⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245465 in webkit


Ignore:
Timestamp:
May 17, 2019, 9:14:06 AM (7 years ago)
Author:
Antti Koivisto
Message:

[iOS] Respect scrolling="no" on composited frames
https://bugs.webkit.org/show_bug.cgi?id=197972
<rdar://problem/50252398>

Reviewed by Simon Fraser.

Source/WebKit:

  • UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
  • UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:

(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):

Disallow scrolling based on canHaveScrollbars, similar to main frame.

(WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):

Factor into a function.

LayoutTests:

  • fast/scrolling/ios/body-overflow-hidden-frame-expected.html:
  • fast/scrolling/ios/body-overflow-hidden-frame.html:

Also fix overflow:hidden test so that the frame content forces composition.

  • fast/scrolling/ios/frame-scrolling-no-expected.html: Added.
  • fast/scrolling/ios/frame-scrolling-no.html: Added.
Location:
trunk
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245429 r245465  
     12019-05-17  Antti Koivisto  <antti@apple.com>
     2
     3        [iOS] Respect scrolling="no" on composited frames
     4        https://bugs.webkit.org/show_bug.cgi?id=197972
     5        <rdar://problem/50252398>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/scrolling/ios/body-overflow-hidden-frame-expected.html:
     10        * fast/scrolling/ios/body-overflow-hidden-frame.html:
     11
     12        Also fix overflow:hidden test so that the frame content forces composition.
     13
     14        * fast/scrolling/ios/frame-scrolling-no-expected.html: Added.
     15        * fast/scrolling/ios/frame-scrolling-no.html: Added.
     16
    1172019-05-16  Greg Doolittle  <gr3g@apple.com>
    218
  • trunk/LayoutTests/fast/scrolling/ios/body-overflow-hidden-frame-expected.html

    r245006 r245465  
    1212    <style>
    1313    body { overflow: hidden }
    14     .scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
     14    .scroll-content { width: 500px; height: 5000px; border: 2px solid green; transform:translateZ(0) }
    1515    </style>
    1616    <body>
  • trunk/LayoutTests/fast/scrolling/ios/body-overflow-hidden-frame.html

    r245006 r245465  
    3333    <style>
    3434    body { overflow: hidden }
    35     .scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
     35    .scroll-content { width: 500px; height: 5000px; border: 2px solid green; transform:translateZ(0) }
    3636    </style>
    3737    <body>
  • trunk/LayoutTests/fast/scrolling/ios/frame-scrolling-no-expected.html

    r245464 r245465  
    77.scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
    88</style>
    9 <body onload="runTest()">
    10 <iframe srcdoc="
     9<body>
     10<iframe scrolling="no" srcdoc="
    1111    <html>
    1212    <style>
    13     body { overflow: hidden }
    14     .scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
     13    .scroll-content { width: 500px; height: 5000px; border: 2px solid green; transform:translateZ(0) }
    1514    </style>
    1615    <body>
  • trunk/LayoutTests/fast/scrolling/ios/frame-scrolling-no.html

    r245464 r245465  
    2929</script>
    3030<body onload="runTest()">
    31 <iframe srcdoc="
     31<iframe scrolling="no" srcdoc="
    3232    <html>
    3333    <style>
    34     body { overflow: hidden }
    35     .scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
     34    .scroll-content { width: 500px; height: 5000px; border: 2px solid green; transform:translateZ(0) }
    3635    </style>
    3736    <body>
  • trunk/Source/WebKit/ChangeLog

    r245462 r245465  
     12019-05-17  Antti Koivisto  <antti@apple.com>
     2
     3        [iOS] Respect scrolling="no" on composited frames
     4        https://bugs.webkit.org/show_bug.cgi?id=197972
     5        <rdar://problem/50252398>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
     10        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
     11        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
     12
     13        Disallow scrolling based on canHaveScrollbars, similar to main frame.
     14
     15        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
     16        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
     17
     18        Factor into a function.
     19
    1202019-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h

    r245134 r245465  
    3434
    3535OBJC_CLASS CALayer;
     36OBJC_CLASS UIScrollView;
    3637OBJC_CLASS WKScrollingNodeScrollViewDelegate;
    3738
     
    7475
    7576private:
     77    UIScrollView *scrollView() const;
     78
    7679    RetainPtr<CALayer> m_scrollLayer;
    7780    RetainPtr<CALayer> m_scrolledContentsLayer;
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm

    r245134 r245465  
    235235        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) {
    236236        BEGIN_BLOCK_OBJC_EXCEPTIONS
    237         UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
    238         ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
    239 
     237        UIScrollView *scrollView = this->scrollView();
    240238        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer)) {
    241239            if (!m_scrollViewDelegate)
     
    273271    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HorizontalSnapOffsets) || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::VerticalSnapOffsets)) {
    274272        BEGIN_BLOCK_OBJC_EXCEPTIONS
    275         UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
    276         ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
    277 
    278         scrollView.decelerationRate = scrollingNode().horizontalSnapOffsets().size() || scrollingNode().verticalSnapOffsets().size() ? UIScrollViewDecelerationRateFast : UIScrollViewDecelerationRateNormal;
    279 #endif
     273        scrollView().decelerationRate = scrollingNode().horizontalSnapOffsets().size() || scrollingNode().verticalSnapOffsets().size() ? UIScrollViewDecelerationRateFast : UIScrollViewDecelerationRateNormal;
    280274        END_BLOCK_OBJC_EXCEPTIONS
    281275    }
     276#endif
    282277
    283278    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaParams)) {
    284279        BEGIN_BLOCK_OBJC_EXCEPTIONS
    285         UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
    286         ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
     280        UIScrollView *scrollView = this->scrollView();
    287281
    288282        [scrollView setShowsHorizontalScrollIndicator:!scrollingNode().horizontalScrollbarHiddenByStyle()];
    289283        [scrollView setShowsVerticalScrollIndicator:!scrollingNode().verticalScrollbarHiddenByStyle()];
     284        [scrollView setScrollEnabled:scrollingNode().canHaveScrollbars()];
    290285
    291286        END_BLOCK_OBJC_EXCEPTIONS
     
    303298
    304299    BEGIN_BLOCK_OBJC_EXCEPTIONS
     300    [scrollView() setContentOffset:scrollPosition];
     301    END_BLOCK_OBJC_EXCEPTIONS
     302}
     303
     304void ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart() const
     305{
     306    scrollingTree().scrollingTreeNodeWillStartScroll();
     307}
     308
     309void ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd() const
     310{
     311    scrollingTree().scrollingTreeNodeDidEndScroll();
     312}
     313
     314void ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture() const
     315{
     316    scrollingTree().scrollingTreeNodeWillStartPanGesture();
     317}
     318
     319void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollPosition, bool inUserInteraction)
     320{
     321    if (m_updatingFromStateNode)
     322        return;
     323
     324    scrollingNode().wasScrolledByDelegatedScrolling(scrollPosition);
     325}
     326
     327void ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical) const
     328{
     329    if (m_updatingFromStateNode)
     330        return;
     331
     332    scrollingTree().currentSnapPointIndicesDidChange(scrollingNode().scrollingNodeID(), horizontal, vertical);
     333}
     334
     335UIScrollView *ScrollingTreeScrollingNodeDelegateIOS::scrollView() const
     336{
    305337    UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
    306338    ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
    307     [scrollView setContentOffset:scrollPosition];
    308     END_BLOCK_OBJC_EXCEPTIONS
    309 }
    310 
    311 void ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart() const
    312 {
    313     scrollingTree().scrollingTreeNodeWillStartScroll();
    314 }
    315 
    316 void ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd() const
    317 {
    318     scrollingTree().scrollingTreeNodeDidEndScroll();
    319 }
    320 
    321 void ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture() const
    322 {
    323     scrollingTree().scrollingTreeNodeWillStartPanGesture();
    324 }
    325 
    326 void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollPosition, bool inUserInteraction)
    327 {
    328     if (m_updatingFromStateNode)
    329         return;
    330 
    331     scrollingNode().wasScrolledByDelegatedScrolling(scrollPosition);
    332 }
    333 
    334 void ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical) const
    335 {
    336     if (m_updatingFromStateNode)
    337         return;
    338 
    339     scrollingTree().currentSnapPointIndicesDidChange(scrollingNode().scrollingNodeID(), horizontal, vertical);
     339    return scrollView;
    340340}
    341341
Note: See TracChangeset for help on using the changeset viewer.