- Revision
- 112237
- Author
- le...@chromium.org
- Date
- 2012-03-27 03:06:49 -0700 (Tue, 27 Mar 2012)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112236 => 112237)
--- trunk/Source/WebCore/ChangeLog 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/ChangeLog 2012-03-27 10:06:49 UTC (rev 112237)
@@ -1,3 +1,31 @@
+2012-03-27 Levi Weintraub <le...@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 <podivi...@chromium.org>
Web Inspector: store UIBreakpoints on UISourceCode.
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (112236 => 112237)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2012-03-27 10:06:49 UTC (rev 112237)
@@ -785,14 +785,14 @@
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 @@
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;
Modified: trunk/Source/WebCore/rendering/RenderInline.h (112236 => 112237)
--- trunk/Source/WebCore/rendering/RenderInline.h 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2012-03-27 10:06:49 UTC (rev 112237)
@@ -51,7 +51,7 @@
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
- LayoutRect linesBoundingBox() const;
+ IntRect linesBoundingBox() const;
LayoutRect linesVisualOverflowBoundingBox() const;
InlineFlowBox* createAndAppendInlineFlowBox();
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (112236 => 112237)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-03-27 10:06:49 UTC (rev 112237)
@@ -739,7 +739,7 @@
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;
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (112236 => 112237)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2012-03-27 10:06:49 UTC (rev 112237)
@@ -1472,9 +1472,9 @@
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()) {
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp (112236 => 112237)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp 2012-03-27 10:06:49 UTC (rev 112237)
@@ -165,7 +165,7 @@
return boundingBox;
}
-LayoutRect RenderSVGInlineText::linesBoundingBox() const
+IntRect RenderSVGInlineText::linesBoundingBox() const
{
return enclosingIntRect(floatLinesBoundingBox());
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h (112236 => 112237)
--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2012-03-27 09:55:18 UTC (rev 112236)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h 2012-03-27 10:06:49 UTC (rev 112237)
@@ -59,7 +59,7 @@
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;