[iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2016 00:20:27 +0000 (00:20 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2016 00:20:27 +0000 (00:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157496
Source/WebCore:

Reviewed by Tim Horton.

UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.

Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
user interaction on these views.

Test: fast/scrolling/ios/touch-scroll-visibility-hidden.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsVisibility): We have to tell the scrolling layer
if we have visibility:hidden.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::contentsHidden):
(PlatformCALayerCocoa::setContentsHidden):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterDescendants):

Source/WebKit2:

rdar://problem/22963278

Reviewed by Tim Horton.

UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.

Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
user interaction on these views.

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
* UIProcess/ios/RemoteLayerTreeHostIOS.mm:
(-[UIView _recursiveFindDescendantScrollViewAtPoint:withEvent:]): Our custom hit
test needs to take view.isUserInteractionEnabled into account.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setHidden):
(WebKit::PlatformCALayerRemote::contentsHidden):
(WebKit::PlatformCALayerRemote::setContentsHidden):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

Tools:

rdar://problem/22963278

Reviewed by Tim Horton.

Enhance UIScriptController to generate a drag, which is useful for scrolling.

* WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::dragFromPointToPoint):
* WebKitTestRunner/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator dragWithStartPoint:endPoint:duration:completionBlock:]):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::dragFromPointToPoint):

LayoutTests:

rdar://problem/22963278

Reviewed by Tim Horton.

Add a fast/scrolling/ios directory, disable it everywhere except on iOS.

* TestExpectations:
* fast/scrolling/ios/touch-scroll-visibility-hidden-expected.txt: Added.
* fast/scrolling/ios/touch-scroll-visibility-hidden.html: Added.
* platform/ios-simulator-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200602 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
Tools/ChangeLog
Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/ios/HIDEventGenerator.h
Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

index ec6c631..945cea4 100644 (file)
@@ -1,3 +1,18 @@
+2016-05-09  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=157496
+        rdar://problem/22963278
+
+        Reviewed by Tim Horton.
+        
+        Add a fast/scrolling/ios directory, disable it everywhere except on iOS.
+
+        * TestExpectations:
+        * fast/scrolling/ios/touch-scroll-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/ios/touch-scroll-visibility-hidden.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+
 2016-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Web Font is downloaded even when all the characters in the document are outside its unicode-range
index f3693c3..a52d195 100644 (file)
@@ -20,6 +20,7 @@ fast/zooming/ios [ Skip ]
 fast/viewport/ios [ Skip ]
 fast/events/ios [ Skip ]
 fast/events/touch/ios [ Skip ]
+fast/scrolling/ios [ Skip ]
 
 fast/forms/attributed-strings.html [ Skip ]
 fast/scrolling/latching [ Skip ]
diff --git a/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..6a48e53
--- /dev/null
@@ -0,0 +1,9 @@
+PASS hitElement.id is "under-target"
+PASS scroller.scrollTop is 0
+swipe complete
+PASS scroller.scrollTop is 0
+PASS document.scrollingElement.scrollTop is 90
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html b/LayoutTests/fast/scrolling/ios/touch-scroll-visibility-hidden.html
new file mode 100644 (file)
index 0000000..d22ce95
--- /dev/null
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0">
+    <style>
+        body {
+            margin: 0;
+            height: 2000px;
+        }
+        
+        .box {
+            height: 100px;
+            width: 100px;
+            background-color: blue;
+        }
+        
+        .outer {
+            position: absolute;
+            top: 0;
+        }
+        
+        .box:hover {
+            background-color: green;
+        }
+        
+        .container {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            height: 300px;
+            width: 300px;
+            overflow: scroll;
+            -webkit-overflow-scrolling: touch;
+            border: 1px solid black;
+            visibility: hidden;
+        }
+        
+        .content {
+            height: 600px;
+        }
+    </style>
+    <script src="../../../resources/js-test-pre.js"></script>
+    <script>
+        window.jsTestIsAsync = true;
+
+        function getUIScript()
+        {
+            return `
+            (function() {
+                uiController.dragFromPointToPoint(60, 200, 60, 100, 0.5, function() {
+                    uiController.uiScriptComplete("");
+                });
+            })();`
+        }
+
+        var hitElement;
+        function runTest()
+        {
+            hitElement = document.elementFromPoint(20, 20);
+            shouldBeEqualToString("hitElement.id", "under-target");
+            
+            var scroller = document.getElementById('scroller');
+            shouldBe("scroller.scrollTop", "0");
+
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getUIScript(), function() {
+                    debug("swipe complete");
+                    shouldBe("scroller.scrollTop", "0");
+                    shouldBe("document.scrollingElement.scrollTop", "90");
+                    finishJSTest();
+                });
+            }
+        }
+        window.addEventListener('load', runTest, false);
+    </script>
+</head>
+<body onscroll="debug('body scroll')">
+<div class="outer box" id="under-target">
+</div>
+
+<div id="scroller" class="container" onscroll="debug('overflow scroll')">
+    <div class="content">
+        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+        <div class="inner box" style="visibility: visible">
+        </div>
+    </div>
+</div>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
index 3642545..c8fd3e6 100644 (file)
@@ -9,6 +9,7 @@
 fast/harness/ui-side-scripts.html [ Pass ]
 fast/harness/concurrent-ui-side-scripts.html [ Pass ]
 fast/zooming/ios [ Pass ]
+fast/scrolling/ios [ Pass ]
 
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
index eda32ff..7c4081f 100644 (file)
@@ -1,3 +1,29 @@
+2016-05-09  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=157496
+
+        Reviewed by Tim Horton.
+
+        UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
+        with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.
+
+        Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
+        user interaction on these views.
+
+        Test: fast/scrolling/ios/touch-scroll-visibility-hidden.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateContentsVisibility): We have to tell the scrolling layer
+        if we have visibility:hidden.
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::contentsHidden):
+        (PlatformCALayerCocoa::setContentsHidden):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateAfterDescendants):
+
 2016-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Web Font is downloaded even when all the characters in the document are outside its unicode-range
index 6a62827..cde0409 100644 (file)
@@ -1877,6 +1877,8 @@ void GraphicsLayerCA::updateContentsVisibility()
         if (m_backdropLayer)
             m_backdropLayer->setHidden(true);
     }
+
+    m_layer->setContentsHidden(!m_contentsVisible);
 }
 
 void GraphicsLayerCA::updateContentsOpaque(float pageScaleFactor)
index 970fc00..9d8ed12 100644 (file)
@@ -158,6 +158,9 @@ public:
     virtual bool isHidden() const = 0;
     virtual void setHidden(bool) = 0;
 
+    virtual bool contentsHidden() const = 0;
+    virtual void setContentsHidden(bool) = 0;
+
     virtual bool geometryFlipped() const = 0;
     virtual void setGeometryFlipped(bool) = 0;
 
index c5ca0dd..272d150 100644 (file)
@@ -90,6 +90,9 @@ public:
     bool isHidden() const override;
     void setHidden(bool) override;
 
+    bool contentsHidden() const override;
+    void setContentsHidden(bool) override;
+
     void setBackingStoreAttached(bool) override;
     bool backingStoreAttached() const override;
 
index a05f4d2..3039207 100644 (file)
@@ -616,6 +616,17 @@ void PlatformCALayerCocoa::setHidden(bool value)
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
+bool PlatformCALayerCocoa::contentsHidden() const
+{
+    // Used to disable user interaction for some platforms.
+    return true;
+}
+
+void PlatformCALayerCocoa::setContentsHidden(bool)
+{
+    // Used to disable user interaction for some platforms.
+}
+
 void PlatformCALayerCocoa::setBackingStoreAttached(bool)
 {
     // We could throw away backing store here with setContents:nil.
index 9efcc4c..1c320b3 100644 (file)
@@ -1066,6 +1066,8 @@ void RenderLayerBacking::updateAfterDescendants()
     updateDrawsContent(isSimpleContainer);
 
     m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendantLayers());
+    if (m_scrollingLayer)
+        m_scrollingLayer->setContentsVisible(renderer().style().visibility() == VISIBLE);
 }
 
 // FIXME: Avoid repaints when clip path changes.
index 388ae9d..77b5398 100644 (file)
@@ -1,3 +1,34 @@
+2016-05-09  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=157496
+        rdar://problem/22963278
+
+        Reviewed by Tim Horton.
+
+        UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
+        with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.
+
+        Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
+        user interaction on these views.
+
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::dumpChangedLayers):
+        * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
+        (-[UIView _recursiveFindDescendantScrollViewAtPoint:withEvent:]): Our custom hit
+        test needs to take view.isUserInteractionEnabled into account.
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::setHidden):
+        (WebKit::PlatformCALayerRemote::contentsHidden):
+        (WebKit::PlatformCALayerRemote::setContentsHidden):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
 2016-05-09  Ada Chan  <adachan@apple.com>
 
         Introduce WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen() and use it in WebVideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen()
index 44c725c..c218fbd 100644 (file)
@@ -312,7 +312,6 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr
     }
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) {
-
         CALayer *maskOwnerLayer = view.layer;
 
         if (properties.customAppearance == GraphicsLayer::LightBackdropAppearance || properties.customAppearance == GraphicsLayer::DarkBackdropAppearance) {
@@ -332,6 +331,10 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr
                 maskOwnerLayer.mask = maskView.layer;
         }
     }
+    
+    if (properties.changedProperties & RemoteLayerTreeTransaction::ContentsHiddenChanged)
+        view.userInteractionEnabled = !properties.contentsHidden;
+
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 #endif
index 4e99acd..a225dc3 100644 (file)
@@ -69,25 +69,26 @@ public:
         DoubleSidedChanged              = 1LLU << 14,
         MasksToBoundsChanged            = 1LLU << 15,
         OpaqueChanged                   = 1LLU << 16,
-        MaskLayerChanged                = 1LLU << 17,
-        ClonedContentsChanged           = 1LLU << 18,
-        ContentsRectChanged             = 1LLU << 19,
-        ContentsScaleChanged            = 1LLU << 20,
-        CornerRadiusChanged             = 1LLU << 21,
-        ShapeRoundedRectChanged         = 1LLU << 22,
-        ShapePathChanged                = 1LLU << 23,
-        MinificationFilterChanged       = 1LLU << 24,
-        MagnificationFilterChanged      = 1LLU << 25,
-        BlendModeChanged                = 1LLU << 26,
-        WindRuleChanged                 = 1LLU << 27,
-        SpeedChanged                    = 1LLU << 28,
-        TimeOffsetChanged               = 1LLU << 29,
-        BackingStoreChanged             = 1LLU << 30,
-        BackingStoreAttachmentChanged   = 1LLU << 31,
-        FiltersChanged                  = 1LLU << 32,
-        AnimationsChanged               = 1LLU << 33,
-        EdgeAntialiasingMaskChanged     = 1LLU << 34,
-        CustomAppearanceChanged         = 1LLU << 35,
+        ContentsHiddenChanged           = 1LLU << 17,
+        MaskLayerChanged                = 1LLU << 18,
+        ClonedContentsChanged           = 1LLU << 19,
+        ContentsRectChanged             = 1LLU << 20,
+        ContentsScaleChanged            = 1LLU << 21,
+        CornerRadiusChanged             = 1LLU << 22,
+        ShapeRoundedRectChanged         = 1LLU << 23,
+        ShapePathChanged                = 1LLU << 24,
+        MinificationFilterChanged       = 1LLU << 25,
+        MagnificationFilterChanged      = 1LLU << 26,
+        BlendModeChanged                = 1LLU << 27,
+        WindRuleChanged                 = 1LLU << 28,
+        SpeedChanged                    = 1LLU << 29,
+        TimeOffsetChanged               = 1LLU << 30,
+        BackingStoreChanged             = 1LLU << 31,
+        BackingStoreAttachmentChanged   = 1LLU << 32,
+        FiltersChanged                  = 1LLU << 33,
+        AnimationsChanged               = 1LLU << 34,
+        EdgeAntialiasingMaskChanged     = 1LLU << 35,
+        CustomAppearanceChanged         = 1LLU << 36,
     };
     typedef uint64_t LayerChange;
 
@@ -164,6 +165,7 @@ public:
         bool doubleSided;
         bool masksToBounds;
         bool opaque;
+        bool contentsHidden;
     };
 
     explicit RemoteLayerTreeTransaction();
index 73d734b..ac70cbc 100644 (file)
@@ -103,6 +103,7 @@ RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
     , doubleSided(true)
     , masksToBounds(false)
     , opaque(false)
+    , contentsHidden(false)
 {
 }
 
@@ -140,6 +141,7 @@ RemoteLayerTreeTransaction::LayerProperties::LayerProperties(const LayerProperti
     , doubleSided(other.doubleSided)
     , masksToBounds(other.masksToBounds)
     , opaque(other.opaque)
+    , contentsHidden(other.contentsHidden)
 {
     // FIXME: LayerProperties should reference backing store by ID, so that two layers can have the same backing store (for clones).
     // FIXME: LayerProperties shouldn't be copyable; PlatformCALayerRemote::clone should copy the relevant properties.
@@ -211,6 +213,9 @@ void RemoteLayerTreeTransaction::LayerProperties::encode(IPC::ArgumentEncoder& e
     if (changedProperties & OpaqueChanged)
         encoder << opaque;
 
+    if (changedProperties & ContentsHiddenChanged)
+        encoder << contentsHidden;
+
     if (changedProperties & MaskLayerChanged)
         encoder << maskLayerID;
 
@@ -374,6 +379,11 @@ bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::ArgumentDecoder& d
             return false;
     }
 
+    if (result.changedProperties & ContentsHiddenChanged) {
+        if (!decoder.decode(result.contentsHidden))
+            return false;
+    }
+
     if (result.changedProperties & MaskLayerChanged) {
         if (!decoder.decode(result.maskLayerID))
             return false;
@@ -742,6 +752,9 @@ static void dumpChangedLayers(TextStream& ts, const RemoteLayerTreeTransaction::
         if (layerProperties.changedProperties & RemoteLayerTreeTransaction::OpaqueChanged)
             ts.dumpProperty("opaque", layerProperties.opaque);
 
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsHiddenChanged)
+            ts.dumpProperty("contentsHidden", layerProperties.contentsHidden);
+
         if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged)
             ts.dumpProperty("maskLayer", layerProperties.maskLayerID);
 
index 13064a6..367ac13 100644 (file)
@@ -60,7 +60,7 @@ using namespace WebCore;
     [[self subviews] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
         CGPoint subviewPoint = [view convertPoint:point fromView:self];
 
-        if ([view pointInside:subviewPoint withEvent:event] && [view isKindOfClass:[UIScrollView class]])
+        if ([view pointInside:subviewPoint withEvent:event] && [view isKindOfClass:[UIScrollView class]] && view.isUserInteractionEnabled)
             foundView = view;
 
         if (![view subviews])
index f4a87ba..aab764d 100644 (file)
@@ -503,10 +503,27 @@ bool PlatformCALayerRemote::isHidden() const
 
 void PlatformCALayerRemote::setHidden(bool value)
 {
+    if (m_properties.hidden == value)
+        return;
+
     m_properties.hidden = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::HiddenChanged);
 }
 
+bool PlatformCALayerRemote::contentsHidden() const
+{
+    return m_properties.contentsHidden;
+}
+
+void PlatformCALayerRemote::setContentsHidden(bool value)
+{
+    if (m_properties.contentsHidden == value)
+        return;
+
+    m_properties.contentsHidden = value;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsHiddenChanged);
+}
+
 void PlatformCALayerRemote::setBackingStoreAttached(bool value)
 {
     if (m_properties.backingStoreAttached == value)
index 0a463ba..aa1f224 100644 (file)
@@ -94,6 +94,9 @@ public:
     bool isHidden() const override;
     void setHidden(bool) override;
 
+    bool contentsHidden() const override;
+    void setContentsHidden(bool) override;
+
     void setBackingStoreAttached(bool) override;
     bool backingStoreAttached() const override;
     bool backingContributesToMemoryEstimate() const override { return backingStoreAttached(); }
index 92ef4e2..6f5ad13 100644 (file)
@@ -1,5 +1,25 @@
 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
 
+        [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=157496
+        rdar://problem/22963278
+
+        Reviewed by Tim Horton.
+
+        Enhance UIScriptController to generate a drag, which is useful for scrolling.
+
+        * WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
+        * WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::dragFromPointToPoint):
+        * WebKitTestRunner/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/HIDEventGenerator.h:
+        * WebKitTestRunner/ios/HIDEventGenerator.mm:
+        (-[HIDEventGenerator dragWithStartPoint:endPoint:duration:completionBlock:]):
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::dragFromPointToPoint):
+
+2016-05-09  Simon Fraser  <simon.fraser@apple.com>
+
         Remove testRunner.setTextAutosizingEnabled and migrate the one test that uses it
         https://bugs.webkit.org/show_bug.cgi?id=157480
 
index 53e9c8a..fab4641 100644 (file)
@@ -36,6 +36,7 @@ interface UIScriptController {
     void liftUpAtPoint(long x, long y, long touchCount, object callback);
     void singleTapAtPoint(long x, long y, object callback);
     void doubleTapAtPoint(long x, long y, object callback);
+    void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, object callback);
 
     void typeCharacterUsingHardwareKeyboard(DOMString character, object callback);
     void keyDownUsingHardwareKeyboard(DOMString character, object callback);
index 6582402..2a8f4cd 100644 (file)
@@ -134,6 +134,10 @@ void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef)
 {
 }
 
+void UIScriptController::dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback)
+{
+}
+
 void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef, JSValueRef)
 {
 }
index 8e958c9..514b5f0 100644 (file)
@@ -51,6 +51,7 @@ public:
     void liftUpAtPoint(long x, long y, long touchCount, JSValueRef callback);
     void singleTapAtPoint(long x, long y, JSValueRef callback);
     void doubleTapAtPoint(long x, long y, JSValueRef callback);
+    void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback);
     
     void typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback);
     void keyDownUsingHardwareKeyboard(JSStringRef character, JSValueRef callback);
index 1da00ae..96bf7f5 100644 (file)
@@ -32,9 +32,6 @@
 + (HIDEventGenerator *)sharedHIDEventGenerator;
 
 // Touches
-- (void)touchDown:(CGPoint)location;
-- (void)liftUp:(CGPoint)location;
-- (void)moveToPoints:(CGPoint*)locations touchCount:(NSUInteger)count duration:(NSTimeInterval)seconds;
 - (void)touchDown:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
 - (void)liftUp:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
 
index 294f36b..5cd33c7 100644 (file)
@@ -415,6 +415,10 @@ static void delayBetweenMove(int eventIndex, double elapsed)
 
 - (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock
 {
+    [self touchDown:startLocation touchCount:1];
+    [self moveToPoints:&endLocation touchCount:1 duration:seconds];
+    [self liftUp:endLocation];
+    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
 }
 
 - (void)pinchCloseWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock
index a0a60ad..b5a4116 100644 (file)
@@ -125,6 +125,20 @@ void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef callback)
     }];
 }
 
+void UIScriptController::dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    CGPoint startPoint = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), startX, startY);
+    CGPoint endPoint = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), endX, endY);
+    
+    [[HIDEventGenerator sharedHIDEventGenerator] dragWithStartPoint:startPoint endPoint:endPoint duration:durationSeconds completionBlock:^{
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    }];
+}
+
 void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback)
 {
     unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);