diff options
Diffstat (limited to 'Source/WebKit/chromium/src')
61 files changed, 804 insertions, 650 deletions
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index aaaa4a5..20fbcd5 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -258,6 +258,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNone, PlatformCursor::TypeNone); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeNotAllowed, PlatformCursor::TypeNotAllowed); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeZoomIn, PlatformCursor::TypeZoomIn); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeZoomOut, PlatformCursor::TypeZoomOut); +COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeGrab, PlatformCursor::TypeGrab); +COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeGrabbing, PlatformCursor::TypeGrabbing); COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCustom, PlatformCursor::TypeCustom); COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped); diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 4b68c18..1e639ec 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -79,6 +79,7 @@ #include "WebPopupMenuInfo.h" #include "WebPopupType.h" #include "WebRect.h" +#include "WebSettings.h" #include "WebTextDirection.h" #include "WebURLRequest.h" #include "WebViewClient.h" @@ -484,14 +485,9 @@ bool ChromeClientImpl::shouldInterruptJavaScript() return false; } -bool ChromeClientImpl::tabsToLinks() const +KeyboardUIMode ChromeClientImpl::keyboardUIMode() { - // Returns true if anchors should accept keyboard focus with the tab key. - // This method is used in a convoluted fashion by EventHandler::tabsToLinks. - // It's a twisted path (self-evident, but more complicated than seems - // necessary), but the net result is that returning true from here, on a - // platform other than MAC or QT, lets anchors get keyboard focus. - return m_webView->tabsToLinks(); + return m_webView->tabsToLinks() ? KeyboardAccessTabsToLinks : KeyboardAccessDefault; } IntRect ChromeClientImpl::windowResizerRect() const @@ -505,7 +501,7 @@ IntRect ChromeClientImpl::windowResizerRect() const #if ENABLE(REGISTER_PROTOCOL_HANDLER) void ChromeClientImpl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) { - notImplemented(); + m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); } #endif @@ -860,6 +856,32 @@ void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) m_webView->client()->exitFullscreenForNode(WebNode(node)); } +#if ENABLE(FULLSCREEN_API) +bool ChromeClientImpl::supportsFullScreenForElement(const WebCore::Element* element) +{ + return m_webView->page()->settings()->fullScreenEnabled(); +} + +void ChromeClientImpl::enterFullScreenForElement(WebCore::Element* element) +{ + // FIXME: We may need to call these someplace else when window resizes. + element->document()->webkitWillEnterFullScreenForElement(element); + element->document()->webkitDidEnterFullScreenForElement(element); +} + +void ChromeClientImpl::exitFullScreenForElement(WebCore::Element* element) +{ + // FIXME: We may need to call these someplace else when window resizes. + element->document()->webkitWillExitFullScreenForElement(element); + element->document()->webkitDidExitFullScreenForElement(element); +} + +void ChromeClientImpl::fullScreenRendererChanged(RenderBox*) +{ + notImplemented(); +} +#endif + bool ChromeClientImpl::selectItemWritingDirectionIsNatural() { return false; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index d3ccb75..e70b766 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -38,9 +38,11 @@ namespace WebCore { class AccessibilityObject; +class Element; class FileChooser; class PopupContainer; class PopupMenuClient; +class RenderBox; class SecurityOrigin; struct WindowFeatures; } @@ -99,7 +101,7 @@ public: const WTF::String& defaultValue, WTF::String& result); virtual void setStatusbarText(const WTF::String& message); virtual bool shouldInterruptJavaScript(); - virtual bool tabsToLinks() const; + virtual WebCore::KeyboardUIMode keyboardUIMode(); virtual WebCore::IntRect windowResizerRect() const; #if ENABLE(REGISTER_PROTOCOL_HANDLER) virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title); @@ -163,6 +165,13 @@ public: virtual void enterFullscreenForNode(WebCore::Node*); virtual void exitFullscreenForNode(WebCore::Node*); +#if ENABLE(FULLSCREEN_API) + virtual bool supportsFullScreenForElement(const WebCore::Element*); + virtual void enterFullScreenForElement(WebCore::Element*); + virtual void exitFullScreenForElement(WebCore::Element*); + virtual void fullScreenRendererChanged(WebCore::RenderBox*); +#endif + // ChromeClientChromium methods: virtual void popupOpened(WebCore::PopupContainer* popupContainer, const WebCore::IntRect& bounds, diff --git a/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp new file mode 100644 index 0000000..29857c6 --- /dev/null +++ b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011 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 <wtf/OSRandomSource.h> + +#include "WebKit.h" +#include "WebKitClient.h" + +namespace WTF { + +void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) +{ + WebKit::webKitClient()->cryptographicallyRandomValues(buffer, length); +} + +} diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 49de043..9c137c9 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -41,6 +41,7 @@ #include "EventHandler.h" #include "FrameLoader.h" #include "FrameView.h" +#include "HistoryItem.h" #include "HitTestResult.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -240,8 +241,12 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // Send the frame and page URLs in any case. data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); - if (selectedFrame != m_webView->mainFrameImpl()->frame()) + if (selectedFrame != m_webView->mainFrameImpl()->frame()) { data.frameURL = urlFromFrame(selectedFrame); + RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->currentItem(); + if (historyItem) + data.frameHistoryItem = WebHistoryItem(historyItem); + } if (r.isSelected()) data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace(); @@ -257,13 +262,9 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( } #if OS(DARWIN) - ExceptionCode ec = 0; - RefPtr<CSSStyleDeclaration> style = selectedFrame->document()->createCSSStyleDeclaration(); - style->setProperty(CSSPropertyDirection, "ltr", false, ec); - if (selectedFrame->editor()->selectionHasStyle(style.get()) != FalseTriState) + if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState) data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuItemChecked; - style->setProperty(CSSPropertyDirection, "rtl", false, ec); - if (selectedFrame->editor()->selectionHasStyle(style.get()) != FalseTriState) + if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "rtl") != FalseTriState) data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuItemChecked; #endif // OS(DARWIN) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 3dc3a6a..38d4f5e 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -187,11 +187,6 @@ int EditorClientImpl::spellCheckerDocumentTag() return 0; } -bool EditorClientImpl::isEditable() -{ - return false; -} - bool EditorClientImpl::shouldBeginEditing(Range* range) { if (m_webView->client()) @@ -324,6 +319,16 @@ void EditorClientImpl::clearUndoRedoOperations() m_redoStack.clear(); } +bool EditorClientImpl::canCopyCut(bool defaultValue) const +{ + return defaultValue; +} + +bool EditorClientImpl::canPaste(bool defaultValue) const +{ + return defaultValue; +} + bool EditorClientImpl::canUndo() const { return !m_undoStack.isEmpty(); diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 8c40f3c..b81fb56 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -32,6 +32,7 @@ #define EditorClientImpl_h #include "EditorClient.h" +#include "TextCheckerClient.h" #include "Timer.h" #include <wtf/Deque.h> @@ -43,7 +44,7 @@ class SpellChecker; namespace WebKit { class WebViewImpl; -class EditorClientImpl : public WebCore::EditorClient { +class EditorClientImpl : public WebCore::EditorClient, public WebCore::TextCheckerClient { public: EditorClientImpl(WebViewImpl* webView); @@ -58,7 +59,6 @@ public: virtual bool isGrammarCheckingEnabled(); virtual void toggleGrammarChecking(); virtual int spellCheckerDocumentTag(); - virtual bool isEditable(); virtual bool shouldBeginEditing(WebCore::Range*); virtual bool shouldEndEditing(WebCore::Range*); virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction); @@ -79,6 +79,8 @@ public: virtual void registerCommandForUndo(PassRefPtr<WebCore::EditCommand>); virtual void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>); virtual void clearUndoRedoOperations(); + virtual bool canCopyCut(bool defaultValue) const; + virtual bool canPaste(bool defaultValue) const; virtual bool canUndo() const; virtual bool canRedo() const; virtual void undo(); @@ -114,6 +116,8 @@ public: virtual void setInputMethodState(bool enabled); virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&); + virtual WebCore::TextCheckerClient* textChecker() { return this; } + // Shows the form autofill popup for |node| if it is an HTMLInputElement and // it is empty. This is called when you press the up or down arrow in a // text-field or when clicking an already focused text-field. diff --git a/Source/WebKit/chromium/src/Extensions3DChromium.cpp b/Source/WebKit/chromium/src/Extensions3DChromium.cpp index 52c2e12..30101c7 100644 --- a/Source/WebKit/chromium/src/Extensions3DChromium.cpp +++ b/Source/WebKit/chromium/src/Extensions3DChromium.cpp @@ -97,6 +97,24 @@ void Extensions3DChromium::copyTextureToParentTextureCHROMIUM(unsigned texture, m_internal->copyTextureToParentTextureCHROMIUM(texture, parentTexture); } +Platform3DObject Extensions3DChromium::createVertexArrayOES() +{ + return 0; +} + +void Extensions3DChromium::deleteVertexArrayOES(Platform3DObject) +{ +} + +GC3Dboolean Extensions3DChromium::isVertexArrayOES(Platform3DObject) +{ + return 0; +} + +void Extensions3DChromium::bindVertexArrayOES(Platform3DObject) +{ +} + } // namespace WebCore #endif // ENABLE(WEBGL) diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 34c53cf..dc47923 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -842,14 +842,11 @@ void FrameLoaderClientImpl::dispatchShow() webView->client()->show(webView->initialNavigationPolicy()); } -void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType( +void FrameLoaderClientImpl::dispatchDecidePolicyForResponse( FramePolicyFunction function, - const String& mimeType, + const ResourceResponse& response, const ResourceRequest&) { - const ResourceResponse& response = - m_webFrame->frame()->loader()->activeDocumentLoader()->response(); - PolicyAction action; int statusCode = response.httpStatusCode(); @@ -861,7 +858,7 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType( // Downloading is handled by the embedder, but we still get the initial // response so that we can ignore it and clean up properly. action = PolicyIgnore; - } else if (!canShowMIMEType(mimeType)) { + } else if (!canShowMIMEType(response.mimeType())) { // Make sure that we can actually handle this type internally. action = PolicyIgnore; } else { @@ -1135,6 +1132,14 @@ bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem* item) const return false; } +bool FrameLoaderClientImpl::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) const +{ + // Don't stop loading for pseudo-back-forward URLs, since they will get + // translated and then pass through again. + const KURL& url = targetItem->url(); + return !url.protocolIs(backForwardNavigationScheme); +} + void FrameLoaderClientImpl::dispatchDidAddBackForwardItem(HistoryItem*) const { } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index 925b759..7abf617 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -114,7 +114,7 @@ public: virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); - virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WTF::String& mime_type, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WTF::String& frame_name); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state); virtual void cancelPolicyCheck(); @@ -138,6 +138,7 @@ public: virtual void updateGlobalHistory(); virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const; virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; virtual void dispatchDidChangeBackForwardIndex() const; diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index 0751785..3d937ac 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -82,7 +82,7 @@ namespace WebCore { GraphicsContext3DInternal::GraphicsContext3DInternal() : m_webViewImpl(0) , m_initializedAvailableExtensions(false) -#if PLATFORM(SKIA) +#if USE(SKIA) #elif PLATFORM(CG) , m_renderOutput(0) #else @@ -165,7 +165,7 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon HTMLCanvasElement* canvas = context->canvas(); ImageBuffer* imageBuffer = canvas->buffer(); unsigned char* pixels = 0; -#if PLATFORM(SKIA) +#if USE(SKIA) const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap(); const SkBitmap* readbackBitmap = 0; ASSERT(canvasBitmap->config() == SkBitmap::kARGB_8888_Config); @@ -200,7 +200,7 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon m_impl->readBackFramebuffer(pixels, 4 * m_impl->width() * m_impl->height()); -#if PLATFORM(SKIA) +#if USE(SKIA) if (m_resizingBitmap.readyToDraw()) { // We need to draw the resizing bitmap into the canvas's backing store. SkCanvas canvas(*canvasBitmap); diff --git a/Source/WebKit/chromium/src/GraphicsContext3DInternal.h b/Source/WebKit/chromium/src/GraphicsContext3DInternal.h index be9ce16..c8f7c7a 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DInternal.h +++ b/Source/WebKit/chromium/src/GraphicsContext3DInternal.h @@ -29,7 +29,7 @@ #include "GraphicsContext3D.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> -#if PLATFORM(SKIA) +#if USE(SKIA) #include "SkBitmap.h" #endif @@ -276,7 +276,7 @@ private: #if USE(ACCELERATED_COMPOSITING) RefPtr<WebGLLayerChromium> m_compositingLayer; #endif -#if PLATFORM(SKIA) +#if USE(SKIA) // If the width and height of the Canvas's backing store don't // match those that we were given in the most recent call to // reshape(), then we need an intermediate bitmap to read back the diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp index dba28d9..ea0f433 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -37,7 +37,6 @@ #include "WebIDBDatabaseError.h" #include "WebIDBIndexImpl.h" #include "WebIDBKey.h" -#include "WebIDBObjectStoreImpl.h" #include "WebIDBTransactionImpl.h" #include "WebSerializedScriptValue.h" @@ -84,11 +83,6 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> idbKey) m_callbacks->onSuccess(WebKit::WebIDBKey(idbKey)); } -void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend) -{ - m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(backend)); -} - void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBTransactionBackendInterface> backend) { m_callbacks->onSuccess(new WebKit::WebIDBTransactionImpl(backend)); @@ -99,6 +93,11 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedSc m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue)); } +void IDBCallbacksProxy::onBlocked() +{ + m_callbacks->onBlocked(); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.h b/Source/WebKit/chromium/src/IDBCallbacksProxy.h index e1db23d..912cb86 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.h @@ -52,9 +52,9 @@ public: virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>); virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); virtual void onSuccess(PassRefPtr<IDBKey>); - virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>); virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); + virtual void onBlocked(); private: IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks>); diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp index ec7bf63..b3b9ea7 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -62,17 +62,14 @@ PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const return m_idbCursor->key(); } -PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const +PassRefPtr<IDBKey> IDBCursorBackendProxy::primaryKey() const { - WebKit::WebSerializedScriptValue webScriptValue; - WebKit::WebIDBKey webKey; - m_idbCursor->value(webScriptValue, webKey); - if (!webScriptValue.isNull()) { - ASSERT(webKey.type() == WebKit::WebIDBKey::InvalidType); - return IDBAny::create<SerializedScriptValue>(webScriptValue); - } - ASSERT(webKey.type() != WebKit::WebIDBKey::InvalidType); - return IDBAny::create<IDBKey>(webKey); + return m_idbCursor->primaryKey(); +} + +PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const +{ + return m_idbCursor->value(); } void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h index 650dded..0c2e1c7 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -44,7 +44,8 @@ public: virtual unsigned short direction() const; virtual PassRefPtr<IDBKey> key() const; - virtual PassRefPtr<IDBAny> value() const; + virtual PassRefPtr<IDBKey> primaryKey() const; + virtual PassRefPtr<SerializedScriptValue> value() const; virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp new file mode 100644 index 0000000..28c134f --- /dev/null +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBDatabaseCallbacksProxy.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "WebIDBDatabaseCallbacks.h" + +namespace WebCore { + +PassRefPtr<IDBDatabaseCallbacksProxy> IDBDatabaseCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBDatabaseCallbacks> callbacks) +{ + return adoptRef(new IDBDatabaseCallbacksProxy(callbacks)); +} + +IDBDatabaseCallbacksProxy::IDBDatabaseCallbacksProxy(PassOwnPtr<WebKit::WebIDBDatabaseCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +IDBDatabaseCallbacksProxy::~IDBDatabaseCallbacksProxy() +{ +} + +void IDBDatabaseCallbacksProxy::onVersionChange(const String& requestedVersion) +{ + m_callbacks->onVersionChange(requestedVersion); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h new file mode 100644 index 0000000..9fd7a0b --- /dev/null +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBDatabaseCallbacksProxy_h +#define IDBDatabaseCallbacksProxy_h + +#include "IDBDatabaseCallbacks.h" + +#if ENABLE(INDEXED_DATABASE) + +#include <wtf/PassOwnPtr.h> + +namespace WebKit { class WebIDBDatabaseCallbacks; } + +namespace WebCore { + +class IDBDatabaseCallbacksProxy : public IDBDatabaseCallbacks { +public: + static PassRefPtr<IDBDatabaseCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBDatabaseCallbacks>); + virtual ~IDBDatabaseCallbacksProxy(); + + virtual void onVersionChange(const String& requestedVersion); + +private: + IDBDatabaseCallbacksProxy(PassOwnPtr<WebKit::WebIDBDatabaseCallbacks>); + + OwnPtr<WebKit::WebIDBDatabaseCallbacks> m_callbacks; +}; + +} // namespace WebCore + +#endif + +#endif // IDBDatabaseCallbacksProxy_h diff --git a/Source/WebKit/chromium/src/IDBDatabaseProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseProxy.cpp index 6355a2a..7fe7378 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseProxy.cpp @@ -28,12 +28,14 @@ #include "DOMStringList.h" #include "IDBCallbacks.h" +#include "IDBDatabaseCallbacks.h" #include "IDBObjectStoreProxy.h" #include "IDBTransactionBackendProxy.h" #include "WebDOMStringList.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" +#include "WebIDBDatabaseCallbacksImpl.h" #include "WebIDBDatabaseError.h" #include "WebIDBObjectStore.h" #include "WebIDBTransaction.h" @@ -90,7 +92,7 @@ void IDBDatabaseProxy::deleteObjectStore(const String& name, IDBTransactionBacke m_webIDBDatabase->deleteObjectStore(name, *transactionProxy->getWebIDBTransaction(), ec); } -void IDBDatabaseProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) +void IDBDatabaseProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, ExceptionCode& ec) { m_webIDBDatabase->setVersion(version, new WebIDBCallbacksImpl(callbacks), ec); } @@ -106,11 +108,16 @@ PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStri return IDBTransactionBackendProxy::create(transaction); } -void IDBDatabaseProxy::close() +void IDBDatabaseProxy::close(PassRefPtr<IDBDatabaseCallbacks>) { m_webIDBDatabase->close(); } +void IDBDatabaseProxy::open(PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks) +{ + m_webIDBDatabase->open(new WebIDBDatabaseCallbacksImpl(databaseCallbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/IDBDatabaseProxy.h b/Source/WebKit/chromium/src/IDBDatabaseProxy.h index 2ceb77e..c3e8346 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseProxy.h +++ b/Source/WebKit/chromium/src/IDBDatabaseProxy.h @@ -48,9 +48,11 @@ public: virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&); virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&); - virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, ExceptionCode&); + virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, ExceptionCode&); - virtual void close(); + virtual void close(PassRefPtr<IDBDatabaseCallbacks>); + + virtual void open(PassRefPtr<IDBDatabaseCallbacks>); private: IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase>); diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index ae2eb1d..35e4de8 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -57,12 +57,12 @@ LocalFileSystem& LocalFileSystem::localFileSystem() return *localFileSystem; } -void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { ASSERT(context && context->isDocument()); Document* document = static_cast<Document*>(context); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); - webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, false, new WebFileSystemCallbacksImpl(callbacks, type)); + webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), 0, false, new WebFileSystemCallbacksImpl(callbacks, type)); } void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous) @@ -76,7 +76,7 @@ void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFi 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, type, context, synchronous), synchronous); + webWorker->openFileSystemForWorker(static_cast<WebFileSystem::Type>(type), size, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous); } } diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index ab14009..18f9fb8 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -87,6 +87,12 @@ String fileButtonChooseFileLabel() return query(WebLocalizedString::FileButtonChooseFileLabel); } +String defaultDetailsSummaryText() +{ + notImplemented(); + return String("Details"); +} + String fileButtonNoFileSelectedLabel() { return query(WebLocalizedString::FileButtonNoFileSelectedLabel); diff --git a/Source/WebKit/chromium/src/PlatformBridge.cpp b/Source/WebKit/chromium/src/PlatformBridge.cpp index b09d150..d825d24 100644 --- a/Source/WebKit/chromium/src/PlatformBridge.cpp +++ b/Source/WebKit/chromium/src/PlatformBridge.cpp @@ -132,14 +132,6 @@ static WebWidgetClient* toWebWidgetClient(Widget* widget) return chromeClientImpl->webView()->client(); } -static WebClipboard* getClipboard(const Frame* frame) -{ - WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(frame); - if (!frameImpl || !frameImpl->client()) - return 0; - return frameImpl->client()->clipboard(); -} - static WebCookieJar* getCookieJar(const Document* document) { WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); @@ -225,15 +217,9 @@ void PlatformBridge::clipboardWriteData(const String& type, } HashSet<String> PlatformBridge::clipboardReadAvailableTypes( - const Frame* frame, - PasteboardPrivate::ClipboardBuffer buffer, - bool* containsFilenames) + PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) { - WebClipboard* clipboard = getClipboard(frame); - if (!clipboard) - return HashSet<String>(); - - WebVector<WebString> result = clipboard->readAvailableTypes( + WebVector<WebString> result = webKitClient()->clipboard()->readAvailableTypes( static_cast<WebClipboard::Buffer>(buffer), containsFilenames); HashSet<String> types; for (size_t i = 0; i < result.size(); ++i) @@ -241,19 +227,12 @@ HashSet<String> PlatformBridge::clipboardReadAvailableTypes( return types; } -bool PlatformBridge::clipboardReadData(const Frame* frame, - PasteboardPrivate::ClipboardBuffer buffer, - const String& type, - String& data, - String& metadata) +bool PlatformBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, + const String& type, String& data, String& metadata) { - WebClipboard* clipboard = getClipboard(frame); - if (!clipboard) - return false; - WebString resultData; WebString resultMetadata; - bool succeeded = clipboard->readData( + bool succeeded = webKitClient()->clipboard()->readData( static_cast<WebClipboard::Buffer>(buffer), type, &resultData, &resultMetadata); if (succeeded) { data = resultData; @@ -262,14 +241,9 @@ bool PlatformBridge::clipboardReadData(const Frame* frame, return succeeded; } -Vector<String> PlatformBridge::clipboardReadFilenames(const Frame* frame, - PasteboardPrivate::ClipboardBuffer buffer) +Vector<String> PlatformBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) { - WebClipboard* clipboard = getClipboard(frame); - if (!clipboard) - return Vector<String>(); - - WebVector<WebString> result = clipboard->readFilenames( + WebVector<WebString> result = webKitClient()->clipboard()->readFilenames( static_cast<WebClipboard::Buffer>(buffer)); Vector<String> convertedResult; for (size_t i = 0; i < result.size(); ++i) @@ -463,12 +437,12 @@ bool PlatformBridge::ensureFontLoaded(HFONT font) #endif #if OS(LINUX) || OS(FREEBSD) -String PlatformBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters) +String PlatformBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale) { if (webKitClient()->sandboxSupport()) - return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters); + return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale); - WebCString family = WebFontInfo::familyForChars(characters, numCharacters); + WebCString family = WebFontInfo::familyForChars(characters, numCharacters, preferredLocale); if (family.data()) return WebString::fromUTF8(family.data()); @@ -539,7 +513,7 @@ void PlatformBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<Re { WebVector<WebSerializedScriptValue> webValues = values; WebVector<WebIDBKey> webKeys; - webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys); + webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, keyPath, webKeys); size_t webKeysSize = webKeys.size(); keys.reserveCapacity(webKeysSize); @@ -547,6 +521,11 @@ void PlatformBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<Re keys.append(PassRefPtr<IDBKey>(webKeys[i])); } +PassRefPtr<SerializedScriptValue> PlatformBridge::injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath) +{ + return webKitClient()->injectIDBKeyIntoSerializedValue(key, value, keyPath); +} + // Keygen --------------------------------------------------------------------- String PlatformBridge::signedPublicKeyAndChallengeString( @@ -856,6 +835,7 @@ static void GetWebThemeExtraParams(PlatformBridge::ThemePart part, PlatformBridg break; case PlatformBridge::PartButton: webThemeExtraParams->button.isDefault = extraParams->button.isDefault; + webThemeExtraParams->button.hasBorder = extraParams->button.hasBorder; webThemeExtraParams->button.backgroundColor = extraParams->button.backgroundColor; break; case PlatformBridge::PartTextField: @@ -864,6 +844,8 @@ static void GetWebThemeExtraParams(PlatformBridge::ThemePart part, PlatformBridg webThemeExtraParams->textField.backgroundColor = extraParams->textField.backgroundColor; break; case PlatformBridge::PartMenuList: + webThemeExtraParams->menuList.hasBorder = extraParams->menuList.hasBorder; + webThemeExtraParams->menuList.hasBorderRadius = extraParams->menuList.hasBorderRadius; webThemeExtraParams->menuList.arrowX = extraParams->menuList.arrowX; webThemeExtraParams->menuList.arrowY = extraParams->menuList.arrowY; webThemeExtraParams->menuList.backgroundColor = extraParams->menuList.backgroundColor; diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp index 86545b7..27783ae 100644 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp +++ b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp @@ -72,6 +72,14 @@ unsigned VideoFrameChromiumImpl::width() const return 0; } +unsigned VideoFrameChromiumImpl::width(unsigned plane) const +{ + unsigned planeWidth = width(); + if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) + planeWidth /= 2; + return planeWidth; +} + unsigned VideoFrameChromiumImpl::height() const { if (m_webVideoFrame) @@ -79,6 +87,14 @@ unsigned VideoFrameChromiumImpl::height() const return 0; } +unsigned VideoFrameChromiumImpl::height(unsigned plane) const +{ + unsigned planeHeight = height(); + if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) + planeHeight /= 2; + return planeHeight; +} + unsigned VideoFrameChromiumImpl::planes() const { if (m_webVideoFrame) @@ -109,21 +125,14 @@ unsigned VideoFrameChromiumImpl::texture(unsigned plane) const const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const { - switch (format()) { - case RGBA: - case YV16: - 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(); + return IntSize(stride(plane), height(plane)); +} + +bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const +{ + if (m_webVideoFrame) + return stride(plane) - width(plane) > 0; + return false; } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h index f86ee1c..ca7f88b 100644 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h +++ b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h @@ -52,12 +52,15 @@ public: virtual SurfaceType surfaceType() const; virtual Format format() const; virtual unsigned width() const; + virtual unsigned width(unsigned plane) const; virtual unsigned height() const; + virtual unsigned height(unsigned plane) const; virtual unsigned planes() const; virtual int stride(unsigned plane) const; virtual const void* data(unsigned plane) const; virtual unsigned texture(unsigned plane) const; virtual const IntSize requiredTextureSize(unsigned plane) const; + virtual bool hasPaddingBytes(unsigned plane) const; private: WebVideoFrame* m_webVideoFrame; diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index 50baa27..30305bd 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -39,6 +39,7 @@ #include "Node.h" #include "PlatformKeyboardEvent.h" #include "RenderStyle.h" +#include "UserGestureIndicator.h" #include "WebDocument.h" #include "WebNode.h" #include "WebPoint.h" @@ -66,6 +67,11 @@ void WebAccessibilityObject::assign(const WebKit::WebAccessibilityObject& other) assign(p); } +bool WebAccessibilityObject::equals(const WebAccessibilityObject& n) const +{ + return (m_private == n.m_private); +} + WebString WebAccessibilityObject::accessibilityDescription() const { if (!m_private) @@ -425,6 +431,8 @@ bool WebAccessibilityObject::performDefaultAction() const if (!m_private) return false; + UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + m_private->updateBackingStore(); return m_private->performDefaultAction(); } diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index 9167c69..0c1dc4f 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -50,7 +50,7 @@ class WebDragDataPrivate : public ChromiumDataObject { void WebDragData::initialize() { - assign(static_cast<WebDragDataPrivate*>(ChromiumDataObject::create(ChromiumDataObjectLegacy::create(Clipboard::DragAndDrop)).releaseRef())); + assign(static_cast<WebDragDataPrivate*>(ChromiumDataObject::create(Clipboard::DragAndDrop).releaseRef())); } void WebDragData::reset() diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index c86e715..53e1d44 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -158,6 +158,13 @@ #include <gdk/gdk.h> #endif +#if USE(V8) +#include "AsyncFileSystem.h" +#include "AsyncFileSystemChromium.h" +#include "DOMFileSystem.h" +#include "V8DOMFileSystem.h" +#endif + using namespace WebCore; namespace WebKit { @@ -358,7 +365,7 @@ public: { } - virtual void begin(float width) + virtual void begin(float width, float height) { } @@ -544,6 +551,12 @@ WebSize WebFrameImpl::scrollOffset() const return WebSize(); } +void WebFrameImpl::setScrollOffset(const WebSize& offset) +{ + if (FrameView* view = frameView()) + view->setScrollOffset(IntPoint(offset.width, offset.height)); +} + WebSize WebFrameImpl::contentsSize() const { return frame()->view()->contentsSize(); @@ -573,6 +586,11 @@ WebView* WebFrameImpl::view() const return viewImpl(); } +void WebFrameImpl::clearOpener() +{ + m_frame->loader()->setOpener(0); +} + WebFrame* WebFrameImpl::opener() const { Frame* opener = 0; @@ -822,6 +840,13 @@ v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const return V8Proxy::mainWorldContext(m_frame); } + +v8::Handle<v8::Value> WebFrameImpl::createFileSystem(int type, + const WebString& name, + const WebString& path) +{ + return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<AsyncFileSystem::Type>(type), path))); +} #endif bool WebFrameImpl::insertStyleText( @@ -892,8 +917,8 @@ void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) m_frame->page()->backForward()->setCurrentItem(currentItem.get()); } - m_frame->loader()->history()->goToItem( - historyItem.get(), FrameLoadTypeIndexedBackForward); + m_frame->page()->goToItem(historyItem.get(), + FrameLoadTypeIndexedBackForward); } void WebFrameImpl::loadData(const WebData& data, @@ -1052,12 +1077,17 @@ bool WebFrameImpl::willSuppressOpenerInNewFrame() const return frame()->loader()->suppressOpenerInNewFrame(); } +bool WebFrameImpl::pageDismissalEventBeingDispatched() const +{ + return frame()->loader()->pageDismissalEventBeingDispatched(); +} + void WebFrameImpl::replaceSelection(const WebString& text) { RefPtr<DocumentFragment> fragment = createFragmentFromText( frame()->selection()->toNormalizedRange().get(), text); applyCommand(ReplaceSelectionCommand::create( - frame()->document(), fragment.get(), false, true, true)); + frame()->document(), fragment.get(), ReplaceSelectionCommand::SmartReplace | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting)); } void WebFrameImpl::insertText(const WebString& text) @@ -1952,7 +1982,7 @@ void WebFrameImpl::createFrameView() view->setParentVisible(true); } -WebFrameImpl* WebFrameImpl::fromFrame(const Frame* frame) +WebFrameImpl* WebFrameImpl::fromFrame(Frame* frame) { if (!frame) return 0; diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index e7c92b0..179051e 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -73,12 +73,14 @@ public: virtual WebURL openSearchDescriptionURL() const; virtual WebString encoding() const; virtual WebSize scrollOffset() const; + virtual void setScrollOffset(const WebSize&); virtual WebSize contentsSize() const; virtual int contentsPreferredWidth() const; virtual int documentElementScrollHeight() const; virtual bool hasVisibleContent() const; virtual WebView* view() const; virtual WebFrame* opener() const; + virtual void clearOpener(); virtual WebFrame* parent() const; virtual WebFrame* top() const; virtual WebFrame* firstChild() const; @@ -107,6 +109,9 @@ public: virtual v8::Handle<v8::Value> executeScriptAndReturnValue( const WebScriptSource&); virtual v8::Local<v8::Context> mainWorldScriptContext() const; + virtual v8::Handle<v8::Value> createFileSystem(int type, + const WebString& name, + const WebString& path); #endif virtual bool insertStyleText(const WebString& css, const WebString& id); virtual void reload(bool ignoreCache); @@ -133,6 +138,7 @@ public: virtual unsigned unloadListenerCount() const; virtual bool isProcessingUserGesture() const; virtual bool willSuppressOpenerInNewFrame() const; + virtual bool pageDismissalEventBeingDispatched() const; virtual void replaceSelection(const WebString&); virtual void insertText(const WebString&); virtual void setMarkedText(const WebString&, unsigned location, unsigned length); @@ -209,7 +215,7 @@ public: void paintWithContext(WebCore::GraphicsContext&, const WebRect&); void createFrameView(); - static WebFrameImpl* fromFrame(const WebCore::Frame*); + static WebFrameImpl* fromFrame(WebCore::Frame* frame); static WebFrameImpl* fromFrameOwnerElement(WebCore::Element* element); // If the frame hosts a PluginDocument, this method returns the WebPluginContainerImpl @@ -361,7 +367,7 @@ private: // This variable keeps a cumulative total of matches found so far for ALL the // frames on the page, and is only incremented by calling IncreaseMatchCount // (on the main frame only). It should be -1 for all other frames. - size_t m_totalMatchCount; + int m_totalMatchCount; // This variable keeps a cumulative total of how many frames are currently // scoping, and is incremented/decremented on the main frame only. diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index bb7a19b..38ac360 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -32,14 +32,12 @@ #include "IDBDatabaseProxy.h" #include "IDBIndexBackendProxy.h" #include "IDBKey.h" -#include "IDBObjectStoreProxy.h" #include "IDBTransactionBackendProxy.h" #include "WebIDBCallbacks.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndex.h" #include "WebIDBKey.h" -#include "WebIDBObjectStore.h" #include "WebIDBTransaction.h" #include "WebSerializedScriptValue.h" @@ -81,11 +79,6 @@ void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) m_callbacks->onSuccess(IDBIndexBackendProxy::create(webKitInstance)); } -void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance) -{ - m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance)); -} - void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBTransaction* webKitInstance) { m_callbacks->onSuccess(IDBTransactionBackendProxy::create(webKitInstance)); @@ -96,6 +89,11 @@ void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& seri m_callbacks->onSuccess(serializedScriptValue); } +void WebIDBCallbacksImpl::onBlocked() +{ + m_callbacks->onBlocked(); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h index d2ae255..9dd59a5 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -46,9 +46,9 @@ public: virtual void onSuccess(WebKit::WebIDBDatabase*); virtual void onSuccess(const WebKit::WebIDBKey&); virtual void onSuccess(WebKit::WebIDBIndex*); - virtual void onSuccess(WebKit::WebIDBObjectStore*); virtual void onSuccess(WebKit::WebIDBTransaction*); virtual void onSuccess(const WebKit::WebSerializedScriptValue&); + virtual void onBlocked(); private: RefPtr<IDBCallbacks> m_callbacks; diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp index 5165574..86c4f57 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -52,22 +52,17 @@ unsigned short WebIDBCursorImpl::direction() const WebIDBKey WebIDBCursorImpl::key() const { - return WebIDBKey(m_idbCursorBackend->key()); + return m_idbCursorBackend->key(); } -void WebIDBCursorImpl::value(WebSerializedScriptValue& serializedScriptValue, WebIDBKey& idbKey) const +WebIDBKey WebIDBCursorImpl::primaryKey() const { - // Verify we're starting off with blank slates. - ASSERT(serializedScriptValue.isNull()); - ASSERT(idbKey.type() == WebIDBKey::InvalidType); + return m_idbCursorBackend->primaryKey(); +} - RefPtr<IDBAny> any = m_idbCursorBackend->value(); - if (any->type() == IDBAny::SerializedScriptValueType) - serializedScriptValue.assign(any->serializedScriptValue()); - else if (any->type() == IDBAny::IDBKeyType) - idbKey.assign(any->idbKey()); - else - ASSERT_NOT_REACHED(); +WebSerializedScriptValue WebIDBCursorImpl::value() const +{ + return m_idbCursorBackend->value(); } void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks, WebExceptionCode& ec) diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.h b/Source/WebKit/chromium/src/WebIDBCursorImpl.h index 7f8ebd7..de17a99 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.h @@ -44,7 +44,8 @@ public: virtual unsigned short direction() const; virtual WebIDBKey key() const; - virtual void value(WebSerializedScriptValue&, WebIDBKey&) const; + virtual WebIDBKey primaryKey() const; + virtual WebSerializedScriptValue value() const; virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&); virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&); virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp new file mode 100644 index 0000000..3ca0274 --- /dev/null +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebIDBDatabaseCallbacksImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBDatabaseCallbacks.h" +#include "WebString.h" + +namespace WebCore { + +WebIDBDatabaseCallbacksImpl::WebIDBDatabaseCallbacksImpl(PassRefPtr<IDBDatabaseCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +WebIDBDatabaseCallbacksImpl::~WebIDBDatabaseCallbacksImpl() +{ +} + +void WebIDBDatabaseCallbacksImpl::onVersionChange(const WebKit::WebString& version) +{ + m_callbacks->onVersionChange(version); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h new file mode 100644 index 0000000..ba3dc5e --- /dev/null +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBDatabaseCallbacksImpl_h +#define WebIDBDatabaseCallbacksImpl_h + +#if ENABLE(INDEXED_DATABASE) + +#include "WebDOMStringList.h" +#include "WebIDBDatabaseCallbacks.h" +#include "WebString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class IDBDatabaseCallbacks; + +class WebIDBDatabaseCallbacksImpl : public WebKit::WebIDBDatabaseCallbacks { +public: + WebIDBDatabaseCallbacksImpl(PassRefPtr<IDBDatabaseCallbacks>); + virtual ~WebIDBDatabaseCallbacksImpl(); + + virtual void onVersionChange(const WebKit::WebString& version); + +private: + RefPtr<IDBDatabaseCallbacks> m_callbacks; +}; + +} // namespace WebCore + +#endif + +#endif // WebIDBDatabaseCallbacksImpl_h diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 7f794d9..2a97923 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -29,8 +29,10 @@ #include "DOMStringList.h" #include "IDBCallbacksProxy.h" #include "IDBDatabaseBackendInterface.h" +#include "IDBDatabaseCallbacksProxy.h" #include "IDBTransactionBackendInterface.h" #include "WebIDBCallbacks.h" +#include "WebIDBDatabaseCallbacks.h" #include "WebIDBObjectStoreImpl.h" #include "WebIDBTransactionImpl.h" @@ -81,7 +83,7 @@ void WebIDBDatabaseImpl::deleteObjectStore(const WebString& name, const WebIDBTr void WebIDBDatabaseImpl::setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode& ec) { - m_databaseBackend->setVersion(version, IDBCallbacksProxy::create(callbacks), ec); + m_databaseBackend->setVersion(version, IDBCallbacksProxy::create(callbacks), m_databaseCallbacks, ec); } WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode& ec) @@ -97,7 +99,17 @@ WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names void WebIDBDatabaseImpl::close() { - m_databaseBackend->close(); + // Use the callbacks that ::open gave us so that the backend in + // multi-process chromium knows which database connection is closing. + ASSERT(m_databaseCallbacks); + m_databaseBackend->close(m_databaseCallbacks); +} + +void WebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) +{ + ASSERT(!m_databaseCallbacks); + m_databaseCallbacks = IDBDatabaseCallbacksProxy::create(callbacks); + m_databaseBackend->open(m_databaseCallbacks); } } // namespace WebCore diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 2dc27d5..0e1d03e 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -32,10 +32,14 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -namespace WebCore { class IDBDatabaseBackendInterface; } +namespace WebCore { +class IDBDatabaseBackendInterface; +class IDBDatabaseCallbacksProxy; +} namespace WebKit { +class WebIDBDatabaseCallbacks; class WebIDBObjectStore; class WebIDBTransaction; @@ -51,12 +55,15 @@ public: virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&); virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); - virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode&); + virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&); virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&); virtual void close(); + virtual void open(WebIDBDatabaseCallbacks*); + private: WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend; + WTF::RefPtr<WebCore::IDBDatabaseCallbacksProxy> m_databaseCallbacks; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp index 7e84df1..a20146e 100644 --- a/Source/WebKit/chromium/src/WebIDBKey.cpp +++ b/Source/WebKit/chromium/src/WebIDBKey.cpp @@ -83,6 +83,11 @@ WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& s return WebCore::createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); } +WebSerializedScriptValue WebIDBKey::injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& path) +{ + return WebCore::injectIDBKeyIntoSerializedValue(key, value, path); +} + void WebIDBKey::assign(const WebIDBKey& value) { m_private = value.m_private; diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index 7e91a17..548f1bb 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -155,6 +155,11 @@ bool WebInputElement::isValidValue(const WebString& value) const return constUnwrap<HTMLInputElement>()->isValidValue(value); } +bool WebInputElement::isChecked() const +{ + return constUnwrap<HTMLInputElement>()->checked(); +} + int WebInputElement::defaultMaxLength() { return HTMLInputElement::s_maximumLength; diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 24eb372..24eeb88 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -221,6 +221,7 @@ PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo m_altKey = event.modifiers & WebInputEvent::AltKey; m_shiftKey = event.modifiers & WebInputEvent::ShiftKey; m_metaKey = event.modifiers & WebInputEvent::MetaKey; + m_timestamp = event.timeStampSeconds; for (int i = 0; i < event.touchPointsLength; ++i) m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touchPoints[i])); diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp index cadcb6c..d130dd5 100644 --- a/Source/WebKit/chromium/src/WebKit.cpp +++ b/Source/WebKit/chromium/src/WebKit.cpp @@ -31,10 +31,10 @@ #include "config.h" #include "WebKit.h" -#include "DOMTimer.h" #include "Logging.h" #include "Page.h" #include "RuntimeEnabledFeatures.h" +#include "Settings.h" #include "TextEncoding.h" #include "WebMediaPlayerClientImpl.h" #include "WebSocket.h" @@ -66,13 +66,6 @@ void initialize(WebKitClient* webKitClient) WTF::initializeMainThread(); WTF::AtomicString::init(); - // Chromium sets the minimum interval timeout to 4ms, overriding the - // default of 10ms. We'd like to go lower, however there are poorly - // coded websites out there which do create CPU-spinning loops. Using - // 4ms prevents the CPU from spinning too busily and provides a balance - // between CPU spinning and the smallest possible interval timer. - WebCore::DOMTimer::setMinTimerInterval(0.004); - // There are some code paths (for example, running WebKit in the browser // process and calling into LocalStorage before anything else) where the // UTF8 string encoding tables are used on a background thread before diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 853cbcf..a1b428c 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -78,7 +78,10 @@ void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar) if (m_isEnabled) { registrar(WebMediaPlayerClientImpl::create, WebMediaPlayerClientImpl::getSupportedTypes, - WebMediaPlayerClientImpl::supportsType); + WebMediaPlayerClientImpl::supportsType, + 0, + 0, + 0); } } @@ -450,6 +453,34 @@ MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const return MediaPlayer::Unknown; } +unsigned WebMediaPlayerClientImpl::decodedFrameCount() const +{ + if (m_webMediaPlayer.get()) + return m_webMediaPlayer->decodedFrameCount(); + return 0; +} + +unsigned WebMediaPlayerClientImpl::droppedFrameCount() const +{ + if (m_webMediaPlayer.get()) + return m_webMediaPlayer->droppedFrameCount(); + return 0; +} + +unsigned WebMediaPlayerClientImpl::audioDecodedByteCount() const +{ + if (m_webMediaPlayer.get()) + return m_webMediaPlayer->audioDecodedByteCount(); + return 0; +} + +unsigned WebMediaPlayerClientImpl::videoDecodedByteCount() const +{ + if (m_webMediaPlayer.get()) + return m_webMediaPlayer->videoDecodedByteCount(); + return 0; +} + #if USE(ACCELERATED_COMPOSITING) bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const { diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index fcdb219..5d44626 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -114,6 +114,10 @@ public: virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual bool hasSingleSecurityOrigin() const; virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const; + virtual unsigned decodedFrameCount() const; + virtual unsigned droppedFrameCount() const; + virtual unsigned audioDecodedByteCount() const; + virtual unsigned videoDecodedByteCount() const; #if USE(ACCELERATED_COMPOSITING) virtual bool supportsAcceleratedRendering() const; diff --git a/Source/WebKit/chromium/src/WebNetworkStateNotifier.cpp b/Source/WebKit/chromium/src/WebNetworkStateNotifier.cpp new file mode 100644 index 0000000..ac810cd --- /dev/null +++ b/Source/WebKit/chromium/src/WebNetworkStateNotifier.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 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 "WebNetworkStateNotifier.h" + +#include "NetworkStateNotifier.h" + +using namespace WebCore; + +namespace WebKit { + +void WebNetworkStateNotifier::setOnLine(bool onLine) +{ + networkStateNotifier().setOnLine(onLine); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index 7ea9a8c..4b65b9e 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -79,6 +79,7 @@ #include "WebPageSerializerImpl.h" #include "Document.h" +#include "DocumentLoader.h" #include "DocumentType.h" #include "Element.h" #include "FrameLoader.h" diff --git a/Source/WebKit/chromium/src/WebSearchableFormData.cpp b/Source/WebKit/chromium/src/WebSearchableFormData.cpp index 647f20d..f50dcb8 100644 --- a/Source/WebKit/chromium/src/WebSearchableFormData.cpp +++ b/Source/WebKit/chromium/src/WebSearchableFormData.cpp @@ -32,6 +32,7 @@ #include "WebSearchableFormData.h" #include "Document.h" +#include "DocumentLoader.h" #include "FormDataBuilder.h" #include "FormDataList.h" #include "Frame.h" diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index dd82fa6..e5d172e 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -35,6 +35,7 @@ #include "Settings.h" #include "WebString.h" #include "WebURL.h" +#include <wtf/UnusedParam.h> #if defined(OS_WIN) #include "RenderThemeChromiumWin.h" @@ -46,6 +47,9 @@ namespace WebKit { WebSettingsImpl::WebSettingsImpl(Settings* settings) : m_settings(settings) + , m_compositeToTextureEnabled(false) + , m_showFPSCounter(false) + , m_showPlatformLayerTree(false) { ASSERT(settings); } @@ -284,6 +288,16 @@ void WebSettingsImpl::setShowDebugBorders(bool show) m_settings->setShowDebugBorders(show); } +void WebSettingsImpl::setShowFPSCounter(bool show) +{ + m_showFPSCounter = show; +} + +void WebSettingsImpl::setShowPlatformLayerTree(bool show) +{ + m_showPlatformLayerTree = show; +} + void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) { m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior)); @@ -294,6 +308,11 @@ void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled) m_settings->setAcceleratedCompositingEnabled(enabled); } +void WebSettingsImpl::setCompositeToTextureEnabled(bool enabled) +{ + m_compositeToTextureEnabled = enabled; +} + void WebSettingsImpl::setAcceleratedCompositingFor3DTransformsEnabled(bool enabled) { m_settings->setAcceleratedCompositingFor3DTransformsEnabled(enabled); @@ -349,4 +368,18 @@ void WebSettingsImpl::setInteractiveFormValidationEnabled(bool enabled) m_settings->setInteractiveFormValidationEnabled(enabled); } +void WebSettingsImpl::setMinimumTimerInterval(double interval) +{ + m_settings->setMinDOMTimerInterval(interval); +} + +void WebSettingsImpl::setFullScreenEnabled(bool enabled) +{ +#if ENABLE(FULLSCREEN_API) + m_settings->setFullScreenEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index b52a364..323a5b3 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -88,8 +88,14 @@ public: virtual void setExperimentalWebGLEnabled(bool); virtual void setOpenGLMultisamplingEnabled(bool); virtual void setShowDebugBorders(bool); + virtual void setShowFPSCounter(bool); + virtual bool showFPSCounter() const { return m_showFPSCounter; } + virtual void setShowPlatformLayerTree(bool); + virtual bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } virtual void setEditingBehavior(EditingBehavior); virtual void setAcceleratedCompositingEnabled(bool); + virtual void setCompositeToTextureEnabled(bool); + virtual bool compositeToTextureEnabled() const { return m_compositeToTextureEnabled; } virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); virtual void setAcceleratedCompositingForVideoEnabled(bool); virtual void setAcceleratedCompositingForPluginsEnabled(bool); @@ -101,9 +107,14 @@ public: virtual void setAsynchronousSpellCheckingEnabled(bool); virtual void setCaretBrowsingEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); + virtual void setMinimumTimerInterval(double); + virtual void setFullScreenEnabled(bool); private: WebCore::Settings* m_settings; + bool m_compositeToTextureEnabled; + bool m_showFPSCounter; + bool m_showPlatformLayerTree; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebURLRequest.cpp b/Source/WebKit/chromium/src/WebURLRequest.cpp index 7a77ca3..47139b3 100644 --- a/Source/WebKit/chromium/src/WebURLRequest.cpp +++ b/Source/WebKit/chromium/src/WebURLRequest.cpp @@ -56,7 +56,6 @@ public: { m_resourceRequest = &m_resourceRequestAllocation; m_allowStoredCredentials = p->m_allowStoredCredentials; - m_downloadToFile = p->m_downloadToFile; } virtual void dispose() { delete this; } @@ -269,12 +268,12 @@ void WebURLRequest::setAppCacheHostID(int appCacheHostID) bool WebURLRequest::downloadToFile() const { - return m_private->m_downloadToFile; + return m_private->m_resourceRequest->downloadToFile(); } void WebURLRequest::setDownloadToFile(bool downloadToFile) { - m_private->m_downloadToFile = downloadToFile; + m_private->m_resourceRequest->setDownloadToFile(downloadToFile); } ResourceRequest& WebURLRequest::toMutableResourceRequest() diff --git a/Source/WebKit/chromium/src/WebURLRequestPrivate.h b/Source/WebKit/chromium/src/WebURLRequestPrivate.h index 79f6451..1c1b696 100644 --- a/Source/WebKit/chromium/src/WebURLRequestPrivate.h +++ b/Source/WebKit/chromium/src/WebURLRequestPrivate.h @@ -39,17 +39,13 @@ class WebURLRequestPrivate { public: WebURLRequestPrivate() : m_resourceRequest(0) - , m_allowStoredCredentials(true) - , m_downloadToFile(false) { } + , m_allowStoredCredentials(true) { } // Called by WebURLRequest when it no longer needs this object. virtual void dispose() = 0; WebCore::ResourceRequest* m_resourceRequest; bool m_allowStoredCredentials; - - // FIXME: Move this to ResourceRequest once we have an internal consumer. - bool m_downloadToFile; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebURLResponse.cpp b/Source/WebKit/chromium/src/WebURLResponse.cpp index 7917298..2850441 100644 --- a/Source/WebKit/chromium/src/WebURLResponse.cpp +++ b/Source/WebKit/chromium/src/WebURLResponse.cpp @@ -60,7 +60,6 @@ public: : m_resourceResponseAllocation(*p->m_resourceResponse) { m_resourceResponse = &m_resourceResponseAllocation; - m_downloadFilePath = p->m_downloadFilePath; } virtual void dispose() { delete this; } @@ -257,16 +256,6 @@ void WebURLResponse::setLastModifiedDate(double lastModifiedDate) m_private->m_resourceResponse->setLastModifiedDate(static_cast<time_t>(lastModifiedDate)); } -bool WebURLResponse::isContentFiltered() const -{ - return m_private->m_resourceResponse->isContentFiltered(); -} - -void WebURLResponse::setIsContentFiltered(bool isContentFiltered) -{ - m_private->m_resourceResponse->setIsContentFiltered(isContentFiltered); -} - long long WebURLResponse::appCacheID() const { return m_private->m_resourceResponse->appCacheID(); @@ -376,22 +365,32 @@ void WebURLResponse::setIsMultipartPayload(bool value) WebString WebURLResponse::downloadFilePath() const { - return m_private->m_downloadFilePath; + return m_private->m_resourceResponse->downloadFilePath(); } void WebURLResponse::setDownloadFilePath(const WebString& downloadFilePath) { - m_private->m_downloadFilePath = downloadFilePath; + m_private->m_resourceResponse->setDownloadFilePath(downloadFilePath.utf8().data()); +} + +WebString WebURLResponse::remoteIPAddress() const +{ + return m_private->m_resourceResponse->remoteIPAddress(); +} + +void WebURLResponse::setRemoteIPAddress(const WebString& remoteIPAddress) +{ + m_private->m_resourceResponse->setRemoteIPAddress(remoteIPAddress); } -WebString WebURLResponse::socketAddress() const +unsigned short WebURLResponse::remotePort() const { - return m_private->m_resourceResponse->socketAddress(); + return m_private->m_resourceResponse->remotePort(); } -void WebURLResponse::setSocketAddress(const WebString& socketAddress) +void WebURLResponse::setRemotePort(unsigned short remotePort) { - m_private->m_resourceResponse->setSocketAddress(socketAddress); + m_private->m_resourceResponse->setRemotePort(remotePort); } void WebURLResponse::assign(WebURLResponsePrivate* p) diff --git a/Source/WebKit/chromium/src/WebURLResponsePrivate.h b/Source/WebKit/chromium/src/WebURLResponsePrivate.h index dc5ce22..7d22d7a 100644 --- a/Source/WebKit/chromium/src/WebURLResponsePrivate.h +++ b/Source/WebKit/chromium/src/WebURLResponsePrivate.h @@ -45,9 +45,6 @@ public: virtual void dispose() = 0; WebCore::ResourceResponse* m_resourceResponse; - - // FIXME: Move this to ResourceResponse once we have an internal consumer. - WebString m_downloadFilePath; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 18a953e..6ae4f35 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -120,6 +120,7 @@ #include "WebString.h" #include "WebVector.h" #include "WebViewClient.h" +#include "cc/CCHeadsUpDisplay.h" #include <wtf/ByteArray.h> #include <wtf/CurrentTime.h> #include <wtf/RefPtr.h> @@ -805,6 +806,15 @@ bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers) { ScrollDirection scrollDirection; ScrollGranularity scrollGranularity; +#if OS(DARWIN) + // Control-Up/Down should be PageUp/Down on Mac. + if (modifiers & WebMouseEvent::ControlKey) { + if (keyCode == VKEY_UP) + keyCode = VKEY_PRIOR; + else if (keyCode == VKEY_DOWN) + keyCode = VKEY_NEXT; + } +#endif if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) return false; return propagateScroll(scrollDirection, scrollGranularity); @@ -900,7 +910,7 @@ void WebViewImpl::hideAutoFillPopup() } } -Frame* WebViewImpl::focusedWebCoreFrame() +Frame* WebViewImpl::focusedWebCoreFrame() const { return m_page.get() ? m_page->focusController()->focusedOrMainFrame() : 0; } @@ -1005,10 +1015,7 @@ void WebViewImpl::layout() #if USE(ACCELERATED_COMPOSITING) void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { - ASSERT(rect.maxX() <= m_layerRenderer->rootLayerTextureSize().width() - && rect.maxY() <= m_layerRenderer->rootLayerTextureSize().height()); - -#if PLATFORM(SKIA) +#if USE(SKIA) PlatformContextSkia context(canvas); // PlatformGraphicsContext is actually a pointer to PlatformContextSkia @@ -1050,7 +1057,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) if (canvas) { // Clip rect to the confines of the rootLayerTexture. IntRect resizeRect(rect); - resizeRect.intersect(IntRect(IntPoint(), m_layerRenderer->rootLayerTextureSize())); + resizeRect.intersect(IntRect(IntPoint(), m_layerRenderer->visibleRectSize())); doPixelReadbackToCanvas(canvas, resizeRect); } #endif @@ -1106,36 +1113,49 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) m_currentInputEvent = &inputEvent; if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) { - // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. - RefPtr<Node> node = m_mouseCaptureNode; - - // Not all platforms call mouseCaptureLost() directly. - if (inputEvent.type == WebInputEvent::MouseUp) + const int mouseButtonModifierMask = WebInputEvent::LeftButtonDown | WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown; + if (inputEvent.type == WebInputEvent::MouseDown || + (inputEvent.modifiers & mouseButtonModifierMask) == 0) { + // It's possible the mouse was released and we didn't get the "up" + // message. This can happen if a dialog pops up while the mouse is + // held, for example. This will leave us "stuck" in capture mode. + // If we get a new mouse down message or any other mouse message + // where no "down" flags are set, we know the user is no longer + // dragging and we can release the capture and fall through to the + // regular event processing. mouseCaptureLost(); + } else { + // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. + RefPtr<Node> node = m_mouseCaptureNode; - AtomicString eventType; - switch (inputEvent.type) { - case WebInputEvent::MouseMove: - eventType = eventNames().mousemoveEvent; - break; - case WebInputEvent::MouseLeave: - eventType = eventNames().mouseoutEvent; - break; - case WebInputEvent::MouseDown: - eventType = eventNames().mousedownEvent; - break; - case WebInputEvent::MouseUp: - eventType = eventNames().mouseupEvent; - break; - default: - ASSERT_NOT_REACHED(); - } + // Not all platforms call mouseCaptureLost() directly. + if (inputEvent.type == WebInputEvent::MouseUp) + mouseCaptureLost(); - node->dispatchMouseEvent( - PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), - eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCount); - m_currentInputEvent = 0; - return true; + AtomicString eventType; + switch (inputEvent.type) { + case WebInputEvent::MouseMove: + eventType = eventNames().mousemoveEvent; + break; + case WebInputEvent::MouseLeave: + eventType = eventNames().mouseoutEvent; + break; + case WebInputEvent::MouseDown: + eventType = eventNames().mousedownEvent; + break; + case WebInputEvent::MouseUp: + eventType = eventNames().mouseupEvent; + break; + default: + ASSERT_NOT_REACHED(); + } + + node->dispatchMouseEvent( + PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), + eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCount); + m_currentInputEvent = 0; + return true; + } } bool handled = true; @@ -1276,7 +1296,7 @@ bool WebViewImpl::setComposition( // node, which doesn't exist any longer. PassRefPtr<Range> range = editor->compositionRange(); if (range) { - const Node* node = range->startPosition().node(); + const Node* node = range->startContainer(); if (!node || !node->isContentEditable()) return false; } @@ -1325,7 +1345,7 @@ bool WebViewImpl::confirmComposition(const WebString& text) // node, which doesn't exist any longer. PassRefPtr<Range> range = editor->compositionRange(); if (range) { - const Node* node = range->startPosition().node(); + const Node* node = range->startContainer(); if (!node || !node->isContentEditable()) return false; } @@ -1356,7 +1376,7 @@ WebTextInputType WebViewImpl::textInputType() if (!controller) return type; - const Node* node = controller->start().node(); + const Node* node = controller->start().deprecatedNode(); if (!node) return type; @@ -1385,14 +1405,14 @@ WebRect WebViewImpl::caretOrSelectionBounds() if (!view) return rect; - const Node* node = controller->start().node(); + const Node* node = controller->start().deprecatedNode(); if (!node || !node->renderer()) return rect; if (controller->isCaret()) rect = view->contentsToWindow(controller->absoluteCaretBounds()); else if (controller->isRange()) { - node = controller->end().node(); + node = controller->end().deprecatedNode(); if (!node || !node->renderer()) return rect; RefPtr<Range> range = controller->toNormalizedRange(); @@ -1749,21 +1769,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter); } -WebDragOperation WebViewImpl::dragTargetDragEnterNew( - int identity, - const WebPoint& clientPoint, - const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - ASSERT(!m_currentDragData.get()); - - m_currentDragData = ChromiumDataObject::createReadable(m_page->mainFrame(), Clipboard::DragAndDrop); - m_dragIdentity = identity; - m_operationsAllowed = operationsAllowed; - - return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter); -} - WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, @@ -1979,7 +1984,7 @@ void WebViewImpl::applyAutoFillSuggestions( if (m_autoFillPopupShowing) { refreshAutoFillPopup(); } else { - m_autoFillPopup->show(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0); + m_autoFillPopup->showInRect(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0); m_autoFillPopupShowing = true; } } @@ -2383,6 +2388,7 @@ void WebViewImpl::doComposite() ASSERT(isAcceleratedCompositingActive()); if (!page()) return; + FrameView* view = page()->mainFrame()->view(); // The visibleRect includes scrollbars whereas the contentRect doesn't. @@ -2393,7 +2399,16 @@ void WebViewImpl::doComposite() WebViewImplTilePaintInterface tilePaint(this); WebViewImplScrollbarPaintInterface scrollbarPaint(this); - m_layerRenderer->drawLayers(visibleRect, contentRect, scroll, tilePaint, scrollbarPaint); + m_layerRenderer->setCompositeOffscreen(settings()->compositeToTextureEnabled()); + + CCHeadsUpDisplay* hud = m_layerRenderer->headsUpDisplay(); + hud->setShowFPSCounter(settings()->showFPSCounter()); + hud->setShowPlatformLayerTree(settings()->showPlatformLayerTree()); + + m_layerRenderer->updateAndDrawLayers(visibleRect, contentRect, scroll, tilePaint, scrollbarPaint); + + if (m_layerRenderer->isCompositingOffscreen()) + m_layerRenderer->copyOffscreenTextureToDisplay(); } void WebViewImpl::reallocateRenderer() diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 7640ceb..2163725 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -158,11 +158,6 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragEnterNew( - int identity, - const WebPoint& clientPoint, - const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, @@ -209,7 +204,7 @@ public: return m_lastMouseDownPoint; } - WebCore::Frame* focusedWebCoreFrame(); + WebCore::Frame* focusedWebCoreFrame() const; // Returns the currently focused Node or null if no node has focus. WebCore::Node* focusedWebCoreNode(); diff --git a/Source/WebKit/chromium/src/WebWorkerBase.cpp b/Source/WebKit/chromium/src/WebWorkerBase.cpp index 06eb7b1..b16b6d4 100644 --- a/Source/WebKit/chromium/src/WebWorkerBase.cpp +++ b/Source/WebKit/chromium/src/WebWorkerBase.cpp @@ -237,7 +237,7 @@ bool WebWorkerBase::allowDatabase(WebFrame*, const WebString& name, const WebStr } #if ENABLE(FILE_SYSTEM) -void WebWorkerBase::openFileSystem(WebFileSystem::Type type, long long size, WebFileSystemCallbacks* callbacks, bool synchronous) +void WebWorkerBase::openFileSystemForWorker(WebFileSystem::Type type, long long size, WebFileSystemCallbacks* callbacks, bool synchronous) { WorkerRunLoop& runLoop = m_workerThread->runLoop(); WorkerScriptController* controller = WorkerScriptController::controllerForContext(); diff --git a/Source/WebKit/chromium/src/WebWorkerBase.h b/Source/WebKit/chromium/src/WebWorkerBase.h index fe84bf7..ec73505 100644 --- a/Source/WebKit/chromium/src/WebWorkerBase.h +++ b/Source/WebKit/chromium/src/WebWorkerBase.h @@ -92,8 +92,7 @@ public: 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*, bool synchronous); + void openFileSystemForWorker(WebFileSystem::Type, long long size, WebFileSystemCallbacks*, bool synchronous); #endif // Executes the given task on the main thread. diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h index 0604823..a7dcd3c 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h @@ -99,10 +99,6 @@ 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/Source/WebKit/chromium/src/gtk/WebFontInfo.cpp b/Source/WebKit/chromium/src/gtk/WebFontInfo.cpp index dd25eb1..94b75de 100644 --- a/Source/WebKit/chromium/src/gtk/WebFontInfo.cpp +++ b/Source/WebKit/chromium/src/gtk/WebFontInfo.cpp @@ -38,7 +38,7 @@ namespace WebKit { -WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCharacters) +WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale) { FcCharSet* cset = FcCharSetCreate(); for (size_t i = 0; i < numCharacters; ++i) { @@ -62,6 +62,13 @@ WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCha fcvalue.u.b = FcTrue; FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse); + if (preferredLocale) { + FcLangSet* langset = FcLangSetCreate(); + FcLangSetAdd(langset, reinterpret_cast<const FcChar8 *>(preferredLocale)); + FcPatternAddLangSet(pattern, FC_LANG, langset); + FcLangSetDestroy(langset); + } + FcConfigSubstitute(0, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); diff --git a/Source/WebKit/chromium/src/js/DevTools.js b/Source/WebKit/chromium/src/js/DevTools.js index 3d61be7..03c72d2 100644 --- a/Source/WebKit/chromium/src/js/DevTools.js +++ b/Source/WebKit/chromium/src/js/DevTools.js @@ -130,26 +130,6 @@ WebInspector.openLinkExternallyLabel = function() -/////////////////////////////////////////// -// Chromium layout test harness support. // -/////////////////////////////////////////// - -WebInspector.runAfterPendingDispatchesQueue = []; - -WebInspector.TestController.prototype.runAfterPendingDispatches = function(callback) -{ - WebInspector.runAfterPendingDispatchesQueue.push(callback); -}; - -WebInspector.queuesAreEmpty = function() -{ - var copy = this.runAfterPendingDispatchesQueue.slice(); - this.runAfterPendingDispatchesQueue = []; - for (var i = 0; i < copy.length; ++i) - copy[i].call(this); -}; - - ///////////////////////////// // Chromium theme support. // ///////////////////////////// diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index f155e08..1d98656 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -454,7 +454,7 @@ TestSuite.prototype.testPauseWhenLoadingDevTools = function() // Script execution can already be paused. if (WebInspector.currentPanel.paused) { - var callFrame = WebInspector.currentPanel.sidebarPanes.callstack.selectedCallFrame; + var callFrame = WebInspector.currentPanel._presentationModel.selectedCallFrame; this.assertEquals(expectations.functionsOnStack[0], callFrame.functionName); var callbackInvoked = false; this._checkSourceFrameWhenLoaded(expectations, function() { @@ -616,7 +616,7 @@ TestSuite.prototype.evaluateInConsole_ = function(code, callback) */ TestSuite.prototype._checkExecutionLine = function(sourceFrame, lineNumber, lineContent) { - this.assertEquals(lineNumber, sourceFrame._executionLine, "Unexpected execution line number."); + this.assertEquals(lineNumber, sourceFrame._executionLineNumber + 1, "Unexpected execution line number."); this.assertEquals(lineContent, sourceFrame._textModel.line(lineNumber - 1), "Unexpected execution line text."); } @@ -734,7 +734,7 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb if (test._scriptsAreParsed(expectedScripts)) callback(); else - test.addSniffer(WebInspector.debuggerModel, "_parsedScriptSource", waitForAllScripts); + test.addSniffer(WebInspector.panels.scripts, "_addOptionToFilesSelect", waitForAllScripts); } waitForAllScripts(); diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index 55883c9..4d24775 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -30,6 +30,7 @@ #include <ApplicationServices/ApplicationServices.h> #import <Cocoa/Cocoa.h> +#import "KeyEventCocoa.h" #include "WebInputEvent.h" #include <wtf/ASCIICType.h> @@ -122,384 +123,30 @@ static bool isKeypadEvent(NSEvent* event) static int windowsKeyCodeForKeyEvent(NSEvent* event) { - switch ([event keyCode]) { - // VK_TAB (09) TAB key - case 48: - return 0x09; - - // VK_APPS (5D) Right windows/meta key - case 54: // Right Command - return 0x5D; - - // VK_LWIN (5B) Left windows/meta key - case 55: // Left Command - return 0x5B; - - // VK_CAPITAL (14) caps locks key - case 57: // Capslock - return 0x14; - - // VK_SHIFT (10) either shift key - case 56: // Left Shift - case 60: // Right Shift - return 0x10; - - // VK_MENU (12) either alt key - case 58: // Left Alt - case 61: // Right Alt - return 0x12; - - // VK_CONTROL (11) either ctrl key - case 59: // Left Ctrl - case 62: // Right Ctrl - return 0x11; - -// Begin non-Apple addition --------------------------------------------------- - case 63: // Function (no Windows key code) - return 0; -// End non-Apple addition ----------------------------------------------------- - - // VK_CLEAR (0C) CLEAR key - case 71: return 0x0C; - - // VK_NUMPAD0 (60) Numeric keypad 0 key - case 82: return 0x60; - // VK_NUMPAD1 (61) Numeric keypad 1 key - case 83: return 0x61; - // VK_NUMPAD2 (62) Numeric keypad 2 key - case 84: return 0x62; - // VK_NUMPAD3 (63) Numeric keypad 3 key - case 85: return 0x63; - // VK_NUMPAD4 (64) Numeric keypad 4 key - case 86: return 0x64; - // VK_NUMPAD5 (65) Numeric keypad 5 key - case 87: return 0x65; - // VK_NUMPAD6 (66) Numeric keypad 6 key - case 88: return 0x66; - // VK_NUMPAD7 (67) Numeric keypad 7 key - case 89: return 0x67; - // VK_NUMPAD8 (68) Numeric keypad 8 key - case 91: return 0x68; - // VK_NUMPAD9 (69) Numeric keypad 9 key - case 92: return 0x69; - // VK_MULTIPLY (6A) Multiply key - case 67: return 0x6A; - // VK_ADD (6B) Add key - case 69: return 0x6B; - - // VK_SUBTRACT (6D) Subtract key - case 78: return 0x6D; - // VK_DECIMAL (6E) Decimal key - case 65: return 0x6E; - // VK_DIVIDE (6F) Divide key - case 75: return 0x6F; - } - -// Begin non-Apple addition --------------------------------------------------- - // |-[NSEvent charactersIgnoringModifiers]| isn't allowed for - // NSFlagsChanged, and conceivably we may not have caught everything - // which causes an NSFlagsChanged above. - if ([event type] == NSFlagsChanged) - return 0; -// End non-Apple addition ----------------------------------------------------- - - NSString* s = [event charactersIgnoringModifiers]; - if ([s length] != 1) - return 0; - - switch ([s characterAtIndex:0]) { - // VK_LBUTTON (01) Left mouse button - // VK_RBUTTON (02) Right mouse button - // VK_CANCEL (03) Control-break processing - // VK_MBUTTON (04) Middle mouse button (three-button mouse) - // VK_XBUTTON1 (05) - // VK_XBUTTON2 (06) - - // VK_BACK (08) BACKSPACE key - case 8: case 0x7F: return 0x08; - // VK_TAB (09) TAB key - case 9: return 0x09; - - // VK_CLEAR (0C) CLEAR key - // handled by key code above - - // VK_RETURN (0D) - case 0xD: case 3: return 0x0D; - - // VK_SHIFT (10) SHIFT key - // VK_CONTROL (11) CTRL key - // VK_MENU (12) ALT key - - // VK_PAUSE (13) PAUSE key - case NSPauseFunctionKey: return 0x13; - - // VK_CAPITAL (14) CAPS LOCK key - // VK_KANA (15) Input Method Editor (IME) Kana mode - // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) - // VK_HANGUL (15) IME Hangul mode - // VK_JUNJA (17) IME Junja mode - // VK_FINAL (18) IME final mode - // VK_HANJA (19) IME Hanja mode - // VK_KANJI (19) IME Kanji mode - - // VK_ESCAPE (1B) ESC key - case 0x1B: return 0x1B; - - // VK_CONVERT (1C) IME convert - // VK_NONCONVERT (1D) IME nonconvert - // VK_ACCEPT (1E) IME accept - // VK_MODECHANGE (1F) IME mode change request - - // VK_SPACE (20) SPACEBAR - case ' ': return 0x20; - // VK_PRIOR (21) PAGE UP key - case NSPageUpFunctionKey: return 0x21; - // VK_NEXT (22) PAGE DOWN key - case NSPageDownFunctionKey: return 0x22; - // VK_END (23) END key - case NSEndFunctionKey: return 0x23; - // VK_HOME (24) HOME key - case NSHomeFunctionKey: return 0x24; - // VK_LEFT (25) LEFT ARROW key - case NSLeftArrowFunctionKey: return 0x25; - // VK_UP (26) UP ARROW key - case NSUpArrowFunctionKey: return 0x26; - // VK_RIGHT (27) RIGHT ARROW key - case NSRightArrowFunctionKey: return 0x27; - // VK_DOWN (28) DOWN ARROW key - case NSDownArrowFunctionKey: return 0x28; - // VK_SELECT (29) SELECT key - case NSSelectFunctionKey: return 0x29; - // VK_PRINT (2A) PRINT key - case NSPrintFunctionKey: return 0x2A; - // VK_EXECUTE (2B) EXECUTE key - case NSExecuteFunctionKey: return 0x2B; - // VK_SNAPSHOT (2C) PRINT SCREEN key - case NSPrintScreenFunctionKey: return 0x2C; - // VK_INSERT (2D) INS key - case NSInsertFunctionKey: case NSHelpFunctionKey: return 0x2D; - // VK_DELETE (2E) DEL key - case NSDeleteFunctionKey: return 0x2E; - - // VK_HELP (2F) HELP key - - // (30) 0 key - case '0': case ')': return 0x30; - // (31) 1 key - case '1': case '!': return 0x31; - // (32) 2 key - case '2': case '@': return 0x32; - // (33) 3 key - case '3': case '#': return 0x33; - // (34) 4 key - case '4': case '$': return 0x34; - // (35) 5 key - case '5': case '%': return 0x35; - // (36) 6 key - case '6': case '^': return 0x36; - // (37) 7 key - case '7': case '&': return 0x37; - // (38) 8 key - case '8': case '*': return 0x38; - // (39) 9 key - case '9': case '(': return 0x39; - // (41) A key - case 'a': case 'A': return 0x41; - // (42) B key - case 'b': case 'B': return 0x42; - // (43) C key - case 'c': case 'C': return 0x43; - // (44) D key - case 'd': case 'D': return 0x44; - // (45) E key - case 'e': case 'E': return 0x45; - // (46) F key - case 'f': case 'F': return 0x46; - // (47) G key - case 'g': case 'G': return 0x47; - // (48) H key - case 'h': case 'H': return 0x48; - // (49) I key - case 'i': case 'I': return 0x49; - // (4A) J key - case 'j': case 'J': return 0x4A; - // (4B) K key - case 'k': case 'K': return 0x4B; - // (4C) L key - case 'l': case 'L': return 0x4C; - // (4D) M key - case 'm': case 'M': return 0x4D; - // (4E) N key - case 'n': case 'N': return 0x4E; - // (4F) O key - case 'o': case 'O': return 0x4F; - // (50) P key - case 'p': case 'P': return 0x50; - // (51) Q key - case 'q': case 'Q': return 0x51; - // (52) R key - case 'r': case 'R': return 0x52; - // (53) S key - case 's': case 'S': return 0x53; - // (54) T key - case 't': case 'T': return 0x54; - // (55) U key - case 'u': case 'U': return 0x55; - // (56) V key - case 'v': case 'V': return 0x56; - // (57) W key - case 'w': case 'W': return 0x57; - // (58) X key - case 'x': case 'X': return 0x58; - // (59) Y key - case 'y': case 'Y': return 0x59; - // (5A) Z key - case 'z': case 'Z': return 0x5A; - - // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) - // VK_RWIN (5C) Right Windows key (Natural keyboard) - // VK_APPS (5D) Applications key (Natural keyboard) - // VK_SLEEP (5F) Computer Sleep key - - // VK_NUMPAD0 (60) Numeric keypad 0 key - // VK_NUMPAD1 (61) Numeric keypad 1 key - // VK_NUMPAD2 (62) Numeric keypad 2 key - // VK_NUMPAD3 (63) Numeric keypad 3 key - // VK_NUMPAD4 (64) Numeric keypad 4 key - // VK_NUMPAD5 (65) Numeric keypad 5 key - // VK_NUMPAD6 (66) Numeric keypad 6 key - // VK_NUMPAD7 (67) Numeric keypad 7 key - // VK_NUMPAD8 (68) Numeric keypad 8 key - // VK_NUMPAD9 (69) Numeric keypad 9 key - // VK_MULTIPLY (6A) Multiply key - // VK_ADD (6B) Add key - // handled by key code above - - // VK_SEPARATOR (6C) Separator key - - // VK_SUBTRACT (6D) Subtract key - // VK_DECIMAL (6E) Decimal key - // VK_DIVIDE (6F) Divide key - // handled by key code above - - // VK_F1 (70) F1 key - case NSF1FunctionKey: return 0x70; - // VK_F2 (71) F2 key - case NSF2FunctionKey: return 0x71; - // VK_F3 (72) F3 key - case NSF3FunctionKey: return 0x72; - // VK_F4 (73) F4 key - case NSF4FunctionKey: return 0x73; - // VK_F5 (74) F5 key - case NSF5FunctionKey: return 0x74; - // VK_F6 (75) F6 key - case NSF6FunctionKey: return 0x75; - // VK_F7 (76) F7 key - case NSF7FunctionKey: return 0x76; - // VK_F8 (77) F8 key - case NSF8FunctionKey: return 0x77; - // VK_F9 (78) F9 key - case NSF9FunctionKey: return 0x78; - // VK_F10 (79) F10 key - case NSF10FunctionKey: return 0x79; - // VK_F11 (7A) F11 key - case NSF11FunctionKey: return 0x7A; - // VK_F12 (7B) F12 key - case NSF12FunctionKey: return 0x7B; - // VK_F13 (7C) F13 key - case NSF13FunctionKey: return 0x7C; - // VK_F14 (7D) F14 key - case NSF14FunctionKey: return 0x7D; - // VK_F15 (7E) F15 key - case NSF15FunctionKey: return 0x7E; - // VK_F16 (7F) F16 key - case NSF16FunctionKey: return 0x7F; - // VK_F17 (80H) F17 key - case NSF17FunctionKey: return 0x80; - // VK_F18 (81H) F18 key - case NSF18FunctionKey: return 0x81; - // VK_F19 (82H) F19 key - case NSF19FunctionKey: return 0x82; - // VK_F20 (83H) F20 key - case NSF20FunctionKey: return 0x83; - // VK_F21 (84H) F21 key - case NSF21FunctionKey: return 0x84; - // VK_F22 (85H) F22 key - case NSF22FunctionKey: return 0x85; - // VK_F23 (86H) F23 key - case NSF23FunctionKey: return 0x86; - // VK_F24 (87H) F24 key - case NSF24FunctionKey: return 0x87; - - // VK_NUMLOCK (90) NUM LOCK key - - // VK_SCROLL (91) SCROLL LOCK key - case NSScrollLockFunctionKey: return 0x91; - - // VK_LSHIFT (A0) Left SHIFT key - // VK_RSHIFT (A1) Right SHIFT key - // VK_LCONTROL (A2) Left CONTROL key - // VK_RCONTROL (A3) Right CONTROL key - // VK_LMENU (A4) Left MENU key - // VK_RMENU (A5) Right MENU key - // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - - // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key - case ';': case ':': return 0xBA; - // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - case '=': case '+': return 0xBB; - // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - case ',': case '<': return 0xBC; - // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - case '-': case '_': return 0xBD; - // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - case '.': case '>': return 0xBE; - // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - case '/': case '?': return 0xBF; - // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - case '`': case '~': return 0xC0; - // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - case '[': case '{': return 0xDB; - // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - case '\\': case '|': return 0xDC; - // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - case ']': case '}': return 0xDD; - // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - case '\'': case '"': return 0xDE; - - // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. - // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - // VK_ATTN (F6) Attn key - // VK_CRSEL (F7) CrSel key - // VK_EXSEL (F8) ExSel key - // VK_EREOF (F9) Erase EOF key - // VK_PLAY (FA) Play key - // VK_ZOOM (FB) Zoom key - // VK_NONAME (FC) Reserved for future use - // VK_PA1 (FD) PA1 key - // VK_OEM_CLEAR (FE) Clear key + int code = 0; + // There are several kinds of characters for which we produce key code from char code: + // 1. Roman letters. Windows keyboard layouts affect both virtual key codes and character codes for these, + // so e.g. 'A' gets the same keyCode on QWERTY, AZERTY or Dvorak layouts. + // 2. Keys for which there is no known Mac virtual key codes, like PrintScreen. + // 3. Certain punctuation keys. On Windows, these are also remapped depending on current keyboard layout, + // but see comment in windowsKeyCodeForCharCode(). + if ([event type] == NSKeyDown || [event type] == NSKeyUp) { + // Cmd switches Roman letters for Dvorak-QWERTY layout, so try modified characters first. + NSString* s = [event characters]; + code = [s length] > 0 ? WebCore::windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0; + if (code) + return code; + + // Ctrl+A on an AZERTY keyboard would get VK_Q keyCode if we relied on -[NSEvent keyCode] below. + s = [event charactersIgnoringModifiers]; + code = [s length] > 0 ? WebCore::windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0; + if (code) + return code; } - return 0; + // Map Mac virtual key code directly to Windows one for any keys not handled above. + // E.g. the key next to Caps Lock has the same Event.keyCode on U.S. keyboard ('A') and on Russian keyboard (CYRILLIC LETTER EF). + return WebCore::windowsKeyCodeForKeyCode([event keyCode]); } static inline NSString* textFromEvent(NSEvent* event) |