Title: [252701] trunk
Revision
252701
Author
[email protected]
Date
2019-11-20 12:33:39 -0800 (Wed, 20 Nov 2019)

Log Message

Turn off antialiasing when rendering with Ahem, for testing
https://bugs.webkit.org/show_bug.cgi?id=204197
Source/WebCore:

<rdar://problem/57190712>

Reviewed by Myles C. Maxfield.

If the font family name matches "Ahem", turn off antialiasing when rendering text,
because many CSS tests assume that Ahem glyphs can be compared with positioned elements
in ref tests.

Since Ahem is a font only used for testing, I don't think this behavior needs to be
controlled by a setting.

* platform/graphics/Font.cpp:
(WebCore::Font::Font):
* platform/graphics/Font.h:
(WebCore::Font::allowsAntialiasing const):
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::isAhemFont):
(WebCore::Font::platformInit):

LayoutTests:

Reviewed by Myles C. Maxfield.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252700 => 252701)


--- trunk/LayoutTests/ChangeLog	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/LayoutTests/ChangeLog	2019-11-20 20:33:39 UTC (rev 252701)
@@ -1,3 +1,12 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        Turn off antialiasing when rendering with Ahem, for testing
+        https://bugs.webkit.org/show_bug.cgi?id=204197
+
+        Reviewed by Myles C. Maxfield.
+
+        * TestExpectations:
+
 2019-11-20  Per Arne Vollan  <[email protected]>
 
         Layout Test fast/text/font-antialiasing-save-restore.html is failing

Modified: trunk/LayoutTests/TestExpectations (252700 => 252701)


--- trunk/LayoutTests/TestExpectations	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/LayoutTests/TestExpectations	2019-11-20 20:33:39 UTC (rev 252701)
@@ -1873,10 +1873,6 @@
 imported/w3c/web-platform-tests/css/css-multicol/columnfill-auto-max-height-001.html
 imported/w3c/web-platform-tests/css/css-multicol/columnfill-auto-max-height-002.html
 imported/w3c/web-platform-tests/css/css-multicol/large-actual-column-count.html
-imported/w3c/web-platform-tests/css/css-multicol/multicol-basic-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-basic-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-basic-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-basic-004.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-breaking-000.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-breaking-001.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-breaking-002.html [ ImageOnlyFailure ]
@@ -1901,21 +1897,14 @@
 imported/w3c/web-platform-tests/css/css-multicol/multicol-nested-margin-003.xht [ ImageOnlyFailure ] 
 imported/w3c/web-platform-tests/css/css-multicol/multicol-nested-margin-004.xht [ ImageOnlyFailure ] 
 imported/w3c/web-platform-tests/css/css-multicol/multicol-nested-margin-005.xht [ ImageOnlyFailure ] 
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-002.xht [ ImageOnlyFailure ]
 webkit.org/b/148816 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-004.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-color-inherit-002.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-fraction-003.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-001.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-002.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-003.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-004.html
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-px-001.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-shorthand-2.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-stacking-001.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-shorthand-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-004.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-010.html
-imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-block-sibling-003.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-button-001.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-button-002.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-button-003.html
@@ -1923,13 +1912,10 @@
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-children-height-005.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-children-height-008.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-002.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-bottom-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-nested-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-nested-002.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-nested-003.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-nested-firstchild-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-rule-001.html
-imported/w3c/web-platform-tests/css/css-multicol/multicol-span-none-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-under-vertical-rl-scroll.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-width-004.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-width-005.html
@@ -2299,26 +2285,6 @@
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-011.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-002.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-003.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-001.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-002.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-003.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-004.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-005.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-006.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-007.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-008.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-009.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-010.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-014.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-015.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-016.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-017.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-001.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-002.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-003.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-004.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-005.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justify-006.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justifyall-001.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justifyall-002.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justifyall-003.html [ ImageOnlyFailure ]
@@ -2327,20 +2293,6 @@
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-justifyall-006.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-last-010.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-last-011.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-001.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-002.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-003.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-004.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-005.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-006.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-007.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-008.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-009.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-010.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-014.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-015.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-016.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-start-017.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-indent/text-indent-percentage-001.xht [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-justify/text-justify-001.html [ ImageOnlyFailure ]
 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-transform/text-transform-capitalize-018.html [ ImageOnlyFailure Pass ]

Modified: trunk/Source/WebCore/ChangeLog (252700 => 252701)


--- trunk/Source/WebCore/ChangeLog	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/Source/WebCore/ChangeLog	2019-11-20 20:33:39 UTC (rev 252701)
@@ -1,3 +1,28 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        Turn off antialiasing when rendering with Ahem, for testing
+        https://bugs.webkit.org/show_bug.cgi?id=204197
+        <rdar://problem/57190712>
+
+        Reviewed by Myles C. Maxfield.
+
+        If the font family name matches "Ahem", turn off antialiasing when rendering text,
+        because many CSS tests assume that Ahem glyphs can be compared with positioned elements
+        in ref tests.
+
+        Since Ahem is a font only used for testing, I don't think this behavior needs to be
+        controlled by a setting.
+
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::Font):
+        * platform/graphics/Font.h:
+        (WebCore::Font::allowsAntialiasing const):
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::isAhemFont):
+        (WebCore::Font::platformInit):
+
 2019-11-20  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Cache InlinteTextItem width when possible

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (252700 => 252701)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2019-11-20 20:33:39 UTC (rev 252701)
@@ -62,6 +62,7 @@
     , m_isBrokenIdeographFallback(false)
     , m_hasVerticalGlyphs(false)
     , m_isUsedInSystemFallbackCache(false)
+    , m_allowsAntialiasing(true)
 #if PLATFORM(IOS_FAMILY)
     , m_shouldNotBeUsedForArabic(false)
 #endif

Modified: trunk/Source/WebCore/platform/graphics/Font.h (252700 => 252701)


--- trunk/Source/WebCore/platform/graphics/Font.h	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2019-11-20 20:33:39 UTC (rev 252701)
@@ -183,6 +183,7 @@
     Origin origin() const { return m_origin; }
     bool isInterstitial() const { return m_isInterstitial; }
     Visibility visibility() const { return m_visibility; }
+    bool allowsAntialiasing() const { return m_allowsAntialiasing; }
 
 #if !LOG_DISABLED
     String description() const;
@@ -310,6 +311,8 @@
     unsigned m_hasVerticalGlyphs : 1;
 
     unsigned m_isUsedInSystemFallbackCache : 1;
+    
+    unsigned m_allowsAntialiasing : 1;
 
 #if PLATFORM(IOS_FAMILY)
     unsigned m_shouldNotBeUsedForArabic : 1;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (252700 => 252701)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2019-11-20 20:33:39 UTC (rev 252701)
@@ -209,6 +209,9 @@
     bool shouldAntialias = true;
     bool shouldSmoothFonts = true;
     
+    if (!font.allowsAntialiasing())
+        smoothingMode = FontSmoothingMode::NoSmoothing;
+
     switch (smoothingMode) {
     case FontSmoothingMode::Antialiased:
         shouldSmoothFonts = false;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (252700 => 252701)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2019-11-20 20:14:25 UTC (rev 252700)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2019-11-20 20:33:39 UTC (rev 252701)
@@ -113,6 +113,11 @@
 
 #endif
 
+static bool isAhemFont(CFStringRef familyName)
+{
+    return familyName && caseInsensitiveCompare(familyName, CFSTR("Ahem"));
+}
+
 void Font::platformInit()
 {
 #if PLATFORM(IOS_FAMILY)
@@ -141,6 +146,11 @@
     }
 
     auto familyName = adoptCF(CTFontCopyFamilyName(m_platformData.font()));
+
+    // Disable antialiasing when rendering with Ahem because many tests require this.
+    if (isAhemFont(familyName.get()))
+        m_allowsAntialiasing = false;
+
 #if PLATFORM(MAC)
     // We need to adjust Times, Helvetica, and Courier to closely match the
     // vertical metrics of their Microsoft counterparts that are the de facto
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to