Changeset 112237 in webkit


Ignore:
Timestamp:
Mar 27, 2012 3:06:49 AM (12 years ago)
Author:
leviw@chromium.org
Message:

Revert linesBoundingBox to integers
https://bugs.webkit.org/show_bug.cgi?id=82182

Reviewed by Eric Seidel.

LayoutRects are intended to be pixel snapped to determine the ultimate screen
coordinates, but the Inline Box tree is laid out using floats, and pixel snapping
the resulting box from linesBoundingBox would produce a potentially incorrect
rectangle. Keeping this using enclosingIntRect retains the previous accuracy and
prevents misuse.

No new tests. No change in behavior.

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::linesBoundingBox):

  • rendering/RenderInline.h:

(RenderInline):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::updateLayerPosition):

  • rendering/RenderText.cpp:

(WebCore::RenderText::linesBoundingBox):

  • rendering/svg/RenderSVGInlineText.cpp:

(WebCore::RenderSVGInlineText::linesBoundingBox):

  • rendering/svg/RenderSVGInlineText.h:

(RenderSVGInlineText):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112236 r112237  
     12012-03-27  Levi Weintraub  <leviw@chromium.org>
     2
     3        Revert linesBoundingBox to integers
     4        https://bugs.webkit.org/show_bug.cgi?id=82182
     5
     6        Reviewed by Eric Seidel.
     7
     8        LayoutRects are intended to be pixel snapped to determine the ultimate screen
     9        coordinates, but the Inline Box tree is laid out using floats, and pixel snapping
     10        the resulting box from linesBoundingBox would produce a potentially incorrect
     11        rectangle. Keeping this using enclosingIntRect retains the previous accuracy and
     12        prevents misuse.
     13
     14        No new tests. No change in behavior.
     15
     16        * rendering/RenderInline.cpp:
     17        (WebCore::RenderInline::linesBoundingBox):
     18        * rendering/RenderInline.h:
     19        (RenderInline):
     20        * rendering/RenderLayer.cpp:
     21        (WebCore::RenderLayer::updateLayerPosition):
     22        * rendering/RenderText.cpp:
     23        (WebCore::RenderText::linesBoundingBox):
     24        * rendering/svg/RenderSVGInlineText.cpp:
     25        (WebCore::RenderSVGInlineText::linesBoundingBox):
     26        * rendering/svg/RenderSVGInlineText.h:
     27        (RenderSVGInlineText):
     28
    1292012-03-26  Pavel Podivilov  <podivilov@chromium.org>
    230
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r112198 r112237  
    786786}
    787787
    788 LayoutRect RenderInline::linesBoundingBox() const
     788IntRect RenderInline::linesBoundingBox() const
    789789{
    790790    if (!alwaysCreateLineBoxes()) {
    791791        ASSERT(!firstLineBox());
    792         return enclosingLayoutRect(culledInlineBoundingBox(this));
    793     }
    794 
    795     LayoutRect result;
     792        return enclosingIntRect(culledInlineBoundingBox(this));
     793    }
     794
     795    IntRect result;
    796796   
    797797    // See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero.  We have been
     
    816816        float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLineBox()->logicalBottom() - x;
    817817        float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide;
    818         result = enclosingLayoutRect(FloatRect(x, y, width, height));
     818        result = enclosingIntRect(FloatRect(x, y, width, height));
    819819    }
    820820
  • trunk/Source/WebCore/rendering/RenderInline.h

    r110224 r112237  
    5252    virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
    5353
    54     LayoutRect linesBoundingBox() const;
     54    IntRect linesBoundingBox() const;
    5555    LayoutRect linesVisualOverflowBoundingBox() const;
    5656
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r111740 r112237  
    740740    if (renderer()->isRenderInline()) {
    741741        RenderInline* inlineFlow = toRenderInline(renderer());
    742         LayoutRect lineBox = inlineFlow->linesBoundingBox();
     742        IntRect lineBox = inlineFlow->linesBoundingBox();
    743743        setSize(lineBox.size());
    744744        inlineBoundingBoxOffset = toSize(lineBox.location());
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r112200 r112237  
    14731473}
    14741474
    1475 LayoutRect RenderText::linesBoundingBox() const
    1476 {
    1477     LayoutRect result;
     1475IntRect RenderText::linesBoundingBox() const
     1476{
     1477    IntRect result;
    14781478   
    14791479    ASSERT(!firstTextBox() == !lastTextBox());  // Either both are null or both exist.
  • trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp

    r112166 r112237  
    166166}
    167167
    168 LayoutRect RenderSVGInlineText::linesBoundingBox() const
     168IntRect RenderSVGInlineText::linesBoundingBox() const
    169169{
    170170    return enclosingIntRect(floatLinesBoundingBox());
  • trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h

    r105143 r112237  
    6060    virtual VisiblePosition positionForPoint(const LayoutPoint&);
    6161    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
    62     virtual LayoutRect linesBoundingBox() const;
     62    virtual IntRect linesBoundingBox() const;
    6363    virtual InlineTextBox* createTextBox();
    6464
Note: See TracChangeset for help on using the changeset viewer.