Use ENABLE_POINTER_EVENTS for the touch-action property
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 11:36:57 +0000 (11:36 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 11:36:57 +0000 (11:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193819

Reviewed by Antti Koivisto.

Since we've added an ENABLE_POINTER_EVENTS we should be using it for anything related to the implementation of the
Pointer Events specification of which the touch-action property is a part.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
* css/CSSPrimitiveValueMappings.h:
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/StyleBuilderConverter.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):
* dom/Element.cpp:
(WebCore::Element::allowsDoubleTapGesture const):
* platform/TouchAction.h:
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperties.json
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/parser/CSSPropertyParser.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/platform/TouchAction.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h

index 38a6769..3930272 100644 (file)
@@ -1,3 +1,30 @@
+2019-01-25  Antoine Quint  <graouts@apple.com>
+
+        Use ENABLE_POINTER_EVENTS for the touch-action property
+        https://bugs.webkit.org/show_bug.cgi?id=193819
+
+        Reviewed by Antti Koivisto.
+
+        Since we've added an ENABLE_POINTER_EVENTS we should be using it for anything related to the implementation of the
+        Pointer Events specification of which the touch-action property is a part.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
+        * css/CSSPrimitiveValueMappings.h:
+        * css/CSSProperties.json:
+        * css/CSSValueKeywords.in:
+        * css/StyleBuilderConverter.h:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        * dom/Element.cpp:
+        (WebCore::Element::allowsDoubleTapGesture const):
+        * platform/TouchAction.h:
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator== const):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2019-01-24  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Refactor MarginCollapse::updateCollapsedMarginAfter
index b4b103b..5aaae72 100644 (file)
@@ -1747,7 +1747,7 @@ static Ref<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
     return CSSValuePool::singleton().createFontFamilyValue(family);
 }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
 static Ref<CSSValue> touchActionFlagsToCSSValue(OptionSet<TouchAction> touchActions)
 {
     auto& cssValuePool = CSSValuePool::singleton();
@@ -3762,6 +3762,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyinStyle(const RenderSty
 #if ENABLE(TOUCH_EVENTS)
         case CSSPropertyWebkitTapHighlightColor:
             return currentColorOrValidColor(&style, style.tapHighlightColor());
+#endif
+#if ENABLE(POINTER_EVENTS)
         case CSSPropertyTouchAction:
             return touchActionFlagsToCSSValue(style.touchActions());
 #endif
index efd8423..d09f49f 100644 (file)
@@ -5236,7 +5236,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextZoom textZoom)
     m_value.valueID = CSSValueNormal;
 }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction touchAction)
     : CSSValue(PrimitiveClass)
 {
index 976fa39..e9f945a 100644 (file)
             ],
             "codegen-properties": {
                 "name-for-methods": "TouchActions",
-                "enable-if": "ENABLE_TOUCH_EVENTS",
+                "enable-if": "ENABLE_POINTER_EVENTS",
                 "converter": "TouchAction"
             },
             "specification": {
index 0932190..d8d3d2d 100644 (file)
@@ -1352,7 +1352,7 @@ style
 scroll-position
 //contents
 
-#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+#if defined(ENABLE_POINTER_EVENTS) && ENABLE_POINTER_EVENTS
 // touch-action
 // auto
 // none
index 80d81aa..50a5f50 100644 (file)
@@ -117,6 +117,8 @@ public:
 #endif
 #if ENABLE(TOUCH_EVENTS)
     static Color convertTapHighlightColor(StyleResolver&, const CSSValue&);
+#endif
+#if ENABLE(POINTER_EVENTS)
     static OptionSet<TouchAction> convertTouchAction(StyleResolver&, const CSSValue&);
 #endif
 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
@@ -1347,7 +1349,9 @@ inline Color StyleBuilderConverter::convertTapHighlightColor(StyleResolver& styl
 {
     return styleResolver.colorFromPrimitiveValue(downcast<CSSPrimitiveValue>(value));
 }
+#endif
 
+#if ENABLE(POINTER_EVENTS)
 inline OptionSet<TouchAction> StyleBuilderConverter::convertTouchAction(StyleResolver&, const CSSValue& value)
 {
     if (is<CSSPrimitiveValue>(value))
index 1f795d9..b39fd1c 100644 (file)
@@ -1347,7 +1347,7 @@ static RefPtr<CSSValue> consumeClip(CSSParserTokenRange& range, CSSParserMode cs
     return CSSValuePool::singleton().createValue(WTFMove(rect));
 }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
 static RefPtr<CSSValue> consumeTouchAction(CSSParserTokenRange& range)
 {
     CSSValueID id = range.peek().id();
@@ -4038,7 +4038,7 @@ RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSS
 #endif
     case CSSPropertyClip:
         return consumeClip(m_range, m_context.mode);
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     case CSSPropertyTouchAction:
         return consumeTouchAction(m_range);
 #endif
index b2f13d0..ea5493a 100644 (file)
@@ -1665,8 +1665,10 @@ URL Element::absoluteLinkURL() const
 #if ENABLE(TOUCH_EVENTS)
 bool Element::allowsDoubleTapGesture() const
 {
+#if ENABLE(POINTER_EVENTS)
     if (renderStyle() && renderStyle()->touchActions() != TouchAction::Auto)
         return false;
+#endif
 
     Element* parent = parentElement();
     return !parent || parent->allowsDoubleTapGesture();
index 8682b7f..b0cb476 100644 (file)
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#if ENABLE(POINTER_EVENTS)
+
 namespace WebCore {
 
 enum class TouchAction : uint8_t {
@@ -37,3 +39,5 @@ enum class TouchAction : uint8_t {
 };
 
 }
+
+#endif // ENABLE(POINTER_EVENTS)
index 3d87fbd..324efe5 100644 (file)
@@ -704,7 +704,7 @@ public:
     int initialLetterDrop() const { return initialLetter().width(); }
     int initialLetterHeight() const { return initialLetter().height(); }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     OptionSet<TouchAction> touchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareNonInheritedData->touchActions); }
 #endif
 
@@ -1223,7 +1223,7 @@ public:
     
     void setInitialLetter(const IntSize& size) { SET_VAR(m_rareNonInheritedData, initialLetter, size); }
     
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     void setTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareNonInheritedData, touchActions, touchActions.toRaw()); }
 #endif
 
@@ -1619,7 +1619,7 @@ public:
 
     static WillChangeData* initialWillChange() { return nullptr; }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     static TouchAction initialTouchActions() { return TouchAction::Auto; }
 #endif
 
index b66c328..19e3372 100644 (file)
@@ -76,7 +76,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , justifyItems(RenderStyle::initialJustifyItems())
     , justifySelf(RenderStyle::initialSelfAlignment())
     , customProperties(StyleCustomPropertyData::create())
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     , touchActions(static_cast<unsigned>(RenderStyle::initialTouchActions()))
 #endif
     , pageSizeType(PAGE_SIZE_AUTO)
@@ -170,7 +170,7 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , justifySelf(o.justifySelf)
     , customProperties(o.customProperties)
     , customPaintWatchedProperties(o.customPaintWatchedProperties ? std::make_unique<HashSet<String>>(*o.customPaintWatchedProperties) : nullptr)
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     , touchActions(o.touchActions)
 #endif
     , pageSizeType(o.pageSizeType)
@@ -285,7 +285,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && borderFit == o.borderFit
         && textCombine == o.textCombine
         && textDecorationStyle == o.textDecorationStyle
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
         && touchActions == o.touchActions
 #endif
 #if ENABLE(CSS_COMPOSITING)
index 3111240..2133b88 100644 (file)
@@ -174,7 +174,7 @@ public:
     DataRef<StyleCustomPropertyData> customProperties;
     std::unique_ptr<HashSet<String>> customPaintWatchedProperties;
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
     unsigned touchActions : 5; // TouchAction
 #endif