Title: [277354] trunk
Revision
277354
Author
[email protected]
Date
2021-05-11 20:55:46 -0700 (Tue, 11 May 2021)

Log Message

[macCatalyst] should have CSS `hover: hover` and `pointer: fine`
https://bugs.webkit.org/show_bug.cgi?id=225672

Reviewed by Tim Horton.

Source/WebKit:

Test: iOSMouseSupport.MouseAlwaysConnected

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isMousePrimaryPointingDevice): Added.
(WebKit::hasAccessoryMousePointingDevice): Added.
(WebKit::hasAccessoryStylusPointingDevice): Added.
(WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const):
(WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevice const):
(WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const):
(WebKit::hasMouseDevice): Deleted.
macCatalyst should consider the mouse as the primary pointing device, just like macOS:
 - `hover` and `any-hover` should always be `hover`
 - `pointer` and `any-pointer` should always be `fine` (instead of only if an accessory mouse/stylus is connected)

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Added.
(WebKit::WebProcessProxy::notifyHasStylusDeviceChanged):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::platformInitialize):
(WebKit::WebProcessProxy::platformDestroy):
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Deleted.
* UIProcess/ios/WKMouseDeviceObserver.h:
* UIProcess/ios/WKMouseDeviceObserver.mm:
* Shared/WebProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* WebProcess/WebProcess.messages.in:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Clean up macro usage to avoid unnecessary work on macCatalyst.
Drive-by: Move non-platform code to non-platform files.

Source/WTF:

* wtf/PlatformHave.h:
Add `HAVE_MOUSE_DEVICE_OBSERVATION` and `HAVE_STYLUS_DEVICE_OBSERVATION` to make callsites
clearer instead of having a somewhat unrelated connection to `HAVE_UIKIT_WITH_MOUSE_SUPPORT`
and `HAVE_PENCILKIT_TEXT_INPUT` (not to mention both of them are `PLATFORM(MACCATALYST)`
which isn't desirable since macCatalyst should consider the mouse as the primary pointing
device, just like macOS).

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TEST.iOSMouseSupport.MouseAlwaysConnected):
* TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (277353 => 277354)


--- trunk/Source/WTF/ChangeLog	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WTF/ChangeLog	2021-05-12 03:55:46 UTC (rev 277354)
@@ -1,3 +1,17 @@
+2021-05-11  Devin Rousso  <[email protected]>
+
+        [macCatalyst] should have CSS `hover: hover` and `pointer: fine`
+        https://bugs.webkit.org/show_bug.cgi?id=225672
+
+        Reviewed by Tim Horton.
+
+        * wtf/PlatformHave.h:
+        Add `HAVE_MOUSE_DEVICE_OBSERVATION` and `HAVE_STYLUS_DEVICE_OBSERVATION` to make callsites
+        clearer instead of having a somewhat unrelated connection to `HAVE_UIKIT_WITH_MOUSE_SUPPORT`
+        and `HAVE_PENCILKIT_TEXT_INPUT` (not to mention both of them are `PLATFORM(MACCATALYST)`
+        which isn't desirable since macCatalyst should consider the mouse as the primary pointing
+        device, just like macOS).
+
 2021-05-11  Alex Christensen  <[email protected]>
 
         Remove xpc_connection_kill

Modified: trunk/Source/WTF/wtf/PlatformHave.h (277353 => 277354)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -483,6 +483,10 @@
 #define HAVE_UI_PARALLAX_TRANSITION_GESTURE_RECOGNIZER 1
 #endif
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130400
+#define HAVE_MOUSE_DEVICE_OBSERVATION 1
+#endif
+
 #if (PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
 #define HAVE_UI_HOVER_EVENT_RESPONDABLE 1
 #endif
@@ -790,6 +794,10 @@
 #define HAVE_PENCILKIT_TEXT_INPUT 1
 #endif
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
+#define HAVE_STYLUS_DEVICE_OBSERVATION 1
+#endif
+
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000 || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
 #if !defined(HAVE_APPLE_ATTESTATION)
 #define HAVE_APPLE_ATTESTATION 1

Modified: trunk/Source/WebKit/ChangeLog (277353 => 277354)


--- trunk/Source/WebKit/ChangeLog	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/ChangeLog	2021-05-12 03:55:46 UTC (rev 277354)
@@ -1,3 +1,50 @@
+2021-05-11  Devin Rousso  <[email protected]>
+
+        [macCatalyst] should have CSS `hover: hover` and `pointer: fine`
+        https://bugs.webkit.org/show_bug.cgi?id=225672
+
+        Reviewed by Tim Horton.
+
+        Test: iOSMouseSupport.MouseAlwaysConnected
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::isMousePrimaryPointingDevice): Added.
+        (WebKit::hasAccessoryMousePointingDevice): Added.
+        (WebKit::hasAccessoryStylusPointingDevice): Added.
+        (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const):
+        (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const):
+        (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevice const):
+        (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const):
+        (WebKit::hasMouseDevice): Deleted.
+        macCatalyst should consider the mouse as the primary pointing device, just like macOS:
+         - `hover` and `any-hover` should always be `hover`
+         - `pointer` and `any-pointer` should always be `fine` (instead of only if an accessory mouse/stylus is connected)
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Added.
+        (WebKit::WebProcessProxy::notifyHasStylusDeviceChanged):
+        * UIProcess/ios/WebProcessProxyIOS.mm:
+        (WebKit::WebProcessProxy::platformInitialize):
+        (WebKit::WebProcessProxy::platformDestroy):
+        (WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Deleted.
+        * UIProcess/ios/WKMouseDeviceObserver.h:
+        * UIProcess/ios/WKMouseDeviceObserver.mm:
+        * Shared/WebProcessCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * WebProcess/WebProcess.messages.in:
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        Clean up macro usage to avoid unnecessary work on macCatalyst.
+        Drive-by: Move non-platform code to non-platform files.
+
 2021-05-11  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r277341.

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (277353 => 277354)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2021-05-12 03:55:46 UTC (rev 277354)
@@ -88,10 +88,12 @@
 #endif
     encoder << textCheckerState;
     encoder << fullKeyboardAccessEnabled;
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     encoder << hasMouseDevice;
 #endif
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     encoder << hasStylusDevice;
+#endif
     encoder << defaultRequestTimeoutInterval;
     encoder << backForwardCacheCapacity;
 #if PLATFORM(COCOA)
@@ -309,12 +311,14 @@
         return false;
     if (!decoder.decode(parameters.fullKeyboardAccessEnabled))
         return false;
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     if (!decoder.decode(parameters.hasMouseDevice))
         return false;
 #endif
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     if (!decoder.decode(parameters.hasStylusDevice))
         return false;
+#endif
     if (!decoder.decode(parameters.defaultRequestTimeoutInterval))
         return false;
     if (!decoder.decode(parameters.backForwardCacheCapacity))

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (277353 => 277354)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -120,10 +120,12 @@
     bool shouldSuppressMemoryPressureHandler { false };
     bool shouldUseFontSmoothing { true };
     bool fullKeyboardAccessEnabled { false };
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     bool hasMouseDevice { false };
 #endif
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     bool hasStylusDevice { false };
+#endif
     bool memoryCacheDisabled { false };
     bool attrStyleEnabled { false };
     bool shouldThrowExceptionForGlobalConstantRedeclaration { true };

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -436,11 +436,11 @@
     parameters.overrideUserInterfaceIdiomAndScale = { _UIApplicationCatalystUserInterfaceIdiom(), _UIApplicationCatalystScaleFactor() };
 #endif
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     parameters.hasMouseDevice = [[WKMouseDeviceObserver sharedInstance] hasMouseDevice];
 #endif
 
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     parameters.hasStylusDevice = [[WKStylusDeviceObserver sharedInstance] hasStylusDevice];
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-05-12 03:55:46 UTC (rev 277354)
@@ -1198,12 +1198,28 @@
         page->activityStateDidChange(ActivityState::IsVisuallyIdle);
 }
 
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
+
+void WebProcessProxy::notifyHasMouseDeviceChanged(bool hasMouseDevice)
+{
+    ASSERT(isMainRunLoop());
+    for (auto* webProcessProxy : WebProcessProxy::allProcesses().values())
+        webProcessProxy->send(Messages::WebProcess::SetHasMouseDevice(hasMouseDevice), 0);
+}
+
+#endif // HAVE(MOUSE_DEVICE_OBSERVATION)
+
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
+
 void WebProcessProxy::notifyHasStylusDeviceChanged(bool hasStylusDevice)
 {
+    ASSERT(isMainRunLoop());
     for (auto* webProcessProxy : WebProcessProxy::allProcesses().values())
         webProcessProxy->send(Messages::WebProcess::SetHasStylusDevice(hasStylusDevice), 0);
 }
 
+#endif // HAVE(STYLUS_DEVICE_OBSERVATION)
+
 void WebProcessProxy::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, CompletionHandler<void(WebsiteData)>&& completionHandler)
 {
     ASSERT(canSendMessage());

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -216,11 +216,13 @@
 
     static bool fullKeyboardAccessEnabled();
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     static void notifyHasMouseDeviceChanged(bool hasMouseDevice);
 #endif
 
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     static void notifyHasStylusDeviceChanged(bool hasStylusDevice);
+#endif
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, CompletionHandler<void(WebsiteData)>&&);
     void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.h (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
 
 #import "BackBoardServicesSPI.h"
 
@@ -48,4 +48,4 @@
 
 @end
 
-#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#endif // HAVE(MOUSE_DEVICE_OBSERVATION)

Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKMouseDeviceObserver.h"
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
 
 #import "WebProcessProxy.h"
 #import <wtf/BlockPtr.h>
@@ -125,4 +125,4 @@
 
 @end
 
-#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#endif // HAVE(MOUSE_DEVICE_OBSERVATION)

Modified: trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.h (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
 
 @interface WKStylusDeviceObserver : NSObject
 
@@ -38,4 +38,4 @@
 
 @end
 
-#endif // HAVE(PENCILKIT_TEXT_INPUT)
+#endif // HAVE(STYLUS_DEVICE_OBSERVATION)

Modified: trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.mm (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/ios/WKStylusDeviceObserver.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKStylusDeviceObserver.h"
 
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
 
 #import "WebProcessProxy.h"
 #import <UIKit/UIScribbleInteraction.h>
@@ -124,4 +124,4 @@
 
 @end
 
-#endif // HAVE(PENCILKIT_TEXT_INPUT)
+#endif // HAVE(STYLUS_DEVICE_OBSERVATION)

Modified: trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm (277353 => 277354)


--- trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -38,10 +38,10 @@
 
 void WebProcessProxy::platformInitialize()
 {
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     [[WKMouseDeviceObserver sharedInstance] start];
 #endif
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     [[WKStylusDeviceObserver sharedInstance] start];
 #endif
 }
@@ -48,25 +48,14 @@
 
 void WebProcessProxy::platformDestroy()
 {
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     [[WKMouseDeviceObserver sharedInstance] stop];
 #endif
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     [[WKStylusDeviceObserver sharedInstance] stop];
 #endif
 }
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
-
-void WebProcessProxy::notifyHasMouseDeviceChanged(bool hasMouseDevice)
-{
-    ASSERT(isMainRunLoop());
-    for (auto* webProcessProxy : WebProcessProxy::allProcesses().values())
-        webProcessProxy->send(Messages::WebProcess::SetHasMouseDevice(hasMouseDevice), 0);
-}
-
-#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT)
-
 bool WebProcessProxy::fullKeyboardAccessEnabled()
 {
 #if ENABLE(FULL_KEYBOARD_ACCESS)

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (277353 => 277354)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -4179,11 +4179,9 @@
     return String();
 }
 
-static bool hasMouseDevice()
+static bool isMousePrimaryPointingDevice()
 {
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
-    return WebProcess::singleton().hasMouseDevice();
-#elif HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(MACCATALYST)
+#if PLATFORM(MACCATALYST)
     return true;
 #else
     return false;
@@ -4190,25 +4188,50 @@
 #endif
 }
 
-bool WebPage::hoverSupportedByPrimaryPointingDevice() const
+static bool hasAccessoryMousePointingDevice()
 {
+    if (isMousePrimaryPointingDevice())
+        return true;
+
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
+    if (WebProcess::singleton().hasMouseDevice())
+        return true;
+#endif
+
     return false;
 }
 
+static bool hasAccessoryStylusPointingDevice()
+{
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
+    if (WebProcess::singleton().hasStylusDevice())
+        return true;
+#endif
+
+    return false;
+}
+
+bool WebPage::hoverSupportedByPrimaryPointingDevice() const
+{
+    return isMousePrimaryPointingDevice();
+}
+
 bool WebPage::hoverSupportedByAnyAvailablePointingDevice() const
 {
-    return hasMouseDevice();
+    return hasAccessoryMousePointingDevice();
 }
 
 Optional<PointerCharacteristics> WebPage::pointerCharacteristicsOfPrimaryPointingDevice() const
 {
-    return PointerCharacteristics::Coarse;
+    return isMousePrimaryPointingDevice() ? PointerCharacteristics::Fine : PointerCharacteristics::Coarse;
 }
 
 OptionSet<PointerCharacteristics> WebPage::pointerCharacteristicsOfAllAvailablePointingDevices() const
 {
-    OptionSet<PointerCharacteristics> result(PointerCharacteristics::Coarse);
-    if (hasMouseDevice() || WebProcess::singleton().hasStylusDevice())
+    OptionSet<PointerCharacteristics> result;
+    if (auto pointerCharacteristicsOfPrimaryPointingDevice = this->pointerCharacteristicsOfPrimaryPointingDevice())
+        result.add(*pointerCharacteristicsOfPrimaryPointingDevice);
+    if (hasAccessoryMousePointingDevice() || hasAccessoryStylusPointingDevice())
         result.add(PointerCharacteristics::Fine);
     return result;
 }

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (277353 => 277354)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-05-12 03:55:46 UTC (rev 277354)
@@ -457,7 +457,13 @@
 
     m_fullKeyboardAccessEnabled = parameters.fullKeyboardAccessEnabled;
 
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
+    m_hasMouseDevice = parameters.hasMouseDevice;
+#endif
+
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     m_hasStylusDevice = parameters.hasStylusDevice;
+#endif
 
     for (auto& scheme : parameters.urlSchemesRegisteredAsEmptyDocument)
         registerURLSchemeAsEmptyDocument(scheme);
@@ -982,7 +988,7 @@
     MessagePort::notifyMessageAvailable(identifier);
 }
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
 
 void WebProcess::setHasMouseDevice(bool hasMouseDevice)
 {
@@ -994,8 +1000,10 @@
     Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
 }
 
-#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#endif // HAVE(MOUSE_DEVICE_OBSERVATION)
 
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
+
 void WebProcess::setHasStylusDevice(bool hasStylusDevice)
 {
     if (hasStylusDevice == m_hasStylusDevice)
@@ -1006,6 +1014,8 @@
     Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
 }
 
+#endif // HAVE(STYLUS_DEVICE_OBSERVATION)
+
 #if ENABLE(GAMEPAD)
 
 void WebProcess::setInitialGamepads(const Vector<WebKit::GamepadData>& gamepadDatas)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (277353 => 277354)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2021-05-12 03:55:46 UTC (rev 277354)
@@ -201,13 +201,15 @@
 
     bool fullKeyboardAccessEnabled() const { return m_fullKeyboardAccessEnabled; }
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     bool hasMouseDevice() const { return m_hasMouseDevice; }
     void setHasMouseDevice(bool);
 #endif
 
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     bool hasStylusDevice() const { return m_hasStylusDevice; }
     void setHasStylusDevice(bool);
+#endif
 
     WebFrame* webFrame(WebCore::FrameIdentifier) const;
     Vector<WebFrame*> webFrames() const;
@@ -614,11 +616,13 @@
 
     bool m_fullKeyboardAccessEnabled { false };
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     bool m_hasMouseDevice { false };
 #endif
 
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     bool m_hasStylusDevice { false };
+#endif
 
     HashMap<WebCore::FrameIdentifier, WebFrame*> m_frameMap;
 

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (277353 => 277354)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-05-12 03:55:46 UTC (rev 277354)
@@ -50,11 +50,13 @@
     UserPreferredLanguagesChanged(Vector<String> languages)
     FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
     SetHasMouseDevice(bool hasMouseDevice)
 #endif
 
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
     SetHasStylusDevice(bool hasStylusDevice)
+#endif
 
     RefreshPlugins()
 

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (277353 => 277354)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -392,10 +392,6 @@
         });
     }
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
-    m_hasMouseDevice = parameters.hasMouseDevice;
-#endif
-
     WebCore::setScreenProperties(parameters.screenProperties);
 
 #if PLATFORM(MAC)

Modified: trunk/Tools/ChangeLog (277353 => 277354)


--- trunk/Tools/ChangeLog	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Tools/ChangeLog	2021-05-12 03:55:46 UTC (rev 277354)
@@ -1,3 +1,14 @@
+2021-05-11  Devin Rousso  <[email protected]>
+
+        [macCatalyst] should have CSS `hover: hover` and `pointer: fine`
+        https://bugs.webkit.org/show_bug.cgi?id=225672
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
+        (TEST.iOSMouseSupport.MouseAlwaysConnected):
+        * TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm:
+
 2021-05-11  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r277341.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm (277353 => 277354)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -370,10 +370,8 @@
 
 #endif // ENABLE(IOS_TOUCH_EVENTS)
 
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
+#if HAVE(MOUSE_DEVICE_OBSERVATION)
 
-#if PLATFORM(IOS)
-
 @interface WKMouseDeviceObserver
 + (WKMouseDeviceObserver *)sharedInstance;
 - (void)startWithCompletionHandler:(void (^)(void))completionHandler;
@@ -524,7 +522,7 @@
     EXPECT_TRUE([webView evaluateMediaQuery:@"any-pointer: fine"]);
 }
 
-#endif // PLATFORM(IOS)
+#endif // HAVE(MOUSE_DEVICE_OBSERVATION)
 
 #if PLATFORM(MACCATALYST)
 
@@ -534,9 +532,9 @@
 
     [webView synchronouslyLoadHTMLString:@""];
 
-    EXPECT_FALSE([webView evaluateMediaQuery:@"hover"]);
-    EXPECT_TRUE([webView evaluateMediaQuery:@"hover: none"]);
-    EXPECT_FALSE([webView evaluateMediaQuery:@"hover: hover"]);
+    EXPECT_TRUE([webView evaluateMediaQuery:@"hover"]);
+    EXPECT_FALSE([webView evaluateMediaQuery:@"hover: none"]);
+    EXPECT_TRUE([webView evaluateMediaQuery:@"hover: hover"]);
 
     EXPECT_TRUE([webView evaluateMediaQuery:@"any-hover"]);
     EXPECT_FALSE([webView evaluateMediaQuery:@"any-hover: none"]);
@@ -544,17 +542,15 @@
 
     EXPECT_TRUE([webView evaluateMediaQuery:@"pointer"]);
     EXPECT_FALSE([webView evaluateMediaQuery:@"pointer: none"]);
-    EXPECT_TRUE([webView evaluateMediaQuery:@"pointer: coarse"]);
-    EXPECT_FALSE([webView evaluateMediaQuery:@"pointer: fine"]);
+    EXPECT_FALSE([webView evaluateMediaQuery:@"pointer: coarse"]);
+    EXPECT_TRUE([webView evaluateMediaQuery:@"pointer: fine"]);
 
     EXPECT_TRUE([webView evaluateMediaQuery:@"any-pointer"]);
     EXPECT_FALSE([webView evaluateMediaQuery:@"any-pointer: none"]);
-    EXPECT_TRUE([webView evaluateMediaQuery:@"any-pointer: coarse"]);
+    EXPECT_FALSE([webView evaluateMediaQuery:@"any-pointer: coarse"]);
     EXPECT_TRUE([webView evaluateMediaQuery:@"any-pointer: fine"]);
 }
 
 #endif // PLATFORM(MACCATALYST)
 
-#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT)
-
 #endif // PLATFORM(IOS) || PLATFORM(MACCATALYST)

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm (277353 => 277354)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm	2021-05-12 03:49:57 UTC (rev 277353)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSStylusSupport.mm	2021-05-12 03:55:46 UTC (rev 277354)
@@ -34,7 +34,7 @@
 #import <WebKit/WKWebViewPrivateForTesting.h>
 #import <WebKit/WebKit.h>
 
-#if HAVE(PENCILKIT_TEXT_INPUT)
+#if HAVE(STYLUS_DEVICE_OBSERVATION)
 
 @interface WKStylusDeviceObserver
 + (WKStylusDeviceObserver *)sharedInstance;
@@ -172,6 +172,6 @@
     EXPECT_TRUE([webView evaluateMediaQuery:@"any-pointer: fine"]);
 }
 
-#endif // HAVE(PENCILKIT_TEXT_INPUT)
+#endif // HAVE(STYLUS_DEVICE_OBSERVATION)
 
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to