Title: [240927] trunk/Source
Revision
240927
Author
commit-qu...@webkit.org
Date
2019-02-04 08:22:49 -0800 (Mon, 04 Feb 2019)

Log Message

Use a dedicated type instead of int32_t for pointer identifiers
https://bugs.webkit.org/show_bug.cgi?id=194217

Patch by Antoine Quint <grao...@apple.com> on 2019-02-04
Reviewed by Antti Koivisto.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* dom/PointerEvent.h:
* dom/PointerID.h: Added.
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::setPointerCapture):
(WebCore::PointerCaptureController::releasePointerCapture):
(WebCore::PointerCaptureController::hasPointerCapture):
(WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
(WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
(WebCore::PointerCaptureController::cancelPointer):
* page/PointerCaptureController.h:

Source/WebKit:

* Scripts/webkit/messages.py:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::cancelPointer):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::cancelPointer):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240926 => 240927)


--- trunk/Source/WebCore/ChangeLog	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebCore/ChangeLog	2019-02-04 16:22:49 UTC (rev 240927)
@@ -1,3 +1,22 @@
+2019-02-04  Antoine Quint  <grao...@apple.com>
+
+        Use a dedicated type instead of int32_t for pointer identifiers
+        https://bugs.webkit.org/show_bug.cgi?id=194217
+
+        Reviewed by Antti Koivisto.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/PointerEvent.h:
+        * dom/PointerID.h: Added.
+        * page/PointerCaptureController.cpp:
+        (WebCore::PointerCaptureController::setPointerCapture):
+        (WebCore::PointerCaptureController::releasePointerCapture):
+        (WebCore::PointerCaptureController::hasPointerCapture):
+        (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier):
+        (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier):
+        (WebCore::PointerCaptureController::cancelPointer):
+        * page/PointerCaptureController.h:
+
 2019-02-04  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (240926 => 240927)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-04 16:22:49 UTC (rev 240927)
@@ -2127,6 +2127,7 @@
 		71E2183A17359FB8006E6E4D /* PlugInsResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E2183817359FB8006E6E4D /* PlugInsResources.h */; };
 		71E2C42621C935280024F8C8 /* AnimationEffectPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E2C42421C9351D0024F8C8 /* AnimationEffectPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71E623D1151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */; };
+		71EADCD822087E720065A45F /* PointerID.h in Headers */ = {isa = PBXBuildFile; fileRef = 71EADCD622087E6D0065A45F /* PointerID.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71EFCEDC202B38A900D7C411 /* AnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71EFCED7202B388D00D7C411 /* AnimationEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */; };
 		724ED32C1A3A7E5400F5F13C /* EXTBlendMinMax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */; };
@@ -9446,6 +9447,7 @@
 		71E2C42421C9351D0024F8C8 /* AnimationEffectPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationEffectPhase.h; sourceTree = "<group>"; };
 		71E623CE151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedIntegerOptionalInteger.cpp; sourceTree = "<group>"; };
 		71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedIntegerOptionalInteger.h; sourceTree = "<group>"; };
+		71EADCD622087E6D0065A45F /* PointerID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PointerID.h; sourceTree = "<group>"; };
 		71EFCED6202B388C00D7C411 /* AnimationEffect.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AnimationEffect.idl; sourceTree = "<group>"; };
 		71EFCED7202B388D00D7C411 /* AnimationEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationEffect.h; sourceTree = "<group>"; };
 		71EFCEDA202B388F00D7C411 /* AnimationEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AnimationEffect.cpp; sourceTree = "<group>"; };
@@ -27667,6 +27669,7 @@
 				317D3FF1215599E20034E3B9 /* PointerEvent.cpp */,
 				317D3FF2215599E30034E3B9 /* PointerEvent.h */,
 				317D3FEF215599E10034E3B9 /* PointerEvent.idl */,
+				71EADCD622087E6D0065A45F /* PointerID.h */,
 				5189F0DD10B46B0E00F3C739 /* PopStateEvent.cpp */,
 				5174E20810A1F44F00F95E6F /* PopStateEvent.h */,
 				5174E20B10A1F49A00F95E6F /* PopStateEvent.idl */,
@@ -30022,6 +30025,7 @@
 				1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */,
 				1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */,
 				1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */,
+				71EADCD822087E720065A45F /* PointerID.h in Headers */,
 				1A494E350A12358B00FDAFC1 /* JSHTMLDocument.h in Headers */,
 				1A494BFB0A122F4400FDAFC1 /* JSHTMLElement.h in Headers */,
 				938E65F109F09840008A48EC /* JSHTMLElementWrapperFactory.h in Headers */,

Modified: trunk/Source/WebCore/dom/PointerEvent.h (240926 => 240927)


--- trunk/Source/WebCore/dom/PointerEvent.h	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebCore/dom/PointerEvent.h	2019-02-04 16:22:49 UTC (rev 240927)
@@ -28,6 +28,7 @@
 #if ENABLE(POINTER_EVENTS)
 
 #include "MouseEvent.h"
+#include "PointerID.h"
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
@@ -39,7 +40,7 @@
 class PointerEvent final : public MouseEvent {
 public:
     struct Init : MouseEventInit {
-        int32_t pointerId { 0 };
+        PointerID pointerId { 0 };
         double width { 1 };
         double height { 1 };
         float pressure { 0 };
@@ -56,7 +57,7 @@
         return adoptRef(*new PointerEvent(type, WTFMove(initializer)));
     }
 
-    static Ref<PointerEvent> create(const AtomicString& type, int32_t pointerId, String pointerType)
+    static Ref<PointerEvent> create(const AtomicString& type, PointerID pointerId, String pointerType)
     {
         Init initializer;
         initializer.bubbles = true;
@@ -86,7 +87,7 @@
 
     virtual ~PointerEvent();
 
-    int32_t pointerId() const { return m_pointerId; }
+    PointerID pointerId() const { return m_pointerId; }
     double width() const { return m_width; }
     double height() const { return m_height; }
     float pressure() const { return m_pressure; }
@@ -108,7 +109,7 @@
     PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
 #endif
 
-    int32_t m_pointerId { 0 };
+    PointerID m_pointerId { 0 };
     double m_width { 1 };
     double m_height { 1 };
     float m_pressure { 0 };

Added: trunk/Source/WebCore/dom/PointerID.h (0 => 240927)


--- trunk/Source/WebCore/dom/PointerID.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/PointerID.h	2019-02-04 16:22:49 UTC (rev 240927)
@@ -0,0 +1,36 @@
+/*
+ * 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
+
+#if ENABLE(POINTER_EVENTS)
+
+namespace WebCore {
+
+using PointerID = int32_t;
+
+}
+
+#endif // ENABLE(POINTER_EVENTS)

Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (240926 => 240927)


--- trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-02-04 16:22:49 UTC (rev 240927)
@@ -42,7 +42,7 @@
 {
 }
 
-ExceptionOr<void> PointerCaptureController::setPointerCapture(Element* capturingTarget, int32_t pointerId)
+ExceptionOr<void> PointerCaptureController::setPointerCapture(Element* capturingTarget, PointerID pointerId)
 {
     // https://w3c.github.io/pointerevents/#setting-pointer-capture
 
@@ -72,7 +72,7 @@
     return { };
 }
 
-ExceptionOr<void> PointerCaptureController::releasePointerCapture(Element* capturingTarget, int32_t pointerId)
+ExceptionOr<void> PointerCaptureController::releasePointerCapture(Element* capturingTarget, PointerID pointerId)
 {
     // https://w3c.github.io/pointerevents/#releasing-pointer-capture
 
@@ -95,7 +95,7 @@
     return { };
 }
 
-bool PointerCaptureController::hasPointerCapture(Element* capturingTarget, int32_t pointerId)
+bool PointerCaptureController::hasPointerCapture(Element* capturingTarget, PointerID pointerId)
 {
     // https://w3c.github.io/pointerevents/#dom-element-haspointercapture
 
@@ -123,12 +123,12 @@
     }
 }
 
-void PointerCaptureController::touchEndedOrWasCancelledForIdentifier(int32_t pointerId)
+void PointerCaptureController::touchEndedOrWasCancelledForIdentifier(PointerID pointerId)
 {
     m_activePointerIdsToCapturingData.remove(pointerId);
 }
 
-bool PointerCaptureController::hasCancelledPointerEventForIdentifier(int32_t pointerId)
+bool PointerCaptureController::hasCancelledPointerEventForIdentifier(PointerID pointerId)
 {
     auto iterator = m_activePointerIdsToCapturingData.find(pointerId);
     return iterator != m_activePointerIdsToCapturingData.end() && iterator->value.cancelled;
@@ -183,7 +183,7 @@
     processPendingPointerCapture(event);
 }
 
-void PointerCaptureController::cancelPointer(int32_t pointerId, const IntPoint& documentPoint)
+void PointerCaptureController::cancelPointer(PointerID pointerId, const IntPoint& documentPoint)
 {
     // https://w3c.github.io/pointerevents/#the-pointercancel-event
 

Modified: trunk/Source/WebCore/page/PointerCaptureController.h (240926 => 240927)


--- trunk/Source/WebCore/page/PointerCaptureController.h	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebCore/page/PointerCaptureController.h	2019-02-04 16:22:49 UTC (rev 240927)
@@ -26,6 +26,7 @@
 
 #if ENABLE(POINTER_EVENTS)
 
+#include "PointerID.h"
 #include <wtf/HashMap.h>
 
 namespace WebCore {
@@ -40,17 +41,17 @@
 public:
     explicit PointerCaptureController(Page&);
 
-    ExceptionOr<void> setPointerCapture(Element*, int32_t);
-    ExceptionOr<void> releasePointerCapture(Element*, int32_t);
-    bool hasPointerCapture(Element*, int32_t);
+    ExceptionOr<void> setPointerCapture(Element*, PointerID);
+    ExceptionOr<void> releasePointerCapture(Element*, PointerID);
+    bool hasPointerCapture(Element*, PointerID);
 
     void pointerLockWasApplied();
 
-    void touchEndedOrWasCancelledForIdentifier(int32_t);
-    bool hasCancelledPointerEventForIdentifier(int32_t);
+    void touchEndedOrWasCancelledForIdentifier(PointerID);
+    bool hasCancelledPointerEventForIdentifier(PointerID);
     void pointerEventWillBeDispatched(const PointerEvent&, EventTarget*);
     void pointerEventWasDispatched(const PointerEvent&);
-    WEBCORE_EXPORT void cancelPointer(int32_t, const IntPoint&);
+    WEBCORE_EXPORT void cancelPointer(PointerID, const IntPoint&);
 
 private:
     struct CapturingData {
@@ -63,7 +64,7 @@
     void processPendingPointerCapture(const PointerEvent&);
 
     Page& m_page;
-    HashMap<int32_t, CapturingData> m_activePointerIdsToCapturingData;
+    HashMap<PointerID, CapturingData> m_activePointerIdsToCapturingData;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (240926 => 240927)


--- trunk/Source/WebKit/ChangeLog	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/ChangeLog	2019-02-04 16:22:49 UTC (rev 240927)
@@ -1,3 +1,19 @@
+2019-02-04  Antoine Quint  <grao...@apple.com>
+
+        Use a dedicated type instead of int32_t for pointer identifiers
+        https://bugs.webkit.org/show_bug.cgi?id=194217
+
+        Reviewed by Antti Koivisto.
+
+        * Scripts/webkit/messages.py:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::cancelPointer):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::cancelPointer):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2019-02-04  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, avoid -Wswitch warnings introduced in r240880

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (240926 => 240927)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2019-02-04 16:22:49 UTC (rev 240927)
@@ -199,6 +199,7 @@
         'String',
         'WebCore::DocumentIdentifier',
         'WebCore::FetchIdentifier',
+        'WebCore::PointerID',
         'WebCore::ServiceWorkerIdentifier',
         'WebCore::ServiceWorkerJobIdentifier',
         'WebCore::ServiceWorkerOrClientData',

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (240926 => 240927)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-02-04 16:22:49 UTC (rev 240927)
@@ -2650,7 +2650,7 @@
 #endif // ENABLE(TOUCH_EVENTS)
 
 #if ENABLE(POINTER_EVENTS)
-void WebPageProxy::cancelPointer(int32_t pointerId, const WebCore::IntPoint& documentPoint)
+void WebPageProxy::cancelPointer(WebCore::PointerID pointerId, const WebCore::IntPoint& documentPoint)
 {
     m_process->send(Messages::WebPage::CancelPointer(pointerId, documentPoint), m_pageID);
 }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (240926 => 240927)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-04 16:22:49 UTC (rev 240927)
@@ -81,6 +81,7 @@
 #include <WebCore/MediaPlaybackTargetContext.h>
 #include <WebCore/MediaProducer.h>
 #include <WebCore/PlatformScreen.h>
+#include <WebCore/PointerID.h>
 #include <WebCore/ScrollTypes.h>
 #include <WebCore/SearchPopupMenu.h>
 #include <WebCore/TextChecking.h>
@@ -791,7 +792,7 @@
 #endif
 
 #if ENABLE(POINTER_EVENTS)
-    void cancelPointer(int32_t, const WebCore::IntPoint&);
+    void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
 #endif
 
     void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (240926 => 240927)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-02-04 16:22:49 UTC (rev 240927)
@@ -2816,7 +2816,7 @@
 #endif
 
 #if ENABLE(POINTER_EVENTS)
-void WebPage::cancelPointer(int32_t pointerId, const WebCore::IntPoint& documentPoint)
+void WebPage::cancelPointer(WebCore::PointerID pointerId, const WebCore::IntPoint& documentPoint)
 {
     m_page->pointerCaptureController().cancelPointer(pointerId, documentPoint);
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (240926 => 240927)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-02-04 16:22:49 UTC (rev 240927)
@@ -65,6 +65,7 @@
 #include <WebCore/Page.h>
 #include <WebCore/PageOverlay.h>
 #include <WebCore/PluginData.h>
+#include <WebCore/PointerID.h>
 #include <WebCore/SecurityPolicyViolationEvent.h>
 #include <WebCore/ShareData.h>
 #include <WebCore/UserActivity.h>
@@ -1251,7 +1252,7 @@
 #endif
 
 #if ENABLE(POINTER_EVENTS)
-    void cancelPointer(int32_t, const WebCore::IntPoint&);
+    void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
 #endif
 
 #if ENABLE(CONTEXT_MENUS)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (240926 => 240927)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-02-04 16:05:18 UTC (rev 240926)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-02-04 16:22:49 UTC (rev 240927)
@@ -128,7 +128,7 @@
 #endif
 
 #if ENABLE(POINTER_EVENTS)
-    CancelPointer(int32_t pointerId, WebCore::IntPoint documentPoint)
+    CancelPointer(WebCore::PointerID pointerId, WebCore::IntPoint documentPoint)
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to