Changeset 287757 in webkit


Ignore:
Timestamp:
Jan 7, 2022, 10:06:43 AM (4 years ago)
Author:
Simon Fraser
Message:

REGRESSION (Safari 14): background-attachment: local does not work
https://bugs.webkit.org/show_bug.cgi?id=219324
Source/WebCore:

<rdar://71808922>

Reviewed by Antti Koivisto.

With async overflow scrolling, we need to trigger a repaint if the scrolling element
has any background layer with background-attachment: local.

The background won't always be synchronized with the scrolling, but a little jitter
is better than a broken CSS behavior (and this is what Firefox does).

Test: fast/repaint/background-attachment-local-scroll.html

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::needsRepaintOnCompositedScroll const):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::hasAnyLocalBackground const):

  • rendering/style/RenderStyle.h:

LayoutTests:

Reviewed by Antti Koivisto.

Skip the test on platforms without async overflow scroll.

  • TestExpectations:
  • fast/repaint/background-attachment-local-scroll-expected.txt: Added.
  • fast/repaint/background-attachment-local-scroll.html: Added.
  • platform/ios-wk2/TestExpectations:
  • platform/mac-wk2/TestExpectations:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287756 r287757  
     12022-01-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (Safari 14): background-attachment: local does not work
     4        https://bugs.webkit.org/show_bug.cgi?id=219324
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Skip the test on platforms without async overflow scroll.
     9
     10        * TestExpectations:
     11        * fast/repaint/background-attachment-local-scroll-expected.txt: Added.
     12        * fast/repaint/background-attachment-local-scroll.html: Added.
     13        * platform/ios-wk2/TestExpectations:
     14        * platform/mac-wk2/TestExpectations:
     15
    1162022-01-07  Kate Cheney  <katherine_cheney@apple.com>
    217
  • trunk/LayoutTests/TestExpectations

    r287696 r287757  
    9292compositing/scrolling/async-overflow-scrolling [ Skip ]
    9393compositing/layer-creation/clipping-scope [ Skip ]
     94fast/repaint/background-attachment-local-scroll.html [ Skip ]
    9495
    9596# WebKit2 only.
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r287693 r287757  
    4242fast/media/mq-prefers-contrast-live-update.html [ Pass ]
    4343
     44fast/repaint/background-attachment-local-scroll.html [ Pass ]
    4445fast/repaint/placeholder-after-caps-lock-hidden.html [ Pass ]
    4546
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r287693 r287757  
    4343fast/media/mq-prefers-contrast.html [ Pass ]
    4444
     45fast/repaint/background-attachment-local-scroll.html [ Pass ]
    4546fast/scrolling/unfocusing-page-while-keyboard-scrolling.html [ Pass ]
    4647
  • trunk/Source/WebCore/ChangeLog

    r287756 r287757  
     12022-01-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (Safari 14): background-attachment: local does not work
     4        https://bugs.webkit.org/show_bug.cgi?id=219324
     5        <rdar://71808922>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        With async overflow scrolling, we need to trigger a repaint if the scrolling element
     10        has any background layer with `background-attachment: local`.
     11
     12        The background won't always be synchronized with the scrolling, but a little jitter
     13        is better than a broken CSS behavior (and this is what Firefox does).
     14
     15        Test: fast/repaint/background-attachment-local-scroll.html
     16
     17        * rendering/RenderLayerBacking.cpp:
     18        (WebCore::RenderLayerBacking::needsRepaintOnCompositedScroll const):
     19        * rendering/style/RenderStyle.cpp:
     20        (WebCore::RenderStyle::hasAnyLocalBackground const):
     21        * rendering/style/RenderStyle.h:
     22
    1232022-01-07  Kate Cheney  <katherine_cheney@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r287742 r287757  
    20352035        return false;
    20362036
     2037    if (renderer().style().hasAnyLocalBackground())
     2038        return true;
     2039
    20372040    if (auto scrollingCoordinator = m_owningLayer.page().scrollingCoordinator())
    20382041        return scrollingCoordinator->hasSynchronousScrollingReasons(m_scrollingNodeID);
    2039    
     2042
    20402043    return false;
    20412044}
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r287742 r287757  
    16651665{
    16661666    return allLayersAreFixed(backgroundLayers());
     1667}
     1668
     1669bool RenderStyle::hasAnyLocalBackground() const
     1670{
     1671    for (auto* layer = &backgroundLayers(); layer; layer = layer->next()) {
     1672        if (layer->image() && layer->attachment() == FillAttachment::LocalBackground)
     1673            return true;
     1674    }
     1675    return false;
    16671676}
    16681677
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r287742 r287757  
    215215
    216216    bool hasEntirelyFixedBackground() const;
     217    bool hasAnyLocalBackground() const;
    217218
    218219    bool hasAppearance() const { return appearance() != NoControlPart; }
Note: See TracChangeset for help on using the changeset viewer.