Title: [99008] trunk/Source/WebCore
Revision
99008
Author
e...@chromium.org
Date
2011-11-01 16:02:17 -0700 (Tue, 01 Nov 2011)

Log Message

Switch RenderObject to layout abstraction
https://bugs.webkit.org/show_bug.cgi?id=71249

Switch RenderObject to LayoutRect/Size/Point abstraction.

Reviewed by Darin Adler.

No new tests.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::drawLineForBoxSide):
(WebCore::RenderObject::addPDFURLRect):
(WebCore::RenderObject::absoluteBoundingBoxRect):
(WebCore::RenderObject::absoluteFocusRingQuads):
(WebCore::RenderObject::addAbsoluteRectForLayer):
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
(WebCore::RenderObject::computeRectForRepaint):
(WebCore::RenderObject::viewRect):
(WebCore::RenderObject::mapLocalToContainer):
(WebCore::RenderObject::localCaretRect):
(WebCore::RenderObject::addDashboardRegions):
(WebCore::RenderObject::maximalOutlineSize):
(WebCore::RenderObject::adjustRectForOutlineAndShadow):
* rendering/RenderObject.h:
(WebCore::RenderObject::absoluteBoundingBoxRectIgnoringTransforms):
(WebCore::RenderObject::absoluteClippedOverflowRect):
(WebCore::RenderObject::computeAbsoluteRepaintRect):
(WebCore::RenderObject::absoluteOutlineBounds):
(WebCore::RenderObject::outlineBoundsForRepaint):
(WebCore::adjustForAbsoluteZoom):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99007 => 99008)


--- trunk/Source/WebCore/ChangeLog	2011-11-01 23:01:59 UTC (rev 99007)
+++ trunk/Source/WebCore/ChangeLog	2011-11-01 23:02:17 UTC (rev 99008)
@@ -1,3 +1,36 @@
+2011-11-01  Emil A Eklund  <e...@chromium.org>
+
+        Switch RenderObject to layout abstraction
+        https://bugs.webkit.org/show_bug.cgi?id=71249
+
+        Switch RenderObject to LayoutRect/Size/Point abstraction.
+
+        Reviewed by Darin Adler.
+
+        No new tests.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::drawLineForBoxSide):
+        (WebCore::RenderObject::addPDFURLRect):
+        (WebCore::RenderObject::absoluteBoundingBoxRect):
+        (WebCore::RenderObject::absoluteFocusRingQuads):
+        (WebCore::RenderObject::addAbsoluteRectForLayer):
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
+        (WebCore::RenderObject::computeRectForRepaint):
+        (WebCore::RenderObject::viewRect):
+        (WebCore::RenderObject::mapLocalToContainer):
+        (WebCore::RenderObject::localCaretRect):
+        (WebCore::RenderObject::addDashboardRegions):
+        (WebCore::RenderObject::maximalOutlineSize):
+        (WebCore::RenderObject::adjustRectForOutlineAndShadow):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::absoluteBoundingBoxRectIgnoringTransforms):
+        (WebCore::RenderObject::absoluteClippedOverflowRect):
+        (WebCore::RenderObject::computeAbsoluteRepaintRect):
+        (WebCore::RenderObject::absoluteOutlineBounds):
+        (WebCore::RenderObject::outlineBoundsForRepaint):
+        (WebCore::adjustForAbsoluteZoom):
+
 2011-11-01  Xiaomei Ji  <x...@chromium.org>
 
         Refactor: change Scrollable::m_scrollOrigin from protected to private.

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (99007 => 99008)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-11-01 23:01:59 UTC (rev 99007)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-11-01 23:02:17 UTC (rev 99008)
@@ -787,7 +787,7 @@
     return false;
 }
 
-void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
+void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2,
                                       BoxSide side, Color color, EBorderStyle style,
                                       int adjacentWidth1, int adjacentWidth2, bool antialias)
 {
@@ -1097,7 +1097,7 @@
         addPDFURLRect(context, unionRect(focusRingRects));
 }        
 
-void RenderObject::addPDFURLRect(GraphicsContext* context, const IntRect& rect)
+void RenderObject::addPDFURLRect(GraphicsContext* context, const LayoutRect& rect)
 {
     if (rect.isEmpty())
         return;
@@ -1163,7 +1163,7 @@
         graphicsContext->endTransparencyLayer();
 }
 
-IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms) const
+LayoutRect RenderObject::absoluteBoundingBoxRect(bool useTransforms) const
 {
     if (useTransforms) {
         Vector<FloatQuad> quads;
@@ -1173,21 +1173,21 @@
         if (!n)
             return IntRect();
     
-        IntRect result = quads[0].enclosingBoundingBox();
+        LayoutRect result = quads[0].enclosingBoundingBox();
         for (size_t i = 1; i < n; ++i)
             result.unite(quads[i].enclosingBoundingBox());
         return result;
     }
 
     FloatPoint absPos = localToAbsolute();
-    Vector<IntRect> rects;
+    Vector<LayoutRect> rects;
     absoluteRects(rects, flooredLayoutPoint(absPos));
 
     size_t n = rects.size();
     if (!n)
-        return IntRect();
+        return LayoutRect();
 
-    IntRect result = rects[0];
+    LayoutRect result = rects[0];
     for (size_t i = 1; i < n; ++i)
         result.unite(rects[i]);
     return result;
@@ -1195,22 +1195,22 @@
 
 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
 {
-    Vector<IntRect> rects;
+    Vector<LayoutRect> rects;
     // FIXME: addFocusRingRects() needs to be passed this transform-unaware
     // localToAbsolute() offset here because RenderInline::addFocusRingRects()
     // implicitly assumes that. This doesn't work correctly with transformed
     // descendants.
     FloatPoint absolutePoint = localToAbsolute();
-    addFocusRingRects(rects, flooredIntPoint(absolutePoint));
+    addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
     size_t count = rects.size(); 
     for (size_t i = 0; i < count; ++i) {
-        IntRect rect = rects[i];
+        LayoutRect rect = rects[i];
         rect.move(-absolutePoint.x(), -absolutePoint.y());
         quads.append(localToAbsoluteQuad(FloatQuad(rect)));
     }
 }
 
-void RenderObject::addAbsoluteRectForLayer(IntRect& result)
+void RenderObject::addAbsoluteRectForLayer(LayoutRect& result)
 {
     if (hasLayer())
         result.unite(absoluteBoundingBoxRectIgnoringTransforms());
@@ -1399,9 +1399,9 @@
         LayoutUnit shadowRight;
         style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
 
-        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);
+        LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : LayoutUnit(0);
+        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(0);
+        LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderRight, max<LayoutUnit>(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,
@@ -1418,9 +1418,9 @@
         LayoutUnit shadowBottom;
         style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
 
-        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);
+        LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : LayoutUnit(0);
+        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUnit(0);
+        LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max(borderBottom, max<LayoutUnit>(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()),
@@ -1463,7 +1463,7 @@
     return LayoutRect();
 }
 
-void RenderObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed) const
+void RenderObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
 {
     if (repaintContainer == this)
         return;
@@ -1481,10 +1481,10 @@
             // anyway if its size does change.
             RenderBox* boxParent = toRenderBox(o);
 
-            IntRect repaintRect(rect);
+            LayoutRect repaintRect(rect);
             repaintRect.move(-boxParent->layer()->scrolledContentOffset()); // For overflow:auto/scroll/hidden.
 
-            IntRect boxRect(IntPoint(), boxParent->layer()->size());
+            LayoutRect boxRect(LayoutPoint(), boxParent->layer()->size());
             rect = intersection(repaintRect, boxRect);
             if (rect.isEmpty())
                 return;
@@ -1941,7 +1941,7 @@
     }
 }
 
-IntRect RenderObject::viewRect() const
+LayoutRect RenderObject::viewRect() const
 {
     return view()->viewRect();
 }
@@ -1973,12 +1973,12 @@
     if (!o)
         return;
 
-    IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
+    LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint());
     if (o->isBox() && o->style()->isFlippedBlocksWritingMode())
-        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedIntPoint(transformState.mappedPoint())) - centerPoint);
+        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint);
 
-    IntSize columnOffset;
-    o->adjustForColumns(columnOffset, roundedIntPoint(transformState.mappedPoint()));
+    LayoutSize columnOffset;
+    o->adjustForColumns(columnOffset, roundedLayoutPoint(transformState.mappedPoint()));
     if (!columnOffset.isZero())
         transformState.move(columnOffset);
 
@@ -2479,15 +2479,15 @@
     for (i = 0; i < count; i++) {
         StyleDashboardRegion styleRegion = styleRegions[i];
 
-        int w = box->width();
-        int h = box->height();
+        LayoutUnit w = box->width();
+        LayoutUnit h = box->height();
 
         DashboardRegionValue region;
         region.label = styleRegion.label;
-        region.bounds = IntRect(styleRegion.offset.left().value(),
-                                styleRegion.offset.top().value(),
-                                w - styleRegion.offset.left().value() - styleRegion.offset.right().value(),
-                                h - styleRegion.offset.top().value() - styleRegion.offset.bottom().value());
+        region.bounds = LayoutRect(styleRegion.offset.left().value(),
+                                   styleRegion.offset.top().value(),
+                                   w - styleRegion.offset.left().value() - styleRegion.offset.right().value(),
+                                   h - styleRegion.offset.top().value() - styleRegion.offset.bottom().value());
         region.type = styleRegion.type;
 
         region.clip = region.bounds;
@@ -2537,7 +2537,7 @@
     return !document()->inPageCache() && !document()->view()->isOffscreen();
 }
 
-int RenderObject::maximalOutlineSize(PaintPhase p) const
+LayoutUnit RenderObject::maximalOutlineSize(PaintPhase p) const
 {
     if (p != PaintPhaseOutline && p != PaintPhaseSelfOutline && p != PaintPhaseChildOutlines)
         return 0;
@@ -2573,9 +2573,9 @@
     return current + 1;
 }
 
-void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const
+void RenderObject::adjustRectForOutlineAndShadow(LayoutRect& rect) const
 {
-    int outlineSize = outlineStyleForRepaint()->outlineSize();
+    LayoutUnit outlineSize = outlineStyleForRepaint()->outlineSize();
     if (const ShadowData* boxShadow = style()->boxShadow()) {
         boxShadow->adjustRectForShadow(rect, outlineSize);
         return;

Modified: trunk/Source/WebCore/rendering/RenderObject.h (99007 => 99008)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-11-01 23:01:59 UTC (rev 99007)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-11-01 23:02:17 UTC (rev 99008)
@@ -109,8 +109,8 @@
     }
 
     String label;
-    IntRect bounds;
-    IntRect clip;
+    LayoutRect bounds;
+    LayoutRect clip;
     int type;
 };
 #endif
@@ -244,7 +244,7 @@
     }
     //////////////////////////////////////////
 private:
-    void addAbsoluteRectForLayer(IntRect& result);
+    void addAbsoluteRectForLayer(LayoutRect& result);
     void setLayerNeedsFullRepaint();
 
 public:
@@ -646,8 +646,8 @@
     virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint&) const { }
 
     // FIXME: useTransforms should go away eventually
-    IntRect absoluteBoundingBoxRect(bool useTransform = true) const;
-    IntRect absoluteBoundingBoxRectIgnoringTransforms() const { return absoluteBoundingBoxRect(false); }
+    LayoutRect absoluteBoundingBoxRect(bool useTransform = true) const;
+    LayoutRect absoluteBoundingBoxRectIgnoringTransforms() const { return absoluteBoundingBoxRect(false); }
 
     // Build an array of quads in absolute coords for line boxes
     virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) const { }
@@ -704,7 +704,7 @@
 
     // Returns the rect that should be repainted whenever this object changes.  The rect is in the view's
     // coordinate space.  This method deals with outlines and overflow.
-    IntRect absoluteClippedOverflowRect() const
+    LayoutRect absoluteClippedOverflowRect() const
     {
         return clippedOverflowRectForRepaint(0);
     }
@@ -713,13 +713,13 @@
 
     // Given a rect in the object's coordinate space, compute a rect suitable for repainting
     // that rect in view coordinates.
-    void computeAbsoluteRepaintRect(IntRect& r, bool fixed = false) const
+    void computeAbsoluteRepaintRect(LayoutRect& r, bool fixed = false) const
     {
         return computeRectForRepaint(0, r, fixed);
     }
     // Given a rect in the object's coordinate space, compute a rect suitable for repainting
     // that rect in the coordinate space of repaintContainer.
-    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;
+    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
 
     // If multiple-column layout results in applying an offset to the given point, add the same
     // offset to the given size.
@@ -735,7 +735,7 @@
     bool hasReflection() const { return m_hasReflection; }
 
     // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
-    int maximalOutlineSize(PaintPhase) const;
+    LayoutUnit maximalOutlineSize(PaintPhase) const;
 
     void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }
     bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
@@ -843,7 +843,7 @@
     
     virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&) { };
 
-    IntRect absoluteOutlineBounds() const
+    LayoutRect absoluteOutlineBounds() const
     {
         return outlineBoundsForRepaint(0);
     }
@@ -855,21 +855,21 @@
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
     void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
 
-    void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
+    void drawLineForBoxSide(GraphicsContext*, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2, BoxSide,
                             Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
 
     void paintFocusRing(GraphicsContext*, const LayoutPoint&, RenderStyle*);
     void paintOutline(GraphicsContext*, const LayoutRect&);
-    void addPDFURLRect(GraphicsContext*, const IntRect&);
+    void addPDFURLRect(GraphicsContext*, const LayoutRect&);
 
-    virtual IntRect viewRect() const;
+    virtual LayoutRect viewRect() const;
 
-    void adjustRectForOutlineAndShadow(IntRect&) const;
+    void adjustRectForOutlineAndShadow(LayoutRect&) const;
 
     virtual void willBeDestroyed();
     void arenaDelete(RenderArena*, void* objectBase);
 
-    virtual LayoutRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, IntPoint* /*cachedOffsetToRepaintContainer*/ = 0) const { return LayoutRect(); }
+    virtual LayoutRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, LayoutPoint* /*cachedOffsetToRepaintContainer*/ = 0) const { return LayoutRect(); }
 
 private:
     RenderStyle* firstLineStyleSlowCase() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to