Index: third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp |
index fe9541f71d65a99e69b410da692d48126567bf1d..93a36cd89618183758faf1a3b9a7b3b5ed08960d 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp |
@@ -69,17 +69,19 @@ void SVGRootInlineBox::computePerCharacterLayoutInformation() { |
// Perform SVG text layout phase four |
// Position & resize all SVGInlineText/FlowBoxes in the inline box tree, |
// resize the root box as well as the LayoutSVGText parent block. |
- LayoutRect childRect = layoutInlineBoxes(*this); |
+ layoutInlineBoxes(*this); |
- // Finally, assign the root block position, now that all content is laid out. |
+ // Let the HTML block space originate from the local SVG coordinate space. |
LineLayoutBlockFlow parentBlock = block(); |
- parentBlock.setLocation(childRect.location()); |
- parentBlock.setSize(childRect.size()); |
- |
- adjustInlineBoxesToBlockSpace(*this); |
- |
- setLineTopBottomPositions(LayoutUnit(), logicalHeight(), LayoutUnit(), |
- logicalHeight()); |
+ parentBlock.setLocation(LayoutPoint()); |
+ // The width could be any value, but set it so that a line box will mirror |
+ // within the childRect when its coordinates are converted between physical |
+ // block direction and flipped block direction, for ease of understanding of |
+ // flipped coordinates. The height doesn't matter. |
+ parentBlock.setSize(LayoutSize(x() * 2 + width(), LayoutUnit())); |
+ |
+ setLineTopBottomPositions(logicalTop(), logicalBottom(), logicalTop(), |
+ logicalBottom()); |
} |
LayoutRect SVGRootInlineBox::layoutInlineBoxes(InlineBox& box) { |
@@ -106,21 +108,6 @@ LayoutRect SVGRootInlineBox::layoutInlineBoxes(InlineBox& box) { |
return rect; |
} |
-void SVGRootInlineBox::adjustInlineBoxesToBlockSpace(InlineBox& box) { |
- LineLayoutBlockFlow parentBlock = block(); |
- LayoutPoint location = box.topLeft(); |
- location.moveBy(-parentBlock.location()); |
- box.setX(location.x()); |
- box.setY(location.y()); |
- |
- if (!box.isInlineFlowBox()) |
- return; |
- |
- for (InlineBox* child = toInlineFlowBox(box).firstChild(); child; |
- child = child->nextOnLine()) |
- adjustInlineBoxesToBlockSpace(*child); |
-} |
- |
InlineBox* SVGRootInlineBox::closestLeafChildForPosition( |
const LayoutPoint& point) { |
InlineBox* firstLeaf = firstLeafChild(); |