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

Unified Diff: Source/core/rendering/RenderText.cpp

Issue 270813003: Reland r172943 "Make CSSFontFace::willUseFontData() load fonts with unicode-range" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/core/css/CSSSegmentedFontFace.cpp ('k') | Source/platform/fonts/Font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderText.cpp
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index 242ca26d774679a5c6297652f00eab8ab28161a8..4243c39a93dcf01a9bbfd27b84c3308f02073834 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -205,8 +205,11 @@ void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
if (oldTransform != newStyle->textTransform() || oldSecurity != newStyle->textSecurity())
transformText();
+ // This is an optimization that kicks off font load before layout.
+ // In order to make it fast, we only check if the first character of the
+ // text is included in the unicode ranges of the fonts.
if (!text().containsOnlyWhitespace())
- newStyle->font().willUseFontData();
+ newStyle->font().willUseFontData(text().characterStartingAt(0));
}
void RenderText::removeAndDestroyTextBoxes()
« no previous file with comments | « Source/core/css/CSSSegmentedFontFace.cpp ('k') | Source/platform/fonts/Font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698