Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: Source/core/rendering/RenderText.h

Issue 620753006: Rendering API cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address jchaffraix remarks Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 String substring(unsigned position, unsigned length) const { return m_text.s ubstring(position, length); }
82 UChar characterAt(unsigned) const; 81 UChar characterAt(unsigned) const;
83 UChar uncheckedCharacterAt(unsigned) const; 82 UChar uncheckedCharacterAt(unsigned) const;
84 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } 83 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); }
85 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()
86 void positionLineBox(InlineBox*); 85 void positionLineBox(InlineBox*);
87 86
88 virtual float width(unsigned from, unsigned len, const Font&, float xPos, Te xtDirection, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 87 virtual float width(unsigned from, unsigned len, const Font&, float xPos, Te xtDirection, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
89 virtual float width(unsigned from, unsigned len, float xPos, TextDirection, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, Glyph Overflow* = 0) const; 88 virtual float width(unsigned from, unsigned len, float xPos, TextDirection, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, Glyph Overflow* = 0) const;
90 89
91 float minLogicalWidth() const; 90 float minLogicalWidth() const;
(...skipping 17 matching lines...) Expand all
109 virtual void setText(PassRefPtr<StringImpl>, bool force = false); 108 virtual void setText(PassRefPtr<StringImpl>, bool force = false);
110 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len , bool force = false); 109 void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len , bool force = false);
111 110
112 virtual void transformText(); 111 virtual void transformText();
113 112
114 virtual bool canBeSelectionLeaf() const OVERRIDE { return true; } 113 virtual bool canBeSelectionLeaf() const OVERRIDE { return true; }
115 virtual void setSelectionState(SelectionState s) OVERRIDE FINAL; 114 virtual void setSelectionState(SelectionState s) OVERRIDE FINAL;
116 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer) const OVERRIDE; 115 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer) const OVERRIDE;
117 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e xtraWidthToEndOfLine = 0) OVERRIDE; 116 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e xtraWidthToEndOfLine = 0) OVERRIDE;
118 117
119 LayoutUnit marginLeft() const { return minimumValueForLength(style()->margin Left(), 0); }
120 LayoutUnit marginRight() const { return minimumValueForLength(style()->margi nRight(), 0); }
121
122 InlineTextBox* firstTextBox() const { return m_firstTextBox; } 118 InlineTextBox* firstTextBox() const { return m_firstTextBox; }
123 InlineTextBox* lastTextBox() const { return m_lastTextBox; } 119 InlineTextBox* lastTextBox() const { return m_lastTextBox; }
124 120
125 virtual int caretMinOffset() const OVERRIDE; 121 virtual int caretMinOffset() const OVERRIDE;
126 virtual int caretMaxOffset() const OVERRIDE; 122 virtual int caretMaxOffset() const OVERRIDE;
127 unsigned renderedTextLength() const; 123 unsigned renderedTextLength() const;
128 124
129 virtual int previousOffset(int current) const OVERRIDE FINAL; 125 virtual int previousOffset(int current) const OVERRIDE FINAL;
130 virtual int previousOffsetForBackwardDeletion(int current) const OVERRIDE FI NAL; 126 virtual int previousOffsetForBackwardDeletion(int current) const OVERRIDE FI NAL;
131 virtual int nextOffset(int current) const OVERRIDE FINAL; 127 virtual int nextOffset(int current) const OVERRIDE FINAL;
132 128
133 bool containsReversedText() const { return m_containsReversedText; } 129 bool containsReversedText() const { return m_containsReversedText; }
134 130
135 bool isSecure() const { return style()->textSecurity() != TSNONE; } 131 bool isSecure() const { return style()->textSecurity() != TSNONE; }
136 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); 132 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset);
137 133
138 void checkConsistency() const;
139
140 bool isAllCollapsibleWhitespace() const; 134 bool isAllCollapsibleWhitespace() const;
141 135
142 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; } 136 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; }
143 137
144 void removeAndDestroyTextBoxes(); 138 void removeAndDestroyTextBoxes();
145 139
146 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox(); 140 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox();
147 141
148 protected: 142 protected:
149 virtual void willBeDestroyed() OVERRIDE; 143 virtual void willBeDestroyed() OVERRIDE;
(...skipping 29 matching lines...) Expand all
179 bool isAllASCII() const { return m_isAllASCII; } 173 bool isAllASCII() const { return m_isAllASCII; }
180 174
181 void secureText(UChar mask); 175 void secureText(UChar mask);
182 176
183 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.
184 178
185 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;
186 // The parent invalidates for RenderText, so RenderText does nothing. 180 // The parent invalidates for RenderText, so RenderText does nothing.
187 virtual InvalidationReason invalidatePaintIfNeeded(const PaintInvalidationSt ate&, const RenderLayerModelObject&) OVERRIDE FINAL { return InvalidationNone; } 181 virtual InvalidationReason invalidatePaintIfNeeded(const PaintInvalidationSt ate&, const RenderLayerModelObject&) OVERRIDE FINAL { return InvalidationNone; }
188 182
183 void checkConsistency() const;
184
189 // We put the bitfield first to minimize padding on 64-bit. 185 // 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. 186 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'). 187 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit h '\n').
192 bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t'). 188 bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t').
193 bool m_hasBreakableStart : 1; 189 bool m_hasBreakableStart : 1;
194 bool m_hasBreakableEnd : 1; 190 bool m_hasBreakableEnd : 1;
195 bool m_hasEndWhiteSpace : 1; 191 bool m_hasEndWhiteSpace : 1;
196 bool m_linesDirty : 1; // This bit indicates that the text run has already d irtied specific 192 bool m_linesDirty : 1; // This bit indicates that the text run has already d irtied specific
197 // line boxes, and this hint will enable layoutInline Children to avoid 193 // line boxes, and this hint will enable layoutInline Children to avoid
198 // just dirtying everything when character data is mo dified (e.g., appended/inserted 194 // just dirtying everything when character data is mo dified (e.g., appended/inserted
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 inline RenderText* Text::renderer() const 234 inline RenderText* Text::renderer() const
239 { 235 {
240 return toRenderText(CharacterData::renderer()); 236 return toRenderText(CharacterData::renderer());
241 } 237 }
242 238
243 void applyTextTransform(const RenderStyle*, String&, UChar); 239 void applyTextTransform(const RenderStyle*, String&, UChar);
244 240
245 } // namespace blink 241 } // namespace blink
246 242
247 #endif // RenderText_h 243 #endif // RenderText_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698