Title: [246070] trunk
Revision
246070
Author
grao...@webkit.org
Date
2019-06-04 10:45:43 -0700 (Tue, 04 Jun 2019)

Log Message

[Pointer Events] Expose navigator.maxTouchPoints
https://bugs.webkit.org/show_bug.cgi?id=198468
<rdar://problem/51273029>

Reviewed by Chris Dumez.

Source/WebCore:

Expose the navigator.maxTouchPoints property when Pointer Events are enabled both at compile-time and run-time.
We return a canned value for this on iOS touch-enabled devices that matches the number of simultaneous touches
supported by the system, which is 5. In fact, iPad support more simultaneous touches, but it doesn't seem worthy
to expose this level of granularity due to fingerprinting practices. In practice, what really matters is returning
0, 1 or more than 1 for this value to identify multi-touch support.

Test: js/dom/navigator-maxtouchpoints.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/NavigatorMaxTouchPoints.idl: Added.
* page/Navigator.idl:
* page/Navigator.h:
(WebCore::Navigator::maxTouchPoints const):

LayoutTests:

* js/dom/navigator-maxtouchpoints-expected.txt: Added.
* js/dom/navigator-maxtouchpoints.html: Added.
* platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/win/js/dom/navigator-maxtouchpoints-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246069 => 246070)


--- trunk/LayoutTests/ChangeLog	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/LayoutTests/ChangeLog	2019-06-04 17:45:43 UTC (rev 246070)
@@ -1,3 +1,19 @@
+2019-06-02  Antoine Quint  <grao...@apple.com>
+
+        [Pointer Events] Expose navigator.maxTouchPoints
+        https://bugs.webkit.org/show_bug.cgi?id=198468
+        <rdar://problem/51273029>
+
+        Reviewed by Chris Dumez.
+
+        * js/dom/navigator-maxtouchpoints-expected.txt: Added.
+        * js/dom/navigator-maxtouchpoints.html: Added.
+        * platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/win/js/dom/navigator-maxtouchpoints-expected.txt: Added.
+
 2019-06-04  Antoine Quint  <grao...@apple.com>
 
         The "mouseenter" and "pointerenter" events are fired from the bottom up

Added: trunk/LayoutTests/js/dom/navigator-maxtouchpoints-expected.txt (0 => 246070)


--- trunk/LayoutTests/js/dom/navigator-maxtouchpoints-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/dom/navigator-maxtouchpoints-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -0,0 +1,10 @@
+Check return value of navigator.maxTouchPoints.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+navigator.maxTouchPoints = 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/dom/navigator-maxtouchpoints.html (0 => 246070)


--- trunk/LayoutTests/js/dom/navigator-maxtouchpoints.html	                        (rev 0)
+++ trunk/LayoutTests/js/dom/navigator-maxtouchpoints.html	2019-06-04 17:45:43 UTC (rev 246070)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Check return value of navigator.maxTouchPoints.");
+debug(`navigator.maxTouchPoints = ${navigator.maxTouchPoints}`);
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt (246069 => 246070)


--- trunk/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -11,6 +11,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
@@ -35,6 +36,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK

Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt (246069 => 246070)


--- trunk/LayoutTests/platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -8,6 +8,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
@@ -27,6 +28,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK

Modified: trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt (246069 => 246070)


--- trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -9,6 +9,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
@@ -29,6 +30,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK

Modified: trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt (246069 => 246070)


--- trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -12,6 +12,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
@@ -37,6 +38,7 @@
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
+navigator.maxTouchPoints is OK
 navigator.mediaCapabilities is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK

Added: trunk/LayoutTests/platform/win/js/dom/navigator-maxtouchpoints-expected.txt (0 => 246070)


--- trunk/LayoutTests/platform/win/js/dom/navigator-maxtouchpoints-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/js/dom/navigator-maxtouchpoints-expected.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -0,0 +1,10 @@
+Check return value of navigator.maxTouchPoints.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+navigator.maxTouchPoints = undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/CMakeLists.txt (246069 => 246070)


--- trunk/Source/WebCore/CMakeLists.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/CMakeLists.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -710,6 +710,7 @@
     dom/MutationObserver.idl
     dom/MutationRecord.idl
     dom/NamedNodeMap.idl
+    dom/NavigatorMaxTouchPoints.idl
     dom/Node.idl
     dom/NodeFilter.idl
     dom/NodeIterator.idl

Modified: trunk/Source/WebCore/ChangeLog (246069 => 246070)


--- trunk/Source/WebCore/ChangeLog	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/ChangeLog	2019-06-04 17:45:43 UTC (rev 246070)
@@ -1,3 +1,30 @@
+2019-06-02  Antoine Quint  <grao...@apple.com>
+
+        [Pointer Events] Expose navigator.maxTouchPoints
+        https://bugs.webkit.org/show_bug.cgi?id=198468
+        <rdar://problem/51273029>
+
+        Reviewed by Chris Dumez.
+
+        Expose the navigator.maxTouchPoints property when Pointer Events are enabled both at compile-time and run-time.
+        We return a canned value for this on iOS touch-enabled devices that matches the number of simultaneous touches
+        supported by the system, which is 5. In fact, iPad support more simultaneous touches, but it doesn't seem worthy
+        to expose this level of granularity due to fingerprinting practices. In practice, what really matters is returning
+        0, 1 or more than 1 for this value to identify multi-touch support.
+
+        Test: js/dom/navigator-maxtouchpoints.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/NavigatorMaxTouchPoints.idl: Added.
+        * page/Navigator.idl:
+        * page/Navigator.h:
+        (WebCore::Navigator::maxTouchPoints const):
+
 2019-06-04  Zalan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Decouple float placement and line shrinking

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (246069 => 246070)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2019-06-04 17:45:43 UTC (rev 246070)
@@ -593,6 +593,7 @@
 $(PROJECT_DIR)/dom/MutationObserver.idl
 $(PROJECT_DIR)/dom/MutationRecord.idl
 $(PROJECT_DIR)/dom/NamedNodeMap.idl
+$(PROJECT_DIR)/dom/NavigatorMaxTouchPoints.idl
 $(PROJECT_DIR)/dom/Node.idl
 $(PROJECT_DIR)/dom/NodeFilter.idl
 $(PROJECT_DIR)/dom/NodeIterator.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (246069 => 246070)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2019-06-04 17:45:43 UTC (rev 246070)
@@ -1051,6 +1051,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorID.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorLanguage.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorLanguage.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMaxTouchPoints.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMaxTouchPoints.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMediaCapabilities.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMediaCapabilities.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMediaDevices.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (246069 => 246070)


--- trunk/Source/WebCore/DerivedSources.make	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/DerivedSources.make	2019-06-04 17:45:43 UTC (rev 246070)
@@ -609,6 +609,7 @@
     $(WebCore)/dom/MutationObserver.idl \
     $(WebCore)/dom/MutationRecord.idl \
     $(WebCore)/dom/NamedNodeMap.idl \
+    $(WebCore)/dom/NavigatorMaxTouchPoints.idl \
     $(WebCore)/dom/Node.idl \
     $(WebCore)/dom/NodeFilter.idl \
     $(WebCore)/dom/NodeIterator.idl \

Modified: trunk/Source/WebCore/Sources.txt (246069 => 246070)


--- trunk/Source/WebCore/Sources.txt	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/Sources.txt	2019-06-04 17:45:43 UTC (rev 246070)
@@ -2935,6 +2935,7 @@
 JSNavigatorGPU.cpp
 JSNavigatorID.cpp
 JSNavigatorLanguage.cpp
+JSNavigatorMaxTouchPoints.cpp
 JSNavigatorMediaCapabilities.cpp
 JSNavigatorMediaDevices.cpp
 JSNavigatorOnLine.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (246069 => 246070)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-06-04 17:45:43 UTC (rev 246070)
@@ -9394,6 +9394,7 @@
 		71EFCEDA202B388F00D7C411 /* AnimationEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AnimationEffect.cpp; sourceTree = "<group>"; };
 		71EFCEDE202B39C700D7C411 /* JSAnimationEffectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAnimationEffectCustom.cpp; sourceTree = "<group>"; };
 		71F936F71DD4F99B00922CC7 /* tracks-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "tracks-support.js"; sourceTree = "<group>"; };
+		71FF851822A3F81F005D5959 /* NavigatorMaxTouchPoints.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorMaxTouchPoints.idl; sourceTree = "<group>"; };
 		721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; };
 		721443462240CAD200F12FF7 /* SVGValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValueProperty.h; sourceTree = "<group>"; };
 		724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; };
@@ -27488,6 +27489,7 @@
 				A81872130977D3C0005826D9 /* NameNodeList.h */,
 				8306EFF01B8BCE7C0031D032 /* NativeNodeFilter.cpp */,
 				83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */,
+				71FF851822A3F81F005D5959 /* NavigatorMaxTouchPoints.idl */,
 				A8C4A7EE09D563270003AC8D /* Node.cpp */,
 				14115B5109F84B7100CA4FC1 /* Node.h */,
 				14DC0D0B09FECFA4007B0235 /* Node.idl */,

Added: trunk/Source/WebCore/dom/NavigatorMaxTouchPoints.idl (0 => 246070)


--- trunk/Source/WebCore/dom/NavigatorMaxTouchPoints.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/NavigatorMaxTouchPoints.idl	2019-06-04 17:45:43 UTC (rev 246070)
@@ -0,0 +1,35 @@
+/*
+* 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.
+* 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+*     its contributors may be used to endorse or promote products derived
+*     from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+*/
+
+[
+    NoInterfaceObject,
+    Conditional=POINTER_EVENTS,
+    EnabledAtRuntime=PointerEvents
+] interface MaxTouchPoints {
+    readonly attribute long maxTouchPoints;
+};

Modified: trunk/Source/WebCore/page/Navigator.h (246069 => 246070)


--- trunk/Source/WebCore/page/Navigator.h	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/page/Navigator.h	2019-06-04 17:45:43 UTC (rev 246070)
@@ -55,6 +55,14 @@
 
     void getStorageUpdates();
 
+#if ENABLE(POINTER_EVENTS)
+#if ENABLE(IOS_TOUCH_EVENTS) && !PLATFORM(IOSMAC)
+    int maxTouchPoints() const { return 5; }
+#else
+    int maxTouchPoints() const { return 0; }
+#endif
+#endif
+
 private:
     explicit Navigator(ScriptExecutionContext*, DOMWindow&);
 

Modified: trunk/Source/WebCore/page/Navigator.idl (246069 => 246070)


--- trunk/Source/WebCore/page/Navigator.idl	2019-06-04 17:09:04 UTC (rev 246069)
+++ trunk/Source/WebCore/page/Navigator.idl	2019-06-04 17:45:43 UTC (rev 246070)
@@ -33,6 +33,7 @@
 
 Navigator implements NavigatorID;
 Navigator implements NavigatorLanguage;
+Navigator implements NavigatorMaxTouchPoints;
 Navigator implements NavigatorOnLine;
 Navigator implements NavigatorServiceWorker;
 Navigator implements NavigatorShare;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to