Title: [109246] trunk/Source/WebCore
Revision
109246
Author
jchaffr...@webkit.org
Date
2012-02-29 12:49:49 -0800 (Wed, 29 Feb 2012)

Log Message

Stop doubling maximalOutlineSize during painting
https://bugs.webkit.org/show_bug.cgi?id=79724

Reviewed by Tony Chang.

Refactoring only, covered by existing tests (mostly repaint ones).

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorders):
Introduce a local repaint rectangle that we inflate by the maximalOutlineSize
to simplify the comparison logic. Also tried to make it clearer what's going on
by tweaking the existing code.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintObject):
Remove the doubling.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109245 => 109246)


--- trunk/Source/WebCore/ChangeLog	2012-02-29 20:40:10 UTC (rev 109245)
+++ trunk/Source/WebCore/ChangeLog	2012-02-29 20:49:49 UTC (rev 109246)
@@ -1,3 +1,24 @@
+2012-02-29  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        Stop doubling maximalOutlineSize during painting
+        https://bugs.webkit.org/show_bug.cgi?id=79724
+
+        Reviewed by Tony Chang.
+
+        Refactoring only, covered by existing tests (mostly repaint ones).
+
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldPaint):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        Introduce a local repaint rectangle that we inflate by the maximalOutlineSize
+        to simplify the comparison logic. Also tried to make it clearer what's going on
+        by tweaking the existing code.
+
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::paintObject):
+        Remove the doubling.
+
 2012-02-29  Ken Buchanan  <ke...@chromium.org>
 
         Crash when changing list marker locations

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (109245 => 109246)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-02-29 20:40:10 UTC (rev 109245)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-02-29 20:49:49 UTC (rev 109246)
@@ -196,10 +196,12 @@
         bottom = max(selBottom, bottom);
     }
     
-    LayoutUnit os = 2 * maximalOutlineSize(paintInfo.phase);
-    if (adjustedPaintOffset.x() + minXVisualOverflow() >= paintInfo.rect.maxX() + os || adjustedPaintOffset.x() + maxXVisualOverflow() <= paintInfo.rect.x() - os)
+    LayoutRect localRepaintRect = paintInfo.rect;
+    localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
+    if (adjustedPaintOffset.x() + minXVisualOverflow() >= localRepaintRect.maxX() || adjustedPaintOffset.x() + maxXVisualOverflow() <= localRepaintRect.x())
         return false;
-    if (top >= paintInfo.rect.maxY() + os || bottom <= paintInfo.rect.y() - os)
+
+    if (top >= localRepaintRect.maxY() || bottom <= localRepaintRect.y())
         return false;
 
     return true;

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (109245 => 109246)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-02-29 20:40:10 UTC (rev 109245)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-02-29 20:49:49 UTC (rev 109246)
@@ -960,18 +960,20 @@
     if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE)
         return;
 
-    LayoutPoint adjustedPaintOffset = paintOffset + location();
-    LayoutUnit os = 2 * maximalOutlineSize(paintInfo.phase);
-    if (!(adjustedPaintOffset.y() - table()->outerBorderTop() < paintInfo.rect.maxY() + os
-        && adjustedPaintOffset.y() + height() + table()->outerBorderBottom() > paintInfo.rect.y() - os))
+    LayoutRect localRepaintRect = paintInfo.rect;
+    localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
+
+    LayoutRect paintRect = LayoutRect(paintOffset + location(), size());
+    if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY())
         return;
 
+    if (paintRect.maxY() + table()->outerBorderBottom() <= localRepaintRect.y())
+        return;
+
     GraphicsContext* graphicsContext = paintInfo.context;
     if (!table()->currentBorderValue() || graphicsContext->paintingDisabled())
         return;
 
-    LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
-
     RenderStyle* tableStyle = table()->style();
     CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(tableStyle);
     CollapsedBorderValue rightVal = cachedCollapsedRightBorder(tableStyle);

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (109245 => 109246)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2012-02-29 20:40:10 UTC (rev 109245)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2012-02-29 20:49:49 UTC (rev 109246)
@@ -1060,9 +1060,7 @@
             localRepaintRect.setX(width() - localRepaintRect.maxX());
     }
 
-    // FIXME: Why do we double the outline size?
-    LayoutUnit outlineSize = 2 * maximalOutlineSize(paintPhase);
-    localRepaintRect.inflate(outlineSize);
+    localRepaintRect.inflate(maximalOutlineSize(paintPhase));
 
     CellSpan dirtiedRows = this->dirtiedRows(localRepaintRect);
     CellSpan dirtiedColumns = this->dirtiedColumns(localRepaintRect);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to