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

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

Issue 1411123014: [Line Layout API] Convert SVGTextLayoutEngine and SVGTextLayoutEngineBaseline to line Layout API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
index 74f1ccb640d4486cd080d3de90b6d1d79e8cc02d..5f949b8deec494ceed2bcbd2def01088bc242a53 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
@@ -207,16 +207,16 @@ void SVGTextLayoutEngine::layoutInlineTextBox(SVGInlineTextBox* textBox)
{
ASSERT(textBox);
- LayoutSVGInlineText& text = toLayoutSVGInlineText(textBox->layoutObject());
- ASSERT(text.parent());
- ASSERT(text.parent()->node());
- ASSERT(text.parent()->node()->isSVGElement());
+ LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->lineLayoutItem());
+ ASSERT(textLineLayout.parent());
+ ASSERT(textLineLayout.parent().node());
+ ASSERT(textLineLayout.parent().node()->isSVGElement());
- const ComputedStyle& style = text.styleRef();
+ const ComputedStyle& style = textLineLayout.styleRef();
textBox->clearTextFragments();
m_isVerticalText = !style.isHorizontalWritingMode();
- layoutTextOnLineOrPath(textBox, text, style);
+ layoutTextOnLineOrPath(textBox, textLineLayout, style);
if (m_inPathLayout)
return;
@@ -329,13 +329,13 @@ void SVGTextLayoutEngine::advanceToNextLogicalCharacter(const SVGTextMetrics& lo
m_logicalCharacterOffset += logicalMetrics.length();
}
-void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, const LayoutSVGInlineText& text, const ComputedStyle& style)
+void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, LineLayoutSVGInlineText textLineLayout, const ComputedStyle& style)
{
if (m_inPathLayout && !m_textPathCalculator)
return;
// Find the start of the current text box in the metrics list.
- m_visualMetricsIterator.advanceToTextStart(&text, textBox->start());
+ m_visualMetricsIterator.advanceToTextStart(&textLineLayout, textBox->start());
const Font& font = style.font();
@@ -347,7 +347,7 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons
float lastAngle = 0;
float baselineShift = baselineLayout.calculateBaselineShift(style);
- baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVerticalText, &text);
+ baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVerticalText, textLineLayout);
// Main layout algorithm.
const unsigned boxEndOffset = textBox->start() + textBox->len();
@@ -386,7 +386,7 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons
// Calculate glyph orientation angle.
// Font::width() calculates the resolved FontOrientation for each character,
// but is not exposed today to avoid the API complexity.
- UChar32 currentCharacter = text.codepointAt(m_visualMetricsIterator.characterOffset());
+ UChar32 currentCharacter = textLineLayout.codepointAt(m_visualMetricsIterator.characterOffset());
FontOrientation fontOrientation = font.fontDescription().orientation();
fontOrientation = adjustOrientationForCharacterInMixedVertical(fontOrientation, currentCharacter);

Powered by Google App Engine
This is Rietveld 408576698