Title: [186827] trunk
Revision
186827
Author
mmaxfi...@apple.com
Date
2015-07-14 17:23:41 -0700 (Tue, 14 Jul 2015)

Log Message

REGRESSION (r177876): store.apple.com profile and cart icons are missing
https://bugs.webkit.org/show_bug.cgi?id=146894

Patch by Antti Koivisto <an...@apple.com> on 2015-07-14
Reviewed by Myles C. Maxfield.

Source/WebCore:

If we had several @font-face rules for the same face covering overlapping ranges we
would only try to get glyphs from the first one. If it didn't have the glyph we wouldn't
try the other ones.

Test: fast/css/font-face-multiple-missing-glyphs.html

* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForVariant):
(WebCore::FontCascadeFonts::glyphDataForNormalVariant):

    Get GlyphData with one call.

* platform/graphics/FontRanges.cpp:
(WebCore::FontRanges::~FontRanges):
(WebCore::FontRanges::glyphDataForCharacter):

    Check that we actually have a glyph in the font for the character before returning it.

(WebCore::FontRanges::fontForCharacter):
(WebCore::FontRanges::fontForFirstRange):
* platform/graphics/FontRanges.h:
(WebCore::FontRanges::size):
(WebCore::FontRanges::rangeAt):

LayoutTests:

* fast/css/font-face-multiple-missing-glyphs-expected.html: Added.
* fast/css/font-face-multiple-missing-glyphs.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (186826 => 186827)


--- trunk/LayoutTests/ChangeLog	2015-07-14 23:50:39 UTC (rev 186826)
+++ trunk/LayoutTests/ChangeLog	2015-07-15 00:23:41 UTC (rev 186827)
@@ -1,3 +1,13 @@
+2015-07-14  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (r177876): store.apple.com profile and cart icons are missing
+        https://bugs.webkit.org/show_bug.cgi?id=146894
+
+        Reviewed by Myles C. Maxfield.
+
+        * fast/css/font-face-multiple-missing-glyphs-expected.html: Added.
+        * fast/css/font-face-multiple-missing-glyphs.html: Added.
+
 2015-07-14  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r186809.

Added: trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs-expected.html (0 => 186827)


--- trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs-expected.html	2015-07-15 00:23:41 UTC (rev 186827)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+This test makes sure we search through all font-face declarations in order to find a working font.
+<div style="font: 200px 'Heiti SC'; -webkit-line-box-contain: font;">&#x6c49;</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs.html (0 => 186827)


--- trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/font-face-multiple-missing-glyphs.html	2015-07-15 00:23:41 UTC (rev 186827)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: WebFont;
+    /* Any font which has a smaller ascent than Heiti SC can be used here */
+    src: local("Palatino-Roman");
+}
+
+@font-face {
+    font-family: WebFont;
+    /* This font must not be the default fallback font for U+6c49 */
+    src: local("Heiti SC");
+}
+
+@font-face {
+    font-family: WebFont;
+    src: local("Palatino-Roman");
+}
+</style>
+</head>
+<body>
+This test makes sure we search through all font-face declarations in order to find a working font.
+<div style="font: 200px WebFont; -webkit-line-box-contain: font;">&#x6c49;</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (186826 => 186827)


--- trunk/Source/WebCore/ChangeLog	2015-07-14 23:50:39 UTC (rev 186826)
+++ trunk/Source/WebCore/ChangeLog	2015-07-15 00:23:41 UTC (rev 186827)
@@ -1,3 +1,34 @@
+2015-07-14  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (r177876): store.apple.com profile and cart icons are missing
+        https://bugs.webkit.org/show_bug.cgi?id=146894
+
+        Reviewed by Myles C. Maxfield.
+
+        If we had several @font-face rules for the same face covering overlapping ranges we
+        would only try to get glyphs from the first one. If it didn't have the glyph we wouldn't
+        try the other ones.
+
+        Test: fast/css/font-face-multiple-missing-glyphs.html
+
+        * platform/graphics/FontCascadeFonts.cpp:
+        (WebCore::FontCascadeFonts::glyphDataForVariant):
+        (WebCore::FontCascadeFonts::glyphDataForNormalVariant):
+
+            Get GlyphData with one call.
+
+        * platform/graphics/FontRanges.cpp:
+        (WebCore::FontRanges::~FontRanges):
+        (WebCore::FontRanges::glyphDataForCharacter):
+
+            Check that we actually have a glyph in the font for the character before returning it.
+
+        (WebCore::FontRanges::fontForCharacter):
+        (WebCore::FontRanges::fontForFirstRange):
+        * platform/graphics/FontRanges.h:
+        (WebCore::FontRanges::size):
+        (WebCore::FontRanges::rangeAt):
+
 2015-07-14  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Fix the 32 bit build after r186817

Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (186826 => 186827)


--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2015-07-14 23:50:39 UTC (rev 186826)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2015-07-15 00:23:41 UTC (rev 186827)
@@ -295,8 +295,7 @@
         auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex++);
         if (fontRanges.isNull())
             break;
-        auto* font = fontRanges.fontForCharacter(c);
-        GlyphData data = "" ? font->glyphDataForCharacter(c) : GlyphData();
+        GlyphData data = ""
         if (data.font) {
             // The variantFont function should not normally return 0.
             // But if it does, we will just render the capital letter big.
@@ -313,17 +312,11 @@
 
 GlyphData FontCascadeFonts::glyphDataForNormalVariant(UChar32 c, const FontDescription& description)
 {
-    const unsigned pageNumber = c / GlyphPage::size;
-
-    for (unsigned fallbackIndex = 0; true; ++fallbackIndex) {
+    for (unsigned fallbackIndex = 0; ; ++fallbackIndex) {
         auto& fontRanges = realizeFallbackRangesAt(description, fallbackIndex);
         if (fontRanges.isNull())
             break;
-        auto* font = fontRanges.fontForCharacter(c);
-        auto* page = font ? font->glyphPage(pageNumber) : nullptr;
-        if (!page)
-            continue;
-        GlyphData data = ""
+        GlyphData data = ""
         if (data.font) {
             if (data.font->platformData().orientation() == Vertical && !data.font->isTextOrientationFallback()) {
                 if (!FontCascade::isCJKIdeographOrSymbol(c))
@@ -339,7 +332,6 @@
                     return glyphDataForCJKCharacterWithoutSyntheticItalic(c, data);
 #endif
             }
-
             return data;
         }
     }

Modified: trunk/Source/WebCore/platform/graphics/FontRanges.cpp (186826 => 186827)


--- trunk/Source/WebCore/platform/graphics/FontRanges.cpp	2015-07-14 23:50:39 UTC (rev 186826)
+++ trunk/Source/WebCore/platform/graphics/FontRanges.cpp	2015-07-15 00:23:41 UTC (rev 186827)
@@ -46,15 +46,23 @@
 {
 }
 
-const Font* FontRanges::fontForCharacter(UChar32 c) const
+GlyphData FontRanges::glyphDataForCharacter(UChar32 character) const
 {
     for (auto& range : m_ranges) {
-        if (range.from() <= c && c <= range.to())
-            return &range.font();
+        if (range.from() <= character && character <= range.to()) {
+            auto glyphData = range.font().glyphDataForCharacter(character);
+            if (glyphData.glyph)
+                return glyphData;
+        }
     }
-    return nullptr;
+    return GlyphData();
 }
 
+const Font* FontRanges::fontForCharacter(UChar32 character) const
+{
+    return glyphDataForCharacter(character).font;
+}
+
 const Font& FontRanges::fontForFirstRange() const
 {
     return m_ranges[0].font();

Modified: trunk/Source/WebCore/platform/graphics/FontRanges.h (186826 => 186827)


--- trunk/Source/WebCore/platform/graphics/FontRanges.h	2015-07-14 23:50:39 UTC (rev 186826)
+++ trunk/Source/WebCore/platform/graphics/FontRanges.h	2015-07-15 00:23:41 UTC (rev 186827)
@@ -62,6 +62,7 @@
     unsigned size() const { return m_ranges.size(); }
     const Range& rangeAt(unsigned i) const { return m_ranges[i]; }
 
+    GlyphData glyphDataForCharacter(UChar32) const;
     WEBCORE_EXPORT const Font* fontForCharacter(UChar32) const;
     WEBCORE_EXPORT const Font& fontForFirstRange() const;
     bool isLoading() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to