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

Side by Side Diff: Source/core/rendering/svg/SVGTextMetricsBuilder.cpp

Issue 111833006: Avoiding multiple text/string parsing while creating TextRun (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@FontOptPatch1
Patch Set: Fixing merge issues after LGTM Created 6 years, 11 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
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer(RenderSVGInlin eText* text) 95 void SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer(RenderSVGInlin eText* text)
96 { 96 {
97 m_text = text; 97 m_text = text;
98 m_textPosition = 0; 98 m_textPosition = 0;
99 m_currentMetrics = SVGTextMetrics(); 99 m_currentMetrics = SVGTextMetrics();
100 m_complexStartToCurrentMetrics = SVGTextMetrics(); 100 m_complexStartToCurrentMetrics = SVGTextMetrics();
101 m_totalWidth = 0; 101 m_totalWidth = 0;
102 102
103 const Font& scaledFont = text->scaledFont(); 103 const Font& scaledFont = text->scaledFont();
104 m_run = SVGTextMetrics::constructTextRun(text, 0, text->textLength()); 104 m_run = SVGTextMetrics::constructTextRun(text, 0, text->textLength());
105 m_isComplexText = scaledFont.codePath(m_run) == ComplexPath; 105 CodePath codePath = scaledFont.codePath(m_run);
106 m_isComplexText = codePath == ComplexPath;
107 m_run.setCharacterScanForCodePath(!m_isComplexText);
106 108
107 if (m_isComplexText) 109 if (m_isComplexText)
108 m_simpleWidthIterator.clear(); 110 m_simpleWidthIterator.clear();
109 else 111 else
110 m_simpleWidthIterator = adoptPtr(new WidthIterator(&scaledFont, m_run)); 112 m_simpleWidthIterator = adoptPtr(new WidthIterator(&scaledFont, m_run));
111 } 113 }
112 114
113 struct MeasureTextData { 115 struct MeasureTextData {
114 MeasureTextData(SVGCharacterDataMap* characterDataMap) 116 MeasureTextData(SVGCharacterDataMap* characterDataMap)
115 : allCharactersMap(characterDataMap) 117 : allCharactersMap(characterDataMap)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 220 }
219 221
220 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) 222 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap)
221 { 223 {
222 ASSERT(textRoot); 224 ASSERT(textRoot);
223 MeasureTextData data(&allCharactersMap); 225 MeasureTextData data(&allCharactersMap);
224 walkTree(textRoot, stopAtLeaf, &data); 226 walkTree(textRoot, stopAtLeaf, &data);
225 } 227 }
226 228
227 } 229 }
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698