Changeset 87019 in webkit


Ignore:
Timestamp:
May 21, 2011 8:30:02 AM (13 years ago)
Author:
eae@chromium.org
Message:

2011-05-21 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Change RenderLineBoxList::hitTest to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=61156

Change the RenderLineBoxList hit testing to use IntPoint and clean up the rect calculation.

Covered by existing tests.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::hitTestContents):
  • rendering/RenderInline.cpp: (WebCore::RenderInline::nodeAtPoint):
  • rendering/RenderLineBoxList.cpp: (WebCore::RenderLineBoxList::hitTest):
  • rendering/RenderLineBoxList.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87018 r87019  
     12011-05-21  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Change RenderLineBoxList::hitTest to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=61156
     7
     8        Change the RenderLineBoxList hit testing to use IntPoint and clean up the rect calculation.
     9
     10        Covered by existing tests.
     11
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::hitTestContents):
     14        * rendering/RenderInline.cpp:
     15        (WebCore::RenderInline::nodeAtPoint):
     16        * rendering/RenderLineBoxList.cpp:
     17        (WebCore::RenderLineBoxList::hitTest):
     18        * rendering/RenderLineBoxList.h:
     19
    1202011-05-21  Emil A Eklund  <eae@chromium.org>
    221
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r87018 r87019  
    40364036    if (childrenInline() && !isTable()) {
    40374037        // We have to hit-test our line boxes.
    4038         if (m_lineBoxes.hitTest(this, request, result, x, y, tx, ty, hitTestAction))
     4038        if (m_lineBoxes.hitTest(this, request, result, IntPoint(x, y), tx, ty, hitTestAction))
    40394039            return true;
    40404040    } else {
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r86705 r87019  
    715715                                const IntPoint& pointInContainer, int tx, int ty, HitTestAction hitTestAction)
    716716{
    717     return m_lineBoxes.hitTest(this, request, result, pointInContainer.x(), pointInContainer.y(), tx, ty, hitTestAction);
     717    return m_lineBoxes.hitTest(this, request, result, pointInContainer, tx, ty, hitTestAction);
    718718}
    719719
  • trunk/Source/WebCore/rendering/RenderLineBoxList.cpp

    r86705 r87019  
    275275
    276276
    277 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) const
     277bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, int tx, int ty, HitTestAction hitTestAction) const
    278278{
    279279    if (hitTestAction != HitTestForeground)
     
    286286        return false;
    287287
    288     bool isHorizontal = firstLineBox()->isHorizontal();
    289    
    290     int logicalPointStart = isHorizontal ? y - result.topPadding() : x - result.leftPadding();
    291     int logicalPointEnd = (isHorizontal ? y + result.bottomPadding() : x + result.rightPadding()) + 1;
    292     IntRect rect(isHorizontal ? x : logicalPointStart, isHorizontal ? logicalPointStart : y,
    293                  isHorizontal ? 1 : logicalPointEnd - logicalPointStart,
    294                  isHorizontal ? logicalPointEnd - logicalPointStart : 1);   
     288    IntRect rect = firstLineBox()->isHorizontal() ?
     289        IntRect(pointInContainer.x(), pointInContainer.y() - result.topPadding(), 1, result.topPadding() + result.bottomPadding() + 1) :
     290        IntRect(pointInContainer.x() - result.leftPadding(), pointInContainer.y(), result.rightPadding() + result.leftPadding() + 1, 1);
     291
    295292    if (!anyLineIntersectsRect(renderer, rect, tx, ty))
    296293        return false;
     
    302299        RootInlineBox* root = curr->root();
    303300        if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, tx, ty)) {
    304             bool inside = curr->nodeAtPoint(request, result, IntPoint(x, y), tx, ty, root->lineTop(), root->lineBottom());
     301            bool inside = curr->nodeAtPoint(request, result, pointInContainer, tx, ty, root->lineTop(), root->lineBottom());
    305302            if (inside) {
    306                 renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty));
     303                renderer->updateHitTestResult(result, pointInContainer - IntSize(tx, ty));
    307304                return true;
    308305            }
  • trunk/Source/WebCore/rendering/RenderLineBoxList.h

    r71177 r87019  
    6565
    6666    void paint(RenderBoxModelObject*, PaintInfo&, int x, int y) const;
    67     bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction) const;
     67    bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, HitTestAction) const;
    6868   
    6969private:
Note: See TracChangeset for help on using the changeset viewer.