Title: [239978] trunk/Source/WebCore
Revision
239978
Author
grao...@webkit.org
Date
2019-01-15 00:30:53 -0800 (Tue, 15 Jan 2019)

Log Message

Support parsing of additional values for the touch-action property
https://bugs.webkit.org/show_bug.cgi?id=193314
<rdar://problem/47176519>

Reviewed by Dean Jackson.

We add parsing support for the "none", "pan-x", "pan-y" and "pinch-zoom" values of the CSS "touch-action" property.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::touchActionFlagsToCSSValue):
(WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator OptionSet<TouchAction> const):
(WebCore::CSSPrimitiveValue::operator TouchAction const): Deleted.
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertTouchAction):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTouchAction):
* dom/Element.cpp:
(WebCore::Element::allowsDoubleTapGesture const):
* platform/TouchAction.h: Added.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::touchActions const):
(WebCore::RenderStyle::setTouchActions):
(WebCore::RenderStyle::initialTouchActions):
(WebCore::RenderStyle::touchAction const): Deleted.
(WebCore::RenderStyle::setTouchAction): Deleted.
(WebCore::RenderStyle::initialTouchAction): Deleted.
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239977 => 239978)


--- trunk/Source/WebCore/ChangeLog	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/ChangeLog	2019-01-15 08:30:53 UTC (rev 239978)
@@ -1,3 +1,46 @@
+2019-01-11  Antoine Quint  <grao...@apple.com>
+
+        Support parsing of additional values for the touch-action property
+        https://bugs.webkit.org/show_bug.cgi?id=193314
+        <rdar://problem/47176519>
+
+        Reviewed by Dean Jackson.
+
+        We add parsing support for the "none", "pan-x", "pan-y" and "pinch-zoom" values of the CSS "touch-action" property.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::touchActionFlagsToCSSValue):
+        (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator OptionSet<TouchAction> const):
+        (WebCore::CSSPrimitiveValue::operator TouchAction const): Deleted.
+        * css/CSSProperties.json:
+        * css/CSSValueKeywords.in:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertTouchAction):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeTouchAction):
+        * dom/Element.cpp:
+        (WebCore::Element::allowsDoubleTapGesture const):
+        * platform/TouchAction.h: Added.
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::touchActions const):
+        (WebCore::RenderStyle::setTouchActions):
+        (WebCore::RenderStyle::initialTouchActions):
+        (WebCore::RenderStyle::touchAction const): Deleted.
+        (WebCore::RenderStyle::setTouchAction): Deleted.
+        (WebCore::RenderStyle::initialTouchAction): Deleted.
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator== const):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2019-01-15  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Audit: create new IDL type for exposing special functionality in test context

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (239977 => 239978)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-01-15 08:30:53 UTC (rev 239978)
@@ -2106,6 +2106,7 @@
 		71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
 		71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
 		71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		71B7EE0D21B5C6870031C1EF /* TouchAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 71AEE4EB21B5A49C00DDB036 /* TouchAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71C29E32203CE781008F36D2 /* CSSAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C29E30203CE76B008F36D2 /* CSSAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71C916081D1483A300ACA47D /* UserInterfaceLayoutDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; };
@@ -9367,6 +9368,7 @@
 		71A1B6071DEE5A820073BCFB /* en */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; name = en; path = "en.lproj/modern-media-controls-localized-strings.js"; sourceTree = SOURCE_ROOT; };
 		71A57DEF154BE25C0009D120 /* SVGPathUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathUtilities.cpp; sourceTree = "<group>"; };
 		71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathUtilities.h; sourceTree = "<group>"; };
+		71AEE4EB21B5A49C00DDB036 /* TouchAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchAction.h; sourceTree = "<group>"; };
 		71B0460A1DD3C2EE00EE19CF /* status-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "status-support.js"; sourceTree = "<group>"; };
 		71B28424203CEC0B0036AA5D /* JSCSSAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSAnimation.cpp; sourceTree = "<group>"; };
 		71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSAnimation.h; sourceTree = "<group>"; };
@@ -25426,6 +25428,7 @@
 				185BCF270F3279CE000EA262 /* ThreadTimers.h */,
 				93309EA1099EB78C0056E581 /* Timer.cpp */,
 				9305B24C098F1B6B00C28855 /* Timer.h */,
+				71AEE4EB21B5A49C00DDB036 /* TouchAction.h */,
 				868160D1187669C40021E79D /* UserActivity.cpp */,
 				868160D2187669C40021E79D /* UserActivity.h */,
 				A3AF9D8220325324006CAD06 /* UserAgent.h */,
@@ -31947,6 +31950,7 @@
 				2D7ED0AB1BAE99170043B3E5 /* TimerEventBasedMock.h in Headers */,
 				49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */,
 				0F54DD081881D5F5003EEDBB /* Touch.h in Headers */,
+				71B7EE0D21B5C6870031C1EF /* TouchAction.h in Headers */,
 				0F54DD091881D5F5003EEDBB /* TouchEvent.h in Headers */,
 				0F54DD0A1881D5F5003EEDBB /* TouchList.h in Headers */,
 				070334D71459FFD5008D8D45 /* TrackBase.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (239977 => 239978)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2019-01-15 08:30:53 UTC (rev 239978)
@@ -73,6 +73,7 @@
 #include "StyleResolver.h"
 #include "StyleScope.h"
 #include "StyleScrollSnapPoints.h"
+#include "TouchAction.h"
 #include "WebKitFontFamilyNames.h"
 #include "WillChangeData.h"
 #include <wtf/NeverDestroyed.h>
@@ -1746,6 +1747,32 @@
     return CSSValuePool::singleton().createFontFamilyValue(family);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+static Ref<CSSValue> touchActionFlagsToCSSValue(OptionSet<TouchAction> touchActions)
+{
+    auto& cssValuePool = CSSValuePool::singleton();
+
+    if (touchActions & TouchAction::Auto)
+        return cssValuePool.createIdentifierValue(CSSValueAuto);
+    if (touchActions & TouchAction::None)
+        return cssValuePool.createIdentifierValue(CSSValueNone);
+    if (touchActions & TouchAction::Manipulation)
+        return cssValuePool.createIdentifierValue(CSSValueManipulation);
+
+    auto list = CSSValueList::createSpaceSeparated();
+    if (touchActions & TouchAction::PanX)
+        list->append(cssValuePool.createIdentifierValue(CSSValuePanX));
+    if (touchActions & TouchAction::PanY)
+        list->append(cssValuePool.createIdentifierValue(CSSValuePanY));
+    if (touchActions & TouchAction::PinchZoom)
+        list->append(cssValuePool.createIdentifierValue(CSSValuePinchZoom));
+
+    if (!list->length())
+        return cssValuePool.createIdentifierValue(CSSValueAuto);
+    return WTFMove(list);
+}
+#endif
+
 static Ref<CSSValue> renderTextDecorationFlagsToCSSValue(OptionSet<TextDecoration> textDecoration)
 {
     auto& cssValuePool = CSSValuePool::singleton();
@@ -3732,7 +3759,7 @@
         case CSSPropertyWebkitTapHighlightColor:
             return currentColorOrValidColor(&style, style.tapHighlightColor());
         case CSSPropertyTouchAction:
-            return cssValuePool.createValue(style.touchAction());
+            return touchActionFlagsToCSSValue(style.touchActions());
 #endif
 #if PLATFORM(IOS_FAMILY)
         case CSSPropertyWebkitTouchCallout:

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (239977 => 239978)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -42,6 +42,7 @@
 #include "SVGRenderStyleDefs.h"
 #include "TextFlags.h"
 #include "ThemeTypes.h"
+#include "TouchAction.h"
 #include "UnicodeBidi.h"
 #include "WritingMode.h"
 #include <wtf/MathExtras.h>
@@ -5247,10 +5248,22 @@
     case TouchAction::Manipulation:
         m_value.valueID = CSSValueManipulation;
         break;
+    case TouchAction::None:
+        m_value.valueID = CSSValueNone;
+        break;
+    case TouchAction::PanX:
+        m_value.valueID = CSSValuePanX;
+        break;
+    case TouchAction::PanY:
+        m_value.valueID = CSSValuePanY;
+        break;
+    case TouchAction::PinchZoom:
+        m_value.valueID = CSSValuePinchZoom;
+        break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator TouchAction() const
+template<> inline CSSPrimitiveValue::operator OptionSet<TouchAction>() const
 {
     ASSERT(isValueID());
     switch (m_value.valueID) {
@@ -5258,6 +5271,14 @@
         return TouchAction::Auto;
     case CSSValueManipulation:
         return TouchAction::Manipulation;
+    case CSSValueNone:
+        return TouchAction::None;
+    case CSSValuePanX:
+        return TouchAction::PanX;
+    case CSSValuePanY:
+        return TouchAction::PanY;
+    case CSSValuePinchZoom:
+        return TouchAction::PinchZoom;
     default:
         break;
     }

Modified: trunk/Source/WebCore/css/CSSProperties.json (239977 => 239978)


--- trunk/Source/WebCore/css/CSSProperties.json	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/CSSProperties.json	2019-01-15 08:30:53 UTC (rev 239978)
@@ -6677,10 +6677,16 @@
         "touch-action": {
             "values": [
                 "auto",
-                "manipulation"
+                "none",
+                "manipulation",
+                "pan-x",
+                "pan-y",
+                "pinch-zoom"
             ],
             "codegen-properties": {
-                "enable-if": "ENABLE_TOUCH_EVENTS"
+                "name-for-methods": "TouchActions",
+                "enable-if": "ENABLE_TOUCH_EVENTS",
+                "converter": "TouchAction"
             },
             "specification": {
                 "url": "https://www.w3.org/TR/pointerevents/#the-touch-action-css-property"

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (239977 => 239978)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2019-01-15 08:30:53 UTC (rev 239978)
@@ -1354,7 +1354,12 @@
 
 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
 // touch-action
+// auto
+// none
 manipulation
+pan-x
+pan-y
+pinch-zoom
 #endif
 
 // hanging-punctuation

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (239977 => 239978)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -52,6 +52,7 @@
 #include "Settings.h"
 #include "StyleResolver.h"
 #include "StyleScrollSnapPoints.h"
+#include "TouchAction.h"
 #include "TransformFunctions.h"
 #include <wtf/Optional.h>
 
@@ -116,6 +117,7 @@
 #endif
 #if ENABLE(TOUCH_EVENTS)
     static Color convertTapHighlightColor(StyleResolver&, const CSSValue&);
+    static OptionSet<TouchAction> convertTouchAction(StyleResolver&, const CSSValue&);
 #endif
 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
     static bool convertOverflowScrolling(StyleResolver&, const CSSValue&);
@@ -1345,6 +1347,26 @@
 {
     return styleResolver.colorFromPrimitiveValue(downcast<CSSPrimitiveValue>(value));
 }
+
+inline OptionSet<TouchAction> StyleBuilderConverter::convertTouchAction(StyleResolver&, const CSSValue& value)
+{
+    if (is<CSSPrimitiveValue>(value))
+        return downcast<CSSPrimitiveValue>(value);
+
+    if (is<CSSValueList>(value)) {
+        OptionSet<TouchAction> touchActions;
+        for (auto& currentValue : downcast<CSSValueList>(value)) {
+            auto& primitiveValue = downcast<CSSPrimitiveValue>(currentValue.get());
+            auto primitiveValueID = primitiveValue.valueID();
+            if (primitiveValueID != CSSValuePanX && primitiveValueID != CSSValuePanY && primitiveValueID != CSSValuePinchZoom)
+                return RenderStyle::initialTouchActions();
+            touchActions.add(primitiveValue);
+        }
+        return touchActions;
+    }
+
+    return RenderStyle::initialTouchActions();
+}
 #endif
 
 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (239977 => 239978)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2019-01-15 08:30:53 UTC (rev 239978)
@@ -758,10 +758,6 @@
         return valueID == CSSValueNormal || valueID == CSSValueBreakAll || valueID == CSSValueKeepAll || valueID == CSSValueBreakWord;
     case CSSPropertyWebkitBorderFit:
         return valueID == CSSValueBorder || valueID == CSSValueLines;
-#if ENABLE(TOUCH_EVENTS)
-    case CSSPropertyTouchAction: // auto | manipulation
-        return valueID == CSSValueAuto || valueID == CSSValueManipulation;
-#endif
 #if ENABLE(CSS_TRAILING_WORD)
     case CSSPropertyAppleTrailingWord: // auto | -apple-partially-balanced
         return valueID == CSSValueAuto || valueID == CSSValueWebkitPartiallyBalanced;
@@ -941,9 +937,6 @@
     case CSSPropertyIsolation:
     case CSSPropertyMixBlendMode:
 #endif
-#if ENABLE(TOUCH_EVENTS)
-    case CSSPropertyTouchAction:
-#endif
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     case CSSPropertyWebkitBoxDecorationBreak:
 #endif

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (239977 => 239978)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2019-01-15 08:30:53 UTC (rev 239978)
@@ -1342,14 +1342,23 @@
 #if ENABLE(TOUCH_EVENTS)
 static RefPtr<CSSValue> consumeTouchAction(CSSParserTokenRange& range)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     CSSValueID id = range.peek().id();
-    if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) {
-        list->append(consumeIdent(range).releaseNonNull());
-        return list;
+    if (id == CSSValueNone || id == CSSValueAuto || id == CSSValueManipulation)
+        return consumeIdent(range);
+
+    auto list = CSSValueList::createSpaceSeparated();
+    while (true) {
+        auto ident = consumeIdent<CSSValuePanX, CSSValuePanY, CSSValuePinchZoom>(range);
+        if (!ident)
+            break;
+        if (list->hasValue(ident.get()))
+            return nullptr;
+        list->append(ident.releaseNonNull());
     }
-    // FIXME-NEWPARSER: Support pan.
-    return nullptr;
+
+    if (!list->length())
+        return nullptr;
+    return list;
 }
 #endif
 

Modified: trunk/Source/WebCore/dom/Element.cpp (239977 => 239978)


--- trunk/Source/WebCore/dom/Element.cpp	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/dom/Element.cpp	2019-01-15 08:30:53 UTC (rev 239978)
@@ -103,6 +103,7 @@
 #include "StyleScope.h"
 #include "StyleTreeResolver.h"
 #include "TextIterator.h"
+#include "TouchAction.h"
 #include "VoidCallback.h"
 #include "WebAnimation.h"
 #include "WheelEvent.h"
@@ -1664,7 +1665,7 @@
 #if ENABLE(TOUCH_EVENTS)
 bool Element::allowsDoubleTapGesture() const
 {
-    if (renderStyle() && renderStyle()->touchAction() != TouchAction::Auto)
+    if (renderStyle() && renderStyle()->touchActions() != TouchAction::Auto)
         return false;
 
     Element* parent = parentElement();

Added: trunk/Source/WebCore/platform/TouchAction.h (0 => 239978)


--- trunk/Source/WebCore/platform/TouchAction.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/TouchAction.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class TouchAction : uint8_t {
+    Auto         = 0,
+    None         = 1 << 0,
+    Manipulation = 1 << 1,
+    PanX         = 1 << 2,
+    PanY         = 1 << 3,
+    PinchZoom    = 1 << 4,
+};
+
+}

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (239977 => 239978)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -64,6 +64,7 @@
 #include "StyleVisualData.h"
 #include "TextFlags.h"
 #include "ThemeTypes.h"
+#include "TouchAction.h"
 #include "TransformOperations.h"
 #include "UnicodeBidi.h"
 #include <memory>
@@ -704,7 +705,7 @@
     int initialLetterHeight() const { return initialLetter().height(); }
 
 #if ENABLE(TOUCH_EVENTS)
-    TouchAction touchAction() const { return static_cast<TouchAction>(m_rareNonInheritedData->touchAction); }
+    OptionSet<TouchAction> touchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareNonInheritedData->touchActions); }
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -1223,7 +1224,7 @@
     void setInitialLetter(const IntSize& size) { SET_VAR(m_rareNonInheritedData, initialLetter, size); }
     
 #if ENABLE(TOUCH_EVENTS)
-    void setTouchAction(TouchAction touchAction) { SET_VAR(m_rareNonInheritedData, touchAction, static_cast<unsigned>(touchAction)); }
+    void setTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareNonInheritedData, touchActions, touchActions.toRaw()); }
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -1619,7 +1620,7 @@
     static WillChangeData* initialWillChange() { return nullptr; }
 
 #if ENABLE(TOUCH_EVENTS)
-    static TouchAction initialTouchAction() { return TouchAction::Auto; }
+    static TouchAction initialTouchActions() { return TouchAction::Auto; }
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (239977 => 239978)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -1085,13 +1085,6 @@
     ViewBox
 };
 
-#if ENABLE(TOUCH_EVENTS)
-enum class TouchAction : uint8_t {
-    Auto,
-    Manipulation
-};
-#endif
-
 #if ENABLE(CSS_SCROLL_SNAP)
 enum class ScrollSnapStrictness : uint8_t {
     None,

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (239977 => 239978)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2019-01-15 08:30:53 UTC (rev 239978)
@@ -77,7 +77,7 @@
     , justifySelf(RenderStyle::initialSelfAlignment())
     , customProperties(StyleCustomPropertyData::create())
 #if ENABLE(TOUCH_EVENTS)
-    , touchAction(static_cast<unsigned>(RenderStyle::initialTouchAction()))
+    , touchActions(static_cast<unsigned>(RenderStyle::initialTouchActions()))
 #endif
     , pageSizeType(PAGE_SIZE_AUTO)
     , transformStyle3D(static_cast<unsigned>(RenderStyle::initialTransformStyle3D()))
@@ -171,7 +171,7 @@
     , customProperties(o.customProperties)
     , customPaintWatchedProperties(o.customPaintWatchedProperties ? std::make_unique<HashSet<String>>(*o.customPaintWatchedProperties) : nullptr)
 #if ENABLE(TOUCH_EVENTS)
-    , touchAction(o.touchAction)
+    , touchActions(o.touchActions)
 #endif
     , pageSizeType(o.pageSizeType)
     , transformStyle3D(o.transformStyle3D)
@@ -286,7 +286,7 @@
         && textCombine == o.textCombine
         && textDecorationStyle == o.textDecorationStyle
 #if ENABLE(TOUCH_EVENTS)
-        && touchAction == o.touchAction
+        && touchActions == o.touchActions
 #endif
 #if ENABLE(CSS_COMPOSITING)
         && effectiveBlendMode == o.effectiveBlendMode

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (239977 => 239978)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2019-01-15 08:27:23 UTC (rev 239977)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2019-01-15 08:30:53 UTC (rev 239978)
@@ -175,7 +175,7 @@
     std::unique_ptr<HashSet<String>> customPaintWatchedProperties;
 
 #if ENABLE(TOUCH_EVENTS)
-    unsigned touchAction : 1; // TouchAction
+    unsigned touchActions : 5; // TouchAction
 #endif
 
     unsigned pageSizeType : 2; // PageSizeType
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to