Changeset 88202 in webkit


Ignore:
Timestamp:
Jun 6, 2011 4:45:22 PM (13 years ago)
Author:
eae@chromium.org
Message:

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

Reviewed by Eric Seidel.

Convert RenderBox::absoluteRects to IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62130

Covered by existing tests.

  • dom/Node.cpp: (WebCore::Node::hasNonEmptyBoundingBox):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::absoluteRects):
  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp: (WebCore::RenderBox::absoluteRects):
  • rendering/RenderBox.h:
  • rendering/RenderInline.cpp: (WebCore::RenderInline::absoluteRects):
  • rendering/RenderInline.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::absoluteBoundingBoxRect):
  • rendering/RenderObject.h: (WebCore::RenderObject::absoluteRects):
  • rendering/RenderText.cpp: (WebCore::RenderText::absoluteRects):
  • rendering/RenderText.h:
  • rendering/RenderView.cpp: (WebCore::RenderView::absoluteRects):
  • rendering/RenderView.h:
Location:
trunk/Source/WebCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88200 r88202  
     12011-06-06  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Convert RenderBox::absoluteRects to IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62130
     7
     8        Covered by existing tests.
     9
     10        * dom/Node.cpp:
     11        (WebCore::Node::hasNonEmptyBoundingBox):
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::absoluteRects):
     14        * rendering/RenderBlock.h:
     15        * rendering/RenderBox.cpp:
     16        (WebCore::RenderBox::absoluteRects):
     17        * rendering/RenderBox.h:
     18        * rendering/RenderInline.cpp:
     19        (WebCore::RenderInline::absoluteRects):
     20        * rendering/RenderInline.h:
     21        * rendering/RenderObject.cpp:
     22        (WebCore::RenderObject::absoluteBoundingBoxRect):
     23        * rendering/RenderObject.h:
     24        (WebCore::RenderObject::absoluteRects):
     25        * rendering/RenderText.cpp:
     26        (WebCore::RenderText::absoluteRects):
     27        * rendering/RenderText.h:
     28        * rendering/RenderView.cpp:
     29        (WebCore::RenderView::absoluteRects):
     30        * rendering/RenderView.h:
     31
    1322011-06-06  Levi Weintraub  <leviw@chromium.org>
    233
  • trunk/Source/WebCore/dom/Node.cpp

    r87991 r88202  
    840840    Vector<IntRect> rects;
    841841    FloatPoint absPos = renderer()->localToAbsolute();
    842     renderer()->absoluteRects(rects, absPos.x(), absPos.y());
     842    renderer()->absoluteRects(rects, flooredIntPoint(absPos));
    843843    size_t n = rects.size();
    844844    for (size_t i = 0; i < n; ++i)
  • trunk/Source/WebCore/rendering/InlineBox.h

    r87964 r88202  
    237237    float width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
    238238    float height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
     239    FloatSize size() const { return IntSize(width(), height()); }
    239240    float right() const { return left() + width(); }
    240241    float bottom() const { return top() + height(); }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r88198 r88202  
    56665666}
    56675667
    5668 void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
     5668void RenderBlock::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
    56695669{
    56705670    // For blocks inside inlines, we go ahead and include margins so that we run right up to the
     
    56745674        // FIXME: This is wrong for block-flows that are horizontal.
    56755675        // https://bugs.webkit.org/show_bug.cgi?id=46781
    5676         rects.append(IntRect(tx, ty - collapsedMarginBefore(),
     5676        rects.append(IntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
    56775677                             width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
    5678         continuation()->absoluteRects(rects,
    5679                                       tx - x() + inlineElementContinuation()->containingBlock()->x(),
    5680                                       ty - y() + inlineElementContinuation()->containingBlock()->y());
     5678        continuation()->absoluteRects(rects, accumulatedOffset - toSize(location() +
     5679                inlineElementContinuation()->containingBlock()->location()));
    56815680    } else
    5682         rects.append(IntRect(tx, ty, width(), height()));
     5681        rects.append(IntRect(accumulatedOffset, size()));
    56835682}
    56845683
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r88190 r88202  
    626626    int logicalRightSelectionOffset(RenderBlock* rootBlock, int position);
    627627   
    628     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     628    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    629629    virtual void absoluteQuads(Vector<FloatQuad>&);
    630630
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r88198 r88202  
    456456}
    457457
    458 void RenderBox::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
    459 {
    460     rects.append(IntRect(tx, ty, width(), height()));
     458void RenderBox::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
     459{
     460    rects.append(IntRect(accumulatedOffset, size()));
    461461}
    462462
  • trunk/Source/WebCore/rendering/RenderBox.h

    r88198 r88202  
    231231    virtual int collapsedMarginAfter() const { return marginAfter(); }
    232232
    233     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     233    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    234234    virtual void absoluteQuads(Vector<FloatQuad>&);
    235235   
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r88195 r88202  
    466466}
    467467
    468 void RenderInline::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
     468void RenderInline::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
    469469{
    470470    if (!alwaysCreateLineBoxes())
    471         culledInlineAbsoluteRects(this, rects, IntSize(tx, ty));
     471        culledInlineAbsoluteRects(this, rects, toSize(accumulatedOffset));
    472472    else if (InlineFlowBox* curr = firstLineBox()) {
    473473        for (; curr; curr = curr->nextLineBox())
    474             rects.append(enclosingIntRect(FloatRect(tx + curr->x(), ty + curr->y(), curr->width(), curr->height())));
     474            rects.append(enclosingIntRect(FloatRect(accumulatedOffset + curr->topLeft(), curr->size())));
    475475    } else
    476         rects.append(IntRect(tx, ty, 0, 0));
     476        rects.append(IntRect(accumulatedOffset, IntSize()));
    477477
    478478    if (continuation()) {
    479479        if (continuation()->isBox()) {
    480480            RenderBox* box = toRenderBox(continuation());
    481             continuation()->absoluteRects(rects,
    482                                           tx - containingBlock()->x() + box->x(),
    483                                           ty - containingBlock()->y() + box->y());
     481            continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location() + box->size()));
    484482        } else
    485             continuation()->absoluteRects(rects, tx - containingBlock()->x(), ty - containingBlock()->y());
     483            continuation()->absoluteRects(rects, toPoint(accumulatedOffset - containingBlock()->location()));
    486484    }
    487485}
  • trunk/Source/WebCore/rendering/RenderInline.h

    r88190 r88202  
    4949    virtual int marginEnd() const;
    5050
    51     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     51    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    5252    virtual void absoluteQuads(Vector<FloatQuad>&);
    5353
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r88195 r88202  
    11001100    FloatPoint absPos = localToAbsolute();
    11011101    Vector<IntRect> rects;
    1102     absoluteRects(rects, absPos.x(), absPos.y());
     1102    absoluteRects(rects, flooredIntPoint(absPos));
    11031103
    11041104    size_t n = rects.size();
  • trunk/Source/WebCore/rendering/RenderObject.h

    r88195 r88202  
    591591    IntSize offsetFromAncestorContainer(RenderObject*) const;
    592592   
    593     virtual void absoluteRects(Vector<IntRect>&, int, int) { }
     593    virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { }
    594594    // FIXME: useTransforms should go away eventually
    595595    IntRect absoluteBoundingBoxRect(bool useTransforms = false);
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r88188 r88202  
    270270}
    271271
    272 void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
     272void RenderText::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
    273273{
    274274    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
    275         rects.append(enclosingIntRect(FloatRect(tx + box->x(), ty + box->y(), box->width(), box->height())));
     275        rects.append(enclosingIntRect(FloatRect(accumulatedOffset + box->topLeft(), box->size())));
    276276}
    277277
  • trunk/Source/WebCore/rendering/RenderText.h

    r86708 r88202  
    5757    void dirtyLineBoxes(bool fullLayout);
    5858
    59     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     59    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    6060    void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
    6161
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r88087 r88202  
    322322}
    323323
    324 void RenderView::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
    325 {
    326     rects.append(IntRect(IntPoint(tx, ty), m_layer->size()));
     324void RenderView::absoluteRects(Vector<IntRect>& rects, const IntPoint& accumulatedOffset)
     325{
     326    rects.append(IntRect(accumulatedOffset, m_layer->size()));
    327327}
    328328
  • trunk/Source/WebCore/rendering/RenderView.h

    r88033 r88202  
    8383    bool printing() const;
    8484
    85     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     85    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    8686    virtual void absoluteQuads(Vector<FloatQuad>&);
    8787
Note: See TracChangeset for help on using the changeset viewer.