diff options
Diffstat (limited to 'WebKit/win/WebCoreSupport')
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebChromeClient.cpp | 39 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebChromeClient.h | 4 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebContextMenuClient.cpp | 74 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebContextMenuClient.h | 4 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebEditorClient.cpp | 2 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebEditorClient.h | 3 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp | 8 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebFrameLoaderClient.h | 3 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebGeolocationClient.cpp | 30 | ||||
| -rw-r--r-- | WebKit/win/WebCoreSupport/WebGeolocationClient.h | 6 |
10 files changed, 90 insertions, 83 deletions
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index d046c21..9446e15 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -32,7 +32,6 @@ #include "DOMCoreClasses.h" #include "WebElementPropertyBag.h" #include "WebFrame.h" -#include "WebGeolocationPolicyListener.h" #include "WebHistory.h" #include "WebMutableURLRequest.h" #include "WebDesktopNotificationsDelegate.h" @@ -46,7 +45,6 @@ #include <WebCore/FloatRect.h> #include <WebCore/FrameLoadRequest.h> #include <WebCore/FrameView.h> -#include <WebCore/Geolocation.h> #include <WebCore/HTMLNames.h> #include <WebCore/Icon.h> #include <WebCore/LocalWindowsContext.h> @@ -799,17 +797,19 @@ void WebChromeClient::setCursor(const Cursor& cursor) if (!platformCursor) return; + bool shouldSetCursor = true; if (COMPtr<IWebUIDelegate> delegate = uiDelegate()) { COMPtr<IWebUIDelegatePrivate> delegatePrivate(Query, delegate); if (delegatePrivate) { if (SUCCEEDED(delegatePrivate->webViewSetCursor(m_webView, reinterpret_cast<OLE_HANDLE>(platformCursor)))) - return; + shouldSetCursor = false; } } - m_webView->setLastCursor(platformCursor); - ::SetCursor(platformCursor); - return; + if (shouldSetCursor) + ::SetCursor(platformCursor); + + setLastSetCursorToCurrentCursor(); } void WebChromeClient::setLastSetCursorToCurrentCursor() @@ -817,38 +817,15 @@ void WebChromeClient::setLastSetCursorToCurrentCursor() m_webView->setLastCursor(::GetCursor()); } -void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) -{ - COMPtr<IWebUIDelegate> uiDelegate; - if (FAILED(m_webView->uiDelegate(&uiDelegate))) { - geolocation->setIsAllowed(false); - return; - } - - COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, uiDelegate); - if (!uiDelegatePrivate2) { - geolocation->setIsAllowed(false); - return; - } - - COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(frame->document()->securityOrigin())); - COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(geolocation); - HRESULT hr = uiDelegatePrivate2->decidePolicyForGeolocationRequest(m_webView, kit(frame), origin.get(), listener.get()); - if (hr != E_NOTIMPL) - return; - - geolocation->setIsAllowed(false); -} - #if USE(ACCELERATED_COMPOSITING) void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) { - m_webView->setRootChildLayer(graphicsLayer ? static_cast<WKCACFLayer*>(graphicsLayer->platformLayer()) : 0); + m_webView->setRootChildLayer(graphicsLayer ? PlatformCALayer::platformCALayer(graphicsLayer->platformLayer()) : 0); } void WebChromeClient::scheduleCompositingLayerSync() { - m_webView->setRootLayerNeedsDisplay(); + m_webView->setRootLayerNeedsDisplay(true); } #endif diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index 55167b6..b6c2525 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -159,7 +159,9 @@ public: virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {} - virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); + // FIXME: Remove once all ports are using client-based geolocation. https://bugs.webkit.org/show_bug.cgi?id=40373 + // For client-based geolocation, these two methods have been moved to WebGeolocationClient. https://bugs.webkit.org/show_bug.cgi?id=50061 + virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*) { } virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { } #if ENABLE(VIDEO) diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp index 24178f2..9405fc8 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp @@ -32,6 +32,7 @@ #include "WebView.h" #include <WebCore/ContextMenu.h> +#include <WebCore/ContextMenuController.h> #include <WebCore/Event.h> #include <WebCore/Frame.h> #include <WebCore/FrameLoader.h> @@ -54,59 +55,29 @@ void WebContextMenuClient::contextMenuDestroyed() delete this; } -static bool isPreInspectElementTagSafari(IWebUIDelegate* uiDelegate) +PassOwnPtr<ContextMenu> WebContextMenuClient::customizeMenu(PassOwnPtr<ContextMenu> popMenu) { - if (!uiDelegate) - return false; + OwnPtr<ContextMenu> menu = popMenu; - TCHAR modulePath[MAX_PATH]; - DWORD length = ::GetModuleFileName(0, modulePath, WTF_ARRAY_LENGTH(modulePath)); - if (!length) - return false; - - return String(modulePath, length).endsWith("Safari.exe", false); -} - -static HMENU fixMenuReceivedFromOldSafari(IWebUIDelegate* uiDelegate, ContextMenu* originalMenu, HMENU menuFromClient) -{ - ASSERT_ARG(originalMenu, originalMenu); - if (!isPreInspectElementTagSafari(uiDelegate)) - return menuFromClient; - - int count = ::GetMenuItemCount(originalMenu->platformDescription()); - if (count < 1) - return menuFromClient; - - if (::GetMenuItemID(originalMenu->platformDescription(), count - 1) != WebMenuItemTagInspectElement) - return menuFromClient; - - count = ::GetMenuItemCount(menuFromClient); - if (count < 1) - return menuFromClient; - - if (::GetMenuItemID(menuFromClient, count - 1) == WebMenuItemTagInspectElement) - return menuFromClient; - - originalMenu->setPlatformDescription(menuFromClient); - originalMenu->addInspectElementItem(); - return originalMenu->platformDescription(); -} - -HMENU WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu) -{ COMPtr<IWebUIDelegate> uiDelegate; if (FAILED(m_webView->uiDelegate(&uiDelegate))) - return menu->platformDescription(); + return menu.release(); ASSERT(uiDelegate); - HMENU newMenu = 0; + HMENU nativeMenu = menu->nativeMenu(); COMPtr<WebElementPropertyBag> propertyBag; - propertyBag.adoptRef(WebElementPropertyBag::createInstance(menu->hitTestResult())); + propertyBag.adoptRef(WebElementPropertyBag::createInstance(m_webView->page()->contextMenuController()->hitTestResult())); // FIXME: We need to decide whether to do the default before calling this delegate method - if (FAILED(uiDelegate->contextMenuItemsForElement(m_webView, propertyBag.get(), (OLE_HANDLE)(ULONG64)menu->platformDescription(), (OLE_HANDLE*)&newMenu))) - return menu->platformDescription(); - return fixMenuReceivedFromOldSafari(uiDelegate.get(), menu, newMenu); + if (FAILED(uiDelegate->contextMenuItemsForElement(m_webView, propertyBag.get(), (OLE_HANDLE)(ULONG64)nativeMenu, (OLE_HANDLE*)&nativeMenu))) { + ::DestroyMenu(nativeMenu); + return menu.release(); + } + + OwnPtr<ContextMenu> customizedMenu = adoptPtr(new ContextMenu(nativeMenu)); + ::DestroyMenu(nativeMenu); + + return customizedMenu.release(); } void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem* item, const ContextMenu* parentMenu) @@ -120,9 +91,18 @@ void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem* item, const ASSERT(uiDelegate); COMPtr<WebElementPropertyBag> propertyBag; - propertyBag.adoptRef(WebElementPropertyBag::createInstance(parentMenu->hitTestResult())); - - uiDelegate->contextMenuItemSelected(m_webView, item->releasePlatformDescription(), propertyBag.get()); + propertyBag.adoptRef(WebElementPropertyBag::createInstance(m_webView->page()->contextMenuController()->hitTestResult())); + + // This call would leak the MENUITEMINFO's subMenu if it had one, but on Windows, subMenus can't be selected, so there is + // no way we would get to this point. Also, it can't be a separator, because separators cannot be selected. + ASSERT(item->type() != SubmenuType); + ASSERT(item->type() != SeparatorType); + + // ContextMenuItem::nativeMenuItem doesn't set the dwTypeData of the MENUITEMINFO, but no WebKit clients + // use the title in IWebUIDelegate::contextMenuItemSelected, so we don't need to populate it here. + MENUITEMINFO selectedItem = item->nativeMenuItem(); + + uiDelegate->contextMenuItemSelected(m_webView, &selectedItem, propertyBag.get()); } void WebContextMenuClient::downloadURL(const KURL& url) diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.h b/WebKit/win/WebCoreSupport/WebContextMenuClient.h index 6bcb072..ed41c59 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.h +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.h @@ -23,8 +23,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <WebCore/ContextMenu.h> #include <WebCore/ContextMenuClient.h> #include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> class WebView; @@ -34,7 +36,7 @@ public: virtual void contextMenuDestroyed(); - virtual HMENU getCustomMenuFromDefaultItems(WebCore::ContextMenu*); + virtual PassOwnPtr<WebCore::ContextMenu> customizeMenu(PassOwnPtr<WebCore::ContextMenu>); virtual void contextMenuItemSelected(WebCore::ContextMenuItem*, const WebCore::ContextMenu*); virtual void downloadURL(const WebCore::KURL&); diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp index f03ffd6..539259b 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp @@ -758,7 +758,7 @@ bool WebEditorClient::spellingUIIsShowing() return !!showing; } -void WebEditorClient::getGuessesForWord(const String& word, Vector<String>& guesses) +void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) { guesses.clear(); diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.h b/WebKit/win/WebCoreSupport/WebEditorClient.h index 8be6de9..358a365 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.h +++ b/WebKit/win/WebCoreSupport/WebEditorClient.h @@ -107,10 +107,11 @@ public: virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); - virtual void getGuessesForWord(const WTF::String&, Vector<WTF::String>& guesses); + virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool); + virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {} private: WebView* m_webView; diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 24f97ca..7fd2b98 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -720,6 +720,14 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() core(m_webFrame)->createView(IntRect(rect).size(), backgroundColor, transparent, IntSize(), false); } +void WebFrameLoaderClient::didSaveToPageCache() +{ +} + +void WebFrameLoaderClient::didRestoreFromPageCache() +{ +} + void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool) { } diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index 981daec..573b58f 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -108,6 +108,9 @@ public: virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); + virtual void didSaveToPageCache(); + virtual void didRestoreFromPageCache(); + virtual void dispatchDidBecomeFrameset(bool); virtual bool canCachePage() const; diff --git a/WebKit/win/WebCoreSupport/WebGeolocationClient.cpp b/WebKit/win/WebCoreSupport/WebGeolocationClient.cpp index 8a526c4..b1d83fb 100644 --- a/WebKit/win/WebCoreSupport/WebGeolocationClient.cpp +++ b/WebKit/win/WebCoreSupport/WebGeolocationClient.cpp @@ -27,8 +27,14 @@ #include "WebKitDLL.h" #include "WebGeolocationClient.h" +#include "WebFrame.h" +#include "WebGeolocationPolicyListener.h" #include "WebGeolocationPosition.h" +#include "WebSecurityOrigin.h" #include "WebView.h" +#include <WebCore/Frame.h> +#include <WebCore/Geolocation.h> +#include <WebCore/SecurityOrigin.h> using namespace WebCore; @@ -72,3 +78,27 @@ GeolocationPosition* WebGeolocationClient::lastPosition() return 0; #endif } + +void WebGeolocationClient::requestPermission(Geolocation* geolocation) +{ + COMPtr<IWebUIDelegate> uiDelegate; + if (FAILED(m_webView->uiDelegate(&uiDelegate))) { + geolocation->setIsAllowed(false); + return; + } + + COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, uiDelegate); + if (!uiDelegatePrivate2) { + geolocation->setIsAllowed(false); + return; + } + + Frame* frame = geolocation->frame(); + COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(frame->document()->securityOrigin())); + COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(geolocation); + HRESULT hr = uiDelegatePrivate2->decidePolicyForGeolocationRequest(m_webView.get(), kit(frame), origin.get(), listener.get()); + if (hr != E_NOTIMPL) + return; + + geolocation->setIsAllowed(false); +} diff --git a/WebKit/win/WebCoreSupport/WebGeolocationClient.h b/WebKit/win/WebCoreSupport/WebGeolocationClient.h index 2422ae5..c5db134 100644 --- a/WebKit/win/WebCoreSupport/WebGeolocationClient.h +++ b/WebKit/win/WebCoreSupport/WebGeolocationClient.h @@ -30,7 +30,8 @@ #include <WebCore/GeolocationClient.h> namespace WebCore { - class GeolocationPosition; +class Geolocation; +class GeolocationPosition; } class WebView; @@ -45,6 +46,9 @@ public: virtual void setEnableHighAccuracy(bool) { } virtual WebCore::GeolocationPosition* lastPosition(); + virtual void requestPermission(WebCore::Geolocation*); + virtual void cancelPermissionRequest(WebCore::Geolocation*) { } + private: COMPtr<WebView> m_webView; }; |
