| 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/api/LineLayoutSVGInlineText.h" | 23 #include "core/layout/api/LineLayoutSVGInlineText.h" |
| 24 #include "core/layout/svg/LayoutSVGInlineText.h" | 24 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 25 #include "core/layout/svg/SVGTextFragment.h" | 25 #include "core/layout/svg/SVGTextFragment.h" |
| 26 #include "core/layout/svg/SVGTextLayoutAttributes.h" | 26 #include "core/layout/svg/SVGTextLayoutAttributes.h" |
| 27 #include "core/layout/svg/SVGTextMetrics.h" | 27 #include "core/layout/svg/SVGTextMetrics.h" |
| 28 #include "platform/graphics/Path.h" | |
| 29 #include "wtf/Allocator.h" | 28 #include "wtf/Allocator.h" |
| 30 #include "wtf/Vector.h" | 29 #include "wtf/Vector.h" |
| 31 | 30 |
| 32 namespace blink { | 31 namespace blink { |
| 33 | 32 |
| 34 class ComputedStyle; | 33 class ComputedStyle; |
| 35 class InlineFlowBox; | 34 class InlineFlowBox; |
| 36 class LayoutObject; | 35 class LayoutObject; |
| 36 class PathPositionMapper; |
| 37 class SVGInlineFlowBox; | 37 class SVGInlineFlowBox; |
| 38 class SVGInlineTextBox; | 38 class SVGInlineTextBox; |
| 39 | 39 |
| 40 // SVGTextLayoutEngine performs the second layout phase for SVG text. | 40 // SVGTextLayoutEngine performs the second layout phase for SVG text. |
| 41 // | 41 // |
| 42 // The InlineBox tree was created, containing the text chunk information, necess
ary to apply | 42 // The InlineBox tree was created, containing the text chunk information, necess
ary to apply |
| 43 // certain SVG specific text layout properties (text-length adjustments and text
-anchor). | 43 // certain SVG specific text layout properties (text-length adjustments and text
-anchor). |
| 44 // The second layout phase uses the SVGTextLayoutAttributes stored in the indivi
dual | 44 // The second layout phase uses the SVGTextLayoutAttributes stored in the indivi
dual |
| 45 // LayoutSVGInlineText layoutObjects to compute the final positions for each cha
racter | 45 // LayoutSVGInlineText layoutObjects to compute the final positions for each cha
racter |
| 46 // which are stored in the SVGInlineTextBox objects. | 46 // which are stored in the SVGInlineTextBox objects. |
| 47 | 47 |
| 48 class SVGTextLayoutEngine { | 48 class SVGTextLayoutEngine { |
| 49 STACK_ALLOCATED(); | 49 STACK_ALLOCATED(); |
| 50 WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngine); | 50 WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngine); |
| 51 public: | 51 public: |
| 52 SVGTextLayoutEngine(Vector<SVGTextLayoutAttributes*>&); | 52 SVGTextLayoutEngine(Vector<SVGTextLayoutAttributes*>&); |
| 53 ~SVGTextLayoutEngine(); |
| 53 | 54 |
| 54 Vector<SVGTextLayoutAttributes*>& layoutAttributes() { return m_layoutAttrib
utes; } | 55 Vector<SVGTextLayoutAttributes*>& layoutAttributes() { return m_layoutAttrib
utes; } |
| 55 | 56 |
| 56 void layoutCharactersInTextBoxes(InlineFlowBox* start); | 57 void layoutCharactersInTextBoxes(InlineFlowBox* start); |
| 57 void finishLayout(); | 58 void finishLayout(); |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 void updateCharacterPositionIfNeeded(float& x, float& y); | 61 void updateCharacterPositionIfNeeded(float& x, float& y); |
| 61 void updateCurrentTextPosition(float x, float y, float glyphAdvance); | 62 void updateCurrentTextPosition(float x, float y, float glyphAdvance); |
| 62 void updateRelativePositionAdjustmentsIfNeeded(float dx, float dy); | 63 void updateRelativePositionAdjustmentsIfNeeded(float dx, float dy); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 SVGInlineTextMetricsIterator m_visualMetricsIterator; | 86 SVGInlineTextMetricsIterator m_visualMetricsIterator; |
| 86 float m_x; | 87 float m_x; |
| 87 float m_y; | 88 float m_y; |
| 88 float m_dx; | 89 float m_dx; |
| 89 float m_dy; | 90 float m_dy; |
| 90 bool m_isVerticalText; | 91 bool m_isVerticalText; |
| 91 bool m_inPathLayout; | 92 bool m_inPathLayout; |
| 92 bool m_textLengthSpacingInEffect; | 93 bool m_textLengthSpacingInEffect; |
| 93 | 94 |
| 94 // Text on path layout | 95 // Text on path layout |
| 95 Path::PositionCalculator* m_textPathCalculator; | 96 OwnPtr<PathPositionMapper> m_textPath; |
| 96 float m_textPathLength; | |
| 97 float m_textPathStartOffset; | 97 float m_textPathStartOffset; |
| 98 float m_textPathCurrentOffset; | 98 float m_textPathCurrentOffset; |
| 99 float m_textPathSpacing; | 99 float m_textPathSpacing; |
| 100 float m_textPathScaling; | 100 float m_textPathScaling; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| 104 | 104 |
| 105 #endif | 105 #endif |
| OLD | NEW |