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

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

Issue 1179723002: Store glyph bounds in WordMeasurement to avoid slow path width calc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 | Annotate | Revision Log
« 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 *
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool is8Bit() const { return m_text.is8Bit(); } 79 bool is8Bit() const { return m_text.is8Bit(); }
80 const LChar* characters8() const { return m_text.impl()->characters8(); } 80 const LChar* characters8() const { return m_text.impl()->characters8(); }
81 const UChar* characters16() const { return m_text.impl()->characters16(); } 81 const UChar* characters16() const { return m_text.impl()->characters16(); }
82 bool hasEmptyText() const { return m_text.isEmpty(); } 82 bool hasEmptyText() const { return m_text.isEmpty(); }
83 UChar characterAt(unsigned) const; 83 UChar characterAt(unsigned) const;
84 UChar uncheckedCharacterAt(unsigned) const; 84 UChar uncheckedCharacterAt(unsigned) const;
85 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); } 85 UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); }
86 unsigned textLength() const { return m_text.length(); } // non virtual imple mentation of length() 86 unsigned textLength() const { return m_text.length(); } // non virtual imple mentation of length()
87 void positionLineBox(InlineBox*); 87 void positionLineBox(InlineBox*);
88 88
89 virtual float width(unsigned from, unsigned len, const Font&, LayoutUnit xPo s, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, Glyph Overflow* = nullptr) const; 89 virtual float width(unsigned from, unsigned len, const Font&, LayoutUnit xPo s, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts = nullptr, Float Rect* glyphBounds = nullptr) const;
90 virtual float width(unsigned from, unsigned len, LayoutUnit xPos, TextDirect ion, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = nul lptr, GlyphOverflow* = nullptr) const; 90 virtual float width(unsigned from, unsigned len, LayoutUnit xPos, TextDirect ion, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = nul lptr, FloatRect* glyphBounds = nullptr) const;
91 91
92 float minLogicalWidth() const; 92 float minLogicalWidth() const;
93 float maxLogicalWidth() const; 93 float maxLogicalWidth() const;
94 94
95 void trimmedPrefWidths(LayoutUnit leadWidth, 95 void trimmedPrefWidths(LayoutUnit leadWidth,
96 LayoutUnit& firstLineMinWidth, bool& hasBreakableStart, 96 LayoutUnit& firstLineMinWidth, bool& hasBreakableStart,
97 LayoutUnit& lastLineMinWidth, bool& hasBreakableEnd, 97 LayoutUnit& lastLineMinWidth, bool& hasBreakableEnd,
98 bool& hasBreakableChar, bool& hasBreak, 98 bool& hasBreakableChar, bool& hasBreak,
99 LayoutUnit& firstLineMaxWidth, LayoutUnit& lastLineMaxWidth, 99 LayoutUnit& firstLineMaxWidth, LayoutUnit& lastLineMaxWidth,
100 LayoutUnit& minWidth, LayoutUnit& maxWidth, bool& stripFrontSpaces, 100 LayoutUnit& minWidth, LayoutUnit& maxWidth, bool& stripFrontSpaces,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 virtual UChar previousCharacter() const; 151 virtual UChar previousCharacter() const;
152 152
153 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const override; 153 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const override;
154 154
155 virtual InlineTextBox* createTextBox(int start, unsigned short length); // S ubclassed by SVG. 155 virtual InlineTextBox* createTextBox(int start, unsigned short length); // S ubclassed by SVG.
156 156
157 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer) const override; 157 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer) 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, FloatRect& glyphBounds);
162 162
163 bool computeCanUseSimpleFontCodePath() const; 163 bool computeCanUseSimpleFontCodePath() const;
164 164
165 // Make length() private so that callers that have a LayoutText* 165 // Make length() private so that callers that have a LayoutText*
166 // will use the more efficient textLength() instead, while 166 // will use the more efficient textLength() instead, while
167 // callers with a LayoutObject* 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(HitTestResult&, const HitTestLocation&, const Layou tPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); return false; } 172 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation&, const Layou tPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); 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 widthFromFont(const Font&, int start, int len, float leadWidth, float textWidthSoFar, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts, Fl oatRect* glyphBoundsAccumulation) const;
177 177
178 void secureText(UChar mask); 178 void secureText(UChar mask);
179 179
180 bool isText() const = delete; // This will catch anyone doing an unnecessary check. 180 bool isText() const = delete; // This will catch anyone doing an unnecessary check.
181 181
182 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override; 182 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
183 183
184 void checkConsistency() const; 184 void checkConsistency() const;
185 185
186 // We put the bitfield first to minimize padding on 64-bit. 186 // We put the bitfield first to minimize padding on 64-bit.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 inline LayoutText* Text::layoutObject() const 235 inline LayoutText* Text::layoutObject() const
236 { 236 {
237 return toLayoutText(CharacterData::layoutObject()); 237 return toLayoutText(CharacterData::layoutObject());
238 } 238 }
239 239
240 void applyTextTransform(const ComputedStyle*, String&, UChar); 240 void applyTextTransform(const ComputedStyle*, String&, UChar);
241 241
242 } // namespace blink 242 } // namespace blink
243 243
244 #endif // LayoutText_h 244 #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