Index: Source/core/rendering/RenderText.cpp |
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp |
index 8d4b5fd8d8af6a44cf87e2f37fec15ffa6ca7475..1fe720b0f5e1fc52966d2c844cc490b546038cc0 100644 |
--- a/Source/core/rendering/RenderText.cpp |
+++ b/Source/core/rendering/RenderText.cpp |
@@ -204,8 +204,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() |