From cfa7416254ad623139de04d4fca7cea25955318b Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sun, 29 Aug 1999 03:25:56 +0000 Subject: [PATCH] Fix for bug #12751. Optimized PaintBorder() so if the dirty rect is completely inside of the border rect, then we don't paint anything. This speed up incremental painting git-svn-id: svn://10.0.0.236/trunk@45026 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSRendering.cpp | 8 ++++++++ mozilla/layout/html/style/src/nsCSSRendering.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 53ecf95dc20..a7d5b6da1cb 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -1410,9 +1410,17 @@ void nsCSSRendering::PaintBorder(nsIPresContext& aPresContext, if (0 == border.bottom) aSkipSides |= (1 << NS_SIDE_BOTTOM); if (0 == border.left) aSkipSides |= (1 << NS_SIDE_LEFT); + // XXX These are misnamed. Why is it that 'outside' is inside of + // 'inside' (it's produced by deflating)? nsRect inside(aBorderArea); nsRect outside(inside); outside.Deflate(border); + + // If the dirty rect is completely inside the border area (e.g., only the + // content is being painted), then we can skip out now + if (outside.Contains(aDirtyRect)) { + return; + } //see if any sides are dotted or dashed for (cnt = 0; cnt < 4; cnt++) { diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 53ecf95dc20..a7d5b6da1cb 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -1410,9 +1410,17 @@ void nsCSSRendering::PaintBorder(nsIPresContext& aPresContext, if (0 == border.bottom) aSkipSides |= (1 << NS_SIDE_BOTTOM); if (0 == border.left) aSkipSides |= (1 << NS_SIDE_LEFT); + // XXX These are misnamed. Why is it that 'outside' is inside of + // 'inside' (it's produced by deflating)? nsRect inside(aBorderArea); nsRect outside(inside); outside.Deflate(border); + + // If the dirty rect is completely inside the border area (e.g., only the + // content is being painted), then we can skip out now + if (outside.Contains(aDirtyRect)) { + return; + } //see if any sides are dotted or dashed for (cnt = 0; cnt < 4; cnt++) {