diff options
Diffstat (limited to 'WebKit/chromium/src')
49 files changed, 1056 insertions, 808 deletions
diff --git a/WebKit/chromium/src/ApplicationCacheHostInternal.h b/WebKit/chromium/src/ApplicationCacheHostInternal.h index bf6c4ae..edaaca9 100644 --- a/WebKit/chromium/src/ApplicationCacheHostInternal.h +++ b/WebKit/chromium/src/ApplicationCacheHostInternal.h @@ -39,6 +39,7 @@ #include "WebFrameImpl.h" #include "WebKit.h" #include "WebKitClient.h" +#include "WebURL.h" namespace WebCore { @@ -57,6 +58,17 @@ public: m_innerHost->notifyDOMApplicationCache(static_cast<ApplicationCacheHost::EventID>(eventID)); } + virtual void notifyProgressEventListener(const WebKit::WebURL&, int num_total, int num_complete) + { + // FIXME: Modify webcore's progress event handling to carry the extra info and alter the + // layout tests to not fail when the more recently specified 'final' event is raised. + // For now, we're eating the extra info and that last event. + // See https://bugs.webkit.org/show_bug.cgi?id=37602 + if (num_complete == num_total) + return; + notifyEventListener(WebKit::WebApplicationCacheHost::ProgressEvent); + } + static WebKit::WebApplicationCacheHost* toWebApplicationCacheHost(ApplicationCacheHost* innerHost) { if (innerHost && innerHost->m_internal.get()) diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index fa7d73a..819339d 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -127,6 +127,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDefinitionListDefinition, Defin COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleAnnotation, AnnotationRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleSliderThumb, SliderThumbRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleIgnored, IgnoredRole); +COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRolePresentational, PresentationalRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTab, TabRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabList, TabListRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTabPanel, TabPanelRole); diff --git a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 8084aad..04c02f2 100644 --- a/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -56,7 +56,7 @@ WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const --listIndex; // FIXME: Modify the PopupMenu to add the label in gray right-justified. - ASSERT(listIndex >= 0 && listIndex < m_names.size()); + ASSERT(listIndex < m_names.size()); WebString suggestion = m_names[listIndex]; if (m_labels[listIndex].isEmpty()) @@ -68,7 +68,7 @@ WebString AutoFillPopupMenuClient::getSuggestion(unsigned listIndex) const void AutoFillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) { // FIXME: Do we want to remove AutoFill suggestions? - ASSERT(listIndex >= 0 && listIndex < m_names.size()); + ASSERT(listIndex < m_names.size()); m_names.remove(listIndex); m_labels.remove(listIndex); } @@ -82,7 +82,7 @@ void AutoFillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) --listIndex; - ASSERT(listIndex >= 0 && listIndex < m_names.size()); + ASSERT(listIndex < m_names.size()); webView->client()->didAcceptAutoFillSuggestion(WebNode(getTextField()), m_names[listIndex], @@ -99,7 +99,7 @@ void AutoFillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEven if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) --listIndex; - ASSERT(listIndex >= 0 && listIndex < m_names.size()); + ASSERT(listIndex < m_names.size()); webView->client()->didSelectAutoFillSuggestion(WebNode(getTextField()), m_names[listIndex], diff --git a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp index 9620ffc..ed4f670 100644 --- a/WebKit/chromium/src/AutocompletePopupMenuClient.cpp +++ b/WebKit/chromium/src/AutocompletePopupMenuClient.cpp @@ -46,13 +46,13 @@ unsigned AutocompletePopupMenuClient::getSuggestionsCount() const WebString AutocompletePopupMenuClient::getSuggestion(unsigned listIndex) const { - ASSERT(listIndex >= 0 && listIndex < m_suggestions.size()); + ASSERT(listIndex < m_suggestions.size()); return m_suggestions[listIndex]; } void AutocompletePopupMenuClient::removeSuggestionAtIndex(unsigned listIndex) { - ASSERT(listIndex >= 0 && listIndex < m_suggestions.size()); + ASSERT(listIndex < m_suggestions.size()); m_suggestions.remove(listIndex); } diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 559a62b..54c81aa 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -231,7 +231,7 @@ Page* ChromeClientImpl::createWindow( return 0; WebViewImpl* newView = static_cast<WebViewImpl*>( - m_webView->client()->createView(WebFrameImpl::fromFrame(frame), features)); + m_webView->client()->createView(WebFrameImpl::fromFrame(frame), features, r.frameName())); if (!newView) return 0; diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 3b8e5fa..4963f78 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -49,6 +49,7 @@ #include "WebMimeRegistry.h" #include "WebPluginContainerImpl.h" #include "WebPluginListBuilderImpl.h" +#include "WebSandboxSupport.h" #include "WebScreenInfo.h" #include "WebString.h" #include "WebURL.h" @@ -59,12 +60,10 @@ #if OS(WINDOWS) #include "WebRect.h" -#include "WebSandboxSupport.h" #include "WebThemeEngine.h" #endif #if OS(LINUX) -#include "WebSandboxSupport.h" #include "WebFontInfo.h" #include "WebFontRenderStyle.h" #endif @@ -404,6 +403,22 @@ void ChromiumBridge::getRenderStyleForStrike(const char* font, int sizeAndStyle, } #endif +#if OS(DARWIN) +bool ChromiumBridge::loadFont(NSFont* srcFont, ATSFontContainerRef* out) +{ + WebSandboxSupport* ss = webKitClient()->sandboxSupport(); + if (ss) + return ss->loadFont(srcFont, out); + + // This function should only be called in response to an error loading a + // font due to being blocked by the sandbox. + // This by definition shouldn't happen if there is no sandbox support. + ASSERT_NOT_REACHED(); + *out = 0; + return false; +} +#endif + // Geolocation ---------------------------------------------------------------- GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(GeolocationServiceChromium* geolocationServiceChromium) diff --git a/WebKit/chromium/src/CompositionUnderlineBuilder.h b/WebKit/chromium/src/CompositionUnderlineBuilder.h new file mode 100644 index 0000000..ce62474 --- /dev/null +++ b/WebKit/chromium/src/CompositionUnderlineBuilder.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CompositionUnderlineBuilder_h +#define CompositionUnderlineBuilder_h + +#include "Editor.h" +#include "Vector.h" +#include "WebCompositionUnderline.h" +#include "WebVector.h" + +namespace WebKit { + +// This class is used for converting from WebCompositionUnderline to +// WebCore::CompositionUnderline. + +class CompositionUnderlineBuilder : public WebCore::CompositionUnderline { +public: + CompositionUnderlineBuilder(const WebCompositionUnderline& u) + : WebCore::CompositionUnderline(u.startOffset, u.endOffset, + WebCore::Color(u.color), u.thick) { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/CompositionUnderlineVectorBuilder.cpp b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.cpp new file mode 100644 index 0000000..55dca85 --- /dev/null +++ b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CompositionUnderlineVectorBuilder.h" + +#include "CompositionUnderlineBuilder.h" + +using namespace WebCore; + +namespace WebKit { + +CompositionUnderlineVectorBuilder::CompositionUnderlineVectorBuilder( + const WebVector<WebCompositionUnderline>& underlines) +{ + size_t size = underlines.size(); + reserveCapacity(size); + for (size_t i = 0; i < size; ++i) + append(CompositionUnderlineBuilder(underlines[i])); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h new file mode 100644 index 0000000..8050f02 --- /dev/null +++ b/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CompositionUnderlineVectorBuilder_h +#define CompositionUnderlineVectorBuilder_h + +#include "Editor.h" +#include "Vector.h" +#include "WebCompositionUnderline.h" +#include "WebVector.h" + +namespace WebKit { + +// This classes are used for converting from std::vector<WebCompositionUnderline> +// to Vector<WebCore::CompositionUnderline>. + +class CompositionUnderlineVectorBuilder : + public Vector<WebCore::CompositionUnderline> { +public: + CompositionUnderlineVectorBuilder( + const WebVector<WebCompositionUnderline>&); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/DatabaseObserver.cpp b/WebKit/chromium/src/DatabaseObserver.cpp index be658fe..e1b7cbe 100644 --- a/WebKit/chromium/src/DatabaseObserver.cpp +++ b/WebKit/chromium/src/DatabaseObserver.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "DatabaseObserver.h" -#include "Database.h" +#include "AbstractDatabase.h" #include "Document.h" #include "ScriptExecutionContext.h" #include "WebDatabase.h" @@ -65,19 +65,19 @@ bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecut return true; } -void DatabaseObserver::databaseOpened(Database* database) +void DatabaseObserver::databaseOpened(AbstractDatabase* database) { ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseOpened(WebDatabase(database)); } -void DatabaseObserver::databaseModified(Database* database) +void DatabaseObserver::databaseModified(AbstractDatabase* database) { ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseModified(WebDatabase(database)); } -void DatabaseObserver::databaseClosed(Database* database) +void DatabaseObserver::databaseClosed(AbstractDatabase* database) { ASSERT(database->scriptExecutionContext()->isContextThread()); WebDatabase::observer()->databaseClosed(WebDatabase(database)); diff --git a/WebKit/chromium/src/DebuggerAgentManager.cpp b/WebKit/chromium/src/DebuggerAgentManager.cpp index a30675d..939f4ed 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -265,9 +265,9 @@ void DebuggerAgentManager::setMessageLoopDispatchHandler(WebDevToolsAgent::Messa void DebuggerAgentManager::setExposeV8DebuggerProtocol(bool value) { s_exposeV8DebuggerProtocol = value; + WebCore::ScriptDebugServer::shared().setEnabled(!s_exposeV8DebuggerProtocol); } - void DebuggerAgentManager::setHostId(WebFrameImpl* webframe, int hostId) { ASSERT(hostId > 0); diff --git a/WebKit/chromium/src/DragScrollTimer.cpp b/WebKit/chromium/src/DragScrollTimer.cpp new file mode 100644 index 0000000..83b81b7 --- /dev/null +++ b/WebKit/chromium/src/DragScrollTimer.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DragScrollTimer.h" + +#include "FrameView.h" + +using namespace WebCore; + +namespace WebKit { + +// 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); +} + +DragScrollTimer::DragScrollTimer() + : m_timer(this, &DragScrollTimer::fired) + , m_view(0) + , m_scrolling(false) +{ +} + +DragScrollTimer::~DragScrollTimer() +{ + // We do this for detecting dead object earlier + stop(); +} + +void DragScrollTimer::stop() +{ + m_timer.stop(); + m_view = 0; + m_scrolling = false; +} + +void DragScrollTimer::scroll() +{ + m_view->scrollBy(m_lastDistance); + m_scrolling = true; +} + +void DragScrollTimer::update() +{ + if (shouldScroll()) + scroll(); + else + stop(); +} + +void DragScrollTimer::triggerScroll(FrameView* view, const WebPoint& location) +{ + if (!view) + return; + + // Approximates Safari + static const double scrollStartDelay = 0.2; + + m_view = view; + m_lastDistance = scrollDistanceFor(view, location); + + if (m_scrolling) + update(); + else if (shouldScroll() && !m_timer.isActive()) + m_timer.startOneShot(scrollStartDelay); +} + +IntSize DragScrollTimer::scrollDistanceFor(FrameView* view, const WebPoint& location) const +{ + static const int scrollMargin = 30; + + IntRect bounds(0, 0, view->visibleWidth(), view->visibleHeight()); + if (!bounds.contains(location)) + return IntSize(0, 0); // The location is outside the border belt. + + bounds.setY(bounds.y() + scrollMargin); + bounds.setHeight(bounds.height() - scrollMargin * 2); + bounds.setX(bounds.x() + scrollMargin); + bounds.setWidth(bounds.width() - scrollMargin * 2); + + if (bounds.contains(location)) + return IntSize(0, 0); // The location is inside the border belt. + + // The location is over the border belt. + return distanceToRect(location, bounds); +} + +} // namespace WebKit diff --git a/WebKit/chromium/src/DragScrollTimer.h b/WebKit/chromium/src/DragScrollTimer.h new file mode 100644 index 0000000..a4090e0 --- /dev/null +++ b/WebKit/chromium/src/DragScrollTimer.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DragScrollTimer_h +#define DragScrollTimer_h + +#include "IntSize.h" +#include "Timer.h" +#include "WebPoint.h" + +namespace WebCore { class FrameView; } + +namespace WebKit { + +// +// Encapsulating a timer and associated state management for +// scroll-on-drag behaviour. +// +class DragScrollTimer { +public: + DragScrollTimer(); + ~DragScrollTimer(); + + void fired(WebCore::Timer<DragScrollTimer>*) { update(); } + void triggerScroll(WebCore::FrameView*, const WebPoint&); + void stop(); + +private: + void scroll(); + void update(); + WebCore::IntSize scrollDistanceFor(WebCore::FrameView*, const WebPoint&) const; + bool shouldScroll() const { return !m_lastDistance.isZero(); } + + WebCore::Timer<DragScrollTimer> m_timer; + WebCore::FrameView* m_view; + WebCore::IntSize m_lastDistance; + bool m_scrolling; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp index 4eda1f6..2a40d78 100644 --- a/WebKit/chromium/src/EditorClientImpl.cpp +++ b/WebKit/chromium/src/EditorClientImpl.cpp @@ -921,8 +921,13 @@ void EditorClientImpl::getGuessesForWord(const String&, void EditorClientImpl::setInputMethodState(bool enabled) { - if (m_webView->client()) + if (m_webView->client()) { + m_webView->client()->resetInputMethod(); + + // Remove this line when WebViewClient::setInputMethodEnabled() gets + // removed. m_webView->client()->setInputMethodEnabled(enabled); + } } } // namesace WebKit diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 694d7c2..dae9348 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -735,9 +735,6 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad() if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); - - if (webview->devToolsAgentPrivate()) - webview->devToolsAgentPrivate()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); } void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( diff --git a/WebKit/chromium/src/GLES2Context.cpp b/WebKit/chromium/src/GLES2Context.cpp index 9dd4eff..b6d619c 100644 --- a/WebKit/chromium/src/GLES2Context.cpp +++ b/WebKit/chromium/src/GLES2Context.cpp @@ -47,6 +47,8 @@ // WebGLES2Context. This is done so we have a place to inject an // implementation which creates the GL ES context. +using namespace WebKit; + namespace WebCore { class GLES2ContextInternal { @@ -56,23 +58,20 @@ public: bool initialize(Page*); - WebKit::WebGLES2Context* getWebGLES2Context() { return m_impl.get(); } + WebGLES2Context* getWebGLES2Context() { return m_impl; } private: - OwnPtr<WebKit::WebGLES2Context> m_impl; + WebGLES2Context* m_impl; }; bool GLES2ContextInternal::initialize(Page* page) { - m_impl = WebKit::webKitClient()->createGLES2Context(); + ASSERT(page); + WebViewImpl* webView = WebViewImpl::fromPage(page); + m_impl = webView->gles2Context(); if (!m_impl) return false; - WebKit::WebViewImpl* webView = WebKit::WebViewImpl::fromPage(page); - if (!m_impl->initialize(webView)) { - m_impl.clear(); - return false; - } return true; } @@ -94,7 +93,7 @@ GLES2Context::~GLES2Context() bool GLES2Context::makeCurrent() { - WebKit::WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); if (!webContext) return false; return webContext->makeCurrent(); @@ -102,7 +101,7 @@ bool GLES2Context::makeCurrent() bool GLES2Context::destroy() { - WebKit::WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); if (!webContext) return false; return webContext->destroy(); @@ -110,7 +109,7 @@ bool GLES2Context::destroy() bool GLES2Context::swapBuffers() { - WebKit::WebGLES2Context* webContext = m_internal->getWebGLES2Context(); + WebGLES2Context* webContext = m_internal->getWebGLES2Context(); if (!webContext) return false; return webContext->swapBuffers(); diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index 91d10d5..cf491f7 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -60,64 +60,74 @@ InspectorClientImpl::~InspectorClientImpl() void InspectorClientImpl::inspectorDestroyed() { - // Our lifetime is bound to the WebViewImpl. + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->inspectorDestroyed(); } -void InspectorClientImpl::openInspectorFrontend(InspectorController*) +void InspectorClientImpl::openInspectorFrontend(InspectorController* controller) { -} - -static void invalidateNodeBoundingRect(WebViewImpl* webView) -{ - // FIXME: Is it important to just invalidate the rect of the node region - // given that this is not on a critical codepath? In order to do so, we'd - // have to take scrolling into account. - const WebSize& size = webView->size(); - WebRect damagedRect(0, 0, size.width, size.height); - if (webView->client()) - webView->client()->didInvalidateRect(damagedRect); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->openInspectorFrontend(controller); } void InspectorClientImpl::highlight(Node* node) { - // InspectorController does the actually tracking of the highlighted node - // and the drawing of the highlight. Here we just make sure to invalidate - // the rects of the old and new nodes. - hideHighlight(); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->highlight(node); } void InspectorClientImpl::hideHighlight() { - // FIXME: able to invalidate a smaller rect. - invalidateNodeBoundingRect(m_inspectedWebView); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->hideHighlight(); } void InspectorClientImpl::populateSetting(const String& key, String* value) { - WebString string; - m_inspectedWebView->inspectorSetting(key, &string); - *value = string; + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->populateSetting(key, value); } void InspectorClientImpl::storeSetting(const String& key, const String& value) { - m_inspectedWebView->setInspectorSetting(key, value); + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->storeSetting(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; + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + return agent->sendMessageToFrontend(message); + return false; +} + +void InspectorClientImpl::resourceTrackingWasEnabled() +{ + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->resourceTrackingWasEnabled(); +} + +void InspectorClientImpl::resourceTrackingWasDisabled() +{ + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->resourceTrackingWasDisabled(); +} + +void InspectorClientImpl::timelineProfilerWasStarted() +{ + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->timelineProfilerWasStarted(); +} + +void InspectorClientImpl::timelineProfilerWasStopped() +{ + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->timelineProfilerWasStopped(); +} + +WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent() +{ + return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); } } // namespace WebKit diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index f4994e3..0605ccd 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -38,6 +38,7 @@ namespace WebKit { class WebDevToolsAgentClient; +class WebDevToolsAgentImpl; class WebViewImpl; class InspectorClientImpl : public WebCore::InspectorClient { @@ -56,7 +57,13 @@ public: virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); virtual bool sendMessageToFrontend(const WebCore::String&); + + virtual void resourceTrackingWasEnabled(); + virtual void resourceTrackingWasDisabled(); + virtual void timelineProfilerWasStarted(); + virtual void timelineProfilerWasStopped(); private: + WebDevToolsAgentImpl* devToolsAgent(); // The WebViewImpl of the page being inspected; gets passed to the constructor WebViewImpl* m_inspectedWebView; diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 6f7ed95..83b925a 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -31,6 +31,8 @@ #include "config.h" #include "InspectorFrontendClientImpl.h" +#include "Document.h" +#include "Frame.h" #include "InspectorFrontendHost.h" #include "Page.h" #include "PlatformString.h" @@ -120,9 +122,9 @@ void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned) // Do nothing; } -void InspectorFrontendClientImpl::inspectedURLChanged(const String&) +void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) { - // Do nothing; + m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); } } // namespace WebKit diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp index c928c91..dca1856 100644 --- a/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -88,10 +88,7 @@ void NotificationPresenterImpl::cancel(Notification* notification) void NotificationPresenterImpl::notificationObjectDestroyed(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)); + m_presenter->objectDestroyed(PassRefPtr<Notification>(notification)); } NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& sourceURL) diff --git a/WebKit/chromium/src/ToolsAgent.h b/WebKit/chromium/src/ToolsAgent.h index ab48153..c748c8a 100644 --- a/WebKit/chromium/src/ToolsAgent.h +++ b/WebKit/chromium/src/ToolsAgent.h @@ -50,9 +50,6 @@ namespace WebKit { DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT) #define TOOLS_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \ - /* Updates focused node on the client. */ \ - METHOD1(frameNavigate, String /* url */) \ - \ /* Response to the DispatchOn*. */ \ METHOD3(didDispatchOn, int /* call_id */, String /* result */, String /* exception */) \ \ diff --git a/WebKit/chromium/src/WebCString.cpp b/WebKit/chromium/src/WebCString.cpp index b484b19..f81d7f4 100644 --- a/WebKit/chromium/src/WebCString.cpp +++ b/WebKit/chromium/src/WebCString.cpp @@ -41,6 +41,18 @@ namespace WebKit { class WebCStringPrivate : public WTF::CStringBuffer { }; +int WebCString::compare(const WebCString& other) const +{ + // A null string is always less than a non null one. + if (isNull() != other.isNull()) + return isNull() ? -1 : 1; + + if (isNull()) + return 0; // Both WebStrings are null. + + return strcmp(m_private->data(), other.m_private->data()); +} + void WebCString::reset() { if (m_private) { diff --git a/WebKit/chromium/src/WebDatabase.cpp b/WebKit/chromium/src/WebDatabase.cpp index 1479eb0..376509d 100644 --- a/WebKit/chromium/src/WebDatabase.cpp +++ b/WebKit/chromium/src/WebDatabase.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebDatabase.h" -#include "Database.h" +#include "AbstractDatabase.h" #include "DatabaseTask.h" #include "DatabaseThread.h" #include "DatabaseTracker.h" @@ -50,7 +50,7 @@ namespace WebKit { static WebDatabaseObserver* databaseObserver = 0; -class WebDatabasePrivate : public Database { +class WebDatabasePrivate : public AbstractDatabase { }; void WebDatabase::reset() @@ -110,34 +110,27 @@ void WebDatabase::updateDatabaseSize( void WebDatabase::closeDatabaseImmediately(const WebString& originIdentifier, const WebString& databaseName) { - HashSet<RefPtr<Database> > databaseHandles; - PassRefPtr<SecurityOrigin> originPrp(WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier)); - RefPtr<SecurityOrigin> origin = originPrp; + HashSet<RefPtr<AbstractDatabase> > databaseHandles; + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); DatabaseTracker::tracker().getOpenDatabases(origin.get(), databaseName, &databaseHandles); - for (HashSet<RefPtr<Database> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) { - Database* database = it->get(); - DatabaseThread* databaseThread = database->scriptExecutionContext()->databaseThread(); - if (databaseThread && !databaseThread->terminationRequested()) { - database->stop(); - databaseThread->scheduleTask(DatabaseCloseTask::create(database, Database::RemoveDatabaseFromContext, 0)); - } - } + for (HashSet<RefPtr<AbstractDatabase> >::iterator it = databaseHandles.begin(); it != databaseHandles.end(); ++it) + it->get()->closeImmediately(); } -WebDatabase::WebDatabase(const WTF::PassRefPtr<Database>& database) +WebDatabase::WebDatabase(const WTF::PassRefPtr<AbstractDatabase>& database) : m_private(static_cast<WebDatabasePrivate*>(database.releaseRef())) { } -WebDatabase& WebDatabase::operator=(const WTF::PassRefPtr<Database>& database) +WebDatabase& WebDatabase::operator=(const WTF::PassRefPtr<AbstractDatabase>& database) { assign(static_cast<WebDatabasePrivate*>(database.releaseRef())); return *this; } -WebDatabase::operator WTF::PassRefPtr<Database>() const +WebDatabase::operator WTF::PassRefPtr<AbstractDatabase>() const { - return PassRefPtr<Database>(const_cast<WebDatabasePrivate*>(m_private)); + return PassRefPtr<AbstractDatabase>(const_cast<WebDatabasePrivate*>(m_private)); } void WebDatabase::assign(WebDatabasePrivate* d) diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index c4bbbfa..c0e9b44 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -60,12 +60,15 @@ #include "WebDataSource.h" #include "WebDevToolsAgentClient.h" #include "WebDevToolsMessageData.h" +#include "WebDevToolsMessageTransport.h" #include "WebFrameImpl.h" +#include "WebRect.h" #include "WebString.h" #include "WebURL.h" #include "WebURLError.h" #include "WebURLRequest.h" #include "WebURLResponse.h" +#include "WebViewClient.h" #include "WebViewImpl.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -103,32 +106,23 @@ void InspectorBackendWeakReferenceCallback(v8::Persistent<v8::Value> object, voi object.Dispose(); } -void SetApuAgentEnabledInUtilityContext(v8::Handle<v8::Context> context, bool enabled) -{ - v8::HandleScope handleScope; - v8::Context::Scope contextScope(context); - v8::Handle<v8::Object> dispatcher = v8::Local<v8::Object>::Cast( - context->Global()->Get(v8::String::New("ApuAgentDispatcher"))); - if (dispatcher.IsEmpty()) - return; - dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); -} - -// TODO(pfeldman): Make this public in WebDevToolsAgent API. -static const char kApuAgentFeatureName[] = "apu-agent"; - -// Keep these in sync with the ones in inject_dispatch.js. -static const char kTimelineFeatureName[] = "timeline-profiler"; static const char kResourceTrackingFeatureName[] = "resource-tracking"; +static const char kTimelineFeatureName[] = "timeline-profiler"; +static const char kApuAgentFeatureName[] = "apu-agent"; class IORPCDelegate : public DevToolsRPC::Delegate, public Noncopyable { public: - IORPCDelegate() { } + IORPCDelegate() : m_transport(0) { } + explicit IORPCDelegate(WebDevToolsMessageTransport* transport) : m_transport(transport) { } virtual ~IORPCDelegate() { } virtual void sendRpcMessage(const WebDevToolsMessageData& data) { - WebDevToolsAgentClient::sendMessageToFrontendOnIOThread(data); + if (m_transport) + m_transport->sendMessageToFrontendOnIOThread(data); } + +private: + WebDevToolsMessageTransport* m_transport; }; class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop { @@ -306,21 +300,6 @@ void WebDevToolsAgentImpl::didNavigate() DebuggerAgentManager::onNavigate(); } -void WebDevToolsAgentImpl::didCommitProvisionalLoad(WebFrameImpl* webframe, bool isNewNavigation) -{ - if (!m_attached) - return; - WebDataSource* ds = webframe->dataSource(); - const WebURLRequest& request = ds->request(); - WebURL url = ds->hasUnreachableURL() ? - ds->unreachableURL() : - request.url(); - if (!webframe->parent()) { - m_toolsAgentDelegateStub->frameNavigate(WebCore::KURL(url).string()); - SetApuAgentEnabledInUtilityContext(m_utilityContext, m_apuAgentEnabled); - } -} - void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) { DebuggerAgentManager::setHostId(webframe, m_hostId); @@ -412,15 +391,6 @@ void WebDevToolsAgentImpl::initDevToolsAgentHost() devtoolsAgentHost.addProtoFunction( "dispatch", WebDevToolsAgentImpl::jsDispatchOnClient); - devtoolsAgentHost.addProtoFunction( - "dispatchToApu", - WebDevToolsAgentImpl::jsDispatchToApu); - devtoolsAgentHost.addProtoFunction( - "evaluateOnSelf", - WebDevToolsAgentImpl::jsEvaluateOnSelf); - devtoolsAgentHost.addProtoFunction( - "runtimeFeatureStateChanged", - WebDevToolsAgentImpl::jsOnRuntimeFeatureStateChanged); devtoolsAgentHost.build(); v8::HandleScope scope; @@ -481,7 +451,6 @@ void WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController() void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) { m_apuAgentEnabled = enabled; - SetApuAgentEnabledInUtilityContext(m_utilityContext, enabled); InspectorController* ic = m_webViewImpl->page()->inspectorController(); if (enabled) { m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); @@ -510,55 +479,25 @@ v8::Handle<v8::Value> WebDevToolsAgentImpl::jsDispatchOnClient(const v8::Argumen String message = WebCore::toWebCoreStringWithNullCheck(args[0]); if (message.isEmpty() || exceptionCatcher.HasCaught()) return v8::Undefined(); + WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - agent->m_toolsAgentDelegateStub->dispatchOnClient(message); - return v8::Undefined(); -} -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsDispatchToApu(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String message = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (message.isEmpty() || exceptionCatcher.HasCaught()) + if (!agent->m_apuAgentEnabled) { + agent->m_toolsAgentDelegateStub->dispatchOnClient(message); return v8::Undefined(); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>( - v8::External::Cast(*args.Data())->Value()); - agent->m_apuAgentDelegateStub->dispatchToApu(message); - return v8::Undefined(); -} - -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsEvaluateOnSelf(const v8::Arguments& args) -{ - String code; - { - v8::TryCatch exceptionCatcher; - code = WebCore::toWebCoreStringWithNullCheck(args[0]); - if (code.isEmpty() || exceptionCatcher.HasCaught()) - return v8::Undefined(); } - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - v8::Context::Scope(agent->m_utilityContext); - V8Proxy* proxy = V8Proxy::retrieve(agent->m_webViewImpl->page()->mainFrame()); - v8::Local<v8::Value> result = proxy->runScript(v8::Script::Compile(v8::String::New(code.utf8().data())), true); - return result; -} -// static -v8::Handle<v8::Value> WebDevToolsAgentImpl::jsOnRuntimeFeatureStateChanged(const v8::Arguments& args) -{ - v8::TryCatch exceptionCatcher; - String feature = WebCore::toWebCoreStringWithNullCheck(args[0]); - bool enabled = args[1]->ToBoolean()->Value(); - if (feature.isEmpty() || exceptionCatcher.HasCaught()) + String method = WebCore::toWebCoreStringWithNullCheck(args[1]); + if (method.isEmpty() || exceptionCatcher.HasCaught()) return v8::Undefined(); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(v8::External::Cast(*args.Data())->Value()); - agent->m_client->runtimeFeatureStateChanged(feature, enabled); + + if (method != "addRecordToTimeline" && method != "updateResource" && method != "addResource") + return v8::Undefined(); + + agent->m_apuAgentDelegateStub->dispatchToApu(message); return v8::Undefined(); } - WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() { if (Page* page = m_webViewImpl->page()) @@ -612,6 +551,83 @@ void WebDevToolsAgentImpl::didFailLoading(unsigned long resourceId, const WebURL ic->didFailLoading(resourceId, resourceError); } +void WebDevToolsAgentImpl::inspectorDestroyed() +{ + // Our lifetime is bound to the WebViewImpl. +} + +void WebDevToolsAgentImpl::openInspectorFrontend(InspectorController*) +{ +} + +void WebDevToolsAgentImpl::highlight(Node* node) +{ + // InspectorController does the actuall tracking of the highlighted node + // and the drawing of the highlight. Here we just make sure to invalidate + // the rects of the old and new nodes. + hideHighlight(); +} + +void WebDevToolsAgentImpl::hideHighlight() +{ + // FIXME: able to invalidate a smaller rect. + // FIXME: Is it important to just invalidate the rect of the node region + // given that this is not on a critical codepath? In order to do so, we'd + // have to take scrolling into account. + const WebSize& size = m_webViewImpl->size(); + WebRect damagedRect(0, 0, size.width, size.height); + if (m_webViewImpl->client()) + m_webViewImpl->client()->didInvalidateRect(damagedRect); +} + +void WebDevToolsAgentImpl::populateSetting(const String& key, String* value) +{ + WebString string; + m_webViewImpl->inspectorSetting(key, &string); + *value = string; +} + +void WebDevToolsAgentImpl::storeSetting(const String& key, const String& value) +{ + m_webViewImpl->setInspectorSetting(key, value); +} + +bool WebDevToolsAgentImpl::sendMessageToFrontend(const WebCore::String& message) +{ + WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_webViewImpl->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; +} + +void WebDevToolsAgentImpl::resourceTrackingWasEnabled() +{ + m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, true); +} + +void WebDevToolsAgentImpl::resourceTrackingWasDisabled() +{ + m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, false); +} + +void WebDevToolsAgentImpl::timelineProfilerWasStarted() +{ + m_client->runtimeFeatureStateChanged(kTimelineFeatureName, true); +} + +void WebDevToolsAgentImpl::timelineProfilerWasStopped() +{ + m_client->runtimeFeatureStateChanged(kTimelineFeatureName, false); +} + void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script) { InspectorController* ic = inspectorController(); @@ -647,10 +663,10 @@ void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler DebuggerAgentManager::setMessageLoopDispatchHandler(handler); } -bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(const WebDevToolsMessageData& data) +bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(WebDevToolsMessageTransport* transport, const WebDevToolsMessageData& data) { - IORPCDelegate transport; - ProfilerAgentDelegateStub stub(&transport); + IORPCDelegate delegate(transport); + ProfilerAgentDelegateStub stub(&delegate); ProfilerAgentImpl agent(&stub); return ProfilerAgentDispatch::dispatch(&agent, data); } diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index 455dcef..c97b21f 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -31,6 +31,8 @@ #ifndef WebDevToolsAgentImpl_h #define WebDevToolsAgentImpl_h +#include "InspectorClient.h" + #include "APUAgentDelegate.h" #include "DevToolsRPC.h" #include "ToolsAgent.h" @@ -41,6 +43,7 @@ namespace WebCore { class Document; +class InspectorClient; class InspectorController; class Node; class String; @@ -62,7 +65,8 @@ struct WebDevToolsMessageData; class WebDevToolsAgentImpl : public WebDevToolsAgentPrivate, public ToolsAgent, - public DevToolsRPC::Delegate { + public DevToolsRPC::Delegate, + public WebCore::InspectorClient { public: WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client); virtual ~WebDevToolsAgentImpl(); @@ -73,7 +77,6 @@ public: // WebDevToolsAgentPrivate implementation. virtual void didClearWindowObject(WebFrameImpl* frame); - virtual void didCommitProvisionalLoad(WebFrameImpl* frame, bool isNewNavigation); // WebDevToolsAgent implementation. virtual void attach(); @@ -92,6 +95,19 @@ public: virtual void didFinishLoading(unsigned long); virtual void didFailLoading(unsigned long, const WebURLError&); + // InspectorClient implementation. + 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 resourceTrackingWasEnabled(); + virtual void resourceTrackingWasDisabled(); + virtual void timelineProfilerWasStarted(); + virtual void timelineProfilerWasStopped(); + virtual bool sendMessageToFrontend(const WebCore::String&); + // DevToolsRPC::Delegate implementation. virtual void sendRpcMessage(const WebDevToolsMessageData& data); @@ -101,9 +117,6 @@ public: private: static v8::Handle<v8::Value> jsDispatchOnClient(const v8::Arguments& args); - static v8::Handle<v8::Value> jsDispatchToApu(const v8::Arguments& args); - static v8::Handle<v8::Value> jsEvaluateOnSelf(const v8::Arguments& args); - static v8::Handle<v8::Value> jsOnRuntimeFeatureStateChanged(const v8::Arguments& args); void disposeUtilityContext(); diff --git a/WebKit/chromium/src/WebDevToolsAgentPrivate.h b/WebKit/chromium/src/WebDevToolsAgentPrivate.h index 446f647..7038a5e 100644 --- a/WebKit/chromium/src/WebDevToolsAgentPrivate.h +++ b/WebKit/chromium/src/WebDevToolsAgentPrivate.h @@ -43,11 +43,6 @@ public: // The window object for the frame has been cleared of any extra properties // that may have been set by script from the previously loaded document. virtual void didClearWindowObject(WebFrameImpl*) = 0; - - // The provisional datasource is now committed. The first part of the - // response body has been received, and the encoding of the response body - // is known. - virtual void didCommitProvisionalLoad(WebFrameImpl*, bool isNewNavigation) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 0a6c8de..eda2f77 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -105,6 +105,10 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( InspectorController* ic = m_webViewImpl->page()->inspectorController(); ic->setInspectorFrontendClient(new InspectorFrontendClientImpl(m_webViewImpl->page(), m_client, this)); + // Put DevTools frontend Page into its own group so that it's not + // deferred along with inspected page. + m_webViewImpl->page()->setGroupName("DevToolsFrontend"); + WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); v8::HandleScope scope; v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index 2b8ae3c..665d8d9 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -42,7 +42,7 @@ using namespace WebCore; namespace { -// Note that this file is also included by HTMLDocumentParser.cpp so we are getting +// Note that this file is also included by LegacyHTMLDocumentParser.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 diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index bb1f6ce..c5fa1fe 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -472,9 +472,9 @@ WebString WebFrameImpl::name() const return m_frame->tree()->name(); } -void WebFrameImpl::clearName() +void WebFrameImpl::setName(const WebString& name) { - m_frame->tree()->clearName(); + m_frame->tree()->setName(name); } WebURL WebFrameImpl::url() const @@ -1279,6 +1279,21 @@ void WebFrameImpl::printEnd() m_printContext.clear(); } +bool WebFrameImpl::isPageBoxVisible(int pageIndex) +{ + return frame()->document()->isPageBoxVisible(pageIndex); +} + +WebRect WebFrameImpl::pageAreaRectInPixels(int pageIndex) +{ + return frame()->document()->pageAreaRectInPixels(pageIndex); +} + +WebSize WebFrameImpl::preferredPageSizeInPixels(int pageIndex) +{ + return frame()->document()->preferredPageSizeInPixels(pageIndex); +} + bool WebFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, @@ -2135,14 +2150,8 @@ void WebFrameImpl::loadJavaScriptURL(const KURL& url) if (!result.getString(scriptResult)) return; - SecurityOrigin* securityOrigin = m_frame->document()->securityOrigin(); - - if (!m_frame->redirectScheduler()->locationChangePending()) { - m_frame->loader()->stopAllLoaders(); - m_frame->loader()->writer()->begin(m_frame->loader()->url(), true, securityOrigin); - m_frame->loader()->writer()->addData(scriptResult); - m_frame->loader()->writer()->end(); - } + if (!m_frame->redirectScheduler()->locationChangePending()) + m_frame->loader()->writer()->replaceDocument(scriptResult); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index a8b272f..c14ad9b 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -64,7 +64,7 @@ class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> { public: // WebFrame methods: virtual WebString name() const; - virtual void clearName(); + virtual void setName(const WebString&); virtual WebURL url() const; virtual WebURL favIconURL() const; virtual WebURL openSearchDescriptionURL() const; @@ -149,6 +149,9 @@ public: virtual float printPage(int pageToPrint, WebCanvas*); virtual float getPrintPageShrink(int page); virtual void printEnd(); + virtual bool isPageBoxVisible(int pageIndex); + virtual WebRect pageAreaRectInPixels(int pageIndex); + virtual WebSize preferredPageSizeInPixels(int pageIndex); virtual bool find( int identifier, const WebString& searchText, const WebFindOptions&, bool wrapWithinFrame, WebRect* selectionRect); diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 4d24ea9..b23dc35 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -1001,6 +1001,7 @@ void WebGraphicsContext3DDefaultImpl::generateMipmap(unsigned long target) bool WebGraphicsContext3DDefaultImpl::getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo& info) { + makeContextCurrent(); if (!program) { synthesizeGLError(GL_INVALID_VALUE); return false; @@ -1032,6 +1033,7 @@ bool WebGraphicsContext3DDefaultImpl::getActiveAttrib(WebGLId program, unsigned bool WebGraphicsContext3DDefaultImpl::getActiveUniform(WebGLId program, unsigned long index, ActiveInfo& info) { + makeContextCurrent(); GLint maxNameLength = -1; glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); if (maxNameLength < 0) @@ -1223,6 +1225,7 @@ DELEGATE_TO_GL_2(polygonOffset, PolygonOffset, double, double) void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* pixels) { + makeContextCurrent(); // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., // all previous rendering calls should be done before reading pixels. glFlush(); diff --git a/WebKit/chromium/src/WebHistoryItem.cpp b/WebKit/chromium/src/WebHistoryItem.cpp index 45e4472..99ebce8 100644 --- a/WebKit/chromium/src/WebHistoryItem.cpp +++ b/WebKit/chromium/src/WebHistoryItem.cpp @@ -201,6 +201,17 @@ void WebHistoryItem::setDocumentState(const WebVector<WebString>& state) m_private->setDocumentState(ds); } +long long WebHistoryItem::itemSequenceNumber() const +{ + return m_private->itemSequenceNumber(); +} + +void WebHistoryItem::setItemSequenceNumber(long long itemSequenceNumber) +{ + ensureMutable(); + m_private->setItemSequenceNumber(itemSequenceNumber); +} + long long WebHistoryItem::documentSequenceNumber() const { return m_private->documentSequenceNumber(); diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 5ae1557..38d91df 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -36,6 +36,7 @@ #include "Notification.h" #include "WebString.h" +#include "WebTextDirection.h" #include "WebURL.h" #include <wtf/PassRefPtr.h> @@ -94,11 +95,19 @@ WebString WebNotification::body() const return m_private->contents().body(); } +// FIXME: remove dir() when unreferenced. Being replaced by direction(). WebString WebNotification::dir() const { return m_private->dir(); } +WebTextDirection WebNotification::direction() const +{ + return (m_private->direction() == RTL) ? + WebTextDirectionRightToLeft : + WebTextDirectionLeftToRight; +} + WebString WebNotification::replaceId() const { return m_private->replaceId(); diff --git a/WebKit/chromium/src/WebPluginListBuilderImpl.cpp b/WebKit/chromium/src/WebPluginListBuilderImpl.cpp index 8f5a1f7..d0f7324 100644 --- a/WebKit/chromium/src/WebPluginListBuilderImpl.cpp +++ b/WebKit/chromium/src/WebPluginListBuilderImpl.cpp @@ -53,16 +53,13 @@ void WebPluginListBuilderImpl::addMediaTypeToLastPlugin(const WebString& name, c MimeClassInfo info; info.type = name; info.desc = description; - info.pluginIndex = m_results->size() - 1; m_results->last().mimes.append(info); } void WebPluginListBuilderImpl::addFileExtensionToLastMediaType(const WebString& extension) { MimeClassInfo& info = m_results->last().mimes.last(); - if (!info.suffixes.isEmpty()) - info.suffixes.append(','); - info.suffixes.append(extension); + info.extensions.append(extension); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebPopupMenuImpl.cpp b/WebKit/chromium/src/WebPopupMenuImpl.cpp index f9da394..9ac4d34 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -230,6 +230,7 @@ void WebPopupMenuImpl::setFocus(bool enable) { } +// DEPRECATED, will be removed later. bool WebPopupMenuImpl::handleCompositionEvent( WebCompositionCommand command, int cursorPosition, int targetStart, int targetEnd, const WebString& imeString) @@ -237,11 +238,34 @@ bool WebPopupMenuImpl::handleCompositionEvent( return false; } +bool WebPopupMenuImpl::setComposition( + const WebString& text, const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, int selectionEnd) +{ + return false; +} + +bool WebPopupMenuImpl::confirmComposition() +{ + return false; +} + +// DEPRECATED, will be removed later. bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled, WebRect* caretRect) { return false; } +WebTextInputType WebPopupMenuImpl::textInputType() +{ + return WebTextInputTypeNone; +} + +WebRect WebPopupMenuImpl::caretOrSelectionBounds() +{ + return WebRect(); +} + void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) { } diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index a2602b0..95f776e 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -66,10 +66,21 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); + + // DEPRECATED, will be removed later. virtual bool handleCompositionEvent( WebCompositionCommand command, int cursorPosition, int targetStart, int targetEnd, const WebString& text); + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, int selectionEnd); + virtual bool confirmComposition(); + + // DEPRECATED, will be removed later. virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); + virtual WebTextInputType textInputType(); + virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); virtual bool isAcceleratedCompositingActive() const { return false; } diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp index 8e73d6f..595a47f 100644 --- a/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebRuntimeFeatures.h" -#include "Database.h" +#include "AbstractDatabase.h" #include "RuntimeEnabledFeatures.h" #include "WebMediaPlayerClientImpl.h" #include "WebSocket.h" @@ -43,14 +43,14 @@ namespace WebKit { void WebRuntimeFeatures::enableDatabase(bool enable) { #if ENABLE(DATABASE) - Database::setIsAvailable(enable); + AbstractDatabase::setIsAvailable(enable); #endif } bool WebRuntimeFeatures::isDatabaseEnabled() { #if ENABLE(DATABASE) - return Database::isAvailable(); + return AbstractDatabase::isAvailable(); #else return false; #endif diff --git a/WebKit/chromium/src/WebURLResponse.cpp b/WebKit/chromium/src/WebURLResponse.cpp index d5ba707..3f3ddba 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::wasAlternateProtocolAvailable() const +{ + return m_private->m_resourceResponse->wasAlternateProtocolAvailable(); +} + +void WebURLResponse::setWasAlternateProtocolAvailable(bool value) +{ + m_private->m_resourceResponse->setWasAlternateProtocolAvailable(value); +} + bool WebURLResponse::wasFetchedViaProxy() const { return m_private->m_resourceResponse->wasFetchedViaProxy(); diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 5adc35c..257d646 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -35,6 +35,7 @@ #include "AutocompletePopupMenuClient.h" #include "AXObjectCache.h" #include "Chrome.h" +#include "CompositionUnderlineVectorBuilder.h" #include "ContextMenu.h" #include "ContextMenuController.h" #include "ContextMenuItem.h" @@ -45,6 +46,7 @@ #include "DocumentLoader.h" #include "DOMUtilitiesPrivate.h" #include "DragController.h" +#include "DragScrollTimer.h" #include "DragData.h" #include "Editor.h" #include "EventHandler.h" @@ -81,14 +83,18 @@ #include "SecurityOrigin.h" #include "SelectionController.h" #include "Settings.h" +#include "Timer.h" #include "TypingCommand.h" #include "WebAccessibilityObject.h" #include "WebDevToolsAgentPrivate.h" +#include "WebDevToolsAgentImpl.h" #include "WebDragData.h" #include "WebFrameImpl.h" #include "WebImage.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" +#include "WebKit.h" +#include "WebKitClient.h" #include "WebMediaPlayerAction.h" #include "WebNode.h" #include "WebPoint.h" @@ -160,9 +166,9 @@ static const PopupContainerSettings suggestionsPopupSettings = { // WebView ---------------------------------------------------------------- -WebView* WebView::create(WebViewClient* client) +WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) { - return new WebViewImpl(client); + return new WebViewImpl(client, devToolsClient); } void WebView::updateVisitedLinkState(unsigned long long linkHash) @@ -209,7 +215,7 @@ void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalOnly); } -WebViewImpl::WebViewImpl(WebViewClient* client) +WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devToolsClient) : m_client(client) , m_backForwardListClientImpl(this) , m_chromeClientImpl(this) @@ -238,10 +244,12 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_suggestionsPopup(0) , m_isTransparent(false) , m_tabsToLinks(false) + , m_dragScrollTimer(new DragScrollTimer()) #if USE(ACCELERATED_COMPOSITING) , m_layerRenderer(0) , m_isAcceleratedCompositingActive(false) #endif + , m_gles2Context(0) { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading @@ -252,9 +260,13 @@ WebViewImpl::WebViewImpl(WebViewClient* client) // set to impossible point so we always get the first mouse pos m_lastMousePosition = WebPoint(-1, -1); - // the page will take ownership of the various clients + if (devToolsClient) + m_devToolsAgent = static_cast<WebDevToolsAgentImpl*>(WebDevToolsAgent::create(this, devToolsClient)); + m_page.set(new Page(&m_chromeClientImpl, &m_contextMenuClientImpl, &m_editorClientImpl, &m_dragClientImpl, &m_inspectorClientImpl, 0, 0, 0)); + // the page will take ownership of the various clients + m_page->backForwardList()->setClient(&m_backForwardListClientImpl); m_page->setGroupName(pageGroupName); @@ -827,45 +839,6 @@ 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()) @@ -1191,25 +1164,66 @@ void WebViewImpl::setFocus(bool enable) } } +// DEPRECATED, will be removed later. bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, int cursorPosition, int targetStart, int targetEnd, const WebString& imeString) { + if (command == WebKit::WebCompositionCommandSet) { + if (targetStart < 0) + targetStart = 0; + if (targetEnd < 0) + targetEnd = static_cast<int>(imeString.length()); + + // Create custom underlines. + // To emphasize the selection, the selected region uses a solid black + // for its underline while other regions uses a pale gray for theirs. + WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(3)); + underlines[0].startOffset = 0; + underlines[0].endOffset = targetStart; + underlines[0].thick = true; + underlines[0].color = 0xffd3d3d3; + underlines[1].startOffset = targetStart; + underlines[1].endOffset = targetEnd; + underlines[1].thick = true; + underlines[1].color = 0xff000000; + underlines[2].startOffset = targetEnd; + underlines[2].endOffset = static_cast<unsigned>(imeString.length()); + underlines[2].thick = true; + underlines[2].color = 0xffd3d3d3; + return setComposition(imeString, underlines, cursorPosition, cursorPosition); + } + + if (command == WebKit::WebCompositionCommandDiscard) + setComposition(WebString(), WebVector<WebCompositionUnderline>(), 0, 0); + else if (command == WebKit::WebCompositionCommandConfirm) { + setComposition(imeString, WebVector<WebCompositionUnderline>(), 0, 0); + confirmComposition(); + } + + return true; +} + +bool WebViewImpl::setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) +{ Frame* focused = focusedWebCoreFrame(); if (!focused || !m_imeAcceptEvents) return false; Editor* editor = focused->editor(); if (!editor) return false; - if (!editor->canEdit()) { - // The input focus has been moved to another WebWidget object. - // We should use this |editor| object only to complete the ongoing - // composition. - if (!editor->hasComposition()) - return false; - } + + // The input focus has been moved to another WebWidget object. + // We should use this |editor| object only to complete the ongoing + // composition. + if (!editor->canEdit() && !editor->hasComposition()) + return false; // We should verify the parent node of this IME composition node are // editable because JavaScript may delete a parent node of the composition @@ -1224,9 +1238,7 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, // If we're not going to fire a keypress event, then the keydown event was // canceled. In that case, cancel any existing composition. - // FIXME: Ideally, we would only cancel a single keypress, rather than the - // whole composition. - if ((command == WebCompositionCommandDiscard) || m_suppressNextKeypressEvent) { + if (text.isEmpty() || m_suppressNextKeypressEvent) { // A browser process sent an IPC message which does not contain a valid // string, which means an ongoing composition has been canceled. // If the ongoing composition has been canceled, replace the ongoing @@ -1234,49 +1246,45 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, String emptyString; Vector<CompositionUnderline> emptyUnderlines; editor->setComposition(emptyString, emptyUnderlines, 0, 0); - } else { - // A browser process sent an IPC message which contains a string to be - // displayed in this Editor object. - // To display the given string, set the given string to the - // m_compositionNode member of this Editor object and display it. - if (targetStart < 0) - targetStart = 0; - if (targetEnd < 0) - targetEnd = static_cast<int>(imeString.length()); - String compositionString(imeString); - // Create custom underlines. - // To emphasize the selection, the selected region uses a solid black - // for its underline while other regions uses a pale gray for theirs. - Vector<CompositionUnderline> underlines(3); - underlines[0].startOffset = 0; - underlines[0].endOffset = targetStart; - underlines[0].thick = true; - underlines[0].color.setRGB(0xd3, 0xd3, 0xd3); - underlines[1].startOffset = targetStart; - underlines[1].endOffset = targetEnd; - underlines[1].thick = true; - underlines[1].color.setRGB(0x00, 0x00, 0x00); - underlines[2].startOffset = targetEnd; - underlines[2].endOffset = static_cast<int>(imeString.length()); - underlines[2].thick = true; - underlines[2].color.setRGB(0xd3, 0xd3, 0xd3); - // When we use custom underlines, WebKit ("InlineTextBox.cpp" Line 282) - // prevents from writing a text in between 'selectionStart' and - // 'selectionEnd' somehow. - // Therefore, we use the 'cursorPosition' for these arguments so that - // there are not any characters in the above region. - editor->setComposition(compositionString, underlines, - cursorPosition, cursorPosition); - // The given string is a result string, which means the ongoing - // composition has been completed. I have to call the - // Editor::confirmCompletion() and complete this composition. - if (command == WebCompositionCommandConfirm) - editor->confirmComposition(); + return text.isEmpty(); } + // When the range of composition underlines overlap with the range between + // selectionStart and selectionEnd, WebKit somehow won't paint the selection + // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). + // But the selection range actually takes effect. + editor->setComposition(String(text), + CompositionUnderlineVectorBuilder(underlines), + selectionStart, selectionEnd); + return editor->hasComposition(); } +bool WebViewImpl::confirmComposition() +{ + Frame* focused = focusedWebCoreFrame(); + if (!focused || !m_imeAcceptEvents) + return false; + Editor* editor = focused->editor(); + if (!editor || !editor->hasComposition()) + return false; + + // We should verify the parent node of this IME composition node are + // editable because JavaScript may delete a parent node of the composition + // node. In this case, WebKit crashes while deleting texts from the parent + // node, which doesn't exist any longer. + PassRefPtr<Range> range = editor->compositionRange(); + if (range) { + const Node* node = range->startPosition().node(); + if (!node || !node->isContentEditable()) + return false; + } + + editor->confirmComposition(); + return true; +} + +// DEPRECATED, will be removed later. bool WebViewImpl::queryCompositionStatus(bool* enableIME, WebRect* caretRect) { // Store whether the selected node needs IME and the caret rectangle. @@ -1311,6 +1319,59 @@ bool WebViewImpl::queryCompositionStatus(bool* enableIME, WebRect* caretRect) return true; } +WebTextInputType WebViewImpl::textInputType() +{ + WebTextInputType type = WebTextInputTypeNone; + const Frame* focused = focusedWebCoreFrame(); + if (!focused) + return type; + + const Editor* editor = focused->editor(); + if (!editor || !editor->canEdit()) + return type; + + SelectionController* controller = focused->selection(); + if (!controller) + return type; + + const Node* node = controller->start().node(); + if (!node) + return type; + + // FIXME: Support more text input types when necessary, eg. Number, + // Date, Email, URL, etc. + if (controller->isInPasswordField()) + type = WebTextInputTypePassword; + else if (node->shouldUseInputMethod()) + type = WebTextInputTypeText; + + return type; +} + +WebRect WebViewImpl::caretOrSelectionBounds() +{ + WebRect rect; + const Frame* focused = focusedWebCoreFrame(); + if (!focused) + return rect; + + SelectionController* controller = focused->selection(); + if (!controller) + return rect; + + const FrameView* view = focused->view(); + if (!view) + return rect; + + if (controller->isCaret()) + rect = view->contentsToWindow(controller->absoluteCaretBounds()); + else if (controller->isRange()) { + RefPtr<Range> range = controller->toNormalizedRange(); + rect = view->contentsToWindow(focused->firstRectForRange(range.get())); + } + return rect; +} + void WebViewImpl::setTextDirection(WebTextDirection direction) { // The Editor::setBaseWritingDirection() function checks if we can change @@ -1393,7 +1454,7 @@ bool WebViewImpl::dispatchBeforeUnloadEvent() if (!frame) return true; - return frame->shouldClose(); + return frame->loader()->shouldClose(); } void WebViewImpl::dispatchUnloadEvent() @@ -1576,6 +1637,7 @@ void WebViewImpl::dragSourceEndedAt( false, 0); m_page->mainFrame()->eventHandler()->dragSourceEndedAt(pme, static_cast<DragOperation>(operation)); + m_dragScrollTimer->stop(); } void WebViewImpl::dragSourceMovedTo( @@ -1583,7 +1645,7 @@ void WebViewImpl::dragSourceMovedTo( const WebPoint& screenPoint, WebDragOperation operation) { - scrollForDragging(clientPoint); + m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); } void WebViewImpl::dragSourceSystemDragEnded() @@ -1672,6 +1734,7 @@ void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, m_dropEffect = DropEffectDefault; m_dragOperation = WebDragOperationNone; m_dragIdentity = 0; + m_dragScrollTimer->stop(); } int WebViewImpl::dragIdentity() @@ -1707,7 +1770,10 @@ WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo m_dragOperation = static_cast<WebDragOperation>(effect); if (dragAction == DragOver) - scrollForDragging(clientPoint); + m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); + else + m_dragScrollTimer->stop(); + return m_dragOperation; } @@ -2221,7 +2287,23 @@ void WebViewImpl::setRootLayerNeedsDisplay() if (m_layerRenderer) m_layerRenderer->setNeedsDisplay(); } +#endif // USE(ACCELERATED_COMPOSITING) -#endif +// Returns the GLES2 context associated with this View. If one doesn't exist +// it will get created first. +WebGLES2Context* WebViewImpl::gles2Context() +{ + if (!m_gles2Context) { + m_gles2Context = webKitClient()->createGLES2Context(); + if (!m_gles2Context) + return 0; + + if (!m_gles2Context->initialize(this, 0)) { + m_gles2Context.clear(); + return 0; + } + } + return m_gles2Context.get(); +} } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 8b15f8a..a6fa131 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -31,6 +31,7 @@ #ifndef WebViewImpl_h #define WebViewImpl_h +#include "WebGLES2Context.h" #include "WebNavigationPolicy.h" #include "WebPoint.h" #include "WebSize.h" @@ -68,8 +69,10 @@ namespace WebKit { class AutocompletePopupMenuClient; class AutoFillPopupMenuClient; class ContextMenuClientImpl; +class DragScrollTimer; class SuggestionsPopupMenuClient; class WebAccessibilityObject; +class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; class WebFrameImpl; class WebImage; @@ -90,13 +93,24 @@ public: virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); + + // DEPRECATED, will be removed later. virtual bool handleCompositionEvent(WebCompositionCommand command, int cursorPosition, int targetStart, int targetEnd, const WebString& text); - virtual bool queryCompositionStatus(bool* enabled, - WebRect* caretRect); + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd); + virtual bool confirmComposition(); + + // DEPRECATED, will be removed later. + virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); + virtual WebTextInputType textInputType(); + virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); virtual bool isAcceleratedCompositingActive() const; @@ -322,6 +336,10 @@ public: WebCore::ScrollDirection* scrollDirection, WebCore::ScrollGranularity* scrollGranularity); + // Returns the GLES2Context associated with this WebView. One will be created + // if it doesn't already exist. + WebGLES2Context* gles2Context(); + private: friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; @@ -331,7 +349,7 @@ private: DragOver }; - WebViewImpl(WebViewClient* client); + WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devToolsClient); ~WebViewImpl(); // Returns true if the event was actually processed. @@ -351,8 +369,6 @@ 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 @@ -496,6 +512,7 @@ private: typedef HashMap<WebCore::String, WebCore::String> SettingsMap; OwnPtr<SettingsMap> m_inspectorSettingsMap; + OwnPtr<DragScrollTimer> m_dragScrollTimer; #if ENABLE(NOTIFICATIONS) // The provider of desktop notifications; @@ -510,6 +527,8 @@ private: bool m_isAcceleratedCompositingActive; #endif static const WebInputEvent* m_currentInputEvent; + + OwnPtr<WebGLES2Context> m_gles2Context; }; } // namespace WebKit diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index 8d2457f..01d7627 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -1075,7 +1075,7 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) WebInspector.parsedScriptSource(sourceId, null, null, 0, WebInspector.Script.WorldType.MAIN_WORLD); } - var funcName = func.name || func.inferredName || "(anonymous function)"; + var funcName = func.name || func.inferredName; var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(stackFrame.line); // Add basic scope chain info with scope variables. diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index 3ff3eb7..baddb7d 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -219,8 +219,6 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var functionName; if (func) functionName = func.name() || func.inferredName(); - if (!functionName) - functionName = "[anonymous]"; // Get script ID. var script = func.script(); diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 398d358..851c934 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -61,7 +61,6 @@ devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) devtools.ToolsAgent = function() { RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; - RemoteToolsAgent.frameNavigate = this.frameNavigate_.bind(this); RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); this.debuggerAgent_ = new devtools.DebuggerAgent(); this.profilerAgent_ = new devtools.ProfilerAgent(); @@ -107,24 +106,14 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() }; -/** - * @param {string} url Url frame navigated to. - * @see tools_agent.h - * @private - */ -devtools.ToolsAgent.prototype.frameNavigate_ = function(url) +(function () { +var orig = WebInspector.reset; +WebInspector.reset = function() { - this.reset(); - // Do not reset Profiles panel. - var profiles = null; - if ("profiles" in WebInspector.panels) { - profiles = WebInspector.panels["profiles"]; - delete WebInspector.panels["profiles"]; - } - WebInspector.reset(); - if (profiles !== null) - WebInspector.panels["profiles"] = profiles; + devtools.tools.reset(); + orig.call(this); }; +})(); /** @@ -302,31 +291,6 @@ WebInspector.UIString = function(string) return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); }; -// Activate window upon node search complete. This will go away once InspectorFrontendClient is landed. -(function() { - var original = WebInspector.searchingForNodeWasDisabled; - WebInspector.searchingForNodeWasDisabled = function() - { - if (this.panels.elements._nodeSearchButton.toggled) - InspectorFrontendHost.bringToFront(); - original.apply(this, arguments); - } -})(); - - -// There is no clear way of setting frame title yet. So sniffing main resource -// load. -(function OverrideUpdateResource() { - var originalUpdateResource = WebInspector.updateResource; - WebInspector.updateResource = function(identifier, payload) - { - originalUpdateResource.call(this, identifier, payload); - var resource = this.resources[identifier]; - if (resource && resource.mainResource && resource.finished) - document.title = WebInspector.UIString("Developer Tools - %s", resource.url); - }; -})(); - /** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */ (function() @@ -356,9 +320,10 @@ WebInspector.UIString = function(string) })(); -// We need to have a place for postponed tasks -// which should be executed when all the messages between agent and frontend -// are processed. + +/////////////////////////////////////////// +// Chromium layout test harness support. // +/////////////////////////////////////////// WebInspector.runAfterPendingDispatchesQueue = []; @@ -375,19 +340,11 @@ WebInspector.queuesAreEmpty = function() copy[i].call(this); }; -(function() -{ -var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; -InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) -{ - var resource = WebInspector.resources[identifier]; - if (!resource) - return; - originalAddToFrame.call(this, identifier, resource.mimeType, element); -}; -})(); -// Chromium theme support. +///////////////////////////// +// Chromium theme support. // +///////////////////////////// + WebInspector.setToolbarColors = function(backgroundColor, color) { if (!WebInspector._themeStyleElement) { diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index da5929a..806bf6a 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -34,277 +34,8 @@ */ if (!window["RemoteDebuggerAgent"]) { - -/** - * FIXME: change field naming style to use trailing underscore. - * @constructor - */ -RemoteDebuggerAgentStub = function() -{ -}; - - -RemoteDebuggerAgentStub.prototype.getContextId = function() -{ - RemoteDebuggerAgent.setContextId(3); -}; - - -RemoteDebuggerAgentStub.prototype.processDebugCommands = function() -{ -}; - - - -/** - * @constructor - */ -RemoteProfilerAgentStub = function() -{ -}; - - -RemoteProfilerAgentStub.prototype.getActiveProfilerModules = function() -{ - ProfilerStubHelper.GetInstance().getActiveProfilerModules(); -}; - - -RemoteProfilerAgentStub.prototype.getLogLines = function(pos) -{ - ProfilerStubHelper.GetInstance().getLogLines(pos); -}; - - -/** - * @constructor - */ -RemoteToolsAgentStub = function() -{ -}; - - -RemoteToolsAgentStub.prototype.dispatchOnInjectedScript = function() -{ -}; - - -RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function() -{ -}; - - -/** - * @constructor - */ -ProfilerStubHelper = function() -{ - this.activeProfilerModules_ = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE; - this.heapProfSample_ = 0; - this.log_ = ''; -}; - - -ProfilerStubHelper.GetInstance = function() -{ - if (!ProfilerStubHelper.instance_) - ProfilerStubHelper.instance_ = new ProfilerStubHelper(); - return ProfilerStubHelper.instance_; -}; - - -ProfilerStubHelper.prototype.StopProfiling = function(modules) -{ - this.activeProfilerModules_ &= ~modules; -}; - - -ProfilerStubHelper.prototype.StartProfiling = function(modules) -{ - var profModules = devtools.ProfilerAgent.ProfilerModules; - if (modules & profModules.PROFILER_MODULE_HEAP_SNAPSHOT) { - if (modules & profModules.PROFILER_MODULE_HEAP_STATS) { - this.log_ += - 'heap-sample-begin,"Heap","allocated",' + - (new Date()).getTime() + '\n' + - 'heap-sample-stats,"Heap","allocated",10000,1000\n'; - this.log_ += - 'heap-sample-item,STRING_TYPE,100,1000\n' + - 'heap-sample-item,CODE_TYPE,10,200\n' + - 'heap-sample-item,MAP_TYPE,20,350\n'; - this.log_ += ProfilerStubHelper.HeapSamples[this.heapProfSample_++]; - this.heapProfSample_ %= ProfilerStubHelper.HeapSamples.length; - this.log_ += 'heap-sample-end,"Heap","allocated"\n'; - } - } else { - if (modules & profModules.PROFILER_MODULE_CPU) - this.log_ += ProfilerStubHelper.ProfilerLogBuffer; - this.activeProfilerModules_ |= modules; - } -}; - - -ProfilerStubHelper.prototype.getActiveProfilerModules = function() -{ - var self = this; - setTimeout(function() { - RemoteProfilerAgent.didGetActiveProfilerModules(self.activeProfilerModules_); - }, 100); -}; - - -ProfilerStubHelper.prototype.getLogLines = function(pos) -{ - var profModules = devtools.ProfilerAgent.ProfilerModules; - var logLines = this.log_.substr(pos); - setTimeout(function() { - RemoteProfilerAgent.didGetLogLines(pos + logLines.length, logLines); - }, 100); -}; - - -ProfilerStubHelper.ProfilerLogBuffer = - 'profiler,begin,1\n' + - 'profiler,resume\n' + - 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' + - 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' + - 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' + - 'tick,0x1010,0x0,3\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x3010,0x0,3,0x2020, 0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x2030,0x0,3,0x2020, 0x1010\n' + - 'tick,0x2020,0x0,3,0x1010\n' + - 'tick,0x1010,0x0,3\n' + - 'profiler,pause\n'; - - -ProfilerStubHelper.HeapSamples = [ - 'heap-js-cons-item,foo,1,100\n' + - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,Object,5,100\n' + - 'heap-js-ret-item,foo,bar;3\n' + - 'heap-js-ret-item,bar,foo;5\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1\n', - - 'heap-js-cons-item,foo,2000,200000\n' + - 'heap-js-cons-item,bar,10,1000\n' + - 'heap-js-cons-item,Object,6,120\n' + - 'heap-js-ret-item,foo,bar;7,Object:0x1234;10\n' + - 'heap-js-ret-item,bar,foo;10,Object:0x1234;10\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1\n', - - 'heap-js-cons-item,foo,15,1500\n' + - 'heap-js-cons-item,bar,15,1500\n' + - 'heap-js-cons-item,Object,5,100\n' + - 'heap-js-cons-item,Array,3,1000\n' + - 'heap-js-ret-item,foo,bar;3,Array:0x5678;1\n' + - 'heap-js-ret-item,bar,foo;5,Object:0x1234;8,Object:0x5678;2\n' + - 'heap-js-ret-item,Object:0x1234,(roots);1,Object:0x5678;2\n' + - 'heap-js-ret-item,Object:0x5678,(global property);3,Object:0x1234;5\n' + - 'heap-js-ret-item,Array:0x5678,(global property);3,Array:0x5678;2\n', - - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,Object,6,120\n' + - 'heap-js-ret-item,bar,foo;5,Object:0x1234;1,Object:0x1235;3\n' + - 'heap-js-ret-item,Object:0x1234,(global property);3\n' + - 'heap-js-ret-item,Object:0x1235,(global property);5\n', - - 'heap-js-cons-item,foo,15,1500\n' + - 'heap-js-cons-item,bar,15,1500\n' + - 'heap-js-cons-item,Array,10,1000\n' + - 'heap-js-ret-item,foo,bar;1,Array:0x5678;1\n' + - 'heap-js-ret-item,bar,foo;5\n' + - 'heap-js-ret-item,Array:0x5678,(roots);3\n', - - 'heap-js-cons-item,bar,20,2000\n' + - 'heap-js-cons-item,baz,15,1500\n' + - 'heap-js-ret-item,bar,baz;3\n' + - 'heap-js-ret-item,baz,bar;3\n' -]; - - -/** - * @constructor - */ -RemoteDebuggerCommandExecutorStub = function() -{ -}; - - -RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) -{ - if ('{"seq":2,"type":"request","command":"scripts","arguments":{"includeSource":false}}' === cmd) { - var response1 = - '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' + - 'success":true,"body":[{"handle":61,"type":"script","name":"' + - 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + - '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' + - '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' + - '"handle":60,"type":"context","data":"page,3"}],"running":false}'; - this.sendResponse_(response1); - } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{"ids":[59],"includeSource":true}}' === cmd) { - this.sendResponse_( - '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' + - '"success":true,"body":[{"handle":1,"type":"script","name":' + - '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + - '"lineCount":1,"source":"function fib(n) {return n+1;}",' + - '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' + - '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' + - '"running":false}'); - } else if (cmd.indexOf('"command":"profile"') !== -1) { - var cmdObj = JSON.parse(cmd); - if (cmdObj.arguments.command === "resume") - ProfilerStubHelper.GetInstance().StartProfiling(parseInt(cmdObj.arguments.modules)); - else if (cmdObj.arguments.command === "pause") - ProfilerStubHelper.GetInstance().StopProfiling(parseInt(cmdObj.arguments.modules)); - else - debugPrint("Unexpected profile command: " + cmdObj.arguments.command); - } else - debugPrint("Unexpected command: " + cmd); -}; - - -RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript = function() -{ -}; - - -RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response) -{ - setTimeout(function() { - RemoteDebuggerAgent.debuggerOutput(response); - }, 0); -}; - - -DevToolsHostStub = function() -{ - this.isStub = true; -}; -DevToolsHostStub.prototype.__proto__ = WebInspector.InspectorFrontendHostStub.prototype; - - -DevToolsHostStub.prototype.reset = function() -{ -}; - - -DevToolsHostStub.prototype.setting = function() -{ -}; - - -DevToolsHostStub.prototype.setSetting = function() -{ -}; - - -window["RemoteDebuggerAgent"] = new RemoteDebuggerAgentStub(); -window["RemoteDebuggerCommandExecutor"] = new RemoteDebuggerCommandExecutorStub(); -window["RemoteProfilerAgent"] = new RemoteProfilerAgentStub(); -window["RemoteToolsAgent"] = new RemoteToolsAgentStub(); -InspectorFrontendHost = new DevToolsHostStub(); - + window["RemoteDebuggerAgent"] = { setDebuggerScriptSource: function() {} }; + window["RemoteDebuggerCommandExecutor"] = {}; + window["RemoteProfilerAgent"] = {}; + window["RemoteToolsAgent"] = { dispatchOnInjectedScript: function() {} }; } diff --git a/WebKit/chromium/src/js/HeapProfilerPanel.js b/WebKit/chromium/src/js/HeapProfilerPanel.js index 0fc4418..bcb008f 100644 --- a/WebKit/chromium/src/js/HeapProfilerPanel.js +++ b/WebKit/chromium/src/js/HeapProfilerPanel.js @@ -932,7 +932,7 @@ WebInspector.HeapSnapshotProfileType.prototype = { buttonClicked: function() { - InspectorBackend.takeHeapSnapshot(); + devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT); }, get welcomeMessage() diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js index 30caaf2..cda84e5 100644 --- a/WebKit/chromium/src/js/InjectDispatch.js +++ b/WebKit/chromium/src/js/InjectDispatch.js @@ -49,60 +49,14 @@ InspectorControllerDispatcher.dispatch = function(functionName, json_args) }; /** - * Special controller object for APU related messages. Outgoing messages - * are sent to this object if the ApuAgentDispatcher is enabled. - **/ -var ApuAgentDispatcher = { enabled : false }; - -/** - * Dispatches messages to APU. This filters and transforms - * outgoing messages that are used by APU. - * @param {string} method name of the dispatch method. - **/ -ApuAgentDispatcher.dispatchToApu = function(method, args) -{ - if (method !== "addRecordToTimeline" && method !== "updateResource" && method !== "addResource") - return; - // TODO(knorton): Transform args so they can be used - // by APU. - DevToolsAgentHost.dispatchToApu(JSON.stringify(args)); -}; - -/** * This is called by the InspectorFrontend for serialization. * We serialize the call and send it to the client over the IPC * using dispatchOut bound method. */ function dispatch(method, var_args) { - // Handle all messages with non-primitieve arguments here. var args = Array.prototype.slice.call(arguments); - - if (method === "inspectedWindowCleared" || method === "reset" || method === "setAttachedWindow") { - // Filter out messages we don't need here. - // We do it on the sender side since they may have non-serializable - // parameters. - return; - } - - // Sniff some inspector controller state changes in order to support - // cross-navigation instrumentation. Keep names in sync with - // webdevtoolsagent_impl. - if (method === "timelineProfilerWasStarted") - DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", true); - else if (method === "timelineProfilerWasStopped") - DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", false); - else if (method === "resourceTrackingWasEnabled") - DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", true); - else if (method === "resourceTrackingWasDisabled") - DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", false); - - if (ApuAgentDispatcher.enabled) { - ApuAgentDispatcher.dispatchToApu(method, args); - return; - } - var call = JSON.stringify(args); - DevToolsAgentHost.dispatch(call); + DevToolsAgentHost.dispatch(call, method); }; function close() { diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js index 327ca8f..cbe607d 100644 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ b/WebKit/chromium/src/js/InspectorControllerImpl.js @@ -38,14 +38,18 @@ if (!this.devtools) devtools.InspectorBackendImpl = function() { WebInspector.InspectorBackendStub.call(this); + this.installInspectorControllerDelegate_("addInspectedNode"); this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad"); - this.installInspectorControllerDelegate_("clearMessages"); + this.installInspectorControllerDelegate_("changeTagName"); + this.installInspectorControllerDelegate_("clearConsoleMessages"); this.installInspectorControllerDelegate_("copyNode"); this.installInspectorControllerDelegate_("deleteCookie"); this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend"); + this.installInspectorControllerDelegate_("disableMonitoringXHR"); this.installInspectorControllerDelegate_("disableResourceTracking"); this.installInspectorControllerDelegate_("disableSearchingForNode"); this.installInspectorControllerDelegate_("disableTimeline"); + this.installInspectorControllerDelegate_("enableMonitoringXHR"); this.installInspectorControllerDelegate_("enableResourceTracking"); this.installInspectorControllerDelegate_("enableSearchingForNode"); this.installInspectorControllerDelegate_("enableTimeline"); @@ -54,6 +58,7 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("getDatabaseTableNames"); this.installInspectorControllerDelegate_("getDOMStorageEntries"); this.installInspectorControllerDelegate_("getEventListenersForNode"); + this.installInspectorControllerDelegate_("getOuterHTML"); this.installInspectorControllerDelegate_("getProfile"); this.installInspectorControllerDelegate_("getProfileHeaders"); this.installInspectorControllerDelegate_("removeProfile"); @@ -62,6 +67,7 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("highlightDOMNode"); this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); this.installInspectorControllerDelegate_("performSearch"); + this.installInspectorControllerDelegate_("pushNodeByPathToFrontend"); this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); this.installInspectorControllerDelegate_("reloadPage"); @@ -74,12 +80,14 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("setAttribute"); this.installInspectorControllerDelegate_("setDOMStorageItem"); this.installInspectorControllerDelegate_("setInjectedScriptSource"); + this.installInspectorControllerDelegate_("setOuterHTML"); this.installInspectorControllerDelegate_("setTextNodeValue"); this.installInspectorControllerDelegate_("startProfiling"); this.installInspectorControllerDelegate_("startTimelineProfiler"); this.installInspectorControllerDelegate_("stopProfiling"); this.installInspectorControllerDelegate_("stopTimelineProfiler"); this.installInspectorControllerDelegate_("storeLastActivePanel"); + this.installInspectorControllerDelegate_("takeHeapSnapshot"); this.installInspectorControllerDelegate_("getAllStyles"); this.installInspectorControllerDelegate_("getStyles"); @@ -113,24 +121,6 @@ devtools.InspectorBackendImpl = function() devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype; -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.debuggerEnabled = function() -{ - return true; -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.profilerEnabled = function() -{ - return true; -}; - - if (!window.v8ScriptDebugServerEnabled) { devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition) @@ -248,17 +238,6 @@ devtools.InspectorBackendImpl.prototype.pauseInDebugger = function() /** * @override */ -devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function() -{ - devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT - | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_STATS - | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_JS_CONSTRUCTORS); -}; - - -/** - * @override - */ devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(callId, injectedScriptId, methodName, argsString, async) { // Encode injectedScriptId into callId diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js index 29de4a3..0b65ace 100644 --- a/WebKit/chromium/src/js/ProfilerAgent.js +++ b/WebKit/chromium/src/js/ProfilerAgent.js @@ -105,12 +105,8 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately) */ devtools.ProfilerAgent.prototype.startProfiling = function(modules) { - var cmd = new devtools.DebugCommand("profile", { - "modules": modules, - "command": "resume"}); - devtools.DebuggerAgent.sendCommand_(cmd); - RemoteDebuggerAgent.processDebugCommands(); if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) { + InspectorBackend.takeHeapSnapshot(); // Active modules will not change, instead, a snapshot will be logged. this._getNextLogLines(); } @@ -118,19 +114,6 @@ devtools.ProfilerAgent.prototype.startProfiling = function(modules) /** - * Stops profiling. - */ -devtools.ProfilerAgent.prototype.stopProfiling = function(modules) -{ - var cmd = new devtools.DebugCommand("profile", { - "modules": modules, - "command": "pause"}); - devtools.DebuggerAgent.sendCommand_(cmd); - RemoteDebuggerAgent.processDebugCommands(); -}; - - -/** * Handles current profiler status. * @param {number} modules List of active (started) modules. */ diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index fa910ab..893bc56 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -453,7 +453,7 @@ TestSuite.prototype.testProfilerTab = function() setTimeout(findVisibleView, 0); return; } - setTimeout(findDisplayedNode, 0); + setTimeout(findDisplayedNode, 0); } findVisibleView(); @@ -462,6 +462,51 @@ TestSuite.prototype.testProfilerTab = function() /** + * Tests that heap profiler works. + */ +TestSuite.prototype.testHeapProfiler = function() +{ + this.showPanel("profiles"); + + var panel = WebInspector.panels.profiles; + var test = this; + + function findDisplayedNode() { + var node = panel.visibleView.dataGrid.children[0]; + if (!node) { + // Profile hadn't been queried yet, re-schedule. + window.setTimeout(findDisplayedNode, 100); + return; + } + + // Iterate over displayed functions and find node called "A" + // If found, this will mean that we actually have taken heap snapshot. + while (node) { + if (node.constructorName.indexOf("A") !== -1) { + test.releaseControl(); + return; + } + node = node.traverseNextNode(false, null, true); + } + + test.fail(); + } + + function findVisibleView() { + if (!panel.visibleView) { + setTimeout(findVisibleView, 0); + return; + } + setTimeout(findDisplayedNode, 0); + } + + WebInspector.HeapSnapshotProfileType.prototype.buttonClicked(); + findVisibleView(); + this.takeControl(); +}; + + +/** * Tests that scripts tab can be open and populated with inspected scripts. */ TestSuite.prototype.testShowScriptsTab = function() @@ -488,31 +533,19 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() var test = this; this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one."); - this.addSniffer(devtools.DebuggerAgent.prototype, "reset", waitUntilScriptIsParsed); + this.addSniffer(WebInspector.panels.scripts, "reset", waitUntilScriptIsParsed); // Reload inspected page. It will reset the debugger agent. test.evaluateInConsole_( "window.location.reload(true);", - function(resultText) { - test.assertEquals("undefined", resultText, "Unexpected result of reload()."); - }); + function(resultText) {}); function waitUntilScriptIsParsed() { - var parsed = devtools.tools.getDebuggerAgent().parsedScripts_; - for (var id in parsed) { - var url = parsed[id].getUrl(); - if (url && url.search("debugger_test_page.html") !== -1) { - checkScriptsPanel(); - return; - } - } - test.addSniffer(devtools.DebuggerAgent.prototype, "addScriptInfo_", waitUntilScriptIsParsed); - } - - function checkScriptsPanel() { test.showPanel("scripts"); - test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Inspected script not found in the scripts list"); - test.releaseControl(); + test._waitUntilScriptsAreParsed(["debugger_test_page.html"], + function() { + test.releaseControl(); + }); } // Wait until all scripts are added to the debugger. @@ -603,7 +636,7 @@ TestSuite.prototype.testSetBreakpoint = function() var test = this; this.showPanel("scripts"); - var breakpointLine = 12; + var breakpointLine = 16 this._waitUntilScriptsAreParsed(["debugger_test_page.html"], function() { @@ -611,15 +644,25 @@ TestSuite.prototype.testSetBreakpoint = function() "debugger_test_page.html", function(view, url) { view._addBreakpoint(breakpointLine); - // Force v8 execution. - RemoteDebuggerAgent.processDebugCommands(); - test.waitForSetBreakpointResponse_(url, breakpointLine, - function() { - test.releaseControl(); + + test.evaluateInConsole_( + 'setTimeout("calculate()" , 0)', + function(resultText) { + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); }); }); }); + this._waitForScriptPause( + { + functionsOnStack: ["calculate", ""], + lineNumber: breakpointLine, + lineText: " result = fib(lastVal++);" + }, + function() { + test.releaseControl(); + }); + this.takeControl(); }; @@ -632,21 +675,13 @@ TestSuite.prototype.testPauseOnException = function() this.showPanel("scripts"); var test = this; - // TODO(yurys): remove else branch once the states are supported. - if (WebInspector.ScriptsPanel.PauseOnExceptionsState) { - while (WebInspector.currentPanel._pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) - WebInspector.currentPanel._pauseOnExceptionButton.element.click(); - } else { - // Make sure pause on exceptions is on. - if (!WebInspector.currentPanel._pauseOnExceptionButton.toggled) - WebInspector.currentPanel._pauseOnExceptionButton.element.click(); - } + InspectorBackend.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions); this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]); this._waitForScriptPause( { - functionsOnStack: ["throwAnException", "handleClick", "(anonymous function)"], + functionsOnStack: ["throwAnException", "handleClick", ""], lineNumber: 6, lineText: " return unknown_var;" }, @@ -728,7 +763,7 @@ TestSuite.prototype.testPauseWhenScriptIsRunning = function() test._waitForScriptPause( { - functionsOnStack: ["handleClick", "(anonymous function)"], + functionsOnStack: ["handleClick", ""], lineNumber: 5, lineText: " while(true) {" }, @@ -861,36 +896,30 @@ TestSuite.prototype.testEvalOnCallFrame = function() var breakpointLine = 16; var test = this; - this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_", - function(msg) { + this._waitUntilScriptsAreParsed(["debugger_test_page.html"], + function() { test.showMainPageScriptSource_( "debugger_test_page.html", function(view, url) { view._addBreakpoint(breakpointLine); - // Force v8 execution. - RemoteDebuggerAgent.processDebugCommands(); - test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback); + + // Since breakpoints are ignored in evals' calculate() function is + // execute after zero-timeout so that the breakpoint is hit. + test.evaluateInConsole_( + 'setTimeout("calculate(123)" , 0)', + function(resultText) { + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); + waitForBreakpointHit(); + }); }); }); - function setBreakpointCallback() { - // Since breakpoints are ignored in evals' calculate() function is - // execute after zero-timeout so that the breakpoint is hit. - test.evaluateInConsole_( - 'setTimeout("calculate(123)" , 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - waitForBreakpointHit(); - }); - } - function waitForBreakpointHit() { - test.addSniffer( - devtools.DebuggerAgent.prototype, - "handleBacktraceResponse_", - function(msg) { - test.assertEquals(2, this.callFrames_.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(msg)); - test.assertEquals("calculate", this.callFrames_[0].functionName, "Unexpected top frame function."); + test.addSniffer(WebInspector, + "pausedScript", + function(callFrames) { + test.assertEquals(2, callFrames.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(callFrames, null, 4)); + test.assertEquals("calculate", callFrames[0].functionName, "Unexpected top frame function."); // Evaluate "e+1" where "e" is an argument of "calculate" function. test.evaluateInConsole_( "e+1", @@ -916,7 +945,7 @@ TestSuite.prototype.testCompletionOnPause = function() this._waitForScriptPause( { - functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"], + functionsOnStack: ["innerFunction", "handleClick", ""], lineNumber: 9, lineText: " debugger;" }, @@ -963,6 +992,9 @@ TestSuite.prototype.testCompletionOnPause = function() */ TestSuite.prototype.testAutoContinueOnSyntaxError = function() { + if (window.v8ScriptDebugServerEnabled) + return; + this.showPanel("scripts"); var test = this; @@ -978,6 +1010,7 @@ TestSuite.prototype.testAutoContinueOnSyntaxError = function() } } + this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_", function(msg) { checkScriptsList(); @@ -1140,7 +1173,7 @@ TestSuite.prototype._executeCodeWhenScriptsAreParsed = function(code, expectedSc test.evaluateInConsole_( 'setTimeout("' + code + '" , 0)', function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); + test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText + ". Code: " + code); }); } @@ -1188,7 +1221,7 @@ TestSuite.prototype.testStepOver = function() this._performSteps([ { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 3, lineText: " debugger;" }, @@ -1196,7 +1229,7 @@ TestSuite.prototype.testStepOver = function() document.getElementById("scripts-step-over").click(); }, { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 5, lineText: " var y = fact(10);" }, @@ -1204,7 +1237,7 @@ TestSuite.prototype.testStepOver = function() document.getElementById("scripts-step-over").click(); }, { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 6, lineText: " return y;" }, @@ -1229,7 +1262,7 @@ TestSuite.prototype.testStepOut = function() this._performSteps([ { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 3, lineText: " debugger;" }, @@ -1237,7 +1270,7 @@ TestSuite.prototype.testStepOut = function() document.getElementById("scripts-step-out").click(); }, { - functionsOnStack: ["a","(anonymous function)"], + functionsOnStack: ["a",""], lineNumber: 8, lineText: " printResult(result);" }, @@ -1262,7 +1295,7 @@ TestSuite.prototype.testStepIn = function() this._performSteps([ { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 3, lineText: " debugger;" }, @@ -1270,7 +1303,7 @@ TestSuite.prototype.testStepIn = function() document.getElementById("scripts-step-over").click(); }, { - functionsOnStack: ["d","a","(anonymous function)"], + functionsOnStack: ["d","a",""], lineNumber: 5, lineText: " var y = fact(10);" }, @@ -1278,7 +1311,7 @@ TestSuite.prototype.testStepIn = function() document.getElementById("scripts-step-into").click(); }, { - functionsOnStack: ["fact","d","a","(anonymous function)"], + functionsOnStack: ["fact","d","a",""], lineNumber: 10, lineText: " var r = 1;" }, @@ -1440,7 +1473,7 @@ TestSuite.prototype.testExpandScope = function() this._waitForScriptPause( { - functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"], + functionsOnStack: ["innerFunction", "handleClick", ""], lineNumber: 8, lineText: " debugger;" }, @@ -1463,14 +1496,14 @@ TestSuite.prototype.testExpandScope = function() properties: { x:"2009", innerFunctionLocalVar:"2011", - "this": "global", + "this": (window.v8ScriptDebugServerEnabled ? "DOMWindow" : "global"), } }, { title: "Closure", properties: { - n:"TextParam", - makeClosureLocalVar:"local.TextParam", + n: (window.v8ScriptDebugServerEnabled ? '"TextParam"' : "TextParam"), + makeClosureLocalVar: (window.v8ScriptDebugServerEnabled ? '"local.TextParam"' : "local.TextParam"), } }, { @@ -1554,7 +1587,7 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() this._waitForScriptPause( { - functionsOnStack: ["callDebugger", "handleClick", "(anonymous function)"], + functionsOnStack: ["callDebugger", "handleClick", ""], lineNumber: 29, lineText: " debugger;" }, @@ -1574,6 +1607,15 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() } function examineLocalScope() { + if (window.v8ScriptDebugServerEnabled) { + var scopeExpectations = [ + "a", "Child", [ + "constructor", "function Child(n) {", null, + "parentField", "10", null, + "childField", "20", null, + ] + ]; + } else { var scopeExpectations = [ "a", "Object", [ "constructor", "function Child()", [ @@ -1606,13 +1648,14 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() "childField", 20, null, ] ]; + } checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations); } var propQueue = []; var index = 0; - var expectedFinalIndex = 8; + var expectedFinalIndex = (window.v8ScriptDebugServerEnabled ? 1 : 8); function expandAndCheckNextProperty() { if (index === propQueue.length) { |