Changeset 88264 in webkit


Ignore:
Timestamp:
Jun 7, 2011 2:06:26 PM (13 years ago)
Author:
eae@chromium.org
Message:

2011-06-07 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Switch ContainerNode to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=61893

Covered by existing tests.

  • dom/ContainerNode.cpp: (WebCore::ContainerNode::getUpperLeftCorner): (WebCore::ContainerNode::getLowerRightCorner): (WebCore::ContainerNode::getRect): Change to use maxX/maxY instead of x+width/y+height
  • platform/graphics/FloatPoint.h: (WebCore::FloatPoint::move): (WebCore::FloatPoint::moveBy): (WebCore::FloatPoint::expandedTo): Add move, moveBy and expandedTo mirroring the IntPoint implementation of the same.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88263 r88264  
     12011-06-07  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch ContainerNode to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=61893
     7
     8        Covered by existing tests.
     9
     10        * dom/ContainerNode.cpp:
     11        (WebCore::ContainerNode::getUpperLeftCorner):
     12        (WebCore::ContainerNode::getLowerRightCorner):
     13        (WebCore::ContainerNode::getRect):
     14        Change to use maxX/maxY instead of x+width/y+height
     15       
     16        * platform/graphics/FloatPoint.h:
     17        (WebCore::FloatPoint::move):
     18        (WebCore::FloatPoint::moveBy):
     19        (WebCore::FloatPoint::expandedTo):
     20        Add move, moveBy and expandedTo mirroring the IntPoint implementation of the same.
     21
    1222011-06-07  Ryosuke Niwa  <rniwa@webkit.org>
    223
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r87128 r88264  
    879879            } else if (o->isBox()) {
    880880                RenderBox* box = toRenderBox(o);
    881                 point.move(box->x(), box->y());
     881                point.moveBy(box->location());
    882882            }
    883883            point = o->container()->localToAbsolute(point, false, true);
     
    905905        RenderBox* box = toRenderBox(o);
    906906        point = o->localToAbsolute(FloatPoint(), false, true);
    907         point.move(box->width(), box->height());
     907        point.move(box->size());
    908908        return true;
    909909    }
     
    931931                RenderText* text = toRenderText(o);
    932932                IntRect linesBox = text->linesBoundingBox();
    933                 if (!linesBox.x() && !linesBox.width() && !linesBox.y() && !linesBox.height())
     933                if (!linesBox.maxX() && !linesBox.maxY())
    934934                    continue;
    935                 point.move(linesBox.x() + linesBox.width(), linesBox.y() + linesBox.height());
     935                point.moveBy(linesBox.maxXMaxYCorner());
    936936            } else {
    937937                RenderBox* box = toRenderBox(o);
    938                 point.move(box->x() + box->width(), box->y() + box->height());
     938                point.moveBy(box->frameRect().maxXMaxYCorner());
    939939            }
    940940            point = o->container()->localToAbsolute(point, false, true);
     
    960960    }
    961961
    962     lowerRight.setX(max(upperLeft.x(), lowerRight.x()));
    963     lowerRight.setY(max(upperLeft.y(), lowerRight.y()));
    964    
    965     return enclosingIntRect(FloatRect(upperLeft, lowerRight - upperLeft));
     962    return enclosingIntRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
    966963}
    967964
  • trunk/Source/WebCore/platform/graphics/FloatPoint.h

    r87880 r88264  
    9292        m_y += dy;
    9393    }
     94    void move(const IntSize& a)
     95    {
     96        m_x += a.width();
     97        m_y += a.height();
     98    }
     99    void moveBy(const IntPoint& a)
     100    {
     101        m_x += a.x();
     102        m_y += a.y();
     103    }
    94104    void scale(float sx, float sy)
    95105    {
     
    110120        return m_x * m_x + m_y * m_y;
    111121    }
     122
     123    FloatPoint expandedTo(const FloatPoint& other) const
     124    {
     125        return FloatPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
     126    }   
    112127
    113128#if USE(CG) || USE(SKIA_ON_MAC_CHROME)
Note: See TracChangeset for help on using the changeset viewer.