Revert linesBoundingBox to integers
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 10:06:49 +0000 (10:06 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 10:06:49 +0000 (10:06 +0000)
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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112237 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
Source/WebCore/rendering/svg/RenderSVGInlineText.h

index 564ac78..21f62ec 100644 (file)
@@ -1,3 +1,31 @@
+2012-03-27  Levi Weintraub  <leviw@chromium.org>
+
+        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):
+
 2012-03-26  Pavel Podivilov  <podivilov@chromium.org>
 
         Web Inspector: store UIBreakpoints on UISourceCode.
index 4631e77..5f57547 100644 (file)
@@ -785,14 +785,14 @@ VisiblePosition RenderInline::positionForPoint(const LayoutPoint& point)
     return RenderBoxModelObject::positionForPoint(point);
 }
 
-LayoutRect RenderInline::linesBoundingBox() const
+IntRect RenderInline::linesBoundingBox() const
 {
     if (!alwaysCreateLineBoxes()) {
         ASSERT(!firstLineBox());
-        return enclosingLayoutRect(culledInlineBoundingBox(this));
+        return enclosingIntRect(culledInlineBoundingBox(this));
     }
 
-    LayoutRect result;
+    IntRect result;
     
     // 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
     // unable to reproduce this at all (and consequently unable to figure ot why this is happening).  The assert will hopefully catch the problem in debug
@@ -815,7 +815,7 @@ LayoutRect RenderInline::linesBoundingBox() const
         float y = isHorizontal ? firstLineBox()->y() : logicalLeftSide;
         float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLineBox()->logicalBottom() - x;
         float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide;
-        result = enclosingLayoutRect(FloatRect(x, y, width, height));
+        result = enclosingIntRect(FloatRect(x, y, width, height));
     }
 
     return result;
index 0cb0264..172ee04 100644 (file)
@@ -51,7 +51,7 @@ public:
 
     virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
 
-    LayoutRect linesBoundingBox() const;
+    IntRect linesBoundingBox() const;
     LayoutRect linesVisualOverflowBoundingBox() const;
 
     InlineFlowBox* createAndAppendInlineFlowBox();
index 992ef06..fd8996e 100644 (file)
@@ -739,7 +739,7 @@ void RenderLayer::updateLayerPosition()
     LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done.
     if (renderer()->isRenderInline()) {
         RenderInline* inlineFlow = toRenderInline(renderer());
-        LayoutRect lineBox = inlineFlow->linesBoundingBox();
+        IntRect lineBox = inlineFlow->linesBoundingBox();
         setSize(lineBox.size());
         inlineBoundingBoxOffset = toSize(lineBox.location());
         localPoint += inlineBoundingBoxOffset;
index 82d543c..e5a2c2e 100644 (file)
@@ -1472,9 +1472,9 @@ float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos,
     return w;
 }
 
-LayoutRect RenderText::linesBoundingBox() const
+IntRect RenderText::linesBoundingBox() const
 {
-    LayoutRect result;
+    IntRect result;
     
     ASSERT(!firstTextBox() == !lastTextBox());  // Either both are null or both exist.
     if (firstTextBox() && lastTextBox()) {
index dc5ed8a..a55b0f0 100644 (file)
@@ -165,7 +165,7 @@ FloatRect RenderSVGInlineText::floatLinesBoundingBox() const
     return boundingBox;
 }
 
-LayoutRect RenderSVGInlineText::linesBoundingBox() const
+IntRect RenderSVGInlineText::linesBoundingBox() const
 {
     return enclosingIntRect(floatLinesBoundingBox());
 }
index 6ac768c..51378fd 100644 (file)
@@ -59,7 +59,7 @@ private:
 
     virtual VisiblePosition positionForPoint(const LayoutPoint&);
     virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
-    virtual LayoutRect linesBoundingBox() const;
+    virtual IntRect linesBoundingBox() const;
     virtual InlineTextBox* createTextBox();
 
     float m_scalingFactor;