diff options
author | Kristian Monsen <kristianm@google.com> | 2010-05-21 16:53:46 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-05-25 10:24:15 +0100 |
commit | 6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch) | |
tree | f7111b9b22befab472616c1d50ec94eb50f1ec8c /WebKit/chromium/src | |
parent | a149172322a9067c14e8b474a53e63649aa17cad (diff) | |
download | external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2 |
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebKit/chromium/src')
52 files changed, 768 insertions, 185 deletions
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index 1d2948f..e7aeb49 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -51,6 +51,7 @@ #include "WebInputElement.h" #include "WebMediaPlayer.h" #include "WebNotificationPresenter.h" +#include "WebScrollbar.h" #include "WebTextAffinity.h" #include "WebTextCaseSensitivity.h" #include <wtf/Assertions.h> @@ -291,6 +292,14 @@ COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, Not COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationPresenter::PermissionDenied); #endif +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::Horizontal, HorizontalScrollbar); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::Vertical, VerticalScrollbar); + +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByLine, ScrollByLine); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPage, ScrollByPage); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByDocument, ScrollByDocument); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPixel, ScrollByPixel); + COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM); COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM); diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 74f0bd8..1a366bc 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -66,6 +66,7 @@ #include "WebFrameImpl.h" #include "WebInputEvent.h" #include "WebKit.h" +#include "WebNode.h" #include "WebPopupMenuImpl.h" #include "WebPopupMenuInfo.h" #include "WebPopupType.h" @@ -214,6 +215,8 @@ void ChromeClientImpl::takeFocus(FocusDirection direction) void ChromeClientImpl::focusedNodeChanged(Node* node) { + m_webView->client()->focusedNodeChanged(WebNode(node)); + WebURL focus_url; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a @@ -689,6 +692,7 @@ void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer, info->itemFontSize = popupContainer->menuItemFontSize(); info->selectedIndex = popupContainer->selectedIndex(); info->items.swap(outputItems); + info->rightAligned = popupContainer->menuStyle().textDirection() == RTL; } void ChromeClientImpl::didChangeAccessibilityObjectState(AccessibilityObject* obj) @@ -708,6 +712,7 @@ NotificationPresenter* ChromeClientImpl::notificationPresenter() const void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) { GeolocationServiceChromium* geolocationService = static_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService()); + geolocationService->geolocationServiceBridge()->attachBridgeIfNeeded(); m_webView->client()->geolocationService()->requestPermissionForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url()); } diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index a0e8d3b..d188016 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -132,6 +132,13 @@ static WebCookieJar* getCookieJar(const Document* document) return cookieJar; } +// Cache ---------------------------------------------------------------------- + +void ChromiumBridge::cacheMetadata(const KURL& url, double responseTime, const Vector<char>& data) +{ + webKitClient()->cacheMetadata(url, responseTime, data.data(), data.size()); +} + // Clipboard ------------------------------------------------------------------ bool ChromiumBridge::clipboardIsFormatAvailable( @@ -432,9 +439,9 @@ GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(Geoloca // HTML5 DB ------------------------------------------------------------------- #if ENABLE(DATABASE) -PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags, PlatformFileHandle* dirHandle) +PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags) { - return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags, dirHandle); + return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags); } int ChromiumBridge::databaseDeleteFile(const String& vfsFileName, bool syncDir) @@ -672,6 +679,13 @@ void ChromiumBridge::paintTrackbar( gc->platformContext()->canvas(), part, state, classicState, rect); } +void ChromiumBridge::paintProgressBar( + GraphicsContext* gc, const IntRect& barRect, int valuePart, const IntRect& valueRect) +{ + webKitClient()->themeEngine()->paintProgressBar( + gc->platformContext()->canvas(), barRect, valuePart, valueRect); +} + #endif // Trace Event ---------------------------------------------------------------- diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index bee4310..b6005f9 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -151,9 +151,6 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // all else. data.linkURL = r.absoluteLinkURL(); - data.mediaType = WebContextMenuData::MediaTypeNone; - data.mediaFlags = WebContextMenuData::MediaNone; - if (!r.absoluteImageURL().isEmpty()) { data.srcURL = r.absoluteImageURL(); data.mediaType = WebContextMenuData::MediaTypeImage; @@ -202,7 +199,6 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (r.isSelected()) data.selectedText = selectedFrame->selectedText().stripWhiteSpace(); - data.isEditable = false; if (r.isContentEditable()) { data.isEditable = true; if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { @@ -212,11 +208,6 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( } #if OS(DARWIN) - // Writing direction context menu. - data.writingDirectionDefault = WebContextMenuData::CheckableMenuItemDisabled; - data.writingDirectionLeftToRight = WebContextMenuData::CheckableMenuItemEnabled; - data.writingDirectionRightToLeft = WebContextMenuData::CheckableMenuItemEnabled; - ExceptionCode ec = 0; RefPtr<CSSStyleDeclaration> style = selectedFrame->document()->createCSSStyleDeclaration(); style->setProperty(CSSPropertyDirection, "ltr", false, ec); diff --git a/WebKit/chromium/src/DatabaseObserver.cpp b/WebKit/chromium/src/DatabaseObserver.cpp index 6a2e2a7..1c5117c 100644 --- a/WebKit/chromium/src/DatabaseObserver.cpp +++ b/WebKit/chromium/src/DatabaseObserver.cpp @@ -50,12 +50,16 @@ namespace WebCore { bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize) { ASSERT(scriptExecutionContext->isContextThread()); - // FIXME: add support for the case scriptExecutionContext()->isWorker() once workers implement web databases. - ASSERT(scriptExecutionContext->isDocument()); + ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerContext()); if (scriptExecutionContext->isDocument()) { Document* document = static_cast<Document*>(scriptExecutionContext); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); return webFrame->client()->allowDatabase(webFrame, name, displayName, estimatedSize); + } else { + WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext); + WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); + WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); + return webWorker->allowDatabase(0, name, displayName, estimatedSize); } return true; diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index c163f62..25be623 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -31,14 +31,12 @@ #ifndef FrameLoaderClientImpl_h #define FrameLoaderClientImpl_h -// FIXME: remove this relative path once consumers from glue are removed. -#include "../public/WebNavigationPolicy.h" #include "FrameLoaderClient.h" #include "KURL.h" +#include "WebNavigationPolicy.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> - namespace WebKit { class WebFrameImpl; diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index e51f433..7c5635b 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -40,16 +40,16 @@ #include "ImageBuffer.h" #include "ImageData.h" #include "WebGLBuffer.h" -#include "WebGLByteArray.h" -#include "WebGLFloatArray.h" +#include "Int8Array.h" +#include "FloatArray.h" #include "WebGLFramebuffer.h" -#include "WebGLIntArray.h" +#include "Int32Array.h" #include "WebGLProgram.h" #include "WebGLRenderbuffer.h" #include "WebGLRenderingContext.h" #include "WebGLShader.h" #include "WebGLTexture.h" -#include "WebGLUnsignedByteArray.h" +#include "Uint8Array.h" #include "WebGraphicsContext3D.h" #include "WebGraphicsContext3DDefaultImpl.h" #include "WebKit.h" @@ -130,8 +130,8 @@ public: void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); void bufferData(unsigned long target, int size, unsigned long usage); - void bufferData(unsigned long target, WebGLArray* data, unsigned long usage); - void bufferSubData(unsigned long target, long offset, WebGLArray* data); + void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage); + void bufferSubData(unsigned long target, long offset, ArrayBufferView* data); unsigned long checkFramebufferStatus(unsigned long target); void clear(unsigned long mask); @@ -673,12 +673,12 @@ void GraphicsContext3DInternal::bufferData(unsigned long target, int size, unsig m_impl->bufferData(target, size, 0, usage); } -void GraphicsContext3DInternal::bufferData(unsigned long target, WebGLArray* array, unsigned long usage) +void GraphicsContext3DInternal::bufferData(unsigned long target, ArrayBufferView* array, unsigned long usage) { m_impl->bufferData(target, array->byteLength(), array->baseAddress(), usage); } -void GraphicsContext3DInternal::bufferSubData(unsigned long target, long offset, WebGLArray* array) +void GraphicsContext3DInternal::bufferSubData(unsigned long target, long offset, ArrayBufferView* array) { m_impl->bufferSubData(target, offset, array->byteLength(), array->baseAddress()); } @@ -1104,8 +1104,8 @@ DELEGATE_TO_INTERNAL_2(blendFunc, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_4(blendFuncSeparate, unsigned long, unsigned long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_3(bufferData, unsigned long, int, unsigned long) -DELEGATE_TO_INTERNAL_3(bufferData, unsigned long, WebGLArray*, unsigned long) -DELEGATE_TO_INTERNAL_3(bufferSubData, unsigned long, long, WebGLArray*) +DELEGATE_TO_INTERNAL_3(bufferData, unsigned long, ArrayBufferView*, unsigned long) +DELEGATE_TO_INTERNAL_3(bufferSubData, unsigned long, long, ArrayBufferView*) DELEGATE_TO_INTERNAL_1R(checkFramebufferStatus, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_1(clear, unsigned long) diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp new file mode 100644 index 0000000..0346b58 --- /dev/null +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBCallbacksProxy.h" + +#include "IDBCallbacks.h" +#include "IDBDatabaseError.h" +#include "IDBDatabaseProxy.h" +#include "WebIDBCallbacks.h" +#include "WebIDBDatabase.h" +#include "WebIDBDatabaseError.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +IDBCallbacksProxy::IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +IDBCallbacksProxy::~IDBCallbacksProxy() +{ +} + +void IDBCallbacksProxy::onError(const WebKit::WebIDBDatabaseError& error) +{ + m_callbacks->onError(error); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(WebKit::WebIDBDatabase* webKitInstance) +{ + m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); + m_callbacks.clear(); +} + +void IDBCallbacksProxy::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) +{ + m_callbacks->onSuccess(serializedScriptValue); + m_callbacks.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) + diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index e803c96..692b0a3 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -29,40 +29,33 @@ #ifndef IDBCallbacksProxy_h #define IDBCallbacksProxy_h -#include "IDBCallbacks.h" -#include "IDBDatabaseError.h" #include "WebIDBCallbacks.h" -#include "WebIDBDatabaseError.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #if ENABLE(INDEXED_DATABASE) -namespace WebCore { +namespace WebKit { +class WebIDBDatabase; +class WebIDBDatabaseError; +class WebSerializedScriptValue; +} -template <typename WebKitClass, typename WebCoreClass, typename WebCoreProxy> -class IDBCallbacksProxy : public WebKit::WebIDBCallbacks<WebKitClass> { -public: - IDBCallbacksProxy(PassRefPtr<IDBCallbacks<WebCoreClass> > callbacks) - : m_callbacks(callbacks) { } +namespace WebCore { - virtual ~IDBCallbacksProxy() { } +class IDBCallbacks; - virtual void onSuccess(WebKitClass* webKitInstance) - { - RefPtr<WebCoreClass> proxy = WebCoreProxy::create(webKitInstance); - m_callbacks->onSuccess(proxy); - m_callbacks.clear(); - } +class IDBCallbacksProxy : public WebKit::WebIDBCallbacks { +public: + IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks); + virtual ~IDBCallbacksProxy(); - virtual void onError(const WebKit::WebIDBDatabaseError& error) - { - m_callbacks->onError(error); - m_callbacks.clear(); - } + virtual void onError(const WebKit::WebIDBDatabaseError& error); + virtual void onSuccess(WebKit::WebIDBDatabase* webKitInstance); + virtual void onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue); private: - PassRefPtr<IDBCallbacks<WebCoreClass> > m_callbacks; + RefPtr<IDBCallbacks> m_callbacks; }; diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IndexedDatabaseProxy.cpp index 9069b46..a4bd0b1 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp +++ b/WebKit/chromium/src/IndexedDatabaseProxy.cpp @@ -29,9 +29,12 @@ #include "config.h" #include "IndexedDatabaseProxy.h" +#include "Document.h" +#include "Frame.h" #include "IDBCallbacksProxy.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" +#include "SecurityOrigin.h" #include "WebFrameImpl.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" @@ -57,11 +60,12 @@ IndexedDatabaseProxy::~IndexedDatabaseProxy() { } -void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBDatabaseCallbacks> callbacks, Frame* frame, ExceptionCode& ec) +void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, Frame* frame, ExceptionCode& ec) { + if (!frame || !frame->document()) + return; WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - typedef IDBCallbacksProxy<WebKit::WebIDBDatabase, IDBDatabase, IDBDatabaseProxy> CallbacksProxy; - m_webIndexedDatabase->open(name, description, modifyDatabase, new CallbacksProxy(callbacks), webFrame, ec); + m_webIndexedDatabase->open(name, description, modifyDatabase, new IDBCallbacksProxy(callbacks), frame->document()->securityOrigin()->toString(), webFrame, ec); } } // namespace WebCore diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IndexedDatabaseProxy.h index d0f55b6..0c8674a 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.h +++ b/WebKit/chromium/src/IndexedDatabaseProxy.h @@ -42,7 +42,7 @@ public: static PassRefPtr<IndexedDatabase> create(); virtual ~IndexedDatabaseProxy(); - virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBDatabaseCallbacks>, Frame*, ExceptionCode&); + virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&); private: IndexedDatabaseProxy(); diff --git a/WebKit/chromium/src/PlatformMessagePortChannel.h b/WebKit/chromium/src/PlatformMessagePortChannel.h index 05e8397..5416145 100644 --- a/WebKit/chromium/src/PlatformMessagePortChannel.h +++ b/WebKit/chromium/src/PlatformMessagePortChannel.h @@ -31,12 +31,9 @@ #ifndef PlatformMessagePortChannel_h #define PlatformMessagePortChannel_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebMessagePortChannelClient.h" +#include "WebMessagePortChannelClient.h" #include "MessagePortChannel.h" - #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp index 39270e7..a13400d 100644 --- a/WebKit/chromium/src/ResourceHandle.cpp +++ b/WebKit/chromium/src/ResourceHandle.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "ResourceHandle.h" +#include "ChromiumBridge.h" #include "ResourceHandleClient.h" #include "ResourceRequest.h" #include "SharedBuffer.h" @@ -72,6 +73,7 @@ public: WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&); virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength); + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength); virtual void didFinishLoading(WebURLLoader*); virtual void didFail(WebURLLoader*, const WebURLError&); @@ -171,6 +173,15 @@ void ResourceHandleInternal::didReceiveData( m_client->didReceiveData(m_owner, data, dataLength, dataLength); } +void ResourceHandleInternal::didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) +{ + ASSERT(m_client); + if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData) + CRASH(); + + m_client->didReceiveCachedMetadata(m_owner, data, dataLength); +} + void ResourceHandleInternal::didFinishLoading(WebURLLoader*) { ASSERT(m_client); @@ -311,4 +322,10 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*) return true; } +// static +void ResourceHandle::cacheMetadata(const ResourceResponse& response, const Vector<char>& data) +{ + ChromiumBridge::cacheMetadata(response.url(), response.responseTime(), data); +} + } // namespace WebCore diff --git a/WebKit/chromium/src/SharedWorkerRepository.cpp b/WebKit/chromium/src/SharedWorkerRepository.cpp index a2b513f..2c4e918 100644 --- a/WebKit/chromium/src/SharedWorkerRepository.cpp +++ b/WebKit/chromium/src/SharedWorkerRepository.cpp @@ -72,6 +72,7 @@ public: , m_port(port) , m_scriptLoader(ResourceRequestBase::TargetIsSharedWorker) , m_loading(false) + , m_responseAppCacheID(0) { } @@ -81,6 +82,7 @@ public: private: // WorkerScriptLoaderClient callback + virtual void didReceiveResponse(const ResourceResponse&); virtual void notifyFinished(); virtual void connected(); @@ -96,6 +98,7 @@ private: OwnPtr<MessagePortChannel> m_port; WorkerScriptLoader m_scriptLoader; bool m_loading; + long long m_responseAppCacheID; }; static Vector<SharedWorkerScriptLoader*>& pendingLoaders() @@ -148,6 +151,11 @@ static WebMessagePortChannel* getWebPort(PassOwnPtr<MessagePortChannel> port) return webPort; } +void SharedWorkerScriptLoader::didReceiveResponse(const ResourceResponse& response) +{ + m_responseAppCacheID = response.appCacheID(); +} + void SharedWorkerScriptLoader::notifyFinished() { if (m_scriptLoader.failed()) { @@ -159,7 +167,7 @@ void SharedWorkerScriptLoader::notifyFinished() inspector->scriptImported(m_scriptLoader.identifier(), m_scriptLoader.script()); #endif // Pass the script off to the worker, then send a connect event. - m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader.script()); + m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader.script(), m_responseAppCacheID); sendConnect(); } } diff --git a/WebKit/chromium/src/StorageNamespaceProxy.cpp b/WebKit/chromium/src/StorageNamespaceProxy.cpp index 252bc14..ec0dbce 100644 --- a/WebKit/chromium/src/StorageNamespaceProxy.cpp +++ b/WebKit/chromium/src/StorageNamespaceProxy.cpp @@ -51,7 +51,7 @@ PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* pag { WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(page->chrome()->client()); WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); - return adoptRef(new StorageNamespaceProxy(webViewClient->createSessionStorageNamespace(), SessionStorage)); + return adoptRef(new StorageNamespaceProxy(webViewClient->createSessionStorageNamespace(quota), SessionStorage)); } StorageNamespaceProxy::StorageNamespaceProxy(WebKit::WebStorageNamespace* storageNamespace, StorageType storageType) diff --git a/WebKit/chromium/src/WebAnimationControllerImpl.h b/WebKit/chromium/src/WebAnimationControllerImpl.h index 8b0676e..66dfe98 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.h +++ b/WebKit/chromium/src/WebAnimationControllerImpl.h @@ -31,9 +31,7 @@ #ifndef WebAnimationControllerImpl_h #define WebAnimationControllerImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebAnimationController.h" +#include "WebAnimationController.h" namespace WebCore { class AnimationController; diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp index 41619d6..99e82a7 100644 --- a/WebKit/chromium/src/WebBindings.cpp +++ b/WebKit/chromium/src/WebBindings.cpp @@ -34,9 +34,6 @@ #include "npruntime_impl.h" #include "npruntime_priv.h" -#include "../public/WebDragData.h" -#include "../public/WebRange.h" - #if USE(V8) #include "ChromiumDataObject.h" #include "ClipboardChromium.h" @@ -53,6 +50,8 @@ #elif USE(JSC) #include "bridge/c/c_utility.h" #endif +#include "WebDragData.h" +#include "WebRange.h" #if USE(JAVASCRIPTCORE_BINDINGS) using JSC::Bindings::PrivateIdentifier; diff --git a/WebKit/chromium/src/WebDataSourceImpl.h b/WebKit/chromium/src/WebDataSourceImpl.h index f868e95..be32217 100644 --- a/WebKit/chromium/src/WebDataSourceImpl.h +++ b/WebKit/chromium/src/WebDataSourceImpl.h @@ -31,17 +31,12 @@ #ifndef WebDataSourceImpl_h #define WebDataSourceImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebDataSource.h" - #include "DocumentLoader.h" #include "KURL.h" - +#include "WebDataSource.h" #include "WebPluginLoadObserver.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" - #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> diff --git a/WebKit/chromium/src/WebDevToolsAgentPrivate.h b/WebKit/chromium/src/WebDevToolsAgentPrivate.h index 0c1c67e..446f647 100644 --- a/WebKit/chromium/src/WebDevToolsAgentPrivate.h +++ b/WebKit/chromium/src/WebDevToolsAgentPrivate.h @@ -31,9 +31,7 @@ #ifndef WebDevToolsAgentPrivate_h #define WebDevToolsAgentPrivate_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebDevToolsAgent.h" +#include "WebDevToolsAgent.h" namespace WebKit { class WebFrameImpl; diff --git a/WebKit/chromium/src/WebFileChooserCompletionImpl.h b/WebKit/chromium/src/WebFileChooserCompletionImpl.h index fe759e0..147d1f7 100644 --- a/WebKit/chromium/src/WebFileChooserCompletionImpl.h +++ b/WebKit/chromium/src/WebFileChooserCompletionImpl.h @@ -31,14 +31,11 @@ #ifndef WebFileChooserCompletionImpl_h #define WebFileChooserCompletionImpl_h -// FIXME: These relative paths are a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebFileChooserCompletion.h" -#include "../public/WebString.h" -#include "../public/WebVector.h" +#include "WebFileChooserCompletion.h" +#include "WebString.h" +#include "WebVector.h" #include "FileChooser.h" - #include <wtf/PassRefPtr.h> using WebKit::WebFileChooserCompletion; diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index 7b6c8ce..b678459 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -1608,14 +1608,6 @@ void WebFrameImpl::resetMatchCount() m_framesScopingCount = 0; } -WebURL WebFrameImpl::completeURL(const WebString& url) const -{ - if (!m_frame || !m_frame->document()) - return WebURL(); - - return m_frame->document()->completeURL(url); -} - WebString WebFrameImpl::contentAsText(size_t maxChars) const { if (!m_frame) @@ -1942,13 +1934,16 @@ void WebFrameImpl::setCanHaveScrollbars(bool canHaveScrollbars) m_frame->view()->setCanHaveScrollbars(canHaveScrollbars); } -void WebFrameImpl::registerPasswordListener( +bool WebFrameImpl::registerPasswordListener( WebInputElement inputElement, WebPasswordAutocompleteListener* listener) { RefPtr<HTMLInputElement> element = inputElement.operator PassRefPtr<HTMLInputElement>(); - ASSERT(m_passwordListeners.find(element) == m_passwordListeners.end()); - m_passwordListeners.set(element, listener); + if (!m_passwordListeners.add(element, listener).second) { + delete listener; + return false; + } + return true; } WebPasswordAutocompleteListener* WebFrameImpl::getPasswordListener( @@ -2030,7 +2025,8 @@ void WebFrameImpl::addMarker(Range* range, bool activeMatch) void WebFrameImpl::setMarkerActive(Range* range, bool active) { - if (!range) + WebCore::ExceptionCode ec; + if (!range || range->collapsed(ec)) return; frame()->document()->setMarkersActive(range, active); diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index 08d3cc2..a8b272f 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -31,16 +31,15 @@ #ifndef WebFrameImpl_h #define WebFrameImpl_h -// FIXME: remove this relative path once consumers from glue are removed. -#include "../public/WebFrame.h" +#include "WebAnimationControllerImpl.h" +#include "WebFrame.h" + #include "Frame.h" #include "FrameLoaderClientImpl.h" #include "PlatformString.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> -#include "WebAnimationControllerImpl.h" - namespace WebCore { class GraphicsContext; class HistoryItem; @@ -160,10 +159,9 @@ public: virtual void cancelPendingScopingEffort(); virtual void increaseMatchCount(int count, int identifier); virtual void resetMatchCount(); - virtual void registerPasswordListener( + virtual bool registerPasswordListener( WebInputElement, WebPasswordAutocompleteListener*); - virtual WebURL completeURL(const WebString& url) const; virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; virtual WebString renderTreeAsText() const; diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp index 07f09da..265ef4f 100644 --- a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp @@ -73,6 +73,7 @@ public: virtual void suspend(); virtual void resume(); virtual int getBridgeId() const; + virtual void attachBridgeIfNeeded(); // WebGeolocationServiceBridge virtual void setIsAllowed(bool allowed); @@ -94,12 +95,8 @@ GeolocationServiceBridge* createGeolocationServiceBridgeImpl(GeolocationServiceC WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) : m_GeolocationServiceChromium(geolocationServiceChromium) + , m_bridgeId(0) { - // We need to attach ourselves here: Geolocation calls requestPermissionForFrame() - // directly, and we need to be attached so that the embedder can call - // our setIsAllowed(). - m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this); - ASSERT(m_bridgeId); } WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl() @@ -116,8 +113,7 @@ WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl() bool WebGeolocationServiceBridgeImpl::startUpdating(PositionOptions* positionOptions) { - if (!m_bridgeId) - m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this); + attachBridgeIfNeeded(); getWebViewClient()->geolocationService()->startUpdating(m_bridgeId, m_GeolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy()); return true; } @@ -148,6 +144,12 @@ int WebGeolocationServiceBridgeImpl::getBridgeId() const return m_bridgeId; } +void WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded() +{ + if (!m_bridgeId) + m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this); +} + void WebGeolocationServiceBridgeImpl::setIsAllowed(bool allowed) { m_GeolocationServiceChromium->setIsAllowed(allowed); diff --git a/WebKit/chromium/src/WebGraphicsContext3D.cpp b/WebKit/chromium/src/WebGraphicsContext3D.cpp index bc23703..ce6f55d 100644 --- a/WebKit/chromium/src/WebGraphicsContext3D.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3D.cpp @@ -31,8 +31,6 @@ #include "config.h" #include "WebGraphicsContext3D.h" -#if ENABLE(3D_CANVAS) - #include "WebGraphicsContext3DDefaultImpl.h" namespace WebKit { @@ -47,5 +45,3 @@ WebGraphicsContext3D* WebGraphicsContext3D::createDefault() } } // namespace WebKit - -#endif // ENABLE(3D_CANVAS) diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp index 6a6327b..4820cfb 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp @@ -47,9 +47,9 @@ WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl() { } -void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks<WebIDBDatabase>* callbacksPtr, WebFrame*, int& exceptionCode) +void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks* callbacksPtr, const WebString& origin, WebFrame*, int& exceptionCode) { - OwnPtr<WebIDBCallbacks<WebIDBDatabase>*> callbacks(callbacksPtr); + OwnPtr<WebIDBCallbacks> callbacks(callbacksPtr); callbacks->onError(WebIDBDatabaseError(0, "Not implemented")); // FIXME: Implement for realz. } diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIndexedDatabaseImpl.h index b4b8c99..0402ede 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.h @@ -37,7 +37,7 @@ class WebIndexedDatabaseImpl : public WebIndexedDatabase { public: virtual ~WebIndexedDatabaseImpl(); - virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks<WebIDBDatabase>*, WebFrame*, int& exceptionCode); + virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebString& origin, WebFrame*, int& exceptionCode); }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 2f65ad2..68bb91e 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -70,6 +70,11 @@ void WebInputElement::setActivatedSubmit(bool activated) unwrap<HTMLInputElement>()->setActivatedSubmit(activated); } +int WebInputElement::size() const +{ + return constUnwrap<HTMLInputElement>()->size(); +} + void WebInputElement::setValue(const WebString& value) { unwrap<HTMLInputElement>()->setValue(value); diff --git a/WebKit/chromium/src/WebInputEventConversion.h b/WebKit/chromium/src/WebInputEventConversion.h index 3018973..dc5db35 100644 --- a/WebKit/chromium/src/WebInputEventConversion.h +++ b/WebKit/chromium/src/WebInputEventConversion.h @@ -31,9 +31,7 @@ #ifndef WebInputEventConversion_h #define WebInputEventConversion_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebInputEvent.h" +#include "WebInputEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" diff --git a/WebKit/chromium/src/WebLabelElement.cpp b/WebKit/chromium/src/WebLabelElement.cpp index 9546986..ef2c698 100644 --- a/WebKit/chromium/src/WebLabelElement.cpp +++ b/WebKit/chromium/src/WebLabelElement.cpp @@ -42,7 +42,7 @@ namespace WebKit { WebElement WebLabelElement::correspondingControl() { - return WebElement(unwrap<HTMLLabelElement>()->correspondingControl()); + return WebElement(unwrap<HTMLLabelElement>()->control()); } WebLabelElement::WebLabelElement(const PassRefPtr<HTMLLabelElement>& elem) diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index d7dbade..03051c3 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -133,6 +133,13 @@ void WebMediaPlayerClientImpl::sawUnsupportedTracks() m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer); } +float WebMediaPlayerClientImpl::volume() const +{ + if (m_mediaPlayer) + return m_mediaPlayer->volume(); + return 0.0f; +} + // MediaPlayerPrivateInterface ------------------------------------------------- void WebMediaPlayerClientImpl::load(const String& url) diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 4adbed2..57c93b7 100644 --- a/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -61,6 +61,7 @@ public: virtual void rateChanged(); virtual void sizeChanged(); virtual void sawUnsupportedTracks(); + virtual float volume() const; // MediaPlayerPrivateInterface methods: virtual void load(const WebCore::String& url); diff --git a/WebKit/chromium/src/WebNode.cpp b/WebKit/chromium/src/WebNode.cpp index 90bbb34..31ad70f 100644 --- a/WebKit/chromium/src/WebNode.cpp +++ b/WebKit/chromium/src/WebNode.cpp @@ -94,11 +94,6 @@ bool WebNode::setNodeValue(const WebString& value) return !exceptionCode; } -WebFrame* WebNode::frame() const -{ - return WebFrameImpl::fromFrame(m_private->document()->frame()); -} - WebDocument WebNode::document() const { return WebDocument(m_private->document()); diff --git a/WebKit/chromium/src/WebPageSerializerImpl.cpp b/WebKit/chromium/src/WebPageSerializerImpl.cpp index 008e0c7..e65af85 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -510,7 +510,7 @@ bool WebPageSerializerImpl::serialize() const KURL& currentFrameURL = currentFrame->frame()->loader()->url(); // Check whether we have done this document. - if (m_localLinks.contains(currentFrameURL.string())) { + if (currentFrameURL.isValid() && m_localLinks.contains(currentFrameURL.string())) { // A new document, we will serialize it. didSerialization = true; // Get target encoding for current document. diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index b207a25..5807a79 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -35,6 +35,7 @@ #include "ChromeClientImpl.h" #include "WebCursorInfo.h" #include "WebDataSourceImpl.h" +#include "WebElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebKit.h" @@ -239,6 +240,11 @@ void WebPluginContainerImpl::printEnd() return m_webPlugin->printEnd(); } +WebElement WebPluginContainerImpl::element() +{ + return WebElement(m_element); +} + void WebPluginContainerImpl::invalidate() { Widget::invalidate(); diff --git a/WebKit/chromium/src/WebPluginContainerImpl.h b/WebKit/chromium/src/WebPluginContainerImpl.h index 4163ee5..ad2fa95 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/WebKit/chromium/src/WebPluginContainerImpl.h @@ -31,9 +31,7 @@ #ifndef WebPluginContainerImpl_h #define WebPluginContainerImpl_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebPluginContainer.h" +#include "WebPluginContainer.h" #include "Widget.h" #include <wtf/PassRefPtr.h> @@ -77,6 +75,7 @@ public: virtual void widgetPositionsUpdated(); // WebPluginContainer methods + virtual WebElement element(); virtual void invalidate(); virtual void invalidateRect(const WebRect&); virtual void reportGeometry(); diff --git a/WebKit/chromium/src/WebPluginLoadObserver.h b/WebKit/chromium/src/WebPluginLoadObserver.h index 097d08d..7bd06eb 100644 --- a/WebKit/chromium/src/WebPluginLoadObserver.h +++ b/WebKit/chromium/src/WebPluginLoadObserver.h @@ -31,7 +31,7 @@ #ifndef WebPluginLoadObserver_h #define WebPluginLoadObserver_h -#include "../public/WebURL.h" +#include "WebURL.h" namespace WebKit { diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index ca50b81..a2602b0 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -31,14 +31,10 @@ #ifndef WebPopupMenuImpl_h #define WebPopupMenuImpl_h -// FIXME: Add this to FramelessScrollViewClient.h -namespace WebCore { class FramelessScrollView; } - #include "FramelessScrollViewClient.h" -// FIXME: remove the relative paths once glue/ consumers are removed. -#include "../public/WebPoint.h" -#include "../public/WebPopupMenu.h" -#include "../public/WebSize.h" +#include "WebPoint.h" +#include "WebPopupMenu.h" +#include "WebSize.h" #include <wtf/RefCounted.h> namespace WebCore { diff --git a/WebKit/chromium/src/WebScrollbarImpl.cpp b/WebKit/chromium/src/WebScrollbarImpl.cpp new file mode 100644 index 0000000..8bf5340 --- /dev/null +++ b/WebKit/chromium/src/WebScrollbarImpl.cpp @@ -0,0 +1,297 @@ +/* + * 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 "WebScrollbarImpl.h" + +#include "GraphicsContext.h" +#include "KeyboardCodes.h" +#include "PlatformContextSkia.h" +#include "Scrollbar.h" +#include "ScrollbarTheme.h" +#include "ScrollTypes.h" +#include "WebCanvas.h" +#include "WebInputEvent.h" +#include "WebInputEventConversion.h" +#include "WebRect.h" +#include "WebScrollbarClient.h" +#include "WebVector.h" +#include "WebViewImpl.h" + +using namespace std; +using namespace WebCore; + +namespace WebKit { + +WebScrollbar* WebScrollbar::create(WebScrollbarClient* client, Orientation orientation) +{ + return new WebScrollbarImpl(client, orientation); +} + +int WebScrollbar::defaultThickness() +{ + return ScrollbarTheme::nativeTheme()->scrollbarThickness(); +} + +WebScrollbarImpl::WebScrollbarImpl(WebScrollbarClient* client, Orientation orientation) + : m_client(client) +{ + m_scrollbar = Scrollbar::createNativeScrollbar( + static_cast<ScrollbarClient*>(this), + static_cast<ScrollbarOrientation>(orientation), + RegularScrollbar); +} + +WebScrollbarImpl::~WebScrollbarImpl() +{ +} + +void WebScrollbarImpl::setLocation(const WebRect& rect) +{ + WebCore::IntRect oldRect = m_scrollbar->frameRect(); + m_scrollbar->setFrameRect(rect); + if (WebRect(oldRect) != rect) + m_scrollbar->invalidate(); + + int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar->width() : m_scrollbar->height(); + int pageStep = max(max<int>(length * Scrollbar::minFractionToStepWhenPaging(), length - Scrollbar::maxOverlapBetweenPages()), 1); + m_scrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); + m_scrollbar->setEnabled(m_scrollbar->totalSize() > length); + m_scrollbar->setProportion(length, m_scrollbar->totalSize()); +} + +int WebScrollbarImpl::value() const +{ + return m_scrollbar->value(); +} + +void WebScrollbarImpl::setValue(int position) +{ + m_scrollbar->setValue(position); +} + +void WebScrollbarImpl::setDocumentSize(int size) +{ + int length = m_scrollbar->orientation() == HorizontalScrollbar ? m_scrollbar->width() : m_scrollbar->height(); + m_scrollbar->setEnabled(size > length); + m_scrollbar->setProportion(length, size); +} + +void WebScrollbarImpl::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) +{ + WebCore::ScrollDirection dir; + bool horizontal = m_scrollbar->orientation() == HorizontalScrollbar; + if (direction == ScrollForward) + dir = horizontal ? ScrollRight : ScrollDown; + else + dir = horizontal ? ScrollLeft : ScrollUp; + m_scrollbar->scroll(dir, static_cast<WebCore::ScrollGranularity>(granularity), multiplier); +} + +void WebScrollbarImpl::paint(WebCanvas* canvas, const WebRect& rect) +{ +#if WEBKIT_USING_CG + GraphicsContext gc(canvas); +#elif WEBKIT_USING_SKIA + PlatformContextSkia context(canvas); + + // PlatformGraphicsContext is actually a pointer to PlatformContextSkia + GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); +#else + notImplemented(); +#endif + + m_scrollbar->paint(&gc, rect); +} + +bool WebScrollbarImpl::handleInputEvent(const WebInputEvent& event) +{ + switch (event.type) { + case WebInputEvent::MouseDown: + return onMouseDown(event); + case WebInputEvent::MouseUp: + return onMouseUp(event); + case WebInputEvent::MouseMove: + return onMouseMove(event); + case WebInputEvent::MouseLeave: + return onMouseLeave(event); + case WebInputEvent::MouseWheel: + return onMouseWheel(event); + case WebInputEvent::KeyDown: + return onKeyDown(event); + case WebInputEvent::Undefined: + case WebInputEvent::MouseEnter: + case WebInputEvent::RawKeyDown: + case WebInputEvent::KeyUp: + case WebInputEvent::Char: + case WebInputEvent::TouchStart: + case WebInputEvent::TouchMove: + case WebInputEvent::TouchEnd: + case WebInputEvent::TouchCancel: + default: + break; + } + return false; +} + +bool WebScrollbarImpl::onMouseDown(const WebInputEvent& event) +{ + WebMouseEvent mousedown = *static_cast<const WebMouseEvent*>(&event); + if (!m_scrollbar->frameRect().contains(mousedown.x, mousedown.y)) + return false; + + mousedown.x -= m_scrollbar->x(); + mousedown.y -= m_scrollbar->y(); + m_scrollbar->mouseDown(PlatformMouseEventBuilder(m_scrollbar.get(), mousedown)); + return true; + } + +bool WebScrollbarImpl::onMouseUp(const WebInputEvent& event) +{ + if (m_scrollbar->pressedPart() == NoPart) + return false; + + return m_scrollbar->mouseUp(); +} + +bool WebScrollbarImpl::onMouseMove(const WebInputEvent& event) +{ + WebMouseEvent mousemove = *static_cast<const WebMouseEvent*>(&event); + if (m_scrollbar->frameRect().contains(mousemove.x, mousemove.y) + || m_scrollbar->pressedPart() != NoPart) { + mousemove.x -= m_scrollbar->x(); + mousemove.y -= m_scrollbar->y(); + return m_scrollbar->mouseMoved(PlatformMouseEventBuilder(m_scrollbar.get(), mousemove)); + } + + if (m_scrollbar->hoveredPart() != NoPart) + m_scrollbar->mouseExited(); + return false; +} + +bool WebScrollbarImpl::onMouseLeave(const WebInputEvent& event) +{ + if (m_scrollbar->hoveredPart() == NoPart) + return false; + + return m_scrollbar->mouseExited(); +} + +bool WebScrollbarImpl::onMouseWheel(const WebInputEvent& event) +{ + // Same logic as in Scrollview.cpp. If we can move at all, we'll accept the event. + WebMouseWheelEvent mousewheel = *static_cast<const WebMouseWheelEvent*>(&event); + int maxScrollDelta = m_scrollbar->maximum() - m_scrollbar->value(); + float delta = m_scrollbar->orientation() == HorizontalScrollbar ? mousewheel.deltaX : mousewheel.deltaY; + if ((delta < 0 && maxScrollDelta > 0) || (delta > 0 && m_scrollbar->value() > 0)) { + if (mousewheel.scrollByPage) { + ASSERT(m_scrollbar->orientation() == VerticalScrollbar); + bool negative = delta < 0; + delta = max(max<int>(m_scrollbar->visibleSize() * Scrollbar::minFractionToStepWhenPaging(), m_scrollbar->visibleSize() - Scrollbar::maxOverlapBetweenPages()), 1); + if (negative) + delta *= -1; + } + m_scrollbar->setValue(m_scrollbar->value() - delta); + return true; + } + + return false; + } + +bool WebScrollbarImpl::onKeyDown(const WebInputEvent& event) +{ + WebKeyboardEvent keyboard = *static_cast<const WebKeyboardEvent*>(&event); + int keyCode; + // We have to duplicate this logic from WebViewImpl because there it uses + // Char and RawKeyDown events, which don't exist at this point. + if (keyboard.windowsKeyCode == VKEY_SPACE) + keyCode = ((keyboard.modifiers & WebInputEvent::ShiftKey) ? VKEY_PRIOR : VKEY_NEXT); + else { + if (keyboard.modifiers == WebInputEvent::ControlKey) { + // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl + // key combinations which affect scrolling. Safari is buggy in the + // sense that it scrolls the page for all Ctrl+scrolling key + // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. + switch (keyboard.windowsKeyCode) { + case VKEY_HOME: + case VKEY_END: + break; + default: + return false; + } + } + + if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKey)) + return false; + + keyCode = keyboard.windowsKeyCode; + } + WebCore::ScrollDirection scrollDirection; + WebCore::ScrollGranularity scrollGranularity; + if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) { + // Will return false if scroll direction wasn't compatible with this scrollbar. + return m_scrollbar->scroll(scrollDirection, scrollGranularity); + } + return false; +} + +void WebScrollbarImpl::valueChanged(WebCore::Scrollbar*) +{ + m_client->valueChanged(this); +} + +void WebScrollbarImpl::invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect& rect) +{ + WebRect webrect(rect); + webrect.x += m_scrollbar->x(); + webrect.y += m_scrollbar->y(); + m_client->invalidateScrollbarRect(this, webrect); +} + +bool WebScrollbarImpl::isActive() const +{ + return true; +} + +bool WebScrollbarImpl::scrollbarCornerPresent() const +{ + return false; +} + +void WebScrollbarImpl::getTickmarks(Vector<WebCore::IntRect>& tickmarks) const +{ + WebVector<WebRect> ticks; + m_client->getTickmarks(const_cast<WebScrollbarImpl*>(this), &ticks); + tickmarks.resize(ticks.size()); + for (size_t i = 0; i < ticks.size(); ++i) + tickmarks[i] = ticks[i]; +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/WebScrollbarImpl.h b/WebKit/chromium/src/WebScrollbarImpl.h new file mode 100644 index 0000000..a041ccc --- /dev/null +++ b/WebKit/chromium/src/WebScrollbarImpl.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScrollbarImpl_h +#define WebScrollbarImpl_h + +#include "ScrollbarClient.h" +#include "WebScrollbar.h" + +#include <wtf/RefPtr.h> + +namespace WebCore { +class Scrollbar; +} + +namespace WebKit { + +class WebScrollbarImpl : public WebScrollbar, + public WebCore::ScrollbarClient { +public: + WebScrollbarImpl(WebScrollbarClient*, Orientation orientation); + ~WebScrollbarImpl(); + + // WebKit::WebScrollbar methods + virtual void setLocation(const WebRect&); + virtual int value() const; + virtual void setValue(int position); + virtual void setDocumentSize(int size); + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier); + virtual void paint(WebCanvas*, const WebRect&); + virtual bool handleInputEvent(const WebInputEvent&); + + // WebCore::ScrollbarClient methods + virtual void valueChanged(WebCore::Scrollbar*); + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); + virtual bool isActive() const; + virtual bool scrollbarCornerPresent() const; + virtual void getTickmarks(Vector<WebCore::IntRect>&) const; + +private: + bool onMouseDown(const WebInputEvent& event); + bool onMouseUp(const WebInputEvent& event); + bool onMouseMove(const WebInputEvent& event); + bool onMouseLeave(const WebInputEvent& event); + bool onMouseWheel(const WebInputEvent& event); + bool onKeyDown(const WebInputEvent& event); + + WebScrollbarClient* m_client; + + RefPtr<WebCore::Scrollbar> m_scrollbar; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/WebSecurityPolicy.cpp b/WebKit/chromium/src/WebSecurityPolicy.cpp index cb7ded0..4b2b557 100644 --- a/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -83,22 +83,6 @@ void WebSecurityPolicy::resetOriginAccessWhitelists() SecurityOrigin::resetOriginAccessWhitelists(); } -// To be removed when Chromium's test_shell has proper references. -void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin, - const WebString& destinationProtocol, - const WebString& destinationHost, - bool allowDestinationSubdomains) -{ - addOriginAccessWhitelistEntry(sourceOrigin, - destinationProtocol, destinationHost, - allowDestinationSubdomains); -} - -void WebSecurityPolicy::resetOriginAccessWhiteLists() -{ - resetOriginAccessWhitelists(); -} - bool WebSecurityPolicy::shouldHideReferrer(const WebURL& url, const WebString& referrer) { return SecurityOrigin::shouldHideReferrer(url, referrer); diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index 54c660b..fdc03f0 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -31,8 +31,7 @@ #ifndef WebSettingsImpl_h #define WebSettingsImpl_h -// TODO(jorlow): Remove this hack once WebView is free of glue. -#include "../public/WebSettings.h" +#include "WebSettings.h" namespace WebCore { class Settings; diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/WebKit/chromium/src/WebSharedWorkerImpl.cpp index 4547336..91636d9 100644 --- a/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -92,7 +92,7 @@ void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, WebShared workerContext->toSharedWorkerContext()->dispatchEvent(createConnectEvent(port)); } -void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode) +void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long) { initializeLoader(url); setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this)); diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.h b/WebKit/chromium/src/WebSharedWorkerImpl.h index 7c10d76..b591c7b 100644 --- a/WebKit/chromium/src/WebSharedWorkerImpl.h +++ b/WebKit/chromium/src/WebSharedWorkerImpl.h @@ -51,7 +51,7 @@ public: // WebSharedWorker methods: virtual bool isStarted(); - virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode); + virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long); virtual void connect(WebMessagePortChannel*, ConnectListener*); virtual void terminateWorkerContext(); virtual void clientDestroyed(); diff --git a/WebKit/chromium/src/WebURLResponse.cpp b/WebKit/chromium/src/WebURLResponse.cpp index 3b0600c..1aba54e 100644 --- a/WebKit/chromium/src/WebURLResponse.cpp +++ b/WebKit/chromium/src/WebURLResponse.cpp @@ -93,6 +93,16 @@ void WebURLResponse::setURL(const WebURL& url) m_private->m_resourceResponse->setURL(url); } +double WebURLResponse::responseTime() const +{ + return m_private->m_resourceResponse->responseTime(); +} + +void WebURLResponse::setResponseTime(double responseTime) +{ + m_private->m_resourceResponse->setResponseTime(responseTime); +} + WebString WebURLResponse::mimeType() const { return m_private->m_resourceResponse->mimeType(); @@ -267,6 +277,16 @@ void WebURLResponse::setWasFetchedViaSPDY(bool value) m_private->m_resourceResponse->setWasFetchedViaSPDY(value); } +bool WebURLResponse::wasNpnNegotiated() const +{ + return m_private->m_resourceResponse->wasNpnNegotiated(); +} + +void WebURLResponse::setWasNpnNegotiated(bool value) +{ + m_private->m_resourceResponse->setWasNpnNegotiated(value); +} + bool WebURLResponse::isMultipartPayload() const { return m_private->m_resourceResponse->isMultipartPayload(); diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 81a4ff3..94cf36c 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -780,45 +780,53 @@ bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers) { ScrollDirection scrollDirection; ScrollGranularity scrollGranularity; + if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) + return false; + return propagateScroll(scrollDirection, scrollGranularity); +} +bool WebViewImpl::mapKeyCodeForScroll(int keyCode, + WebCore::ScrollDirection* scrollDirection, + WebCore::ScrollGranularity* scrollGranularity) +{ switch (keyCode) { case VKEY_LEFT: - scrollDirection = ScrollLeft; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollLeft; + *scrollGranularity = ScrollByLine; break; case VKEY_RIGHT: - scrollDirection = ScrollRight; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollRight; + *scrollGranularity = ScrollByLine; break; case VKEY_UP: - scrollDirection = ScrollUp; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByLine; break; case VKEY_DOWN: - scrollDirection = ScrollDown; - scrollGranularity = ScrollByLine; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByLine; break; case VKEY_HOME: - scrollDirection = ScrollUp; - scrollGranularity = ScrollByDocument; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByDocument; break; case VKEY_END: - scrollDirection = ScrollDown; - scrollGranularity = ScrollByDocument; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByDocument; break; case VKEY_PRIOR: // page up - scrollDirection = ScrollUp; - scrollGranularity = ScrollByPage; + *scrollDirection = ScrollUp; + *scrollGranularity = ScrollByPage; break; case VKEY_NEXT: // page down - scrollDirection = ScrollDown; - scrollGranularity = ScrollByPage; + *scrollDirection = ScrollDown; + *scrollGranularity = ScrollByPage; break; default: return false; } - return propagateScroll(scrollDirection, scrollGranularity); + return true; } void WebViewImpl::hideSelectPopup() diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 0bed223..b561e49 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -31,12 +31,11 @@ #ifndef WebViewImpl_h #define WebViewImpl_h -// FIXME: Remove these relative paths once consumers from glue are removed. -#include "../public/WebNavigationPolicy.h" -#include "../public/WebPoint.h" -#include "../public/WebSize.h" -#include "../public/WebString.h" -#include "../public/WebView.h" +#include "WebNavigationPolicy.h" +#include "WebPoint.h" +#include "WebSize.h" +#include "WebString.h" +#include "WebView.h" #include "BackForwardListClientImpl.h" #include "ChromeClientImpl.h" @@ -47,7 +46,6 @@ #include "InspectorClientImpl.h" #include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" - #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -312,6 +310,11 @@ public: WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } + // Returns true if the event leads to scrolling. + static bool mapKeyCodeForScroll(int keyCode, + WebCore::ScrollDirection* scrollDirection, + WebCore::ScrollGranularity* scrollGranularity); + private: friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 8e26560..1fedeb2 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebWorkerBase.h" +#include "DatabaseTask.h" #include "GenericWorkerTask.h" #include "MessagePortChannel.h" #include "PlatformMessagePortChannel.h" @@ -39,9 +40,12 @@ #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebMessagePortChannel.h" +#include "WebRuntimeFeatures.h" +#include "WebSettings.h" #include "WebView.h" #include "WebWorkerClient.h" +#include "WorkerScriptController.h" #include "WorkerThread.h" #include <wtf/MainThread.h> @@ -51,6 +55,67 @@ namespace WebKit { #if ENABLE(WORKERS) +static const char allowDatabaseMode[] = "allowDatabaseMode"; + +namespace { + +// This class is used to route the result of the WebWorkerBase::allowDatabase +// call back to the worker context. +class AllowDatabaseMainThreadBridge : public ThreadSafeShared<AllowDatabaseMainThreadBridge> { +public: + static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebWorkerBase* worker, const WebCore::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String& name, const WebCore::String& displayName, unsigned long estimatedSize) + { + return adoptRef(new AllowDatabaseMainThreadBridge(worker, mode, commonClient, frame, name, displayName, estimatedSize)); + } + + // These methods are invoked on the worker context. + void cancel() + { + MutexLocker locker(m_mutex); + m_worker = 0; + } + + bool result() + { + return m_result; + } + + // This method is invoked on the main thread. + void signalCompleted(bool result) + { + MutexLocker locker(m_mutex); + if (m_worker) + m_worker->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), m_mode); + } + +private: + AllowDatabaseMainThreadBridge(WebWorkerBase* worker, const WebCore::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String& name, const WebCore::String& displayName, unsigned long estimatedSize) + : m_worker(worker) + , m_mode(mode) + { + worker->dispatchTaskToMainThread(createCallbackTask(&allowDatabaseTask, commonClient, frame, String(name), String(displayName), estimatedSize, this)); + } + + static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WebCore::String name, const WebCore::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) + { + if (!commonClient) + bridge->signalCompleted(false); + else + bridge->signalCompleted(commonClient->allowDatabase(frame, name, displayName, estimatedSize)); + } + + static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowDatabaseMainThreadBridge> bridge, bool result) + { + bridge->m_result = result; + } + + bool m_result; + Mutex m_mutex; + WebWorkerBase* m_worker; + WebCore::String m_mode; +}; +} + // This function is called on the main thread to force to initialize some static // values used in WebKit before any worker thread is started. This is because in // our worker processs, we do not run any WebKit code in main thread and thus @@ -101,6 +166,7 @@ void WebWorkerBase::initializeLoader(const WebURL& url) // infrastructure. ASSERT(!m_webView); m_webView = WebView::create(0); + m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled()); m_webView->initializeMainFrame(this); WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); @@ -144,6 +210,27 @@ WebApplicationCacheHost* WebWorkerBase::createApplicationCacheHost(WebFrame*, We return 0; } +bool WebWorkerBase::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) +{ + WorkerRunLoop& runLoop = m_workerThread->runLoop(); + WorkerScriptController* controller = WorkerScriptController::controllerForContext(); + WorkerContext* workerContext = controller->workerContext(); + + // Create a unique mode just for this synchronous call. + String mode = allowDatabaseMode; + mode.append(String::number(runLoop.createUniqueId())); + + RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(this, mode, commonClient(), m_webView->mainFrame(), String(name), String(displayName), estimatedSize); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + return false; + } + + return bridge->result(); +} + // WorkerObjectProxy ----------------------------------------------------------- void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h index a470ee4..15e8013 100644 --- a/WebKit/chromium/src/WebWorkerBase.h +++ b/WebKit/chromium/src/WebWorkerBase.h @@ -88,6 +88,9 @@ public: virtual void didCreateDataSource(WebFrame*, WebDataSource*); virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*); + // Controls whether access to Web Databases is allowed for this worker. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize); + // 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 907499a..758c376 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/WebKit/chromium/src/WebWorkerClientImpl.h @@ -33,8 +33,7 @@ #if ENABLE(WORKERS) -// FIXME: fix to just "WebWorkerClient.h" once nobody in glue depends on us. -#include "../public/WebWorkerClient.h" +#include "WebWorkerClient.h" #include "WorkerContextProxy.h" #include <wtf/PassOwnPtr.h> @@ -95,6 +94,11 @@ public: return 0; } virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) + { + ASSERT_NOT_REACHED(); + return true; + } private: virtual ~WebWorkerClientImpl(); diff --git a/WebKit/chromium/src/WrappedResourceRequest.h b/WebKit/chromium/src/WrappedResourceRequest.h index 97311db..3057387 100644 --- a/WebKit/chromium/src/WrappedResourceRequest.h +++ b/WebKit/chromium/src/WrappedResourceRequest.h @@ -31,9 +31,7 @@ #ifndef WrappedResourceRequest_h #define WrappedResourceRequest_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebURLRequest.h" +#include "WebURLRequest.h" #include "WebURLRequestPrivate.h" namespace WebKit { diff --git a/WebKit/chromium/src/WrappedResourceResponse.h b/WebKit/chromium/src/WrappedResourceResponse.h index af4f88f..927582d 100644 --- a/WebKit/chromium/src/WrappedResourceResponse.h +++ b/WebKit/chromium/src/WrappedResourceResponse.h @@ -31,9 +31,7 @@ #ifndef WrappedResourceResponse_h #define WrappedResourceResponse_h -// FIXME: This relative path is a temporary hack to support using this -// header from webkit/glue. -#include "../public/WebURLResponse.h" +#include "WebURLResponse.h" #include "WebURLResponsePrivate.h" namespace WebKit { diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 59b88db..6e9c090 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -200,7 +200,7 @@ devtools.domContentLoaded = function() var pair = params[i].split("="); paramsObject[pair[0]] = pair[1]; } - WebInspector.setAttachedWindow(paramsObject.docked); + WebInspector.setAttachedWindow(paramsObject.docked === "true"); if (paramsObject.toolbar_color && paramsObject.text_color) WebInspector.setToolbarColors(paramsObject.toolbar_color, paramsObject.text_color); } |