Title: [221408] trunk
Revision
221408
Author
mmaxfi...@apple.com
Date
2017-08-30 16:46:39 -0700 (Wed, 30 Aug 2017)

Log Message

Previous elements with lang= can affect fonts selected for subsequent elements
https://bugs.webkit.org/show_bug.cgi?id=175959
<rdar://problem/33785853>

Reviewed by Zalan Bujtas.

Source/WebCore:

FontCascade::update() was erroneously getting a cache hit. Elements with different lang=
should be distinct inside the FontCascadeCache. We should be keying off of the locale
string instead of the script enum because the string is the thing we actually pass to the
platform APIs when performing font selection. This is a regression because we only
recently (within the past few years) started making font selection sensitive to lang= at
all.

Test: fast/text/lang-font-selection-cache.html

* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator== const):
(WebCore::FontDescriptionKey::computeHash const):

LayoutTests:

* fast/text/lang-font-selection-cache-expected.html: Added.
* fast/text/lang-font-selection-cache.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (221407 => 221408)


--- trunk/LayoutTests/ChangeLog	2017-08-30 23:43:39 UTC (rev 221407)
+++ trunk/LayoutTests/ChangeLog	2017-08-30 23:46:39 UTC (rev 221408)
@@ -1,3 +1,14 @@
+2017-08-30  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Previous elements with lang= can affect fonts selected for subsequent elements
+        https://bugs.webkit.org/show_bug.cgi?id=175959
+        <rdar://problem/33785853>
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/text/lang-font-selection-cache-expected.html: Added.
+        * fast/text/lang-font-selection-cache.html: Added.
+
 2017-08-30  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, rolling out r221327.

Added: trunk/LayoutTests/fast/text/lang-font-selection-cache-expected.html (0 => 221408)


--- trunk/LayoutTests/fast/text/lang-font-selection-cache-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/lang-font-selection-cache-expected.html	2017-08-30 23:46:39 UTC (rev 221408)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+</style>
+</head>
+<body>
+This test makes sure that a previous element rendered with the same font but different lang doesn't affect the fonts chosen to render a subsequent element.
+<div style="font-size: 48px;">
+<div style="width: 1px; height: 200px; display: inline-block;"></div>
+<span lang="ku-Arab">&#x643;&#x648;&#x631;&#x62f;&#x6cc;</span>
+</div>
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/text/lang-font-selection-cache.html (0 => 221408)


--- trunk/LayoutTests/fast/text/lang-font-selection-cache.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/lang-font-selection-cache.html	2017-08-30 23:46:39 UTC (rev 221408)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+</style>
+</head>
+<body>
+This test makes sure that a previous element rendered with the same font but different lang doesn't affect the fonts chosen to render a subsequent element.
+<div style="font-size: 48px;">
+<div style="width: 1px; height: 200px; display: inline-block;"></div>
+<span lang="ur" style="color: transparent;">&#x627;&#x631;&#x62f;&#x648;</span>
+<span lang="ku-Arab">&#x643;&#x648;&#x631;&#x62f;&#x6cc;</span>
+</div>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (221407 => 221408)


--- trunk/Source/WebCore/ChangeLog	2017-08-30 23:43:39 UTC (rev 221407)
+++ trunk/Source/WebCore/ChangeLog	2017-08-30 23:46:39 UTC (rev 221408)
@@ -1,3 +1,25 @@
+2017-08-30  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Previous elements with lang= can affect fonts selected for subsequent elements
+        https://bugs.webkit.org/show_bug.cgi?id=175959
+        <rdar://problem/33785853>
+
+        Reviewed by Zalan Bujtas.
+
+        FontCascade::update() was erroneously getting a cache hit. Elements with different lang=
+        should be distinct inside the FontCascadeCache. We should be keying off of the locale
+        string instead of the script enum because the string is the thing we actually pass to the
+        platform APIs when performing font selection. This is a regression because we only
+        recently (within the past few years) started making font selection sensitive to lang= at
+        all.
+
+        Test: fast/text/lang-font-selection-cache.html
+
+        * platform/graphics/FontCache.h:
+        (WebCore::FontDescriptionKey::FontDescriptionKey):
+        (WebCore::FontDescriptionKey::operator== const):
+        (WebCore::FontDescriptionKey::computeHash const):
+
 2017-08-30  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, rolling out r221327.

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (221407 => 221408)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2017-08-30 23:43:39 UTC (rev 221407)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2017-08-30 23:46:39 UTC (rev 221408)
@@ -74,6 +74,7 @@
         : m_size(description.computedPixelSize())
         , m_fontSelectionRequest(description.fontSelectionRequest())
         , m_flags(makeFlagsKey(description))
+        , m_locale(description.locale())
         , m_featureSettings(description.featureSettings())
 #if ENABLE(VARIATION_FONTS)
         , m_variationSettings(description.variationSettings())
@@ -89,6 +90,7 @@
         return m_size == other.m_size
             && m_fontSelectionRequest == other.m_fontSelectionRequest
             && m_flags == other.m_flags
+            && m_locale == other.m_locale
 #if ENABLE(VARIATION_FONTS)
             && m_variationSettings == other.m_variationSettings
 #endif
@@ -109,6 +111,7 @@
         hasher.add(m_fontSelectionRequest.weight);
         hasher.add(m_fontSelectionRequest.width);
         hasher.add(m_fontSelectionRequest.slope);
+        hasher.add(m_locale.existingHash());
         for (unsigned flagItem : m_flags)
             hasher.add(flagItem);
         hasher.add(m_featureSettings.hash());
@@ -154,6 +157,7 @@
     unsigned m_size { 0 };
     FontSelectionRequest m_fontSelectionRequest;
     std::array<unsigned, 2> m_flags {{ 0, 0 }};
+    AtomicString m_locale;
     FontFeatureSettings m_featureSettings;
 #if ENABLE(VARIATION_FONTS)
     FontVariationSettings m_variationSettings;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to