Title: [253636] trunk/Source
Revision
253636
Author
timothy_hor...@apple.com
Date
2019-12-17 11:57:25 -0800 (Tue, 17 Dec 2019)

Log Message

macCatalyst: Cursor should update on mouse movement and style change
https://bugs.webkit.org/show_bug.cgi?id=205317
<rdar://problem/46793696>

Reviewed by Anders Carlsson.

Source/WebCore:

* Configurations/WebCore.xcconfig:
Link AppKit for NSCursor.

* SourcesCocoa.txt:
Remove CursorIOS.cpp.
De-unify CursorMac; because it imports AppKit headers, we have to
take care to make sure it doesn't also get WAK (which it does if you
leave it unified).

* WebCore.xcodeproj/project.pbxproj:
Remove CursorIOS.cpp and de-unify CursorMac (by adding it to the target)

* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::setCursor):
(WebCore::Chrome::setCursorHiddenUntilMouseMoves):
Unifdef many things.

* page/ChromeClient.h:
(WebCore::ChromeClient::supportsSettingCursor):
Add a ChromeClient bit, supportsSettingCursor, which can be used
to guard work that shouldn't happen if a platform doesn't support
pushing cursor updates out from WebCore. This will be true everywhere
except iOS, and does the work of the old platform ifdefs.

* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::updateCursor):
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::scheduleCursorUpdate):
* page/EventHandler.h:
* platform/Cursor.cpp:
* platform/Cursor.h:
Unifdef, and use supportsSettingCursor to avoid some unnecessary work.

* platform/ios/CursorIOS.cpp: Removed.
* platform/ios/WidgetIOS.mm:
(WebCore::Widget::setCursor):
Propagate cursor changes upwards.

* platform/mac/CursorMac.mm:
(WebCore::cursor):
(WebCore::Cursor::ensurePlatformCursor const):
CursorMac is now built in macCatalyst. However, parts that depend
on HIServices or NSImage are #ifdeffed out, and fall back to an arrow.

Source/WebKit:

* Configurations/WebKit.xcconfig:
Link AppKit for NSCursor.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Cursor>::decode):
Enable Cursor encoders.

* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::setCursor):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
Unifdef various things.
Implement setCursor().

Source/WebKitLegacy/ios:

* WebCoreSupport/WebChromeClientIOS.h:
Provide a stub implementation of cursor-related ChromeClient methods.

Source/WTF:

* wtf/FeatureDefines.h:
Make ENABLE_CURSOR_SUPPORT true on iOS, for macCatalyst. This results
in it being true everywhere, so remove it.

Add a new ENABLE_CUSTOM_CURSOR_SUPPORT, indicating whether we support
custom bitmap cursors. It covers the subset of ENABLE_CURSOR_SUPPORT
code that we still don't support in macCatalyst.

* wtf/Platform.h:
Add HAVE_HISERVICES (true on macOS but not macCatalyst) and
HAVE_NSCURSOR (true on macOS and macCatalyst but not e.g. iOS).

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (253635 => 253636)


--- trunk/Source/WTF/ChangeLog	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WTF/ChangeLog	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1,3 +1,23 @@
+2019-12-17  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Cursor should update on mouse movement and style change
+        https://bugs.webkit.org/show_bug.cgi?id=205317
+        <rdar://problem/46793696>
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/FeatureDefines.h:
+        Make ENABLE_CURSOR_SUPPORT true on iOS, for macCatalyst. This results
+        in it being true everywhere, so remove it.
+
+        Add a new ENABLE_CUSTOM_CURSOR_SUPPORT, indicating whether we support
+        custom bitmap cursors. It covers the subset of ENABLE_CURSOR_SUPPORT
+        code that we still don't support in macCatalyst.
+
+        * wtf/Platform.h:
+        Add HAVE_HISERVICES (true on macOS but not macCatalyst) and
+        HAVE_NSCURSOR (true on macOS and macCatalyst but not e.g. iOS).
+
 2019-12-16  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] Remove ArrayBufferNeuteringWatchpointSet

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (253635 => 253636)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -83,8 +83,8 @@
 #endif
 #endif
 
-#if !defined(ENABLE_CURSOR_SUPPORT)
-#define ENABLE_CURSOR_SUPPORT 0
+#if !defined(ENABLE_CUSTOM_CURSOR_SUPPORT)
+#define ENABLE_CUSTOM_CURSOR_SUPPORT 0
 #endif
 
 #if !defined(ENABLE_DRAG_SUPPORT)
@@ -455,8 +455,8 @@
 #define ENABLE_CSS_CONIC_GRADIENTS 0
 #endif
 
-#if !defined(ENABLE_CURSOR_SUPPORT)
-#define ENABLE_CURSOR_SUPPORT 1
+#if !defined(ENABLE_CUSTOM_CURSOR_SUPPORT)
+#define ENABLE_CUSTOM_CURSOR_SUPPORT 1
 #endif
 
 #if !defined(ENABLE_CUSTOM_SCHEME_HANDLER)

Modified: trunk/Source/WTF/wtf/Platform.h (253635 => 253636)


--- trunk/Source/WTF/wtf/Platform.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WTF/wtf/Platform.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -619,6 +619,7 @@
 
 #define HAVE_RUNLOOP_TIMER 1
 #define HAVE_SEC_KEYCHAIN 1
+#define HAVE_HISERVICES 1
 #define USE_APPKIT 1
 #define USE_PASSKIT 1
 
@@ -1226,6 +1227,7 @@
 
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
 #define HAVE_APPLE_GRAPHICS_CONTROL 1
+#define HAVE_NSCURSOR 1
 #endif
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/ChangeLog (253635 => 253636)


--- trunk/Source/WebCore/ChangeLog	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/ChangeLog	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1,3 +1,59 @@
+2019-12-17  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Cursor should update on mouse movement and style change
+        https://bugs.webkit.org/show_bug.cgi?id=205317
+        <rdar://problem/46793696>
+
+        Reviewed by Anders Carlsson.
+
+        * Configurations/WebCore.xcconfig:
+        Link AppKit for NSCursor.
+
+        * SourcesCocoa.txt:
+        Remove CursorIOS.cpp.
+        De-unify CursorMac; because it imports AppKit headers, we have to
+        take care to make sure it doesn't also get WAK (which it does if you
+        leave it unified).
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Remove CursorIOS.cpp and de-unify CursorMac (by adding it to the target)
+
+        * loader/EmptyClients.h:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::setCursor):
+        (WebCore::Chrome::setCursorHiddenUntilMouseMoves):
+        Unifdef many things.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::supportsSettingCursor):
+        Add a ChromeClient bit, supportsSettingCursor, which can be used
+        to guard work that shouldn't happen if a platform doesn't support
+        pushing cursor updates out from WebCore. This will be true everywhere
+        except iOS, and does the work of the old platform ifdefs.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::EventHandler):
+        (WebCore::EventHandler::clear):
+        (WebCore::EventHandler::updateCursor):
+        (WebCore::EventHandler::selectCursor):
+        (WebCore::EventHandler::handleMouseMoveEvent):
+        (WebCore::EventHandler::scheduleCursorUpdate):
+        * page/EventHandler.h:
+        * platform/Cursor.cpp:
+        * platform/Cursor.h:
+        Unifdef, and use supportsSettingCursor to avoid some unnecessary work.
+
+        * platform/ios/CursorIOS.cpp: Removed.
+        * platform/ios/WidgetIOS.mm:
+        (WebCore::Widget::setCursor):
+        Propagate cursor changes upwards.
+
+        * platform/mac/CursorMac.mm:
+        (WebCore::cursor):
+        (WebCore::Cursor::ensurePlatformCursor const):
+        CursorMac is now built in macCatalyst. However, parts that depend
+        on HIServices or NSImage are #ifdeffed out, and fall back to an arrow.
+
 2019-12-17  Antti Koivisto  <an...@apple.com>
 
         REGRESSION: ASSERTION FAILED: FontCache::singleton().generation() == m_generation

Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (253635 => 253636)


--- trunk/Source/WebCore/Configurations/WebCore.xcconfig	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig	2019-12-17 19:57:25 UTC (rev 253636)
@@ -73,6 +73,7 @@
 
 WK_APPKIT_LDFLAGS = $(WK_APPKIT_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_APPKIT_LDFLAGS_macosx = -framework AppKit;
+WK_APPKIT_LDFLAGS_maccatalyst = -framework AppKit;
 
 WK_APPSUPPORT_LDFLAGS = $(WK_APPSUPPORT_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_APPSUPPORT_LDFLAGS_cocoatouch = -framework AppSupport;

Modified: trunk/Source/WebCore/SourcesCocoa.txt (253635 => 253636)


--- trunk/Source/WebCore/SourcesCocoa.txt	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2019-12-17 19:57:25 UTC (rev 253636)
@@ -384,7 +384,6 @@
 platform/graphics/opentype/OpenTypeCG.cpp
 
 platform/ios/ColorIOS.mm
-platform/ios/CursorIOS.cpp
 platform/ios/Device.cpp
 platform/ios/DeviceMotionClientIOS.mm
 platform/ios/DeviceOrientationClientIOS.mm
@@ -436,7 +435,7 @@
 platform/ios/wak/WKView.mm
 
 platform/mac/BlacklistUpdater.mm
-platform/mac/CursorMac.mm
+platform/mac/CursorMac.mm @no-unify
 platform/mac/DragDataMac.mm
 platform/mac/DragImageMac.mm
 platform/mac/KeyEventMac.mm @no-unify

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (253635 => 253636)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-12-17 19:57:25 UTC (rev 253636)
@@ -724,6 +724,7 @@
 		2D0621511DA63A9F00A7FB26 /* WebKitMediaKeyNeededEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0621481DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.h */; };
 		2D0621521DA63AA200A7FB26 /* WebKitMediaKeyNeededEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D0621471DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.cpp */; };
 		2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		2D22830323A8470700364B7E /* CursorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784F002DE375901EA4122 /* CursorMac.mm */; };
 		2D25396318CE7F6200270222 /* ImageControlsButtonElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */; };
 		2D29386B235F6B6900C7F3B2 /* ExceptionDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6563,7 +6564,6 @@
 		262EC41C1D110B1F00BA78FC /* EventTrackingRegions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTrackingRegions.cpp; sourceTree = "<group>"; };
 		265541371489811C000DFC5D /* KeyEventCodesIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyEventCodesIOS.h; sourceTree = "<group>"; };
 		265541381489811C000DFC5D /* KeyEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyEventIOS.mm; sourceTree = "<group>"; };
-		2655414B1489AA2B000DFC5D /* CursorIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CursorIOS.cpp; sourceTree = "<group>"; };
 		26601EBD14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformEventFactoryIOS.h; sourceTree = "<group>"; };
 		26601EBE14B3B9AD0012C0FE /* PlatformEventFactoryIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformEventFactoryIOS.mm; sourceTree = "<group>"; };
 		267725F61A5B3AD9003C24DD /* DFA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFA.cpp; sourceTree = "<group>"; };
@@ -22866,7 +22866,6 @@
 				F48223121E386E240066FC79 /* AbstractPasteboard.h */,
 				CE5169E521F1B84700EA4F78 /* ColorIOS.h */,
 				CE5169E621F1B84700EA4F78 /* ColorIOS.mm */,
-				2655414B1489AA2B000DFC5D /* CursorIOS.cpp */,
 				A1ED778A1BE3293F00DC1791 /* Device.cpp */,
 				A1ED778B1BE3294000DC1791 /* Device.h */,
 				31EAF97C121435A400E7C1BF /* DeviceMotionClientIOS.h */,
@@ -33550,6 +33549,7 @@
 				07AFF4231EFB144900B545B3 /* CoreAudioCaptureSourceIOS.mm in Sources */,
 				46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */,
 				1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */,
+				2D22830323A8470700364B7E /* CursorMac.mm in Sources */,
 				5CBD59592280E926002B22AA /* CustomHeaderFields.cpp in Sources */,
 				BE23480C18A9870B00E4B6E8 /* DataCue.cpp in Sources */,
 				4463CF682212FA68001A8577 /* DataDetectorsCoreSoftLink.mm in Sources */,

Modified: trunk/Source/WebCore/loader/EmptyClients.h (253635 => 253636)


--- trunk/Source/WebCore/loader/EmptyClients.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -142,10 +142,8 @@
     void elementDidFocus(Element&) final { }
     void elementDidBlur(Element&) final { }
 
-#if !PLATFORM(IOS_FAMILY)
     void setCursor(const Cursor&) final { }
     void setCursorHiddenUntilMouseMoves(bool) final { }
-#endif
 
     void scrollRectIntoView(const IntRect&) const final { }
 

Modified: trunk/Source/WebCore/page/Chrome.cpp (253635 => 253636)


--- trunk/Source/WebCore/page/Chrome.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/page/Chrome.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -486,20 +486,12 @@
 
 void Chrome::setCursor(const Cursor& cursor)
 {
-#if ENABLE(CURSOR_SUPPORT)
     m_client.setCursor(cursor);
-#else
-    UNUSED_PARAM(cursor);
-#endif
 }
 
 void Chrome::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
 {
-#if ENABLE(CURSOR_SUPPORT)
     m_client.setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
-#else
-    UNUSED_PARAM(hiddenUntilMouseMoves);
-#endif
 }
 
 PlatformDisplayID Chrome::displayID() const

Modified: trunk/Source/WebCore/page/ChromeClient.h (253635 => 253636)


--- trunk/Source/WebCore/page/ChromeClient.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/page/ChromeClient.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -189,10 +189,9 @@
 
     virtual PlatformPageClient platformPageClient() const = 0;
 
-#if ENABLE(CURSOR_SUPPORT)
     virtual void setCursor(const Cursor&) = 0;
     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
-#endif
+    virtual bool supportsSettingCursor() { return true; }
 
     virtual FloatSize screenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
     virtual FloatSize availableScreenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }

Modified: trunk/Source/WebCore/page/EventHandler.cpp (253635 => 253636)


--- trunk/Source/WebCore/page/EventHandler.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -176,13 +176,11 @@
 const Seconds fakeMouseMoveLongInterval = { 250_ms };
 #endif
 
-#if ENABLE(CURSOR_SUPPORT)
 // The amount of time to wait for a cursor update on style and layout changes
 // Set to 50Hz, no need to be faster than common screen refresh rate
 static const Seconds cursorUpdateInterval { 20_ms };
 
 const int maximumCursorSize = 128;
-#endif
 
 #if ENABLE(MOUSE_CURSOR_SCALE)
 // It's pretty unlikely that a scale of less than one would ever be used. But all we really
@@ -376,9 +374,7 @@
 EventHandler::EventHandler(Frame& frame)
     : m_frame(frame)
     , m_hoverTimer(*this, &EventHandler::hoverTimerFired)
-#if ENABLE(CURSOR_SUPPORT)
     , m_cursorUpdateTimer(*this, &EventHandler::cursorUpdateTimerFired)
-#endif
 #if PLATFORM(MAC)
     , m_pendingMomentumWheelEventsTimer(*this, &EventHandler::clearLatchedState)
 #endif
@@ -415,9 +411,7 @@
 void EventHandler::clear()
 {
     m_hoverTimer.stop();
-#if ENABLE(CURSOR_SUPPORT)
     m_cursorUpdateTimer.stop();
-#endif
 #if !ENABLE(IOS_TOUCH_EVENTS)
     m_fakeMouseMoveEventTimer.stop();
 #endif
@@ -1340,7 +1334,6 @@
     return &downcast<FrameView>(*widget).frame();
 }
 
-#if ENABLE(CURSOR_SUPPORT)
 static bool isSubmitImage(Node* node)
 {
     return is<HTMLInputElement>(node) && downcast<HTMLInputElement>(*node).isImageButton();
@@ -1397,6 +1390,11 @@
     if (m_mousePositionIsUnknown)
         return;
 
+    if (Page* page = m_frame.page()) {
+        if (!page->chrome().client().supportsSettingCursor())
+            return;
+    }
+
     FrameView* view = m_frame.view();
     if (!view)
         return;
@@ -1617,7 +1615,6 @@
     }
     return pointerCursor();
 }
-#endif // ENABLE(CURSOR_SUPPORT)
 
 #if ENABLE(CURSOR_VISIBILITY)
 void EventHandler::startAutoHideCursorTimer()
@@ -1943,9 +1940,7 @@
     if (m_hoverTimer.isActive())
         m_hoverTimer.stop();
 
-#if ENABLE(CURSOR_SUPPORT)
     m_cursorUpdateTimer.stop();
-#endif
 
 #if !ENABLE(IOS_TOUCH_EVENTS)
     cancelFakeMouseMoveEvent();
@@ -2024,10 +2019,8 @@
     }
 
     if (!newSubframe || mouseEvent.scrollbar()) {
-#if ENABLE(CURSOR_SUPPORT)
         if (auto* view = m_frame.view())
             updateCursor(*view, mouseEvent.hitTestResult(), platformMouseEvent.shiftKey());
-#endif
     }
     
     m_lastMouseMoveEventSubframe = newSubframe;
@@ -3059,13 +3052,16 @@
         m_hoverTimer.startOneShot(0_s);
 }
 
-#if ENABLE(CURSOR_SUPPORT)
 void EventHandler::scheduleCursorUpdate()
 {
+    if (Page* page = m_frame.page()) {
+        if (!page->chrome().client().supportsSettingCursor())
+            return;
+    }
+
     if (!m_cursorUpdateTimer.isActive())
         m_cursorUpdateTimer.startOneShot(cursorUpdateInterval);
 }
-#endif
 
 void EventHandler::dispatchFakeMouseMoveEventSoon()
 {

Modified: trunk/Source/WebCore/page/EventHandler.h (253635 => 253636)


--- trunk/Source/WebCore/page/EventHandler.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/page/EventHandler.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -175,9 +175,7 @@
 #endif
 
     void scheduleHoverStateUpdate();
-#if ENABLE(CURSOR_SUPPORT)
     void scheduleCursorUpdate();
-#endif
 
     void setResizingFrameSet(HTMLFrameSetElement*);
 
@@ -377,10 +375,7 @@
     void updateCursor(FrameView&, const HitTestResult&, bool shiftKey);
 
     void hoverTimerFired();
-
-#if ENABLE(CURSOR_SUPPORT)
     void cursorUpdateTimerFired();
-#endif
 
     bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = nullptr);
     
@@ -523,10 +518,7 @@
 #endif
 
     Timer m_hoverTimer;
-
-#if ENABLE(CURSOR_SUPPORT)
     Timer m_cursorUpdateTimer;
-#endif
 
 #if PLATFORM(MAC)
     Timer m_pendingMomentumWheelEventsTimer;

Modified: trunk/Source/WebCore/platform/Cursor.cpp (253635 => 253636)


--- trunk/Source/WebCore/platform/Cursor.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/platform/Cursor.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "Cursor.h"
 
-#if !PLATFORM(IOS_FAMILY)
-
 #include "Image.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
@@ -181,7 +179,7 @@
 {
 }
 
-#if !PLATFORM(COCOA)
+#if !HAVE(NSCURSOR)
 
 PlatformCursor Cursor::platformCursor() const
 {
@@ -449,7 +447,7 @@
     return c;
 }
 
-#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WIN)
+#if !HAVE(NSCURSOR) && !PLATFORM(GTK) && !PLATFORM(WIN)
 void Cursor::ensurePlatformCursor() const
 {
     notImplemented();
@@ -456,7 +454,11 @@
 }
 #endif
 
+#if !HAVE(NSCURSOR)
+void Cursor::setAsPlatformCursor() const
+{
+    notImplemented();
+}
+#endif
+
 } // namespace WebCore
-
-#endif // !PLATFORM(IOS_FAMILY)
-

Modified: trunk/Source/WebCore/platform/Cursor.h (253635 => 253636)


--- trunk/Source/WebCore/platform/Cursor.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/platform/Cursor.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -40,7 +40,7 @@
 #include "GRefPtrGtk.h"
 #endif
 
-#if USE(APPKIT)
+#if HAVE(NSCURSOR)
 OBJC_CLASS NSCursor;
 #endif
 
@@ -70,7 +70,7 @@
 
 #if PLATFORM(WIN)
 using PlatformCursor = RefPtr<SharedCursor>;
-#elif USE(APPKIT)
+#elif HAVE(NSCURSOR)
 using PlatformCursor = NSCursor *;
 #elif PLATFORM(GTK)
 using PlatformCursor = GRefPtr<GdkCursor>;
@@ -130,8 +130,6 @@
 
     Cursor() = default;
 
-#if !PLATFORM(IOS_FAMILY)
-
     WEBCORE_EXPORT static const Cursor& fromType(Cursor::Type);
 
     WEBCORE_EXPORT Cursor(Image*, const IntPoint& hotSpot);
@@ -154,6 +152,8 @@
 
     WEBCORE_EXPORT PlatformCursor platformCursor() const;
 
+    WEBCORE_EXPORT void setAsPlatformCursor() const;
+
 private:
     void ensurePlatformCursor() const;
 
@@ -166,13 +166,12 @@
     float m_imageScaleFactor { 1 };
 #endif
 
-#if !USE(APPKIT)
+#if !HAVE(NSCURSOR)
     mutable PlatformCursor m_platformCursor { nullptr };
 #else
     mutable RetainPtr<NSCursor> m_platformCursor;
 #endif
 
-#endif // !PLATFORM(IOS_FAMILY)
 };
 
 IntPoint determineHotSpot(Image*, const IntPoint& specifiedHotSpot);
@@ -221,8 +220,6 @@
 const Cursor& grabCursor();
 const Cursor& grabbingCursor();
 
-#if !PLATFORM(IOS_FAMILY)
-
 inline Cursor::Type Cursor::type() const
 {
     ASSERT(m_type >= 0);
@@ -230,6 +227,4 @@
     return m_type;
 }
 
-#endif
-
 } // namespace WebCore

Deleted: trunk/Source/WebCore/platform/ios/CursorIOS.cpp (253635 => 253636)


--- trunk/Source/WebCore/platform/ios/CursorIOS.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/platform/ios/CursorIOS.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#include "config.h"
-#include "Cursor.h"
-
-#if PLATFORM(IOS_FAMILY)
-
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-
-static const Cursor& cursor()
-{
-    static NeverDestroyed<const Cursor> cursor;
-    return cursor;
-}
-
-const Cursor& pointerCursor()
-{
-    return cursor();
-}
-
-const Cursor& crossCursor()
-{
-    return cursor();
-}
-
-const Cursor& handCursor()
-{
-    return cursor();
-}
-
-const Cursor& moveCursor()
-{
-    return cursor();
-}
-
-const Cursor& iBeamCursor()
-{
-    return cursor();
-}
-
-const Cursor& waitCursor()
-{
-    return cursor();
-}
-
-const Cursor& helpCursor()
-{
-    return cursor();
-}
-
-const Cursor& eastResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northEastResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northWestResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& southResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& southEastResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& southWestResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& westResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northSouthResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& eastWestResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northEastSouthWestResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& northWestSouthEastResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& columnResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& rowResizeCursor()
-{
-    return cursor();
-}
-
-const Cursor& middlePanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& eastPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& northPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& northEastPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& northWestPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& southPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& southEastPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& southWestPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& westPanningCursor()
-{
-    return cursor();
-}
-
-const Cursor& verticalTextCursor()
-{
-    return cursor();
-}
-
-const Cursor& cellCursor()
-{
-    return cursor();
-}
-
-const Cursor& contextMenuCursor()
-{
-    return cursor();
-}
-
-const Cursor& noDropCursor()
-{
-    return cursor();
-}
-
-const Cursor& notAllowedCursor()
-{
-    return cursor();
-}
-
-const Cursor& progressCursor()
-{
-    return cursor();
-}
-
-const Cursor& aliasCursor()
-{
-    return cursor();
-}
-
-const Cursor& zoomInCursor()
-{
-    return cursor();
-}
-
-const Cursor& zoomOutCursor()
-{
-    return cursor();
-}
-
-const Cursor& copyCursor()
-{
-    return cursor();
-}
-
-const Cursor& noneCursor()
-{
-    return cursor();
-}
-
-const Cursor& grabCursor()
-{
-    return cursor();
-}
-
-const Cursor& grabbingCursor()
-{
-    return cursor();
-}
-
-IntPoint determineHotSpot(Image*, const IntPoint&)
-{
-    return IntPoint();
-}
-
-}
-
-#endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebCore/platform/ios/WidgetIOS.mm (253635 => 253636)


--- trunk/Source/WebCore/platform/ios/WidgetIOS.mm	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/platform/ios/WidgetIOS.mm	2019-12-17 19:57:25 UTC (rev 253636)
@@ -32,7 +32,9 @@
 #import "Document.h"
 #import "FontCascade.h"
 #import "Frame.h"
+#import "FrameView.h"
 #import "GraphicsContext.h"
+#import "HostWindow.h"
 #import "PlatformMouseEvent.h"
 #import "ScrollView.h"
 #import "WAKScrollView.h"
@@ -72,8 +74,12 @@
     UNUSED_PARAM(focused);
 }
 
-void Widget::setCursor(const Cursor&)
+void Widget::setCursor(const Cursor& cursor)
 {
+    FrameView* view = root();
+    if (!view)
+        return;
+    view->hostWindow()->setCursor(cursor);
 }
 
 void Widget::show()

Modified: trunk/Source/WebCore/platform/mac/CursorMac.mm (253635 => 253636)


--- trunk/Source/WebCore/platform/mac/CursorMac.mm	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebCore/platform/mac/CursorMac.mm	2019-12-17 19:57:25 UTC (rev 253636)
@@ -26,13 +26,17 @@
 #import "config.h"
 #import "Cursor.h"
 
-#if PLATFORM(MAC)
+#if HAVE(NSCURSOR)
 
+#import <AppKit/NSCursor.h>
 #import <objc/runtime.h>
-#import <pal/spi/mac/HIServicesSPI.h>
 #import <wtf/BlockObjCExceptions.h>
 #import <wtf/StdLibExtras.h>
 
+#if HAVE(HISERVICES)
+#import <pal/spi/mac/HIServicesSPI.h>
+#endif
+
 @interface WebCoreCursorBundle : NSObject { }
 @end
 
@@ -40,7 +44,9 @@
 @end
 
 namespace WebCore {
-    
+
+#if HAVE(HISERVICES)
+
 static NSCursor *busyButClickableNSCursor;
 static NSCursor *makeAliasNSCursor;
 static NSCursor *moveNSCursor;
@@ -174,9 +180,19 @@
     return *slot;
 }
 
+#else
+
+static NSCursor *cursor(const char *)
+{
+    return [NSCursor arrowCursor];
+}
+
+#endif // HAVE(HISERVICES)
+
 // Simple NSCursor calls shouldn't need protection,
 // but creating a cursor with a bad image might throw.
 
+#if ENABLE(CUSTOM_CURSOR_SUPPORT)
 #if ENABLE(MOUSE_CURSOR_SCALE)
 static RetainPtr<NSCursor> createCustomCursor(Image* image, const IntPoint& hotSpot, float scale)
 #else
@@ -215,6 +231,7 @@
     END_BLOCK_OBJC_EXCEPTIONS;
     return nullptr;
 }
+#endif // ENABLE(CUSTOM_CURSOR_SUPPORT)
 
 void Cursor::ensurePlatformCursor() const
 {
@@ -344,7 +361,11 @@
         break;
 
     case Cursor::None:
+#if ENABLE(CUSTOM_CURSOR_SUPPORT)
         m_platformCursor = adoptNS([[NSCursor alloc] initWithImage:adoptNS([[NSImage alloc] initWithSize:NSMakeSize(1, 1)]).get() hotSpot:NSZeroPoint]);
+#else
+        m_platformCursor = [NSCursor arrowCursor];
+#endif
         break;
 
     case Cursor::NotAllowed:
@@ -368,11 +389,13 @@
         break;
 
     case Cursor::Custom:
+#if ENABLE(CUSTOM_CURSOR_SUPPORT)
 #if ENABLE(MOUSE_CURSOR_SCALE)
         m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot, m_imageScaleFactor);
 #else
         m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot);
-#endif
+#endif // ENABLE(MOUSE_CURSOR_SCALE)
+#endif // ENABLE(CUSTOM_CURSOR_SUPPORT)
         break;
     }
 }
@@ -383,6 +406,14 @@
     return m_platformCursor.get();
 }
 
+void Cursor::setAsPlatformCursor() const
+{
+    NSCursor *cursor = platformCursor();
+    if ([NSCursor currentCursor] == cursor)
+        return;
+    [cursor set];
+}
+
 } // namespace WebCore
 
-#endif // PLATFORM(MAC)
+#endif // HAVE(NSCURSOR)

Modified: trunk/Source/WebKit/ChangeLog (253635 => 253636)


--- trunk/Source/WebKit/ChangeLog	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/ChangeLog	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1,3 +1,26 @@
+2019-12-17  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Cursor should update on mouse movement and style change
+        https://bugs.webkit.org/show_bug.cgi?id=205317
+        <rdar://problem/46793696>
+
+        Reviewed by Anders Carlsson.
+
+        * Configurations/WebKit.xcconfig:
+        Link AppKit for NSCursor.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<Cursor>::decode):
+        Enable Cursor encoders.
+
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::setCursor):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Unifdef various things.
+        Implement setCursor().
+
 2019-12-17  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] IndexedDB directory set in WebsiteDataManager is ignored

Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (253635 => 253636)


--- trunk/Source/WebKit/Configurations/WebKit.xcconfig	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig	2019-12-17 19:57:25 UTC (rev 253636)
@@ -46,6 +46,7 @@
 
 WK_APPKIT_LDFLAGS = $(WK_APPKIT_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_APPKIT_LDFLAGS_macosx = -framework AppKit;
+WK_APPKIT_LDFLAGS_maccatalyst = -framework AppKit;
 
 WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_ASSERTION_SERVICES_LDFLAGS_cocoatouch = -framework AssertionServices;

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (253635 => 253636)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1125,7 +1125,6 @@
     return decodeOptionalNativeImage(decoder, imageHandle.image);
 }
 
-#if !PLATFORM(IOS_FAMILY)
 void ArgumentCoder<Cursor>::encode(Encoder& encoder, const Cursor& cursor)
 {
     encoder.encodeEnum(cursor.type());
@@ -1196,7 +1195,6 @@
 #endif
     return true;
 }
-#endif
 
 void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequest& resourceRequest)
 {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (253635 => 253636)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2019-12-17 19:57:25 UTC (rev 253636)
@@ -39,10 +39,8 @@
 #endif // ENABLE(WEBGL)
     DidChangeViewportProperties(struct WebCore::ViewportAttributes attributes)
     DidReceiveEvent(uint32_t type, bool handled)
-#if !PLATFORM(IOS_FAMILY)
     SetCursor(WebCore::Cursor cursor)
     SetCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
-#endif
     SetStatusText(String statusText)
     SetFocus(bool focused)
     TakeFocus(uint32_t direction)

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (253635 => 253636)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-12-17 19:57:25 UTC (rev 253636)
@@ -57,6 +57,7 @@
 #import "WebPageProxy.h"
 #import "WebProcessProxy.h"
 #import "_WKDownloadInternal.h"
+#import <WebCore/Cursor.h>
 #import <WebCore/DOMPasteAccess.h>
 #import <WebCore/DictionaryLookup.h>
 #import <WebCore/NotImplemented.h>
@@ -266,9 +267,14 @@
     return [m_contentView bounds];
 }
 
-void PageClientImpl::setCursor(const Cursor&)
+void PageClientImpl::setCursor(const Cursor& cursor)
 {
-    notImplemented();
+    // The Web process may have asked to change the cursor when the view was in an active window, but
+    // if it is no longer in a window or the window is not active, then the cursor should not change.
+    if (!isViewWindowActive())
+        return;
+
+    cursor.setAsPlatformCursor();
 }
 
 void PageClientImpl::setCursorHiddenUntilMouseMoves(bool)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (253635 => 253636)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2019-12-17 19:57:25 UTC (rev 253636)
@@ -822,8 +822,6 @@
     loader.iconLoaded(createIconForFiles(filenames));
 }
 
-#if !PLATFORM(IOS_FAMILY)
-
 void WebChromeClient::setCursor(const Cursor& cursor)
 {
     m_page.send(Messages::WebPageProxy::SetCursor(cursor));
@@ -834,6 +832,8 @@
     m_page.send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves));
 }
 
+#if !PLATFORM(IOS_FAMILY)
+
 RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames)
 {
     return Icon::createIconForFiles(filenames);

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (253635 => 253636)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -191,9 +191,10 @@
     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) final;
     void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final;
 
-#if !PLATFORM(IOS_FAMILY)
     void setCursor(const WebCore::Cursor&) final;
     void setCursorHiddenUntilMouseMoves(bool) final;
+#if !HAVE(NSCURSOR)
+    bool supportsSettingCursor() final { return false; }
 #endif
 
 #if ENABLE(POINTER_LOCK)

Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (253635 => 253636)


--- trunk/Source/WebKitLegacy/ios/ChangeLog	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog	2019-12-17 19:57:25 UTC (rev 253636)
@@ -1,3 +1,14 @@
+2019-12-17  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Cursor should update on mouse movement and style change
+        https://bugs.webkit.org/show_bug.cgi?id=205317
+        <rdar://problem/46793696>
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        Provide a stub implementation of cursor-related ChromeClient methods.
+
 2019-12-14  David Kilzer  <ddkil...@apple.com>
 
         Add release assert for selectedIndex in WebKit::WebPopupMenu::show()

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h (253635 => 253636)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2019-12-17 19:50:48 UTC (rev 253635)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h	2019-12-17 19:57:25 UTC (rev 253636)
@@ -50,6 +50,9 @@
     void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) final;
     void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final;
 
+    void setCursor(const WebCore::Cursor&) final { }
+    void setCursorHiddenUntilMouseMoves(bool) final { }
+
 #if ENABLE(TOUCH_EVENTS)
     void didPreventDefaultForEvent() final;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to