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

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

Issue 1741073002: Rename enums/functions that collide in chromium style in core/layout/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-6
Patch Set: get-names-7: rebase Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 return; 107 return;
108 } 108 }
109 109
110 m_dx = dx; 110 m_dx = dx;
111 m_dy = dy; 111 m_dy = dy;
112 } 112 }
113 113
114 static void computeGlyphOverflow(SVGInlineTextBox* textBox, SVGTextFragment& tex tFragment) 114 static void computeGlyphOverflow(SVGInlineTextBox* textBox, SVGTextFragment& tex tFragment)
115 { 115 {
116 LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->li neLayoutItem()); 116 LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->ge tLineLayoutItem());
117 TextRun run = SVGTextMetrics::constructTextRun(textLineLayout, textFragment. characterOffset, textFragment.length, textLineLayout.styleRef().direction()); 117 TextRun run = SVGTextMetrics::constructTextRun(textLineLayout, textFragment. characterOffset, textFragment.length, textLineLayout.styleRef().direction());
118 118
119 float scalingFactor = textLineLayout.scalingFactor(); 119 float scalingFactor = textLineLayout.scalingFactor();
120 ASSERT(scalingFactor); 120 ASSERT(scalingFactor);
121 const Font& scaledFont = textLineLayout.scaledFont(); 121 const Font& scaledFont = textLineLayout.scaledFont();
122 FloatRect glyphOverflowBounds; 122 FloatRect glyphOverflowBounds;
123 123
124 float width = scaledFont.width(run, nullptr, &glyphOverflowBounds); 124 float width = scaledFont.width(run, nullptr, &glyphOverflowBounds);
125 float ascent = scaledFont.fontMetrics().floatAscent(); 125 float ascent = scaledFont.fontMetrics().floatAscent();
126 float descent = scaledFont.fontMetrics().floatDescent(); 126 float descent = scaledFont.fontMetrics().floatDescent();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox) 167 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox)
168 { 168 {
169 // Build text chunks for all <textPath> children, using the line layout algo rithm. 169 // Build text chunks for all <textPath> children, using the line layout algo rithm.
170 // This is needeed as text-anchor is just an additional startOffset for text paths. 170 // This is needeed as text-anchor is just an additional startOffset for text paths.
171 SVGTextLayoutEngine lineLayout(m_layoutAttributes); 171 SVGTextLayoutEngine lineLayout(m_layoutAttributes);
172 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect; 172 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect;
173 lineLayout.layoutCharactersInTextBoxes(flowBox); 173 lineLayout.layoutCharactersInTextBoxes(flowBox);
174 174
175 m_inPathLayout = true; 175 m_inPathLayout = true;
176 LineLayoutSVGTextPath textPath = LineLayoutSVGTextPath(flowBox->lineLayoutIt em()); 176 LineLayoutSVGTextPath textPath = LineLayoutSVGTextPath(flowBox->getLineLayou tItem());
177 177
178 m_textPath = textPath.layoutPath(); 178 m_textPath = textPath.layoutPath();
179 if (!m_textPath) 179 if (!m_textPath)
180 return; 180 return;
181 m_textPathStartOffset = textPath.calculateStartOffset(m_textPath->length()); 181 m_textPathStartOffset = textPath.calculateStartOffset(m_textPath->length());
182 182
183 SVGTextPathChunkBuilder textPathChunkLayoutBuilder; 183 SVGTextPathChunkBuilder textPathChunkLayoutBuilder;
184 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes); 184 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes);
185 185
186 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift(); 186 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift();
(...skipping 29 matching lines...) Expand all
216 m_textPathStartOffset = 0; 216 m_textPathStartOffset = 0;
217 m_textPathCurrentOffset = 0; 217 m_textPathCurrentOffset = 0;
218 m_textPathSpacing = 0; 218 m_textPathSpacing = 0;
219 m_textPathScaling = 1; 219 m_textPathScaling = 1;
220 } 220 }
221 221
222 void SVGTextLayoutEngine::layoutInlineTextBox(SVGInlineTextBox* textBox) 222 void SVGTextLayoutEngine::layoutInlineTextBox(SVGInlineTextBox* textBox)
223 { 223 {
224 ASSERT(textBox); 224 ASSERT(textBox);
225 225
226 LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->li neLayoutItem()); 226 LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->ge tLineLayoutItem());
227 ASSERT(textLineLayout.parent()); 227 ASSERT(textLineLayout.parent());
228 ASSERT(textLineLayout.parent().node()); 228 ASSERT(textLineLayout.parent().node());
229 ASSERT(textLineLayout.parent().node()->isSVGElement()); 229 ASSERT(textLineLayout.parent().node()->isSVGElement());
230 230
231 const ComputedStyle& style = textLineLayout.styleRef(); 231 const ComputedStyle& style = textLineLayout.styleRef();
232 232
233 textBox->clearTextFragments(); 233 textBox->clearTextFragments();
234 m_isVerticalText = !style.isHorizontalWritingMode(); 234 m_isVerticalText = !style.isHorizontalWritingMode();
235 layoutTextOnLineOrPath(textBox, textLineLayout, style); 235 layoutTextOnLineOrPath(textBox, textLineLayout, style);
236 236
237 if (m_inPathLayout) 237 if (m_inPathLayout)
238 return; 238 return;
239 239
240 m_lineLayoutBoxes.append(textBox); 240 m_lineLayoutBoxes.append(textBox);
241 } 241 }
242 242
243 static bool definesTextLengthWithSpacing(const InlineFlowBox* start) 243 static bool definesTextLengthWithSpacing(const InlineFlowBox* start)
244 { 244 {
245 SVGTextContentElement* textContentElement = SVGTextContentElement::elementFr omLineLayoutItem(start->lineLayoutItem()); 245 SVGTextContentElement* textContentElement = SVGTextContentElement::elementFr omLineLayoutItem(start->getLineLayoutItem());
246 return textContentElement 246 return textContentElement
247 && textContentElement->lengthAdjust()->currentValue()->enumValue() == SV GLengthAdjustSpacing 247 && textContentElement->lengthAdjust()->currentValue()->enumValue() == SV GLengthAdjustSpacing
248 && textContentElement->textLengthIsSpecifiedByUser(); 248 && textContentElement->textLengthIsSpecifiedByUser();
249 } 249 }
250 250
251 void SVGTextLayoutEngine::layoutCharactersInTextBoxes(InlineFlowBox* start) 251 void SVGTextLayoutEngine::layoutCharactersInTextBoxes(InlineFlowBox* start)
252 { 252 {
253 bool textLengthSpacingInEffect = m_textLengthSpacingInEffect || definesTextL engthWithSpacing(start); 253 bool textLengthSpacingInEffect = m_textLengthSpacingInEffect || definesTextL engthWithSpacing(start);
254 TemporaryChange<bool> textLengthSpacingScope(m_textLengthSpacingInEffect, te xtLengthSpacingInEffect); 254 TemporaryChange<bool> textLengthSpacingScope(m_textLengthSpacingInEffect, te xtLengthSpacingInEffect);
255 255
256 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin e()) { 256 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin e()) {
257 if (child->isSVGInlineTextBox()) { 257 if (child->isSVGInlineTextBox()) {
258 ASSERT(child->lineLayoutItem().isSVGInlineText()); 258 ASSERT(child->getLineLayoutItem().isSVGInlineText());
259 layoutInlineTextBox(toSVGInlineTextBox(child)); 259 layoutInlineTextBox(toSVGInlineTextBox(child));
260 } else { 260 } else {
261 // Skip generated content. 261 // Skip generated content.
262 Node* node = child->lineLayoutItem().node(); 262 Node* node = child->getLineLayoutItem().node();
263 if (!node) 263 if (!node)
264 continue; 264 continue;
265 265
266 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); 266 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
267 bool isTextPath = isSVGTextPathElement(*node); 267 bool isTextPath = isSVGTextPathElement(*node);
268 if (isTextPath) 268 if (isTextPath)
269 beginTextPathLayout(flowBox); 269 beginTextPathLayout(flowBox);
270 270
271 layoutCharactersInTextBoxes(flowBox); 271 layoutCharactersInTextBoxes(flowBox);
272 272
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 549
550 if (!didStartTextFragment) 550 if (!didStartTextFragment)
551 return; 551 return;
552 552
553 // Close last open fragment, if needed. 553 // Close last open fragment, if needed.
554 recordTextFragment(textBox); 554 recordTextFragment(textBox);
555 } 555 }
556 556
557 } // namespace blink 557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698