diff options
| author | John Reck <jreck@google.com> | 2010-11-04 12:00:17 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2010-11-09 11:35:04 -0800 |
| commit | e14391e94c850b8bd03680c23b38978db68687a8 (patch) | |
| tree | 3fed87e6620fecaf3edc7259ae58a11662bedcb2 /WebKit/chromium/src | |
| parent | 1bd705833a68f07850cf7e204b26f8d328d16951 (diff) | |
| download | external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.zip external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.gz external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.bz2 | |
Merge Webkit at r70949: Initial merge by git.
Change-Id: I77b8645c083b5d0da8dba73ed01d4014aab9848e
Diffstat (limited to 'WebKit/chromium/src')
32 files changed, 512 insertions, 209 deletions
diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp index f1b1a91..a6e66c6 100644 --- a/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -113,6 +113,11 @@ void ApplicationCacheHost::selectCacheWithManifest(const KURL& manifestURL) } } +void ApplicationCacheHost::maybeLoadMainResourceForRedirect(ResourceRequest&, SubstituteData&) +{ + // N/A to the chromium port +} + bool ApplicationCacheHost::maybeLoadFallbackForMainResponse(const ResourceRequest&, const ResourceResponse& response) { if (m_internal) { diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 9647a44..c6ab85a 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -37,6 +37,8 @@ #include "ApplicationCacheHost.h" #include "AsyncFileSystem.h" #include "EditorInsertAction.h" +#include "FileError.h" +#include "FileMetadata.h" #include "FontDescription.h" #include "FontSmoothingMode.h" #include "HTMLInputElement.h" @@ -56,6 +58,8 @@ #include "WebClipboard.h" #include "WebCursorInfo.h" #include "WebEditingAction.h" +#include "WebFileError.h" +#include "WebFileInfo.h" #include "WebFileSystem.h" #include "WebFontDescription.h" #include "WebIDBKey.h" @@ -361,4 +365,20 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); #if ENABLE(FILE_SYSTEM) COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary); COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent); +COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown); +COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile); +COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory); #endif + +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNotFound, FileError::NOT_FOUND_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorSecurity, FileError::SECURITY_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorAbort, FileError::ABORT_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNotReadable, FileError::NOT_READABLE_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorEncoding, FileError::ENCODING_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNoModificationAllowed, FileError::NO_MODIFICATION_ALLOWED_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorInvalidState, FileError::INVALID_STATE_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorSyntax, FileError::SYNTAX_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorInvalidModification, FileError::INVALID_MODIFICATION_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorQuotaExceeded, FileError::QUOTA_EXCEEDED_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorTypeMismatch, FileError::TYPE_MISMATCH_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorPathExists, FileError::PATH_EXISTS_ERR); diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp index 8969094..71cf3b5 100644 --- a/WebKit/chromium/src/AsyncFileWriterChromium.cpp +++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp @@ -85,7 +85,7 @@ void AsyncFileWriterChromium::didTruncate() void AsyncFileWriterChromium::didFail(WebKit::WebFileError error) { - m_client->didFail(error); + m_client->didFail(static_cast<FileError::ErrorCode>(error)); } } // namespace diff --git a/WebKit/chromium/src/BackForwardListClientImpl.cpp b/WebKit/chromium/src/BackForwardListClientImpl.cpp index 2976329..af659bc 100644 --- a/WebKit/chromium/src/BackForwardListClientImpl.cpp +++ b/WebKit/chromium/src/BackForwardListClientImpl.cpp @@ -84,14 +84,15 @@ void BackForwardListClientImpl::goToItem(HistoryItem* item) m_pendingHistoryItem = 0; } -HistoryItem* BackForwardListClientImpl::currentItem() -{ - return m_currentItem.get(); -} - HistoryItem* BackForwardListClientImpl::itemAtIndex(int index) { - if (!m_webView->client() || index > forwardListCount() || -index > backListCount()) + if (!m_webView->client()) + return 0; + + if (!index) + return m_currentItem.get(); + + if (index > forwardListCount() || -index > backListCount()) return 0; // Since we don't keep the entire back/forward list, we have no way to diff --git a/WebKit/chromium/src/BackForwardListClientImpl.h b/WebKit/chromium/src/BackForwardListClientImpl.h index 1d8beb0..b795ecf 100644 --- a/WebKit/chromium/src/BackForwardListClientImpl.h +++ b/WebKit/chromium/src/BackForwardListClientImpl.h @@ -31,7 +31,7 @@ #ifndef BackForwardListClientImpl_h #define BackForwardListClientImpl_h -#include "BackForwardList.h" +#include "BackForwardListImpl.h" namespace WebKit { class WebViewImpl; @@ -50,7 +50,6 @@ private: // WebCore::BackForwardListClient methods: virtual void addItem(PassRefPtr<WebCore::HistoryItem>); virtual void goToItem(WebCore::HistoryItem*); - virtual WebCore::HistoryItem* currentItem(); virtual WebCore::HistoryItem* itemAtIndex(int index); virtual int backListCount(); virtual int forwardListCount(); diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 4f1705f..df13b29 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -40,6 +40,7 @@ #include "DatabaseTracker.h" #include "Document.h" #include "DocumentLoader.h" +#include "ExternalPopupMenu.h" #include "FileChooser.h" #include "FloatRect.h" #include "FrameLoadRequest.h" @@ -51,6 +52,7 @@ #include "HTMLNames.h" #include "HitTestResult.h" #include "IntRect.h" +#include "NavigationAction.h" #include "Node.h" #include "NotificationPresenterImpl.h" #include "Page.h" @@ -251,7 +253,7 @@ void ChromeClientImpl::focusedNodeChanged(Node* node) } Page* ChromeClientImpl::createWindow( - Frame* frame, const FrameLoadRequest& r, const WindowFeatures& features) + Frame* frame, const FrameLoadRequest& r, const WindowFeatures& features, const NavigationAction&) { if (!m_webView->client()) return 0; @@ -833,6 +835,9 @@ bool ChromeClientImpl::selectItemWritingDirectionIsNatural() PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const { + if (WebViewImpl::useExternalPopupMenus()) + return adoptRef(new ExternalPopupMenu(client, m_webView->client())); + return adoptRef(new PopupMenuChromium(client)); } diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index b1208f7..039fc1b 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -71,7 +71,7 @@ public: virtual void takeFocus(WebCore::FocusDirection); virtual void focusedNodeChanged(WebCore::Node*); virtual WebCore::Page* createWindow( - WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); + WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&); virtual void show(); virtual bool canRunModal(); virtual void runModal(); diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index d9ccb17..d33a06b 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -241,7 +241,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; // Spellchecking might be enabled for the field, but could be disabled on the node. - if (m_webView->focusedWebCoreFrame()->editor()->spellCheckingEnabledInFocusedNode()) + if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } } diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp index 11977b6..bc1d206 100644 --- a/WebKit/chromium/src/EditorClientImpl.cpp +++ b/WebKit/chromium/src/EditorClientImpl.cpp @@ -124,7 +124,7 @@ bool EditorClientImpl::shouldSpellcheckByDefault() const Editor* editor = frame->editor(); if (!editor) return false; - if (editor->spellCheckingEnabledInFocusedNode()) + if (editor->isSpellCheckingEnabledInFocusedNode()) return true; const Document* document = frame->document(); if (!document) diff --git a/WebKit/chromium/src/EventListenerWrapper.cpp b/WebKit/chromium/src/EventListenerWrapper.cpp index 706ba21..6360932 100644 --- a/WebKit/chromium/src/EventListenerWrapper.cpp +++ b/WebKit/chromium/src/EventListenerWrapper.cpp @@ -40,7 +40,7 @@ namespace WebKit { EventListenerWrapper::EventListenerWrapper(WebDOMEventListener* webDOMEventListener) - : EventListener(EventListener::JSEventListenerType) + : EventListener(EventListener::NativeEventListenerType) , m_webDOMEventListener(webDOMEventListener) { } diff --git a/WebKit/chromium/src/ExternalPopupMenu.cpp b/WebKit/chromium/src/ExternalPopupMenu.cpp new file mode 100644 index 0000000..a0243eb --- /dev/null +++ b/WebKit/chromium/src/ExternalPopupMenu.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ExternalPopupMenu.h" + +#include "FrameView.h" +#include "IntPoint.h" +#include "PopupMenuClient.h" +#include "TextDirection.h" +#include "WebExternalPopupMenu.h" +#include "WebMenuItemInfo.h" +#include "WebPopupMenuInfo.h" +#include "WebVector.h" +#include "WebViewClient.h" + +using namespace WebCore; + +namespace WebKit { + +ExternalPopupMenu::ExternalPopupMenu(PopupMenuClient* popupMenuClient, + WebViewClient* webViewClient) + : m_popupMenuClient(popupMenuClient) + , m_webViewClient(webViewClient) + , m_webExternalPopupMenu(0) +{ +} + +ExternalPopupMenu::~ExternalPopupMenu() +{ +} + +void ExternalPopupMenu::show(const IntRect& rect, FrameView* v, int index) +{ + // WebCore reuses the PopupMenu of a page. + // For simplicity, we do recreate the actual external popup everytime. + hide(); + + WebPopupMenuInfo info; + getPopupMenuInfo(&info); + m_webExternalPopupMenu = + m_webViewClient->createExternalPopupMenu(info, this); + m_webExternalPopupMenu->show(v->contentsToWindow(rect)); +} + +void ExternalPopupMenu::hide() +{ + if (m_popupMenuClient) + m_popupMenuClient->popupDidHide(); + if (!m_webExternalPopupMenu) + return; + m_webExternalPopupMenu->close(); + m_webExternalPopupMenu = 0; +} + +void ExternalPopupMenu::updateFromElement() +{ +} + +void ExternalPopupMenu::disconnectClient() +{ + hide(); + m_popupMenuClient = 0; +} + +void ExternalPopupMenu::didChangeSelection(int index) +{ + if (m_popupMenuClient) + m_popupMenuClient->selectionChanged(index); +} + +void ExternalPopupMenu::didAcceptIndex(int index) +{ + if (m_popupMenuClient) { + m_popupMenuClient->valueChanged(index); + m_popupMenuClient->popupDidHide(); + } + m_webExternalPopupMenu = 0; +} + +void ExternalPopupMenu::didCancel() +{ + if (m_popupMenuClient) + m_popupMenuClient->popupDidHide(); + m_webExternalPopupMenu = 0; +} + +void ExternalPopupMenu::getPopupMenuInfo(WebPopupMenuInfo* info) +{ + int itemCount = m_popupMenuClient->listSize(); + WebVector<WebPopupMenuInfo::Item> items( + static_cast<size_t>(itemCount)); + for (int i = 0; i < itemCount; ++i) { + WebPopupMenuInfo::Item& popupItem = items[i]; + popupItem.label = m_popupMenuClient->itemText(i); + if (m_popupMenuClient->itemIsSeparator(i)) + popupItem.type = WebMenuItemInfo::Separator; + else if (m_popupMenuClient->itemIsLabel(i)) + popupItem.type = WebMenuItemInfo::Group; + else + popupItem.type = WebMenuItemInfo::Option; + popupItem.enabled = m_popupMenuClient->itemIsEnabled(i); + } + + info->itemHeight = m_popupMenuClient->menuStyle().font().height(); + info->itemFontSize = + static_cast<int>(m_popupMenuClient->menuStyle().font().size()); + info->selectedIndex = m_popupMenuClient->selectedIndex(); + info->rightAligned = + m_popupMenuClient->menuStyle().textDirection() == WebCore::RTL; + info->items.swap(items); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/ExternalPopupMenu.h b/WebKit/chromium/src/ExternalPopupMenu.h new file mode 100644 index 0000000..6963e8d --- /dev/null +++ b/WebKit/chromium/src/ExternalPopupMenu.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ExternalPopupMenu_h +#define ExternalPopupMenu_h + +#include "PopupMenu.h" +#include "WebExternalPopupMenuClient.h" + +namespace WebCore { +class FrameView; +class IntRect; +class PopupMenuClient; +} + +namespace WebKit { + +class WebExternalPopupMenu; +class WebViewClient; +struct WebPopupMenuInfo; + +// The ExternalPopupMenu connects the actual implementation of the popup menu +// to the WebCore popup menu. +class ExternalPopupMenu : public WebCore::PopupMenu, + public WebExternalPopupMenuClient { +public: + ExternalPopupMenu(WebCore::PopupMenuClient*, WebViewClient*); + virtual ~ExternalPopupMenu(); + +private: + // WebCore::PopupMenu methods: + virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + + // WebExternalPopupClient methods: + virtual void didChangeSelection(int index); + virtual void didAcceptIndex(int index); + virtual void didCancel(); + + // Fills |info| with the popup menu information contained in the + // WebCore::PopupMenuClient associated with this ExternalPopupMenu. + void getPopupMenuInfo(WebPopupMenuInfo* info); + + WebCore::PopupMenuClient* m_popupMenuClient; + WebViewClient* m_webViewClient; + + // The actual implementor of the show menu. + WebExternalPopupMenu* m_webExternalPopupMenu; +}; + +} // namespace WebKit + +#endif // ExternalPopupMenu_h diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b4c62f4..29141ac 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -812,11 +812,11 @@ void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); } -Frame* FrameLoaderClientImpl::dispatchCreatePage() +Frame* FrameLoaderClientImpl::dispatchCreatePage(const NavigationAction& action) { struct WindowFeatures features; Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow( - m_webFrame->frame(), FrameLoadRequest(), features); + m_webFrame->frame(), FrameLoadRequest(), features, action); // Make sure that we have a valid disposition. This should have been set in // the preceeding call to dispatchDecidePolicyForNewWindowAction. @@ -1342,6 +1342,10 @@ void FrameLoaderClientImpl::transitionToCommittedForNewPage() makeDocumentView(); } +void FrameLoaderClientImpl::dispatchDidBecomeFrameset(bool) +{ +} + bool FrameLoaderClientImpl::canCachePage() const { // Since we manage the cache, always report this page as non-cacheable to @@ -1385,6 +1389,11 @@ void FrameLoaderClientImpl::didTransferChildFrameToNewDocument(Page*) m_webFrame->setClient(newParent->client()); } +void FrameLoaderClientImpl::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*) +{ + notImplemented(); +} + PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( const IntSize& size, // FIXME: how do we use this? HTMLPlugInElement* element, diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 0b15db6..ef00ed3 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -112,7 +112,7 @@ public: virtual void dispatchDidFinishLoad(); virtual void dispatchDidFirstLayout(); virtual void dispatchDidFirstVisuallyNonEmptyLayout(); - virtual WebCore::Frame* dispatchCreatePage(); + virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WTF::String& mime_type, const WebCore::ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WTF::String& frame_name); @@ -169,6 +169,7 @@ public: virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); + virtual void dispatchDidBecomeFrameset(bool); virtual bool canCachePage() const; virtual void download( WebCore::ResourceHandle*, const WebCore::ResourceRequest&, @@ -180,6 +181,7 @@ public: const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual void didTransferChildFrameToNewDocument(WebCore::Page*); + virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); virtual PassRefPtr<WebCore::Widget> createPlugin( const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp index 963d440..b5ed384 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -32,15 +32,21 @@ #include "SpeechInputClientImpl.h" #include "PlatformString.h" +#include "SpeechInputListener.h" #include "WebSpeechInputController.h" #include "WebString.h" #include "WebViewClient.h" -#include "page/SpeechInputListener.h" +#include <wtf/PassOwnPtr.h> #if ENABLE(INPUT_SPEECH) namespace WebKit { +PassOwnPtr<SpeechInputClientImpl> SpeechInputClientImpl::create(WebViewClient* client) +{ + return adoptPtr(new SpeechInputClientImpl(client)); +} + SpeechInputClientImpl::SpeechInputClientImpl(WebViewClient* web_view_client) : m_controller(web_view_client ? web_view_client->speechInputController(this) : 0) , m_listener(0) @@ -56,10 +62,10 @@ void SpeechInputClientImpl::setListener(WebCore::SpeechInputListener* listener) m_listener = listener; } -bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect) +bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar) { ASSERT(m_listener); - return m_controller->startRecognition(requestId, elementRect); + return m_controller->startRecognition(requestId, elementRect, language, grammar); } void SpeechInputClientImpl::stopRecording(int requestId) @@ -86,10 +92,13 @@ void SpeechInputClientImpl::didCompleteRecognition(int requestId) m_listener->didCompleteRecognition(requestId); } -void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebString& result) +void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebSpeechInputResultArray& results) { ASSERT(m_listener); - m_listener->setRecognitionResult(requestId, result); + WebCore::SpeechInputResultArray webcoreResults(results.size()); + for (size_t i = 0; i < results.size(); ++i) + webcoreResults[i] = results[i]; + m_listener->setRecognitionResult(requestId, webcoreResults); } } // namespace WebKit diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h index 817b32b..520803a 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.h +++ b/WebKit/chromium/src/SpeechInputClientImpl.h @@ -33,8 +33,11 @@ #if ENABLE(INPUT_SPEECH) +#include "SpeechInputClient.h" #include "WebSpeechInputListener.h" -#include "page/SpeechInputClient.h" +#include <wtf/Forward.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { class SpeechInputListener; @@ -49,21 +52,23 @@ class SpeechInputClientImpl : public WebCore::SpeechInputClient, public WebSpeechInputListener { public: - SpeechInputClientImpl(WebViewClient*); + static PassOwnPtr<SpeechInputClientImpl> create(WebViewClient*); virtual ~SpeechInputClientImpl(); // SpeechInputClient methods. void setListener(WebCore::SpeechInputListener*); - bool startRecognition(int, const WebCore::IntRect&); + bool startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar); void stopRecording(int); void cancelRecognition(int); // WebSpeechInputListener methods. void didCompleteRecording(int); - void setRecognitionResult(int, const WebString&); + void setRecognitionResult(int, const WebSpeechInputResultArray&); void didCompleteRecognition(int); private: + SpeechInputClientImpl(WebViewClient*); + WebSpeechInputController* m_controller; // To call into the embedder. WebCore::SpeechInputListener* m_listener; }; diff --git a/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp index f44e8f1..52a4032 100644 --- a/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp @@ -34,6 +34,7 @@ #include "AsyncFileSystemCallbacks.h" #include "AsyncFileSystemChromium.h" +#include "FileMetadata.h" #include "ScriptExecutionContext.h" #include "WebFileSystemEntry.h" #include "WebFileInfo.h" @@ -63,9 +64,13 @@ void WebFileSystemCallbacksImpl::didSucceed() delete this; } -void WebFileSystemCallbacksImpl::didReadMetadata(const WebFileInfo& info) +void WebFileSystemCallbacksImpl::didReadMetadata(const WebFileInfo& webFileInfo) { - m_callbacks->didReadMetadata(info.modificationTime); + FileMetadata fileMetadata; + fileMetadata.modificationTime = webFileInfo.modificationTime; + fileMetadata.length = webFileInfo.length; + fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); + m_callbacks->didReadMetadata(fileMetadata); delete this; } diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 1625eb8..e805c55 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -73,10 +73,14 @@ WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl() , m_texture(0) , m_fbo(0) , m_depthStencilBuffer(0) + , m_cachedWidth(0) + , m_cachedHeight(0) , m_multisampleFBO(0) , m_multisampleDepthStencilBuffer(0) , m_multisampleColorBuffer(0) , m_boundFBO(0) + , m_boundTexture(0) + , m_copyTextureToParentTextureFBO(0) #ifdef FLIP_FRAMEBUFFER_VERTICALLY , m_scanline(0) #endif @@ -101,6 +105,7 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() glDeleteRenderbuffersEXT(1, &m_depthStencilBuffer); } glDeleteTextures(1, &m_texture); + glDeleteFramebuffersEXT(1, &m_copyTextureToParentTextureFBO); #ifdef FLIP_FRAMEBUFFER_VERTICALLY if (m_scanline) delete[] m_scanline; @@ -165,12 +170,15 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute validateAttributes(); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + glEnable(GL_POINT_SPRITE); if (!angleCreateCompilers()) { angleDestroyCompilers(); return false; } + glGenFramebuffersEXT(1, &m_copyTextureToParentTextureFBO); + m_initialized = true; return true; } @@ -211,12 +219,10 @@ void WebGraphicsContext3DDefaultImpl::validateAttributes() void WebGraphicsContext3DDefaultImpl::resolveMultisampledFramebuffer(unsigned x, unsigned y, unsigned width, unsigned height) { if (m_attributes.antialias) { - bool mustRestoreFBO = (m_boundFBO != m_multisampleFBO); glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); - if (mustRestoreFBO) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); } } @@ -280,6 +286,7 @@ void WebGraphicsContext3DDefaultImpl::prepareTexture() { if (!m_renderDirectlyToWebView) { // We need to prepare our rendering results for the compositor. + makeContextCurrent(); resolveMultisampledFramebuffer(0, 0, m_cachedWidth, m_cachedHeight); } } @@ -558,12 +565,33 @@ void WebGraphicsContext3DDefaultImpl::unmapTexSubImage2DCHROMIUM(const void* mem bool WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM() { - // We don't claim support for this extension at this time - return false; + // This extension requires this desktopGL-only function (GLES2 doesn't + // support it), so check for its existence here. + return glGetTexLevelParameteriv; } void WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM(unsigned id, unsigned id2) { + makeContextCurrent(); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_copyTextureToParentTextureFBO); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, + id, + 0); // level + glBindTexture(GL_TEXTURE_2D, id2); + GLsizei width, height; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); + glCopyTexImage2D(GL_TEXTURE_2D, + 0, // level + GL_RGBA, + 0, 0, // x, y + width, + height, + 0); // border + glBindTexture(GL_TEXTURE_2D, m_boundTexture); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); } // Helper macros to reduce the amount of code. @@ -688,7 +716,12 @@ void WebGraphicsContext3DDefaultImpl::bindFramebuffer(unsigned long target, WebG DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbufferEXT, unsigned long, WebGLId) -DELEGATE_TO_GL_2(bindTexture, BindTexture, unsigned long, WebGLId) +void WebGraphicsContext3DDefaultImpl::bindTexture(unsigned long target, WebGLId texture) +{ + makeContextCurrent(); + glBindTexture(target, texture); + m_boundTexture = texture; +} DELEGATE_TO_GL_4(blendColor, BlendColor, double, double, double, double) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index 124ceac..5eebf12 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -288,6 +288,12 @@ private: // For tracking which FBO is bound unsigned int m_boundFBO; + // For tracking which texture is bound + unsigned int m_boundTexture; + + // FBO used for copying child texture to parent texture. + unsigned m_copyTextureToParentTextureFBO; + #ifdef FLIP_FRAMEBUFFER_VERTICALLY unsigned char* m_scanline; void flipVertically(unsigned char* framebuffer, diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h index fda4265..94f1101 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -39,7 +39,7 @@ namespace WebKit { class WebIDBObjectStore; class WebIDBTransaction; -// See comment in WebIndexedDatabase for a high level overview these classes. +// See comment in WebIDBFactory for a high level overview these classes. class WebIDBDatabaseImpl : public WebIDBDatabase { public: WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabaseBackendInterface>); diff --git a/WebKit/chromium/src/WebIDBFactory.cpp b/WebKit/chromium/src/WebIDBFactory.cpp index b186b68..40eff97 100755 --- a/WebKit/chromium/src/WebIDBFactory.cpp +++ b/WebKit/chromium/src/WebIDBFactory.cpp @@ -31,22 +31,23 @@ #include "config.h" #include "WebIDBFactory.h" -#if ENABLE(INDEXED_DATABASE) - #include "IDBFactoryBackendImpl.h" -#include "SecurityOrigin.h" +#include "WebSecurityOrigin.h" +#include <wtf/UnusedParam.h> using namespace WebCore; namespace WebKit { -WebString WebIDBFactory::databaseFileName(const WebString& name, const WebSecurityOrigin& origin) +WebString WebIDBFactory::databaseFileName(const WebSecurityOrigin& origin) { - RefPtr<SecurityOrigin> securityOrigin; - securityOrigin = origin; - return IDBFactoryBackendImpl::databaseFileName(name, securityOrigin.get()); + return IDBFactoryBackendImpl::databaseFileName(origin.get()); } +WebString WebIDBFactory::databaseFileName(const WebString& name, const WebSecurityOrigin& origin) +{ + UNUSED_PARAM(name); + return databaseFileName(origin); } -#endif // ENABLE(INDEXED_DATABASE) +} diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 96495fe..5dd2652 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -104,7 +104,7 @@ void WebIDBObjectStoreImpl::removeIndex(const WebString& name, const WebIDBTrans void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { - m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec); + m_objectStore->openCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index e19308a..65f0fde 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -99,8 +99,10 @@ WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() { // VideoLayerChromium may outlive this object so make sure all frames are // released. +#if USE(ACCELERATED_COMPOSITING) if (m_videoLayer.get()) m_videoLayer->releaseCurrentFrame(); +#endif } void WebMediaPlayerClientImpl::networkStateChanged() @@ -113,8 +115,10 @@ void WebMediaPlayerClientImpl::readyStateChanged() { ASSERT(m_mediaPlayer); m_mediaPlayer->readyStateChanged(); +#if USE(ACCELERATED_COMPOSITING) if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer.get()) m_videoLayer = VideoLayerChromium::create(0, this); +#endif } void WebMediaPlayerClientImpl::volumeChanged(float newVolume) @@ -185,8 +189,10 @@ void WebMediaPlayerClientImpl::load(const String& url) // Video frame object is owned by WebMediaPlayer. Before destroying // WebMediaPlayer all frames need to be released. +#if USE(ACCELERATED_COMPOSITING) if (m_videoLayer.get()) m_videoLayer->releaseCurrentFrame(); +#endif m_webMediaPlayer.set(createWebMediaPlayer(this, frame)); if (m_webMediaPlayer.get()) @@ -396,7 +402,14 @@ void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re // check. if (m_webMediaPlayer.get() && !context->paintingDisabled()) { #if WEBKIT_USING_SKIA - m_webMediaPlayer->paint(context->platformContext()->canvas(), rect); + PlatformGraphicsContext* platformContext = context->platformContext(); + WebCanvas* canvas = platformContext->canvas(); + + canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha()); + + m_webMediaPlayer->paint(canvas, rect); + + canvas->restore(); #elif WEBKIT_USING_CG m_webMediaPlayer->paint(context->platformContext(), rect); #else @@ -418,13 +431,6 @@ bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const return false; } -#if USE(ACCELERATED_COMPOSITING) -bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const -{ - return m_supportsAcceleratedCompositing; -} -#endif - MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const { if (m_webMediaPlayer.get()) @@ -433,6 +439,12 @@ MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const return MediaPlayer::Unknown; } +#if USE(ACCELERATED_COMPOSITING) +bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const +{ + return m_supportsAcceleratedCompositing; +} + VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() { VideoFrameChromium* videoFrame = 0; @@ -454,6 +466,7 @@ void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) delete videoFrame; } } +#endif MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player) { diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 6535094..ca7c43c 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -48,7 +48,9 @@ class WebMediaPlayer; // This class serves as a bridge between WebCore::MediaPlayer and // WebKit::WebMediaPlayer. class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface +#if USE(ACCELERATED_COMPOSITING) , public WebCore::VideoFrameProvider +#endif , public WebMediaPlayerClient { public: @@ -110,15 +112,14 @@ public: virtual void setSize(const WebCore::IntSize&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual bool hasSingleSecurityOrigin() const; + virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; #if USE(ACCELERATED_COMPOSITING) virtual bool supportsAcceleratedRendering() const; -#endif - - virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; // VideoFrameProvider methods: virtual WebCore::VideoFrameChromium* getCurrentFrame(); virtual void putCurrentFrame(WebCore::VideoFrameChromium*); +#endif private: WebMediaPlayerClientImpl(); diff --git a/WebKit/chromium/src/WebSecurityOrigin.cpp b/WebKit/chromium/src/WebSecurityOrigin.cpp index 8685738..adccb31 100644 --- a/WebKit/chromium/src/WebSecurityOrigin.cpp +++ b/WebKit/chromium/src/WebSecurityOrigin.cpp @@ -143,6 +143,11 @@ WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_private)); } +SecurityOrigin* WebSecurityOrigin::get() const +{ + return m_private; +} + void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) { // p is already ref'd for us by the caller diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp index 60c4fed..3b56338 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -57,7 +57,12 @@ WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result) { - m_webcoreMock->setRecognitionResult(result); + m_webcoreMock->setRecognitionResult(result, WebString::fromUTF8("")); +} + +void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result, const WebString &language) +{ + m_webcoreMock->setRecognitionResult(result, language); } void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) @@ -70,14 +75,14 @@ void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) m_listener->didCompleteRecognition(requestId); } -void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WTF::String& result) +void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result) { m_listener->setRecognitionResult(requestId, result); } -bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect) +bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar) { - return m_webcoreMock->startRecognition(requestId, elementRect); + return m_webcoreMock->startRecognition(requestId, elementRect, language, grammar); } void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h index edbfca3..c98f92a 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h @@ -54,14 +54,18 @@ public: // WebCore::SpeechInputListener methods. void didCompleteRecording(int requestId); void didCompleteRecognition(int requestId); - void setRecognitionResult(int requestId, const WTF::String& result); + void setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result); // WebSpeechInputController methods. - bool startRecognition(int requestId, const WebRect& elementRect); + bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar); void cancelRecognition(int requestId); void stopRecording(int requestId); // WebSpeechInputControllerMock methods. + void setMockRecognitionResult(const WebString& result, const WebString& language); + + // FIXME: this is a fix for a two-sided patch. Delete as soon as the chromium side is patched. + // Chromium patch not uploaded yet, but will depend on http://codereview.chromium.org/3615005/show patch. void setMockRecognitionResult(const WebString& result); private: @@ -72,4 +76,3 @@ private: } // namespace WebKit #endif // WebSpeechInputControllerMockImpl_h - diff --git a/WebKit/chromium/src/WebSpeechInputResult.cpp b/WebKit/chromium/src/WebSpeechInputResult.cpp new file mode 100644 index 0000000..1cafc84 --- /dev/null +++ b/WebKit/chromium/src/WebSpeechInputResult.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebSpeechInputResult.h" + +#include "SpeechInputResult.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +void WebSpeechInputResult::reset() +{ + m_private.reset(); +} + +WebSpeechInputResult::WebSpeechInputResult(const PassRefPtr<WebCore::SpeechInputResult>& value) + : m_private(value) +{ +} + +void WebSpeechInputResult::set(const WebString& utterance, double confidence) +{ + m_private = WebCore::SpeechInputResult::create(utterance, confidence); +} + +WebSpeechInputResult::operator PassRefPtr<WebCore::SpeechInputResult>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index aeab400..57d0ca4 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -33,6 +33,7 @@ #include "AutoFillPopupMenuClient.h" #include "AXObjectCache.h" +#include "BackForwardListImpl.h" #include "Chrome.h" #include "ColorSpace.h" #include "CompositionUnderlineVectorBuilder.h" @@ -88,6 +89,7 @@ #include "SecurityOrigin.h" #include "SelectionController.h" #include "Settings.h" +#include "SpeechInputClientImpl.h" #include "Timer.h" #include "TypingCommand.h" #include "UserGestureIndicator.h" @@ -182,6 +184,8 @@ static const PopupContainerSettings autoFillPopupSettings = { PopupContainerSettings::DOMElementDirection, }; +static bool shouldUseExternalPopupMenus = false; + // WebView ---------------------------------------------------------------- WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) @@ -193,6 +197,11 @@ WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devTools return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef(); } +void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) +{ + shouldUseExternalPopupMenus = useExternalPopupMenus; +} + void WebView::updateVisitedLinkState(unsigned long long linkHash) { Page::visitedStateChanged(PageGroup::pageGroup(pageGroupName), linkHash); @@ -275,7 +284,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools , m_compositorCreationFailed(false) #endif #if ENABLE(INPUT_SPEECH) - , m_speechInputClient(client) + , m_speechInputClient(SpeechInputClientImpl::create(client)) #endif , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0)) { @@ -298,13 +307,13 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools pageClients.dragClient = &m_dragClientImpl; pageClients.inspectorClient = &m_inspectorClientImpl; #if ENABLE(INPUT_SPEECH) - pageClients.speechInputClient = &m_speechInputClient; + pageClients.speechInputClient = m_speechInputClient.get(); #endif pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get(); m_page.set(new Page(pageClients)); - m_page->backForwardList()->setClient(&m_backForwardListClientImpl); + static_cast<BackForwardListImpl*>(m_page->backForwardList())->setClient(&m_backForwardListClientImpl); m_page->setGroupName(pageGroupName); m_inspectorSettingsMap.set(new SettingsMap); @@ -1039,6 +1048,10 @@ void WebViewImpl::composite(bool finish) // Put result onscreen. m_layerRenderer->present(); + + GraphicsContext3D* context = m_layerRenderer->context(); + if (context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR) + reallocateRenderer(); #endif } @@ -2107,6 +2120,11 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation) m_observedNewNavigation = false; } +bool WebViewImpl::useExternalPopupMenus() +{ + return shouldUseExternalPopupMenus; +} + bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button, bool ctrl, bool shift, bool alt, bool meta, @@ -2476,6 +2494,22 @@ void WebViewImpl::doComposite() // Draw the actual layers... m_layerRenderer->drawLayers(visibleRect, contentRect); } + +void WebViewImpl::reallocateRenderer() +{ + GraphicsContext3D* context = m_layerRenderer->context(); + RefPtr<GraphicsContext3D> newContext = GraphicsContext3D::create(context->getContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); + // GraphicsContext3D::create might fail and return 0, in that case LayerRendererChromium::create will also return 0. + RefPtr<LayerRendererChromium> layerRenderer = LayerRendererChromium::create(newContext); + + // Reattach the root layer. Child layers will get reattached as a side effect of updateLayersRecursive. + if (layerRenderer) + m_layerRenderer->transferRootLayer(layerRenderer.get()); + m_layerRenderer = layerRenderer; + + // Enable or disable accelerated compositing and request a refresh. + setRootGraphicsLayer(m_layerRenderer ? m_layerRenderer->rootLayer() : 0); +} #endif @@ -2491,10 +2525,8 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D() else { GraphicsContext3D::Attributes attributes; m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); -#if OS(DARWIN) if (m_temporaryOnscreenGraphicsContext3D) m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); -#endif context = m_temporaryOnscreenGraphicsContext3D.get(); } return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 050b5e1..0388770 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -49,7 +49,6 @@ #include "IntRect.h" #include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" -#include "SpeechInputClientImpl.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -74,6 +73,7 @@ class AutoFillPopupMenuClient; class ContextMenuClientImpl; class DeviceOrientationClientProxy; class DragScrollTimer; +class SpeechInputClientImpl; class WebAccessibilityObject; class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; @@ -273,6 +273,10 @@ public: // load. void didCommitLoad(bool* isNewNavigation); + // Returns true if popup menus should be rendered by the browser, false if + // they should be rendered by WebKit (which is the default). + static bool useExternalPopupMenus(); + bool contextMenuAllowed() const { return m_contextMenuAllowed; @@ -406,6 +410,7 @@ private: void updateRootLayerContents(const WebCore::IntRect&); void doComposite(); void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&); + void reallocateRenderer(); #endif WebViewClient* m_client; @@ -543,7 +548,7 @@ private: static const WebInputEvent* m_currentInputEvent; #if ENABLE(INPUT_SPEECH) - SpeechInputClientImpl m_speechInputClient; + OwnPtr<SpeechInputClientImpl> m_speechInputClient; #endif // If we attempt to fetch the on-screen GraphicsContext3D before // the compositor has been turned on, we need to instantiate it diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 5cebb52..2b264ee 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -245,146 +245,6 @@ TestSuite.prototype.testEnableResourcesTab = function() /** - * Tests that correct content length is reported for resources. - */ -TestSuite.prototype.testResourceContentLength = function() -{ - this.showPanel("resources"); - var test = this; - - var png = false; - var html = false; - this.addSniffer(WebInspector, "updateResource", - function(payload) { - if (!payload.didLengthChange) - return; - var resource = WebInspector.resources[payload.id]; - if (!resource || !resource.url) - return; - if (resource.url.search("image.html") !== -1) { - var expectedLength = 87; - test.assertTrue( - resource.resourceSize <= expectedLength, - "image.html content length is greater thatn expected."); - if (expectedLength === resource.resourceSize) - html = true; - } else if (resource.url.search("image.png") !== -1) { - var expectedLength = 257796; - test.assertTrue( - resource.resourceSize <= expectedLength, - "image.png content length is greater than expected."); - if (expectedLength === resource.resourceSize) - png = true; - } - if (html && png) { - // Wait 1 second before releasing control to check that the content - // lengths are not updated anymore. - setTimeout(function() { - test.releaseControl(); - }, 1000); - } - }, true); - - // Make sure resource tracking is on. - WebInspector.panels.resources._enableResourceTracking(); - // Reload inspected page to update all resources. - test.evaluateInConsole_( - "window.location.reload(true);", - function(resultText) { - test.assertEquals("undefined", resultText, "Unexpected result of reload()."); - }); - - // We now have some time to report results to controller. - this.takeControl(); -}; - - -/** - * Tests resource headers. - */ -TestSuite.prototype.testResourceHeaders = function() -{ - this.showPanel("resources"); - - var test = this; - - var responseOk = false; - var timingOk = false; - - this.addSniffer(WebInspector, "updateResource", - function(payload) { - var resource = this.resources[payload.id]; - if (!resource || resource.mainResource) { - // We are only interested in secondary resources in this test. - return; - } - - var requestHeaders = JSON.stringify(resource.requestHeaders); - test.assertContains(requestHeaders, "Accept"); - - if (payload.didResponseChange) { - var responseHeaders = JSON.stringify(resource.responseHeaders); - test.assertContains(responseHeaders, "Content-type"); - test.assertContains(responseHeaders, "Content-Length"); - test.assertTrue(typeof resource.responseReceivedTime !== "undefined"); - responseOk = true; - } - - if (payload.didTimingChange) { - test.assertTrue(typeof resource.startTime !== "undefined"); - timingOk = true; - } - - if (payload.didCompletionChange) { - test.assertTrue(responseOk); - test.assertTrue(timingOk); - test.assertTrue(typeof resource.endTime !== "undefined"); - test.releaseControl(); - } - }, true); - - WebInspector.panels.resources._enableResourceTracking(); - this.takeControl(); -}; - - -/** - * Tests the mime type of a cached (HTTP 304) resource. - */ -TestSuite.prototype.testCachedResourceMimeType = function() -{ - this.showPanel("resources"); - - var test = this; - var hasReloaded = false; - - this.addSniffer(WebInspector, "updateResource", - function(payload) { - var resource = this.resources[payload.id]; - if (!resource || resource.mainResource) { - // We are only interested in secondary resources in this test. - return; - } - - if (payload.didResponseChange) { - // Test server uses a default mime type for JavaScript files. - test.assertEquals("text/html", payload.mimeType); - if (!hasReloaded) { - hasReloaded = true; - // Reload inspected page to update all resources. - test.evaluateInConsole_("window.location.reload(true);", function() {}); - } else - test.releaseControl(); - } - - }, true); - - WebInspector.panels.resources._enableResourceTracking(); - this.takeControl(); -}; - - -/** * Tests that profiler works. */ TestSuite.prototype.testProfilerTab = function() diff --git a/WebKit/chromium/src/mac/WebInputEventFactory.mm b/WebKit/chromium/src/mac/WebInputEventFactory.mm index b4e09c0..015409e 100644 --- a/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -856,6 +856,8 @@ static inline int modifiersFromEvent(NSEvent* event) { modifiers |= WebInputEvent::AltKey; if ([event modifierFlags] & NSCommandKeyMask) modifiers |= WebInputEvent::MetaKey; + if ([event modifierFlags] & NSAlphaShiftKeyMask) + modifiers |= WebInputEvent::CapsLockOn; // TODO(port): Set mouse button states return modifiers; |
