Title: [90169] trunk/Source/WebCore
Revision
90169
Author
[email protected]
Date
2011-06-30 15:15:25 -0700 (Thu, 30 Jun 2011)

Log Message

2011-06-30  Levi Weintraub  <[email protected]>

        Reviewed by Eric Seidel.

        Switch paintingRootRect and RenderObject repaint methods to new layout types
        https://bugs.webkit.org/show_bug.cgi?id=63746

        Switching paintingRootRect and RenderObject repaint functions over to the
        new layout unit abstraction.

        No new tests, no functionality changes.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::repaintDuringLayoutIfMoved):
        * rendering/RenderBox.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::paintingRootRect):
        (WebCore::RenderObject::paint):
        (WebCore::RenderObject::repaintUsingContainer):
        (WebCore::RenderObject::repaintRectangle):
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
        (WebCore::RenderObject::repaintDuringLayoutIfMoved):
        * rendering/RenderObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90168 => 90169)


--- trunk/Source/WebCore/ChangeLog	2011-06-30 22:10:32 UTC (rev 90168)
+++ trunk/Source/WebCore/ChangeLog	2011-06-30 22:15:25 UTC (rev 90169)
@@ -1,3 +1,27 @@
+2011-06-30  Levi Weintraub  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Switch paintingRootRect and RenderObject repaint methods to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=63746
+
+        Switching paintingRootRect and RenderObject repaint functions over to the
+        new layout unit abstraction.
+
+        No new tests, no functionality changes.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::repaintDuringLayoutIfMoved):
+        * rendering/RenderBox.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::paintingRootRect):
+        (WebCore::RenderObject::paint):
+        (WebCore::RenderObject::repaintUsingContainer):
+        (WebCore::RenderObject::repaintRectangle):
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
+        (WebCore::RenderObject::repaintDuringLayoutIfMoved):
+        * rendering/RenderObject.h:
+
 2011-06-30  Cary Clark  <[email protected]>
 
         Reviewed by James Robinson.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (90168 => 90169)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-30 22:10:32 UTC (rev 90168)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-30 22:15:25 UTC (rev 90169)
@@ -1513,19 +1513,19 @@
     o->computeRectForRepaint(repaintContainer, rect, fixed);
 }
 
-void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
+void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& rect)
 {
-    int newX = x();
-    int newY = y();
-    int newWidth = width();
-    int newHeight = height();
+    LayoutUnit newX = x();
+    LayoutUnit newY = y();
+    LayoutUnit newWidth = width();
+    LayoutUnit newHeight = height();
     if (rect.x() != newX || rect.y() != newY) {
         // The child moved.  Invalidate the object's old and new positions.  We have to do this
         // since the object may not have gotten a layout.
         m_frameRect = rect;
         repaint();
         repaintOverhangingFloats(true);
-        m_frameRect = IntRect(newX, newY, newWidth, newHeight);
+        m_frameRect = LayoutRect(newX, newY, newWidth, newHeight);
         repaint();
         repaintOverhangingFloats(true);
     }

Modified: trunk/Source/WebCore/rendering/RenderBox.h (90168 => 90169)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-06-30 22:10:32 UTC (rev 90168)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-06-30 22:15:25 UTC (rev 90169)
@@ -283,7 +283,7 @@
     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
 
-    virtual void repaintDuringLayoutIfMoved(const IntRect&);
+    virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
 
     virtual int containingBlockLogicalWidthForContent() const;
     int perpendicularContainingBlockLogicalHeight() const;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (90168 => 90169)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-06-30 22:10:32 UTC (rev 90168)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-06-30 22:15:25 UTC (rev 90169)
@@ -1136,16 +1136,16 @@
         current->addAbsoluteRectForLayer(result);
 }
 
-IntRect RenderObject::paintingRootRect(IntRect& topLevelRect)
+LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect)
 {
-    IntRect result = absoluteBoundingBoxRect();
+    LayoutRect result = absoluteBoundingBoxRect();
     topLevelRect = result;
     for (RenderObject* current = firstChild(); current; current = current->nextSibling())
         current->addAbsoluteRectForLayer(result);
     return result;
 }
 
-void RenderObject::paint(PaintInfo&, const IntPoint&)
+void RenderObject::paint(PaintInfo&, const LayoutPoint&)
 {
 }
 
@@ -1163,7 +1163,7 @@
     return 0;
 }
 
-void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate)
+void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect& r, bool immediate)
 {
     if (!repaintContainer) {
         view()->repaintViewRectangle(r, immediate);
@@ -1176,7 +1176,7 @@
         ASSERT(repaintContainer == v);
         bool viewHasCompositedLayer = v->hasLayer() && v->layer()->isComposited();
         if (!viewHasCompositedLayer || v->layer()->backing()->paintingGoesToWindow()) {
-            IntRect repaintRectangle = r;
+            LayoutRect repaintRectangle = r;
             if (viewHasCompositedLayer &&  v->layer()->transform())
                 repaintRectangle = v->layer()->transform()->mapRect(r);
             v->repaintViewRectangle(repaintRectangle, immediate);
@@ -1208,7 +1208,7 @@
     repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOverflowRectForRepaint(repaintContainer), immediate);
 }
 
-void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
+void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate)
 {
     // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
     RenderView* view;
@@ -1218,7 +1218,7 @@
     if (view->printing())
         return; // Don't repaint if we're printing.
 
-    IntRect dirtyRect(r);
+    LayoutRect dirtyRect(r);
 
     // FIXME: layoutDelta needs to be applied in parts before/after transforms and
     // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
@@ -1229,7 +1229,7 @@
     repaintUsingContainer(repaintContainer ? repaintContainer : view, dirtyRect, immediate);
 }
 
-bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr, const IntRect* newOutlineBoxRectPtr)
+bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr, const LayoutRect* newOutlineBoxRectPtr)
 {
     RenderView* v = view();
     if (v->printing())
@@ -1237,8 +1237,8 @@
 
     // This ASSERT fails due to animations.  See https://bugs.webkit.org/show_bug.cgi?id=37048
     // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(repaintContainer));
-    IntRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
-    IntRect newOutlineBox;
+    LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
+    LayoutRect newOutlineBox;
 
     bool fullRepaint = selfNeedsLayout();
     // Presumably a background or a border exists if border-fit:lines was specified.
@@ -1265,29 +1265,29 @@
     if (newBounds == oldBounds && newOutlineBox == oldOutlineBox)
         return false;
 
-    int deltaLeft = newBounds.x() - oldBounds.x();
+    LayoutUnit deltaLeft = newBounds.x() - oldBounds.x();
     if (deltaLeft > 0)
-        repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
+        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
     else if (deltaLeft < 0)
-        repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
+        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
 
-    int deltaRight = newBounds.maxX() - oldBounds.maxX();
+    LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
     if (deltaRight > 0)
-        repaintUsingContainer(repaintContainer, IntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
+        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
     else if (deltaRight < 0)
-        repaintUsingContainer(repaintContainer, IntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
+        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
 
-    int deltaTop = newBounds.y() - oldBounds.y();
+    LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
     if (deltaTop > 0)
-        repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
+        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
     else if (deltaTop < 0)
-        repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
+        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
 
-    int deltaBottom = newBounds.maxY() - oldBounds.maxY();
+    LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
     if (deltaBottom > 0)
-        repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
+        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
     else if (deltaBottom < 0)
-        repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
+        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
 
     if (newOutlineBox == oldOutlineBox)
         return false;
@@ -1295,40 +1295,40 @@
     // We didn't move, but we did change size.  Invalidate the delta, which will consist of possibly
     // two rectangles (but typically only one).
     RenderStyle* outlineStyle = outlineStyleForRepaint();
-    int ow = outlineStyle->outlineSize();
-    int width = abs(newOutlineBox.width() - oldOutlineBox.width());
+    LayoutUnit ow = outlineStyle->outlineSize();
+    LayoutUnit width = abs(newOutlineBox.width() - oldOutlineBox.width());
     if (width) {
-        int shadowLeft;
-        int shadowRight;
+        LayoutUnit shadowLeft;
+        LayoutUnit shadowRight;
         style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
 
-        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
-        int boxWidth = isBox() ? toRenderBox(this)->width() : 0;
-        int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
-        IntRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
+        LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
+        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : 0;
+        LayoutUnit borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
+        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
             newOutlineBox.y(),
             width + borderWidth,
             max(newOutlineBox.height(), oldOutlineBox.height()));
-        int right = min(newBounds.maxX(), oldBounds.maxX());
+        LayoutUnit right = min(newBounds.maxX(), oldBounds.maxX());
         if (rightRect.x() < right) {
             rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
             repaintUsingContainer(repaintContainer, rightRect);
         }
     }
-    int height = abs(newOutlineBox.height() - oldOutlineBox.height());
+    LayoutUnit height = abs(newOutlineBox.height() - oldOutlineBox.height());
     if (height) {
-        int shadowTop;
-        int shadowBottom;
+        LayoutUnit shadowTop;
+        LayoutUnit shadowBottom;
         style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
 
-        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
-        int boxHeight = isBox() ? toRenderBox(this)->height() : 0;
-        int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
-        IntRect bottomRect(newOutlineBox.x(),
+        LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
+        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : 0;
+        LayoutUnit borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
+        LayoutRect bottomRect(newOutlineBox.x(),
             min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
             max(newOutlineBox.width(), oldOutlineBox.width()),
             height + borderHeight);
-        int bottom = min(newBounds.maxY(), oldBounds.maxY());
+        LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY());
         if (bottomRect.y() < bottom) {
             bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y()));
             repaintUsingContainer(repaintContainer, bottomRect);
@@ -1337,7 +1337,7 @@
     return false;
 }
 
-void RenderObject::repaintDuringLayoutIfMoved(const IntRect&)
+void RenderObject::repaintDuringLayoutIfMoved(const LayoutRect&)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/RenderObject.h (90168 => 90169)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-06-30 22:10:32 UTC (rev 90168)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-06-30 22:15:25 UTC (rev 90169)
@@ -603,7 +603,7 @@
     void absoluteFocusRingQuads(Vector<FloatQuad>&);
 
     // the rect that will be painted if this object is passed as the paintingRoot
-    IntRect paintingRootRect(IntRect& topLevelRect);
+    LayoutRect paintingRootRect(LayoutRect& topLevelRect);
 
     virtual int minPreferredLogicalWidth() const { return 0; }
     virtual int maxPreferredLogicalWidth() const { return 0; }
@@ -629,20 +629,20 @@
     RenderBoxModelObject* containerForRepaint() const;
     // Actually do the repaint of rect r for this object which has been computed in the coordinate space
     // of repaintContainer. If repaintContainer is 0, repaint via the view.
-    void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate = false);
+    void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect&, bool immediate = false);
     
     // Repaint the entire object.  Called when, e.g., the color of a border changes, or when a border
     // style changes.
     void repaint(bool immediate = false);
 
     // Repaint a specific subrectangle within a given object.  The rect |r| is in the object's coordinate space.
-    void repaintRectangle(const IntRect&, bool immediate = false);
+    void repaintRectangle(const LayoutRect&, bool immediate = false);
 
     // Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known.
-    bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr = 0, const IntRect* newOutlineBoxPtr = 0);
+    bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = 0, const LayoutRect* newOutlineBoxPtr = 0);
 
     // Repaint only if the object moved.
-    virtual void repaintDuringLayoutIfMoved(const IntRect& rect);
+    virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
 
     // Called to repaint a block's floats.
     virtual void repaintOverhangingFloats(bool paintAllDescendants = false);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to