Title: [107311] branches/subpixellayout/Source/WebCore/rendering
Revision
107311
Author
[email protected]
Date
2012-02-09 16:54:41 -0800 (Thu, 09 Feb 2012)

Log Message

Removing an unnecessary parameter from LayoutPainter and switching it to use pixelSnapped instead of enclosingIntRect. This fixes some unnecessary repaints.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.cpp (107310 => 107311)


--- branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.cpp	2012-02-10 00:42:46 UTC (rev 107310)
+++ branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.cpp	2012-02-10 00:54:41 UTC (rev 107311)
@@ -30,15 +30,15 @@
 
 namespace WebCore {
 
-LayoutRepainter::LayoutRepainter(RenderObject& object, bool checkForRepaint, const IntRect* oldBounds)
+LayoutRepainter::LayoutRepainter(RenderObject& object, bool checkForRepaint)
     : m_object(object)
     , m_repaintContainer(0)
     , m_checkForRepaint(checkForRepaint)
 {
     if (m_checkForRepaint) {
         m_repaintContainer = m_object.containerForRepaint();
-        m_oldBounds = oldBounds ? *oldBounds : enclosingIntRect(m_object.clippedOverflowRectForRepaint(m_repaintContainer));
-        m_oldOutlineBox = enclosingIntRect(m_object.outlineBoundsForRepaint(m_repaintContainer));
+        m_oldBounds = pixelSnappedIntRect(m_object.clippedOverflowRectForRepaint(m_repaintContainer));
+        m_oldOutlineBox = pixelSnappedIntRect(m_object.outlineBoundsForRepaint(m_repaintContainer));
     }
 }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.h (107310 => 107311)


--- branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.h	2012-02-10 00:42:46 UTC (rev 107310)
+++ branches/subpixellayout/Source/WebCore/rendering/LayoutRepainter.h	2012-02-10 00:54:41 UTC (rev 107311)
@@ -35,7 +35,7 @@
 
 class LayoutRepainter {
 public:
-    LayoutRepainter(RenderObject&, bool checkForRepaint, const IntRect* oldBounds = 0);
+    LayoutRepainter(RenderObject&, bool checkForRepaint);
 
     bool checkForRepaint() const { return m_checkForRepaint; }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp (107310 => 107311)


--- branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp	2012-02-10 00:42:46 UTC (rev 107310)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderLayer.cpp	2012-02-10 00:54:41 UTC (rev 107311)
@@ -438,8 +438,8 @@
     ASSERT(!m_visibleContentStatusDirty);
 
     RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
-    m_repaintRect = enclosingIntRect(renderer()->clippedOverflowRectForRepaint(repaintContainer));
-    m_outlineBox = enclosingIntRect(renderer()->outlineBoundsForRepaint(repaintContainer, offsetFromRoot));
+    m_repaintRect = pixelSnappedIntRect(renderer()->clippedOverflowRectForRepaint(repaintContainer));
+    m_outlineBox = pixelSnappedIntRect(renderer()->outlineBoundsForRepaint(repaintContainer, offsetFromRoot));
 }
 
 void RenderLayer::clearRepaintRects()

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp (107310 => 107311)


--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2012-02-10 00:42:46 UTC (rev 107310)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2012-02-10 00:54:41 UTC (rev 107311)
@@ -1357,8 +1357,8 @@
 
     // This ASSERT fails due to animations.  See https://bugs.webkit.org/show_bug.cgi?id=37048
     // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(repaintContainer));
-    LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
-    LayoutRect newOutlineBox;
+    IntRect newBounds = newBoundsPtr ? *newBoundsPtr : pixelSnappedIntRect(clippedOverflowRectForRepaint(repaintContainer));
+    IntRect newOutlineBox;
 
     bool fullRepaint = selfNeedsLayout();
     // Presumably a background or a border exists if border-fit:lines was specified.
@@ -1367,7 +1367,7 @@
     if (!fullRepaint) {
         // This ASSERT fails due to animations.  See https://bugs.webkit.org/show_bug.cgi?id=37048
         // ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBoundsForRepaint(repaintContainer));
-        newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBoundsForRepaint(repaintContainer);
+        newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : pixelSnappedIntRect(outlineBoundsForRepaint(repaintContainer));
         if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaintBackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBox)))
             fullRepaint = true;
     }
@@ -1385,25 +1385,25 @@
     if (newBounds == oldBounds && newOutlineBox == oldOutlineBox)
         return false;
 
-    LayoutUnit deltaLeft = newBounds.x() - oldBounds.x();
+    int deltaLeft = newBounds.x() - oldBounds.x();
     if (deltaLeft > 0)
         repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
     else if (deltaLeft < 0)
         repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
 
-    LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
+    int deltaRight = newBounds.maxX() - oldBounds.maxX();
     if (deltaRight > 0)
         repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
     else if (deltaRight < 0)
         repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
 
-    LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
+    int deltaTop = newBounds.y() - oldBounds.y();
     if (deltaTop > 0)
         repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
     else if (deltaTop < 0)
         repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
 
-    LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
+    int deltaBottom = newBounds.maxY() - oldBounds.maxY();
     if (deltaBottom > 0)
         repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
     else if (deltaBottom < 0)
@@ -1416,7 +1416,7 @@
     // two rectangles (but typically only one).
     RenderStyle* outlineStyle = outlineStyleForRepaint();
     LayoutUnit ow = outlineStyle->outlineSize();
-    LayoutUnit width = (newOutlineBox.width() - oldOutlineBox.width()).abs();
+    LayoutUnit width = abs(newOutlineBox.width() - oldOutlineBox.width());
     if (width) {
         LayoutUnit shadowLeft;
         LayoutUnit shadowRight;
@@ -1435,7 +1435,7 @@
             repaintUsingContainer(repaintContainer, rightRect);
         }
     }
-    LayoutUnit height = (newOutlineBox.height() - oldOutlineBox.height()).abs();
+    LayoutUnit height = abs(newOutlineBox.height() - oldOutlineBox.height());
     if (height) {
         LayoutUnit shadowTop;
         LayoutUnit shadowBottom;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to