OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef LayoutSVGInlineText_h | 22 #ifndef LayoutSVGInlineText_h |
23 #define LayoutSVGInlineText_h | 23 #define LayoutSVGInlineText_h |
24 | 24 |
25 #include "core/layout/LayoutText.h" | 25 #include "core/layout/LayoutText.h" |
26 #include "core/layout/svg/SVGTextLayoutAttributes.h" | 26 #include "core/layout/svg/SVGCharacterData.h" |
27 #include "core/layout/svg/SVGTextMetrics.h" | 27 #include "core/layout/svg/SVGTextMetrics.h" |
28 #include "wtf/Vector.h" | 28 #include "wtf/Vector.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 class LayoutSVGInlineText final : public LayoutText { | 32 class LayoutSVGInlineText final : public LayoutText { |
33 public: | 33 public: |
34 LayoutSVGInlineText(Node*, PassRefPtr<StringImpl>); | 34 LayoutSVGInlineText(Node*, PassRefPtr<StringImpl>); |
35 | 35 |
36 bool characterStartsNewTextChunk(int position) const; | 36 bool characterStartsNewTextChunk(int position) const; |
37 SVGTextLayoutAttributes* layoutAttributes() { return &m_layoutAttributes; } | 37 SVGCharacterDataMap& characterDataMap() { return m_characterDataMap; } |
38 const SVGTextLayoutAttributes* layoutAttributes() const { return &m_layoutAt
tributes; } | 38 const SVGCharacterDataMap& characterDataMap() const { return m_characterData
Map; } |
39 | 39 |
40 const Vector<SVGTextMetrics>& metricsList() const { return m_metrics; } | 40 const Vector<SVGTextMetrics>& metricsList() const { return m_metrics; } |
41 | 41 |
42 float scalingFactor() const { return m_scalingFactor; } | 42 float scalingFactor() const { return m_scalingFactor; } |
43 const Font& scaledFont() const { return m_scaledFont; } | 43 const Font& scaledFont() const { return m_scaledFont; } |
44 void updateScaledFont(); | 44 void updateScaledFont(); |
45 void updateMetricsList(bool& lastCharacterWasWhiteSpace); | 45 void updateMetricsList(bool& lastCharacterWasWhiteSpace); |
46 static void computeNewScaledFontForStyle(LayoutObject*, float& scalingFactor
, Font& scaledFont); | 46 static void computeNewScaledFontForStyle(LayoutObject*, float& scalingFactor
, Font& scaledFont); |
47 | 47 |
48 // Preserves floating point precision for the use in DRT. It knows how to ro
und and does a better job than enclosingIntRect. | 48 // Preserves floating point precision for the use in DRT. It knows how to ro
und and does a better job than enclosingIntRect. |
(...skipping 16 matching lines...) Expand all Loading... |
65 PositionWithAffinity positionForPoint(const LayoutPoint&) override; | 65 PositionWithAffinity positionForPoint(const LayoutPoint&) override; |
66 LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidt
hToEndOfLine = nullptr) override; | 66 LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidt
hToEndOfLine = nullptr) override; |
67 LayoutRect linesBoundingBox() const override; | 67 LayoutRect linesBoundingBox() const override; |
68 InlineTextBox* createTextBox(int start, unsigned short length) override; | 68 InlineTextBox* createTextBox(int start, unsigned short length) override; |
69 | 69 |
70 LayoutRect absoluteClippedOverflowRect() const final; | 70 LayoutRect absoluteClippedOverflowRect() const final; |
71 FloatRect paintInvalidationRectInLocalSVGCoordinates() const final; | 71 FloatRect paintInvalidationRectInLocalSVGCoordinates() const final; |
72 | 72 |
73 float m_scalingFactor; | 73 float m_scalingFactor; |
74 Font m_scaledFont; | 74 Font m_scaledFont; |
75 SVGTextLayoutAttributes m_layoutAttributes; | 75 SVGCharacterDataMap m_characterDataMap; |
76 Vector<SVGTextMetrics> m_metrics; | 76 Vector<SVGTextMetrics> m_metrics; |
77 }; | 77 }; |
78 | 78 |
79 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGInlineText, isSVGInlineText()); | 79 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGInlineText, isSVGInlineText()); |
80 | 80 |
81 } // namespace blink | 81 } // namespace blink |
82 | 82 |
83 #endif // LayoutSVGInlineText_h | 83 #endif // LayoutSVGInlineText_h |
OLD | NEW |