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() |