Title: [93837] trunk/Source/WebCore
Revision
93837
Author
[email protected]
Date
2011-08-25 16:39:57 -0700 (Thu, 25 Aug 2011)

Log Message

Concentrate RenderLayer repaint rects updates
https://bugs.webkit.org/show_bug.cgi?id=64993

Reviewed by David Hyatt.

The change moves the update of the repaint rects to 2 methods
(computeRepaintRects and clearRepaintRects) to better track
those changes.

No new test, refactoring covered by the existing test cases.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions): Reverse the logic and
calculate the new bounds upfront. This should have no impact as none
of the methods rely on the internal value.

(WebCore::RenderLayer::computeRepaintRects): Added the cachedOffset parameter
to avoid breaking the performance optimization in updateLayerPositions. Added
some ASSERTS.

(WebCore::RenderLayer::clearRepaintRects): Added some ASSERTs here.
(WebCore::RenderLayer::updateRepaintRectsAfterScroll): Added a FIXME as this
method could use the cachedOffset trick too.

(WebCore::RenderLayer::setHasVisibleContent): Changed the code to use
computeRepaintRects.

* rendering/RenderLayer.h: Updated the signature of computeRepaintRects and moved
those 2 methods into the private section of the class.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93836 => 93837)


--- trunk/Source/WebCore/ChangeLog	2011-08-25 23:33:10 UTC (rev 93836)
+++ trunk/Source/WebCore/ChangeLog	2011-08-25 23:39:57 UTC (rev 93837)
@@ -1,3 +1,35 @@
+2011-08-25  Julien Chaffraix  <[email protected]>
+
+        Concentrate RenderLayer repaint rects updates
+        https://bugs.webkit.org/show_bug.cgi?id=64993
+
+        Reviewed by David Hyatt.
+
+        The change moves the update of the repaint rects to 2 methods
+        (computeRepaintRects and clearRepaintRects) to better track
+        those changes.
+
+        No new test, refactoring covered by the existing test cases.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositions): Reverse the logic and
+        calculate the new bounds upfront. This should have no impact as none
+        of the methods rely on the internal value.
+
+        (WebCore::RenderLayer::computeRepaintRects): Added the cachedOffset parameter
+        to avoid breaking the performance optimization in updateLayerPositions. Added
+        some ASSERTS.
+
+        (WebCore::RenderLayer::clearRepaintRects): Added some ASSERTs here.
+        (WebCore::RenderLayer::updateRepaintRectsAfterScroll): Added a FIXME as this
+        method could use the cachedOffset trick too.
+
+        (WebCore::RenderLayer::setHasVisibleContent): Changed the code to use
+        computeRepaintRects.
+
+        * rendering/RenderLayer.h: Updated the signature of computeRepaintRects and moved
+        those 2 methods into the private section of the class.
+
 2011-08-25  Van Lam  <[email protected]>
 
         Remove use of magic number -1 in WebCore/editing/visible_units.cpp

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (93836 => 93837)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-25 23:33:10 UTC (rev 93836)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-25 23:39:57 UTC (rev 93837)
@@ -309,26 +309,23 @@
         ASSERT(!view->layoutStateEnabled());
 
         RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
-        LayoutRect newRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
-        LayoutRect newOutlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, cachedOffset);
-        // FIXME: Should ASSERT that value calculated for newOutlineBox using the cached offset is the same
+        IntRect oldRepaintRect = m_repaintRect;
+        IntRect oldOutlineBox = m_outlineBox;
+        computeRepaintRects();
+        // FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
         // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
         if (flags & CheckForRepaint) {
             if (view && !view->printing()) {
                 if (m_needsFullRepaint) {
-                    renderer()->repaintUsingContainer(repaintContainer, m_repaintRect);
-                    if (newRect != m_repaintRect)
-                        renderer()->repaintUsingContainer(repaintContainer, newRect);
+                    renderer()->repaintUsingContainer(repaintContainer, oldRepaintRect);
+                    if (m_repaintRect != oldRepaintRect)
+                        renderer()->repaintUsingContainer(repaintContainer, m_repaintRect);
                 } else
-                    renderer()->repaintAfterLayoutIfNeeded(repaintContainer, m_repaintRect, m_outlineBox, &newRect, &newOutlineBox);
+                    renderer()->repaintAfterLayoutIfNeeded(repaintContainer, oldRepaintRect, oldOutlineBox, &m_repaintRect, &m_outlineBox);
             }
         }
-        m_repaintRect = newRect;
-        m_outlineBox = newOutlineBox;
-    } else {
-        m_repaintRect = LayoutRect();
-        m_outlineBox = LayoutRect();
-    }
+    } else
+        clearRepaintRects();
 
     m_needsFullRepaint = false;
 
@@ -370,18 +367,31 @@
     return repaintRect;
 }
 
-void RenderLayer::computeRepaintRects()
+void RenderLayer::computeRepaintRects(IntPoint* cachedOffset)
 {
-    RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
-    m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
-    m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer);
+    ASSERT(m_hasVisibleContent);
+    ASSERT(!m_visibleContentStatusDirty);
+
+     RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
+     m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
+    m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, cachedOffset);
 }
 
+void RenderLayer::clearRepaintRects()
+{
+    ASSERT(!m_hasVisibleContent);
+    ASSERT(!m_visibleContentStatusDirty);
+
+    m_repaintRect = IntRect();
+    m_outlineBox = IntRect();
+}
+
 void RenderLayer::updateLayerPositionsAfterScroll(bool fixed)
 {
     updateLayerPosition();
 
     if (fixed || renderer()->style()->position() == FixedPosition) {
+        // FIXME: Is it worth passing the cachedOffset around like in updateLayerPositions?
         computeRepaintRects();
         fixed = true;
     } else if (renderer()->hasTransform() && !renderer()->isRenderView()) {
@@ -514,9 +524,7 @@
     m_visibleContentStatusDirty = false; 
     m_hasVisibleContent = b;
     if (m_hasVisibleContent) {
-        RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
-        m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
-        m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer);
+        computeRepaintRects();
         if (!isNormalFlowOnly()) {
             for (RenderLayer* sc = stackingContext(); sc; sc = sc->stackingContext()) {
                 sc->dirtyZOrderLists();

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (93836 => 93837)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-25 23:33:10 UTC (rev 93836)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-25 23:39:57 UTC (rev 93837)
@@ -403,7 +403,6 @@
     // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
     LayoutRect repaintRect() const { return m_repaintRect; }
     LayoutRect repaintRectIncludingDescendants() const;
-    void computeRepaintRects();
     void updateLayerPositionsAfterScroll(bool fixed = false);
     void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
     
@@ -461,6 +460,9 @@
     void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDirtyOverlayScrollbars = dirtyScrollbars; }
 
 private:
+    void computeRepaintRects(IntPoint* cachedOffset = 0);
+    void clearRepaintRects();
+
     // The normal operator new is disallowed on all render objects.
     void* operator new(size_t) throw();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to