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

Side by Side Diff: Source/core/layout/LayoutTextCombine.cpp

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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 updateIsCombined(); 45 updateIsCombined();
46 } 46 }
47 47
48 void LayoutTextCombine::setTextInternal(PassRefPtr<StringImpl> text) 48 void LayoutTextCombine::setTextInternal(PassRefPtr<StringImpl> text)
49 { 49 {
50 LayoutText::setTextInternal(text); 50 LayoutText::setTextInternal(text);
51 51
52 updateIsCombined(); 52 updateIsCombined();
53 } 53 }
54 54
55 float LayoutTextCombine::width(unsigned from, unsigned length, const Font& font, LayoutUnit xPosition, TextDirection direction, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 55 float LayoutTextCombine::width(unsigned from, unsigned length, const Font& font, LayoutUnit xPosition, TextDirection direction, HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* glyphBounds) const
56 { 56 {
57 if (!length) 57 if (!length)
58 return 0; 58 return 0;
59 59
60 if (hasEmptyText()) 60 if (hasEmptyText())
61 return 0; 61 return 0;
62 62
63 if (m_isCombined) 63 if (m_isCombined)
64 return font.fontDescription().computedSize(); 64 return font.fontDescription().computedSize();
65 65
66 return LayoutText::width(from, length, font, xPosition, direction, fallbackF onts, glyphOverflow); 66 return LayoutText::width(from, length, font, xPosition, direction, fallbackF onts, glyphBounds);
67 } 67 }
68 68
69 void scaleHorizontallyAndTranslate(GraphicsContext& context, float scaleX, float centerX, float offsetX, float offsetY) 69 void scaleHorizontallyAndTranslate(GraphicsContext& context, float scaleX, float centerX, float offsetX, float offsetY)
70 { 70 {
71 context.concatCTM(AffineTransform(scaleX, 0, 0, 1, centerX * (1.0f - scaleX) + offsetX * scaleX, offsetY)); 71 context.concatCTM(AffineTransform(scaleX, 0, 0, 1, centerX * (1.0f - scaleX) + offsetX * scaleX, offsetY));
72 } 72 }
73 73
74 void LayoutTextCombine::transformToInlineCoordinates(GraphicsContext& context, c onst LayoutRect& boxRect) const 74 void LayoutTextCombine::transformToInlineCoordinates(GraphicsContext& context, c onst LayoutRect& boxRect) const
75 { 75 {
76 ASSERT(!m_needsFontUpdate); 76 ASSERT(!m_needsFontUpdate);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } else { 154 } else {
155 m_scaleX = 1.0f; 155 m_scaleX = 1.0f;
156 } 156 }
157 } 157 }
158 158
159 if (shouldUpdateFont) 159 if (shouldUpdateFont)
160 style()->font().update(fontSelector); 160 style()->font().update(fontSelector);
161 } 161 }
162 162
163 } // namespace blink 163 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTextCombine.h ('k') | Source/core/layout/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698