diff options
| author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
| commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
| tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/WebProcess/WebCoreSupport | |
| parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
| download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 | |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport')
20 files changed, 277 insertions, 83 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index becf48f..2a81851 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -43,7 +43,6 @@ #include "WebPopupMenu.h" #include "WebPreferencesStore.h" #include "WebProcess.h" -#include "WebProcessProxyMessageKinds.h" #include "WebSearchPopupMenu.h" #include <WebCore/DatabaseTracker.h> #include <WebCore/FileChooser.h> @@ -138,7 +137,7 @@ bool WebChromeClient::canTakeFocus(FocusDirection) void WebChromeClient::takeFocus(FocusDirection direction) { - m_page->send(Messages::WebPageProxy::TakeFocus(direction == FocusDirectionForward ? true : false)); + m_page->send(Messages::WebPageProxy::TakeFocus(direction)); } void WebChromeClient::focusedNodeChanged(Node*) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp index 825a448..6104a50 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp @@ -67,6 +67,8 @@ void WebDatabaseManager::didReceiveMessage(CoreIPC::Connection* connection, Core void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + // FIXME: This could be made more efficient by adding a function to DatabaseTracker // to get both the origins and the Vector of DatabaseDetails for each origin in one // shot. That would avoid taking the numerous locks this requires. @@ -105,11 +107,12 @@ void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const } WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidGetDatabasesByOrigin(originAndDatabasesVector, callbackID), 0); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + Vector<RefPtr<SecurityOrigin> > origins; DatabaseTracker::tracker().origins(origins); @@ -119,37 +122,41 @@ void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const for (size_t i = 0; i < numOrigins; ++i) identifiers[i] = origins[i]->databaseIdentifier(); WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidGetDatabaseOrigins(identifiers, callbackID), 0); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); if (!origin) return; DatabaseTracker::tracker().deleteDatabase(origin.get(), databaseIdentifier); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); if (!origin) return; DatabaseTracker::tracker().deleteOrigin(origin.get()); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::deleteAllDatabases() const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + DatabaseTracker::tracker().deleteAllDatabases(); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + // If the quota is set to a value lower than the current usage, that quota will // "stick" but no data will be purged to meet the new quota. This will simply // prevent new data from being added to databases in that origin. @@ -159,7 +166,6 @@ void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsig return; DatabaseTracker::tracker().setQuota(origin.get(), quota); - WebProcess::shared().terminateIfPossible(); } void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h index 96ed83e..ad91493 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h @@ -46,6 +46,10 @@ public: static void initialize(const String& databaseDirectory); void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const; + +public: + void deleteAllDatabases() const; private: WebDatabaseManager(); @@ -58,8 +62,6 @@ private: void getDatabaseOrigins(uint64_t callbackID) const; void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const; void deleteDatabasesForOrigin(const String& originIdentifier) const; - void deleteAllDatabases() const; - void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const; // WebCore::DatabaseTrackerClient virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp index dfb1542..204810e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp @@ -26,14 +26,16 @@ #include "config.h" #include "WebDragClient.h" -#include <WebCore/NotImplemented.h> +#include "WebPage.h" using namespace WebCore; namespace WebKit { -void WebDragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*) +void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData*) { + if (action == DragDestinationActionLoad) + m_page->willPerformLoadDragDestinationAction(); } void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index b954283..197a0ab 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -26,10 +26,11 @@ #include "config.h" #include "WebEditorClient.h" -#include "SelectionState.h" +#include "EditorState.h" #include "WebCoreArgumentCoders.h" #include "WebFrameLoaderClient.h" #include "WebPage.h" +#include "WebPageProxy.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" #include <WebCore/ArchiveResource.h> @@ -189,16 +190,7 @@ void WebEditorClient::respondToChangedSelection() if (!frame) return; - 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(); - - WebPage::getLocationAndLengthFromRange(frame->selection()->toNormalizedRange().get(), selectionState.selectedRangeStart, selectionState.selectedRangeLength); - - m_page->send(Messages::WebPageProxy::SelectionStateChanged(selectionState)); + m_page->send(Messages::WebPageProxy::EditorStateChanged(m_page->editorState())); #if PLATFORM(WIN) // FIXME: This should also go into the selection state. @@ -263,27 +255,31 @@ bool WebEditorClient::canPaste(bool defaultValue) const bool WebEditorClient::canUndo() const { - notImplemented(); - return false; + bool result = false; + m_page->sendSync(Messages::WebPageProxy::CanUndoRedo(static_cast<uint32_t>(WebPageProxy::Undo)), Messages::WebPageProxy::CanUndoRedo::Reply(result)); + return result; } bool WebEditorClient::canRedo() const { - notImplemented(); - return false; + bool result = false; + m_page->sendSync(Messages::WebPageProxy::CanUndoRedo(static_cast<uint32_t>(WebPageProxy::Redo)), Messages::WebPageProxy::CanUndoRedo::Reply(result)); + return result; } void WebEditorClient::undo() { - notImplemented(); + bool result = false; + m_page->sendSync(Messages::WebPageProxy::ExecuteUndoRedo(static_cast<uint32_t>(WebPageProxy::Undo)), Messages::WebPageProxy::ExecuteUndoRedo::Reply(result)); } void WebEditorClient::redo() { - notImplemented(); + bool result = false; + m_page->sendSync(Messages::WebPageProxy::ExecuteUndoRedo(static_cast<uint32_t>(WebPageProxy::Redo)), Messages::WebPageProxy::ExecuteUndoRedo::Reply(result)); } -#if !PLATFORM(MAC) +#if !PLATFORM(GTK) && !PLATFORM(MAC) void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) { if (m_page->handleEditingKeyboardEvent(event)) @@ -389,9 +385,15 @@ void WebEditorClient::learnWord(const String& word) m_page->send(Messages::WebPageProxy::LearnWord(word)); } -void WebEditorClient::checkSpellingOfString(const UChar*, int, int*, int*) +void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) { - notImplemented(); + int32_t resultLocation = -1; + int32_t resultLength = 0; + // FIXME: It would be nice if we wouldn't have to copy the text here. + m_page->sendSync(Messages::WebPageProxy::CheckSpellingOfString(String(text, length)), + Messages::WebPageProxy::CheckSpellingOfString::Reply(resultLocation, resultLength)); + *misspellingLocation = resultLocation; + *misspellingLength = resultLength; } String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&) @@ -400,9 +402,15 @@ String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&) return String(); } -void WebEditorClient::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) +void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector<WebCore::GrammarDetail>& grammarDetails, int* badGrammarLocation, int* badGrammarLength) { - notImplemented(); + int32_t resultLocation = -1; + int32_t resultLength = 0; + // FIXME: It would be nice if we wouldn't have to copy the text here. + m_page->sendSync(Messages::WebPageProxy::CheckGrammarOfString(String(text, length)), + Messages::WebPageProxy::CheckGrammarOfString::Reply(grammarDetails, resultLocation, resultLength)); + *badGrammarLocation = resultLocation; + *badGrammarLength = resultLength; } void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail) @@ -422,8 +430,9 @@ void WebEditorClient::showSpellingUI(bool) bool WebEditorClient::spellingUIIsShowing() { - notImplemented(); - return false; + bool isShowing = false; + m_page->sendSync(Messages::WebPageProxy::SpellingUIIsShowing(), Messages::WebPageProxy::SpellingUIIsShowing::Reply(isShowing)); + return isShowing; } void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) @@ -441,7 +450,7 @@ void WebEditorClient::setInputMethodState(bool) notImplemented(); } -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) +void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) { notImplemented(); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index 9200af0..633090f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -123,6 +123,11 @@ private: virtual void toggleAutomaticSpellingCorrection(); #endif +#if PLATFORM(GTK) + bool executePendingEditorCommands(WebCore::Frame*, Vector<WTF::String>, bool); + void getEditorCommandsForKeyEvent(const WebCore::KeyboardEvent*, Vector<WTF::String>&); +#endif + TextCheckerClient* textChecker() { return this; } virtual void ignoreWordInSpellDocument(const String&); @@ -131,7 +136,7 @@ private: virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results); + virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<WebCore::TextCheckingResult>& results); #endif virtual void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail& detail); virtual void updateSpellingUIWithMisspelledWord(const String&); @@ -140,7 +145,7 @@ private: virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&); + virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&); #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index fa3cdce..c3f72b0 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -44,7 +44,6 @@ #include "WebPage.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" -#include "WebProcessProxyMessageKinds.h" #include "WebProcessProxyMessages.h" #include <JavaScriptCore/APICast.h> #include <JavaScriptCore/JSObject.h> @@ -223,14 +222,14 @@ void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(m_frame->frameID(), identifier, response)); } -void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) +void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength) { WebPage* webPage = m_frame->page(); if (!webPage) return; - webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, lengthReceived); - webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, lengthReceived)); + webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, dataLength); + webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, dataLength)); } void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) @@ -403,7 +402,7 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, unreachableURL, InjectedBundleUserMessageEncoder(userData.get()))); } -void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) +void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& title) { WebPage* webPage = m_frame->page(); if (!webPage) @@ -412,10 +411,11 @@ void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) RefPtr<APIObject> userData; // Notify the bundle client. - webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, title, m_frame, userData); + // FIXME: use direction of title. + webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, title.string(), m_frame, userData); // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title, InjectedBundleUserMessageEncoder(userData.get()))); + webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title.string(), InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchDidChangeIcons() @@ -839,14 +839,15 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) void WebFrameLoaderClient::updateGlobalHistory() { WebPage* webPage = m_frame->page(); - if (!webPage) + if (!webPage || !webPage->pageGroup()->isVisibleToHistoryClient()) return; DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader(); WebNavigationDataStore data; data.url = loader->urlForHistory().string(); - data.title = loader->title(); + // FIXME: use direction of title. + data.title = loader->title().string(); WebProcess::shared().connection()->send(Messages::WebContext::DidNavigateWithNavigationData(webPage->pageID(), data, m_frame->frameID()), 0); } @@ -854,7 +855,7 @@ void WebFrameLoaderClient::updateGlobalHistory() void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() { WebPage* webPage = m_frame->page(); - if (!webPage) + if (!webPage || !webPage->pageGroup()->isVisibleToHistoryClient()) return; DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader(); @@ -1061,14 +1062,15 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso return DocumentLoader::create(request, data); } -void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) +void WebFrameLoaderClient::setTitle(const StringWithDirection& title, const KURL& url) { WebPage* webPage = m_frame->page(); - if (!webPage) + if (!webPage || !webPage->pageGroup()->isVisibleToHistoryClient()) return; + // FIXME: use direction of title. WebProcess::shared().connection()->send(Messages::WebContext::DidUpdateHistoryTitle(webPage->pageID(), - title, url.string(), m_frame->frameID()), 0); + title.string(), url.string(), m_frame->frameID()), 0); } String WebFrameLoaderClient::userAgent(const KURL&) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index 1948541..6ab6691 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -67,7 +67,7 @@ private: virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&); #endif virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); - virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength); virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); @@ -84,7 +84,7 @@ private: virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); - virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&); virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); @@ -165,7 +165,7 @@ private: virtual void prepareForDataSourceReplacement(); virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); - virtual void setTitle(const String& title, const WebCore::KURL&); + virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::KURL&); virtual String userAgent(const WebCore::KURL&); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp index 7242d4f..940cb95 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp @@ -81,7 +81,7 @@ Vector<WebPopupItem> WebPopupMenu::populateItems() for (size_t i = 0; i < size; ++i) { if (m_popupClient->itemIsSeparator(i)) - items.append(WebPopupItem(WebPopupItem::Seperator)); + items.append(WebPopupItem(WebPopupItem::Separator)); else { // FIXME: Add support for styling the font. // FIXME: Add support for styling the foreground and background colors. @@ -126,6 +126,13 @@ void WebPopupMenu::hide() void WebPopupMenu::updateFromElement() { +#if PLATFORM(WIN) + if (!m_page || !m_popupClient) + return; + + int selectedIndex = m_popupClient->selectedIndex(); + WebProcess::shared().connection()->send(Messages::WebPageProxy::SetPopupMenuSelectedIndex(selectedIndex), m_page->pageID()); +#endif } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h index 3083c94..1e6e09a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h @@ -43,6 +43,8 @@ public: static PassRefPtr<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*); ~WebPopupMenu(); + WebPage* page() { return m_page; } + void disconnectFromPage() { m_page = 0; } void didChangeSelectedIndex(int newIndex); void setTextForIndex(int newIndex); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp index b875f32..39a7f32 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,6 +23,11 @@ #include "config.h" #include "WebSearchPopupMenu.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <wtf/text/AtomicString.h> + using namespace WebCore; namespace WebKit { @@ -42,17 +47,33 @@ PopupMenu* WebSearchPopupMenu::popupMenu() return m_popup.get(); } -void WebSearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +void WebSearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { + if (name.isEmpty()) + return; + + WebPage* page = m_popup->page(); + if (!page) + return; + + WebProcess::shared().connection()->send(Messages::WebPageProxy::SaveRecentSearches(name, searchItems), page->pageID()); } -void WebSearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void WebSearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& resultItems) { + if (name.isEmpty()) + return; + + WebPage* page = m_popup->page(); + if (!page) + return; + + WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::LoadRecentSearches(name), Messages::WebPageProxy::LoadRecentSearches::Reply(resultItems), page->pageID()); } bool WebSearchPopupMenu::enabled() { - return false; + return true; } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp new file mode 100644 index 0000000..c05589b --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2011 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "WebEditorClient.h" + +#include "Frame.h" +#include "PlatformKeyboardEvent.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/KeyboardEvent.h> +#include <WebCore/NotImplemented.h> + +using namespace WebCore; + +namespace WebKit { + +void WebEditorClient::getEditorCommandsForKeyEvent(const KeyboardEvent* event, Vector<WTF::String>& pendingEditorCommands) +{ + ASSERT(event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent); + + // First try to interpret the command in the UI and get the commands. + WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetEditorCommandsForKeyEvent(), + Messages::WebPageProxy::GetEditorCommandsForKeyEvent::Reply(pendingEditorCommands), + m_page->pageID(), CoreIPC::Connection::NoTimeout); +} + +bool WebEditorClient::executePendingEditorCommands(Frame* frame, Vector<WTF::String> pendingEditorCommands, bool allowTextInsertion) +{ + Vector<Editor::Command> commands; + for (size_t i = 0; i < pendingEditorCommands.size(); i++) { + Editor::Command command = frame->editor()->command(pendingEditorCommands.at(i).utf8().data()); + if (command.isTextInsertion() && !allowTextInsertion) + return false; + + commands.append(command); + } + + for (size_t i = 0; i < commands.size(); i++) { + if (!commands.at(i).execute()) + return false; + } + + return true; +} + +void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) +{ + Node* node = event->target()->toNode(); + ASSERT(node); + Frame* frame = node->document()->frame(); + ASSERT(frame); + + const PlatformKeyboardEvent* platformEvent = event->keyEvent(); + if (!platformEvent) + return; + + Vector<WTF::String> pendingEditorCommands; + getEditorCommandsForKeyEvent(event, pendingEditorCommands); + if (!pendingEditorCommands.isEmpty()) { + + // During RawKeyDown events if an editor command will insert text, defer + // the insertion until the keypress event. We want keydown to bubble up + // through the DOM first. + if (platformEvent->type() == PlatformKeyboardEvent::RawKeyDown) { + if (executePendingEditorCommands(frame, pendingEditorCommands, false)) + event->setDefaultHandled(); + + return; + } + + // Only allow text insertion commands if the current node is editable. + if (executePendingEditorCommands(frame, pendingEditorCommands, frame->editor()->canEdit())) { + event->setDefaultHandled(); + return; + } + } + + // Don't allow text insertion for nodes that cannot edit. + if (!frame->editor()->canEdit()) + return; + + // This is just a normal text insertion, so wait to execute the insertion + // until a keypress event happens. This will ensure that the insertion will not + // be reflected in the contents of the field until the keyup DOM event. + if (event->type() == eventNames().keypressEvent) { + + // FIXME: Add IM support + // https://bugs.webkit.org/show_bug.cgi?id=55946 + frame->editor()->insertText(platformEvent->text(), event); + event->setDefaultHandled(); + + } else { + // Don't insert null or control characters as they can result in unexpected behaviour + if (event->charCode() < ' ') + return; + + // Don't insert anything if a modifier is pressed + if (platformEvent->ctrlKey() || platformEvent->altKey()) + return; + + if (frame->editor()->insertText(platformEvent->text(), event)) + event->setDefaultHandled(); + } +} + +void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*) +{ + notImplemented(); +} + +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm index 6aa83f8..84b7d50 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm @@ -80,9 +80,7 @@ void WebContextMenuClient::searchWithSpotlight() if (selectedString.isEmpty()) return; - NSString *convertedSelectedString = selectedString; - - [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:convertedSelectedString]; + m_page->send(Messages::WebPageProxy::SearchWithSpotlight(selectedString)); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm index 75d92e2..b9806f4 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm @@ -152,7 +152,7 @@ void WebDragClient::declareAndWriteDragImage(NSPasteboard *pasteboard, DOMElemen RetainPtr<WKPasteboardFilePromiseOwner> filePromiseOwner(AdoptNS, [(WKPasteboardFilePromiseOwner *)[WKPasteboardFilePromiseOwner alloc] initWithSource:pasteboardOwner.get()]); m_page->setDragSource(filePromiseOwner.get()); - [pasteboard declareTypes:types.get() owner:pasteboardOwner.get()]; + [pasteboard declareTypes:types.get() owner:pasteboardOwner.leakRef()]; [pasteboard setPropertyList:[NSArray arrayWithObject:extension] forType:NSFilesPromisePboardType]; @@ -252,6 +252,7 @@ static CachedResourceClient* promisedDataClient() - (void)pasteboardChangedOwner:(NSPasteboard *)pasteboard { [self clearImage]; + CFRelease(self); // Balanced by the leakRef that WebDragClient::declareAndWriteDragImage does when making this pasteboard owner. } static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm index 7a95a72..17fd5fe 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -46,9 +46,6 @@ #import <WebCore/Page.h> #import <WebKit/WebResource.h> #import <WebKit/WebNSURLExtras.h> -#if !defined(BUILDING_ON_SNOW_LEOPARD) -#import <AppKit/NSTextChecker.h> -#endif using namespace WebCore; @@ -64,13 +61,13 @@ namespace WebKit { void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) { - if (m_page->interceptEditingKeyboardEvent(event, false)) + if (m_page->handleEditingKeyboardEvent(event, false)) event->setDefaultHandled(); } void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) { - if (m_page->interceptEditingKeyboardEvent(event, true)) + if (m_page->handleEditingKeyboardEvent(event, true)) event->setDefaultHandled(); } @@ -176,8 +173,9 @@ void WebEditorClient::showSubstitutionsPanel(bool) bool WebEditorClient::substitutionsPanelIsShowing() { - notImplemented(); - return false; + bool isShowing; + m_page->sendSync(Messages::WebPageProxy::SubstitutionsPanelIsShowing(), Messages::WebPageProxy::SubstitutionsPanelIsShowing::Reply(isShowing)); + return isShowing; } void WebEditorClient::toggleSmartInsertDelete() @@ -240,7 +238,7 @@ void WebEditorClient::toggleAutomaticSpellingCorrection() notImplemented(); } -void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) +void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { // FIXME: It would be nice if we wouldn't have to copy the text here. m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(String(text, length), checkingTypes), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results)); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm index 70e7607..3ae02a9 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm @@ -43,17 +43,17 @@ static NSString * const WebKitErrorPlugInNameKey = @"WebKitErrorPlug static NSString * const WebKitErrorPlugInPageURLStringKey = @"WebKitErrorPlugInPageURLStringKey"; // Policy errors -#define WebKitErrorDescriptionCannotShowMIMEType UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description") -#define WebKitErrorDescriptionCannotShowURL UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description") -#define WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description") -#define WebKitErrorDescriptionCannotUseRestrictedPort UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description") +#define WebKitErrorDescriptionCannotShowMIMEType WEB_UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description") +#define WebKitErrorDescriptionCannotShowURL WEB_UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description") +#define WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange WEB_UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description") +#define WebKitErrorDescriptionCannotUseRestrictedPort WEB_UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description") // Plug-in and java errors -#define WebKitErrorDescriptionCannotFindPlugin UI_STRING("The plug-in can’t be found", "WebKitErrorCannotFindPlugin description") -#define WebKitErrorDescriptionCannotLoadPlugin UI_STRING("The plug-in can’t be loaded", "WebKitErrorCannotLoadPlugin description") -#define WebKitErrorDescriptionJavaUnavailable UI_STRING("Java is unavailable", "WebKitErrorJavaUnavailable description") -#define WebKitErrorDescriptionPlugInCancelledConnection UI_STRING("Plug-in cancelled", "WebKitErrorPlugInCancelledConnection description") -#define WebKitErrorDescriptionPlugInWillHandleLoad UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description") +#define WebKitErrorDescriptionCannotFindPlugin WEB_UI_STRING("The plug-in can’t be found", "WebKitErrorCannotFindPlugin description") +#define WebKitErrorDescriptionCannotLoadPlugin WEB_UI_STRING("The plug-in can’t be loaded", "WebKitErrorCannotLoadPlugin description") +#define WebKitErrorDescriptionJavaUnavailable WEB_UI_STRING("Java is unavailable", "WebKitErrorJavaUnavailable description") +#define WebKitErrorDescriptionPlugInCancelledConnection WEB_UI_STRING("Plug-in cancelled", "WebKitErrorPlugInCancelledConnection description") +#define WebKitErrorDescriptionPlugInWillHandleLoad WEB_UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description") static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT; static void registerErrors(void); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm index e36f438..b9bc48f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm @@ -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 @@ -46,6 +46,7 @@ void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data return; data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes; + data.shouldPopOver = m_popupClient->shouldPopOver(); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index 06faa2f..a4fbc09 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -65,7 +65,6 @@ void InitWebCoreSystemInterface(void) INIT(GetWheelEventDeltas); INIT(HitTestMediaUIPart); INIT(InitializeMaximumHTTPConnectionCountPerHost); - INIT(IsLatchingWheelEvent); INIT(MeasureMediaUIPart); INIT(MediaControllerThemeAvailable); INIT(PopupMenu); @@ -85,7 +84,9 @@ void InitWebCoreSystemInterface(void) INIT(SetCONNECTProxyForStream); INIT(SetCookieStoragePrivateBrowsingEnabled); INIT(SetDragImage); + INIT(SetHTTPPipeliningMaximumPriority); INIT(SetHTTPPipeliningPriority); + INIT(SetHTTPPipeliningMinimumFastLanePriority); INIT(SetNSURLConnectionDefersCallbacks); INIT(SetNSURLRequestShouldContentSniff); INIT(SetPatternBaseCTM); @@ -135,9 +136,12 @@ void InitWebCoreSystemInterface(void) INIT(WillEndLiveResize); INIT(ContentAreaDidShow); INIT(ContentAreaDidHide); + INIT(DidBeginScrollGesture); + INIT(DidEndScrollGesture); INIT(ScrollbarPainterUsesOverlayScrollers); #else INIT(GetHyphenationLocationBeforeIndex); + INIT(GetNSEventMomentumPhase); #endif INIT(GetAXTextMarkerTypeID); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp index 5fcaa84..0248f70 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp @@ -29,6 +29,7 @@ namespace WebCore { WebFrameNetworkingContext::WebFrameNetworkingContext(Frame* frame) : FrameNetworkingContext(frame) , m_originatingObject(0) + , m_mimeSniffingEnabled(true) { } @@ -47,4 +48,9 @@ QNetworkAccessManager* WebFrameNetworkingContext::networkAccessManager() const return WebKit::WebProcess::shared().networkAccessManager(); } +bool WebFrameNetworkingContext::mimeSniffingEnabled() const +{ + return m_mimeSniffingEnabled; +} + } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h index 9c87785..f2cf248 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h @@ -33,8 +33,10 @@ private: virtual QObject* originatingObject() const; virtual QNetworkAccessManager* networkAccessManager() const; + virtual bool mimeSniffingEnabled() const; QObject* m_originatingObject; + bool m_mimeSniffingEnabled; }; } |
