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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@216145 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 93be7ec..7ace5e0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2017-05-03  Simon Fraser  <simon.fraser@apple.com>
+
+        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  <yoav@yoav.ws>
 
         Link preload HTMLPreloadScanner support
diff --git a/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html b/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html
index 5cc4561..331b3aa 100644
--- a/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html
+++ b/LayoutTests/fast/scrolling/ios/touch-scroll-pointer-events-none.html
@@ -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);
                 });
             }
         }
diff --git a/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html b/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html
index 7692188..9817be6 100644
--- a/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html
+++ b/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html
@@ -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);
                 });
             }
         }
diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations
index 7bbf018..1f0a299 100644
--- a/LayoutTests/platform/ios-wk2/TestExpectations
+++ b/LayoutTests/platform/ios-wk2/TestExpectations
@@ -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 ]