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

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

Issue 1625683003: [Line Layout API] Some harder SVGTextLayoutEngine changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_api_easy_svg
Patch Set: readd null check with new isNull() method on LineLayoutItem Created 4 years, 10 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SVGTextPathChunkBuilder textPathChunkLayoutBuilder; 184 SVGTextPathChunkBuilder textPathChunkLayoutBuilder;
185 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes); 185 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes);
186 186
187 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift(); 187 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift();
188 m_textPathCurrentOffset = m_textPathStartOffset; 188 m_textPathCurrentOffset = m_textPathStartOffset;
189 189
190 // Eventually handle textLength adjustments. 190 // Eventually handle textLength adjustments.
191 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown; 191 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown;
192 float desiredTextLength = 0; 192 float desiredTextLength = 0;
193 193
194 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme ntFromLayoutObject(LineLayoutAPIShim::layoutObjectFrom(textPath))) { 194 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme ntFromLineLayoutItem(textPath)) {
195 SVGLengthContext lengthContext(textContentElement); 195 SVGLengthContext lengthContext(textContentElement);
196 lengthAdjust = textContentElement->lengthAdjust()->currentValue()->enumV alue(); 196 lengthAdjust = textContentElement->lengthAdjust()->currentValue()->enumV alue();
197 if (textContentElement->textLengthIsSpecifiedByUser()) 197 if (textContentElement->textLengthIsSpecifiedByUser())
198 desiredTextLength = textContentElement->textLength()->currentValue() ->value(lengthContext); 198 desiredTextLength = textContentElement->textLength()->currentValue() ->value(lengthContext);
199 else 199 else
200 desiredTextLength = 0; 200 desiredTextLength = 0;
201 } 201 }
202 202
203 if (!desiredTextLength) 203 if (!desiredTextLength)
204 return; 204 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 layoutTextOnLineOrPath(textBox, textLineLayout, style); 238 layoutTextOnLineOrPath(textBox, textLineLayout, style);
239 239
240 if (m_inPathLayout) 240 if (m_inPathLayout)
241 return; 241 return;
242 242
243 m_lineLayoutBoxes.append(textBox); 243 m_lineLayoutBoxes.append(textBox);
244 } 244 }
245 245
246 static bool definesTextLengthWithSpacing(const InlineFlowBox* start) 246 static bool definesTextLengthWithSpacing(const InlineFlowBox* start)
247 { 247 {
248 SVGTextContentElement* textContentElement = SVGTextContentElement::elementFr omLayoutObject(&start->layoutObject()); 248 SVGTextContentElement* textContentElement = SVGTextContentElement::elementFr omLineLayoutItem(start->lineLayoutItem());
249 return textContentElement 249 return textContentElement
250 && textContentElement->lengthAdjust()->currentValue()->enumValue() == SV GLengthAdjustSpacing 250 && textContentElement->lengthAdjust()->currentValue()->enumValue() == SV GLengthAdjustSpacing
251 && textContentElement->textLengthIsSpecifiedByUser(); 251 && textContentElement->textLengthIsSpecifiedByUser();
252 } 252 }
253 253
254 void SVGTextLayoutEngine::layoutCharactersInTextBoxes(InlineFlowBox* start) 254 void SVGTextLayoutEngine::layoutCharactersInTextBoxes(InlineFlowBox* start)
255 { 255 {
256 bool textLengthSpacingInEffect = m_textLengthSpacingInEffect || definesTextL engthWithSpacing(start); 256 bool textLengthSpacingInEffect = m_textLengthSpacingInEffect || definesTextL engthWithSpacing(start);
257 TemporaryChange<bool> textLengthSpacingScope(m_textLengthSpacingInEffect, te xtLengthSpacingInEffect); 257 TemporaryChange<bool> textLengthSpacingScope(m_textLengthSpacingInEffect, te xtLengthSpacingInEffect);
258 258
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 551 }
552 552
553 if (!didStartTextFragment) 553 if (!didStartTextFragment)
554 return; 554 return;
555 555
556 // Close last open fragment, if needed. 556 // Close last open fragment, if needed.
557 recordTextFragment(textBox); 557 recordTextFragment(textBox);
558 } 558 }
559 559
560 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698