diff options
author | Ben Murdoch <benm@google.com> | 2010-06-15 19:36:43 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-16 14:52:28 +0100 |
commit | 545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch) | |
tree | c0c14763654d84d37577dde512c3d3b4699a9e86 /WebKit/chromium/src | |
parent | 719298a66237d38ea5c05f1547123ad8aacbc237 (diff) | |
download | external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2 |
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebKit/chromium/src')
47 files changed, 866 insertions, 208 deletions
diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 4f8793a..8084aad 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -44,14 +44,25 @@ namespace WebKit { unsigned AutoFillPopupMenuClient::getSuggestionsCount() const { - return m_names.size(); + return m_names.size() + ((m_separatorIndex == -1) ? 0 : 1); } WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const { + if (listIndex == static_cast<unsigned>(m_separatorIndex)) + return WebString(); + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + // FIXME: Modify the PopupMenu to add the label in gray right-justified. ASSERT(listIndex >= 0 && listIndex < m_names.size()); - return m_names[listIndex] + String(" (") + m_labels[listIndex] + String(")"); + + WebString suggestion = m_names[listIndex]; + if (m_labels[listIndex].isEmpty()) + return suggestion; + + return suggestion + String(" (") + m_labels[listIndex] + String(")"); } void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) @@ -64,37 +75,85 @@ void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) { + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + ASSERT(listIndex >= 0 && listIndex < m_names.size()); + webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + m_names[listIndex], + m_labels[listIndex], + listIndex); +} + +void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) +{ WebViewImpl* webView = getWebView(); if (!webView) return; - webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), + if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) + --listIndex; + + ASSERT(listIndex >= 0 && listIndex < m_names.size()); + + webView->client()->didSelectAutoFillSuggestion(WebNode(getTextField()), m_names[listIndex], m_labels[listIndex]); } +void AutoFillPopupMenuClient::selectionCleared() +{ + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + webView->suggestionsPopupDidHide(); + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +void AutoFillPopupMenuClient::popupDidHide() +{ + // FIXME: Refactor this method, as selectionCleared() and popupDidHide() + // share the exact same functionality. + WebViewImpl* webView = getWebView(); + if (!webView) + return; + + webView->client()->didClearAutoFillSelection(WebNode(getTextField())); +} + +bool AutoFillPopupMenuClient::itemIsSeparator(unsigned listIndex) const +{ + return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex); +} + void AutoFillPopupMenuClient::initialize( HTMLInputElement* textField, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(separatorIndex < static_cast<int>(names.size())); // The suggestions must be set before initializing the // SuggestionsPopupMenuClient. - setSuggestions(names, labels); + setSuggestions(names, labels, separatorIndex); - SuggestionsPopupMenuClient::initialize(textField, defaultSuggestionIndex); + SuggestionsPopupMenuClient::initialize(textField, -1); } void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels) + const WebVector<WebString>& labels, + int separatorIndex) { ASSERT(names.size() == labels.size()); + ASSERT(separatorIndex < static_cast<int>(names.size())); m_names.clear(); m_labels.clear(); @@ -103,6 +162,8 @@ void AutoFillPopupMenuClient::setSuggestions(const WebVector<WebString>& names, m_labels.append(labels[i]); } + m_separatorIndex = separatorIndex; + // Try to preserve selection if possible. if (getSelectedIndex() >= static_cast<int>(names.size())) setSelectedIndex(-1); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.h b/WebKit/chromium/src/AutoFillPopupMenuClient.h index 568ce4d..488bdb1 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -52,18 +52,26 @@ public: // WebCore::PopupMenuClient implementation: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionCleared(); + virtual void popupDidHide(); + virtual bool itemIsSeparator(unsigned listIndex) const; void initialize(WebCore::HTMLInputElement*, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + int separatorIndex); void setSuggestions(const WebVector<WebString>& names, - const WebVector<WebString>& labels); + const WebVector<WebString>& labels, + int separatorIndex); private: Vector<WebCore::String> m_names; Vector<WebCore::String> m_labels; + + // The index of the separator. -1 if there is no separator. + int m_separatorIndex; }; } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index d54f328..559a62b 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -48,6 +48,7 @@ #include "WebGeolocationService.h" #include "GeolocationServiceChromium.h" #include "GraphicsLayer.h" +#include "HTMLNames.h" #include "HitTestResult.h" #include "IntRect.h" #include "Node.h" @@ -159,35 +160,8 @@ float ChromeClientImpl::scaleFactor() void ChromeClientImpl::focus() { - if (!m_webView->client()) - return; - - m_webView->client()->didFocus(); - - // If accessibility is enabled, we should notify assistive technology that - // the active AccessibilityObject changed. - const Frame* frame = m_webView->focusedWebCoreFrame(); - if (!frame) - return; - - Document* doc = frame->document(); - - if (doc && doc->axObjectCache()->accessibilityEnabled()) { - Node* focusedNode = m_webView->focusedWebCoreNode(); - - if (!focusedNode) { - // Could not retrieve focused Node. - return; - } - - // Retrieve the focused AccessibilityObject. - AccessibilityObject* focusedAccObj = - doc->axObjectCache()->getOrCreate(focusedNode->renderer()); - - // Alert assistive technology that focus changed. - if (focusedAccObj) - m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); - } + if (m_webView->client()) + m_webView->client()->didFocus(); } void ChromeClientImpl::unfocus() @@ -217,17 +191,37 @@ void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); - WebURL focus_url; + WebURL focusURL; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a // WebCore::Node. - HitTestResult hit_test(IntPoint(0, 0)); + HitTestResult hitTest(IntPoint(0, 0)); // This cast must be valid because of the isLink() check. - hit_test.setURLElement(reinterpret_cast<Element*>(node)); - if (hit_test.isLiveLink()) - focus_url = hit_test.absoluteLinkURL(); + hitTest.setURLElement(static_cast<Element*>(node)); + if (hitTest.isLiveLink()) + focusURL = hitTest.absoluteLinkURL(); + } + m_webView->client()->setKeyboardFocusURL(focusURL); + + if (!node) + return; + + // If accessibility is enabled, we should notify assistive technology that + // the active AccessibilityObject changed. + Document* document = node->document(); + if (!document) { + ASSERT_NOT_REACHED(); + return; + } + if (document && document->axObjectCache()->accessibilityEnabled()) { + // Retrieve the focused AccessibilityObject. + AccessibilityObject* focusedAccObj = + document->axObjectCache()->getOrCreate(node->renderer()); + + // Alert assistive technology that focus changed. + if (focusedAccObj) + m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); } - m_webView->client()->setKeyboardFocusURL(focus_url); } Page* ChromeClientImpl::createWindow( @@ -736,4 +730,23 @@ void ChromeClientImpl::scheduleCompositingLayerSync() } #endif +bool ChromeClientImpl::supportsFullscreenForNode(const WebCore::Node* node) +{ + if (m_webView->client() && node->hasTagName(WebCore::HTMLNames::videoTag)) + return m_webView->client()->supportsFullscreen(); + return false; +} + +void ChromeClientImpl::enterFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->enterFullscreenForNode(WebNode(node)); +} + +void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) +{ + if (m_webView->client()) + m_webView->client()->exitFullscreenForNode(WebNode(node)); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index 3b5ebd5..84355c3 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -146,6 +146,10 @@ public: // to do an eager layout before the drawing. virtual void scheduleCompositingLayerSync(); #endif + virtual bool supportsFullscreenForNode(const WebCore::Node*); + virtual void enterFullscreenForNode(WebCore::Node*); + virtual void exitFullscreenForNode(WebCore::Node*); + // ChromeClientChromium methods: virtual void popupOpened(WebCore::PopupContainer* popupContainer, const WebCore::IntRect& bounds, diff --git a/WebKit/chromium/src/DebuggerAgent.h b/WebKit/chromium/src/DebuggerAgent.h index 7f3dbbb..17cde11 100644 --- a/WebKit/chromium/src/DebuggerAgent.h +++ b/WebKit/chromium/src/DebuggerAgent.h @@ -40,10 +40,7 @@ namespace WebKit { METHOD0(getContextId) \ \ /* Request v8 to process all debug commands in the queue. */ \ - METHOD0(processDebugCommands) \ - \ - /* Push DebuggerScript.js content to the agent. */ \ - METHOD1(setDebuggerScriptSource, String) + METHOD0(processDebugCommands) DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT) diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp index 673482a..dde9e1d 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.cpp +++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp @@ -79,11 +79,6 @@ void DebuggerAgentImpl::processDebugCommands() v8::Debug::ProcessDebugMessages(); } -void DebuggerAgentImpl::setDebuggerScriptSource(const String& source) -{ - WebCore::ScriptDebugServer::shared().setDebuggerScriptSource(source); -} - void DebuggerAgentImpl::debuggerOutput(const String& command) { m_delegate->debuggerOutput(command); diff --git a/WebKit/chromium/src/DebuggerAgentImpl.h b/WebKit/chromium/src/DebuggerAgentImpl.h index bd9ddf6..0e6e6af 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.h +++ b/WebKit/chromium/src/DebuggerAgentImpl.h @@ -60,7 +60,6 @@ public: // DebuggerAgent implementation. virtual void getContextId(); virtual void processDebugCommands(); - virtual void setDebuggerScriptSource(const String&); void debuggerOutput(const WebCore::String& out); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 7c5635b..0681675 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -41,7 +41,7 @@ #include "ImageData.h" #include "WebGLBuffer.h" #include "Int8Array.h" -#include "FloatArray.h" +#include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" #include "WebGLProgram.h" diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 3e5f00a..42be08d 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -35,6 +35,7 @@ #include "WebIDBDatabaseImpl.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndexImpl.h" +#include "WebIDBObjectStoreImpl.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -79,6 +80,12 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBIndex> idbIndex) m_callbacks.clear(); } +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore) +{ + m_callbacks->onSuccess(new WebKit::WebIDBObjectStoreImpl(idbObjectStore)); + m_callbacks.clear(); +} + void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue)); diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index d98e2ed..8f2da28 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -30,6 +30,7 @@ #define IDBCallbacksProxy_h #include "IDBCallbacks.h" +#include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -43,6 +44,7 @@ namespace WebCore { class IDBDatabaseError; class IDBDatabase; +class IDBObjectStore; class SerializedScriptValue; class IDBCallbacksProxy : public IDBCallbacks { @@ -54,6 +56,7 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); private: diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp index deb2f99..9d009c0 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.cpp +++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp @@ -27,8 +27,13 @@ #include "IDBDatabaseProxy.h" #include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBObjectStoreProxy.h" +#include "WebFrameImpl.h" +#include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" +#include "WebIDBObjectStore.h" #if ENABLE(INDEXED_DATABASE) @@ -48,26 +53,44 @@ IDBDatabaseProxy::~IDBDatabaseProxy() { } -String IDBDatabaseProxy::name() +String IDBDatabaseProxy::name() const { return m_webIDBDatabase->name(); } -String IDBDatabaseProxy::description() +String IDBDatabaseProxy::description() const { return m_webIDBDatabase->description(); } -String IDBDatabaseProxy::version() +String IDBDatabaseProxy::version() const { return m_webIDBDatabase->version(); } -PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() +PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() const { return m_webIDBDatabase->objectStores(); } +void IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBObjectStore> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode) +{ + WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->objectStore(name, mode); + if (!objectStore) + return 0; + return IDBObjectStoreProxy::create(objectStore); +} + +void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBDatabase->removeObjectStore(name, new WebIDBCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h index e5e5125..36588f0 100644 --- a/WebKit/chromium/src/IDBDatabaseProxy.h +++ b/WebKit/chromium/src/IDBDatabaseProxy.h @@ -42,12 +42,16 @@ public: static PassRefPtr<IDBDatabase> create(PassOwnPtr<WebKit::WebIDBDatabase>); virtual ~IDBDatabaseProxy(); - virtual String name(); - virtual String description(); - virtual String version(); - virtual PassRefPtr<DOMStringList> objectStores(); + virtual String name() const; + virtual String description() const; + virtual String version() const; + virtual PassRefPtr<DOMStringList> objectStores() const; - // FIXME: Add other methods. + // FIXME: Add transaction and setVersion. + + virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode); + virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); private: IDBDatabaseProxy(PassOwnPtr<WebKit::WebIDBDatabase>); diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp new file mode 100755 index 0000000..5942e2a --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IDBObjectStoreProxy.h" + +#include "DOMStringList.h" +#include "IDBCallbacks.h" +#include "IDBIndexProxy.h" +#include "WebIDBCallbacksImpl.h" +#include "WebIDBIndex.h" +#include "WebIDBObjectStore.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +PassRefPtr<IDBObjectStore> IDBObjectStoreProxy::create(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) +{ + return adoptRef(new IDBObjectStoreProxy(objectStore)); +} + +IDBObjectStoreProxy::IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore> objectStore) + : m_webIDBObjectStore(objectStore) +{ +} + +IDBObjectStoreProxy::~IDBObjectStoreProxy() +{ +} + +String IDBObjectStoreProxy::name() const +{ + return m_webIDBObjectStore->name(); +} + +String IDBObjectStoreProxy::keyPath() const +{ + return m_webIDBObjectStore->keyPath(); +} + +PassRefPtr<DOMStringList> IDBObjectStoreProxy::indexNames() const +{ + return m_webIDBObjectStore->indexNames(); +} + +void IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->createIndex(name, keyPath, unique, new WebIDBCallbacksImpl(callbacks)); +} + +PassRefPtr<IDBIndex> IDBObjectStoreProxy::index(const String& name) +{ + WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name); + if (!index) + return 0; + return IDBIndexProxy::create(index); +} + +void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBObjectStore->removeIndex(name, new WebIDBCallbacksImpl(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h new file mode 100755 index 0000000..78983cb --- /dev/null +++ b/WebKit/chromium/src/IDBObjectStoreProxy.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IDBObjectStoreProxy_h +#define IDBObjectStoreProxy_h + +#include "IDBObjectStore.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { class WebIDBObjectStore; } + +namespace WebCore { + +class DOMStringList; +class IDBIndex; + +class IDBObjectStoreProxy : public IDBObjectStore { +public: + static PassRefPtr<IDBObjectStore> create(PassOwnPtr<WebKit::WebIDBObjectStore>); + virtual ~IDBObjectStoreProxy(); + + virtual String name() const; + virtual String keyPath() const; + virtual PassRefPtr<DOMStringList> indexNames() const; + + virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); + virtual PassRefPtr<IDBIndex> index(const String& name); + virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); + +private: + IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>); + + OwnPtr<WebKit::WebIDBObjectStore> m_webIDBObjectStore; +}; + +} // namespace WebCore + +#endif + +#endif // IDBObjectStoreProxy_h + diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IndexedDatabaseProxy.cpp index 2572877..bee99b2 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp +++ b/WebKit/chromium/src/IndexedDatabaseProxy.cpp @@ -57,12 +57,10 @@ IndexedDatabaseProxy::~IndexedDatabaseProxy() { } -void IndexedDatabaseProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, ExceptionCode& ec) +void IndexedDatabaseProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) { - if (!frame || !frame->document()) - return; WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - m_webIndexedDatabase->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame, ec); + m_webIndexedDatabase->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); } } // namespace WebCore diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IndexedDatabaseProxy.h index 206099c..53097f0 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.h +++ b/WebKit/chromium/src/IndexedDatabaseProxy.h @@ -42,7 +42,7 @@ public: static PassRefPtr<IndexedDatabase> create(); virtual ~IndexedDatabaseProxy(); - virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&); + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: IndexedDatabaseProxy(); diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index 22b515f..91d10d5 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -35,6 +35,8 @@ #include "FloatRect.h" #include "NotImplemented.h" #include "Page.h" +#include "WebDevToolsAgentImpl.h" +#include "WebDevToolsMessageData.h" #include "WebRect.h" #include "WebURL.h" #include "WebURLRequest.h" @@ -102,4 +104,20 @@ void InspectorClientImpl::storeSetting(const String& key, const String& value) m_inspectedWebView->setInspectorSetting(key, value); } +bool InspectorClientImpl::sendMessageToFrontend(const WebCore::String& message) +{ + WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); + if (!devToolsAgent) + return false; + + WebVector<WebString> arguments(size_t(1)); + arguments[0] = message; + WebDevToolsMessageData data; + data.className = "ToolsAgentDelegate"; + data.methodName = "dispatchOnClient"; + data.arguments.swap(arguments); + devToolsAgent->sendRpcMessage(data); + return true; +} + } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index 7447d0c..f4994e3 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -36,6 +36,8 @@ #include <wtf/OwnPtr.h> namespace WebKit { + +class WebDevToolsAgentClient; class WebViewImpl; class InspectorClientImpl : public WebCore::InspectorClient { @@ -46,15 +48,14 @@ public: // InspectorClient methods: virtual void inspectorDestroyed(); virtual void openInspectorFrontend(WebCore::InspectorController*); + virtual void highlight(WebCore::Node*); virtual void hideHighlight(); - virtual void populateSetting( - const WebCore::String& key, - WebCore::String* value); - virtual void storeSetting( - const WebCore::String& key, - const WebCore::String& value); + virtual void populateSetting(const WebCore::String& key, WebCore::String* value); + virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); + + virtual bool sendMessageToFrontend(const WebCore::String&); private: // The WebViewImpl of the page being inspected; gets passed to the constructor diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp index dca1856..c928c91 100644 --- a/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -88,7 +88,10 @@ void NotificationPresenterImpl::cancel(Notification* notification) void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notification) { - m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); + // TODO(pkasting): We cannot ref an object that's being destroyed. Either + // this function needs to be called earlier than in ~Notification(), or it + // needs to not ref this object. + //m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); } NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& sourceURL) diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.h b/WebKit/chromium/src/SuggestionsPopupMenuClient.h index 77b3890..7717593 100644 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.h +++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.h @@ -61,6 +61,8 @@ public: // WebCore::PopupMenuClient methods: virtual void valueChanged(unsigned listIndex, bool fireEvents = true); + virtual void selectionChanged(unsigned, bool) {} + virtual void selectionCleared() {} virtual WebCore::String itemText(unsigned listIndex) const; virtual WebCore::String itemToolTip(unsigned lastIndex) const { return WebCore::String(); } virtual WebCore::String itemAccessibilityText(unsigned lastIndex) const { return WebCore::String(); } diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 8dde31f..c4bbbfa 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -462,6 +462,11 @@ void WebDevToolsAgentImpl::createInspectorFrontendProxy() m_utilityContext = v8::Context::New(); compileUtilityScripts(); initDevToolsAgentHost(); +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + WebCString debuggerScriptJs = m_client->debuggerScriptSource(); + WebCore::ScriptDebugServer::shared().setDebuggerScriptSource( + WebCore::String(debuggerScriptJs.data(), debuggerScriptJs.length())); +#endif } void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() @@ -470,8 +475,7 @@ void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() ScriptState* state = ScriptState::forContext( v8::Local<v8::Context>::New(m_utilityContext)); InspectorController* ic = inspectorController(); - ic->setFrontend(new InspectorFrontend( - ScriptObject(state, m_utilityContext->Global()))); + ic->connectFrontend(ScriptObject(state, m_utilityContext->Global())); } void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index b9143d9..2b8ae3c 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -42,12 +42,12 @@ using namespace WebCore; namespace { -// Note that this file is also included by HTMLTokenizer.cpp so we are getting +// Note that this file is also included by HTMLDocumentParser.cpp so we are getting // two copies of the data in memory. We can fix this by changing the script // that generated the array to create a static const that is its length, but // this is low priority since the data is less than 4K. We use anonymous // namespace to prevent name collisions. -#include "HTMLEntityNames.c" // NOLINT +#include "HTMLEntityNames.cpp" // NOLINT } namespace WebKit { diff --git a/WebKit/chromium/src/WebFormControlElement.cpp b/WebKit/chromium/src/WebFormControlElement.cpp index 007673e..a75fe5c 100644 --- a/WebKit/chromium/src/WebFormControlElement.cpp +++ b/WebKit/chromium/src/WebFormControlElement.cpp @@ -59,7 +59,7 @@ WebString WebFormControlElement::nameForAutofill() const String trimmedName = name.stripWhiteSpace(); if (!trimmedName.isEmpty()) return trimmedName; - name = constUnwrap<HTMLFormControlElement>()->getAttribute(HTMLNames::idAttr); + name = constUnwrap<HTMLFormControlElement>()->getIdAttribute(); trimmedName = name.stripWhiteSpace(); if (!trimmedName.isEmpty()) return trimmedName; diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index ea1c0b1..891e3b3 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -30,10 +30,12 @@ #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "IDBIndexProxy.h" +#include "IDBObjectStoreProxy.h" #include "WebIDBCallbacks.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndex.h" +#include "WebIDBObjectStore.h" #include "WebSerializedScriptValue.h" #if ENABLE(INDEXED_DATABASE) @@ -73,6 +75,12 @@ void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) m_callbacks.clear(); } +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance) +{ + m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance)); + m_callbacks.clear(); +} + void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) { m_callbacks->onSuccess(serializedScriptValue); diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h index 8e5ada7..519f692 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -45,6 +45,7 @@ public: virtual void onSuccess(); // For "null". virtual void onSuccess(WebKit::WebIDBDatabase*); virtual void onSuccess(WebKit::WebIDBIndex*); + virtual void onSuccess(WebKit::WebIDBObjectStore*); virtual void onSuccess(const WebKit::WebSerializedScriptValue&); private: diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 3a00ccb..e2f771a 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -27,7 +27,10 @@ #include "WebIDBDatabaseImpl.h" #include "DOMStringList.h" +#include "IDBCallbacksProxy.h" #include "IDBDatabase.h" +#include "WebIDBCallbacks.h" +#include "WebIDBObjectStoreImpl.h" #if ENABLE(INDEXED_DATABASE) @@ -35,8 +38,8 @@ using namespace WebCore; namespace WebKit { -WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> idbDatabase) - : m_idbDatabase(idbDatabase) +WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> database) + : m_database(database) { } @@ -44,24 +47,42 @@ WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { } -WebString WebIDBDatabaseImpl::name() +WebString WebIDBDatabaseImpl::name() const { - return m_idbDatabase->name(); + return m_database->name(); } -WebString WebIDBDatabaseImpl::description() +WebString WebIDBDatabaseImpl::description() const { - return m_idbDatabase->description(); + return m_database->description(); } -WebString WebIDBDatabaseImpl::version() +WebString WebIDBDatabaseImpl::version() const { - return m_idbDatabase->version(); + return m_database->version(); } -WebDOMStringList WebIDBDatabaseImpl::objectStores() +WebDOMStringList WebIDBDatabaseImpl::objectStores() const { - return m_idbDatabase->objectStores(); + return m_database->objectStores(); +} + +void WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks) +{ + m_database->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode) +{ + RefPtr<IDBObjectStore> objectStore = m_database->objectStore(name, mode); + if (!objectStore) + return 0; + return new WebIDBObjectStoreImpl(objectStore); +} + +void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_database->removeObjectStore(name, IDBCallbacksProxy::create(callbacks)); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h index f99a759..c83d8d7 100644 --- a/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -35,19 +35,25 @@ namespace WebCore { class IDBDatabase; } namespace WebKit { +class WebIDBObjectStore; + // See comment in WebIndexedDatabase for a high level overview these classes. class WebIDBDatabaseImpl : public WebIDBDatabase { public: - WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> idbDatabase); + WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> database); virtual ~WebIDBDatabaseImpl(); - virtual WebString name(); - virtual WebString description(); - virtual WebString version(); - virtual WebDOMStringList objectStores(); + virtual WebString name() const; + virtual WebString description() const; + virtual WebString version() const; + virtual WebDOMStringList objectStores() const; + + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks); + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode); + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks); private: - WTF::RefPtr<WebCore::IDBDatabase> m_idbDatabase; + WTF::RefPtr<WebCore::IDBDatabase> m_database; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp new file mode 100755 index 0000000..a41010a --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebIDBObjectStoreImpl.h" + +#include "DOMStringList.h" +#include "IDBCallbacksProxy.h" +#include "IDBObjectStore.h" +#include "WebIDBIndexImpl.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBObjectStoreImpl::WebIDBObjectStoreImpl(PassRefPtr<IDBObjectStore> objectStore) + : m_objectStore(objectStore) +{ +} + +WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl() +{ +} + +WebString WebIDBObjectStoreImpl::name() const +{ + return m_objectStore->name(); +} + +WebString WebIDBObjectStoreImpl::keyPath() const +{ + return m_objectStore->keyPath(); +} + +WebDOMStringList WebIDBObjectStoreImpl::indexNames() const +{ + return m_objectStore->indexNames(); +} + +void WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks) +{ + m_objectStore->createIndex(name, keyPath, unique, IDBCallbacksProxy::create(callbacks)); +} + +WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name) +{ + RefPtr<IDBIndex> index = m_objectStore->index(name); + if (!index) + return 0; + return new WebIDBIndexImpl(index); +} + +void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks* callbacks) +{ + m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks)); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h new file mode 100755 index 0000000..f59840f --- /dev/null +++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBObjectStoreImpl_h +#define WebIDBObjectStoreImpl_h + +#include "WebCommon.h" +#include "WebIDBObjectStore.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBObjectStore; } + +namespace WebKit { + +class WebIDBIndex; + +// See comment in WebIndexedObjectStore for a high level overview these classes. +class WebIDBObjectStoreImpl : public WebIDBObjectStore { +public: + WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStore> objectStore); + virtual ~WebIDBObjectStoreImpl(); + + virtual WebString name() const; + virtual WebString keyPath() const; + virtual WebDOMStringList indexNames() const; + + virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks); + virtual WebIDBIndex* index(const WebString& name); + virtual void removeIndex(const WebString& name, WebIDBCallbacks* callbacks); + + private: + WTF::RefPtr<WebCore::IDBObjectStore> m_objectStore; +}; + +} // namespace WebKit + +#endif // WebIDBObjectStoreImpl_h diff --git a/WebKit/chromium/src/WebImageCG.cpp b/WebKit/chromium/src/WebImageCG.cpp index 60b2449..045c8be 100644 --- a/WebKit/chromium/src/WebImageCG.cpp +++ b/WebKit/chromium/src/WebImageCG.cpp @@ -89,14 +89,16 @@ WebSize WebImage::size() const WebImage::WebImage(const PassRefPtr<Image>& image) : m_imageRef(0) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); } WebImage& WebImage::operator=(const PassRefPtr<Image>& image) { - if (image.get()) - assign(image->nativeImageForCurrentFrame()); + NativeImagePtr p; + if (image.get() && (p = image->nativeImageForCurrentFrame())) + assign(p); else reset(); return *this; diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp index 00122ad..27a6247 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp @@ -57,9 +57,9 @@ WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl() { } -void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, int& exceptionCode) +void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) { - m_indexedDatabase->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0, exceptionCode); + m_indexedDatabase->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIndexedDatabaseImpl.h index 072a92b..76781e5 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.h @@ -41,7 +41,7 @@ public: WebIndexedDatabaseImpl(); virtual ~WebIndexedDatabaseImpl(); - virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, int& exceptionCode); + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*); private: WTF::RefPtr<WebCore::IndexedDatabase> m_indexedDatabase; diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 68bb91e..18bafd6 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -85,6 +85,21 @@ WebString WebInputElement::value() const return constUnwrap<HTMLInputElement>()->value(); } +void WebInputElement::setPlaceholder(const WebString& value) +{ + unwrap<HTMLInputElement>()->setPlaceholder(value); +} + +WebString WebInputElement::placeholder() const +{ + return constUnwrap<HTMLInputElement>()->placeholder(); +} + +bool WebInputElement::isAutofilled() const +{ + return constUnwrap<HTMLInputElement>()->isAutofilled(); +} + void WebInputElement::setAutofilled(bool autoFilled) { unwrap<HTMLInputElement>()->setAutofilled(autoFilled); diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index 5807a79..d099048 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -60,6 +60,7 @@ #include "KeyboardEvent.h" #include "MouseEvent.h" #include "Page.h" +#include "RenderBox.h" #include "ScrollView.h" #include "WheelEvent.h" diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp index 601a497..14ece13 100644 --- a/WebKit/chromium/src/WebSearchableFormData.cpp +++ b/WebKit/chromium/src/WebSearchableFormData.cpp @@ -187,8 +187,8 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt if (!formElement->appendFormData(dataList, false)) continue; - const Vector<FormDataList::Item>& itemList = dataList.list(); - if (isTextElement && !itemList.isEmpty()) { + const BlobItemList& items = dataList.items(); + if (isTextElement && !items.isEmpty()) { if (textElement) { // The auto-complete bar only knows how to fill in one value. // This form has multiple fields; don't treat it as searchable. @@ -196,20 +196,22 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt } textElement = static_cast<HTMLInputElement*>(formElement); } - for (Vector<FormDataList::Item>::const_iterator j(itemList.begin()); j != itemList.end(); ++j) { + for (BlobItemList::const_iterator j(items.begin()); j != items.end(); ++j) { + const StringBlobItem* item = (*j)->toStringBlobItem(); + ASSERT(item); // Handle ISINDEX / <input name=isindex> specially, but only if it's // the first entry. - if (!encodedString->isEmpty() || j->data() != "isindex") { + if (!encodedString->isEmpty() || item->cstr() != "isindex") { if (!encodedString->isEmpty()) encodedString->append('&'); - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); encodedString->append('='); } ++j; if (formElement == textElement) encodedString->append("{searchTerms}", 13); else - FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); + FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr()); } } diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 946782b..7e89a77 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -271,7 +271,7 @@ void WebSettingsImpl::setShowDebugBorders(bool show) void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) { - m_settings->setEditingBehavior(static_cast<WebCore::EditingBehavior>(behavior)); + m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior)); } void WebSettingsImpl::setAcceleratedCompositingEnabled(bool enabled) diff --git a/WebKit/chromium/src/WebURLResponse.cpp b/WebKit/chromium/src/WebURLResponse.cpp index 1aba54e..d5ba707 100644 --- a/WebKit/chromium/src/WebURLResponse.cpp +++ b/WebKit/chromium/src/WebURLResponse.cpp @@ -287,6 +287,16 @@ void WebURLResponse::setWasNpnNegotiated(bool value) m_private->m_resourceResponse->setWasNpnNegotiated(value); } +bool WebURLResponse::wasFetchedViaProxy() const +{ + return m_private->m_resourceResponse->wasFetchedViaProxy(); +} + +void WebURLResponse::setWasFetchedViaProxy(bool value) +{ + m_private->m_resourceResponse->setWasFetchedViaProxy(value); +} + bool WebURLResponse::isMultipartPayload() const { return m_private->m_resourceResponse->isMultipartPayload(); diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index a38995e..5adc35c 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -681,7 +681,7 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) Node* focusedNode = focusedFrame->document()->focusedNode(); Position start = mainFrameImpl->selection()->selection().start(); - if (focusedFrame->editor() && focusedFrame->editor()->canEdit() && start.node()) { + if (start.node()) { RenderObject* renderer = start.node()->renderer(); if (!renderer) return false; @@ -827,6 +827,45 @@ bool WebViewImpl::mapKeyCodeForScroll(int keyCode, return true; } +// Computes the distance from a point outside a rect to the nearest edge of the rect. +static IntSize distanceToRect(const IntPoint& point, const IntRect& rect) +{ + int dx = 0, dy = 0; + if (point.x() < rect.x()) + dx = point.x() - rect.x(); + else if (rect.right() < point.x()) + dx = point.x() - rect.right(); + if (point.y() < rect.y()) + dy = point.y() - rect.y(); + else if (rect.bottom() < point.y()) + dy = point.y() - rect.bottom(); + return IntSize(dx, dy); +} + +void WebViewImpl::scrollForDragging(const WebPoint& clientPoint) +{ + // This margin approximates Safari behavior, derived from an observation. + static const int scrollMargin = 30; + + FrameView* view = mainFrameImpl()->frameView(); + if (!view) + return; + + IntRect bounds(0, 0, view->visibleWidth(), view->visibleHeight()); + bounds.setY(bounds.y() + scrollMargin); + bounds.setHeight(bounds.height() - scrollMargin * 2); + bounds.setX(bounds.x() + scrollMargin); + bounds.setWidth(bounds.width() - scrollMargin * 2); + + IntPoint point = clientPoint; + if (bounds.contains(point)) + return; + + IntSize toScroll = distanceToRect(point, bounds); + if (!toScroll.isZero()) + view->scrollBy(toScroll); +} + void WebViewImpl::hideSelectPopup() { if (m_selectPopup.get()) @@ -1539,6 +1578,14 @@ void WebViewImpl::dragSourceEndedAt( static_cast<DragOperation>(operation)); } +void WebViewImpl::dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation) +{ + scrollForDragging(clientPoint); +} + void WebViewImpl::dragSourceSystemDragEnded() { // It's possible for us to get this callback while not doing a drag if @@ -1659,6 +1706,9 @@ WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo } else m_dragOperation = static_cast<WebDragOperation>(effect); + if (dragAction == DragOver) + scrollForDragging(clientPoint); + return m_dragOperation; } @@ -1736,10 +1786,10 @@ void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) + int separatorIndex) { ASSERT(names.size() == labels.size()); - ASSERT(defaultSuggestionIndex < static_cast<int>(names.size())); + ASSERT(separatorIndex < static_cast<int>(names.size())); if (names.isEmpty()) { hideSuggestionsPopup(); @@ -1764,7 +1814,7 @@ void WebViewImpl::applyAutoFillSuggestions( m_autoFillPopupClient.set(new AutoFillPopupMenuClient); m_autoFillPopupClient->initialize(inputElem, names, labels, - defaultSuggestionIndex); + separatorIndex); if (m_suggestionsPopupClient != m_autoFillPopupClient.get()) { hideSuggestionsPopup(); @@ -1781,7 +1831,7 @@ void WebViewImpl::applyAutoFillSuggestions( m_suggestionsPopup = m_autoFillPopup.get(); if (m_suggestionsPopupShowing) { - m_autoFillPopupClient->setSuggestions(names, labels); + m_autoFillPopupClient->setSuggestions(names, labels, separatorIndex); refreshSuggestionsPopup(); } else { m_suggestionsPopup->show(focusedNode->getRect(), diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index b2fc680..8b15f8a 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -132,6 +132,10 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation); + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation); virtual void dragSourceSystemDragEnded(); virtual WebDragOperation dragTargetDragEnter( const WebDragData& dragData, int identity, @@ -162,7 +166,7 @@ public: const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + int separatorIndex); virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, @@ -347,6 +351,8 @@ private: // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); + void scrollForDragging(const WebPoint&); + void hideSelectPopup(); // Converts |pos| from window coordinates to contents coordinates and gets diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index f4db5ee..dc46b07 100644 --- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -151,6 +151,60 @@ static int gdkEventToWindowsKeyCode(const GdkEventKey* event) GDK_period, // 0x3C: GDK_period GDK_slash, // 0x3D: GDK_slash 0, // 0x3E: GDK_Shift_R + 0, // 0x3F: + 0, // 0x40: + 0, // 0x41: + 0, // 0x42: + 0, // 0x43: + 0, // 0x44: + 0, // 0x45: + 0, // 0x46: + 0, // 0x47: + 0, // 0x48: + 0, // 0x49: + 0, // 0x4A: + 0, // 0x4B: + 0, // 0x4C: + 0, // 0x4D: + 0, // 0x4E: + 0, // 0x4F: + 0, // 0x50: + 0, // 0x51: + 0, // 0x52: + 0, // 0x53: + 0, // 0x54: + 0, // 0x55: + 0, // 0x56: + 0, // 0x57: + 0, // 0x58: + 0, // 0x59: + 0, // 0x5A: + 0, // 0x5B: + 0, // 0x5C: + 0, // 0x5D: + 0, // 0x5E: + 0, // 0x5F: + 0, // 0x60: + 0, // 0x61: + 0, // 0x62: + 0, // 0x63: + 0, // 0x64: + 0, // 0x65: + 0, // 0x66: + 0, // 0x67: + 0, // 0x68: + 0, // 0x69: + 0, // 0x6A: + 0, // 0x6B: + 0, // 0x6C: + 0, // 0x6D: + 0, // 0x6E: + 0, // 0x6F: + 0, // 0x70: + 0, // 0x71: + 0, // 0x72: + GDK_Super_L, // 0x73: GDK_Super_L + GDK_Super_R, // 0x74: GDK_Super_R }; // |windowsKeyCode| has to include a valid virtual-key code even when we diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index 67e54aa..8d2457f 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -181,7 +181,7 @@ devtools.DebuggerAgent.prototype.initUI = function() // pending addition into the UI. for (var scriptId in this.parsedScripts_) { var script = this.parsedScripts_[scriptId]; - WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1); + WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1, script.worldType()); this.restoreBreakpoints_(scriptId, script.getUrl()); } return; @@ -307,7 +307,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, enable /** - * Changes given line of the script. + * Changes given line of the script. */ devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newContent, callback) { @@ -319,12 +319,31 @@ devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newConten var cmd = new devtools.DebugCommand("changelive", commandArguments); devtools.DebuggerAgent.sendCommand_(cmd); this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { - if (!msg.isSuccess()) - WebInspector.log("Unable to modify source code within given scope. Only function bodies are editable at the moment.", WebInspector.ConsoleMessage.MessageLevel.Warning); - this.resolveScriptSource(sourceId, callback); - if (WebInspector.panels.scripts.paused) - this.requestBacktrace_(); + if (!msg.isSuccess()) { + callback(false, "Unable to modify source code within given scope. Only function bodies are editable at the moment.", null); + return; + } + + this.resolveScriptSource(sourceId, requestBacktrace.bind(this)); }.bind(this); + + + function requestBacktrace(newScriptSource) { + if (WebInspector.panels.scripts.paused) + this.requestBacktrace_(handleBacktraceResponse.bind(this, newScriptSource)); + else + reportDidCommitEditing(newScriptSource); + } + + function handleBacktraceResponse(newScriptSource, msg) { + this.updateCallFramesFromBacktraceResponse_(msg); + reportDidCommitEditing(newScriptSource, this.callFrames_); + } + + function reportDidCommitEditing(newScriptSource, callFrames) { + callback(true, newScriptSource, callFrames); + } + RemoteDebuggerAgent.processDebugCommands(); }; @@ -679,12 +698,14 @@ devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId /** * Sends "backtrace" request to v8. */ -devtools.DebuggerAgent.prototype.requestBacktrace_ = function() +devtools.DebuggerAgent.prototype.requestBacktrace_ = function(opt_customHandler) { var cmd = new devtools.DebugCommand("backtrace", { "compactFormat":true }); devtools.DebuggerAgent.sendCommand_(cmd); + var responseHandler = opt_customHandler ? opt_customHandler : this.handleBacktraceResponse_.bind(this); + this.requestSeqToCallback_[cmd.getSequenceNumber()] = responseHandler; }; @@ -800,7 +821,7 @@ devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) else if (msg.getCommand() === "clearbreakpoint") this.handleClearBreakpointResponse_(msg); else if (msg.getCommand() === "backtrace") - this.handleBacktraceResponse_(msg); + this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "lookup") this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "evaluate") @@ -948,17 +969,17 @@ devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { var context = msg.lookup(script.context.ref); - var contextType; // Find the type from context data. The context data has the format // "type,id". var comma = context.data.indexOf(","); if (comma < 0) - return - contextType = context.data.substring(0, comma); - this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType); + return; + var contextType = context.data.substring(0, comma); + var info = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType); + this.parsedScripts_[script.id] = info; if (this.scriptsPanelInitialized_) { // Only report script as parsed after scripts panel has been shown. - WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1); + WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1, info.worldType()); this.restoreBreakpoints_(script.id, script.name); } }; @@ -991,13 +1012,20 @@ devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) */ devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg) { + this.updateCallFramesFromBacktraceResponse_(msg); + WebInspector.pausedScript(this.callFrames_); + this.showPendingExceptionMessage_(); + InspectorFrontendHost.bringToFront(); +}; + + +devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_ = function(msg) +{ var frames = msg.getBody().frames; this.callFrames_ = []; for (var i = 0; i < frames.length; ++i) this.callFrames_.push(this.formatCallFrame_(frames[i])); - WebInspector.pausedScript(this.callFrames_); - this.showPendingExceptionMessage_(); - InspectorFrontendHost.bringToFront(); + return this.callFrames_; }; @@ -1044,7 +1072,7 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) var existingScript = this.parsedScripts_[sourceId]; if (!existingScript) { this.parsedScripts_[sourceId] = new devtools.ScriptInfo(sourceId, null /* name */, 0 /* line */, "unknown" /* type */, true /* unresolved */); - WebInspector.parsedScriptSource(sourceId, null, null, 0); + WebInspector.parsedScriptSource(sourceId, null, null, 0, WebInspector.Script.WorldType.MAIN_WORLD); } var funcName = func.name || func.inferredName || "(anonymous function)"; @@ -1257,6 +1285,14 @@ devtools.ScriptInfo.prototype.isUnresolved = function() }; +devtools.ScriptInfo.prototype.worldType = function() +{ + if (this.contextType_ === "injected") + return WebInspector.Script.WorldType.EXTENSIONS_WORLD; + return WebInspector.Script.WorldType.MAIN_WORLD; +}; + + /** * @param {number} line 0-based line number in the script. * @return {?devtools.BreakpointInfo} Information on a breakpoint at the diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index 7e5b430..3ff3eb7 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function debuggerScriptConstructor() { +(function () { var DebuggerScript = {}; DebuggerScript._breakpoints = {}; @@ -39,6 +39,11 @@ DebuggerScript.PauseOnExceptionsState = { PauseOnUncaughtExceptions: 2 }; +DebuggerScript.ScriptWorldType = { + MainWorld : 0, + ExtensionsWorld : 1 +}; + DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions; Debug.clearBreakOnException(); Debug.clearBreakOnUncaughtException(); @@ -50,11 +55,21 @@ DebuggerScript.getAfterCompileScript = function(eventData) DebuggerScript.getScripts = function(contextData) { - var scripts = Debug.scripts(); var result = []; + + if (!contextData) + return result; + var comma = contextData.indexOf(","); + if (comma === -1) + return result; + // Context data is a string in the following format: + // ("page"|"injected")","<page id> + var idSuffix = contextData.substring(comma); // including the comma + + var scripts = Debug.scripts(); for (var i = 0; i < scripts.length; ++i) { var script = scripts[i]; - if (contextData === script.context_data) + if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1) result.push(DebuggerScript._formatScript(script)); } return result; @@ -62,13 +77,16 @@ DebuggerScript.getScripts = function(contextData) DebuggerScript._formatScript = function(script) { + var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld; + if (script.context_data && script.context_data.indexOf("injected") == 0) + scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld; return { id: script.id, name: script.name, source: script.source, lineOffset: script.line_offset, lineCount: script.lineCount(), - contextData: script.context_data + scriptWorldType: scriptWorldType }; } @@ -152,6 +170,24 @@ DebuggerScript.stepOutOfFunction = function(execState) execState.prepareStep(Debug.StepAction.StepOut, 1); } +DebuggerScript.editScriptSource = function(scriptId, newSource) +{ + var scripts = Debug.scripts(); + var scriptToEdit = null; + for (var i = 0; i < scripts.length; i++) { + if (scripts[i].id == scriptId) { + scriptToEdit = scripts[i]; + break; + } + } + if (!scriptToEdit) + throw("Script not found"); + + var changeLog = []; + Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, changeLog); + return scriptToEdit.source; +} + DebuggerScript.clearBreakpoints = function(execState, args) { for (var key in DebuggerScript._breakpoints) { @@ -239,4 +275,4 @@ DebuggerScript._v8ToWebkitLineNumber = function(line) return DebuggerScript; -} +})(); diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 6e9c090..398d358 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -183,8 +183,8 @@ WebInspector.loaded = function() Preferences.heapProfilerPresent = true; Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; - RemoteDebuggerAgent.setDebuggerScriptSource("(" + debuggerScriptConstructor + ")();"); - + Preferences.canEditScriptSource = true; + oldLoaded.call(this); InspectorFrontendHost.loaded(); @@ -210,42 +210,6 @@ document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); if (!window.v8ScriptDebugServerEnabled) { -/** - * This override is necessary for adding script source asynchronously. - * @override - */ -WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function() -{ - if (!this._frameNeedsSetup) - return; - - this.attach(); - - if (this.script.source) - this.didResolveScriptSource_(); - else { - var self = this; - devtools.tools.getDebuggerAgent().resolveScriptSource( - this.script.sourceID, - function(source) { - self.script.source = source || WebInspector.UIString("<source is not available>"); - self.didResolveScriptSource_(); - }); - } -}; - - -/** - * Performs source frame setup when script source is aready resolved. - */ -WebInspector.ScriptView.prototype.didResolveScriptSource_ = function() -{ - this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source)); - this._sourceFrameSetup = true; - delete this._frameNeedsSetup; -}; - - (function() { var oldShow = WebInspector.ScriptsPanel.prototype.show; @@ -296,6 +260,21 @@ InjectedScriptAccess.prototype.getCompletions = function(expressionString, inclu }; })(); +// Highlight extension content scripts in the scripts list. +(function () { + var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu; + WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script) + { + var result = original.apply(this, arguments); + var debuggerAgent = devtools.tools.getDebuggerAgent(); + var type = debuggerAgent.getScriptContextType(script.sourceID); + var option = script.filesSelectOption; + if (type === "injected" && option) + option.addStyleClass("injected"); + return result; + }; +})(); + } @@ -349,22 +328,6 @@ WebInspector.UIString = function(string) })(); -// Highlight extension content scripts in the scripts list. -(function () { - var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu; - WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script) - { - var result = original.apply(this, arguments); - var debuggerAgent = devtools.tools.getDebuggerAgent(); - var type = debuggerAgent.getScriptContextType(script.sourceID); - var option = script.filesSelectOption; - if (type === "injected" && option) - option.addStyleClass("injected"); - return result; - }; -})(); - - /** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */ (function() { diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index cae4a1e..da5929a 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -55,10 +55,6 @@ RemoteDebuggerAgentStub.prototype.processDebugCommands = function() }; -RemoteDebuggerAgentStub.prototype.setDebuggerScriptSource = function(source) -{ -}; - /** * @constructor diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js index 86f885a..327ca8f 100644 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ b/WebKit/chromium/src/js/InspectorControllerImpl.js @@ -61,13 +61,16 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("getResourceContent"); this.installInspectorControllerDelegate_("highlightDOMNode"); this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); + this.installInspectorControllerDelegate_("performSearch"); this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); this.installInspectorControllerDelegate_("reloadPage"); this.installInspectorControllerDelegate_("removeAttribute"); this.installInspectorControllerDelegate_("removeDOMStorageItem"); this.installInspectorControllerDelegate_("removeNode"); - this.installInspectorControllerDelegate_("saveFrontendSettings"); + this.installInspectorControllerDelegate_("saveApplicationSettings"); + this.installInspectorControllerDelegate_("saveSessionSettings"); + this.installInspectorControllerDelegate_("searchCanceled"); this.installInspectorControllerDelegate_("setAttribute"); this.installInspectorControllerDelegate_("setDOMStorageItem"); this.installInspectorControllerDelegate_("setInjectedScriptSource"); @@ -93,6 +96,8 @@ devtools.InspectorBackendImpl = function() if (window.v8ScriptDebugServerEnabled) { this.installInspectorControllerDelegate_("disableDebugger"); + this.installInspectorControllerDelegate_("editScriptSource"); + this.installInspectorControllerDelegate_("getScriptSource"); this.installInspectorControllerDelegate_("enableDebugger"); this.installInspectorControllerDelegate_("setBreakpoint"); this.installInspectorControllerDelegate_("removeBreakpoint"); @@ -143,12 +148,22 @@ devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, li devtools.InspectorBackendImpl.prototype.editScriptSource = function(callID, sourceID, newContent) { - devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(newFullBody) { - WebInspector.didEditScriptSource(callID, newFullBody); + devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(success, newBodyOrErrorMessage, callFrames) { + WebInspector.didEditScriptSource(callID, success, newBodyOrErrorMessage, callFrames); }); }; +devtools.InspectorBackendImpl.prototype.getScriptSource = function(callID, sourceID) +{ + devtools.tools.getDebuggerAgent().resolveScriptSource( + sourceID, + function(source) { + WebInspector.didGetScriptSource(callID, source); + }); +}; + + devtools.InspectorBackendImpl.prototype.activateBreakpoints = function() { devtools.tools.getDebuggerAgent().setBreakpointsActivated(true); diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 758b8c0..fa910ab 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1279,8 +1279,8 @@ TestSuite.prototype.testStepIn = function() }, { functionsOnStack: ["fact","d","a","(anonymous function)"], - lineNumber: 15, - lineText: " return r;" + lineNumber: 10, + lineText: " var r = 1;" }, function() { test.releaseControl(); diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index 2cb4ab3..0e6d284 100755 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css @@ -1,7 +1,3 @@ -#scripts-files option.injected { - color: rgb(70, 134, 240); -} - .data-grid table { line-height: 120%; } |