-
https://bugs.webkit.org/show_bug.cgi?id=42232weinig@apple.com authored
Make changing Cursors work in WebKit2. Reviewed by Darin Adler. WebCore: - Converted Mac and Windows Cursor implementations to lazily create the platform cursor. - Add HostWindow function to set the cursor and use it from Widget::setCursor. - Rework Windows cursor code to use fewer global variables. * WebCore.exp.in: Updated * loader/EmptyClients.h: (WebCore::EmptyChromeClient::setCursor): (WebCore::EmptyChromeClient::setLastSetCursorToCurrentCursor): Added empty implementations. * page/Chrome.cpp: (WebCore::Chrome::setCursor): * page/Chrome.h: * page/ChromeClient.h: Change existing setCursor() function to take a Cursor instead of a PlatformCursorHandle. Added setLastSetCursorToCurrentCursor. * platform/Cursor.cpp: * platform/Cursor.h: Added Cursor Type and the option of lazily creating the native cursor (used on Mac and Windows for now). * platform/HostWindow.h: Add setCursor. * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): This no longer needs to call determineHotSpot as that is done when on construction of the cursor now and the hotSpot passed in is correct. (WebCore::Cursor::ensurePlatformCursor): (WebCore::Cursor::Cursor): (WebCore::Cursor::~Cursor): (WebCore::Cursor::operator=): (WebCore::Cursor::platformCursor): Convert to lazily creating the native cursor on the first request and storing the type. * platform/mac/WidgetMac.mm: (WebCore::Widget::setCursor): Use HostWindow::setCursor to set the cursor. This in turn will call the ChromeClient. * platform/win/CursorWin.cpp: (WebCore::createSharedCursor): (WebCore::loadSharedCursor): (WebCore::loadCursorByName): (WebCore::Cursor::ensurePlatformCursor): (WebCore::SharedCursor::~SharedCursor): (WebCore::Cursor::Cursor): (WebCore::Cursor::~Cursor): (WebCore::Cursor::operator=): (WebCore::Cursor::platformCursor): Convert to lazily creating the native cursor on the first request and storing the type. * platform/win/WidgetWin.cpp: (WebCore::Widget::setCursor): Use HostWindow::setCursor to set the cursor. This in turn will call the ChromeClient. * plugins/win/PluginViewWin.cpp: (WebCore::PluginView::handleMouseEvent): Use the new setLastSetCursorToCurrentCursor client function to ensure the cursor is properly updated when over a plugin. * platform/chromium/CursorChromium.cpp: * platform/efl/CursorEfl.cpp: * platform/gtk/CursorGtk.cpp: * platform/haiku/CursorHaiku.cpp: * platform/wince/CursorWince.cpp: * platform/wx/CursorWx.cpp: * platform/qt/CursorQt.cpp: Change m_impl -> m_platformCursor. WebKit: * efl/WebCoreSupport/ChromeClientEfl.cpp: (WebCore::ChromeClientEfl::setCursor): * efl/WebCoreSupport/ChromeClientEfl.h: Change prototype to match new one. WebKit/chromium: * src/ChromeClientImpl.h: (WebKit::ChromeClientImpl::setCursor): Change prototype to match new one. * src/WebPopupMenuImpl.cpp: (WebKit::WebPopupMenuImpl::setCursor): * src/WebPopupMenuImpl.h: Add empty setCursor function to satisfy the HostWindow interface. WebKit/gtk: * WebCoreSupport/ChromeClientGtk.cpp: (WebKit::ChromeClient::setCursor): * WebCoreSupport/ChromeClientGtk.h: Change prototype to match new one. WebKit/haiku: * WebCoreSupport/ChromeClientHaiku.cpp: (WebCore::ChromeClientHaiku::setCursor): * WebCoreSupport/ChromeClientHaiku.h: Change prototype to match new one. WebKit/mac: * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::setCursor): * WebView/WebView.mm: Implement cursor changing at the WebKit level for the sake of WebKit2. This functionality is being moved from WidgetMac.mm. (+[WebView _pointingHandCursor]): Update to use platformCursor() instead of impl(). WebKit/qt: * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::setCursor): * WebCoreSupport/ChromeClientQt.h: Change prototype to match new one. WebKit/win: * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::setCursor): We now need to grab the native cursor out of the WebCore cursor. (WebChromeClient::setLastSetCursorToCurrentCursor): Sets the WebView's "last set cursor" to be the current cursor so that the cursor is set correctly for plugins. * WebCoreSupport/WebChromeClient.h: * WebView.cpp: (WebView::WebView): (WebView::WebViewWndProc): * WebView.h: (WebView::setLastCursor): Change the "last set cursor" to be stored as a member instead of a global. WebKit/wx: * WebKitSupport/ChromeClientWx.cpp: (WebCore::ChromeClientWx::setCursor): * WebKitSupport/ChromeClientWx.h: Change prototype to match new one. WebKit2: * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Add SetCursor message. * Shared/WebCoreArgumentCoders.h: Add encoding/decoding of Cursors. For now we don't support Custom cursors. * UIProcess/API/mac/PageClientImpl.h: * UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::setCursor): * UIProcess/PageClient.h: Add pass through functions to get the cursor from the WebPageProxy to the WKView. * UIProcess/API/mac/WKView.mm: (-[WKView _setCursor:]): * UIProcess/API/mac/WKViewInternal.h: Implement changing the cursor. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didReceiveMessage): (WebKit::WebPageProxy::setCursor): * UIProcess/WebPageProxy.h: Decode the cursor. * UIProcess/win/WebView.cpp: (WebKit::WebView::wndProc): (WebKit::WebView::WebView): (WebKit::WebView::onSetCursor): (WebKit::WebView::setCursor): * UIProcess/win/WebView.h: Implement changing the cursor. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setCursor): (WebKit::WebChromeClient::setLastSetCursorToCurrentCursor): * WebProcess/WebCoreSupport/WebChromeClient.h: Encode the cursor when setCursor is called. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ee7d0271