Bug 172737 - REGRESSION(r213464): [iOS] Fonts get too bold when the "Bold Text" accessibility setting is enabled
Summary: REGRESSION(r213464): [iOS] Fonts get too bold when the "Bold Text" accessibil...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-30 15:25 PDT by Myles C. Maxfield
Modified: 2017-08-21 12:13 PDT (History)
11 users (show)

See Also:


Attachments
Needs test (2.98 KB, patch)
2017-05-30 15:27 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
WIP (24.10 KB, patch)
2017-05-30 19:13 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
WIP (31.75 KB, patch)
2017-05-30 21:53 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (36.76 KB, patch)
2017-05-30 23:47 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews124 for ios-simulator-wk2 (12.62 MB, application/zip)
2017-05-31 01:12 PDT, Build Bot
no flags Details
Patch (35.06 KB, patch)
2017-05-31 09:57 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (1.05 MB, application/zip)
2017-05-31 12:10 PDT, Build Bot
no flags Details
Patch (37.61 KB, patch)
2017-06-01 16:52 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (37.68 KB, patch)
2017-06-01 17:21 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (20.60 KB, patch)
2017-06-02 13:16 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (23.52 KB, patch)
2017-06-02 13:25 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (23.53 KB, patch)
2017-06-02 13:34 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (22.53 KB, patch)
2017-06-02 13:48 PDT, Myles C. Maxfield
simon.fraser: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Patch for committing (22.64 KB, patch)
2017-06-02 14:00 PDT, Myles C. Maxfield
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (1.07 MB, application/zip)
2017-06-02 14:23 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (1.24 MB, application/zip)
2017-06-02 14:30 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-elcapitan (1.85 MB, application/zip)
2017-06-02 14:49 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews100 for mac-elcapitan (994.37 KB, application/zip)
2017-06-02 15:01 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.11 MB, application/zip)
2017-06-02 15:05 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-elcapitan (1.86 MB, application/zip)
2017-06-02 15:16 PDT, Build Bot
no flags Details
Patch for committing (23.37 KB, patch)
2017-06-02 15:58 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2017-05-30 15:25:57 PDT
[iOS] Fonts get too bold when the "Bold Text" accessibility setting is enabled
Comment 1 Myles C. Maxfield 2017-05-30 15:26:39 PDT
<rdar://problem/31608236>
Comment 2 Myles C. Maxfield 2017-05-30 15:27:40 PDT
Created attachment 311545 [details]
Needs test
Comment 3 Myles C. Maxfield 2017-05-30 19:13:37 PDT
Created attachment 311567 [details]
WIP
Comment 4 Myles C. Maxfield 2017-05-30 21:53:13 PDT
Created attachment 311573 [details]
WIP
Comment 5 Myles C. Maxfield 2017-05-30 23:47:17 PDT
Created attachment 311576 [details]
Patch
Comment 6 Build Bot 2017-05-31 01:12:24 PDT
Comment on attachment 311576 [details]
Patch

Attachment 311576 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3846821

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 7 Build Bot 2017-05-31 01:12:25 PDT
Created attachment 311578 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 8 Myles C. Maxfield 2017-05-31 09:57:12 PDT
Created attachment 311603 [details]
Patch
Comment 9 Build Bot 2017-05-31 12:10:58 PDT
Comment on attachment 311603 [details]
Patch

Attachment 311603 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3849301

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 10 Build Bot 2017-05-31 12:10:59 PDT
Created attachment 311616 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 11 Myles C. Maxfield 2017-06-01 16:52:32 PDT
Created attachment 311780 [details]
Patch
Comment 12 mitz 2017-06-01 17:05:08 PDT
Comment on attachment 311780 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311780&action=review

> Source/WebKit2/Configurations/BaseTarget.xcconfig:116
> +ACCESSIBILITY_LDFLAGS[sdk=iphone*] = -lAccessibility;
> +ACCESSIBILITY_LDFLAGS[sdk=macosx*] = ;

Please prefix new custom build settings’ names with WK_

It would be better to make the first definition unconditional, so that it applies to all of PLATFORM(IOS) and not just TARGET_OS_IOS.
Comment 13 Myles C. Maxfield 2017-06-01 17:21:52 PDT
Created attachment 311786 [details]
Patch
Comment 14 Simon Fraser (smfr) 2017-06-01 17:34:56 PDT
Comment on attachment 311786 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311786&action=review

> Source/WebCore/rendering/RenderThemeIOS.mm:1234
> +    if (result < -0.6)
> +        return FontSelectionValue(100);
> +    if (result < -0.365)
> +        return FontSelectionValue(200);
> +    if (result < -0.115)
> +        return FontSelectionValue(300);
> +    if (result <  0.130)
> +        return FontSelectionValue(400);
> +    if (result <  0.235)
> +        return FontSelectionValue(500);
> +    if (result <  0.350)
> +        return FontSelectionValue(600);
> +    if (result <  0.500)
> +        return FontSelectionValue(700);
> +    if (result <  0.700)
> +        return FontSelectionValue(800);

I feel like this could be a const data table and a for loop.

> Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:156
> +            _AXSSetEnhanceTextLegibilityEnabled(TRUE);
> +            atexit(&WebKit::unBoldSystemFontForAccessibility);

This part is gross and I think we should try to avoid it.
Comment 15 Sam Weinig 2017-06-01 22:11:18 PDT
Comment on attachment 311786 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311786&action=review

>> Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:156
>> +            atexit(&WebKit::unBoldSystemFontForAccessibility);
> 
> This part is gross and I think we should try to avoid it.

Agreed, I think we need an alternate solution here. Why is this atexit() needed? Your changelog did not say.
Comment 16 Myles C. Maxfield 2017-06-02 13:16:30 PDT
Created attachment 311850 [details]
Patch
Comment 17 Build Bot 2017-06-02 13:22:21 PDT
Attachment 311850 [details] did not pass style-queue:


ERROR: LayoutTests/platform/mac/TestExpectations:1548:  Path does not exist.  [test/expectations] [5]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 18 Myles C. Maxfield 2017-06-02 13:25:57 PDT
Created attachment 311852 [details]
Patch
Comment 19 Myles C. Maxfield 2017-06-02 13:34:34 PDT
Created attachment 311854 [details]
Patch
Comment 20 Simon Fraser (smfr) 2017-06-02 13:38:34 PDT
Comment on attachment 311854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311854&action=review

> Source/WebCore/platform/graphics/FontCache.h:230
> +    bool shouldMockBoldSystemFontForAccessibility() { return m_shouldMockBoldSystemFontForAccessibility; }

const

> Source/WebCore/rendering/RenderTheme.h:256
> +    virtual bool shouldMockBoldSystemFontForAccessibility() { return false; }

const

> Source/WebCore/rendering/RenderThemeIOS.h:121
> +    bool shouldMockBoldSystemFontForAccessibility() override { return m_shouldMockBoldSystemFontForAccessibility; }

const

> Source/WebCore/rendering/RenderThemeIOS.mm:1235
> +    if (result < -0.6)
> +        return FontSelectionValue(100);
> +    if (result < -0.365)
> +        return FontSelectionValue(200);
> +    if (result < -0.115)
> +        return FontSelectionValue(300);
> +    if (result <  0.130)
> +        return FontSelectionValue(400);
> +    if (result <  0.235)
> +        return FontSelectionValue(500);
> +    if (result <  0.350)
> +        return FontSelectionValue(600);
> +    if (result <  0.500)
> +        return FontSelectionValue(700);
> +    if (result <  0.700)
> +        return FontSelectionValue(800);
> +    return FontSelectionValue(900);

You didn't like the const data suggestion?
Comment 21 Myles C. Maxfield 2017-06-02 13:48:32 PDT
Created attachment 311856 [details]
Patch
Comment 22 Simon Fraser (smfr) 2017-06-02 13:52:50 PDT
Comment on attachment 311856 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311856&action=review

> Source/WebCore/rendering/RenderThemeIOS.mm:1219
> +    static float weightThresholds[] = { -0.6, -0.365, -0.115, 0.130, 0.235, 0.350, 0.5, 0.7 };

I'd like to see a comment saying where these magic numbers come from.

> Source/WebCore/testing/InternalSettings.cpp:690
> +    RenderTheme::singleton().setShouldMockBoldSystemFontForAccessibility(requires);
> +    FontCache::singleton().setShouldMockBoldSystemFontForAccessibility(requires);

Feels slightly weird to stash this state in two places.
Comment 23 Myles C. Maxfield 2017-06-02 14:00:40 PDT
Created attachment 311857 [details]
Patch for committing
Comment 24 Simon Fraser (smfr) 2017-06-02 14:04:56 PDT
Comment on attachment 311857 [details]
Patch for committing

View in context: https://bugs.webkit.org/attachment.cgi?id=311857&action=review

> Source/WebCore/rendering/RenderThemeIOS.mm:1219
> +    // These numbers were experimenatlly gathered from weights of the system font.

"experimenatlly"
Comment 25 Build Bot 2017-06-02 14:23:22 PDT
Comment on attachment 311856 [details]
Patch

Attachment 311856 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3861558

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 26 Build Bot 2017-06-02 14:23:24 PDT
Created attachment 311859 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 27 Build Bot 2017-06-02 14:30:00 PDT
Comment on attachment 311856 [details]
Patch

Attachment 311856 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3861588

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 28 Build Bot 2017-06-02 14:30:01 PDT
Created attachment 311861 [details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 29 Build Bot 2017-06-02 14:49:13 PDT
Comment on attachment 311856 [details]
Patch

Attachment 311856 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3861617

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 30 Build Bot 2017-06-02 14:49:14 PDT
Created attachment 311864 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 31 Build Bot 2017-06-02 15:01:22 PDT
Comment on attachment 311857 [details]
Patch for committing

Attachment 311857 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3861755

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 32 Build Bot 2017-06-02 15:01:23 PDT
Created attachment 311868 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 33 Build Bot 2017-06-02 15:05:42 PDT
Comment on attachment 311857 [details]
Patch for committing

Attachment 311857 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3861758

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 34 Build Bot 2017-06-02 15:05:43 PDT
Created attachment 311869 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 35 Build Bot 2017-06-02 15:16:47 PDT
Comment on attachment 311857 [details]
Patch for committing

Attachment 311857 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3861680

New failing tests:
fast/text/accessibility-bold-system-font-2.html
Comment 36 Build Bot 2017-06-02 15:16:49 PDT
Created attachment 311872 [details]
Archive of layout-test-results from ews114 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 37 Myles C. Maxfield 2017-06-02 15:58:58 PDT
Created attachment 311879 [details]
Patch for committing
Comment 38 WebKit Commit Bot 2017-06-02 16:40:10 PDT
Comment on attachment 311879 [details]
Patch for committing

Clearing flags on attachment: 311879

Committed r217742: <http://trac.webkit.org/changeset/217742>
Comment 39 Michael Catanzaro 2017-08-15 09:56:41 PDT
Since this test is only intended to work on iOS, I'm going to skip it in the global TestExpectations and mark it as passing in the iOS expectations instead.
Comment 40 Myles C. Maxfield 2017-08-21 12:13:10 PDT
(In reply to Michael Catanzaro from comment #39)
> Since this test is only intended to work on iOS, I'm going to skip it in the
> global TestExpectations and mark it as passing in the iOS expectations
> instead.

👍