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

Side by Side Diff: Source/platform/fonts/Font.cpp

Issue 554613004: TextBlob: Start caching a text blob per InlineTextBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: turn off runtime-enabled feature for landing Created 6 years, 3 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/platform/fonts/Font.h ('k') | Source/platform/fonts/harfbuzz/FontHarfBuzz.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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #if ENABLE(SVG_FONTS) 196 #if ENABLE(SVG_FONTS)
197 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) 197 if (TextRun::RenderingContext* renderingContext = run.renderingContext())
198 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume d, glyphId); 198 return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsume d, glyphId);
199 #endif 199 #endif
200 200
201 charsConsumed = run.length(); 201 charsConsumed = run.length();
202 glyphId = 0; 202 glyphId = 0;
203 return width(run); 203 return width(run);
204 } 204 }
205 205
206 PassTextBlobPtr Font::buildTextBlob(const TextRunPaintInfo& runInfo, const Float Point& textOrigin, bool couldUseLCDRenderedText, CustomFontNotReadyAction custom FontNotReadyAction) const
207 {
208 ASSERT(RuntimeEnabledFeatures::textBlobEnabled());
209
210 // FIXME: Some logic in common with Font::drawText. Would be nice to
211 // deduplicate.
212 if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotRe ady)
213 return nullptr;
214
215 CodePath codePathToUse = codePath(runInfo.run);
216 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050
217 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length()))
218 codePathToUse = ComplexPath;
219
220 if (codePathToUse != ComplexPath)
221 return buildTextBlobForSimpleText(runInfo, textOrigin, couldUseLCDRender edText);
222
223 return nullptr;
224 }
225
226 PassTextBlobPtr Font::buildTextBlobForSimpleText(const TextRunPaintInfo& runInfo , const FloatPoint& textOrigin, bool couldUseLCDRenderedText) const
227 {
228 GlyphBuffer glyphBuffer;
229 float initialAdvance = getGlyphsAndAdvancesForSimpleText(runInfo, glyphBuffe r);
230 ASSERT(!glyphBuffer.hasVerticalAdvances());
231
232 if (glyphBuffer.isEmpty())
233 return nullptr;
234
235 FloatRect blobBounds = runInfo.bounds;
236 blobBounds.moveBy(-textOrigin);
237
238 float ignoredWidth;
239 return buildTextBlob(glyphBuffer, initialAdvance, blobBounds, ignoredWidth, couldUseLCDRenderedText);
240 }
241
206 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to, bool accountForGlyphBounds) const 242 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to, bool accountForGlyphBounds) const
207 { 243 {
208 to = (to == -1 ? run.length() : to); 244 to = (to == -1 ? run.length() : to);
209 245
210 CodePath codePathToUse = codePath(run); 246 CodePath codePathToUse = codePath(run);
211 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 247 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050
212 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (from || to != run.length())) 248 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (from || to != run.length()))
213 codePathToUse = ComplexPath; 249 codePathToUse = ComplexPath;
214 250
215 if (codePathToUse != ComplexPath) 251 if (codePathToUse != ComplexPath)
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 if (delta <= 0) 892 if (delta <= 0)
857 break; 893 break;
858 } 894 }
859 } 895 }
860 } 896 }
861 897
862 return offset; 898 return offset;
863 } 899 }
864 900
865 } // namespace blink 901 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698