OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "platform/text/TextPath.h" | 33 #include "platform/text/TextPath.h" |
34 #include "platform/text/TextRun.h" | 34 #include "platform/text/TextRun.h" |
35 #include "platform/text/TextRunIterator.h" | 35 #include "platform/text/TextRunIterator.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class SVGTextMetricsCalculator { | 40 class SVGTextMetricsCalculator { |
41 public: | 41 public: |
42 SVGTextMetricsCalculator(RenderSVGInlineText*); | 42 SVGTextMetricsCalculator(RenderSVGInlineText*); |
43 ~SVGTextMetricsCalculator(); | |
44 | 43 |
45 SVGTextMetrics computeMetricsForCharacter(unsigned textPosition); | 44 SVGTextMetrics computeMetricsForCharacter(unsigned textPosition); |
46 unsigned textLength() const { return static_cast<unsigned>(m_run.charactersL
ength()); } | 45 unsigned textLength() const { return static_cast<unsigned>(m_run.charactersL
ength()); } |
47 | 46 |
48 bool characterStartsSurrogatePair(unsigned textPosition) const | 47 bool characterStartsSurrogatePair(unsigned textPosition) const |
49 { | 48 { |
50 return U16_IS_LEAD(m_run[textPosition]) && textPosition + 1 < textLength
() && U16_IS_TRAIL(m_run[textPosition + 1]); | 49 return U16_IS_LEAD(m_run[textPosition]) && textPosition + 1 < textLength
() && U16_IS_TRAIL(m_run[textPosition + 1]); |
51 } | 50 } |
52 bool characterIsWhiteSpace(unsigned textPosition) const | 51 bool characterIsWhiteSpace(unsigned textPosition) const |
53 { | 52 { |
(...skipping 29 matching lines...) Expand all Loading... |
83 CodePath codePath = scaledFont.codePath(m_run); | 82 CodePath codePath = scaledFont.codePath(m_run); |
84 m_isComplexText = codePath == ComplexPath; | 83 m_isComplexText = codePath == ComplexPath; |
85 m_run.setCharacterScanForCodePath(!m_isComplexText); | 84 m_run.setCharacterScanForCodePath(!m_isComplexText); |
86 | 85 |
87 if (!m_isComplexText) | 86 if (!m_isComplexText) |
88 m_simpleWidthIterator = adoptPtr(new WidthIterator(&scaledFont, m_run)); | 87 m_simpleWidthIterator = adoptPtr(new WidthIterator(&scaledFont, m_run)); |
89 else | 88 else |
90 setupBidiRuns(); | 89 setupBidiRuns(); |
91 } | 90 } |
92 | 91 |
93 SVGTextMetricsCalculator::~SVGTextMetricsCalculator() | |
94 { | |
95 m_bidiRuns.deleteRuns(); | |
96 } | |
97 | |
98 void SVGTextMetricsCalculator::setupBidiRuns() | 92 void SVGTextMetricsCalculator::setupBidiRuns() |
99 { | 93 { |
100 RenderStyle* style = m_text->style(); | 94 RenderStyle* style = m_text->style(); |
101 m_textDirection = style->direction(); | 95 m_textDirection = style->direction(); |
102 if (isOverride(style->unicodeBidi())) | 96 if (isOverride(style->unicodeBidi())) |
103 return; | 97 return; |
104 | 98 |
105 BidiStatus status(LTR, false); | 99 BidiStatus status(LTR, false); |
106 status.last = status.lastStrong = WTF::Unicode::OtherNeutral; | 100 status.last = status.lastStrong = WTF::Unicode::OtherNeutral; |
107 m_bidiResolver.setStatus(status); | 101 m_bidiResolver.setStatus(status); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 262 } |
269 | 263 |
270 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) | 264 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) |
271 { | 265 { |
272 ASSERT(textRoot); | 266 ASSERT(textRoot); |
273 MeasureTextData data(&allCharactersMap); | 267 MeasureTextData data(&allCharactersMap); |
274 walkTree(textRoot, stopAtLeaf, &data); | 268 walkTree(textRoot, stopAtLeaf, &data); |
275 } | 269 } |
276 | 270 |
277 } | 271 } |
OLD | NEW |