WebKit Bugzilla
Attachment 362576 Details for
Bug 194886
: Make programmatic frame scrolling work on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
programmatic-frame-scroll-ios.patch (text/plain), 10.64 KB, created by
Antti Koivisto
on 2019-02-20 17:26:13 PST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2019-02-20 17:26:13 PST
Size:
10.64 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 241854) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,21 @@ >+2019-02-20 Antti Koivisto <antti@apple.com> >+ >+ Make programmatic frame scrolling work on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=194886 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: >+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): >+ >+ Don't move based on the layout scroll position. This just overrides the user scroll position. >+ Remove ScrolledContentsLayer checks, we only need to deal with the ScrollContainerLayer here. >+ >+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): >+ >+ Scroll the UIScrollView correctly. This is called as a result of setting the RequestedScrollPosition property. >+ Remove scroll origin code, it doesn't look correct (and is untested). >+ > 2019-02-20 Chris Dumez <cdumez@apple.com> > > Unreviewed build fix after r241823. >Index: Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (revision 241841) >+++ Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (working copy) >@@ -223,7 +223,6 @@ void ScrollingTreeScrollingNodeDelegateI > { > SetForScope<bool> updatingChange(m_updatingFromStateNode, true); > if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer) >- || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) >@@ -232,8 +231,7 @@ void ScrollingTreeScrollingNodeDelegateI > UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]; > ASSERT([scrollView isKindOfClass:[UIScrollView self]]); > >- if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer) >- || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)) { >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer)) { > if (!m_scrollViewDelegate) > m_scrollViewDelegate = adoptNS([[WKScrollingNodeScrollViewDelegate alloc] initWithScrollingTreeNodeDelegate:this]); > >@@ -247,12 +245,8 @@ void ScrollingTreeScrollingNodeDelegateI > recomputeInsets = true; > } > >- if ((scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) >- || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) >- && ![m_scrollViewDelegate _isInUserInteraction]) { >- scrollView.contentOffset = scrollingStateNode.scrollPosition() + scrollOrigin(); >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) > recomputeInsets = true; >- } > > if (recomputeInsets) { > UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0); >@@ -297,7 +291,12 @@ FloatPoint ScrollingTreeScrollingNodeDel > > void ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition(const FloatPoint& scrollPosition) > { >- [m_scrollLayer setPosition:CGPointMake(scrollPosition.x() + scrollOrigin().x(), scrollPosition.y() + scrollOrigin().y())]; >+ BEGIN_BLOCK_OBJC_EXCEPTIONS >+ UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]; >+ ASSERT([scrollView isKindOfClass:[UIScrollView self]]); >+ [scrollView setContentOffset:scrollPosition]; >+ END_BLOCK_OBJC_EXCEPTIONS >+ > updateChildNodesAfterScroll(scrollPosition); > } > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 241841) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-02-20 Antti Koivisto <antti@apple.com> >+ >+ Make programmatic frame scrolling work on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=194886 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test by Frederic Wang. >+ >+ * fast/scrolling/ios/programmatic-scroll-iframe-expected.html: Added. >+ * fast/scrolling/ios/programmatic-scroll-iframe.html: Added. >+ > 2019-02-20 Said Abou-Hallawa <sabouhallawa@apple.com> > > drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy" >Index: LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe-expected.html >=================================================================== >--- LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe-expected.html (nonexistent) >+++ LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe-expected.html (working copy) >@@ -0,0 +1,12 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <title>Programmatic scrolling of iframe</title> >+ <meta name="viewport" content="width=device-width, initial-scale=1"> >+ </head> >+ <body> >+ <p>This test passes if you see a green rectangle.</p> >+ <div style="position: absolute; top: 3em; width: 300px; height: 400px; background: green;"> >+ </div> >+ </body> >+</html> >Index: LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe.html >=================================================================== >--- LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe.html (nonexistent) >+++ LayoutTests/fast/scrolling/ios/programmatic-scroll-iframe.html (working copy) >@@ -0,0 +1,98 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <title>Programmatic scrolling of iframe</title> >+ <meta name="viewport" content="width=device-width, initial-scale=1"> >+ <script> >+ if (window.testRunner) >+ testRunner.waitUntilDone(); >+ if (window.internals) >+ internals.settings.setAsyncFrameScrollingEnabled(true); >+ >+ function runTest() { >+ // This checks scrolling to the location of the green square. >+ document.getElementById("doNotScroll").contentWindow.window.scrollTo(0, 0); >+ document.getElementById("maxScrollX").contentWindow.window.scrollTo(100, 0); >+ document.getElementById("maxScrollY").contentWindow.window.scrollTo(0, 100); >+ document.getElementById("maxScrollXY").contentWindow.window.scrollTo(100, 100); >+ document.getElementById("scrollMiddle").contentWindow.window.scrollTo(50, 50); >+ >+ // This checks scrolling outside the limit of the frame. >+ document.getElementById("scrollBelowXLimit").contentWindow.window.scrollBy(-100, 0); >+ document.getElementById("scrollAboveXLimit").contentWindow.window.scrollBy(200, 0); >+ document.getElementById("scrollBelowYLimit").contentWindow.window.scrollBy(0, -100); >+ document.getElementById("scrollAboveYLimit").contentWindow.window.scrollBy(0, 200); >+ >+ if (window.testRunner) >+ testRunner.notifyDone(); >+ } >+ >+ var frameToLoadCount = 9; >+ function newFrameLoaded() { >+ frameToLoadCount--; >+ if (frameToLoadCount == 0) >+ runTest(); >+ } >+ </script> >+ <style> >+ iframe { >+ float: left; >+ background: linear-gradient(135deg, red, orange); >+ border: 0; >+ height: 100px; >+ width: 100px; >+ overflow: none; >+ } >+ </style> >+ </head> >+ <body> >+ <p>This test passes if you see a green rectangle.</p> >+ <div style="position: absolute; top: 3em; width: 300px; height: 400px; background: green;"> >+ <iframe id="doNotScroll" style="left: 0px; top: 0px;" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='position: absolute; width: 100px; height: 100px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="maxScrollX" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='left: 100px; position: absolute; width: 100px; height: 100px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="maxScrollY" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='top: 100px; position: absolute; width: 100px; height: 100px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="maxScrollXY" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='left: 100px; top: 100px; position: absolute; width: 100px; height: 100px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="scrollMiddle" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='left: 50px; top: 50px; position: absolute; width: 100px; height: 100px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="scrollBelowXLimit" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='position: absolute; width: 200px; height: 200px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="scrollAboveXLimit" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='position: absolute; width: 200px; height: 200px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="scrollBelowYLimit" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='position: absolute; width: 200px; height: 200px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ <iframe id="scrollAboveYLimit" scrolling="yes" srcdoc=" >+ <body style='margin: 0; width: 200px; height: 200px'> >+ <div style='position: absolute; width: 200px; height: 200px; background: green;'></div> >+ </body>" onload="newFrameLoaded()"> >+ </iframe> >+ </div> >+ </body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194886
: 362576