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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef SVGTextLayoutEngine_h | 20 #ifndef SVGTextLayoutEngine_h |
21 #define SVGTextLayoutEngine_h | 21 #define SVGTextLayoutEngine_h |
22 | 22 |
23 #include "core/layout/svg/SVGTextChunkBuilder.h" | |
24 #include "core/layout/svg/SVGTextFragment.h" | 23 #include "core/layout/svg/SVGTextFragment.h" |
25 #include "core/layout/svg/SVGTextLayoutAttributes.h" | 24 #include "core/layout/svg/SVGTextLayoutAttributes.h" |
26 #include "core/layout/svg/SVGTextMetrics.h" | 25 #include "core/layout/svg/SVGTextMetrics.h" |
27 #include "platform/graphics/Path.h" | 26 #include "platform/graphics/Path.h" |
28 #include "wtf/Vector.h" | 27 #include "wtf/Vector.h" |
29 | 28 |
30 namespace blink { | 29 namespace blink { |
31 | 30 |
32 class LayoutObject; | 31 class LayoutObject; |
33 class ComputedStyle; | 32 class ComputedStyle; |
(...skipping 23 matching lines...) Expand all Loading... |
57 | 56 |
58 private: | 57 private: |
59 void updateCharacterPositionIfNeeded(float& x, float& y); | 58 void updateCharacterPositionIfNeeded(float& x, float& y); |
60 void updateCurrentTextPosition(float x, float y, float glyphAdvance); | 59 void updateCurrentTextPosition(float x, float y, float glyphAdvance); |
61 void updateRelativePositionAdjustmentsIfNeeded(float dx, float dy); | 60 void updateRelativePositionAdjustmentsIfNeeded(float dx, float dy); |
62 | 61 |
63 void recordTextFragment(SVGInlineTextBox*, const Vector<SVGTextMetrics>&); | 62 void recordTextFragment(SVGInlineTextBox*, const Vector<SVGTextMetrics>&); |
64 bool parentDefinesTextLength(LayoutObject*) const; | 63 bool parentDefinesTextLength(LayoutObject*) const; |
65 | 64 |
66 void layoutTextOnLineOrPath(SVGInlineTextBox*, const LayoutSVGInlineText&, c
onst ComputedStyle&); | 65 void layoutTextOnLineOrPath(SVGInlineTextBox*, const LayoutSVGInlineText&, c
onst ComputedStyle&); |
67 void finalizeTransformMatrices(Vector<SVGInlineTextBox*>&); | |
68 | 66 |
69 bool currentLogicalCharacterAttributes(SVGTextLayoutAttributes*&); | 67 bool currentLogicalCharacterAttributes(SVGTextLayoutAttributes*&); |
70 bool currentLogicalCharacterMetrics(SVGTextLayoutAttributes*&, SVGTextMetric
s&); | 68 bool currentLogicalCharacterMetrics(SVGTextLayoutAttributes*&, SVGTextMetric
s&); |
71 bool currentVisualCharacterMetrics(SVGInlineTextBox*, const Vector<SVGTextMe
trics>&, SVGTextMetrics&); | 69 bool currentVisualCharacterMetrics(SVGInlineTextBox*, const Vector<SVGTextMe
trics>&, SVGTextMetrics&); |
72 | 70 |
73 void advanceToNextLogicalCharacter(const SVGTextMetrics&); | 71 void advanceToNextLogicalCharacter(const SVGTextMetrics&); |
74 void advanceToNextVisualCharacter(const SVGTextMetrics&); | 72 void advanceToNextVisualCharacter(const SVGTextMetrics&); |
75 | 73 |
76 private: | 74 private: |
77 Vector<SVGTextLayoutAttributes*>& m_layoutAttributes; | 75 Vector<SVGTextLayoutAttributes*>& m_layoutAttributes; |
78 | 76 |
79 Vector<SVGInlineTextBox*> m_lineLayoutBoxes; | 77 Vector<SVGInlineTextBox*> m_lineLayoutBoxes; |
80 Vector<SVGInlineTextBox*> m_pathLayoutBoxes; | 78 Vector<SVGInlineTextBox*> m_pathLayoutBoxes; |
81 SVGTextChunkBuilder m_chunkLayoutBuilder; | |
82 | 79 |
83 SVGTextFragment m_currentTextFragment; | 80 SVGTextFragment m_currentTextFragment; |
84 unsigned m_layoutAttributesPosition; | 81 unsigned m_layoutAttributesPosition; |
85 unsigned m_logicalCharacterOffset; | 82 unsigned m_logicalCharacterOffset; |
86 unsigned m_logicalMetricsListOffset; | 83 unsigned m_logicalMetricsListOffset; |
87 unsigned m_visualCharacterOffset; | 84 unsigned m_visualCharacterOffset; |
88 unsigned m_visualMetricsListOffset; | 85 unsigned m_visualMetricsListOffset; |
89 float m_x; | 86 float m_x; |
90 float m_y; | 87 float m_y; |
91 float m_dx; | 88 float m_dx; |
92 float m_dy; | 89 float m_dy; |
93 bool m_isVerticalText; | 90 bool m_isVerticalText; |
94 bool m_inPathLayout; | 91 bool m_inPathLayout; |
95 | 92 |
96 // Text on path layout | 93 // Text on path layout |
97 Path::PositionCalculator* m_textPathCalculator; | 94 Path::PositionCalculator* m_textPathCalculator; |
98 float m_textPathLength; | 95 float m_textPathLength; |
99 float m_textPathStartOffset; | 96 float m_textPathStartOffset; |
100 float m_textPathCurrentOffset; | 97 float m_textPathCurrentOffset; |
101 float m_textPathSpacing; | 98 float m_textPathSpacing; |
102 float m_textPathScaling; | 99 float m_textPathScaling; |
103 }; | 100 }; |
104 | 101 |
105 } // namespace blink | 102 } // namespace blink |
106 | 103 |
107 #endif | 104 #endif |
OLD | NEW |