Changeset 224265 in webkit


Ignore:
Timestamp:
Oct 31, 2017 5:21:20 PM (7 years ago)
Author:
Simon Fraser
Message:

Rubber-banding overflow-scrolling-touch shows black
https://bugs.webkit.org/show_bug.cgi?id=179087
rdar://problem/35260253

Reviewed by Sam Weinig.

Source/WebCore:

The "backgroundIsKnownToBeObscured" optimization was kicking in for an overflow:scroll
whose area was completely covered by its contents, which happens with overlay scrollbars.

However, this ignored the fact that you can rubber-band to reveal the background, and,
on iOS, composited scrolling requires that the scroller background is painted since it goes
into its own layer.

Fix by turning off the optimization for layers that scroll overflow, including those
using composited scrolling.

Test: fast/scrolling/rubber-band-shows-background.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
(WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderLayer.h:

LayoutTests:

  • fast/scrolling/rubber-band-shows-background-expected.html: Added.
  • fast/scrolling/rubber-band-shows-background.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224264 r224265  
     12017-10-31  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rubber-banding overflow-scrolling-touch shows black
     4        https://bugs.webkit.org/show_bug.cgi?id=179087
     5        rdar://problem/35260253
     6
     7        Reviewed by Sam Weinig.
     8
     9        * fast/scrolling/rubber-band-shows-background-expected.html: Added.
     10        * fast/scrolling/rubber-band-shows-background.html: Added.
     11
    1122017-10-31  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r224263 r224265  
     12017-10-31  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rubber-banding overflow-scrolling-touch shows black
     4        https://bugs.webkit.org/show_bug.cgi?id=179087
     5        rdar://problem/35260253
     6
     7        Reviewed by Sam Weinig.
     8
     9        The "backgroundIsKnownToBeObscured" optimization was kicking in for an overflow:scroll
     10        whose area was completely covered by its contents, which happens with overlay scrollbars.
     11
     12        However, this ignored the fact that you can rubber-band to reveal the background, and,
     13        on iOS, composited scrolling requires that the scroller background is painted since it goes
     14        into its own layer.
     15
     16        Fix by turning off the optimization for layers that scroll overflow, including those
     17        using composited scrolling.
     18
     19        Test: fast/scrolling/rubber-band-shows-background.html
     20
     21        * rendering/RenderBox.cpp:
     22        (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
     23        (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
     24        * rendering/RenderLayer.cpp:
     25        (WebCore::RenderLayer::scrollTo):
     26        (WebCore::RenderLayer::calculateClipRects const):
     27        * rendering/RenderLayer.h:
     28
    1292017-10-31  Tim Horton  <timothy_horton@apple.com>
    230
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r224260 r224265  
    14191419    if (!maxDepthToTest)
    14201420        return false;
     1421
    14211422    for (auto& childBox : childrenOfType<RenderBox>(*this)) {
    14221423        if (!isCandidateForOpaquenessTest(childBox))
     
    14561457    if (!getBackgroundPaintedExtent(paintOffset, backgroundRect))
    14571458        return false;
     1459
     1460    if (hasLayer() && layer()->scrollingMayRevealBackground())
     1461        return false;
     1462
    14581463    return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurationTestMaxDepth);
    14591464}
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r224260 r224265  
    23872387        return;
    23882388    }
    2389    
     2389
    23902390    m_scrollPosition = newPosition;
    23912391
     
    59835983}
    59845984
     5985bool RenderLayer::scrollingMayRevealBackground() const
     5986{
     5987    return scrollsOverflow() || usesCompositedScrolling();
     5988}
     5989
    59855990bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
    59865991{
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r224260 r224265  
    676676    bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
    677677
     678    bool scrollingMayRevealBackground() const;
     679
    678680    bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayScrollbars; }
    679681    void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDirtyOverlayScrollbars = dirtyScrollbars; }
     
    884886
    885887    bool shouldBeNormalFlowOnly() const;
    886 
    887888    bool shouldBeSelfPaintingLayer() const;
    888889
Note: See TracChangeset for help on using the changeset viewer.