Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Unified Diff: third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp

Issue 2531943002: Unify HTML and SVG coordinates of LayoutSVGText (Closed)
Patch Set: - Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698