macCatalyst: Cursor should update on mouse movement and style change
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2019 19:57:25 +0000 (19:57 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2019 19:57:25 +0000 (19:57 +0000)
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).

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

26 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/platform/Cursor.cpp
Source/WebCore/platform/Cursor.h
Source/WebCore/platform/ios/CursorIOS.cpp [deleted file]
Source/WebCore/platform/ios/WidgetIOS.mm
Source/WebCore/platform/mac/CursorMac.mm
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h

index 214bd05..8a3c86d 100644 (file)
@@ -1,3 +1,23 @@
+2019-12-17  Tim Horton  <timothy_horton@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  <ysuzuki@apple.com>
 
         [JSC] Remove ArrayBufferNeuteringWatchpointSet
index f9be441..682a1e8 100644 (file)
@@ -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 @@ the public iOS SDK. See <https://webkit.org/b/179167>. */
 #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)
index 90f7bda..0047501 100644 (file)
 
 #define HAVE_RUNLOOP_TIMER 1
 #define HAVE_SEC_KEYCHAIN 1
+#define HAVE_HISERVICES 1
 #define USE_APPKIT 1
 #define USE_PASSKIT 1
 
 
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
 #define HAVE_APPLE_GRAPHICS_CONTROL 1
+#define HAVE_NSCURSOR 1
 #endif
 
 #if PLATFORM(MAC)
index ce9a9a5..07510c4 100644 (file)
@@ -1,3 +1,59 @@
+2019-12-17  Tim Horton  <timothy_horton@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  <antti@apple.com>
 
         REGRESSION: ASSERTION FAILED: FontCache::singleton().generation() == m_generation
index be2628b..5ba1174 100644 (file)
@@ -73,6 +73,7 @@ UNEXPORTED_SYMBOLS_FILE = Configurations/WebCore.unexp;
 
 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;
index 98c3eb1..22e0dff 100644 (file)
@@ -384,7 +384,6 @@ platform/graphics/opengl/TemporaryOpenGLSetting.cpp
 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/WKGraphics.mm
 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
index 5511e0e..09f0a1d 100644 (file)
                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, ); }; };
                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>"; };
                                F48223121E386E240066FC79 /* AbstractPasteboard.h */,
                                CE5169E521F1B84700EA4F78 /* ColorIOS.h */,
                                CE5169E621F1B84700EA4F78 /* ColorIOS.mm */,
-                               2655414B1489AA2B000DFC5D /* CursorIOS.cpp */,
                                A1ED778A1BE3293F00DC1791 /* Device.cpp */,
                                A1ED778B1BE3294000DC1791 /* Device.h */,
                                31EAF97C121435A400E7C1BF /* DeviceMotionClientIOS.h */,
                                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 */,
index 5e24dad..78957bb 100644 (file)
@@ -142,10 +142,8 @@ class EmptyChromeClient : public ChromeClient {
     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 { }
 
index 15512ca..7b8e75b 100644 (file)
@@ -486,20 +486,12 @@ void Chrome::dispatchViewportPropertiesDidChange(const ViewportArguments& argume
 
 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
index d781f35..62617f7 100644 (file)
@@ -189,10 +189,9 @@ public:
 
     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(); }
index bd872c6..cadb790 100644 (file)
@@ -176,13 +176,11 @@ const Seconds fakeMouseMoveShortInterval = { 100_ms };
 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 @@ inline bool EventHandler::eventLoopHandleMouseDragged(const MouseEventWithHitTes
 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 @@ DragState& EventHandler::dragState()
 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 @@ Frame* EventHandler::subframeForTargetNode(Node* node)
     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 @@ void EventHandler::updateCursor()
     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 @@ Optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bool sh
     }
     return pointerCursor();
 }
-#endif // ENABLE(CURSOR_SUPPORT)
 
 #if ENABLE(CURSOR_VISIBILITY)
 void EventHandler::startAutoHideCursorTimer()
@@ -1943,9 +1940,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE
     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 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE
     }
 
     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 @@ void EventHandler::scheduleHoverStateUpdate()
         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()
 {
index 190c6ac..dcbf222 100644 (file)
@@ -175,9 +175,7 @@ public:
 #endif
 
     void scheduleHoverStateUpdate();
-#if ENABLE(CURSOR_SUPPORT)
     void scheduleCursorUpdate();
-#endif
 
     void setResizingFrameSet(HTMLFrameSetElement*);
 
@@ -377,10 +375,7 @@ private:
     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 @@ private:
 #endif
 
     Timer m_hoverTimer;
-
-#if ENABLE(CURSOR_SUPPORT)
     Timer m_cursorUpdateTimer;
-#endif
 
 #if PLATFORM(MAC)
     Timer m_pendingMomentumWheelEventsTimer;
index 7adeae4..df47200 100644 (file)
@@ -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 @@ Cursor::Cursor(Type type)
 {
 }
 
-#if !PLATFORM(COCOA)
+#if !HAVE(NSCURSOR)
 
 PlatformCursor Cursor::platformCursor() const
 {
@@ -449,14 +447,18 @@ const Cursor& grabbingCursor()
     return c;
 }
 
-#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WIN)
+#if !HAVE(NSCURSOR) && !PLATFORM(GTK) && !PLATFORM(WIN)
 void Cursor::ensurePlatformCursor() const
 {
     notImplemented();
 }
 #endif
 
-} // namespace WebCore
-
-#endif // !PLATFORM(IOS_FAMILY)
+#if !HAVE(NSCURSOR)
+void Cursor::setAsPlatformCursor() const
+{
+    notImplemented();
+}
+#endif
 
+} // namespace WebCore
index 48f4313..c9620e2 100644 (file)
@@ -40,7 +40,7 @@ typedef HICON HCURSOR;
 #include "GRefPtrGtk.h"
 #endif
 
-#if USE(APPKIT)
+#if HAVE(NSCURSOR)
 OBJC_CLASS NSCursor;
 #endif
 
@@ -70,7 +70,7 @@ private:
 
 #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 @@ public:
 
     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 @@ public:
 
     WEBCORE_EXPORT PlatformCursor platformCursor() const;
 
+    WEBCORE_EXPORT void setAsPlatformCursor() const;
+
 private:
     void ensurePlatformCursor() const;
 
@@ -166,13 +166,12 @@ private:
     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& noneCursor();
 const Cursor& grabCursor();
 const Cursor& grabbingCursor();
 
-#if !PLATFORM(IOS_FAMILY)
-
 inline Cursor::Type Cursor::type() const
 {
     ASSERT(m_type >= 0);
@@ -230,6 +227,4 @@ inline Cursor::Type Cursor::type() const
     return m_type;
 }
 
-#endif
-
 } // namespace WebCore
diff --git a/Source/WebCore/platform/ios/CursorIOS.cpp b/Source/WebCore/platform/ios/CursorIOS.cpp
deleted file mode 100644 (file)
index 9e5b1d9..0000000
+++ /dev/null
@@ -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)
index 04928f9..3e09c11 100644 (file)
@@ -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 @@ void Widget::setFocus(bool focused)
     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()
index 7fed940..93d6a9a 100644 (file)
 #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 @@ static NSCursor *cursor(const char *name)
     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 @@ static RetainPtr<NSCursor> createCustomCursor(Image* image, const IntPoint& hotS
     END_BLOCK_OBJC_EXCEPTIONS;
     return nullptr;
 }
+#endif // ENABLE(CUSTOM_CURSOR_SUPPORT)
 
 void Cursor::ensurePlatformCursor() const
 {
@@ -344,7 +361,11 @@ void Cursor::ensurePlatformCursor() const
         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 @@ void Cursor::ensurePlatformCursor() const
         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 @@ NSCursor *Cursor::platformCursor() const
     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)
index a4dc7c3..51086db 100644 (file)
@@ -1,3 +1,26 @@
+2019-12-17  Tim Horton  <timothy_horton@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  <cgarcia@igalia.com>
 
         [GTK][WPE] IndexedDB directory set in WebsiteDataManager is ignored
index a3a0188..748967e 100644 (file)
@@ -46,6 +46,7 @@ WK_ACCESSIBILITY_LDFLAGS_MACOS_SINCE_1014 = -weak_library /usr/lib/libAccessibil
 
 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;
index 054e2b9..9aa5ae6 100644 (file)
@@ -1125,7 +1125,6 @@ bool ArgumentCoder<NativeImageHandle>::decode(Decoder& decoder, NativeImageHandl
     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 @@ bool ArgumentCoder<Cursor>::decode(Decoder& decoder, Cursor& cursor)
 #endif
     return true;
 }
-#endif
 
 void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequest& resourceRequest)
 {
index 4def5dc..ddb52fa 100644 (file)
@@ -39,10 +39,8 @@ messages -> WebPageProxy {
 #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)
index a212563..60ba859 100644 (file)
@@ -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 @@ WebCore::FloatRect PageClientImpl::documentRect() const
     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)
index 3abb1c7..8e4c937 100644 (file)
@@ -822,8 +822,6 @@ void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIcon
     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 @@ void WebChromeClient::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
     m_page.send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves));
 }
 
+#if !PLATFORM(IOS_FAMILY)
+
 RefPtr<Icon> WebChromeClient::createIconForFiles(const Vector<String>& filenames)
 {
     return Icon::createIconForFiles(filenames);
index 72ebef5..fda338e 100644 (file)
@@ -191,9 +191,10 @@ private:
     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)
index c55f101..74f73f4 100644 (file)
@@ -1,3 +1,14 @@
+2019-12-17  Tim Horton  <timothy_horton@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  <ddkilzer@apple.com>
 
         Add release assert for selectedIndex in WebKit::WebPopupMenu::show()
index 1457722..b8b7526 100644 (file)
@@ -50,6 +50,9 @@ private:
     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