Title: [221523] releases/WebKitGTK/webkit-2.18
Revision
221523
Author
[email protected]
Date
2017-09-02 01:14:22 -0700 (Sat, 02 Sep 2017)

Log Message

Merge r221408 - 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: releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog (221522 => 221523)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-09-02 08:10:58 UTC (rev 221522)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-09-02 08:14:22 UTC (rev 221523)
@@ -1,3 +1,14 @@
+2017-08-30  Myles C. Maxfield  <[email protected]>
+
+        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  Said Abou-Hallawa  <[email protected]>
 
         The SVG fragment identifier is not respected if it is a part of an HTTP URL

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache-expected.html (0 => 221523)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache-expected.html	2017-09-02 08:14:22 UTC (rev 221523)
@@ -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: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache.html (0 => 221523)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/lang-font-selection-cache.html	2017-09-02 08:14:22 UTC (rev 221523)
@@ -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: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (221522 => 221523)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-09-02 08:10:58 UTC (rev 221522)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-09-02 08:14:22 UTC (rev 221523)
@@ -1,3 +1,25 @@
+2017-08-30  Myles C. Maxfield  <[email protected]>
+
+        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  Said Abou-Hallawa  <[email protected]>
 
         The SVG fragment identifier is not respected if it is a part of an HTTP URL

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/FontCache.h (221522 => 221523)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/FontCache.h	2017-09-02 08:10:58 UTC (rev 221522)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/FontCache.h	2017-09-02 08:14:22 UTC (rev 221523)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to