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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index 8e555afdd4ec200c1531113264a6aebe43f43ecd..6cb92ab2b5087fc8661662665fade0c81b56d565 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -203,6 +203,42 @@ float Font::width(const TextRun& run, int& charsConsumed, Glyph& glyphId) const
return width(run);
}
+PassTextBlobPtr Font::buildTextBlob(const TextRunPaintInfo& runInfo, const FloatPoint& textOrigin, bool couldUseLCDRenderedText, CustomFontNotReadyAction customFontNotReadyAction) const
+{
+ ASSERT(RuntimeEnabledFeatures::textBlobEnabled());
+
+ // FIXME: Some logic in common with Font::drawText. Would be nice to
+ // deduplicate.
+ if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotReady)
+ return nullptr;
+
+ CodePath codePathToUse = codePath(runInfo.run);
+ // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
+ if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length()))
+ codePathToUse = ComplexPath;
+
+ if (codePathToUse != ComplexPath)
+ return buildTextBlobForSimpleText(runInfo, textOrigin, couldUseLCDRenderedText);
+
+ return nullptr;
+}
+
+PassTextBlobPtr Font::buildTextBlobForSimpleText(const TextRunPaintInfo& runInfo, const FloatPoint& textOrigin, bool couldUseLCDRenderedText) const
+{
+ GlyphBuffer glyphBuffer;
+ float initialAdvance = getGlyphsAndAdvancesForSimpleText(runInfo, glyphBuffer);
+ ASSERT(!glyphBuffer.hasVerticalAdvances());
+
+ if (glyphBuffer.isEmpty())
+ return nullptr;
+
+ FloatRect blobBounds = runInfo.bounds;
+ blobBounds.moveBy(-textOrigin);
+
+ float ignoredWidth;
+ return buildTextBlob(glyphBuffer, initialAdvance, blobBounds, ignoredWidth, couldUseLCDRenderedText);
+}
+
FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to, bool accountForGlyphBounds) const
{
to = (to == -1 ? run.length() : to);
« 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