Title: [291846] trunk
Revision
291846
Author
[email protected]
Date
2022-03-24 21:08:00 -0700 (Thu, 24 Mar 2022)

Log Message

[Cocoa] REGRESSION(r281291): When accessibility bold is enabled, font-family:system-ui is supposed to be bold
https://bugs.webkit.org/show_bug.cgi?id=237817
<rdar://problem/88249241>

Reviewed by Alan Bujtas.

Source/WebCore:

Accessibility bold is supposed to cause the system font to be rendered as bold, even if the
value of the font-weight property is normal.

The way this is originally supposed to work is that, when accessibility bold is enabled and
software asks for the system font, the font reports to not be bold, but the metrics/contours
end up visually bold to the user. Font variations, however, are a lower-level interface to
the font, and don't abide by the facade. So, before r281291, we weren't applying font variations
to the system font, so the facade was maintained, but r281291 started applying variations to the
system font, thereby breaking this accessibility bold setting.

The solution is to re-implement accessibility bold when we apply font variations. At the point
where we apply the weight variation, we should determine if accessibility bold is in effect, and
if it is, artificially increase the weight of the created font according to the platform's
inflation amount. There are a few SPI functions which aid in this endeavor.

Test: fast/text/accessibility-bold.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontIsSystemFont):
(WebCore::normalizeGXWeight):
(WebCore::normalizeCTWeight):
(WebCore::denormalizeGXWeight):
(WebCore::denormalizeCTWeight):
(WebCore::overrideEnhanceTextLegibility):
(WebCore::setOverrideEnhanceTextLegibility):
(WebCore::shouldEnhanceTextLegibility):
(WebCore::preparePlatformFont):
(WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
(WebCore::FontCache::platformInit):
(WebCore::variationCapabilitiesForFontDescriptor):
(WebCore::normalizeWeight): Deleted.
(WebCore::denormalizeWeight): Deleted.
* platform/graphics/cocoa/FontCacheCoreText.h:
* testing/Internals.cpp:
(WebCore::Internals::setOverrideEnhanceTextLegibility):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebCore/PAL:

* pal/spi/cf/CoreTextSPI.h:
* pal/spi/cocoa/AccessibilitySupportSPI.h:

LayoutTests:

This test has <!-- webkit-test-runner [ runSingly=true ] --> so the testing
infrastructure for accessibility bold can be web-process-global.

* fast/text/accessibility-bold-expected-mismatch.html: Added.
* fast/text/accessibility-bold.html: Added.
* platform/mac/TestExpectations: Because this test relies on a webkit-test-runner
      header, skip it on WK1.
* platform/ios/TestExpectations: Ditto.
* platform/mac-wk2/TestExpectations: Mark as PASS.
* platform/ios-wk2/TestExpectations: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (291845 => 291846)


--- trunk/LayoutTests/ChangeLog	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/ChangeLog	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,3 +1,22 @@
+2022-03-24  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] REGRESSION(r281291): When accessibility bold is enabled, font-family:system-ui is supposed to be bold
+        https://bugs.webkit.org/show_bug.cgi?id=237817
+        <rdar://problem/88249241>
+
+        Reviewed by Alan Bujtas.
+
+        This test has <!-- webkit-test-runner [ runSingly=true ] --> so the testing
+        infrastructure for accessibility bold can be web-process-global.
+
+        * fast/text/accessibility-bold-expected-mismatch.html: Added.
+        * fast/text/accessibility-bold.html: Added.
+        * platform/mac/TestExpectations: Because this test relies on a webkit-test-runner
+              header, skip it on WK1.
+        * platform/ios/TestExpectations: Ditto.
+        * platform/mac-wk2/TestExpectations: Mark as PASS.
+        * platform/ios-wk2/TestExpectations: Ditto.
+
 2022-03-24  Antoine Quint  <[email protected]>
 
         DOM GPUP: paintSystemPreviewBadge (AR QuickLook element badge)

Modified: trunk/LayoutTests/TestExpectations (291845 => 291846)


--- trunk/LayoutTests/TestExpectations	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/TestExpectations	2022-03-25 04:08:00 UTC (rev 291846)
@@ -5177,3 +5177,6 @@
 webkit.org/b/237108 http/tests/websocket/tests/hybi/extensions.html [ Failure ]
 webkit.org/b/237108 http/tests/websocket/tests/hybi/deflate-frame-parameter.html [ Failure ] # <rdar://problem/33850189>
 webkit.org/b/237108 http/tests/websocket/tests/hybi/handshake-ok-with-legacy-sec-websocket-response-headers.html [ Pass Failure ]
+
+# This test is only relevant on Apple platforms.
+fast/text/accessibility-bold.html [ Pass ImageOnlyFailure ]

Added: trunk/LayoutTests/fast/text/accessibility-bold-expected-mismatch.html (0 => 291846)


--- trunk/LayoutTests/fast/text/accessibility-bold-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/accessibility-bold-expected-mismatch.html	2022-03-25 04:08:00 UTC (rev 291846)
@@ -0,0 +1,15 @@
+<!DOCTYPE html><!-- webkit-test-runner [ runSingly=true ] -->
+<html>
+<head>
+<script>
+if (window.internals) {
+    window.internals.invalidateFontCache();
+    window.internals.setOverrideEnhanceTextLegibility(false);
+}
+</script>
+</head>
+<body>
+This test makes sure that accessibility bold is applied to font-family: system-ui. The test passes if the text below is bold.
+<p style="font: 24px system-ui;">Hello this is text</p>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/accessibility-bold.html (0 => 291846)


--- trunk/LayoutTests/fast/text/accessibility-bold.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/accessibility-bold.html	2022-03-25 04:08:00 UTC (rev 291846)
@@ -0,0 +1,15 @@
+<!DOCTYPE html><!-- webkit-test-runner [ runSingly=true ] -->
+<html>
+<head>
+<script>
+if (window.internals) {
+    window.internals.invalidateFontCache();
+    window.internals.setOverrideEnhanceTextLegibility(true);
+}
+</script>
+</head>
+<body>
+This test makes sure that accessibility bold is applied to font-family: system-ui. The test passes if the text below is bold.
+<p style="font: 24px system-ui;">Hello this is text</p>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (291845 => 291846)


--- trunk/LayoutTests/platform/ios/TestExpectations	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2022-03-25 04:08:00 UTC (rev 291846)
@@ -3565,3 +3565,6 @@
 webkit.org/b/237433 editing/pasteboard/paste-and-sanitize.html [ Timeout Pass Failure ]
 
 webkit.org/b/237955 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-044.html [ Failure ]
+
+# fast/text/accessibility-bold.html requires WK2. The ***-wk2/TestExpectation files mark it as PASS.
+fast/text/accessibility-bold.html [ Skip ]

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (291845 => 291846)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2022-03-25 04:08:00 UTC (rev 291846)
@@ -2322,4 +2322,6 @@
 
 webkit.org/b/237358 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005.html [ Failure ]
 
-webkit.org/b/238282 editing/deleting/insert-in-orphaned-selection-crash.html [ Failure ]
\ No newline at end of file
+webkit.org/b/238282 editing/deleting/insert-in-orphaned-selection-crash.html [ Failure ]
+
+fast/text/accessibility-bold.html [ Pass ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (291845 => 291846)


--- trunk/LayoutTests/platform/mac/TestExpectations	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2022-03-25 04:08:00 UTC (rev 291846)
@@ -2410,3 +2410,5 @@
 
 webkit.org/b/237166 [ BigSur+ ] webgl/pending/conformance/textures/misc/tex-image-video-repeated.html [ Pass Timeout ]
 
+# fast/text/accessibility-bold.html requires WK2. The ***-wk2/TestExpectation files mark it as PASS.
+fast/text/accessibility-bold.html [ Skip ]

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (291845 => 291846)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1691,3 +1691,6 @@
 webkit.org/b/237095 imported/w3c/web-platform-tests/workers/semantics/multiple-workers/004.html [ Pass Failure ]
 
 webkit.org/b/237165 [ BigSur+ Debug ] imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.html [ Pass Crash ]
+
+# Monterey and later use the system font's variable-ness.
+[ Monterey+ ] fast/text/accessibility-bold.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (291845 => 291846)


--- trunk/Source/WebCore/ChangeLog	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/ChangeLog	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,3 +1,49 @@
+2022-03-24  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] REGRESSION(r281291): When accessibility bold is enabled, font-family:system-ui is supposed to be bold
+        https://bugs.webkit.org/show_bug.cgi?id=237817
+        <rdar://problem/88249241>
+
+        Reviewed by Alan Bujtas.
+
+        Accessibility bold is supposed to cause the system font to be rendered as bold, even if the
+        value of the font-weight property is normal.
+
+        The way this is originally supposed to work is that, when accessibility bold is enabled and
+        software asks for the system font, the font reports to not be bold, but the metrics/contours
+        end up visually bold to the user. Font variations, however, are a lower-level interface to
+        the font, and don't abide by the facade. So, before r281291, we weren't applying font variations
+        to the system font, so the facade was maintained, but r281291 started applying variations to the
+        system font, thereby breaking this accessibility bold setting.
+
+        The solution is to re-implement accessibility bold when we apply font variations. At the point
+        where we apply the weight variation, we should determine if accessibility bold is in effect, and
+        if it is, artificially increase the weight of the created font according to the platform's
+        inflation amount. There are a few SPI functions which aid in this endeavor.
+
+        Test: fast/text/accessibility-bold.html
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::fontIsSystemFont):
+        (WebCore::normalizeGXWeight):
+        (WebCore::normalizeCTWeight):
+        (WebCore::denormalizeGXWeight):
+        (WebCore::denormalizeCTWeight):
+        (WebCore::overrideEnhanceTextLegibility):
+        (WebCore::setOverrideEnhanceTextLegibility):
+        (WebCore::shouldEnhanceTextLegibility):
+        (WebCore::preparePlatformFont):
+        (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
+        (WebCore::FontCache::platformInit):
+        (WebCore::variationCapabilitiesForFontDescriptor):
+        (WebCore::normalizeWeight): Deleted.
+        (WebCore::denormalizeWeight): Deleted.
+        * platform/graphics/cocoa/FontCacheCoreText.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setOverrideEnhanceTextLegibility):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2022-03-24  Chris Dumez  <[email protected]>
 
         FileSystem::pathByAppendingComponent() should take in StringViews instead of Strings

Modified: trunk/Source/WebCore/PAL/ChangeLog (291845 => 291846)


--- trunk/Source/WebCore/PAL/ChangeLog	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/PAL/ChangeLog	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,3 +1,14 @@
+2022-03-24  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] REGRESSION(r281291): When accessibility bold is enabled, font-family:system-ui is supposed to be bold
+        https://bugs.webkit.org/show_bug.cgi?id=237817
+        <rdar://problem/88249241>
+
+        Reviewed by Alan Bujtas.
+
+        * pal/spi/cf/CoreTextSPI.h:
+        * pal/spi/cocoa/AccessibilitySupportSPI.h:
+
 2022-03-23  Eric Carlson  <[email protected]>
 
         [Cocoa] Adopt new AVCapture SPI

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h (291845 => 291846)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2021 Apple Inc.  All rights reserved.
+ * Copyright (C) 2014-2022 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -149,6 +149,7 @@
 bool CTFontManagerEnableAllUserFonts(bool postFontChangeNotification);
 
 void CTParagraphStyleSetCompositionLanguage(CTParagraphStyleRef, CTCompositionLanguage);
+CGFloat CTFontGetAccessibilityBoldWeightOfWeight(CGFloat);
 
 extern const CFStringRef kCTFontCSSWeightAttribute;
 extern const CFStringRef kCTFontCSSWidthAttribute;

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AccessibilitySupportSPI.h (291845 => 291846)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AccessibilitySupportSPI.h	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AccessibilitySupportSPI.h	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc.  All rights reserved.
+ * Copyright (C) 2020-2022 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,6 +47,9 @@
 void _AXSSetIsolatedTreeMode(AXSIsolatedTreeMode);
 #endif // ENABLE(ACCESSIBILITY_ISOLATED_TREE)
 
+extern CFStringRef kAXSEnhanceTextLegibilityChangedNotification;
+Boolean _AXSEnhanceTextLegibilityEnabled(void);
+
 WTF_EXTERN_C_END
 
 #endif // USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (291845 => 291846)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
 #include "SystemFontDatabaseCoreText.h"
 #include <CoreText/SFNTLayoutTypes.h>
 #include <pal/spi/cf/CoreTextSPI.h>
+#include <pal/spi/cocoa/AccessibilitySupportSPI.h>
 #include <wtf/HashSet.h>
 #include <wtf/Lock.h>
 #include <wtf/MainThread.h>
@@ -350,7 +351,6 @@
     return result;
 }
 
-#if USE(NON_VARIABLE_SYSTEM_FONT)
 static inline bool fontIsSystemFont(CTFontRef font)
 {
     if (isSystemFont(font))
@@ -359,25 +359,70 @@
     auto name = adoptCF(CTFontCopyPostScriptName(font));
     return fontNameIsSystemFont(name.get());
 }
-#endif
 
 // These values were calculated by performing a linear regression on the CSS weights/widths/slopes and Core Text weights/widths/slopes of San Francisco.
 // FIXME: <rdar://problem/31312602> Get the real values from Core Text.
-static inline float normalizeWeight(float value)
+static inline float normalizeGXWeight(float value)
 {
     return 523.7 * value - 109.3;
 }
 
+// These values were experimentally gathered from the various named weights of San Francisco.
+static struct {
+    float ctWeight;
+    float cssWeight;
+} keyframes[] = {
+    { -0.8, 30 },
+    { -0.4, 274 },
+    { 0, 400 },
+    { 0.23, 510 },
+    { 0.3, 590 },
+    { 0.4, 700 },
+    { 0.56, 860 },
+    { 0.62, 1000 },
+};
+static_assert(WTF_ARRAY_LENGTH(keyframes) > 0);
+
+static inline float normalizeCTWeight(float value)
+{
+    if (value < keyframes[0].ctWeight)
+        return keyframes[0].cssWeight;
+    for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyframes) - 1; ++i) {
+        auto& before = keyframes[i];
+        auto& after = keyframes[i];
+        if (value < before.ctWeight || value > after.ctWeight)
+            continue;
+        float ratio = (value - before.ctWeight) / (after.ctWeight - before.ctWeight);
+        return ratio * (after.cssWeight - before.cssWeight) + before.cssWeight;
+    }
+    return keyframes[WTF_ARRAY_LENGTH(keyframes) - 1].cssWeight;
+}
+
 static inline float normalizeSlope(float value)
 {
     return value * 300;
 }
 
-static inline float denormalizeWeight(float value)
+static inline float denormalizeGXWeight(float value)
 {
     return (value + 109.3) / 523.7;
 }
 
+static inline float denormalizeCTWeight(float value)
+{
+    if (value < keyframes[0].cssWeight)
+        return keyframes[0].ctWeight;
+    for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyframes) - 1; ++i) {
+        auto& before = keyframes[i];
+        auto& after = keyframes[i];
+        if (value < before.cssWeight || value > after.cssWeight)
+            continue;
+        float ratio = (value - before.cssWeight) / (after.cssWeight - before.cssWeight);
+        return ratio * (after.ctWeight - before.ctWeight) + before.ctWeight;
+    }
+    return keyframes[WTF_ARRAY_LENGTH(keyframes) - 1].ctWeight;
+}
+
 static inline float denormalizeSlope(float value)
 {
     return value / 300;
@@ -521,6 +566,22 @@
     }
 }
 
+static std::optional<bool>& overrideEnhanceTextLegibility()
+{
+    static NeverDestroyed<std::optional<bool>> overrideEnhanceTextLegibility;
+    return overrideEnhanceTextLegibility.get();
+}
+
+void setOverrideEnhanceTextLegibility(bool enhance)
+{
+    overrideEnhanceTextLegibility() = enhance;
+}
+
+static bool shouldEnhanceTextLegibility()
+{
+    return overrideEnhanceTextLegibility().value_or(_AXSEnhanceTextLegibilityEnabled());
+}
+
 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescription& fontDescription, const FontCreationContext& fontCreationContext, bool applyWeightWidthSlopeVariations)
 {
     if (!originalFont)
@@ -603,8 +664,13 @@
             width = std::max(std::min(width, static_cast<float>(widthValue->maximum)), static_cast<float>(widthValue->minimum));
         if (auto slopeValue = fontCreationContext.fontFaceCapabilities().weight)
             slope = std::max(std::min(slope, static_cast<float>(slopeValue->maximum)), static_cast<float>(slopeValue->minimum));
+        if (fontIsSystemFont(originalFont) && shouldEnhanceTextLegibility()) {
+            auto ctWeight = denormalizeCTWeight(weight);
+            ctWeight = CTFontGetAccessibilityBoldWeightOfWeight(ctWeight);
+            weight = normalizeCTWeight(ctWeight);
+        }
         if (needsConversion) {
-            weight = denormalizeWeight(weight);
+            weight = denormalizeGXWeight(weight);
             width = denormalizeVariationWidth(width);
             slope = denormalizeSlope(slope);
         }
@@ -752,7 +818,7 @@
 
 static void invalidateFontCache();
 
-static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef)
+static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
 {
     ASSERT_UNUSED(observer, isMainThread() && observer == &FontCache::forCurrentThread());
 
@@ -763,6 +829,8 @@
 {
     CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, &fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
 
+    CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, &fontCacheRegisteredFontsChangedNotificationCallback, kAXSEnhanceTextLegibilityChangedNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
+
 #if PLATFORM(MAC)
     CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter();
     const CFStringRef notificationName = kCFLocaleCurrentLocaleDidChangeNotification;
@@ -1063,11 +1131,11 @@
 
     if (FontType(font.get()).variationType == FontType::VariationType::TrueTypeGX && !optOutFromGXNormalization) {
         if (result.weight)
-            result.weight = {{ normalizeWeight(result.weight.value().minimum), normalizeWeight(result.weight.value().maximum) }};
+            result.weight = { { normalizeGXWeight(result.weight.value().minimum), normalizeGXWeight(result.weight.value().maximum) } };
         if (result.width)
-            result.width = {{ normalizeVariationWidth(result.width.value().minimum), normalizeVariationWidth(result.width.value().maximum) }};
+            result.width = { { normalizeVariationWidth(result.width.value().minimum), normalizeVariationWidth(result.width.value().maximum) } };
         if (result.slope)
-            result.slope = {{ normalizeSlope(result.slope.value().minimum), normalizeSlope(result.slope.value().maximum) }};
+            result.slope = { { normalizeSlope(result.slope.value().minimum), normalizeSlope(result.slope.value().maximum) } };
     }
 
     auto minimum = static_cast<float>(FontSelectionValue::minimumValue());
@@ -1686,4 +1754,4 @@
 #endif
 }
 
-}
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h (291845 => 291846)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2021 Apple Inc.  All rights reserved.
+ * Copyright (C) 2017-2022 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -72,6 +72,7 @@
 RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontRef, AllowUserInstalledFonts);
 void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts);
 RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts);
+VariationDefaultsMap defaultVariationValues(CTFontRef, ShouldLocalizeAxisNames);
+WEBCORE_EXPORT void setOverrideEnhanceTextLegibility(bool);
 
-VariationDefaultsMap defaultVariationValues(CTFontRef, ShouldLocalizeAxisNames);
-}
+} // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.cpp (291845 => 291846)


--- trunk/Source/WebCore/testing/Internals.cpp	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/testing/Internals.cpp	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -346,6 +346,7 @@
 #endif
 
 #if PLATFORM(COCOA)
+#include "FontCacheCoreText.h"
 #include "SystemBattery.h"
 #include "VP9UtilitiesCocoa.h"
 #include <pal/spi/cf/CoreTextSPI.h>
@@ -1904,6 +1905,15 @@
     FontCascade::setShouldUseSmoothing(enabled);
 }
 
+void Internals::setOverrideEnhanceTextLegibility(bool enhance)
+{
+#if PLATFORM(COCOA)
+    WebCore::setOverrideEnhanceTextLegibility(enhance);
+#else
+    UNUSED_PARAM(enhance);
+#endif
+}
+
 ExceptionOr<void> Internals::setLowPowerModeEnabled(bool isEnabled)
 {
     auto* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (291845 => 291846)


--- trunk/Source/WebCore/testing/Internals.h	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/testing/Internals.h	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -315,6 +315,7 @@
 
     void invalidateFontCache();
     void setFontSmoothingEnabled(bool);
+    void setOverrideEnhanceTextLegibility(bool);
 
     ExceptionOr<void> setLowPowerModeEnabled(bool);
     ExceptionOr<void> setOutsideViewportThrottlingEnabled(bool);

Modified: trunk/Source/WebCore/testing/Internals.idl (291845 => 291846)


--- trunk/Source/WebCore/testing/Internals.idl	2022-03-25 02:51:24 UTC (rev 291845)
+++ trunk/Source/WebCore/testing/Internals.idl	2022-03-25 04:08:00 UTC (rev 291846)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -428,6 +428,7 @@
 
     undefined invalidateFontCache();
     undefined setFontSmoothingEnabled(boolean enabled);
+    undefined setOverrideEnhanceTextLegibility(boolean enhance);
 
     undefined setScrollViewPosition(long x, long y);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to