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 * |
(...skipping 27 matching lines...) Expand all Loading... |
38 class RenderText : public RenderObject { | 38 class RenderText : public RenderObject { |
39 public: | 39 public: |
40 // FIXME: If the node argument is not a Text node or the string argument is | 40 // FIXME: If the node argument is not a Text node or the string argument is |
41 // not the content of the Text node, updating text-transform property | 41 // not the content of the Text node, updating text-transform property |
42 // doesn't re-transform the string. | 42 // doesn't re-transform the string. |
43 RenderText(Node*, PassRefPtr<StringImpl>); | 43 RenderText(Node*, PassRefPtr<StringImpl>); |
44 #if ENABLE(ASSERT) | 44 #if ENABLE(ASSERT) |
45 virtual ~RenderText(); | 45 virtual ~RenderText(); |
46 #endif | 46 #endif |
47 | 47 |
48 virtual const char* renderName() const OVERRIDE; | 48 virtual const char* renderName() const override; |
49 | 49 |
50 virtual bool isTextFragment() const; | 50 virtual bool isTextFragment() const; |
51 virtual bool isWordBreak() const; | 51 virtual bool isWordBreak() const; |
52 | 52 |
53 virtual PassRefPtr<StringImpl> originalText() const; | 53 virtual PassRefPtr<StringImpl> originalText() const; |
54 | 54 |
55 void extractTextBox(InlineTextBox*); | 55 void extractTextBox(InlineTextBox*); |
56 void attachTextBox(InlineTextBox*); | 56 void attachTextBox(InlineTextBox*); |
57 void removeTextBox(InlineTextBox*); | 57 void removeTextBox(InlineTextBox*); |
58 | 58 |
59 const String& text() const { return m_text; } | 59 const String& text() const { return m_text; } |
60 virtual unsigned textStartOffset() const { return 0; } | 60 virtual unsigned textStartOffset() const { return 0; } |
61 String plainText() const; | 61 String plainText() const; |
62 | 62 |
63 InlineTextBox* createInlineTextBox(int start, unsigned short length); | 63 InlineTextBox* createInlineTextBox(int start, unsigned short length); |
64 void dirtyLineBoxes(bool fullLayout); | 64 void dirtyLineBoxes(bool fullLayout); |
65 | 65 |
66 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const OVERRIDE FINAL; | 66 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const override final; |
67 void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsig
ned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); | 67 void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsig
ned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); |
68 | 68 |
69 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID
E FINAL; | 69 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid
e final; |
70 void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, uns
igned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); | 70 void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, uns
igned endOffset = INT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0); |
71 | 71 |
72 enum ClippingOption { NoClipping, ClipToEllipsis }; | 72 enum ClippingOption { NoClipping, ClipToEllipsis }; |
73 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed = 0, ClippingOption =
NoClipping) const; | 73 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed = 0, ClippingOption =
NoClipping) const; |
74 | 74 |
75 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) OVERRIDE; | 75 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override; |
76 | 76 |
77 bool is8Bit() const { return m_text.is8Bit(); } | 77 bool is8Bit() const { return m_text.is8Bit(); } |
78 const LChar* characters8() const { return m_text.impl()->characters8(); } | 78 const LChar* characters8() const { return m_text.impl()->characters8(); } |
79 const UChar* characters16() const { return m_text.impl()->characters16(); } | 79 const UChar* characters16() const { return m_text.impl()->characters16(); } |
80 bool hasEmptyText() const { return m_text.isEmpty(); } | 80 bool hasEmptyText() const { return m_text.isEmpty(); } |
81 UChar characterAt(unsigned) const; | 81 UChar characterAt(unsigned) const; |
82 UChar uncheckedCharacterAt(unsigned) const; | 82 UChar uncheckedCharacterAt(unsigned) const; |
83 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } | 83 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } |
84 unsigned textLength() const { return m_text.length(); } // non virtual imple
mentation of length() | 84 unsigned textLength() const { return m_text.length(); } // non virtual imple
mentation of length() |
85 void positionLineBox(InlineBox*); | 85 void positionLineBox(InlineBox*); |
(...skipping 17 matching lines...) Expand all Loading... |
103 | 103 |
104 FloatPoint firstRunOrigin() const; | 104 FloatPoint firstRunOrigin() const; |
105 float firstRunX() const; | 105 float firstRunX() const; |
106 float firstRunY() const; | 106 float firstRunY() const; |
107 | 107 |
108 virtual void setText(PassRefPtr<StringImpl>, bool force = false); | 108 virtual void setText(PassRefPtr<StringImpl>, bool force = false); |
109 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len
, bool force = false); | 109 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len
, bool force = false); |
110 | 110 |
111 virtual void transformText(); | 111 virtual void transformText(); |
112 | 112 |
113 virtual bool canBeSelectionLeaf() const OVERRIDE { return true; } | 113 virtual bool canBeSelectionLeaf() const override { return true; } |
114 virtual void setSelectionState(SelectionState s) OVERRIDE FINAL; | 114 virtual void setSelectionState(SelectionState) override final; |
115 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer) const OVERRIDE; | 115 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer) const override; |
116 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = 0) OVERRIDE; | 116 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = 0) override; |
117 | 117 |
118 InlineTextBox* firstTextBox() const { return m_firstTextBox; } | 118 InlineTextBox* firstTextBox() const { return m_firstTextBox; } |
119 InlineTextBox* lastTextBox() const { return m_lastTextBox; } | 119 InlineTextBox* lastTextBox() const { return m_lastTextBox; } |
120 | 120 |
121 virtual int caretMinOffset() const OVERRIDE; | 121 virtual int caretMinOffset() const override; |
122 virtual int caretMaxOffset() const OVERRIDE; | 122 virtual int caretMaxOffset() const override; |
123 unsigned renderedTextLength() const; | 123 unsigned renderedTextLength() const; |
124 | 124 |
125 virtual int previousOffset(int current) const OVERRIDE FINAL; | 125 virtual int previousOffset(int current) const override final; |
126 virtual int previousOffsetForBackwardDeletion(int current) const OVERRIDE FI
NAL; | 126 virtual int previousOffsetForBackwardDeletion(int current) const override fi
nal; |
127 virtual int nextOffset(int current) const OVERRIDE FINAL; | 127 virtual int nextOffset(int current) const override final; |
128 | 128 |
129 bool containsReversedText() const { return m_containsReversedText; } | 129 bool containsReversedText() const { return m_containsReversedText; } |
130 | 130 |
131 bool isSecure() const { return style()->textSecurity() != TSNONE; } | 131 bool isSecure() const { return style()->textSecurity() != TSNONE; } |
132 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); | 132 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); |
133 | 133 |
134 bool isAllCollapsibleWhitespace() const; | 134 bool isAllCollapsibleWhitespace() const; |
135 | 135 |
136 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; } | 136 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; } |
137 | 137 |
138 void removeAndDestroyTextBoxes(); | 138 void removeAndDestroyTextBoxes(); |
139 | 139 |
140 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox(); | 140 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox(); |
141 | 141 |
142 protected: | 142 protected: |
143 virtual void willBeDestroyed() OVERRIDE; | 143 virtual void willBeDestroyed() override; |
144 | 144 |
145 virtual void styleWillChange(StyleDifference, const RenderStyle&) OVERRIDE F
INAL { } | 145 virtual void styleWillChange(StyleDifference, const RenderStyle&) override f
inal { } |
146 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 146 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
147 | 147 |
148 virtual void setTextInternal(PassRefPtr<StringImpl>); | 148 virtual void setTextInternal(PassRefPtr<StringImpl>); |
149 virtual UChar previousCharacter() const; | 149 virtual UChar previousCharacter() const; |
150 | 150 |
151 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur
rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons
t OVERRIDE; | 151 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur
rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons
t override; |
152 | 152 |
153 virtual InlineTextBox* createTextBox(int start, unsigned short length); // S
ubclassed by SVG. | 153 virtual InlineTextBox* createTextBox(int start, unsigned short length); // S
ubclassed by SVG. |
154 | 154 |
155 private: | 155 private: |
156 void computePreferredLogicalWidths(float leadWidth); | 156 void computePreferredLogicalWidths(float leadWidth); |
157 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont
Data*>& fallbackFonts, GlyphOverflow&); | 157 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont
Data*>& fallbackFonts, GlyphOverflow&); |
158 | 158 |
159 bool computeCanUseSimpleFontCodePath() const; | 159 bool computeCanUseSimpleFontCodePath() const; |
160 | 160 |
161 // Make length() private so that callers that have a RenderText* | 161 // Make length() private so that callers that have a RenderText* |
162 // will use the more efficient textLength() instead, while | 162 // will use the more efficient textLength() instead, while |
163 // callers with a RenderObject* can continue to use length(). | 163 // callers with a RenderObject* can continue to use length(). |
164 virtual unsigned length() const OVERRIDE FINAL { return textLength(); } | 164 virtual unsigned length() const override final { return textLength(); } |
165 | 165 |
166 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL { ASSERT_N
OT_REACHED(); } | 166 virtual void paint(PaintInfo&, const LayoutPoint&) override final { ASSERT_N
OT_REACHED(); } |
167 virtual void layout() OVERRIDE FINAL { ASSERT_NOT_REACHED(); } | 167 virtual void layout() override final { ASSERT_NOT_REACHED(); } |
168 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation&, const LayoutPoint&, HitTestAction) OVERRIDE FINAL { ASSERT_NOT_REACH
ED(); return false; } | 168 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation&, const LayoutPoint&, HitTestAction) override final { ASSERT_NOT_REACH
ED(); return false; } |
169 | 169 |
170 void deleteTextBoxes(); | 170 void deleteTextBoxes(); |
171 bool containsOnlyWhitespace(unsigned from, unsigned len) const; | 171 bool containsOnlyWhitespace(unsigned from, unsigned len) const; |
172 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; | 172 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect
ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; |
173 bool isAllASCII() const { return m_isAllASCII; } | 173 bool isAllASCII() const { return m_isAllASCII; } |
174 | 174 |
175 void secureText(UChar mask); | 175 void secureText(UChar mask); |
176 | 176 |
177 bool isText() const WTF_DELETED_FUNCTION; // This will catch anyone doing an
unnecessary check. | 177 bool isText() const WTF_DELETED_FUNCTION; // This will catch anyone doing an
unnecessary check. |
178 | 178 |
179 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t OVERRIDE FINAL; | 179 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t override final; |
180 // The parent invalidates for RenderText, so RenderText does nothing. | 180 // The parent invalidates for RenderText, so RenderText does nothing. |
181 virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidat
ionState&, const RenderLayerModelObject& paintInvalidationContainer) OVERRIDE FI
NAL | 181 virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidat
ionState&, const RenderLayerModelObject& paintInvalidationContainer) override fi
nal |
182 { | 182 { |
183 invalidateSelectionIfNeeded(paintInvalidationContainer); | 183 invalidateSelectionIfNeeded(paintInvalidationContainer); |
184 return PaintInvalidationNone; | 184 return PaintInvalidationNone; |
185 } | 185 } |
186 | 186 |
187 void checkConsistency() const; | 187 void checkConsistency() const; |
188 | 188 |
189 // We put the bitfield first to minimize padding on 64-bit. | 189 // We put the bitfield first to minimize padding on 64-bit. |
190 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl
e lines. | 190 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl
e lines. |
191 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit
h '\n'). | 191 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit
h '\n'). |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 inline RenderText* Text::renderer() const | 238 inline RenderText* Text::renderer() const |
239 { | 239 { |
240 return toRenderText(CharacterData::renderer()); | 240 return toRenderText(CharacterData::renderer()); |
241 } | 241 } |
242 | 242 |
243 void applyTextTransform(const RenderStyle*, String&, UChar); | 243 void applyTextTransform(const RenderStyle*, String&, UChar); |
244 | 244 |
245 } // namespace blink | 245 } // namespace blink |
246 | 246 |
247 #endif // RenderText_h | 247 #endif // RenderText_h |
OLD | NEW |