Changeset 90169 in webkit


Ignore:
Timestamp:
Jun 30, 2011 3:15:25 PM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-06-30 Levi Weintraub <leviw@chromium.org>

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:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90167 r90169  
     12011-06-30  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch paintingRootRect and RenderObject repaint methods to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63746
     7
     8        Switching paintingRootRect and RenderObject repaint functions over to the
     9        new layout unit abstraction.
     10
     11        No new tests, no functionality changes.
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::repaintDuringLayoutIfMoved):
     15        * rendering/RenderBox.h:
     16        * rendering/RenderObject.cpp:
     17        (WebCore::RenderObject::paintingRootRect):
     18        (WebCore::RenderObject::paint):
     19        (WebCore::RenderObject::repaintUsingContainer):
     20        (WebCore::RenderObject::repaintRectangle):
     21        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
     22        (WebCore::RenderObject::repaintDuringLayoutIfMoved):
     23        * rendering/RenderObject.h:
     24
    1252011-06-30  Cary Clark  <caryclark@google.com>
    226
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r90144 r90169  
    15141514}
    15151515
    1516 void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
    1517 {
    1518     int newX = x();
    1519     int newY = y();
    1520     int newWidth = width();
    1521     int newHeight = height();
     1516void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& rect)
     1517{
     1518    LayoutUnit newX = x();
     1519    LayoutUnit newY = y();
     1520    LayoutUnit newWidth = width();
     1521    LayoutUnit newHeight = height();
    15221522    if (rect.x() != newX || rect.y() != newY) {
    15231523        // The child moved.  Invalidate the object's old and new positions.  We have to do this
     
    15261526        repaint();
    15271527        repaintOverhangingFloats(true);
    1528         m_frameRect = IntRect(newX, newY, newWidth, newHeight);
     1528        m_frameRect = LayoutRect(newX, newY, newWidth, newHeight);
    15291529        repaint();
    15301530        repaintOverhangingFloats(true);
  • trunk/Source/WebCore/rendering/RenderBox.h

    r90144 r90169  
    284284    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
    285285
    286     virtual void repaintDuringLayoutIfMoved(const IntRect&);
     286    virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
    287287
    288288    virtual int containingBlockLogicalWidthForContent() const;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r89754 r90169  
    11371137}
    11381138
    1139 IntRect RenderObject::paintingRootRect(IntRect& topLevelRect)
    1140 {
    1141     IntRect result = absoluteBoundingBoxRect();
     1139LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect)
     1140{
     1141    LayoutRect result = absoluteBoundingBoxRect();
    11421142    topLevelRect = result;
    11431143    for (RenderObject* current = firstChild(); current; current = current->nextSibling())
     
    11461146}
    11471147
    1148 void RenderObject::paint(PaintInfo&, const IntPoint&)
     1148void RenderObject::paint(PaintInfo&, const LayoutPoint&)
    11491149{
    11501150}
     
    11641164}
    11651165
    1166 void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate)
     1166void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect& r, bool immediate)
    11671167{
    11681168    if (!repaintContainer) {
     
    11771177        bool viewHasCompositedLayer = v->hasLayer() && v->layer()->isComposited();
    11781178        if (!viewHasCompositedLayer || v->layer()->backing()->paintingGoesToWindow()) {
    1179             IntRect repaintRectangle = r;
     1179            LayoutRect repaintRectangle = r;
    11801180            if (viewHasCompositedLayer &&  v->layer()->transform())
    11811181                repaintRectangle = v->layer()->transform()->mapRect(r);
     
    12091209}
    12101210
    1211 void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
     1211void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate)
    12121212{
    12131213    // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
     
    12191219        return; // Don't repaint if we're printing.
    12201220
    1221     IntRect dirtyRect(r);
     1221    LayoutRect dirtyRect(r);
    12221222
    12231223    // FIXME: layoutDelta needs to be applied in parts before/after transforms and
     
    12301230}
    12311231
    1232 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr, const IntRect* newOutlineBoxRectPtr)
     1232bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr, const LayoutRect* newOutlineBoxRectPtr)
    12331233{
    12341234    RenderView* v = view();
     
    12381238    // This ASSERT fails due to animations.  See https://bugs.webkit.org/show_bug.cgi?id=37048
    12391239    // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(repaintContainer));
    1240     IntRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
    1241     IntRect newOutlineBox;
     1240    LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
     1241    LayoutRect newOutlineBox;
    12421242
    12431243    bool fullRepaint = selfNeedsLayout();
     
    12661266        return false;
    12671267
    1268     int deltaLeft = newBounds.x() - oldBounds.x();
     1268    LayoutUnit deltaLeft = newBounds.x() - oldBounds.x();
    12691269    if (deltaLeft > 0)
    1270         repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
     1270        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
    12711271    else if (deltaLeft < 0)
    1272         repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
    1273 
    1274     int deltaRight = newBounds.maxX() - oldBounds.maxX();
     1272        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
     1273
     1274    LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
    12751275    if (deltaRight > 0)
    1276         repaintUsingContainer(repaintContainer, IntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
     1276        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
    12771277    else if (deltaRight < 0)
    1278         repaintUsingContainer(repaintContainer, IntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
    1279 
    1280     int deltaTop = newBounds.y() - oldBounds.y();
     1278        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
     1279
     1280    LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
    12811281    if (deltaTop > 0)
    1282         repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
     1282        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
    12831283    else if (deltaTop < 0)
    1284         repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
    1285 
    1286     int deltaBottom = newBounds.maxY() - oldBounds.maxY();
     1284        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
     1285
     1286    LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
    12871287    if (deltaBottom > 0)
    1288         repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
     1288        repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
    12891289    else if (deltaBottom < 0)
    1290         repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
     1290        repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
    12911291
    12921292    if (newOutlineBox == oldOutlineBox)
     
    12961296    // two rectangles (but typically only one).
    12971297    RenderStyle* outlineStyle = outlineStyleForRepaint();
    1298     int ow = outlineStyle->outlineSize();
    1299     int width = abs(newOutlineBox.width() - oldOutlineBox.width());
     1298    LayoutUnit ow = outlineStyle->outlineSize();
     1299    LayoutUnit width = abs(newOutlineBox.width() - oldOutlineBox.width());
    13001300    if (width) {
    1301         int shadowLeft;
    1302         int shadowRight;
     1301        LayoutUnit shadowLeft;
     1302        LayoutUnit shadowRight;
    13031303        style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
    13041304
    1305         int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
    1306         int boxWidth = isBox() ? toRenderBox(this)->width() : 0;
    1307         int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
    1308         IntRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
     1305        LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
     1306        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : 0;
     1307        LayoutUnit borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
     1308        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
    13091309            newOutlineBox.y(),
    13101310            width + borderWidth,
    13111311            max(newOutlineBox.height(), oldOutlineBox.height()));
    1312         int right = min(newBounds.maxX(), oldBounds.maxX());
     1312        LayoutUnit right = min(newBounds.maxX(), oldBounds.maxX());
    13131313        if (rightRect.x() < right) {
    13141314            rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
     
    13161316        }
    13171317    }
    1318     int height = abs(newOutlineBox.height() - oldOutlineBox.height());
     1318    LayoutUnit height = abs(newOutlineBox.height() - oldOutlineBox.height());
    13191319    if (height) {
    1320         int shadowTop;
    1321         int shadowBottom;
     1320        LayoutUnit shadowTop;
     1321        LayoutUnit shadowBottom;
    13221322        style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
    13231323
    1324         int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
    1325         int boxHeight = isBox() ? toRenderBox(this)->height() : 0;
    1326         int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
    1327         IntRect bottomRect(newOutlineBox.x(),
     1324        LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
     1325        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : 0;
     1326        LayoutUnit borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
     1327        LayoutRect bottomRect(newOutlineBox.x(),
    13281328            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight,
    13291329            max(newOutlineBox.width(), oldOutlineBox.width()),
    13301330            height + borderHeight);
    1331         int bottom = min(newBounds.maxY(), oldBounds.maxY());
     1331        LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY());
    13321332        if (bottomRect.y() < bottom) {
    13331333            bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y()));
     
    13381338}
    13391339
    1340 void RenderObject::repaintDuringLayoutIfMoved(const IntRect&)
     1340void RenderObject::repaintDuringLayoutIfMoved(const LayoutRect&)
    13411341{
    13421342}
  • trunk/Source/WebCore/rendering/RenderObject.h

    r90048 r90169  
    604604
    605605    // the rect that will be painted if this object is passed as the paintingRoot
    606     IntRect paintingRootRect(IntRect& topLevelRect);
     606    LayoutRect paintingRootRect(LayoutRect& topLevelRect);
    607607
    608608    virtual int minPreferredLogicalWidth() const { return 0; }
     
    630630    // Actually do the repaint of rect r for this object which has been computed in the coordinate space
    631631    // of repaintContainer. If repaintContainer is 0, repaint via the view.
    632     void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate = false);
     632    void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect&, bool immediate = false);
    633633   
    634634    // Repaint the entire object.  Called when, e.g., the color of a border changes, or when a border
     
    637637
    638638    // Repaint a specific subrectangle within a given object.  The rect |r| is in the object's coordinate space.
    639     void repaintRectangle(const IntRect&, bool immediate = false);
     639    void repaintRectangle(const LayoutRect&, bool immediate = false);
    640640
    641641    // Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known.
    642     bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr = 0, const IntRect* newOutlineBoxPtr = 0);
     642    bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = 0, const LayoutRect* newOutlineBoxPtr = 0);
    643643
    644644    // Repaint only if the object moved.
    645     virtual void repaintDuringLayoutIfMoved(const IntRect& rect);
     645    virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
    646646
    647647    // Called to repaint a block's floats.
Note: See TracChangeset for help on using the changeset viewer.