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

Unified Diff: third_party/WebKit/Source/core/css/FontFace.cpp

Issue 1773633003: [DO NOT COMMIT] Trace events for layout-based First Meaningful Paint detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
Index: third_party/WebKit/Source/core/css/FontFace.cpp
diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp
index 59b526bbd633ddfb8043f35a64a24294a1792013..84645e2cdf7ae786797e0da1896432213e9521aa 100644
--- a/third_party/WebKit/Source/core/css/FontFace.cpp
+++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -533,6 +533,11 @@ FontTraits FontFace::traits() const
return FontTraits(style, variant, weight, stretch);
}
+bool FontFace::isBlank() const
+{
+ return m_status == Loading && m_charCount > 200 && m_cssFontFace->isBlank();
+}
+
static FontDisplay CSSValueToFontDisplay(CSSValue* value)
{
if (value && value->isPrimitiveValue()) {
@@ -624,6 +629,21 @@ void FontFace::initCSSFontFace(const unsigned char* data, size_t size)
m_cssFontFace->addSource(source);
}
+bool FontFace::willUseFontData(const FontDescription& fontDescription, const String& text)
+{
+ if (m_status != Loaded) {
+ m_charCount += text.length();
+ // if (m_cssFontFace->isBlank())
+ // fprintf(stderr, "%s %u %u\n", m_family.getString().ascii().data(), length, m_charCount);
+ }
+ if (loadStatus() != Unloaded)
+ return true;
+ if (cssFontFace()->maybeScheduleFontLoad(fontDescription, text.characterStartingAt(0))) {
+ return true;
+ }
+ return false;
+}
+
DEFINE_TRACE(FontFace)
{
visitor->trace(m_style);

Powered by Google App Engine
This is Rietveld 408576698