• Philip Rogers's avatar
    Add a feature for respecting the MacOS LCD text behavior · 954954b5
    Philip Rogers authored
    This patch adds a feature flag for respecting the MacOS subpixel
    anti-aliasing setting (called "LCD text" in chromium). MacOS 10.14
    (Mojave) disabled LCD text by default and, by respecting this setting,
    scrolling performance can be improved. This is because composited
    scrolling no longer needs to be avoided for the purposes of maintaining
    LCD text, which is lost in the common case where the scrolling contents
    layer is not fully opaque (see [1] for details of this).
    
    The MacOS setting for LCD text can be controlled with:
    defaults write -g CGFontRenderingFontSmoothingDisabled -bool true
    ("true" is default, "false" overrides this). This patch uses a private
    API, CGFontRenderingGetFontSmoothingDisabled, which is used by Safari
    (see: https://trac.webkit.org/changeset/239306/webkit).
    
    Enabling this feature will expose the differences of composited
    scrolling which include minor pixel differences, less-minor stacking
    differences (the fundamental compositing bug: crbug.com/370604), as well
    as a few bugs. These differences are already present on all devices with
    device pixel ratios >= 1.5 (50% of MacOS), as well as Android and
    ChromeOS platforms which force-enable prefer-compositing-to-lcd-text.
    The web_test changes can be seen in the Mac10.14 trybot results at
    https://crrev.com/c/2207413/1. These have been triaged and
    non-rebaseline differences have been broken out as bugs blocking
    crbug.com/1079418. This patch does not enable the feature by default but
    a followup will, which will include these baseline updates.
    
    We have UMA data from the PreferCompositingToLCDText experiment that
    should match the effect of this feature for users that have not enabled
    LCD text via the command line:
    Event.Latency.ScrollUpdate.Wheel.TimeToScrollUpdateSwapBegin4
      95th: -5%, 99th: -12%
    EventLatency.GestureScrollUpdate.Wheel.TotalLatency
      95th: -6%, 99th: -14%
    https://uma.googleplex.com/p/chrome/variations/?sid=a8cb2e0aa29593ad35baa33a2bee3f97
    
    [1] Excellent explanation of why compositing forces greyscale AA:
    https://gankra.github.io/blah/text-hates-you/#subpixel-aa-isnt-composable
    
    Bug: 1079418
    Change-Id: Ieca837912ec19f7a7b4378b989d86a4242108668
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207413Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
    Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Commit-Queue: Philip Rogers <pdr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#771858}
    954954b5
theme_helper_mac.h 884 Bytes