Title: [191452] trunk
Revision
191452
Author
wenson_hs...@apple.com
Date
2015-10-22 06:54:55 -0700 (Thu, 22 Oct 2015)

Log Message

Implement touch-action: manipulation; for iOS
https://bugs.webkit.org/show_bug.cgi?id=149854
<rdar://problem/23017145>

Reviewed by Benjamin Poulain.

Source/WebCore:

Implements the manipulation value for the CSS property touch-action. Adds support for
parsing the touch-action property and two of its values: auto and manipulation.

Tests: css3/touch-action/touch-action-computed-style.html
       css3/touch-action/touch-action-manipulation-fast-clicks.html
       css3/touch-action/touch-action-parsing.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TouchAction):
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* dom/Element.cpp:
(WebCore::Element::allowsDoubleTapGesture): Here, we determine whether an element that resulted from
    hit-testing a touch should allow double-tap gestures. To do this, we walk up the element's parents,
    stopping when we detect an element that disallows double tap gestures by having a touch-action other
    than auto or by hitting the root node.
* dom/Element.h:
* dom/Node.h:
(WebCore::Node::allowsDoubleTapGesture):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

Source/WebKit2:

Implements the manipulation value for the CSS property touch-action. Performs hit-testing upon receiving a potential
tap to determine whether to disable double-tap gesture recognition over the duration of the tap. If so, sends a message
from the web process to the UI process indicating that double-tapping should be disabled, allowing single taps to
avoid the delay.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::potentialTapAtPosition):

LayoutTests:

Add tests to check that the manipulation and auto values of the touch-action property can be
properly parsed and can be obtained through computed style. Also tests that putting touch-action:
manipulation on an element and tapping repeatedly on it will fire clicks instead of recognizing
double taps and causing the viewport to zoom.

* TestExpectations:
* css3/touch-action/touch-action-computed-style-expected.txt: Added.
* css3/touch-action/touch-action-computed-style.html: Added.
* css3/touch-action/touch-action-manipulation-fast-clicks-expected.txt: Added.
* css3/touch-action/touch-action-manipulation-fast-clicks.html: Added.
* css3/touch-action/touch-action-parsing-expected.txt: Added.
* css3/touch-action/touch-action-parsing.html: Added.
* platform/ios-simulator-wk2/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191451 => 191452)


--- trunk/LayoutTests/ChangeLog	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/LayoutTests/ChangeLog	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1,3 +1,25 @@
+2015-10-22  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Implement touch-action: manipulation; for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=149854
+        <rdar://problem/23017145>
+
+        Reviewed by Benjamin Poulain.
+
+        Add tests to check that the manipulation and auto values of the touch-action property can be
+        properly parsed and can be obtained through computed style. Also tests that putting touch-action:
+        manipulation on an element and tapping repeatedly on it will fire clicks instead of recognizing
+        double taps and causing the viewport to zoom.
+
+        * TestExpectations:
+        * css3/touch-action/touch-action-computed-style-expected.txt: Added.
+        * css3/touch-action/touch-action-computed-style.html: Added.
+        * css3/touch-action/touch-action-manipulation-fast-clicks-expected.txt: Added.
+        * css3/touch-action/touch-action-manipulation-fast-clicks.html: Added.
+        * css3/touch-action/touch-action-parsing-expected.txt: Added.
+        * css3/touch-action/touch-action-parsing.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+
 2015-10-22  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [Streams API] Add writable stream attributes

Modified: trunk/LayoutTests/TestExpectations (191451 => 191452)


--- trunk/LayoutTests/TestExpectations	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/LayoutTests/TestExpectations	2015-10-22 13:54:55 UTC (rev 191452)
@@ -6,6 +6,7 @@
 # Platform-specific tests. Skipped here, then re-enabled on the appropriate platform.
 #//////////////////////////////////////////////////////////////////////////////////////////
 
+css3/touch-action [ Skip ]
 accessibility/ios-simulator [ Skip ]
 accessibility/gtk [ Skip ]
 accessibility/mac [ Skip ]

Added: trunk/LayoutTests/css3/touch-action/touch-action-computed-style-expected.txt (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-computed-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-computed-style-expected.txt	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,22 @@
+Testing touch-action: manipulation;
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'manipulation'
+Testing touch-action: auto;
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'auto'
+Testing a bogus value
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'auto'
+Testing all caps
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'manipulation'
+Testing weird casing
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'auto'
+Testing !important (auto)
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'auto'
+Testing !important (manipulation)
+PASS window.getComputedStyle(document.body).getPropertyValue('touch-action') is 'manipulation'
+Testing non-inheritance
+PASS window.getComputedStyle(document.getElementById('child')).getPropertyValue('touch-action') is 'auto'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Testing the computed style of touch-action:
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Added: trunk/LayoutTests/css3/touch-action/touch-action-computed-style.html (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-computed-style.html	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-computed-style.html	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,61 @@
+<html>
+    <head>
+        <script src=""
+    </head>
+
+    <body id="body-elem">
+        <div id="child"></div>
+        <p id="description"></p>
+        <script>
+            description("Testing the computed style of touch-action:");
+            let styleElement = document.createElement("style");
+            document.head.appendChild(styleElement);
+            let stylesheet = styleElement.sheet;
+
+            debug("Testing touch-action: manipulation;");
+            stylesheet.insertRule("body { touch-action: manipulation; }", 0);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'manipulation'");
+            stylesheet.deleteRule(0);
+
+            debug("Testing touch-action: auto;");
+            stylesheet.insertRule("body { touch-action: auto; }", 0);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'auto'");
+            stylesheet.deleteRule(0);
+
+            debug("Testing a bogus value");
+            stylesheet.insertRule("body { touch-action: typo; }", 0);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'auto'");
+            stylesheet.deleteRule(0);
+
+            debug("Testing all caps");
+            stylesheet.insertRule("body { touch-action: MANIPULATION; }", 0);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'manipulation'");
+            stylesheet.deleteRule(0);
+
+            debug("Testing weird casing");
+            stylesheet.insertRule("body { touch-action: aUtO; }", 0);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'auto'");
+            stylesheet.deleteRule(0);
+
+            debug("Testing !important (auto)");
+            stylesheet.insertRule("body { touch-action: auto !important; }", 0);
+            stylesheet.insertRule("#body-elem { touch-action: manipulation; }", 1);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'auto'");
+            stylesheet.deleteRule(1);
+            stylesheet.deleteRule(0);
+
+            debug("Testing !important (manipulation)");
+            stylesheet.insertRule("body { touch-action: manipulation !important; }", 0);
+            stylesheet.insertRule("#body-elem { touch-action: auto; }", 1);
+            shouldBe("window.getComputedStyle(document.body).getPropertyValue('touch-action')", "'manipulation'");
+            stylesheet.deleteRule(1);
+            stylesheet.deleteRule(0);
+
+            debug("Testing non-inheritance");
+            stylesheet.insertRule("body { touch-action: manipulation; }", 0);
+            shouldBe("window.getComputedStyle(document.getElementById('child')).getPropertyValue('touch-action')", "'auto'");
+            stylesheet.deleteRule(0);
+        </script>
+        <script src=""
+    </body>
+</html>

Added: trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks-expected.txt (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks-expected.txt	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,12 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Repeatedly tapping on the button should fire click events.
+
+This test is best run in WebKitTestRunner. If you are running this test manually, verify that tapping the button causes a "Click!" message to appear below, and that click occurred without the regular 350ms delay for double tapping.
+
+Click!
+Click!
+Click!
+

Added: trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks.html (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks.html	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-manipulation-fast-clicks.html	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,59 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<meta name="viewport" content="initial-scale=1.0">
+
+<head>
+    <script src=""
+    <script id="ui-script" type="text/plain">
+        (function() {
+            function performTap() {
+                uiController.singleTapAtPoint(200, 200, performTap);
+            }
+            performTap();
+        })();
+    </script>
+
+    <script>
+    var clickCount = 0;
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function getUIScript() {
+        return document.getElementById("ui-script").text;
+    }
+
+    function runTest() {
+        if (testRunner.runUIScript)
+            testRunner.runUIScript(getUIScript(), function(result) { });
+    }
+    function handleClicked() {
+        clickCount++;
+        document.body.appendChild(document.createTextNode("Click!"));
+        document.body.appendChild(document.createElement("br"));
+        if (clickCount == 3)
+            testRunner.notifyDone();
+    }
+    </script>
+
+    <style>
+    body {
+        margin: 0;
+    }
+
+    #target {
+        touch-action: manipulation;
+        width: 400px;
+        height: 400px;
+    }
+    </style>
+</head>
+
+<body _onload_="runTest()">
+    <button id="target" _onclick_="handleClicked()"></button>
+    <p>Repeatedly tapping on the button should fire click events.</p>
+    <p>This test is best run in WebKitTestRunner. If you are running this test manually, verify that tapping the button causes a "Click!" message to appear below, and that click occurred without the regular 350ms delay for double tapping.</p>
+    <script src=""
+</body>
+
+</html>

Added: trunk/LayoutTests/css3/touch-action/touch-action-parsing-expected.txt (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-parsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-parsing-expected.txt	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,12 @@
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('touch-action') is 'manipulation'
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('touch-action') is 'auto'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test the parsing of touch-action.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Added: trunk/LayoutTests/css3/touch-action/touch-action-parsing.html (0 => 191452)


--- trunk/LayoutTests/css3/touch-action/touch-action-parsing.html	                        (rev 0)
+++ trunk/LayoutTests/css3/touch-action/touch-action-parsing.html	2015-10-22 13:54:55 UTC (rev 191452)
@@ -0,0 +1,31 @@
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <p id="description"></p>
+        <script>
+            description("Test the parsing of touch-action.");
+
+            var cssRule, declaration;
+            var styleElement = document.createElement("style");
+            document.head.appendChild(styleElement);
+            let stylesheet = styleElement.sheet;
+
+            stylesheet.insertRule("body { touch-action: manipulation; }", 0);
+            cssRule = stylesheet.cssRules.item(0);
+            shouldBe("cssRule.type", "1");
+            declaration = cssRule.style;
+            shouldBe("declaration.length", "1");
+            shouldBe("declaration.getPropertyValue('touch-action')", "'manipulation'");
+
+            stylesheet.insertRule("body { touch-action: auto; }", 0);
+            cssRule = stylesheet.cssRules.item(0);
+            shouldBe("cssRule.type", "1");
+            declaration = cssRule.style;
+            shouldBe("declaration.length", "1");
+            shouldBe("declaration.getPropertyValue('touch-action')", "'auto'");
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (191451 => 191452)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2015-10-22 13:54:55 UTC (rev 191452)
@@ -6,6 +6,7 @@
 # Platform-specific directories. Skipped globally, then re-enabled here.
 #//////////////////////////////////////////////////////////////////////////////////////////
 
+css3/touch-action [ Pass ]
 fast/harness/ui-side-scripts.html [ Pass ]
 fast/harness/concurrent-ui-side-scripts.html [ Pass ]
 fast/zooming/ios [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (191451 => 191452)


--- trunk/Source/WebCore/ChangeLog	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/ChangeLog	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1,3 +1,44 @@
+2015-10-22  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Implement touch-action: manipulation; for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=149854
+        <rdar://problem/23017145>
+
+        Reviewed by Benjamin Poulain.
+
+        Implements the manipulation value for the CSS property touch-action. Adds support for
+        parsing the touch-action property and two of its values: auto and manipulation.
+
+        Tests: css3/touch-action/touch-action-computed-style.html
+               css3/touch-action/touch-action-manipulation-fast-clicks.html
+               css3/touch-action/touch-action-parsing.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        (WebCore::isKeywordPropertyID):
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator TouchAction):
+        * css/CSSPropertyNames.in:
+        * css/CSSValueKeywords.in:
+        * dom/Element.cpp:
+        (WebCore::Element::allowsDoubleTapGesture): Here, we determine whether an element that resulted from
+            hit-testing a touch should allow double-tap gestures. To do this, we walk up the element's parents,
+            stopping when we detect an element that disallows double tap gestures by having a touch-action other
+            than auto or by hitting the root node.
+        * dom/Element.h:
+        * dom/Node.h:
+        (WebCore::Node::allowsDoubleTapGesture):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2015-10-22  Ryosuke Niwa  <rn...@webkit.org>
 
         REGRESSION (r181972): Scroll position changes to top of youtube page when switching tabs

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (191451 => 191452)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-10-22 13:54:55 UTC (rev 191452)
@@ -3193,6 +3193,8 @@
 #if ENABLE(TOUCH_EVENTS)
         case CSSPropertyWebkitTapHighlightColor:
             return currentColorOrValidColor(style.get(), style->tapHighlightColor());
+        case CSSPropertyTouchAction:
+            return cssValuePool.createValue(style->touchAction());
 #endif
 #if PLATFORM(IOS)
         case CSSPropertyWebkitTouchCallout:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (191451 => 191452)


--- trunk/Source/WebCore/css/CSSParser.cpp	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2015-10-22 13:54:55 UTC (rev 191452)
@@ -754,6 +754,12 @@
         if (valueID == CSSValueNormal || valueID == CSSValueBreakWord)
             return true;
         break;
+#if ENABLE(TOUCH_EVENTS)
+    case CSSPropertyTouchAction: // auto | manipulation
+        if (valueID == CSSValueAuto || valueID == CSSValueManipulation)
+            return true;
+        break;
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
     case CSSPropertyWebkitScrollSnapType: // none | mandatory | proximity
         if (valueID == CSSValueNone || valueID == CSSValueMandatory || valueID == CSSValueProximity)
@@ -1176,6 +1182,9 @@
     case CSSPropertyWhiteSpace:
     case CSSPropertyWordBreak:
     case CSSPropertyWordWrap:
+#if ENABLE(TOUCH_EVENTS)
+    case CSSPropertyTouchAction:
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
     case CSSPropertyWebkitScrollSnapType:
 #endif
@@ -3267,6 +3276,9 @@
     case CSSPropertyWhiteSpace:
     case CSSPropertyWordBreak:
     case CSSPropertyWordWrap:
+#if ENABLE(TOUCH_EVENTS)
+    case CSSPropertyTouchAction:
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
     case CSSPropertyWebkitScrollSnapType:
 #endif

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (191451 => 191452)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -5252,6 +5252,37 @@
     m_value.valueID = CSSValueNormal;
 }
 
+#if ENABLE(TOUCH_EVENTS)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction touchAction)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (touchAction) {
+    case TouchAction::Auto:
+        m_value.valueID = CSSValueAuto;
+        break;
+    case TouchAction::Manipulation:
+        m_value.valueID = CSSValueManipulation;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator TouchAction() const
+{
+    ASSERT(isValueID());
+    switch (m_value.valueID) {
+    case CSSValueAuto:
+        return TouchAction::Auto;
+    case CSSValueManipulation:
+        return TouchAction::Manipulation;
+    default:
+        break;
+    }
+    ASSERT_NOT_REACHED();
+    return TouchAction::Auto;
+}
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType e)
     : CSSValue(PrimitiveClass)

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (191451 => 191452)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2015-10-22 13:54:55 UTC (rev 191452)
@@ -666,6 +666,9 @@
 #if defined(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) && ENABLE_ACCELERATED_OVERFLOW_SCROLLING
 -webkit-overflow-scrolling [Inherited, NameForMethods=UseTouchOverflowScrolling, Converter=OverflowScrolling]
 #endif
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+touch-action
+#endif
 #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
 -webkit-touch-callout [Inherited, NameForMethods=TouchCalloutEnabled, Converter=TouchCallout]
 #endif

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (191451 => 191452)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1172,3 +1172,8 @@
 // will-change
 scroll-position
 contents
+
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+// touch-action
+manipulation
+#endif

Modified: trunk/Source/WebCore/dom/Element.cpp (191451 => 191452)


--- trunk/Source/WebCore/dom/Element.cpp	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/dom/Element.cpp	2015-10-22 13:54:55 UTC (rev 191452)
@@ -4,7 +4,7 @@
  *           (C) 2001 Peter Kelly (p...@post.com)
  *           (C) 2001 Dirk Mueller (muel...@kde.org)
  *           (C) 2007 David Smith (catfish....@gmail.com)
- * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Apple Inc. All rights reserved.
  *           (C) 2007 Eric Seidel (e...@webkit.org)
  *
  * This library is free software; you can redistribute it and/or
@@ -1381,6 +1381,17 @@
     return document().completeURL(stripLeadingAndTrailingHTMLSpaces(linkAttribute));
 }
 
+#if ENABLE(TOUCH_EVENTS)
+bool Element::allowsDoubleTapGesture() const
+{
+    if (renderStyle() && renderStyle()->touchAction() != TouchAction::Auto)
+        return false;
+
+    Element* parent = parentElement();
+    return !parent || parent->allowsDoubleTapGesture();
+}
+#endif
+
 StyleResolver& Element::styleResolver()
 {
     if (auto* shadowRoot = containingShadowRoot())

Modified: trunk/Source/WebCore/dom/Element.h (191451 => 191452)


--- trunk/Source/WebCore/dom/Element.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/dom/Element.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -487,6 +487,10 @@
 
     WEBCORE_EXPORT URL absoluteLinkURL() const;
 
+#if ENABLE(TOUCH_EVENTS)
+    virtual bool allowsDoubleTapGesture() const override;
+#endif
+
     StyleResolver& styleResolver();
     Ref<RenderStyle> resolveStyle(RenderStyle* parentStyle);
 

Modified: trunk/Source/WebCore/dom/Node.h (191451 => 191452)


--- trunk/Source/WebCore/dom/Node.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/dom/Node.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -529,6 +529,10 @@
     void dispatchSubtreeModifiedEvent();
     bool dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent);
 
+#if ENABLE(TOUCH_EVENTS)
+    virtual bool allowsDoubleTapGesture() const { return true; }
+#endif
+
 #if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
     bool dispatchTouchEvent(PassRefPtr<TouchEvent>);
 #endif

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (191451 => 191452)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1119,6 +1119,10 @@
     int initialLetterDrop() const { return initialLetter().width(); }
     int initialLetterHeight() const { return initialLetter().height(); }
 
+#if ENABLE(TOUCH_EVENTS)
+    TouchAction touchAction() const { return static_cast<TouchAction>(rareNonInheritedData->m_touchAction); }
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
     ScrollSnapType scrollSnapType() const { return static_cast<ScrollSnapType>(rareNonInheritedData->m_scrollSnapType); }
     const ScrollSnapPoints* scrollSnapPointsX() const;
@@ -1679,6 +1683,10 @@
     
     void setInitialLetter(const IntSize& size) { SET_VAR(rareNonInheritedData, m_initialLetter, size); }
     
+#if ENABLE(TOUCH_EVENTS)
+    void setTouchAction(TouchAction touchAction) { SET_VAR(rareNonInheritedData, m_touchAction, static_cast<unsigned>(touchAction)); }
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
     void setScrollSnapType(ScrollSnapType type) { SET_VAR(rareNonInheritedData, m_scrollSnapType, static_cast<unsigned>(type)); }
     void setScrollSnapPointsX(std::unique_ptr<ScrollSnapPoints>);
@@ -2032,6 +2040,10 @@
 
     static WillChangeData* initialWillChange() { return nullptr; }
 
+#if ENABLE(TOUCH_EVENTS)
+    static TouchAction initialTouchAction() { return TouchAction::Auto; }
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
     static ScrollSnapType initialScrollSnapType() { return ScrollSnapType::None; }
     static ScrollSnapPoints* initialScrollSnapPointsX() { return nullptr; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (191451 => 191452)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -643,6 +643,13 @@
 // Fill, Stroke, ViewBox are just used for SVG.
 enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, Fill, Stroke, ViewBox };
 
+#if ENABLE(TOUCH_EVENTS)
+enum class TouchAction {
+    Auto,
+    Manipulation
+};
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
 enum class ScrollSnapType {
     None,

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (191451 => 191452)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2015-10-22 13:54:55 UTC (rev 191452)
@@ -79,6 +79,9 @@
     , m_justifyContent(RenderStyle::initialContentAlignment())
     , m_justifyItems(RenderStyle::initialSelfAlignment())
     , m_justifySelf(RenderStyle::initialSelfAlignment())
+#if ENABLE(TOUCH_EVENTS)
+    , m_touchAction(static_cast<unsigned>(RenderStyle::initialTouchAction()))
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
     , m_scrollSnapType(static_cast<unsigned>(RenderStyle::initialScrollSnapType()))
 #endif
@@ -168,6 +171,9 @@
     , m_justifyContent(o.m_justifyContent)
     , m_justifyItems(o.m_justifyItems)
     , m_justifySelf(o.m_justifySelf)
+#if ENABLE(TOUCH_EVENTS)
+    , m_touchAction(o.m_touchAction)
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
     , m_scrollSnapType(o.m_scrollSnapType)
 #endif
@@ -282,6 +288,9 @@
         && m_borderFit == o.m_borderFit
         && m_textCombine == o.m_textCombine
         && m_textDecorationStyle == o.m_textDecorationStyle
+#if ENABLE(TOUCH_EVENTS)
+        && m_touchAction == o.m_touchAction
+#endif
 #if ENABLE(CSS_SCROLL_SNAP)
         && m_scrollSnapType == o.m_scrollSnapType
 #endif

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (191451 => 191452)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2015-10-22 13:54:55 UTC (rev 191452)
@@ -184,6 +184,10 @@
     StyleSelfAlignmentData m_justifyItems;
     StyleSelfAlignmentData m_justifySelf;
 
+#if ENABLE(TOUCH_EVENTS)
+    unsigned m_touchAction : 1; // TouchAction
+#endif
+
 #if ENABLE(CSS_SCROLL_SNAP)
     unsigned m_scrollSnapType : 2; // ScrollSnapType
 #endif

Modified: trunk/Source/WebKit2/ChangeLog (191451 => 191452)


--- trunk/Source/WebKit2/ChangeLog	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1,3 +1,19 @@
+2015-10-22  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Implement touch-action: manipulation; for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=149854
+        <rdar://problem/23017145>
+
+        Reviewed by Benjamin Poulain.
+
+        Implements the manipulation value for the CSS property touch-action. Performs hit-testing upon receiving a potential
+        tap to determine whether to disable double-tap gesture recognition over the duration of the tap. If so, sends a message
+        from the web process to the UI process indicating that double-tapping should be disabled, allowing single taps to
+        avoid the delay.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::potentialTapAtPosition):
+
 2015-10-22  Ryosuke Niwa  <rn...@webkit.org>
 
         REGRESSION (r181972): Scroll position changes to top of youtube page when switching tabs

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (191451 => 191452)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-10-22 11:37:46 UTC (rev 191451)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-10-22 13:54:55 UTC (rev 191452)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -665,6 +665,12 @@
     m_potentialTapNode = m_page->mainFrame().nodeRespondingToClickEvents(position, m_potentialTapLocation);
     sendTapHighlightForNodeIfNecessary(requestID, m_potentialTapNode.get());
     if (m_potentialTapNode) {
+#if ENABLE(TOUCH_EVENTS)
+        if (!m_potentialTapNode->allowsDoubleTapGesture()) {
+            send(Messages::WebPageProxy::DisableDoubleTapGesturesUntilTapIsFinishedIfNecessary(requestID, false, FloatRect(), false, 0, 0));
+            return;
+        }
+#endif
         FloatPoint origin = position;
         FloatRect renderRect;
         bool isReplaced;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to