Changeset 90250 in webkit


Ignore:
Timestamp:
Jul 1, 2011 11:33:25 AM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-07-01 Levi Weintraub <leviw@chromium.org>

Reviewed by Eric Seidel.

Switch positionForPoint to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63774

Switching positionForPoint functions to new layout unit abstraction.

No new tests, no functionality changes.

  • rendering/RenderBR.cpp: (WebCore::RenderBR::positionForPoint):
  • rendering/RenderBR.h:
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::positionForPoint):
  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp: (WebCore::RenderBox::positionForPoint):
  • rendering/RenderBox.h:
  • rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::positionForPoint):
  • rendering/RenderFileUploadControl.h:
  • rendering/RenderInline.cpp: (WebCore::RenderInline::positionForPoint):
  • rendering/RenderInline.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::positionForPoint):
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::positionForPoint):
  • rendering/RenderReplaced.h:
  • rendering/RenderText.cpp: (WebCore::RenderText::positionForPoint):
  • rendering/RenderText.h:
  • rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlInnerBlock::positionForPoint):
  • rendering/RenderTextControlSingleLine.h:
  • rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::positionForPoint):
  • rendering/svg/RenderSVGInlineText.h:
  • rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::positionForPoint):
  • rendering/svg/RenderSVGText.h:
Location:
trunk/Source/WebCore
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90249 r90250  
     12011-07-01  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch positionForPoint to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63774
     7
     8        Switching positionForPoint functions to new layout unit abstraction.
     9
     10        No new tests, no functionality changes.
     11
     12        * rendering/RenderBR.cpp:
     13        (WebCore::RenderBR::positionForPoint):
     14        * rendering/RenderBR.h:
     15        * rendering/RenderBlock.cpp:
     16        (WebCore::RenderBlock::positionForPoint):
     17        * rendering/RenderBlock.h:
     18        * rendering/RenderBox.cpp:
     19        (WebCore::RenderBox::positionForPoint):
     20        * rendering/RenderBox.h:
     21        * rendering/RenderFileUploadControl.cpp:
     22        (WebCore::RenderFileUploadControl::positionForPoint):
     23        * rendering/RenderFileUploadControl.h:
     24        * rendering/RenderInline.cpp:
     25        (WebCore::RenderInline::positionForPoint):
     26        * rendering/RenderInline.h:
     27        * rendering/RenderObject.cpp:
     28        (WebCore::RenderObject::positionForPoint):
     29        * rendering/RenderReplaced.cpp:
     30        (WebCore::RenderReplaced::positionForPoint):
     31        * rendering/RenderReplaced.h:
     32        * rendering/RenderText.cpp:
     33        (WebCore::RenderText::positionForPoint):
     34        * rendering/RenderText.h:
     35        * rendering/RenderTextControlSingleLine.cpp:
     36        (WebCore::RenderTextControlInnerBlock::positionForPoint):
     37        * rendering/RenderTextControlSingleLine.h:
     38        * rendering/svg/RenderSVGInlineText.cpp:
     39        (WebCore::RenderSVGInlineText::positionForPoint):
     40        * rendering/svg/RenderSVGInlineText.h:
     41        * rendering/svg/RenderSVGText.cpp:
     42        (WebCore::RenderSVGText::positionForPoint):
     43        * rendering/svg/RenderSVGText.h:
     44
    1452011-07-01  Andrew Scherkus  <scherkus@chromium.org>
    246
  • trunk/Source/WebCore/rendering/RenderBR.cpp

    r70072 r90250  
    7474}
    7575
    76 VisiblePosition RenderBR::positionForPoint(const IntPoint&)
     76VisiblePosition RenderBR::positionForPoint(const LayoutPoint&)
    7777{
    7878    return createVisiblePosition(0, DOWNSTREAM);
  • trunk/Source/WebCore/rendering/RenderBR.h

    r78846 r90250  
    5353    virtual unsigned caretMaxRenderedOffset() const;
    5454
    55     virtual VisiblePosition positionForPoint(const IntPoint&);
     55    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    5656
    5757protected:
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r90144 r90250  
    42034203}
    42044204
    4205 VisiblePosition RenderBlock::positionForPoint(const IntPoint& point)
     4205VisiblePosition RenderBlock::positionForPoint(const LayoutPoint& point)
    42064206{
    42074207    if (isTable())
     
    42104210    if (isReplaced()) {
    42114211        // FIXME: This seems wrong when the object's writing-mode doesn't match the line's writing-mode.
    4212         int pointLogicalLeft = isHorizontalWritingMode() ? point.x() : point.y();
    4213         int pointLogicalTop = isHorizontalWritingMode() ? point.y() : point.x();
     4212        LayoutUnit pointLogicalLeft = isHorizontalWritingMode() ? point.x() : point.y();
     4213        LayoutUnit pointLogicalTop = isHorizontalWritingMode() ? point.y() : point.x();
    42144214
    42154215        if (pointLogicalTop < 0 || (pointLogicalTop < logicalHeight() && pointLogicalLeft < 0))
     
    42194219    }
    42204220
    4221     IntPoint pointInContents = point;
     4221    LayoutPoint pointInContents = point;
    42224222    offsetForContents(pointInContents);
    4223     IntPoint pointInLogicalContents(pointInContents);
     4223    LayoutPoint pointInLogicalContents(pointInContents);
    42244224    if (!isHorizontalWritingMode())
    42254225        pointInLogicalContents = pointInLogicalContents.transposedPoint();
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r90144 r90250  
    121121    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalRightOffsetForLine(position, firstLine); }
    122122
    123     virtual VisiblePosition positionForPoint(const IntPoint&);
     123    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    124124   
    125125    // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r90186 r90250  
    30963096}
    30973097
    3098 VisiblePosition RenderBox::positionForPoint(const IntPoint& point)
     3098VisiblePosition RenderBox::positionForPoint(const LayoutPoint& point)
    30993099{
    31003100    // no children...return this render object's element, if there is one, and offset 0
     
    31023102        return createVisiblePosition(node() ? firstPositionInOrBeforeNode(node()) : Position());
    31033103
    3104     int xPos = point.x();
    3105     int yPos = point.y();
    3106 
    31073104    if (isTable() && node()) {
    3108         int right = contentWidth() + borderAndPaddingWidth();
    3109         int bottom = contentHeight() + borderAndPaddingHeight();
     3105        LayoutUnit right = contentWidth() + borderAndPaddingWidth();
     3106        LayoutUnit bottom = contentHeight() + borderAndPaddingHeight();
    31103107       
    31113108        if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > bottom) {
     
    31173114
    31183115    // Pass off to the closest child.
    3119     int minDist = INT_MAX;
     3116    LayoutUnit minDist = numeric_limits<LayoutUnit>::max();
    31203117    RenderBox* closestRenderer = 0;
    3121     IntPoint adjustedPoint = point;
     3118    LayoutPoint adjustedPoint = point;
    31223119    if (isTableRow())
    31233120        adjustedPoint.move(location());
     
    31333130        RenderBox* renderer = toRenderBox(renderObject);
    31343131
    3135         int top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? 0 : renderer->y());
    3136         int bottom = top + renderer->contentHeight();
    3137         int left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? 0 : renderer->x());
    3138         int right = left + renderer->contentWidth();
     3132        LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? 0 : renderer->y());
     3133        LayoutUnit bottom = top + renderer->contentHeight();
     3134        LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? 0 : renderer->x());
     3135        LayoutUnit right = left + renderer->contentWidth();
    31393136       
    31403137        if (point.x() <= right && point.x() >= left && point.y() <= top && point.y() >= bottom) {
     
    31463143        // Find the distance from (x, y) to the box.  Split the space around the box into 8 pieces
    31473144        // and use a different compare depending on which piece (x, y) is in.
    3148         IntPoint cmp;
    3149         if (xPos > right) {
    3150             if (yPos < top)
    3151                 cmp = IntPoint(right, top);
    3152             else if (yPos > bottom)
    3153                 cmp = IntPoint(right, bottom);
     3145        LayoutPoint cmp;
     3146        if (point.x() > right) {
     3147            if (point.y() < top)
     3148                cmp = LayoutPoint(right, top);
     3149            else if (point.y() > bottom)
     3150                cmp = LayoutPoint(right, bottom);
    31543151            else
    3155                 cmp = IntPoint(right, yPos);
    3156         } else if (xPos < left) {
    3157             if (yPos < top)
    3158                 cmp = IntPoint(left, top);
    3159             else if (yPos > bottom)
    3160                 cmp = IntPoint(left, bottom);
     3152                cmp = LayoutPoint(right, point.y());
     3153        } else if (point.x() < left) {
     3154            if (point.y() < top)
     3155                cmp = LayoutPoint(left, top);
     3156            else if (point.y() > bottom)
     3157                cmp = LayoutPoint(left, bottom);
    31613158            else
    3162                 cmp = IntPoint(left, yPos);
     3159                cmp = LayoutPoint(left, point.y());
    31633160        } else {
    3164             if (yPos < top)
    3165                 cmp = IntPoint(xPos, top);
     3161            if (point.y() < top)
     3162                cmp = LayoutPoint(point.x(), top);
    31663163            else
    3167                 cmp = IntPoint(xPos, bottom);
    3168         }
    3169 
    3170         IntSize difference = cmp - point;
    3171 
    3172         int dist = difference.width() * difference.width() + difference.height() * difference.height();
     3164                cmp = LayoutPoint(point.x(), bottom);
     3165        }
     3166
     3167        LayoutSize difference = cmp - point;
     3168
     3169        LayoutUnit dist = difference.width() * difference.width() + difference.height() * difference.height();
    31733170        if (dist < minDist) {
    31743171            closestRenderer = renderer;
  • trunk/Source/WebCore/rendering/RenderBox.h

    r90169 r90250  
    373373    IntRect maskClipRect();
    374374
    375     virtual VisiblePosition positionForPoint(const IntPoint&);
     375    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    376376
    377377    void removeFloatingOrPositionedChildFromBlockLists();
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r89983 r90250  
    185185}
    186186
    187 VisiblePosition RenderFileUploadControl::positionForPoint(const IntPoint&)
     187VisiblePosition RenderFileUploadControl::positionForPoint(const LayoutPoint&)
    188188{
    189189    return VisiblePosition();
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.h

    r89983 r90250  
    5353    int maxFilenameWidth() const;
    5454   
    55     virtual VisiblePosition positionForPoint(const IntPoint&);
     55    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    5656
    5757    HTMLInputElement* uploadButton() const;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r90186 r90250  
    716716}
    717717
    718 VisiblePosition RenderInline::positionForPoint(const IntPoint& point)
     718VisiblePosition RenderInline::positionForPoint(const LayoutPoint& point)
    719719{
    720720    // FIXME: Does not deal with relative positioned inlines (should it?)
     
    727727
    728728    // Translate the coords from the pre-anonymous block to the post-anonymous block.
    729     IntPoint parentBlockPoint = cb->location() + point; 
     729    LayoutPoint parentBlockPoint = cb->location() + point; 
    730730    RenderBoxModelObject* c = continuation();
    731731    while (c) {
  • trunk/Source/WebCore/rendering/RenderInline.h

    r90049 r90250  
    134134    virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
    135135
    136     virtual VisiblePosition positionForPoint(const IntPoint&);
     136    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    137137
    138138    virtual LayoutRect borderBoundingBox() const
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r90200 r90250  
    21312131}
    21322132
    2133 VisiblePosition RenderObject::positionForPoint(const IntPoint&)
     2133VisiblePosition RenderObject::positionForPoint(const LayoutPoint&)
    21342134{
    21352135    return createVisiblePosition(caretMinOffset(), DOWNSTREAM);
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r90069 r90250  
    401401}
    402402
    403 VisiblePosition RenderReplaced::positionForPoint(const IntPoint& point)
     403VisiblePosition RenderReplaced::positionForPoint(const LayoutPoint& point)
    404404{
    405405    InlineBox* box = inlineBoxWrapper();
     
    411411    RootInlineBox* root = box->root();
    412412
    413     int top = root->selectionTop();
    414     int bottom = root->selectionBottom();
    415 
    416     int blockDirectionPosition = box->isHorizontal() ? point.y() + y() : point.x() + x();
    417     int lineDirectionPosition = box->isHorizontal() ? point.x() + x() : point.y() + y();
     413    LayoutUnit top = root->selectionTop();
     414    LayoutUnit bottom = root->selectionBottom();
     415
     416    LayoutUnit blockDirectionPosition = box->isHorizontal() ? point.y() + y() : point.x() + x();
     417    LayoutUnit lineDirectionPosition = box->isHorizontal() ? point.x() + x() : point.y() + y();
    418418
    419419    if (blockDirectionPosition < top)
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r90069 r90250  
    7878
    7979    virtual unsigned caretMaxRenderedOffset() const;
    80     virtual VisiblePosition positionForPoint(const IntPoint&);
     80    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    8181   
    8282    virtual bool canBeSelectionLeaf() const { return true; }
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r89704 r90250  
    469469}
    470470
    471 VisiblePosition RenderText::positionForPoint(const IntPoint& point)
     471VisiblePosition RenderText::positionForPoint(const LayoutPoint& point)
    472472{
    473473    if (!firstTextBox() || textLength() == 0)
     
    477477    int offset;
    478478
    479     int pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y();
    480     int pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x();
     479    LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y();
     480    LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x();
    481481   
    482482    // FIXME: We should be able to roll these special cases into the general cases in the loop below.
     
    498498        RootInlineBox* rootBox = box->root();
    499499        if (pointBlockDirection >= rootBox->selectionTop() || pointBlockDirection >= rootBox->lineTop()) {
    500             int bottom = rootBox->selectionBottom();
     500            LayoutUnit bottom = rootBox->selectionBottom();
    501501            if (rootBox->nextRootBox())
    502502                bottom = min(bottom, rootBox->nextRootBox()->lineTop());
  • trunk/Source/WebCore/rendering/RenderText.h

    r90049 r90250  
    6666    void absoluteQuads(Vector<FloatQuad>&, ClippingOption option = NoClipping);
    6767
    68     virtual VisiblePosition positionForPoint(const IntPoint&);
     68    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    6969
    7070    const UChar* characters() const { return m_text.characters(); }
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r90089 r90250  
    5353using namespace HTMLNames;
    5454
    55 VisiblePosition RenderTextControlInnerBlock::positionForPoint(const IntPoint& point)
    56 {
    57     IntPoint contentsPoint(point);
     55VisiblePosition RenderTextControlInnerBlock::positionForPoint(const LayoutPoint& point)
     56{
     57    LayoutPoint contentsPoint(point);
    5858
    5959    // Multiline text controls have the scroll on shadowAncestorNode, so we need to take that
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h

    r90089 r90250  
    167167private:
    168168    virtual bool hasLineIfEmpty() const { return true; }
    169     virtual VisiblePosition positionForPoint(const IntPoint&);
     169    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    170170
    171171    bool m_multiLine;
  • trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp

    r89705 r90250  
    170170}
    171171
    172 VisiblePosition RenderSVGInlineText::positionForPoint(const IntPoint& point)
     172VisiblePosition RenderSVGInlineText::positionForPoint(const LayoutPoint& point)
    173173{
    174174    if (!firstTextBox() || !textLength())
     
    182182    // Map local point to absolute point, as the character origins stored in the text fragments use absolute coordinates.
    183183    FloatPoint absolutePoint(point);
    184     absolutePoint.move(containingBlock->x(), containingBlock->y());
     184    absolutePoint.moveBy(containingBlock->location());
    185185
    186186    float closestDistance = std::numeric_limits<float>::max();
  • trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h

    r85335 r90250  
    5959    virtual bool isSVGInlineText() const { return true; }
    6060
    61     virtual VisiblePosition positionForPoint(const IntPoint&);
     61    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    6262    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    6363    virtual IntRect linesBoundingBox() const;
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r89754 r90250  
    208208}
    209209
    210 VisiblePosition RenderSVGText::positionForPoint(const IntPoint& pointInContents)
     210VisiblePosition RenderSVGText::positionForPoint(const LayoutPoint& pointInContents)
    211211{
    212212    RootInlineBox* rootBox = firstRootBox();
     
    222222        return createVisiblePosition(0, DOWNSTREAM);
    223223
    224     return closestBox->renderer()->positionForPoint(IntPoint(pointInContents.x(), closestBox->y()));
     224    return closestBox->renderer()->positionForPoint(LayoutPoint(pointInContents.x(), closestBox->y()));
    225225}
    226226
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.h

    r90048 r90250  
    5656    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
    5757    virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
    58     virtual VisiblePosition positionForPoint(const IntPoint&);
     58    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    5959
    6060    virtual bool requiresLayer() const { return false; }
Note: See TracChangeset for help on using the changeset viewer.