diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport')
22 files changed, 295 insertions, 76 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 2394141..d4c357d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -27,9 +27,6 @@ #include "config.h" #include "WebChromeClient.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - #include "DrawingArea.h" #include "InjectedBundleNavigationAction.h" #include "InjectedBundleUserMessageCoders.h" @@ -54,6 +51,7 @@ #include <WebCore/FrameView.h> #include <WebCore/HTMLNames.h> #include <WebCore/HTMLPlugInImageElement.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/SecurityOrigin.h> @@ -64,13 +62,15 @@ namespace WebKit { static double area(WebFrame* frame) { - IntSize size = frame->size(); + IntSize size = frame->visibleContentBoundsExcludingScrollbars().size(); return static_cast<double>(size.height()) * size.width(); } static WebFrame* findLargestFrameInFrameSet(WebPage* page) { + // Approximate what a user could consider a default target frame for application menu operations. + WebFrame* mainFrame = page->mainFrame(); if (!mainFrame->isFrameSet()) return 0; @@ -252,11 +252,7 @@ void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLev bool WebChromeClient::canRunBeforeUnloadConfirmPanel() { - bool canRun = false; - if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel(), Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel::Reply(canRun), m_page->pageID())) - return false; - - return canRun; + return m_page->canRunBeforeUnloadConfirmPanel(); } bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) @@ -340,9 +336,9 @@ bool WebChromeClient::shouldInterruptJavaScript() return false; } -bool WebChromeClient::tabsToLinks() const +KeyboardUIMode WebChromeClient::keyboardUIMode() { - return m_page->tabsToLinks(); + return m_page->keyboardUIMode(); } IntRect WebChromeClient::windowResizerRect() const @@ -458,7 +454,7 @@ void WebChromeClient::missingPluginButtonClicked(Element* element) const HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element); - m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url())); + m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url(), pluginElement->getAttribute(pluginspageAttr))); } void WebChromeClient::scrollbarsModeDidChange() const diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 82ba36e..96da752 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -102,8 +102,9 @@ private: virtual bool runJavaScriptPrompt(WebCore::Frame*, const String& message, const String& defaultValue, String& result); virtual void setStatusbarText(const String&); virtual bool shouldInterruptJavaScript(); - virtual bool tabsToLinks() const; - + + virtual WebCore::KeyboardUIMode keyboardUIMode(); + virtual WebCore::IntRect windowResizerRect() const; // Methods used by HostWindow. diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp index 0c83cda..b71bf3c 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp @@ -30,12 +30,10 @@ #include "WebPage.h" #include <WebCore/ContextMenu.h> #include <WebCore/Frame.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/UserGestureIndicator.h> -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - using namespace WebCore; namespace WebKit { diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp index 9e348cd..dfb1542 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp @@ -26,8 +26,7 @@ #include "config.h" #include "WebDragClient.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index 5ed1c60..b954283 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -26,10 +26,8 @@ #include "config.h" #include "WebEditorClient.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - #include "SelectionState.h" +#include "WebCoreArgumentCoders.h" #include "WebFrameLoaderClient.h" #include "WebPage.h" #include "WebPageProxyMessages.h" @@ -43,6 +41,7 @@ #include <WebCore/HTMLNames.h> #include <WebCore/HTMLTextAreaElement.h> #include <WebCore/KeyboardEvent.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/UserTypingGestureIndicator.h> @@ -170,21 +169,21 @@ bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*) void WebEditorClient::didBeginEditing() { // FIXME: What good is a notification name, if it's always the same? - static const String WebViewDidBeginEditingNotification = "WebViewDidBeginEditingNotification"; + DEFINE_STATIC_LOCAL(String, WebViewDidBeginEditingNotification, ("WebViewDidBeginEditingNotification")); m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.impl()); notImplemented(); } void WebEditorClient::respondToChangedContents() { - static const String WebViewDidChangeNotification = "WebViewDidChangeNotification"; + DEFINE_STATIC_LOCAL(String, WebViewDidChangeNotification, ("WebViewDidChangeNotification")); m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.impl()); notImplemented(); } void WebEditorClient::respondToChangedSelection() { - static const String WebViewDidChangeSelectionNotification = "WebViewDidChangeSelectionNotification"; + DEFINE_STATIC_LOCAL(String, WebViewDidChangeSelectionNotification, ("WebViewDidChangeSelectionNotification")); m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl()); Frame* frame = m_page->corePage()->focusController()->focusedFrame(); if (!frame) @@ -193,6 +192,7 @@ void WebEditorClient::respondToChangedSelection() SelectionState selectionState; selectionState.isNone = frame->selection()->isNone(); selectionState.isContentEditable = frame->selection()->isContentEditable(); + selectionState.isContentRichlyEditable = frame->selection()->isContentRichlyEditable(); selectionState.isInPasswordField = frame->selection()->isInPasswordField(); selectionState.hasComposition = frame->editor()->hasComposition(); @@ -213,7 +213,7 @@ void WebEditorClient::respondToChangedSelection() void WebEditorClient::didEndEditing() { - static const String WebViewDidEndEditingNotification = "WebViewDidEndEditingNotification"; + DEFINE_STATIC_LOCAL(String, WebViewDidEndEditingNotification, ("WebViewDidEndEditingNotification")); m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.impl()); notImplemented(); } @@ -251,6 +251,16 @@ void WebEditorClient::clearUndoRedoOperations() m_page->send(Messages::WebPageProxy::ClearAllEditCommands()); } +bool WebEditorClient::canCopyCut(bool defaultValue) const +{ + return defaultValue; +} + +bool WebEditorClient::canPaste(bool defaultValue) const +{ + return defaultValue; +} + bool WebEditorClient::canUndo() const { notImplemented(); @@ -395,9 +405,9 @@ void WebEditorClient::checkGrammarOfString(const UChar*, int, Vector<GrammarDeta notImplemented(); } -void WebEditorClient::updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) +void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail) { - notImplemented(); + m_page->send(Messages::WebPageProxy::UpdateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail)); } void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& misspelledWord) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index 40bd8c6..fa8426a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -27,12 +27,13 @@ #define WebEditorClient_h #include <WebCore/EditorClient.h> +#include <WebCore/TextCheckerClient.h> namespace WebKit { class WebPage; -class WebEditorClient : public WebCore::EditorClient { +class WebEditorClient : public WebCore::EditorClient, public WebCore::TextCheckerClient { public: WebEditorClient(WebPage* page) : m_page(page) @@ -74,6 +75,8 @@ private: virtual void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>); virtual void clearUndoRedoOperations(); + virtual bool canCopyCut(bool defaultValue) const; + virtual bool canPaste(bool defaultValue) const; virtual bool canUndo() const; virtual bool canRedo() const; @@ -120,6 +123,8 @@ private: virtual void toggleAutomaticSpellingCorrection(); #endif + TextCheckerClient* textChecker() { return this; } + virtual void ignoreWordInSpellDocument(const String&); virtual void learnWord(const String&); virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); @@ -140,6 +145,7 @@ private: virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings, WebCore::Editor*); virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel); virtual bool isShowingCorrectionPanel(); + virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const WTF::String& replacedString, const WTF::String& replacementString); #endif WebPage* m_page; }; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 4be913f..3770ca6 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -26,9 +26,6 @@ #include "config.h" #include "WebFrameLoaderClient.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - #include "AuthenticationManager.h" #include "DataReference.h" #include "InjectedBundleNavigationAction.h" @@ -36,6 +33,7 @@ #include "PlatformCertificateInfo.h" #include "PluginView.h" #include "StringPairVector.h" +#include "WebBackForwardListProxy.h" #include "WebContextMessages.h" #include "WebCoreArgumentCoders.h" #include "WebErrors.h" @@ -62,6 +60,7 @@ #include <WebCore/HistoryItem.h> #include <WebCore/MIMETypeRegistry.h> #include <WebCore/MouseEvent.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/PluginData.h> #include <WebCore/ProgressTracker.h> @@ -576,7 +575,7 @@ void WebFrameLoaderClient::dispatchShow() webPage->show(); } -void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& MIMEType, const ResourceRequest& request) +void WebFrameLoaderClient::dispatchDecidePolicyForResponse(FramePolicyFunction function, const ResourceResponse& response, const ResourceRequest& request) { WebPage* webPage = m_frame->page(); if (!webPage) @@ -588,7 +587,11 @@ void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction f RefPtr<APIObject> userData; // Notify the bundle client. - webPage->injectedBundlePolicyClient().decidePolicyForMIMEType(webPage, m_frame, MIMEType, request, userData); + WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForResponse(webPage, m_frame, response, request, userData); + if (policy == WKBundlePagePolicyActionUse) { + (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); + return; + } uint64_t listenerID = m_frame->setUpPolicyListener(function); bool receivedPolicyAction; @@ -596,7 +599,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction f uint64_t downloadID; // Notify the UIProcess. - if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID))) + if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponse(m_frame->frameID(), response, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForResponse::Reply(receivedPolicyAction, policyAction, downloadID))) return; // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback. @@ -615,7 +618,11 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFun RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); // Notify the bundle client. - webPage->injectedBundlePolicyClient().decidePolicyForNewWindowAction(webPage, m_frame, action.get(), request, frameName, userData); + WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNewWindowAction(webPage, m_frame, action.get(), request, frameName, userData); + if (policy == WKBundlePagePolicyActionUse) { + (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); + return; + } uint64_t listenerID = m_frame->setUpPolicyListener(function); @@ -630,24 +637,35 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFu if (!webPage) return; + // Always ignore requests with empty URLs. + if (request.isEmpty()) { + (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyIgnore); + return; + } + RefPtr<APIObject> userData; RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); // Notify the bundle client. - webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.get(), request, userData); + WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.get(), request, userData); + if (policy == WKBundlePagePolicyActionUse) { + (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); + return; + } uint64_t listenerID = m_frame->setUpPolicyListener(function); bool receivedPolicyAction; uint64_t policyAction; + uint64_t downloadID; // Notify the UIProcess. - if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction))) + if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction, downloadID))) return; // We call this synchronously because WebCore cannot gracefully handle a frame load without a synchronous navigation policy reply. if (receivedPolicyAction) - m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), 0); + m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID); } void WebFrameLoaderClient::cancelPolicyCheck() @@ -655,9 +673,19 @@ void WebFrameLoaderClient::cancelPolicyCheck() m_frame->invalidatePolicyListener(); } -void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&) +void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError& error) { - notImplemented(); + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundlePolicyClient().unableToImplementPolicy(webPage, m_frame, error, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::UnableToImplementPolicy(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> prpFormState) @@ -797,7 +825,7 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData(); CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0); - webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(dataReference)); + webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(loader->response().suggestedFilename(), dataReference)); } return; @@ -845,9 +873,28 @@ void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() } } -bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const +bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return false; + + uint64_t itemID = WebBackForwardListProxy::idForItem(item); + if (!itemID) { + // We should never be considering navigating to an item that is not actually in the back/forward list. + ASSERT_NOT_REACHED(); + return false; + } + + bool shouldGoToBackForwardListItem; + if (!webPage->sendSync(Messages::WebPageProxy::ShouldGoToBackForwardListItem(itemID), Messages::WebPageProxy::ShouldGoToBackForwardListItem::Reply(shouldGoToBackForwardListItem))) + return false; + + return shouldGoToBackForwardListItem; +} + +bool WebFrameLoaderClient::shouldStopLoadingForHistoryItem(HistoryItem* item) const { - notImplemented(); return true; } @@ -985,6 +1032,11 @@ void WebFrameLoaderClient::restoreViewState() // Inform the UI process of the scale factor. double scaleFactor = m_frame->coreFrame()->loader()->history()->currentItem()->pageScaleFactor(); m_frame->page()->send(Messages::WebPageProxy::ViewScaleFactorDidChange(scaleFactor)); + + // FIXME: This should not be necessary. WebCore should be correctly invalidating + // the view on restores from the back/forward cache. + if (m_frame == m_frame->page()->mainFrame()) + m_frame->page()->drawingArea()->setNeedsDisplay(m_frame->page()->bounds()); } void WebFrameLoaderClient::provisionalLoadStarted() @@ -1273,6 +1325,23 @@ bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) c return false; } +void WebFrameLoaderClient::didChangeScrollOffset() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + if (!m_frame->isMainFrame()) + return; + + // If this is called when tearing down a FrameView, the WebCore::Frame's + // current FrameView will be null. + if (!m_frame->coreFrame()->view()) + return; + + webPage->didChangeScrollOffsetForMainFrame(); +} + PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext() { return WebFrameNetworkingContext::create(m_frame->coreFrame()); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index 9070b3a..9ca9a75 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -97,7 +97,7 @@ private: virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); - virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const String& MIMEType, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, const String& frameName); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>); virtual void cancelPolicyCheck(); @@ -132,6 +132,7 @@ private: virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const; virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; virtual void dispatchDidChangeBackForwardIndex() const; @@ -213,7 +214,9 @@ private: #endif virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const; - + + virtual void didChangeScrollOffset(); + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); WebFrame* m_frame; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp index 80552f0..7a91dcd 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp @@ -32,11 +32,9 @@ #include "WebInspector.h" #include "WebPage.h" #include <WebCore/InspectorController.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - using namespace WebCore; namespace WebKit { diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp index 6298293..d429464 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp @@ -30,12 +30,10 @@ #include "WebInspector.h" #include "WebPage.h" +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <wtf/text/WTFString.h> -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - using namespace WebCore; namespace WebKit { @@ -94,9 +92,9 @@ void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) notImplemented(); } -void WebInspectorFrontendClient::inspectedURLChanged(const String&) +void WebInspectorFrontendClient::inspectedURLChanged(const String& urlString) { - notImplemented(); + m_page->inspector()->inspectedURLChanged(urlString); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index 479252a..7e14701 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 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 @@ -28,24 +28,34 @@ #if USE(PLATFORM_STRATEGIES) -#include "NotImplemented.h" #include "PluginInfoStore.h" #include "WebContextMessages.h" +#include "WebCookieManager.h" #include "WebCoreArgumentCoders.h" #include "WebProcess.h" +#include <WebCore/LocalizedStrings.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/PageGroup.h> #include <wtf/MathExtras.h> #include <wtf/text/CString.h> -#if PLATFORM(CF) +#if USE(CF) #include <wtf/RetainPtr.h> #endif -// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized +#if PLATFORM(MAC) + +#define UI_STRING(string, description) localizedString(string) +#define UI_STRING_KEY(string, key, description) localizedString(key) + +#else + #define UI_STRING(string, description) String::fromUTF8(string, strlen(string)) #define UI_STRING_KEY(string, key, description) String::fromUTF8(string, strlen(string)) +#endif + using namespace WebCore; namespace WebKit { @@ -57,7 +67,7 @@ namespace WebKit { // type according to section 18.7/3 of the C++ N1905 standard. static String formatLocalizedString(String format, ...) { -#if PLATFORM(CF) +#if USE(CF) va_list arguments; va_start(arguments, format); RetainPtr<CFStringRef> formatCFString(AdoptCF, format.createCFString()); @@ -89,7 +99,10 @@ WebPlatformStrategies::WebPlatformStrategies() { } -// PluginStrategy +CookiesStrategy* WebPlatformStrategies::createCookiesStrategy() +{ + return this; +} PluginStrategy* WebPlatformStrategies::createPluginStrategy() { @@ -106,6 +119,13 @@ VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() return this; } +// CookiesStrategy + +void WebPlatformStrategies::notifyCookiesChanged() +{ + WebCookieManager::shared().dispatchCookiesDidChange(); +} + // PluginStrategy void WebPlatformStrategies::populatePluginCache() @@ -175,6 +195,11 @@ String WebPlatformStrategies::fileButtonNoFileSelectedLabel() return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected"); } +String WebPlatformStrategies::defaultDetailsSummaryText() +{ + return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child"); +} + #if PLATFORM(MAC) String WebPlatformStrategies::copyImageUnknownFileLabel() { @@ -748,8 +773,8 @@ String WebPlatformStrategies::allFilesText() String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size) { - // FIXME: It would be nice to have the filename inside the format string, but it's not easy to do that in a way that works with non-ASCII characters in the filename. - return filename + formatLocalizedString(UI_STRING(" %d×%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()); + // FIXME: This should format the numbers correctly. In Mac WebKit, we used +[NSNumberFormatter localizedStringFromNumber:numberStyle:]. + return formatLocalizedString(UI_STRING("<filename> %d×%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("<filename>", filename); } String WebPlatformStrategies::mediaElementLoadingStateText() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h index a763475..92f8236 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -28,6 +28,7 @@ #if USE(PLATFORM_STRATEGIES) +#include <WebCore/CookiesStrategy.h> #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> #include <WebCore/LocalizationStrategy.h> @@ -35,7 +36,7 @@ namespace WebKit { -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { public: static void initialize(); @@ -43,10 +44,14 @@ private: WebPlatformStrategies(); // WebCore::PlatformStrategies + virtual WebCore::CookiesStrategy* createCookiesStrategy(); virtual WebCore::PluginStrategy* createPluginStrategy(); virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); + // WebCore::CookiesStrategy + virtual void notifyCookiesChanged(); + // WebCore::PluginStrategy virtual void refreshPlugins(); virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&); @@ -58,6 +63,7 @@ private: virtual String submitButtonDefaultLabel(); virtual String fileButtonChooseFileLabel(); virtual String fileButtonNoFileSelectedLabel(); + virtual String defaultDetailsSummaryText(); #if PLATFORM(MAC) virtual String copyImageUnknownFileLabel(); #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp index b21be47..d91520e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "WebContextMenuClient.h" -#include "NotImplemented.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp new file mode 100644 index 0000000..7791349 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. + * + * 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. AND ITS CONTRIBUTORS ``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 ITS 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 "WebErrors.h" + +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> +#include <glib/gi18n-lib.h> +#include <webkit/webkiterror.h> + +using namespace WebCore; + +namespace WebKit { + +ResourceError cancelledError(const ResourceRequest& request) +{ + return ResourceError(g_quark_to_string(WEBKIT_NETWORK_ERROR), WEBKIT_NETWORK_ERROR_CANCELLED, + request.url().string(), _("Load request cancelled")); +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT, + request.url().string(), _("Not allowed to use restricted network port")); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL, + request.url().string(), _("URL cannot be shown")); +} + +ResourceError interruptForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE, + request.url().string(), _("Frame load was interrupted")); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE, + response.url().string(), _("Content with the specified MIME type cannot be shown")); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError(g_quark_to_string(WEBKIT_NETWORK_ERROR), WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST, + response.url().string(), _("File does not exist")); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError(g_quark_to_string(WEBKIT_PLUGIN_ERROR), WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, + response.url().string(), _("Plugin will handle load")); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp index b6d71bb..154b022 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "WebPopupMenu.h" -#include "NotImplemented.h" #include "PlatformPopupMenuData.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm index 750a397..7d91c56 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm @@ -26,9 +26,12 @@ #import "config.h" #import "WebContextMenuClient.h" -#import "NotImplemented.h" +#import "DictionaryPopupInfo.h" +#import "WebCoreArgumentCoders.h" #import "WebPage.h" +#import "WebPageProxyMessages.h" #import <WebCore/Frame.h> +#import <WebCore/FrameView.h> #import <WebCore/Page.h> #import <wtf/text/WTFString.h> @@ -36,10 +39,13 @@ using namespace WebCore; namespace WebKit { -void WebContextMenuClient::lookUpInDictionary(Frame*) +void WebContextMenuClient::lookUpInDictionary(Frame* frame) { - // FIXME: <rdar://problem/8750610> - Implement - notImplemented(); + RefPtr<Range> selectedRange = frame->selection()->selection().toNormalizedRange(); + if (!selectedRange) + return; + + m_page->performDictionaryLookupForRange(DictionaryPopupInfo::ContextMenu, frame, selectedRange.get()); } bool WebContextMenuClient::isSpeaking() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm index 5169b23..ae9cec3 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm @@ -63,7 +63,7 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const NSGraphicsContext* bitmapContext = [NSGraphicsContext graphicsContextWithGraphicsPort:graphicsContext->platformContext() flipped:YES]; [NSGraphicsContext setCurrentContext: bitmapContext]; - [dragNSImage drawInRect:NSMakeRect(0, 0, [dragNSImage size].width , [dragNSImage size].height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1]; + [dragNSImage drawInRect:NSMakeRect(0, 0, [dragNSImage size].width , [dragNSImage size].height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1 respectFlipped:YES hints:nil]; [NSGraphicsContext restoreGraphicsState]; SharedMemory::Handle handle; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm index ee87ea2..8af0438 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -30,9 +30,6 @@ #import "config.h" #import "WebEditorClient.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#import "NotImplemented.h" - #import "WebCoreArgumentCoders.h" #import "WebPage.h" #import "WebFrame.h" @@ -45,6 +42,7 @@ #import <WebCore/FocusController.h> #import <WebCore/Frame.h> #import <WebCore/KeyboardEvent.h> +#import <WebCore/NotImplemented.h> #import <WebCore/Page.h> #import <WebKit/WebResource.h> #import <WebKit/WebNSURLExtras.h> @@ -264,6 +262,11 @@ bool WebEditorClient::isShowingCorrectionPanel() notImplemented(); return false; } + +void WebEditorClient::recordAutocorrectionResponse(EditorClient::AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString) +{ + notImplemented(); +} #endif } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm index 7e446b7..e36f438 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm @@ -27,13 +27,25 @@ #import "WebPopupMenu.h" #import "PlatformPopupMenuData.h" +#import <WebCore/Frame.h> +#import <WebCore/FrameView.h> +#import <WebCore/PopupMenuClient.h> using namespace WebCore; namespace WebKit { -void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data) { + NSFont *font = m_popupClient->menuStyle().font().primaryFont()->getNSFont(); + if (!font) + return; + + CFDictionaryRef fontDescriptorAttributes = (CFDictionaryRef)[[font fontDescriptor] fontAttributes]; + if (!fontDescriptorAttributes) + return; + + data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes; } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index 2d74bbc..2c8649e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -93,6 +93,13 @@ void InitWebCoreSystemInterface(void) INIT(SignalCFReadStreamEnd); INIT(SignalCFReadStreamError); INIT(SignalCFReadStreamHasBytes); + INIT(CreatePrivateStorageSession); + INIT(CopyRequestWithStorageSession); + INIT(CreatePrivateInMemoryHTTPCookieStorage); + INIT(GetHTTPCookieAcceptPolicy); + INIT(HTTPCookiesForURL); + INIT(SetHTTPCookiesForURL); + INIT(DeleteHTTPCookie); #if !defined(BUILDING_ON_SNOW_LEOPARD) INIT(IOSurfaceContextCreate); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp index f6c45b0..a09ec19 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "WebContextMenuClient.h" -#include "NotImplemented.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp index b80dccd..b4db406 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp @@ -66,7 +66,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl itemFont.update(m_popupClient->fontSelector()); } - popupWidth = std::max(popupWidth, itemFont.width(TextRun(text.characters(), text.length()))); + popupWidth = std::max<float>(popupWidth, ceilf(itemFont.width(TextRun(text.characters(), text.length())))); } // FIXME: popupWidth should probably take into account monitor constraints as is done with WebPopupMenuProxyWin::calculatePositionAndSize. |