Changeset 87825 in webkit


Ignore:
Timestamp:
Jun 1, 2011 10:59:02 AM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Reviewed by Eric Seidel.

Switch RenderLineBoxList intersection functions to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=61794

Switching rangeIntersectsRect, anyLineIntersectsRect, and lineIntersectsDirtyRect
to take IntPoint instead of a tx/ty to represent the offset to be applied match
the rect and lines' coordinates.

No new tests since this is merely refactoring.

  • rendering/RenderLineBoxList.cpp: (WebCore::RenderLineBoxList::rangeIntersectsRect): (WebCore::RenderLineBoxList::anyLineIntersectsRect): (WebCore::RenderLineBoxList::lineIntersectsDirtyRect): (WebCore::RenderLineBoxList::paint): (WebCore::RenderLineBoxList::hitTest):
  • rendering/RenderLineBoxList.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87822 r87825  
     12011-06-01  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch RenderLineBoxList intersection functions to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=61794
     7
     8        Switching rangeIntersectsRect, anyLineIntersectsRect, and lineIntersectsDirtyRect
     9        to take IntPoint instead of a tx/ty to represent the offset to be applied match
     10        the rect and lines' coordinates.
     11
     12        No new tests since this is merely refactoring.
     13
     14        * rendering/RenderLineBoxList.cpp:
     15        (WebCore::RenderLineBoxList::rangeIntersectsRect):
     16        (WebCore::RenderLineBoxList::anyLineIntersectsRect):
     17        (WebCore::RenderLineBoxList::lineIntersectsDirtyRect):
     18        (WebCore::RenderLineBoxList::paint):
     19        (WebCore::RenderLineBoxList::hitTest):
     20        * rendering/RenderLineBoxList.h:
     21
    1222011-05-19  Adrienne Walker  <enne@google.com>
    223
  • trunk/Source/WebCore/rendering/RenderLineBoxList.cpp

    r87753 r87825  
    147147}
    148148
    149 bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, int logicalTop, int logicalBottom, const IntRect& rect, int tx, int ty) const
     149bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, int logicalTop, int logicalBottom, const IntRect& rect, const IntPoint& offset) const
    150150{
    151151    RenderBox* block;
     
    160160   
    161161    if (renderer->style()->isHorizontalWritingMode()) {
    162         physicalStart += ty;
     162        physicalStart += offset.y();
    163163        if (physicalStart >= rect.maxY() || physicalStart + physicalExtent <= rect.y())
    164164            return false;
    165165    } else {
    166         physicalStart += tx;
     166        physicalStart += offset.x();
    167167        if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= rect.x())
    168168            return false;
     
    172172}
    173173
    174 bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const IntRect& rect, int tx, int ty, bool usePrintRect, int outlineSize) const
     174bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const IntRect& rect, const IntPoint& offset, bool usePrintRect, int outlineSize) const
    175175{
    176176    // We can check the first box and last box and avoid painting/hit testing if we don't
     
    189189    int logicalBottom = outlineSize + lastLineBottom;
    190190   
    191     return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, tx, ty);
    192 }
    193 
    194 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, int tx, int ty) const
     191    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset);
     192}
     193
     194bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const IntPoint& offset) const
    195195{
    196196    RootInlineBox* root = box->root();
     
    198198    int logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
    199199   
    200     return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, tx, ty);
     200    return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, offset);
    201201}
    202202
     
    220220    bool usePrintRect = !v->printRect().isEmpty();
    221221    int outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
    222     if (!anyLineIntersectsRect(renderer, paintInfo.rect, tx, ty, usePrintRect, outlineSize))
     222    if (!anyLineIntersectsRect(renderer, paintInfo.rect, IntPoint(tx, ty), usePrintRect, outlineSize))
    223223        return;
    224224
     
    258258        }
    259259
    260         if (lineIntersectsDirtyRect(renderer, curr, info, tx, ty)) {
     260        if (lineIntersectsDirtyRect(renderer, curr, info, IntPoint(tx, ty))) {
    261261            RootInlineBox* root = curr->root();
    262262            curr->paint(info, IntPoint(tx, ty), root->lineTop(), root->lineBottom());
     
    290290        IntRect(pointInContainer.x() - result.leftPadding(), pointInContainer.y(), result.rightPadding() + result.leftPadding() + 1, 1);
    291291
    292     if (!anyLineIntersectsRect(renderer, rect, tx, ty))
     292    if (!anyLineIntersectsRect(renderer, rect, IntPoint(tx, ty)))
    293293        return false;
    294294
     
    298298    for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
    299299        RootInlineBox* root = curr->root();
    300         if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, tx, ty)) {
     300        if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, IntPoint(tx, ty))) {
    301301            bool inside = curr->nodeAtPoint(request, result, pointInContainer, tx, ty, root->lineTop(), root->lineBottom());
    302302            if (inside) {
  • trunk/Source/WebCore/rendering/RenderLineBoxList.h

    r87019 r87825  
    6868   
    6969private:
    70     bool anyLineIntersectsRect(RenderBoxModelObject*, const IntRect&, int tx, int ty, bool usePrintRect = false, int outlineSize = 0) const;
    71     bool lineIntersectsDirtyRect(RenderBoxModelObject*, InlineFlowBox*, const PaintInfo&, int tx, int ty) const;
    72     bool rangeIntersectsRect(RenderBoxModelObject*, int logicalTop, int logicalBottom, const IntRect&, int tx, int ty) const;
     70    bool anyLineIntersectsRect(RenderBoxModelObject*, const IntRect&, const IntPoint&, bool usePrintRect = false, int outlineSize = 0) const;
     71    bool lineIntersectsDirtyRect(RenderBoxModelObject*, InlineFlowBox*, const PaintInfo&, const IntPoint&) const;
     72    bool rangeIntersectsRect(RenderBoxModelObject*, int logicalTop, int logicalBottom, const IntRect&, const IntPoint&) const;
    7373
    7474    // For block flows, each box represents the root inline box for a line in the
Note: See TracChangeset for help on using the changeset viewer.