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

Side by Side Diff: Source/core/layout/LayoutText.h

Issue 1196213002: Remove duplicate measure hyphen string method (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Making hyphenWidth as inline and removing static nature Created 5 years, 6 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
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 *
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 LayoutText_h 23 #ifndef LayoutText_h
24 #define LayoutText_h 24 #define LayoutText_h
25 25
26 #include "core/CoreExport.h" 26 #include "core/CoreExport.h"
27 #include "core/dom/Text.h" 27 #include "core/dom/Text.h"
28 #include "core/layout/LayoutObject.h" 28 #include "core/layout/LayoutObject.h"
29 #include "core/layout/TextRunConstructor.h"
29 #include "platform/LengthFunctions.h" 30 #include "platform/LengthFunctions.h"
30 #include "platform/text/TextPath.h" 31 #include "platform/text/TextPath.h"
31 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
32 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
33 34
34 namespace blink { 35 namespace blink {
35 36
36 class AbstractInlineTextBox; 37 class AbstractInlineTextBox;
37 class InlineTextBox; 38 class InlineTextBox;
38 39
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset); 135 void momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacterOffset);
135 136
136 bool isAllCollapsibleWhitespace() const; 137 bool isAllCollapsibleWhitespace() const;
137 138
138 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; } 139 bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; }
139 140
140 void removeAndDestroyTextBoxes(); 141 void removeAndDestroyTextBoxes();
141 142
142 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox(); 143 PassRefPtr<AbstractInlineTextBox> firstAbstractInlineTextBox();
143 144
145 float hyphenWidth(const Font&, TextDirection);
146
144 protected: 147 protected:
145 virtual void willBeDestroyed() override; 148 virtual void willBeDestroyed() override;
146 149
147 virtual void styleWillChange(StyleDifference, const ComputedStyle&) override final { } 150 virtual void styleWillChange(StyleDifference, const ComputedStyle&) override final { }
148 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 151 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
149 152
150 virtual void setTextInternal(PassRefPtr<StringImpl>); 153 virtual void setTextInternal(PassRefPtr<StringImpl>);
151 virtual UChar previousCharacter() const; 154 virtual UChar previousCharacter() const;
152 155
153 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const override; 156 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const override;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 220 }
218 221
219 inline UChar LayoutText::characterAt(unsigned i) const 222 inline UChar LayoutText::characterAt(unsigned i) const
220 { 223 {
221 if (i >= textLength()) 224 if (i >= textLength())
222 return 0; 225 return 0;
223 226
224 return uncheckedCharacterAt(i); 227 return uncheckedCharacterAt(i);
225 } 228 }
226 229
230 inline float LayoutText::hyphenWidth(const Font& font, TextDirection direction)
231 {
232 const ComputedStyle& style = styleRef();
233 return font.width(constructTextRun(this, font, style.hyphenString().string() , style, direction));
234 }
235
227 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText()); 236 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText());
228 237
229 #if !ENABLE(ASSERT) 238 #if !ENABLE(ASSERT)
230 inline void LayoutText::checkConsistency() const 239 inline void LayoutText::checkConsistency() const
231 { 240 {
232 } 241 }
233 #endif 242 #endif
234 243
235 inline LayoutText* Text::layoutObject() const 244 inline LayoutText* Text::layoutObject() const
236 { 245 {
237 return toLayoutText(CharacterData::layoutObject()); 246 return toLayoutText(CharacterData::layoutObject());
238 } 247 }
239 248
240 void applyTextTransform(const ComputedStyle*, String&, UChar); 249 void applyTextTransform(const ComputedStyle*, String&, UChar);
241 250
242 } // namespace blink 251 } // namespace blink
243 252
244 #endif // LayoutText_h 253 #endif // LayoutText_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698