Title: [112489] trunk
Revision
112489
Author
[email protected]
Date
2012-03-28 18:41:03 -0700 (Wed, 28 Mar 2012)

Log Message

Respects font fallback list during webfonts are loading
https://bugs.webkit.org/show_bug.cgi?id=76684

Reviewed by Dimitri Glazkov.

Source/WebCore:

For layout, use the rest of the fallback list while webfonts are loading.
If the webfont is loading, it will be given an invalid Unicode Range so that
font selection mechansim doesn't use the webfont for layout.

Test: http/tests/webfont/fallback-font-while-loading.html

* css/CSSSegmentedFontFace.cpp:
(WebCore::appendFontDataWithInvalidUnicodeRangeIfLoading): Added.
(WebCore):
(WebCore::CSSSegmentedFontFace::getFontData):

LayoutTests:

Add a test that checks fallback fonts are used for layout while
webfonts are loading.

* http/tests/webfont/fallback-font-while-loading-expected.txt: Added.
* http/tests/webfont/fallback-font-while-loading.html: Added.
* http/tests/webfont/getahem.cgi: Added.
* http/tests/webfont/resources/Ahem.ttf: Added.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112488 => 112489)


--- trunk/LayoutTests/ChangeLog	2012-03-29 01:32:28 UTC (rev 112488)
+++ trunk/LayoutTests/ChangeLog	2012-03-29 01:41:03 UTC (rev 112489)
@@ -1,3 +1,18 @@
+2012-03-28  Kenichi Ishibashi  <[email protected]>
+
+        Respects font fallback list during webfonts are loading
+        https://bugs.webkit.org/show_bug.cgi?id=76684
+
+        Reviewed by Dimitri Glazkov.
+
+        Add a test that checks fallback fonts are used for layout while
+        webfonts are loading.
+
+        * http/tests/webfont/fallback-font-while-loading-expected.txt: Added.
+        * http/tests/webfont/fallback-font-while-loading.html: Added.
+        * http/tests/webfont/getahem.cgi: Added.
+        * http/tests/webfont/resources/Ahem.ttf: Added.
+
 2012-03-28  Li Yin  <[email protected]>
 
         [WebSocket]Reserved bits test case should cover both extension and no-extension scenarios

Modified: trunk/Source/WebCore/ChangeLog (112488 => 112489)


--- trunk/Source/WebCore/ChangeLog	2012-03-29 01:32:28 UTC (rev 112488)
+++ trunk/Source/WebCore/ChangeLog	2012-03-29 01:41:03 UTC (rev 112489)
@@ -1,3 +1,21 @@
+2012-03-28  Kenichi Ishibashi  <[email protected]>
+
+        Respects font fallback list during webfonts are loading
+        https://bugs.webkit.org/show_bug.cgi?id=76684
+
+        Reviewed by Dimitri Glazkov.
+
+        For layout, use the rest of the fallback list while webfonts are loading.
+        If the webfont is loading, it will be given an invalid Unicode Range so that
+        font selection mechansim doesn't use the webfont for layout.
+
+        Test: http/tests/webfont/fallback-font-while-loading.html
+
+        * css/CSSSegmentedFontFace.cpp:
+        (WebCore::appendFontDataWithInvalidUnicodeRangeIfLoading): Added.
+        (WebCore):
+        (WebCore::CSSSegmentedFontFace::getFontData):
+
 2012-03-28  Mark Rowe  <[email protected]>
 
         Update Localizable.strings.

Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp (112488 => 112489)


--- trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-03-29 01:32:28 UTC (rev 112488)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-03-29 01:41:03 UTC (rev 112489)
@@ -81,6 +81,23 @@
     m_fontFaces.append(fontFace);
 }
 
+static void appendFontDataWithInvalidUnicodeRangeIfLoading(SegmentedFontData* newFontData, const SimpleFontData* faceFontData, const Vector<CSSFontFace::UnicodeRange>& ranges)
+{
+    if (faceFontData->isLoading()) {
+        newFontData->appendRange(FontDataRange(0, 0, faceFontData));
+        return;
+    }
+
+    unsigned numRanges = ranges.size();
+    if (!numRanges) {
+        newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData));
+        return;
+    }
+
+    for (unsigned j = 0; j < numRanges; ++j)
+        newFontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData));
+}
+
 FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription)
 {
     if (!isValid())
@@ -104,14 +121,7 @@
         bool syntheticItalic = !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
         if (const SimpleFontData* faceFontData = m_fontFaces[i]->getFontData(fontDescription, syntheticBold, syntheticItalic)) {
             ASSERT(!faceFontData->isSegmented());
-            const Vector<CSSFontFace::UnicodeRange>& ranges = m_fontFaces[i]->ranges();
-            unsigned numRanges = ranges.size();
-            if (!numRanges)
-                newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData));
-            else {
-                for (unsigned j = 0; j < numRanges; ++j)
-                    newFontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData));
-            }
+            appendFontDataWithInvalidUnicodeRangeIfLoading(newFontData.get(), faceFontData, m_fontFaces[i]->ranges());
         }
     }
     if (newFontData->numRanges()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to