diff options
author | Kristian Monsen <kristianm@google.com> | 2010-09-30 15:42:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-10-07 10:59:29 +0100 |
commit | bec39347bb3bb5bf1187ccaf471d26247f28b585 (patch) | |
tree | 56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebKit/chromium/src | |
parent | 90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff) | |
download | external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2 |
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebKit/chromium/src')
55 files changed, 1162 insertions, 473 deletions
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index ac3aad3..f3b8f5a 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -49,6 +49,7 @@ #include "TextAffinity.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" +#include "UserStyleSheetTypes.h" #include "VideoFrameChromium.h" #include "WebAccessibilityObject.h" #include "WebApplicationCacheHost.h" @@ -273,31 +274,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight900, FontWeight900); COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightNormal, FontWeightNormal); COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightBold, FontWeightBold); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Text, HTMLInputElement::TEXT); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Password, HTMLInputElement::PASSWORD); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::IsIndex, HTMLInputElement::ISINDEX); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::CheckBox, HTMLInputElement::CHECKBOX); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Radio, HTMLInputElement::RADIO); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Submit, HTMLInputElement::SUBMIT); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Reset, HTMLInputElement::RESET); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::File, HTMLInputElement::FILE); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Hidden, HTMLInputElement::HIDDEN); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Image, HTMLInputElement::IMAGE); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Button, HTMLInputElement::BUTTON); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Search, HTMLInputElement::SEARCH); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Range, HTMLInputElement::RANGE); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Email, HTMLInputElement::EMAIL); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Number, HTMLInputElement::NUMBER); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Telephone, HTMLInputElement::TELEPHONE); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::URL, HTMLInputElement::URL); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Color, HTMLInputElement::COLOR); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Date, HTMLInputElement::DATE); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTime, HTMLInputElement::DATETIME); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTimeLocal, HTMLInputElement::DATETIMELOCAL); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Month, HTMLInputElement::MONTH); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Time, HTMLInputElement::TIME); -COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Week, HTMLInputElement::WEEK); - COMPILE_ASSERT_MATCHING_ENUM(WebNode::ElementNode, Node::ELEMENT_NODE); COMPILE_ASSERT_MATCHING_ENUM(WebNode::AttributeNode, Node::ATTRIBUTE_NODE); COMPILE_ASSERT_MATCHING_ENUM(WebNode::TextNode, Node::TEXT_NODE); @@ -378,6 +354,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserScriptInjectAtDocumentStart, InjectAtD COMPILE_ASSERT_MATCHING_ENUM(WebView::UserScriptInjectAtDocumentEnd, InjectAtDocumentEnd); COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInAllFrames, InjectInAllFrames); COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInTopFrameOnly, InjectInTopFrameOnly); +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInExistingDocuments, InjectInExistingDocuments); +COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, InjectInSubsequentDocuments); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NullType, IDBKey::NullType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType); diff --git a/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/WebKit/chromium/src/AsyncFileSystemChromium.cpp index 08fcea6..db65bbd 100644 --- a/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -33,9 +33,11 @@ #if ENABLE(FILE_SYSTEM) #include "AsyncFileSystemCallbacks.h" -#include "FileSystem.h" +#include "AsyncFileWriterChromium.h" +#include "WebFileInfo.h" #include "WebFileSystem.h" #include "WebFileSystemCallbacksImpl.h" +#include "WebFileWriter.h" #include "WebKit.h" #include "WebKitClient.h" @@ -43,6 +45,11 @@ namespace WebCore { +bool AsyncFileSystem::isAvailable() +{ + return true; +} + AsyncFileSystemChromium::AsyncFileSystemChromium(const String& rootPath) : AsyncFileSystem(rootPath) , m_webFileSystem(WebKit::webKitClient()->fileSystem()) @@ -99,6 +106,65 @@ void AsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<Async m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } +class FileWriterHelperCallbacks : public WebKit::WebFileSystemCallbacks { +public: + FileWriterHelperCallbacks(AsyncFileWriterClient* client, const String& path, WebKit::WebFileSystem* webFileSystem, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks) + : m_client(client) + , m_path(path) + , m_webFileSystem(webFileSystem) + , m_callbacks(callbacks) + { + } + + virtual void didSucceed() + { + ASSERT_NOT_REACHED(); + delete this; + } + virtual void didReadMetadata(const WebKit::WebFileInfo& info) + { + ASSERT(m_callbacks); + if (info.type != WebKit::WebFileInfo::TypeFile || info.length < 0) + m_callbacks->didFail(WebKit::WebFileErrorInvalidState); + else { + OwnPtr<AsyncFileWriterChromium> asyncFileWriterChromium = adoptPtr(new AsyncFileWriterChromium(m_client)); + OwnPtr<WebKit::WebFileWriter> webFileWriter = adoptPtr(m_webFileSystem->createFileWriter(m_path, asyncFileWriterChromium.get())); + asyncFileWriterChromium->setWebFileWriter(webFileWriter.release()); + m_callbacks->didCreateFileWriter(asyncFileWriterChromium.release(), info.length); + } + delete this; + } + + virtual void didReadDirectory(const WebKit::WebVector<WebKit::WebFileSystemEntry>& entries, bool hasMore) + { + ASSERT_NOT_REACHED(); + delete this; + } + virtual void didOpenFileSystem(const WebKit::WebString& name, const WebKit::WebString& rootPath) + { + ASSERT_NOT_REACHED(); + delete this; + } + + virtual void didFail(WebKit::WebFileError error) + { + ASSERT(m_callbacks); + m_callbacks->didFail(error); + delete this; + } + +private: + AsyncFileWriterClient* m_client; + String m_path; + WebKit::WebFileSystem* m_webFileSystem; + OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; +}; + +void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, path, m_webFileSystem, callbacks)); +} + } // namespace WebCore #endif diff --git a/WebKit/chromium/src/AsyncFileSystemChromium.h b/WebKit/chromium/src/AsyncFileSystemChromium.h index f46f78c..d8698d5 100644 --- a/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -58,6 +58,7 @@ public: virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); private: WebKit::WebFileSystem* m_webFileSystem; diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp index 4bfc988..8969094 100644 --- a/WebKit/chromium/src/AsyncFileWriterChromium.cpp +++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp @@ -33,30 +33,31 @@ #if ENABLE(FILE_SYSTEM) +#include "AsyncFileWriterClient.h" #include "Blob.h" -#include "FileWriterClient.h" #include "WebFileWriter.h" #include "WebURL.h" -using namespace WebCore; +namespace WebCore { -namespace WebKit { - -AsyncFileWriterChromium::AsyncFileWriterChromium(FileWriterClient* client) +AsyncFileWriterChromium::AsyncFileWriterChromium(AsyncFileWriterClient* client) : m_client(client) { } -void AsyncFileWriterChromium::setWebFileWriter(WebFileWriter* writer) +AsyncFileWriterChromium::~AsyncFileWriterChromium() +{ +} + +void AsyncFileWriterChromium::setWebFileWriter(PassOwnPtr<WebKit::WebFileWriter> writer) { - ASSERT(!m_writer); m_writer = writer; } void AsyncFileWriterChromium::write(long long position, Blob* data) { ASSERT(m_writer); - m_writer->write(position, WebURL(data->url())); + m_writer->write(position, WebKit::WebURL(data->url())); } void AsyncFileWriterChromium::truncate(long long length) @@ -77,12 +78,12 @@ void AsyncFileWriterChromium::didWrite(long long bytes, bool complete) m_client->didWrite(bytes, complete); } -void AsyncFileWriterChromium::didTruncate(long long length) +void AsyncFileWriterChromium::didTruncate() { - m_client->didTruncate(length); + m_client->didTruncate(); } -void AsyncFileWriterChromium::didFail(WebFileError error) +void AsyncFileWriterChromium::didFail(WebKit::WebFileError error) { m_client->didFail(error); } diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.h b/WebKit/chromium/src/AsyncFileWriterChromium.h index 92743ca..71a2f18 100644 --- a/WebKit/chromium/src/AsyncFileWriterChromium.h +++ b/WebKit/chromium/src/AsyncFileWriterChromium.h @@ -36,35 +36,37 @@ #include "AsyncFileWriter.h" #include "WebFileError.h" #include "WebFileWriterClient.h" +#include <wtf/PassOwnPtr.h> -namespace WebCore { -class Blob; -class FileWriterClient; +namespace WebKit { +class WebFileWriter; } -namespace WebKit { +namespace WebCore { -class WebFileWriter; +class Blob; +class AsyncFileWriterClient; -class AsyncFileWriterChromium : public WebCore::AsyncFileWriter, public WebFileWriterClient { +class AsyncFileWriterChromium : public AsyncFileWriter, public WebKit::WebFileWriterClient { public: - AsyncFileWriterChromium(WebCore::FileWriterClient* client); - - void setWebFileWriter(WebFileWriter* writer); + AsyncFileWriterChromium(AsyncFileWriterClient* client); + ~AsyncFileWriterChromium(); + + void setWebFileWriter(PassOwnPtr<WebKit::WebFileWriter> writer); // FileWriter - virtual void write(long long position, WebCore::Blob* data); + virtual void write(long long position, Blob* data); virtual void truncate(long long length); virtual void abort(); // WebFileWriterClient virtual void didWrite(long long bytes, bool complete); - virtual void didTruncate(long long length); - virtual void didFail(WebFileError); + virtual void didTruncate(); + virtual void didFail(WebKit::WebFileError); private: - OwnPtr<WebFileWriter> m_writer; - WebCore::FileWriterClient* m_client; + OwnPtr<WebKit::WebFileWriter> m_writer; + AsyncFileWriterClient* m_client; }; } // namespace diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 8c13cbb..5f702e0 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -44,7 +44,6 @@ #include "FloatRect.h" #include "FrameLoadRequest.h" #include "FrameView.h" -#include "GLES2Context.h" #include "Geolocation.h" #include "GeolocationService.h" #include "GeolocationServiceChromium.h" @@ -257,7 +256,9 @@ void ChromeClientImpl::focusedNodeChanged(Node* node) if (!document) { ASSERT_NOT_REACHED(); return; - } + } + + // TODO: Remove once the FocusedUIElementChanged notification is handled downstream. if (document && document->axObjectCache()->accessibilityEnabled()) { // Retrieve the focused AccessibilityObject. AccessibilityObject* focusedAccObj = @@ -760,20 +761,6 @@ void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer, info->rightAligned = popupContainer->menuStyle().textDirection() == RTL; } -void ChromeClientImpl::didChangeAccessibilityObjectState(AccessibilityObject* obj) -{ - // Alert assistive technology about the accessibility object state change - if (obj) - m_webView->client()->didChangeAccessibilityObjectState(WebAccessibilityObject(obj)); -} - -void ChromeClientImpl::didChangeAccessibilityObjectChildren(WebCore::AccessibilityObject* obj) -{ - // Alert assistive technology about the accessibility object children change - if (obj) - m_webView->client()->didChangeAccessibilityObjectChildren(WebAccessibilityObject(obj)); -} - void ChromeClientImpl::postAccessibilityNotification(AccessibilityObject* obj, AXObjectCache::AXNotification notification) { // Alert assistive technology about the accessibility object notification. diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index fbaac87..02f1de6 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -166,8 +166,6 @@ public: const WebCore::IntRect& bounds, bool handleExternally); virtual void popupClosed(WebCore::PopupContainer* popupContainer); - virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*); - virtual void didChangeAccessibilityObjectChildren(WebCore::AccessibilityObject*); virtual void postAccessibilityNotification(WebCore::AccessibilityObject*, WebCore::AXObjectCache::AXNotification); // ChromeClientImpl: diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 3ced7b8..b906575 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -66,7 +66,7 @@ #include "WebThemeEngine.h" #endif -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) #include "WebFontInfo.h" #include "WebFontRenderStyle.h" #endif @@ -422,7 +422,7 @@ bool ChromiumBridge::ensureFontLoaded(HFONT font) } #endif -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters) { if (webKitClient()->sandboxSupport()) diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.cpp b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp index f4a0dd9..29b43ba 100644 --- a/WebKit/chromium/src/DeviceOrientationClientProxy.cpp +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.cpp @@ -71,4 +71,9 @@ WebCore::DeviceOrientation* DeviceOrientationClientProxy::lastOrientation() cons return m_lastOrientation.get(); } +void DeviceOrientationClientProxy::deviceOrientationControllerDestroyed() +{ + // Our lifetime is bound to the WebViewImpl. +} + } // namespace WebKit diff --git a/WebKit/chromium/src/DeviceOrientationClientProxy.h b/WebKit/chromium/src/DeviceOrientationClientProxy.h index 2d3a7dc..e90d77f 100644 --- a/WebKit/chromium/src/DeviceOrientationClientProxy.h +++ b/WebKit/chromium/src/DeviceOrientationClientProxy.h @@ -48,6 +48,7 @@ public: void startUpdating(); void stopUpdating(); WebCore::DeviceOrientation* lastOrientation() const; + virtual void deviceOrientationControllerDestroyed(); private: WebDeviceOrientationClient* m_client; diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 61d43df..ba9c8fd 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -147,6 +147,14 @@ void FrameLoaderClientImpl::didCreateIsolatedScriptContext() m_webFrame->client()->didCreateIsolatedScriptContext(m_webFrame); } +bool FrameLoaderClientImpl::allowScriptExtension(const String& extensionName, + int extensionGroup) +{ + if (m_webFrame->client()) + return m_webFrame->client()->allowScriptExtension(m_webFrame, extensionName, extensionGroup); + return false; +} + void FrameLoaderClientImpl::didPerformFirstNavigation() const { } @@ -1360,7 +1368,7 @@ PassRefPtr<Frame> FrameLoaderClientImpl::createFrame( return m_webFrame->createChildFrame(frameRequest, ownerElement); } -void FrameLoaderClientImpl::didTransferChildFrameToNewDocument() +void FrameLoaderClientImpl::didTransferChildFrameToNewDocument(Page*) { ASSERT(m_webFrame->frame()->ownerElement()); diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 57105de..0b15db6 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -69,6 +69,10 @@ public: // in garbage collection. virtual void didCreateIsolatedScriptContext(); + // Returns true if we should allow the given V8 extension to be added to + // the script context at the currently loading page and given extension group. + virtual bool allowScriptExtension(const String& extensionName, int extensionGroup); + virtual bool hasWebView() const; virtual bool hasFrameView() const; virtual void makeRepresentation(WebCore::DocumentLoader*); @@ -175,7 +179,7 @@ public: WebCore::HTMLFrameOwnerElement* ownerElement, const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); - virtual void didTransferChildFrameToNewDocument(); + virtual void didTransferChildFrameToNewDocument(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/GLES2Context.cpp b/WebKit/chromium/src/GLES2Context.cpp deleted file mode 100644 index b4b4bb2..0000000 --- a/WebKit/chromium/src/GLES2Context.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 "GLES2Context.h" -#include "GLES2ContextInternal.h" -#include "IntSize.h" -#include "WebGLES2Context.h" -#include "WebKit.h" -#include "WebKitClient.h" -#include "WebViewImpl.h" -#include <wtf/OwnPtr.h> - -// There are two levels of delegation in this file: -// -// 1. GLES2Context delegates to GLES2ContextInternal. This is done -// so that we have some place to store data members common among -// implementations. -// -// 2. GLES2ContextInternal delegates to an implementation of -// WebGLES2Context. This is done so we have a place to inject an -// implementation which creates the GL ES context. - -using namespace WebKit; - -namespace WebCore { - -PassOwnPtr<GLES2ContextInternal> GLES2ContextInternal::create(WebGLES2Context* impl, bool owns) -{ - PassOwnPtr<GLES2ContextInternal> result = new GLES2ContextInternal(impl, owns); - return result; -} - -PassOwnPtr<GLES2Context> GLES2Context::create(PassOwnPtr<GLES2ContextInternal> internal) -{ - PassOwnPtr<GLES2Context> result = new GLES2Context(); - result->m_internal = internal; - return result; -} - -GLES2Context::GLES2Context() -{ -} - -GLES2Context::~GLES2Context() -{ -} - -bool GLES2Context::makeCurrent() -{ - WebGLES2Context* webContext = m_internal->getWebGLES2Context(); - if (!webContext) - return false; - return webContext->makeCurrent(); -} - -bool GLES2Context::destroy() -{ - WebGLES2Context* webContext = m_internal->getWebGLES2Context(); - if (!webContext) - return false; - return webContext->destroy(); -} - -bool GLES2Context::swapBuffers() -{ - WebGLES2Context* webContext = m_internal->getWebGLES2Context(); - if (!webContext) - return false; - return webContext->swapBuffers(); -} - -void GLES2Context::resizeOffscreenContent(const IntSize& size) -{ - WebGLES2Context* webContext = m_internal->getWebGLES2Context(); - ASSERT(webContext); - webContext->resizeOffscreenContent(size); -} - -unsigned GLES2Context::getOffscreenContentParentTextureId() -{ - WebGLES2Context* webContext = m_internal->getWebGLES2Context(); - ASSERT(webContext); - return webContext->getOffscreenContentParentTextureId(); -} - -} // namespace WebCore diff --git a/WebKit/chromium/src/GLES2ContextInternal.h b/WebKit/chromium/src/GLES2ContextInternal.h deleted file mode 100644 index 4668311..0000000 --- a/WebKit/chromium/src/GLES2ContextInternal.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 <wtf/PassOwnPtr.h> - -namespace WebKit { -class WebGLES2Context; -} - -namespace WebCore { - -class GLES2ContextInternal { -public: - // If 'owns' is set to true, this GLES2ContextInternal takes ownership of the passed in WebKit::WebGLES2Context. - static PassOwnPtr<GLES2ContextInternal> create(WebKit::WebGLES2Context* impl, bool owns); - - WebKit::WebGLES2Context* getWebGLES2Context() { return m_impl; } - - ~GLES2ContextInternal(); - -private: - GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns); - - WebKit::WebGLES2Context* m_impl; - bool m_owns; -}; - -} diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h index 42a7d7e..fffd23e 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.h +++ b/WebKit/chromium/src/IDBDatabaseProxy.h @@ -47,7 +47,7 @@ public: virtual String version() const; virtual PassRefPtr<DOMStringList> objectStores() const; - // FIXME: Add transaction and setVersion. + // FIXME: Add setVersion. virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode); diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 18101e4..d43e787 100755 --- a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -65,14 +65,6 @@ void IDBFactoryBackendProxy::open(const String& name, const String& description, m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::abortPendingTransactions(const Vector<int>& pendingIDs) -{ - ASSERT(pendingIDs.size()); - WebKit::WebVector<int> ids = pendingIDs; - - m_webIDBFactory->abortPendingTransactions(ids); -} - } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h index ac30cf2..6371686 100755 --- a/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -46,7 +46,6 @@ public: PassRefPtr<DOMStringList> databases(void) const; virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - virtual void abortPendingTransactions(const Vector<int>& pendingIDs); private: IDBFactoryBackendProxy(); diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp index ad27fa3..82ca5f6 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -30,11 +30,13 @@ #include "IDBCallbacks.h" #include "IDBIndexBackendProxy.h" #include "IDBKeyRange.h" +#include "IDBTransactionBackendProxy.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBKeyRange.h" #include "WebIDBIndex.h" #include "WebIDBKey.h" #include "WebIDBObjectStore.h" +#include "WebIDBTransactionImpl.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -70,9 +72,12 @@ PassRefPtr<DOMStringList> IDBObjectStoreProxy::indexNames() const return m_webIDBObjectStore->indexNames(); } -void IDBObjectStoreProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +void IDBObjectStoreProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction) { - m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks)); + // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, + // all implementations of IDB interfaces are proxy objects. + IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); + m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction()); } void IDBObjectStoreProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks> callbacks) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h index a334572..13dfe23 100755 --- a/WebKit/chromium/src/IDBObjectStoreProxy.h +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -46,7 +46,7 @@ public: String keyPath() const; PassRefPtr<DOMStringList> indexNames() const; - void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); + void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*); void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>); void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.cpp b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp index be6b058..59e88d8 100644 --- a/WebKit/chromium/src/IDBTransactionBackendProxy.cpp +++ b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp @@ -69,11 +69,17 @@ void IDBTransactionBackendProxy::abort() m_webIDBTransaction->abort(); } -void IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) +bool IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) { // This should never be reached as it's the impl objects who get to // execute tasks in the browser process. ASSERT_NOT_REACHED(); + return false; +} + +void IDBTransactionBackendProxy::didCompleteTaskEvents() +{ + m_webIDBTransaction->didCompleteTaskEvents(); } int IDBTransactionBackendProxy::id() const diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.h b/WebKit/chromium/src/IDBTransactionBackendProxy.h index d62b8ff..3daf73e 100644 --- a/WebKit/chromium/src/IDBTransactionBackendProxy.h +++ b/WebKit/chromium/src/IDBTransactionBackendProxy.h @@ -45,10 +45,13 @@ public: virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); virtual unsigned short mode() const; virtual void abort(); - virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>); + virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>); + virtual void didCompleteTaskEvents(); virtual int id() const; virtual void setCallbacks(IDBTransactionCallbacks*); + WebKit::WebIDBTransaction* getWebIDBTransaction() const { return m_webIDBTransaction.get(); } + private: IDBTransactionBackendProxy(PassOwnPtr<WebKit::WebIDBTransaction>); diff --git a/WebKit/chromium/src/LocalFileSystemChromium.cpp b/WebKit/chromium/src/LocalFileSystemChromium.cpp index 45365ef..7bf4335 100644 --- a/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -42,25 +42,33 @@ #include "WebFileSystemCallbacksImpl.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebWorkerImpl.h" +#include "WorkerContext.h" +#include "WorkerThread.h" +#include <wtf/Threading.h> using namespace WebKit; namespace WebCore { -PassRefPtr<LocalFileSystem> LocalFileSystem::create(const String& path) +LocalFileSystem& LocalFileSystem::localFileSystem() { - return adoptRef(new LocalFileSystem(path)); + AtomicallyInitializedStatic(LocalFileSystem*, localFileSystem = new LocalFileSystem("")); + return *localFileSystem; } -void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { ASSERT(context); if (context->isDocument()) { Document* document = static_cast<Document*>(context); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); - webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(new FileSystemCallbacks(successCallback, errorCallback, context))); + webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks)); } else { - // FIXME: Add implementation for workers. + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); + WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); + webWorker->openFileSystem(static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks)); } } diff --git a/WebKit/chromium/src/LocalizedStrings.cpp b/WebKit/chromium/src/LocalizedStrings.cpp index 74ff699..3354c30 100644 --- a/WebKit/chromium/src/LocalizedStrings.cpp +++ b/WebKit/chromium/src/LocalizedStrings.cpp @@ -265,6 +265,16 @@ String contextMenuItemTagInspectElement() { return String(); } String contextMenuItemTagShowSpellingPanel(bool show) { return String(); } String mediaElementLiveBroadcastStateText() { return String(); } String mediaElementLoadingStateText() { return String(); } +String contextMenuItemTagOpenVideoInNewWindow() { return String(); } +String contextMenuItemTagOpenAudioInNewWindow() { return String(); } +String contextMenuItemTagCopyVideoLinkToClipboard() { return String(); } +String contextMenuItemTagCopyAudioLinkToClipboard() { return String(); } +String contextMenuItemTagToggleMediaControls() { return String(); } +String contextMenuItemTagToggleMediaLoop() { return String(); } +String contextMenuItemTagEnterVideoFullscreen() { return String(); } +String contextMenuItemTagMediaPlay() { return String(); } +String contextMenuItemTagMediaPause() { return String(); } +String contextMenuItemTagMediaMute() { return String(); } String localizedMediaControlElementString(const String& /*name*/) { diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp index 2b98320..a60fe28 100644 --- a/WebKit/chromium/src/VideoFrameChromiumImpl.cpp +++ b/WebKit/chromium/src/VideoFrameChromiumImpl.cpp @@ -38,14 +38,6 @@ using namespace WebCore; namespace WebKit { -const unsigned cMaxPlanes = 3; -const unsigned cNumRGBPlanes = 1; -const unsigned cRGBPlane = 0; -const unsigned cNumYUVPlanes = 3; -const unsigned cYPlane = 0; -const unsigned cUPlane = 1; -const unsigned cVPlane = 2; - WebVideoFrame* VideoFrameChromiumImpl::toWebVideoFrame(VideoFrameChromium* videoFrame) { VideoFrameChromiumImpl* wrappedFrame = static_cast<VideoFrameChromiumImpl*>(videoFrame); @@ -108,4 +100,22 @@ const void* VideoFrameChromiumImpl::data(unsigned plane) const return 0; } +const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const +{ + switch (format()) { + case RGBA: + return IntSize(stride(plane), height()); + case YV12: + if (plane == static_cast<unsigned>(yPlane)) + return IntSize(stride(plane), height()); + else if (plane == static_cast<unsigned>(uPlane)) + return IntSize(stride(plane), height() / 2); + else if (plane == static_cast<unsigned>(vPlane)) + return IntSize(stride(plane), height() / 2); + default: + break; + } + return IntSize(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/VideoFrameChromiumImpl.h b/WebKit/chromium/src/VideoFrameChromiumImpl.h index 3ad424c..042cd7e 100644 --- a/WebKit/chromium/src/VideoFrameChromiumImpl.h +++ b/WebKit/chromium/src/VideoFrameChromiumImpl.h @@ -56,6 +56,7 @@ public: virtual unsigned planes() const; virtual int stride(unsigned plane) const; virtual const void* data(unsigned plane) const; + virtual const IntSize requiredTextureSize(unsigned plane) const; private: WebVideoFrame* m_webVideoFrame; diff --git a/WebKit/chromium/src/WebAccessibilityCache.cpp b/WebKit/chromium/src/WebAccessibilityCache.cpp index 8a3f697..ab8f814 100644 --- a/WebKit/chromium/src/WebAccessibilityCache.cpp +++ b/WebKit/chromium/src/WebAccessibilityCache.cpp @@ -42,4 +42,9 @@ void WebAccessibilityCache::enableAccessibility() AXObjectCache::enableAccessibility(); } +bool WebAccessibilityCache::accessibilityEnabled() +{ + return AXObjectCache::accessibilityEnabled(); +} + } diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp index 4bb9022..c25c31b 100644 --- a/WebKit/chromium/src/WebBindings.cpp +++ b/WebKit/chromium/src/WebBindings.cpp @@ -312,6 +312,17 @@ static bool getElementImpl(NPObject* npObj, WebElement* webElement) return true; } +static NPObject* makeIntArrayImpl(const WebVector<int>& data) +{ + v8::HandleScope handleScope; + v8::Handle<v8::Array> result = v8::Array::New(data.size()); + for (size_t i = 0; i < data.size(); i++) + result->Set(i, v8::Number::New(data[i])); + + WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext()); + return npCreateV8ScriptObject(0, result, window); +} + #endif bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data) @@ -350,6 +361,16 @@ bool WebBindings::getElement(NPObject* element, WebElement* webElement) #endif } +NPObject* WebBindings::makeIntArray(const WebVector<int> & data) +{ +#if USE(V8) + return makeIntArrayImpl(data); +#else + // Not supported on other ports (JSC, etc.). + return 0; +#endif +} + void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data) { WebCore::pushExceptionHandler(handler, data); diff --git a/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/WebKit/chromium/src/WebFileSystemCallbacksImpl.h index b9c825b..36ab9ff 100644 --- a/WebKit/chromium/src/WebFileSystemCallbacksImpl.h +++ b/WebKit/chromium/src/WebFileSystemCallbacksImpl.h @@ -43,7 +43,7 @@ class AsyncFileSystemCallbacks; namespace WebKit { struct WebFileInfo; -class WebFileSystemEntry; +struct WebFileSystemEntry; class WebString; class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index 2d42f4b..1b64e5a 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -99,6 +99,7 @@ #include "HistoryItem.h" #include "InspectorController.h" #include "Page.h" +#include "Performance.h" #include "PlatformContextSkia.h" #include "PluginDocument.h" #include "PrintContext.h" @@ -109,6 +110,7 @@ #include "ReplaceSelectionCommand.h" #include "ResourceHandle.h" #include "ResourceRequest.h" +#include "SVGSMILElement.h" #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" @@ -130,6 +132,7 @@ #include "WebHistoryItem.h" #include "WebInputElement.h" #include "WebPasswordAutocompleteListener.h" +#include "WebPerformance.h" #include "WebPlugin.h" #include "WebPluginContainerImpl.h" #include "WebRange.h" @@ -151,7 +154,7 @@ #include "LocalCurrentGraphicsContext.h" #endif -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) #include <gdk/gdk.h> #endif @@ -307,7 +310,7 @@ public: float scale = m_printedPageWidth / pageRect.width(); ctx.save(); -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) ctx.scale(WebCore::FloatSize(scale, scale)); #endif ctx.translate(static_cast<float>(-pageRect.x()), @@ -550,7 +553,7 @@ WebSize WebFrameImpl::contentsSize() const int WebFrameImpl::contentsPreferredWidth() const { if (m_frame->document() && m_frame->document()->renderView()) - return m_frame->document()->renderView()->minPrefWidth(); + return m_frame->document()->renderView()->minPreferredLogicalWidth(); return 0; } @@ -692,6 +695,14 @@ WebAnimationController* WebFrameImpl::animationController() return &m_animationController; } +WebPerformance WebFrameImpl::performance() const +{ + if (!m_frame || !m_frame->domWindow()) + return WebPerformance(); + + return WebPerformance(m_frame->domWindow()->webkitPerformance()); +} + WebSecurityOrigin WebFrameImpl::securityOrigin() const { if (!m_frame || !m_frame->document()) @@ -1071,6 +1082,22 @@ WebRange WebFrameImpl::markedRange() const return frame()->editor()->compositionRange(); } +bool WebFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length, WebRect& rect) const +{ + if ((location + length < location) && (location + length)) + length = 0; + + Element* selectionRoot = frame()->selection()->rootEditableElement(); + Element* scope = selectionRoot ? selectionRoot : frame()->document()->documentElement(); + RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, location, length); + if (!range) + return false; + IntRect intRect = frame()->editor()->firstRectForRange(range.get()); + rect = WebRect(intRect.x(), intRect.y(), intRect.width(), intRect.height()); + + return true; +} + bool WebFrameImpl::executeCommand(const WebString& name) { ASSERT(frame()); @@ -1712,6 +1739,26 @@ bool WebFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) cons return m_frame->editor()->selectionStartHasSpellingMarkerFor(from, length); } +bool WebFrameImpl::pauseSVGAnimation(const WebString& animationId, double time, const WebString& elementId) +{ +#if !ENABLE(SVG) + return false; +#else + if (!m_frame) + return false; + + Document* document = m_frame->document(); + if (!document || !document->svgExtensions()) + return false; + + Node* coreNode = document->getElementById(animationId); + if (!coreNode || !SVGSMILElement::isSMILElement(coreNode)) + return false; + + return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time); +#endif +} + // WebFrameImpl public --------------------------------------------------------- PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client) diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index 25e7004..d93254b 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -56,6 +56,7 @@ class WebDataSourceImpl; class WebInputElement; class WebFrameClient; class WebPasswordAutocompleteListener; +class WebPerformance; class WebPluginContainerImpl; class WebView; class WebViewImpl; @@ -90,6 +91,7 @@ public: virtual WebDocument document() const; virtual void forms(WebVector<WebFormElement>&) const; virtual WebAnimationController* animationController(); + virtual WebPerformance performance() const; virtual WebSecurityOrigin securityOrigin() const; virtual void grantUniversalAccess(); virtual NPObject* windowObject() const; @@ -135,6 +137,7 @@ public: virtual void unmarkText(); virtual bool hasMarkedText() const; virtual WebRange markedRange() const; + virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const; virtual bool executeCommand(const WebString&); virtual bool executeCommand(const WebString&, const WebString& value); virtual bool isCommandEnabled(const WebString&) const; @@ -183,6 +186,9 @@ public: virtual WebRect selectionBoundsRect() const; virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; + virtual bool pauseSVGAnimation(const WebString& animationId, + double time, + const WebString& elementId); static PassRefPtr<WebFrameImpl> create(WebFrameClient* client); ~WebFrameImpl(); diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 24dcf9a..45bc2ee 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -38,12 +38,21 @@ #include "app/gfx/gl/gl_context.h" #include "NotImplemented.h" #include <wtf/PassOwnPtr.h> +#include <wtf/text/CString.h> #include <stdio.h> #include <string.h> namespace WebKit { +enum { + IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B, + IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, + MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, + MAX_VARYING_VECTORS = 0x8DFC, + MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD +}; + WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState() : enabled(false) , buffer(0) @@ -69,6 +78,8 @@ WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl() , m_scanline(0) #endif , m_boundArrayBuffer(0) + , m_fragmentCompiler(0) + , m_vertexCompiler(0) { } @@ -94,6 +105,8 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() glDeleteFramebuffersEXT(1, &m_fbo); m_glContext->Destroy(); + + angleDestroyCompilers(); } } @@ -115,15 +128,16 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute validateAttributes(); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + + if (!angleCreateCompilers()) { + angleDestroyCompilers(); + return false; + } + m_initialized = true; return true; } -bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) -{ - return initialize(attributes, webView, false); -} - void WebGraphicsContext3DDefaultImpl::validateAttributes() { const char* extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); @@ -657,7 +671,33 @@ DELEGATE_TO_GL_1(clearStencil, ClearStencil, long) DELEGATE_TO_GL_4(colorMask, ColorMask, bool, bool, bool, bool) -DELEGATE_TO_GL_1(compileShader, CompileShader, WebGLId) +void WebGraphicsContext3DDefaultImpl::compileShader(WebGLId shader) +{ + makeContextCurrent(); + + ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader); + if (result == m_shaderSourceMap.end()) { + // Passing down to gl driver to generate the correct error; or the case + // where the shader deletion is delayed when it's attached to a program. + glCompileShader(shader); + return; + } + ShaderSourceEntry& entry = result->second; + + if (!angleValidateShaderSource(entry)) + return; // Shader didn't validate, don't move forward with compiling translated source + + int shaderLength = entry.translatedSource ? strlen(entry.translatedSource) : 0; + glShaderSource(shader, 1, const_cast<const char**>(&entry.translatedSource), &shaderLength); + glCompileShader(shader); + +#ifndef NDEBUG + int compileStatus; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus); + // ASSERT that ANGLE generated GLSL will be accepted by OpenGL + ASSERT(compileStatus == GL_TRUE); +#endif +} void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) @@ -871,21 +911,21 @@ void WebGraphicsContext3DDefaultImpl::getIntegerv(unsigned long pname, int* valu // Therefore, the value returned by desktop GL needs to be divided by 4. makeContextCurrent(); switch (pname) { - case 0x8B9B: // IMPLEMENTATION_COLOR_READ_FORMAT + case IMPLEMENTATION_COLOR_READ_FORMAT: *value = GL_RGB; break; - case 0x8B9A: // IMPLEMENTATION_COLOR_READ_TYPE + case IMPLEMENTATION_COLOR_READ_TYPE: *value = GL_UNSIGNED_BYTE; break; - case 0x8DFD: // MAX_FRAGMENT_UNIFORM_VECTORS + case MAX_FRAGMENT_UNIFORM_VECTORS: glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, value); *value /= 4; break; - case 0x8DFB: // MAX_VERTEX_UNIFORM_VECTORS + case MAX_VERTEX_UNIFORM_VECTORS: glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, value); *value /= 4; break; - case 0x8DFC: // MAX_VARYING_VECTORS + case MAX_VARYING_VECTORS: glGetIntegerv(GL_MAX_VARYING_FLOATS, value); *value /= 4; break; @@ -916,14 +956,57 @@ WebString WebGraphicsContext3DDefaultImpl::getProgramInfoLog(WebGLId program) DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameterivEXT, unsigned long, unsigned long, int*) -DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, unsigned long, int*) +void WebGraphicsContext3DDefaultImpl::getShaderiv(WebGLId shader, unsigned long pname, int* value) +{ + makeContextCurrent(); + + ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader); + if (result != m_shaderSourceMap.end()) { + ShaderSourceEntry& entry = result->second; + switch (pname) { + case GL_COMPILE_STATUS: + if (!entry.isValid) { + *value = 0; + return; + } + break; + case GL_INFO_LOG_LENGTH: + if (!entry.isValid) { + *value = entry.log ? strlen(entry.log) : 0; + if (*value) + (*value)++; + return; + } + break; + case GL_SHADER_SOURCE_LENGTH: + *value = entry.source ? strlen(entry.source) : 0; + if (*value) + (*value)++; + return; + } + } + + glGetShaderiv(shader, pname, value); +} WebString WebGraphicsContext3DDefaultImpl::getShaderInfoLog(WebGLId shader) { makeContextCurrent(); - GLint logLength; + + ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader); + if (result != m_shaderSourceMap.end()) { + ShaderSourceEntry& entry = result->second; + if (!entry.isValid) { + if (!entry.log) + return WebString(); + WebString res = WebString::fromUTF8(entry.log, strlen(entry.log)); + return res; + } + } + + GLint logLength = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); - if (!logLength) + if (logLength <= 1) return WebString(); GLchar* log = 0; if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) @@ -939,9 +1022,19 @@ WebString WebGraphicsContext3DDefaultImpl::getShaderInfoLog(WebGLId shader) WebString WebGraphicsContext3DDefaultImpl::getShaderSource(WebGLId shader) { makeContextCurrent(); - GLint logLength; + + ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader); + if (result != m_shaderSourceMap.end()) { + ShaderSourceEntry& entry = result->second; + if (!entry.source) + return WebString(); + WebString res = WebString::fromUTF8(entry.source, strlen(entry.source)); + return res; + } + + GLint logLength = 0; glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); - if (!logLength) + if (logLength <= 1) return WebString(); GLchar* log = 0; if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) @@ -1061,8 +1154,19 @@ DELEGATE_TO_GL_4(scissor, Scissor, long, long, unsigned long, unsigned long) void WebGraphicsContext3DDefaultImpl::shaderSource(WebGLId shader, const char* string) { makeContextCurrent(); - GLint length = strlen(string); - glShaderSource(shader, 1, &string, &length); + GLint length = string ? strlen(string) : 0; + ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader); + if (result != m_shaderSourceMap.end()) { + ShaderSourceEntry& entry = result->second; + if (entry.source) { + fastFree(entry.source); + entry.source = 0; + } + if (!tryFastMalloc((length + 1) * sizeof(char)).getValue(entry.source)) + return; // FIXME: generate an error? + memcpy(entry.source, string, (length + 1) * sizeof(char)); + } else + glShaderSource(shader, 1, &string, &length); } DELEGATE_TO_GL_3(stencilFunc, StencilFunc, unsigned long, long, unsigned long) @@ -1201,7 +1305,18 @@ unsigned WebGraphicsContext3DDefaultImpl::createRenderbuffer() return o; } -DELEGATE_TO_GL_1R(createShader, CreateShader, unsigned long, unsigned); +unsigned WebGraphicsContext3DDefaultImpl::createShader(unsigned long shaderType) +{ + makeContextCurrent(); + ASSERT(shaderType == GL_VERTEX_SHADER || shaderType == GL_FRAGMENT_SHADER); + unsigned shader = glCreateShader(shaderType); + if (shader) { + ShaderSourceEntry entry; + entry.type = shaderType; + m_shaderSourceMap.set(shader, entry); + } + return shader; +} unsigned WebGraphicsContext3DDefaultImpl::createTexture() { @@ -1239,6 +1354,7 @@ void WebGraphicsContext3DDefaultImpl::deleteShader(unsigned shader) { makeContextCurrent(); glDeleteShader(shader); + m_shaderSourceMap.remove(shader); } void WebGraphicsContext3DDefaultImpl::deleteTexture(unsigned texture) @@ -1247,6 +1363,92 @@ void WebGraphicsContext3DDefaultImpl::deleteTexture(unsigned texture) glDeleteTextures(1, &texture); } +bool WebGraphicsContext3DDefaultImpl::angleCreateCompilers() +{ + if (!ShInitialize()) + return false; + + TBuiltInResource resource; + resource.MaxVertexAttribs = 0; + getIntegerv(GL_MAX_VERTEX_ATTRIBS, &resource.MaxVertexAttribs); + resource.MaxVertexUniformVectors = 0; + getIntegerv(MAX_VERTEX_UNIFORM_VECTORS, + &resource.MaxVertexUniformVectors); + resource.MaxVaryingVectors = 0; + getIntegerv(MAX_VARYING_VECTORS, + &resource.MaxVaryingVectors); + resource.MaxVertexTextureImageUnits = 0; + getIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &resource.MaxVertexTextureImageUnits); + resource.MaxCombinedTextureImageUnits = 0; + getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &resource.MaxCombinedTextureImageUnits); + resource.MaxTextureImageUnits = 0; + getIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &resource.MaxTextureImageUnits); + resource.MaxFragmentUniformVectors = 0; + getIntegerv(MAX_FRAGMENT_UNIFORM_VECTORS, + &resource.MaxFragmentUniformVectors); + // Always set to 1 for OpenGL ES. + resource.MaxDrawBuffers = 1; + + m_fragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecWebGL, &resource); + m_vertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecWebGL, &resource); + return (m_fragmentCompiler && m_vertexCompiler); +} + +void WebGraphicsContext3DDefaultImpl::angleDestroyCompilers() +{ + if (m_fragmentCompiler) { + ShDestruct(m_fragmentCompiler); + m_fragmentCompiler = 0; + } + if (m_vertexCompiler) { + ShDestruct(m_vertexCompiler); + m_vertexCompiler = 0; + } +} + +bool WebGraphicsContext3DDefaultImpl::angleValidateShaderSource(ShaderSourceEntry& entry) +{ + entry.isValid = false; + if (entry.translatedSource) { + fastFree(entry.translatedSource); + entry.translatedSource = 0; + } + if (entry.log) { + fastFree(entry.log); + entry.log = 0; + } + + ShHandle compiler = 0; + switch (entry.type) { + case GL_FRAGMENT_SHADER: + compiler = m_fragmentCompiler; + break; + case GL_VERTEX_SHADER: + compiler = m_vertexCompiler; + break; + } + if (!compiler) + return false; + + if (!ShCompile(compiler, &entry.source, 1, EShOptObjectCode)) { + int logSize = 0; + ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &logSize); + if (logSize > 1 && tryFastMalloc(logSize * sizeof(char)).getValue(entry.log)) + ShGetInfoLog(compiler, entry.log); + return false; + } + + int length = 0; + ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &length); + if (length > 1) { + if (!tryFastMalloc(length * sizeof(char)).getValue(entry.translatedSource)) + return false; + ShGetObjectCode(compiler, entry.translatedSource); + } + entry.isValid = true; + return true; +} + } // namespace WebKit #endif // ENABLE(3D_CANVAS) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index 5bf439a..319d9d8 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -33,8 +33,10 @@ #if ENABLE(3D_CANVAS) +#include "GLSLANG/ShaderLang.h" #include "WebGraphicsContext3D.h" +#include <wtf/HashMap.h> #include <wtf/ListHashSet.h> #include <wtf/OwnPtr.h> @@ -60,8 +62,6 @@ public: //---------------------------------------------------------------------- // WebGraphicsContext3D methods virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*, bool); - // FIXME: remove once compositor is switched over to GraphicsContext3D. - virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*); virtual bool makeContextCurrent(); virtual int width(); @@ -302,8 +302,7 @@ private: // need to in order to verify that all enabled vertex arrays have // a valid buffer bound -- to avoid crashes on certain cards. unsigned int m_boundArrayBuffer; - class VertexAttribPointerState { - public: + struct VertexAttribPointerState { VertexAttribPointerState(); bool enabled; @@ -325,6 +324,44 @@ private: ListHashSet<unsigned long> m_syntheticErrors; OwnPtr<gfx::GLContext> m_glContext; + + // ANGLE related. + struct ShaderSourceEntry { + ShaderSourceEntry() + : type(0) + , source(0) + , log(0) + , translatedSource(0) + , isValid(false) + { + } + + ~ShaderSourceEntry() + { + if (source) + fastFree(source); + if (log) + fastFree(log); + if (translatedSource) + fastFree(translatedSource); + } + + unsigned long type; + char* source; + char* log; + char* translatedSource; + bool isValid; + }; + + bool angleCreateCompilers(); + void angleDestroyCompilers(); + bool angleValidateShaderSource(ShaderSourceEntry& entry); + + typedef HashMap<WebGLId, ShaderSourceEntry> ShaderSourceMap; + ShaderSourceMap m_shaderSourceMap; + + ShHandle m_fragmentCompiler; + ShHandle m_vertexCompiler; }; } // namespace WebKit diff --git a/WebKit/chromium/src/GLES2ContextInternal.cpp b/WebKit/chromium/src/WebIDBFactory.cpp index 33eb602..b186b68 100644..100755 --- a/WebKit/chromium/src/GLES2ContextInternal.cpp +++ b/WebKit/chromium/src/WebIDBFactory.cpp @@ -29,24 +29,24 @@ */ #include "config.h" +#include "WebIDBFactory.h" -#include "GLES2ContextInternal.h" +#if ENABLE(INDEXED_DATABASE) -#include "WebGLES2Context.h" +#include "IDBFactoryBackendImpl.h" +#include "SecurityOrigin.h" -namespace WebCore { +using namespace WebCore; -GLES2ContextInternal::GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns) - : m_impl(impl) - , m_owns(owns) -{ -} +namespace WebKit { -GLES2ContextInternal::~GLES2ContextInternal() +WebString WebIDBFactory::databaseFileName(const WebString& name, const WebSecurityOrigin& origin) { - if (m_owns) - delete m_impl; + RefPtr<SecurityOrigin> securityOrigin; + securityOrigin = origin; + return IDBFactoryBackendImpl::databaseFileName(name, securityOrigin.get()); } -} // namespace WebCore +} +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp index 3c8d459..7147cf0 100755 --- a/WebKit/chromium/src/WebIDBFactoryImpl.cpp +++ b/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -63,15 +63,6 @@ void WebIDBFactoryImpl::open(const WebString& name, const WebString& description m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0, dataDir); } -void WebIDBFactoryImpl::abortPendingTransactions(const WebVector<int>& pendingIDs) -{ - WTF::Vector<int> ids(pendingIDs.size()); - for (size_t i = 0; i < pendingIDs.size(); ++i) - ids[i] = pendingIDs[i]; - - m_idbFactoryBackend->abortPendingTransactions(ids); -} - } // namespace WebKit #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h index 4dc0a10..a0a4d7d 100755 --- a/WebKit/chromium/src/WebIDBFactoryImpl.h +++ b/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -43,7 +43,6 @@ public: virtual ~WebIDBFactoryImpl(); virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); - virtual void abortPendingTransactions(const WebVector<int>& pendingIDs); private: WTF::RefPtr<WebCore::IDBFactoryBackendInterface> m_idbFactoryBackend; diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 1ad1d9f..36d8ace 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -33,6 +33,7 @@ #include "WebIDBIndexImpl.h" #include "WebIDBKey.h" #include "WebIDBKeyRange.h" +#include "WebIDBTransaction.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -65,9 +66,9 @@ WebDOMStringList WebIDBObjectStoreImpl::indexNames() const return m_objectStore->indexNames(); } -void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks) +void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction) { - m_objectStore->get(key, IDBCallbacksProxy::create(callbacks)); + m_objectStore->get(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface()); } void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks) diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 9f31369..a9f1200 100755 --- a/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -47,7 +47,7 @@ public: WebString keyPath() const; WebDOMStringList indexNames() const; - void get(const WebIDBKey& key, WebIDBCallbacks*); + void get(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&); void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*); void remove(const WebIDBKey& key, WebIDBCallbacks*); diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.cpp b/WebKit/chromium/src/WebIDBTransactionImpl.cpp index 0dc9702..f5d8748 100644 --- a/WebKit/chromium/src/WebIDBTransactionImpl.cpp +++ b/WebKit/chromium/src/WebIDBTransactionImpl.cpp @@ -64,6 +64,11 @@ void WebIDBTransactionImpl::abort() m_backend->abort(); } +void WebIDBTransactionImpl::didCompleteTaskEvents() +{ + m_backend->didCompleteTaskEvents(); +} + int WebIDBTransactionImpl::id() const { return m_backend->id(); @@ -75,6 +80,11 @@ void WebIDBTransactionImpl::setCallbacks(WebIDBTransactionCallbacks* callbacks) m_backend->setCallbacks(idbCallbacks.get()); } +IDBTransactionBackendInterface* WebIDBTransactionImpl::getIDBTransactionBackendInterface() const +{ + return m_backend.get(); +} + } // namespace WebKit #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.h b/WebKit/chromium/src/WebIDBTransactionImpl.h index a9bde68..24bab91 100644 --- a/WebKit/chromium/src/WebIDBTransactionImpl.h +++ b/WebKit/chromium/src/WebIDBTransactionImpl.h @@ -33,8 +33,6 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -namespace WebCore { class IDBTransactionBackendInterface; } - namespace WebKit { // See comment in WebIndexedDatabase for a high level overview these classes. @@ -46,9 +44,12 @@ public: virtual int mode() const; virtual WebIDBObjectStore* objectStore(const WebString& name); virtual void abort(); + virtual void didCompleteTaskEvents(); virtual int id() const; virtual void setCallbacks(WebIDBTransactionCallbacks*); + virtual WebCore::IDBTransactionBackendInterface* getIDBTransactionBackendInterface() const; + private: WTF::RefPtr<WebCore::IDBTransactionBackendInterface> m_backend; }; diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 25d484c..7779dbc 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -75,11 +75,6 @@ bool WebInputElement::isEnabledFormControl() const return constUnwrap<HTMLInputElement>()->isEnabledFormControl(); } -WebInputElement::InputType WebInputElement::inputType() const -{ - return static_cast<InputType>(constUnwrap<HTMLInputElement>()->deprecatedInputType()); -} - int WebInputElement::maxLength() const { return constUnwrap<HTMLInputElement>()->maxLength(); diff --git a/WebKit/chromium/src/WebPerformance.cpp b/WebKit/chromium/src/WebPerformance.cpp new file mode 100644 index 0000000..f019793 --- /dev/null +++ b/WebKit/chromium/src/WebPerformance.cpp @@ -0,0 +1,160 @@ +/* + * 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 "WebPerformance.h" + +#include "Performance.h" + +using namespace WebCore; + +namespace WebKit { + +void WebPerformance::reset() +{ + m_private.reset(); +} + +void WebPerformance::assign(const WebPerformance& other) +{ + m_private = other.m_private; +} + +WebNavigationType WebPerformance::navigationType() const +{ + switch (m_private->navigation()->type()) { + case Navigation::NAVIGATE: + return WebNavigationTypeOther; + case Navigation::RELOAD: + return WebNavigationTypeReload; + case Navigation::BACK_FORWARD: + return WebNavigationTypeBackForward; + } + ASSERT_NOT_REACHED(); + return WebNavigationTypeOther; +} + +double WebPerformance::navigationStart() const +{ + return static_cast<double>(m_private->timing()->navigationStart()); +} + +double WebPerformance::unloadEventEnd() const +{ + return static_cast<double>(m_private->timing()->unloadEventEnd()); +} + +double WebPerformance::redirectStart() const +{ + return static_cast<double>(m_private->timing()->redirectStart()); +} + +double WebPerformance::redirectEnd() const +{ + return static_cast<double>(m_private->timing()->redirectEnd()); +} + +unsigned short WebPerformance::redirectCount() const +{ + return m_private->navigation()->redirectCount(); +} + +double WebPerformance::fetchStart() const +{ + return static_cast<double>(m_private->timing()->fetchStart()); +} + +double WebPerformance::domainLookupStart() const +{ + return static_cast<double>(m_private->timing()->domainLookupStart()); +} + +double WebPerformance::domainLookupEnd() const +{ + return static_cast<double>(m_private->timing()->domainLookupEnd()); +} + +double WebPerformance::connectStart() const +{ + return static_cast<double>(m_private->timing()->connectStart()); +} + +double WebPerformance::connectEnd() const +{ + return static_cast<double>(m_private->timing()->connectEnd()); +} + +double WebPerformance::requestStart() const +{ + return static_cast<double>(m_private->timing()->requestStart()); +} + +double WebPerformance::requestEnd() const +{ + return static_cast<double>(m_private->timing()->requestEnd()); +} + +double WebPerformance::responseStart() const +{ + return static_cast<double>(m_private->timing()->responseStart()); +} + +double WebPerformance::responseEnd() const +{ + return static_cast<double>(m_private->timing()->responseEnd()); +} + +double WebPerformance::loadEventStart() const +{ + return static_cast<double>(m_private->timing()->loadEventStart()); +} + +double WebPerformance::loadEventEnd() const +{ + return static_cast<double>(m_private->timing()->loadEventEnd()); +} + +WebPerformance::WebPerformance(const PassRefPtr<Performance>& performance) + : m_private(performance) +{ +} + +WebPerformance& WebPerformance::operator=(const PassRefPtr<Performance>& performance) +{ + m_private = performance; + return *this; +} + +WebPerformance::operator PassRefPtr<Performance>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebScriptController.cpp b/WebKit/chromium/src/WebScriptController.cpp index d2c168d..8877ba0 100644 --- a/WebKit/chromium/src/WebScriptController.cpp +++ b/WebKit/chromium/src/WebScriptController.cpp @@ -43,7 +43,7 @@ namespace WebKit { void WebScriptController::registerExtension(v8::Extension* extension) { - V8Proxy::registerExtension(extension, WebString()); + V8Proxy::registerExtension(extension); } void WebScriptController::registerExtension(v8::Extension* extension, diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 329027c..9953b5c 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -289,4 +289,14 @@ void WebSettingsImpl::setMemoryInfoEnabled(bool enabled) m_settings->setMemoryInfoEnabled(enabled); } +void WebSettingsImpl::setHyperlinkAuditingEnabled(bool enabled) +{ + m_settings->setHyperlinkAuditingEnabled(enabled); +} + +void WebSettingsImpl::setCaretBrowsingEnabled(bool enabled) +{ + m_settings->setCaretBrowsingEnabled(enabled); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index 0120dbc..6d40b4f 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -89,6 +89,8 @@ public: virtual void setAcceleratedCompositingEnabled(bool); virtual void setAccelerated2dCanvasEnabled(bool); virtual void setMemoryInfoEnabled(bool); + virtual void setHyperlinkAuditingEnabled(bool); + virtual void setCaretBrowsingEnabled(bool); private: WebCore::Settings* m_settings; diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index a1c6578..c3df0c7 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -125,7 +125,7 @@ #if OS(WINDOWS) #include "RenderThemeChromiumWin.h" #else -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) #include "RenderThemeChromiumLinux.h" #endif #include "RenderTheme.h" @@ -429,7 +429,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) || (event.button == WebMouseEvent::ButtonLeft && event.modifiers & WebMouseEvent::ControlKey)) mouseContextMenu(event); -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) if (event.button == WebMouseEvent::ButtonRight) mouseContextMenu(event); #endif @@ -468,7 +468,7 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return; -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) // If the event was a middle click, attempt to copy text into the focused // frame. We execute this before we let the page have a go at the event // because the page may change what is focused during in its event handler. @@ -552,11 +552,11 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event) if (!handler) return keyEventDefault(event); -#if OS(WINDOWS) || OS(LINUX) +#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) const WebInputEvent::Type contextMenuTriggeringEventType = #if OS(WINDOWS) WebInputEvent::KeyUp; -#elif OS(LINUX) +#elif OS(LINUX) || OS(FREEBSD) WebInputEvent::RawKeyDown; #endif @@ -700,7 +700,7 @@ bool WebViewImpl::touchEvent(const WebTouchEvent& event) } #endif -#if OS(WINDOWS) || OS(LINUX) +#if OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) // Mac has no way to open a context menu based on a keyboard event. bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) { @@ -925,7 +925,7 @@ void WebViewImpl::resize(const WebSize& newSize) m_client->didInvalidateRect(damagedRect); } -#if OS(DARWIN) +#if USE(ACCELERATED_COMPOSITING) && OS(DARWIN) if (m_layerRenderer) { m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_size.width), std::max(1, m_size.height))); @@ -1041,8 +1041,6 @@ void WebViewImpl::composite(bool finish) #endif } -// FIXME: m_currentInputEvent should be removed once ChromeClient::show() can -// get the current-event information from WebCore. const WebInputEvent* WebViewImpl::m_currentInputEvent = 0; bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) @@ -1057,6 +1055,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_ignoreInputEvents) return true; + m_currentInputEvent = &inputEvent; + if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) { // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. RefPtr<Node> node = m_mouseCaptureNode; @@ -1086,17 +1086,10 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) node->dispatchMouseEvent( PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), eventType); + m_currentInputEvent = 0; return true; } - // FIXME: Remove m_currentInputEvent. - // This only exists to allow ChromeClient::show() to know which mouse button - // triggered a window.open event. - // Safari must perform a similar hack, ours is in our WebKit glue layer - // theirs is in the application. This should go when WebCore can be fixed - // to pass more event information to ChromeClient::show() - m_currentInputEvent = &inputEvent; - bool handled = true; // FIXME: WebKit seems to always return false on mouse events processing @@ -1984,7 +1977,7 @@ void WebViewImpl::setDomainRelaxationForbidden(bool forbidden, const WebString& void WebViewImpl::setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor) { -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) PlatformThemeChromiumGtk::setScrollbarColors(inactiveColor, activeColor, trackColor); @@ -1995,7 +1988,7 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, unsigned activeForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor) { -#if OS(LINUX) +#if OS(LINUX) || OS(FREEBSD) RenderThemeChromiumLinux::setSelectionColors(activeBackgroundColor, activeForegroundColor, inactiveBackgroundColor, @@ -2022,7 +2015,8 @@ void WebView::addUserScript(const WebString& sourceCode, void WebView::addUserStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patternsIn, - WebView::UserContentInjectIn injectIn) + WebView::UserContentInjectIn injectIn, + WebView::UserStyleInjectionTime injectionTime) { OwnPtr<Vector<String> > patterns(new Vector<String>); for (size_t i = 0; i < patternsIn.size(); ++i) @@ -2037,7 +2031,8 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0, static_cast<UserContentInjectedFrames>(injectIn), - UserStyleSheet::AuthorLevel); + UserStyleAuthorLevel, + static_cast<WebCore::UserStyleInjectionTime>(injectionTime)); } void WebView::removeAllUserContent() @@ -2206,8 +2201,6 @@ void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) void WebViewImpl::setRootLayerNeedsDisplay() { - if (m_layerRenderer) - m_layerRenderer->setNeedsDisplay(); m_client->scheduleComposite(); // FIXME: To avoid breaking the downstream Chrome render_widget while downstream // changes land, we also have to pass a 1x1 invalidate up to the client @@ -2247,7 +2240,7 @@ void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& // rects allows us to intermix invalidates with scrolls. IntRect damagedContentsRect; if (scrollDelta.width()) { - float dx = static_cast<float>(scrollDelta.width()); + int dx = scrollDelta.width(); damagedContentsRect.setY(contentRect.y()); damagedContentsRect.setHeight(contentRect.height()); if (dx > 0) { @@ -2258,7 +2251,7 @@ void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& damagedContentsRect.setWidth(-dx); } } else { - float dy = static_cast<float>(scrollDelta.height()); + int dy = scrollDelta.height(); damagedContentsRect.setX(contentRect.x()); damagedContentsRect.setWidth(contentRect.width()); if (dy > 0) { @@ -2270,7 +2263,7 @@ void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& } } - m_scrollDamage.unite(damagedContentsRect); + m_rootLayerScrollDamage.unite(damagedContentsRect); setRootLayerNeedsDisplay(); } @@ -2289,10 +2282,12 @@ void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) // rect is in viewport space. Convert to content space // so that invalidations and scroll invalidations play well with one-another. - FloatRect contentRect = view->windowToContents(rect); + IntRect contentRect = view->windowToContents(rect); - // FIXME: add a smarter damage aggregation logic? Right now, LayerChromium does simple union-ing. - m_layerRenderer->rootLayer()->setNeedsDisplay(contentRect); + // FIXME: add a smarter damage aggregation logic and/or unify with + // LayerChromium's damage logic + m_rootLayerDirtyRect.unite(contentRect); + setRootLayerNeedsDisplay(); } @@ -2301,23 +2296,29 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) if (m_isAcceleratedCompositingActive == active) return; - if (active) { - OwnPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release(); - if (!context) { - context = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); - if (context) - context->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); - } - m_layerRenderer = LayerRendererChromium::create(context.release()); - if (m_layerRenderer) { - m_isAcceleratedCompositingActive = true; - } else { - m_isAcceleratedCompositingActive = false; - m_compositorCreationFailed = true; - } + if (!active) { + m_isAcceleratedCompositingActive = false; + return; + } + + if (m_layerRenderer) { + m_isAcceleratedCompositingActive = true; + return; + } + + OwnPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release(); + if (!context) { + context = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); + if (context) + context->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); + } + m_layerRenderer = LayerRendererChromium::create(context.release()); + if (m_layerRenderer) { + m_isAcceleratedCompositingActive = true; + m_compositorCreationFailed = false; } else { - m_layerRenderer = 0; m_isAcceleratedCompositingActive = false; + m_compositorCreationFailed = true; } } @@ -2391,14 +2392,14 @@ void WebViewImpl::doComposite() m_layerRenderer->prepareToDrawLayers(visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); // Draw the contents of the root layer. - Vector<FloatRect> damageRects; - damageRects.append(m_scrollDamage); - damageRects.append(m_layerRenderer->rootLayer()->dirtyRect()); + Vector<IntRect> damageRects; + damageRects.append(m_rootLayerScrollDamage); + damageRects.append(m_rootLayerDirtyRect); for (size_t i = 0; i < damageRects.size(); ++i) { // The damage rect for the root layer is in content space [e.g. unscrolled]. // Convert from content space to viewPort space. - const FloatRect damagedContentRect = damageRects[i]; - IntRect damagedRect = view->contentsToWindow(IntRect(damagedContentRect)); + const IntRect damagedContentRect = damageRects[i]; + IntRect damagedRect = view->contentsToWindow(damagedContentRect); // Intersect this rectangle with the viewPort. damagedRect.intersect(viewPort); @@ -2409,8 +2410,8 @@ void WebViewImpl::doComposite() m_layerRenderer->updateRootLayerTextureRect(damagedRect); } } - m_layerRenderer->rootLayer()->resetNeedsDisplay(); - m_scrollDamage = WebRect(); + m_rootLayerDirtyRect = IntRect(); + m_rootLayerScrollDamage = IntRect(); // Draw the actual layers... m_layerRenderer->drawLayers(visibleRect, contentRect); @@ -2431,32 +2432,28 @@ SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D() return m_sharedContext3D.get(); } -WebGLES2Context* WebViewImpl::gles2Context() -{ - return 0; -} - WebGraphicsContext3D* WebViewImpl::graphicsContext3D() { #if USE(ACCELERATED_COMPOSITING) - GraphicsContext3D* context = 0; - if (m_layerRenderer) - context = m_layerRenderer->context(); - else if (m_temporaryOnscreenGraphicsContext3D) - context = m_temporaryOnscreenGraphicsContext3D.get(); - else { - GraphicsContext3D::Attributes attributes; - m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); + if (m_page->settings()->acceleratedCompositingEnabled() && allowsAcceleratedCompositing()) { + GraphicsContext3D* context = 0; + if (m_layerRenderer) + context = m_layerRenderer->context(); + else if (m_temporaryOnscreenGraphicsContext3D) + context = m_temporaryOnscreenGraphicsContext3D.get(); + 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)); + if (m_temporaryOnscreenGraphicsContext3D) + m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); #endif - context = m_temporaryOnscreenGraphicsContext3D.get(); + context = m_temporaryOnscreenGraphicsContext3D.get(); + } + return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); } - return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); -#else - return 0; #endif + return 0; } } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index bbd25a2..9db914d 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -317,9 +317,8 @@ public: void hideAutoFillPopup(); - // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can - // fix WebKit to pass enough information up into ChromeClient::show() so we - // can decide if the window.open event was caused by a middle-mouse click + // Returns the input event we're currently processing. This is used in some + // cases where the WebCore DOM event doesn't have the information we need. static const WebInputEvent* currentInputEvent() { return m_currentInputEvent; @@ -332,9 +331,6 @@ public: void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect); void invalidateRootLayerRect(const WebCore::IntRect&); #endif - // FIXME: remove this method once the compositor is fully switched - // over to GraphicsContext3D. - virtual WebGLES2Context* gles2Context(); // Returns the onscreen 3D context used by the compositor. This is // used by the renderer's code to set up resource sharing between @@ -526,8 +522,9 @@ private: RefPtr<WebCore::Node> m_mouseCaptureNode; #if USE(ACCELERATED_COMPOSITING) - WebCore::IntRect m_scrollDamage; - OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; + WebCore::IntRect m_rootLayerDirtyRect; + WebCore::IntRect m_rootLayerScrollDamage; + RefPtr<WebCore::LayerRendererChromium> m_layerRenderer; bool m_isAcceleratedCompositingActive; bool m_compositorCreationFailed; #endif diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 42f41d2..622f5c2 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -37,6 +37,7 @@ #include "PlatformMessagePortChannel.h" #include "WebDataSourceImpl.h" +#include "WebFileError.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebMessagePortChannel.h" @@ -45,6 +46,8 @@ #include "WebView.h" #include "WebWorkerClient.h" +#include "WorkerContext.h" +#include "WorkerFileSystemCallbacksBridge.h" #include "WorkerScriptController.h" #include "WorkerThread.h" #include <wtf/MainThread.h> @@ -56,6 +59,7 @@ namespace WebKit { #if ENABLE(WORKERS) static const char allowDatabaseMode[] = "allowDatabaseMode"; +static const char openFileSystemMode[] = "openFileSystemMode"; namespace { @@ -114,6 +118,7 @@ private: WebWorkerBase* m_worker; WTF::String m_mode; }; + } // This function is called on the main thread to force to initialize some static @@ -231,6 +236,17 @@ bool WebWorkerBase::allowDatabase(WebFrame*, const WebString& name, const WebStr return bridge->result(); } +#if ENABLE(FILE_SYSTEM) +void WebWorkerBase::openFileSystem(WebFileSystem::Type type, long long size, WebFileSystemCallbacks* callbacks) +{ + WorkerScriptController* controller = WorkerScriptController::controllerForContext(); + WorkerContext* workerContext = controller->workerContext(); + + RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(this, workerContext, callbacks); + bridge->postOpenFileSystemToMainThread(commonClient(), type, size, openFileSystemMode); +} +#endif + // WorkerObjectProxy ----------------------------------------------------------- void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h index 22711f9..1f4bc03 100644 --- a/WebKit/chromium/src/WebWorkerBase.h +++ b/WebKit/chromium/src/WebWorkerBase.h @@ -91,6 +91,11 @@ public: // Controls whether access to Web Databases is allowed for this worker. virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize); +#if ENABLE(FILE_SYSTEM) + // Requests to open a file system for this worker. (Note that this is not the implementation for WebFrameClient::openFileSystem.) + void openFileSystem(WebFileSystem::Type, long long size, WebFileSystemCallbacks*); +#endif + // Executes the given task on the main thread. static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); diff --git a/WebKit/chromium/src/WebWorkerClientImpl.h b/WebKit/chromium/src/WebWorkerClientImpl.h index 741d606..0604823 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/WebKit/chromium/src/WebWorkerClientImpl.h @@ -33,8 +33,8 @@ #if ENABLE(WORKERS) +#include "WebFileSystem.h" #include "WebWorkerClient.h" - #include "WorkerContextProxy.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> @@ -99,6 +99,10 @@ public: ASSERT_NOT_REACHED(); return true; } + virtual void openFileSystem(WebFrame*, WebFileSystem::Type, long long size, WebFileSystemCallbacks*) + { + ASSERT_NOT_REACHED(); + } private: virtual ~WebWorkerClientImpl(); diff --git a/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp new file mode 100644 index 0000000..d112886 --- /dev/null +++ b/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp @@ -0,0 +1,190 @@ +/* + * 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 "WorkerFileSystemCallbacksBridge.h" + +#if ENABLE(FILE_SYSTEM) + +#include "CrossThreadTask.h" +#include "WebCommonWorkerClient.h" +#include "WebFileSystemCallbacks.h" +#include "WebString.h" +#include "WebWorkerBase.h" +#include "WorkerContext.h" +#include "WorkerScriptController.h" +#include "WorkerThread.h" +#include <wtf/MainThread.h> +#include <wtf/Threading.h> + +using namespace WebCore; + +namespace WebKit { + +// FileSystemCallbacks that are to be dispatched on the main thread. +class MainThreadFileSystemCallbacks : public WebFileSystemCallbacks { +public: + static PassOwnPtr<MainThreadFileSystemCallbacks> create(PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode) + { + return adoptPtr(new MainThreadFileSystemCallbacks(bridge, mode)); + } + + virtual ~MainThreadFileSystemCallbacks() + { + } + + virtual void didOpenFileSystem(const WebString& name, const WebString& path) + { + m_bridge->didOpenFileSystemOnMainThread(name, path, m_mode); + delete this; + } + + virtual void didFail(WebFileError error) + { + m_bridge->didFailOnMainThread(error, m_mode); + delete this; + } + + virtual void didSucceed() + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + virtual void didReadMetadata(const WebFileInfo& info) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + +private: + MainThreadFileSystemCallbacks(PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode) + : m_bridge(bridge) + , m_mode(mode) + { + ASSERT(m_bridge.get()); + } + + friend class WorkerFileSystemCallbacksBridge; + RefPtr<WorkerFileSystemCallbacksBridge> m_bridge; + const String m_mode; +}; + +void WorkerFileSystemCallbacksBridge::stop() +{ + ASSERT(m_workerContext->isContextThread()); + MutexLocker locker(m_mutex); + m_worker = 0; + + if (m_callbacksOnWorkerThread) { + m_callbacksOnWorkerThread->didFail(WebFileErrorAbort); + m_callbacksOnWorkerThread = 0; + } +} + +void WorkerFileSystemCallbacksBridge::postOpenFileSystemToMainThread(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, const String& mode) +{ + m_selfRef = this; + ASSERT(m_workerContext->isContextThread()); + ASSERT(m_worker); + m_worker->dispatchTaskToMainThread(createCallbackTask(&openFileSystemOnMainThread, commonClient, type, size, this, mode)); +} + +void WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread(ScriptExecutionContext*, WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, WorkerFileSystemCallbacksBridge* bridge, const String& mode) +{ + ASSERT(isMainThread()); + if (!commonClient) + bridge->didFailOnMainThread(WebFileErrorAbort, mode); + else { + // MainThreadFileSystemCallbacks is self-destructed, so we leak ptr here. + commonClient->openFileSystem(type, size, MainThreadFileSystemCallbacks::create(bridge, mode).leakPtr()); + } +} + +void WorkerFileSystemCallbacksBridge::didFailOnMainThread(WebFileError error, const String& mode) +{ + ASSERT(isMainThread()); + mayPostTaskToWorker(createCallbackTask(&didFailOnWorkerThread, m_selfRef, error), mode); +} + +void WorkerFileSystemCallbacksBridge::didOpenFileSystemOnMainThread(const String& name, const String& rootPath, const String& mode) +{ + ASSERT(isMainThread()); + mayPostTaskToWorker(createCallbackTask(&didOpenFileSystemOnWorkerThread, m_selfRef, name, rootPath), mode); +} + +WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge(WebWorkerBase* worker, ScriptExecutionContext* scriptExecutionContext, WebFileSystemCallbacks* callbacks) + : WorkerContext::Observer(static_cast<WorkerContext*>(scriptExecutionContext)) + , m_worker(worker) + , m_workerContext(scriptExecutionContext) + , m_callbacksOnWorkerThread(callbacks) +{ + ASSERT(m_workerContext->isContextThread()); +} + +WorkerFileSystemCallbacksBridge::~WorkerFileSystemCallbacksBridge() +{ + ASSERT(!m_callbacksOnWorkerThread); +} + +void WorkerFileSystemCallbacksBridge::didFailOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, WebFileError error) +{ + if (bridge->m_callbacksOnWorkerThread) { + ASSERT(bridge->m_workerContext->isContextThread()); + bridge->m_callbacksOnWorkerThread->didFail(error); + bridge->m_callbacksOnWorkerThread = 0; + } +} + +void WorkerFileSystemCallbacksBridge::didOpenFileSystemOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& name, const String& rootPath) +{ + if (bridge->m_callbacksOnWorkerThread) { + ASSERT(bridge->m_workerContext->isContextThread()); + bridge->m_callbacksOnWorkerThread->didOpenFileSystem(name, rootPath); + bridge->m_callbacksOnWorkerThread = 0; + } +} + +void WorkerFileSystemCallbacksBridge::mayPostTaskToWorker(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode) +{ + { // Let go of the mutex before possibly deleting this due to m_selfRef.clear(). + MutexLocker locker(m_mutex); + if (m_worker) + m_worker->postTaskForModeToWorkerContext(task, mode); + } + m_selfRef.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h new file mode 100644 index 0000000..899127e --- /dev/null +++ b/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -0,0 +1,122 @@ +/* + * 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 WorkerFileSystemCallbacksBridge_h +#define WorkerFileSystemCallbacksBridge_h + +#if ENABLE(FILE_SYSTEM) + +#include "PlatformString.h" +#include "ScriptExecutionContext.h" +#include "WebFileError.h" +#include "WebFileSystem.h" +#include "WebVector.h" +#include "WorkerContext.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Threading.h> + +namespace WebKit { + +class AsyncFileSystem; +class MainThreadFileSystemCallbacks; +class ThreadableCallbacksBridgeWrapper; +class WebCommonWorkerClient; +class WebFileSystemCallbacks; +class WebWorkerBase; +struct WebFileInfo; +struct WebFileSystemEntry; + +// This class is used to post a openFileSystem request to the main thread and get called back for the request. This must be destructed on the worker thread. +// +// A typical flow for openFileSystem would look like this: +// Bridge::postOpenFileSystemToMainThread() on WorkerThread +// --> Bridge::openFileSystemOnMainThread() is called on MainThread +// This makes an IPC with a MainThreadFileSystemCallbacks instance +// [actual operation is down in the browser] +// --> MainThreadFileSystemCallbacks::didXxx is called on MainThread +// --> Bridge::didXxxOnMainThread is called on MainThread +// --> Bridge::didXxxOnWorkerThread is called on WorkerThread +// This calls the original callbacks (m_callbacksOnWorkerThread) and +// releases a self-reference to the bridge. +class WorkerFileSystemCallbacksBridge : public ThreadSafeShared<WorkerFileSystemCallbacksBridge>, public WebCore::WorkerContext::Observer { +public: + static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebWorkerBase* worker, WebCore::ScriptExecutionContext* workerContext, WebFileSystemCallbacks* callbacks) + { + return WTF::adoptRef(new WorkerFileSystemCallbacksBridge(worker, workerContext, callbacks)); + } + ~WorkerFileSystemCallbacksBridge(); + + // WorkerContext::Observer method. + virtual void notifyStop() + { + stop(); + } + + void stop(); + + // Posts an initial request task to the main thread. It is supposed to be called immediately after the bridge is constructed. (It doesn't check if the context has been stopped or not.) + void postOpenFileSystemToMainThread(WebCommonWorkerClient*, WebFileSystem::Type, long long size, const String& mode); + + // Callback methods that are called on the main thread. + void didFailOnMainThread(WebFileError, const String& mode); + void didOpenFileSystemOnMainThread(const String& name, const String& rootPath, const String& mode); + +private: + WorkerFileSystemCallbacksBridge(WebWorkerBase*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacks*); + + // Method that is to be called on the main thread. + static void openFileSystemOnMainThread(WebCore::ScriptExecutionContext*, WebCommonWorkerClient*, WebFileSystem::Type, long long size, WorkerFileSystemCallbacksBridge*, const String& mode); + + friend class MainThreadFileSystemCallbacks; + + // Methods that dispatch WebFileSystemCallbacks on the worker threads. + // They release a selfRef of the WorkerFileSystemCallbacksBridge. + static void didFailOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>, WebFileError); + static void didOpenFileSystemOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& name, const String& rootPath); + + void mayPostTaskToWorker(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode); + + // m_selfRef keeps a reference to itself until a task is created for the worker thread (at which point the task holds the reference). + RefPtr<WorkerFileSystemCallbacksBridge> m_selfRef; + + Mutex m_mutex; + WebWorkerBase* m_worker; + WebCore::ScriptExecutionContext* m_workerContext; + + // This is self-destructed and must be fired on the worker thread. + WebFileSystemCallbacks* m_callbacksOnWorkerThread; +}; + +} // namespace WebCore + +#endif + +#endif // WorkerFileSystemCallbacksBridge_h diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index f8a1386..0d55c43 100644 --- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -85,6 +85,10 @@ static int gdkStateToWebEventModifiers(guint state) modifiers |= WebInputEvent::MiddleButtonDown; if (state & GDK_BUTTON3_MASK) modifiers |= WebInputEvent::RightButtonDown; + if (state & GDK_LOCK_MASK) + modifiers |= WebInputEvent::CapsLockOn; + if (state & GDK_MOD2_MASK) + modifiers |= WebInputEvent::NumLockOn; return modifiers; } diff --git a/WebKit/chromium/src/gtk/WebScreenInfoFactory.cpp b/WebKit/chromium/src/gtk/WebScreenInfoFactory.cpp deleted file mode 100644 index 081daa2..0000000 --- a/WebKit/chromium/src/gtk/WebScreenInfoFactory.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2009 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 "WebScreenInfoFactory.h" - -#include "WebScreenInfo.h" -#include <gtk/gtk.h> - -namespace WebKit { - -WebScreenInfo WebScreenInfoFactory::screenInfo(GtkWidget* widget) -{ - WebScreenInfo results; - results.depth = 32; - results.depthPerComponent = 8; - results.isMonochrome = false; - - if (!widget) - return results; - - GdkScreen* screen = gtk_widget_get_screen(widget); - - results.rect = WebRect( - 0, 0, gdk_screen_get_width(screen), gdk_screen_get_height(screen)); - - // I don't know of a way to query the "maximize" size of the window (e.g. - // screen size less sidebars etc) since this is something which only the - // window manager knows. - results.availableRect = results.rect; - - return results; -} - -} // namespace WebKit diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 0c7241d..a66e174 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -45,7 +45,7 @@ var context = {}; // Used by WebCore's inspector routines. Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; Preferences.onlineDetectionEnabled = false; - Preferences.domBreakpointsEnabled = true; + Preferences.nativeInstrumentationEnabled = true; })(); var devtools = devtools || {}; diff --git a/WebKit/chromium/src/win/WebInputEventFactory.cpp b/WebKit/chromium/src/win/WebInputEventFactory.cpp index d1d5869..c71a3b6 100644 --- a/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -86,6 +86,16 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) return keypad; } +// Loads the state for toggle keys into the event. +static void SetToggleKeyState(WebInputEvent* event) +{ + // Low bit set from GetKeyState indicates "toggled". + if (::GetKeyState(VK_NUMLOCK) & 1) + event->modifiers |= WebInputEvent::NumLockOn; + if (::GetKeyState(VK_CAPITAL) & 1) + event->modifiers |= WebInputEvent::CapsLockOn; +} + WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -144,6 +154,7 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, if (isKeyPad(wparam, lparam)) result.modifiers |= WebInputEvent::IsKeyPad; + SetToggleKeyState(&result); return result; } @@ -289,6 +300,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(HWND hwnd, UINT message, if (wparam & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; + SetToggleKeyState(&result); return result; } @@ -386,6 +398,8 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message if (keyState & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; + SetToggleKeyState(&result); + // Set coordinates by translating event coordinates from screen to client. POINT clientPoint = { result.globalX, result.globalY }; MapWindowPoints(0, hwnd, &clientPoint, 1); |