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

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

Issue 104813005: Explicitly set text direction for TextRuns (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const LChar* characters8() const { return m_text.impl()->characters8(); } 75 const LChar* characters8() const { return m_text.impl()->characters8(); }
76 const UChar* characters16() const { return m_text.impl()->characters16(); } 76 const UChar* characters16() const { return m_text.impl()->characters16(); }
77 bool hasEmptyText() const { return m_text.isEmpty(); } 77 bool hasEmptyText() const { return m_text.isEmpty(); }
78 String substring(unsigned position, unsigned length) const { return m_text.s ubstring(position, length); } 78 String substring(unsigned position, unsigned length) const { return m_text.s ubstring(position, length); }
79 UChar characterAt(unsigned) const; 79 UChar characterAt(unsigned) const;
80 UChar uncheckedCharacterAt(unsigned) const; 80 UChar uncheckedCharacterAt(unsigned) const;
81 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } 81 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); }
82 unsigned textLength() const { return m_text.length(); } // non virtual imple mentation of length() 82 unsigned textLength() const { return m_text.length(); } // non virtual imple mentation of length()
83 void positionLineBox(InlineBox*); 83 void positionLineBox(InlineBox*);
84 84
85 virtual float width(unsigned from, unsigned len, const Font&, float xPos, Ha shSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 85 virtual float width(unsigned from, unsigned len, const Font&, float xPos, Te xtDirection, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
86 virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; 86 virtual float width(unsigned from, unsigned len, float xPos, TextDirection, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, Glyph Overflow* = 0) const;
87 87
88 float minLogicalWidth() const; 88 float minLogicalWidth() const;
89 float maxLogicalWidth() const; 89 float maxLogicalWidth() const;
90 90
91 void trimmedPrefWidths(float leadWidth, 91 void trimmedPrefWidths(float leadWidth,
92 float& firstLineMinWidth, bool& hasBreakableStart, 92 float& firstLineMinWidth, bool& hasBreakableStart,
93 float& lastLineMinWidth, bool& hasBreakableEnd, 93 float& lastLineMinWidth, bool& hasBreakableEnd,
94 bool& hasBreakableChar, bool& hasBreak, 94 bool& hasBreakableChar, bool& hasBreak,
95 float& firstLineMaxWidth, float& lastLineMaxWidth, 95 float& firstLineMaxWidth, float& lastLineMaxWidth,
96 float& minWidth, float& maxWidth, bool& stripFrontSpaces); 96 float& minWidth, float& maxWidth, bool& stripFrontSpaces);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 154 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
155 155
156 virtual void setTextInternal(PassRefPtr<StringImpl>); 156 virtual void setTextInternal(PassRefPtr<StringImpl>);
157 virtual UChar previousCharacter() const; 157 virtual UChar previousCharacter() const;
158 158
159 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons t OVERRIDE; 159 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons t OVERRIDE;
160 160
161 virtual InlineTextBox* createTextBox(); // Subclassed by SVG. 161 virtual InlineTextBox* createTextBox(); // Subclassed by SVG.
162 162
163 private: 163 private:
164 void computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFont Data*>& fallbackFonts, GlyphOverflow&); 164 void computePreferredLogicalWidths(float leadWidth, TextDirection, HashSet<c onst SimpleFontData*>& fallbackFonts, GlyphOverflow&);
165 165
166 bool computeCanUseSimpleFontCodePath() const; 166 bool computeCanUseSimpleFontCodePath() const;
167 167
168 // Make length() private so that callers that have a RenderText* 168 // Make length() private so that callers that have a RenderText*
169 // will use the more efficient textLength() instead, while 169 // will use the more efficient textLength() instead, while
170 // callers with a RenderObject* can continue to use length(). 170 // callers with a RenderObject* can continue to use length().
171 virtual unsigned length() const OVERRIDE FINAL { return textLength(); } 171 virtual unsigned length() const OVERRIDE FINAL { return textLength(); }
172 172
173 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL { ASSERT_N OT_REACHED(); } 173 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL { ASSERT_N OT_REACHED(); }
174 virtual void layout() OVERRIDE FINAL { ASSERT_NOT_REACHED(); } 174 virtual void layout() OVERRIDE FINAL { ASSERT_NOT_REACHED(); }
175 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation&, const LayoutPoint&, HitTestAction) OVERRIDE FINAL { ASSERT_NOT_REACH ED(); return false; } 175 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation&, const LayoutPoint&, HitTestAction) OVERRIDE FINAL { ASSERT_NOT_REACH ED(); return false; }
176 176
177 void deleteTextBoxes(); 177 void deleteTextBoxes();
178 bool containsOnlyWhitespace(unsigned from, unsigned len) const; 178 bool containsOnlyWhitespace(unsigned from, unsigned len) const;
179 float widthFromCache(const Font&, int start, int len, float xPos, HashSet<co nst SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; 179 float widthFromCache(const Font&, int start, int len, float xPos, TextDirect ion, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const;
180 bool isAllASCII() const { return m_isAllASCII; } 180 bool isAllASCII() const { return m_isAllASCII; }
181 181
182 void secureText(UChar mask); 182 void secureText(UChar mask);
183 183
184 // We put the bitfield first to minimize padding on 64-bit. 184 // We put the bitfield first to minimize padding on 64-bit.
185 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl e lines. 185 bool m_hasBreakableChar : 1; // Whether or not we can be broken into multipl e lines.
186 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit h '\n'). 186 bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> wit h '\n').
187 bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t'). 187 bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t').
188 bool m_hasBreakableStart : 1; 188 bool m_hasBreakableStart : 1;
189 bool m_hasBreakableEnd : 1; 189 bool m_hasBreakableEnd : 1;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 inline void RenderText::checkConsistency() const 228 inline void RenderText::checkConsistency() const
229 { 229 {
230 } 230 }
231 #endif 231 #endif
232 232
233 void applyTextTransform(const RenderStyle*, String&, UChar); 233 void applyTextTransform(const RenderStyle*, String&, UChar);
234 234
235 } // namespace WebCore 235 } // namespace WebCore
236 236
237 #endif // RenderText_h 237 #endif // RenderText_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698