Changeset 88297 in webkit


Ignore:
Timestamp:
Jun 7, 2011 5:30:08 PM (13 years ago)
Author:
eae@chromium.org
Message:

2011-06-07 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/InlineBox.h: (WebCore::InlineBox::size):
  • 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:
  • rendering/svg/RenderSVGBlock.cpp: (WebCore::RenderSVGBlock::absoluteRects):
  • rendering/svg/RenderSVGBlock.h:
  • rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::absoluteRects):
  • rendering/svg/RenderSVGModelObject.h:
Location:
trunk/Source/WebCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88294 r88297  
     12011-06-07  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/InlineBox.h:
     13        (WebCore::InlineBox::size):
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::RenderBlock::absoluteRects):
     16        * rendering/RenderBlock.h:
     17        * rendering/RenderBox.cpp:
     18        (WebCore::RenderBox::absoluteRects):
     19        * rendering/RenderBox.h:
     20        * rendering/RenderInline.cpp:
     21        (WebCore::RenderInline::absoluteRects):
     22        * rendering/RenderInline.h:
     23        * rendering/RenderObject.cpp:
     24        (WebCore::RenderObject::absoluteBoundingBoxRect):
     25        * rendering/RenderObject.h:
     26        (WebCore::RenderObject::absoluteRects):
     27        * rendering/RenderText.cpp:
     28        (WebCore::RenderText::absoluteRects):
     29        * rendering/RenderText.h:
     30        * rendering/RenderView.cpp:
     31        (WebCore::RenderView::absoluteRects):
     32        * rendering/RenderView.h:
     33        * rendering/svg/RenderSVGBlock.cpp:
     34        (WebCore::RenderSVGBlock::absoluteRects):
     35        * rendering/svg/RenderSVGBlock.h:
     36        * rendering/svg/RenderSVGModelObject.cpp:
     37        (WebCore::RenderSVGModelObject::absoluteRects):
     38        * rendering/svg/RenderSVGModelObject.h:
     39
    1402011-06-07  Kent Tamura  <tkent@chromium.org>
    241
  • trunk/Source/WebCore/dom/Node.cpp

    r88213 r88297  
    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

    r88213 r88297  
    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

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

    r88282 r88297  
    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

    r88250 r88297  
    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

    r88250 r88297  
    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

    r88250 r88297  
    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

    r88250 r88297  
    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

    r88270 r88297  
    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

    r88250 r88297  
    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

    r88213 r88297  
    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

    r88250 r88297  
    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

    r88250 r88297  
    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

    r88250 r88297  
    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
  • trunk/Source/WebCore/rendering/svg/RenderSVGBlock.cpp

    r75351 r88297  
    6969}
    7070
    71 void RenderSVGBlock::absoluteRects(Vector<IntRect>&, int, int)
     71void RenderSVGBlock::absoluteRects(Vector<IntRect>&, const IntPoint&)
    7272{
    7373    // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
  • trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h

    r75350 r88297  
    3737    virtual void updateBoxModelInfoFromStyle();
    3838
    39     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     39    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    4040
    4141    virtual void destroy();
  • trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp

    r86705 r88297  
    7171}
    7272
    73 void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, int, int)
     73void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, const IntPoint&)
    7474{
    7575    // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
  • trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h

    r86705 r88297  
    5656    virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint*) const;
    5757
    58     virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
     58    virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
    5959    virtual void absoluteQuads(Vector<FloatQuad>&);
    6060
Note: See TracChangeset for help on using the changeset viewer.