Title: [216145] trunk
Revision
216145
Author
[email protected]
Date
2017-05-03 15:04:18 -0700 (Wed, 03 May 2017)

Log Message

Have WKWebView call _updateVisibleContentRects for the current transaction if possible, rather than always delaying
https://bugs.webkit.org/show_bug.cgi?id=171619
Source/WebKit2:

Also fixes webkit.org/b/170153 and webkit.org/b/170195

Reviewed by Tim Horton.

In r214391 we started adding the pre-commit handler in a dispatch_async() to ensure that
the handler would always run, since we couldn't reliably test the phase of the current
transaction. Now that problem has been solved (rdar://problem/31253952) we can go back to
checking the transaction phase on newer iOS versions. If we're too late for the current transaction
we still need to dispatch_async() to get into the next one.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
(-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):

Tools:

https://bugs.webkit.org/show_bug.cgi?id=170195

Reviewed by Tim Horton.

Re-enable WebKit2.ResizeWithHiddenContentDoesNotHang.

* TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm:
(TEST):

LayoutTests:

https://bugs.webkit.org/show_bug.cgi?id=170153

Reviewed by Tim Horton.

These tests need to wait a bit for the scrolling state of the document to be updated.

* fast/scrolling/ios/touch-scroll-pointer-events-none.html:
* fast/scrolling/ios/touch-scroll-visibility-hidden.html:
* platform/ios-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216144 => 216145)


--- trunk/LayoutTests/ChangeLog	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/LayoutTests/ChangeLog	2017-05-03 22:04:18 UTC (rev 216145)
@@ -1,3 +1,17 @@
+2017-05-03  Simon Fraser  <[email protected]>
+
+        Have WKWebView call _updateVisibleContentRects for the current transaction if possible, rather than always delaying
+        https://bugs.webkit.org/show_bug.cgi?id=171619
+        https://bugs.webkit.org/show_bug.cgi?id=170153
+
+        Reviewed by Tim Horton.
+
+        These tests need to wait a bit for the scrolling state of the document to be updated.
+
+        * fast/scrolling/ios/touch-scroll-pointer-events-none.html:
+        * fast/scrolling/ios/touch-scroll-visibility-hidden.html:
+        * platform/ios-wk2/TestExpectations:
+
 2017-05-03  Yoav Weiss  <[email protected]>
 
         Link preload HTMLPreloadScanner support

Modified: trunk/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html (216144 => 216145)


--- trunk/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html	2017-05-03 22:04:18 UTC (rev 216145)
@@ -66,10 +66,12 @@
 
             if (testRunner.runUIScript) {
                 testRunner.runUIScript(getUIScript(), function() {
-                    debug("swipe complete");
-                    shouldBe("scroller.scrollTop", "0");
-                    shouldBe("document.scrollingElement.scrollTop", "90");
-                    finishJSTest();
+                    setTimeout(function() {
+                        debug("swipe complete");
+                        shouldBe("scroller.scrollTop", "0");
+                        shouldBe("document.scrollingElement.scrollTop", "90");
+                        finishJSTest();
+                    }, 0);
                 });
             }
         }

Modified: trunk/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html (216144 => 216145)


--- trunk/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html	2017-05-03 22:04:18 UTC (rev 216145)
@@ -66,10 +66,12 @@
 
             if (testRunner.runUIScript) {
                 testRunner.runUIScript(getUIScript(), function() {
-                    debug("swipe complete");
-                    shouldBe("scroller.scrollTop", "0");
-                    shouldBe("document.scrollingElement.scrollTop", "90");
-                    finishJSTest();
+                    setTimeout(function() {
+                        debug("swipe complete");
+                        shouldBe("scroller.scrollTop", "0");
+                        shouldBe("document.scrollingElement.scrollTop", "90");
+                        finishJSTest();
+                    }, 0);
                 });
             }
         }

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (216144 => 216145)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2017-05-03 22:04:18 UTC (rev 216145)
@@ -1940,9 +1940,6 @@
 
 webkit.org/b/169558 fast/history/ios/history-scroll-restoration.html [ Pass Failure ]
 
-webkit.org/b/170153 fast/scrolling/ios/touch-scroll-pointer-events-none.html [ Failure ]
-webkit.org/b/170153 fast/scrolling/ios/touch-scroll-visibility-hidden.html [ Failure ]
-
 webkit.org/b/169719 fast/mediacapturefromelement/CanvasCaptureMediaStream-request-frame-events.html [ Pass Failure ]
 
 webkit.org/b/171301 [ Release ] http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html [ Pass Timeout ]

Modified: trunk/Source/WebKit2/ChangeLog (216144 => 216145)


--- trunk/Source/WebKit2/ChangeLog	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/Source/WebKit2/ChangeLog	2017-05-03 22:04:18 UTC (rev 216145)
@@ -1,3 +1,22 @@
+2017-05-03  Simon Fraser  <[email protected]>
+
+        Have WKWebView call _updateVisibleContentRects for the current transaction if possible, rather than always delaying
+        https://bugs.webkit.org/show_bug.cgi?id=171619
+        
+        Also fixes webkit.org/b/170153 and webkit.org/b/170195
+
+        Reviewed by Tim Horton.
+
+        In r214391 we started adding the pre-commit handler in a dispatch_async() to ensure that
+        the handler would always run, since we couldn't reliably test the phase of the current
+        transaction. Now that problem has been solved (rdar://problem/31253952) we can go back to
+        checking the transaction phase on newer iOS versions. If we're too late for the current transaction
+        we still need to dispatch_async() to get into the next one.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
+        (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+
 2017-05-03  Chris Dumez  <[email protected]>
 
         REGRESSION (r216129): ASSERTION FAILED: m_process->state() == WebProcessProxy::State::Terminated

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (216144 => 216145)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-05-03 22:04:18 UTC (rev 216145)
@@ -2311,6 +2311,16 @@
     return isStableState;
 }
 
+- (void)_addUpdateVisibleContentRectPreCommitHandler
+{
+    auto retainedSelf = retainPtr(self);
+    [CATransaction addCommitHandler:[retainedSelf] {
+        WKWebView *webView = retainedSelf.get();
+        [webView _updateVisibleContentRects];
+        webView->_hasScheduledVisibleRectUpdate = NO;
+    } forPhase:kCATransactionPhasePreCommit];
+}
+
 - (void)_scheduleVisibleContentRectUpdateAfterScrollInView:(UIScrollView *)scrollView
 {
     _visibleContentRectUpdateScheduledFromScrollViewInStableState = [self _scrollViewIsInStableState:scrollView];
@@ -2320,13 +2330,17 @@
 
     _hasScheduledVisibleRectUpdate = YES;
     
-    // FIXME: remove the dispatch_async() when we have a fix for rdar://problem/31253952.
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+    CATransactionPhase transactionPhase = [CATransaction currentPhase];
+    if (transactionPhase == kCATransactionPhaseNull || transactionPhase == kCATransactionPhasePreLayout) {
+        [self _addUpdateVisibleContentRectPreCommitHandler];
+        return;
+    }
+#endif
+
     dispatch_async(dispatch_get_main_queue(), [retainedSelf = retainPtr(self)] {
-        [CATransaction addCommitHandler:[retainedSelf] {
-            WKWebView *webView = retainedSelf.get();
-            [webView _updateVisibleContentRects];
-            webView->_hasScheduledVisibleRectUpdate = NO;
-        } forPhase:kCATransactionPhasePreCommit];
+        WKWebView *webView = retainedSelf.get();
+        [webView _addUpdateVisibleContentRectPreCommitHandler];
     });
 }
 

Modified: trunk/Tools/ChangeLog (216144 => 216145)


--- trunk/Tools/ChangeLog	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/Tools/ChangeLog	2017-05-03 22:04:18 UTC (rev 216145)
@@ -1,3 +1,16 @@
+2017-05-03  Simon Fraser  <[email protected]>
+
+        Have WKWebView call _updateVisibleContentRects for the current transaction if possible, rather than always delaying
+        https://bugs.webkit.org/show_bug.cgi?id=171619
+        https://bugs.webkit.org/show_bug.cgi?id=170195
+
+        Reviewed by Tim Horton.
+
+        Re-enable WebKit2.ResizeWithHiddenContentDoesNotHang.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm:
+        (TEST):
+
 2017-05-03  Michael Catanzaro  <[email protected]>
 
         YouTube user agent quirk breaks new YouTube

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm (216144 => 216145)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm	2017-05-03 21:56:33 UTC (rev 216144)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm	2017-05-03 22:04:18 UTC (rev 216145)
@@ -82,7 +82,7 @@
     return navigationDelegate;
 }
 
-TEST(WebKit2, DISABLED_ResizeWithHiddenContentDoesNotHang)
+TEST(WebKit2, ResizeWithHiddenContentDoesNotHang)
 {
     auto webView = createAnimatedResizeWebView();
     auto navigationDelegate = createFirstVisuallyNonEmptyWatchingNavigationDelegate();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to