OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights reserved. |
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 | 22 |
23 #ifndef RenderText_h | 23 #ifndef RenderText_h |
24 #define RenderText_h | 24 #define RenderText_h |
25 | 25 |
26 #include "core/dom/Text.h" | 26 #include "core/dom/Text.h" |
| 27 #include "core/layout/LayoutObject.h" |
27 #include "core/layout/line/FloatToLayoutUnit.h" | 28 #include "core/layout/line/FloatToLayoutUnit.h" |
28 #include "core/rendering/RenderObject.h" | |
29 #include "platform/LengthFunctions.h" | 29 #include "platform/LengthFunctions.h" |
30 #include "platform/text/TextPath.h" | 30 #include "platform/text/TextPath.h" |
31 #include "wtf/Forward.h" | 31 #include "wtf/Forward.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class AbstractInlineTextBox; | 36 class AbstractInlineTextBox; |
37 class InlineTextBox; | 37 class InlineTextBox; |
38 | 38 |
39 class RenderText : public RenderObject { | 39 class RenderText : public LayoutObject { |
40 public: | 40 public: |
41 // FIXME: If the node argument is not a Text node or the string argument is | 41 // FIXME: If the node argument is not a Text node or the string argument is |
42 // not the content of the Text node, updating text-transform property | 42 // not the content of the Text node, updating text-transform property |
43 // doesn't re-transform the string. | 43 // doesn't re-transform the string. |
44 RenderText(Node*, PassRefPtr<StringImpl>); | 44 RenderText(Node*, PassRefPtr<StringImpl>); |
45 #if ENABLE(ASSERT) | 45 #if ENABLE(ASSERT) |
46 virtual ~RenderText(); | 46 virtual ~RenderText(); |
47 #endif | 47 #endif |
48 | 48 |
49 virtual const char* renderName() const override; | 49 virtual const char* renderName() const override; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 virtual void invalidateDisplayItemClients(DisplayItemList*) const override; | 157 virtual void invalidateDisplayItemClients(DisplayItemList*) const override; |
158 | 158 |
159 private: | 159 private: |
160 void computePreferredLogicalWidths(float leadWidth); | 160 void computePreferredLogicalWidths(float leadWidth); |
161 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont
Data*>& fallbackFonts, GlyphOverflow&); | 161 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont
Data*>& fallbackFonts, GlyphOverflow&); |
162 | 162 |
163 bool computeCanUseSimpleFontCodePath() const; | 163 bool computeCanUseSimpleFontCodePath() const; |
164 | 164 |
165 // Make length() private so that callers that have a RenderText* | 165 // Make length() private so that callers that have a RenderText* |
166 // will use the more efficient textLength() instead, while | 166 // will use the more efficient textLength() instead, while |
167 // callers with a RenderObject* can continue to use length(). | 167 // callers with a LayoutObject* can continue to use length(). |
168 virtual unsigned length() const override final { return textLength(); } | 168 virtual unsigned length() const override final { return textLength(); } |
169 | 169 |
170 virtual void paint(const PaintInfo&, const LayoutPoint&) override final { AS
SERT_NOT_REACHED(); } | 170 virtual void paint(const PaintInfo&, const LayoutPoint&) override final { AS
SERT_NOT_REACHED(); } |
171 virtual void layout() override final { ASSERT_NOT_REACHED(); } | 171 virtual void layout() override final { ASSERT_NOT_REACHED(); } |
172 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation&, const LayoutPoint&, HitTestAction) override final { ASSERT_NOT_REACH
ED(); return false; } | 172 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation&, const LayoutPoint&, HitTestAction) override final { ASSERT_NOT_REACH
ED(); return false; } |
173 | 173 |
174 void deleteTextBoxes(); | 174 void deleteTextBoxes(); |
175 bool containsOnlyWhitespace(unsigned from, unsigned len) const; | 175 bool containsOnlyWhitespace(unsigned from, unsigned len) const; |
176 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; | 176 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; |
177 bool isAllASCII() const { return m_isAllASCII; } | 177 bool isAllASCII() const { return m_isAllASCII; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 inline UChar RenderText::characterAt(unsigned i) const | 220 inline UChar RenderText::characterAt(unsigned i) const |
221 { | 221 { |
222 if (i >= textLength()) | 222 if (i >= textLength()) |
223 return 0; | 223 return 0; |
224 | 224 |
225 return uncheckedCharacterAt(i); | 225 return uncheckedCharacterAt(i); |
226 } | 226 } |
227 | 227 |
228 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderText, isText()); | 228 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderText, isText()); |
229 | 229 |
230 #if !ENABLE(ASSERT) | 230 #if !ENABLE(ASSERT) |
231 inline void RenderText::checkConsistency() const | 231 inline void RenderText::checkConsistency() const |
232 { | 232 { |
233 } | 233 } |
234 #endif | 234 #endif |
235 | 235 |
236 inline RenderText* Text::renderer() const | 236 inline RenderText* Text::renderer() const |
237 { | 237 { |
238 return toRenderText(CharacterData::renderer()); | 238 return toRenderText(CharacterData::renderer()); |
239 } | 239 } |
240 | 240 |
241 void applyTextTransform(const RenderStyle*, String&, UChar); | 241 void applyTextTransform(const RenderStyle*, String&, UChar); |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
244 | 244 |
245 #endif // RenderText_h | 245 #endif // RenderText_h |
OLD | NEW |