diff options
author | Iain Merrick <husky@google.com> | 2010-08-19 17:55:56 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-08-23 11:05:40 +0100 |
commit | f486d19d62f1bc33246748b14b14a9dfa617b57f (patch) | |
tree | 195485454c93125455a30e553a73981c3816144d /WebKit/chromium/src | |
parent | 6ba0b43722d16bc295606bec39f396f596e4fef1 (diff) | |
download | external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2 |
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebKit/chromium/src')
33 files changed, 443 insertions, 1137 deletions
diff --git a/WebKit/chromium/src/ApplicationCacheHost.cpp b/WebKit/chromium/src/ApplicationCacheHost.cpp index dfd4754..3bfcfe2 100644 --- a/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -202,6 +202,15 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int done) { +#if ENABLE(INSPECTOR) + // If host's frame is main frame and inspector frontend is connected, update appcache status. + if (id != PROGRESS_EVENT && m_documentLoader->frame()) { + Page* page = m_documentLoader->frame()->page(); + if (page && page->inspectorController()->applicationCacheAgent() && page->mainFrame() == m_documentLoader->frame()) + page->inspectorController()->applicationCacheAgent()->updateApplicationCacheStatus(status()); + } +#endif + if (m_defersEvents) { // Event dispatching is deferred until document.onload has fired. m_deferredEvents.append(DeferredEvent(id, total, done)); diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index bcd7931..b93d4bb 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -45,7 +45,6 @@ #include "PasteboardPrivate.h" #include "PlatformCursor.h" #include "Settings.h" -#include "StringImpl.h" #include "TextAffinity.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" @@ -65,6 +64,7 @@ #include "WebTextCaseSensitivity.h" #include "WebView.h" #include <wtf/Assertions.h> +#include <wtf/text/StringImpl.h> #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index a43109c..5b18e82 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -41,7 +41,7 @@ #include "WebCursorInfo.h" #include "WebData.h" #include "WebDragData.h" -#include "WebFileSystem.h" +#include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebImage.h" @@ -320,28 +320,28 @@ void ChromiumBridge::prefetchDNS(const String& hostname) bool ChromiumBridge::fileExists(const String& path) { - return webKitClient()->fileSystem()->fileExists(path); + return webKitClient()->fileUtilities()->fileExists(path); } bool ChromiumBridge::deleteFile(const String& path) { - return webKitClient()->fileSystem()->deleteFile(path); + return webKitClient()->fileUtilities()->deleteFile(path); } bool ChromiumBridge::deleteEmptyDirectory(const String& path) { - return webKitClient()->fileSystem()->deleteEmptyDirectory(path); + return webKitClient()->fileUtilities()->deleteEmptyDirectory(path); } bool ChromiumBridge::getFileSize(const String& path, long long& result) { - return webKitClient()->fileSystem()->getFileSize(path, result); + return webKitClient()->fileUtilities()->getFileSize(path, result); } bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { double modificationTime; - if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) + if (!webKitClient()->fileUtilities()->getFileModificationTime(path, modificationTime)) return false; result = static_cast<time_t>(modificationTime); return true; @@ -349,62 +349,62 @@ bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) String ChromiumBridge::directoryName(const String& path) { - return webKitClient()->fileSystem()->directoryName(path); + return webKitClient()->fileUtilities()->directoryName(path); } String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) { - return webKitClient()->fileSystem()->pathByAppendingComponent(path, component); + return webKitClient()->fileUtilities()->pathByAppendingComponent(path, component); } bool ChromiumBridge::makeAllDirectories(const String& path) { - return webKitClient()->fileSystem()->makeAllDirectories(path); + return webKitClient()->fileUtilities()->makeAllDirectories(path); } String ChromiumBridge::getAbsolutePath(const String& path) { - return webKitClient()->fileSystem()->getAbsolutePath(path); + return webKitClient()->fileUtilities()->getAbsolutePath(path); } bool ChromiumBridge::isDirectory(const String& path) { - return webKitClient()->fileSystem()->isDirectory(path); + return webKitClient()->fileUtilities()->isDirectory(path); } KURL ChromiumBridge::filePathToURL(const String& path) { - return webKitClient()->fileSystem()->filePathToURL(path); + return webKitClient()->fileUtilities()->filePathToURL(path); } PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) { - return webKitClient()->fileSystem()->openFile(path, mode); + return webKitClient()->fileUtilities()->openFile(path, mode); } void ChromiumBridge::closeFile(PlatformFileHandle& handle) { - webKitClient()->fileSystem()->closeFile(handle); + webKitClient()->fileUtilities()->closeFile(handle); } long long ChromiumBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) { - return webKitClient()->fileSystem()->seekFile(handle, offset, origin); + return webKitClient()->fileUtilities()->seekFile(handle, offset, origin); } bool ChromiumBridge::truncateFile(PlatformFileHandle handle, long long offset) { - return webKitClient()->fileSystem()->truncateFile(handle, offset); + return webKitClient()->fileUtilities()->truncateFile(handle, offset); } int ChromiumBridge::readFromFile(PlatformFileHandle handle, char* data, int length) { - return webKitClient()->fileSystem()->readFromFile(handle, data, length); + return webKitClient()->fileUtilities()->readFromFile(handle, data, length); } int ChromiumBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) { - return webKitClient()->fileSystem()->writeToFile(handle, data, length); + return webKitClient()->fileUtilities()->writeToFile(handle, data, length); } // Font ----------------------------------------------------------------------- diff --git a/WebKit/chromium/src/DebuggerAgentManager.cpp b/WebKit/chromium/src/DebuggerAgentManager.cpp index 1df7172..dfc186c 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -50,10 +50,6 @@ bool DebuggerAgentManager::s_inHostDispatchHandler = false; DebuggerAgentManager::DeferrersMap DebuggerAgentManager::s_pageDeferrers; -bool DebuggerAgentManager::s_inUtilityContext = false; - -bool DebuggerAgentManager::s_debugBreakDelayed = false; - bool DebuggerAgentManager::s_exposeV8DebuggerProtocol = false; namespace { @@ -208,28 +204,20 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) return; } - if (s_inUtilityContext && message.GetEvent() == v8::Break) { - // This may happen when two tabs are being debugged in the same process. - // Suppose that first debugger is pauesed on an exception. It will run - // nested MessageLoop which may process Break request from the second - // debugger. - s_debugBreakDelayed = true; - } else { - // If the context is from one of the inpected tabs or injected extension - // scripts it must have hostId in the data field. - int hostId = WebCore::V8Proxy::contextDebugId(context); - if (hostId != -1) { - DebuggerAgentImpl* agent = debuggerAgentForHostId(hostId); - if (agent) { - if (agent->autoContinueOnException() - && message.GetEvent() == v8::Exception) { - sendContinueCommandToV8(); - return; - } - - agent->debuggerOutput(out); + // If the context is from one of the inpected tabs or injected extension + // scripts it must have hostId in the data field. + int hostId = WebCore::V8Proxy::contextDebugId(context); + if (hostId != -1) { + DebuggerAgentImpl* agent = debuggerAgentForHostId(hostId); + if (agent) { + if (agent->autoContinueOnException() + && message.GetEvent() == v8::Exception) { + sendContinueCommandToV8(); return; } + + agent->debuggerOutput(out); + return; } } @@ -242,10 +230,7 @@ void DebuggerAgentManager::onV8DebugMessage(const v8::Debug::Message& message) void DebuggerAgentManager::pauseScript() { - if (s_inUtilityContext) - s_debugBreakDelayed = true; - else - v8::Debug::DebugBreak(); + v8::Debug::DebugBreak(); } void DebuggerAgentManager::executeDebuggerCommand(const WTF::String& command, int callerId) diff --git a/WebKit/chromium/src/DebuggerAgentManager.h b/WebKit/chromium/src/DebuggerAgentManager.h index 300cada..66bd714 100644 --- a/WebKit/chromium/src/DebuggerAgentManager.h +++ b/WebKit/chromium/src/DebuggerAgentManager.h @@ -80,23 +80,6 @@ public: static void onNavigate(); - class UtilityContextScope : public Noncopyable { - public: - UtilityContextScope() - { - ASSERT(!s_inUtilityContext); - s_inUtilityContext = true; - } - ~UtilityContextScope() - { - if (s_debugBreakDelayed) { - v8::Debug::DebugBreak(); - s_debugBreakDelayed = false; - } - s_inUtilityContext = false; - } - }; - private: DebuggerAgentManager(); ~DebuggerAgentManager(); @@ -118,8 +101,6 @@ private: typedef HashMap<WebViewImpl*, WebCore::PageGroupLoadDeferrer*> DeferrersMap; static DeferrersMap s_pageDeferrers; - static bool s_inUtilityContext; - static bool s_debugBreakDelayed; static bool s_exposeV8DebuggerProtocol; }; diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b416e35..74186bf 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -37,6 +37,7 @@ #include "FormState.h" #include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameView.h" #include "HTTPParsers.h" #include "HistoryItem.h" #include "HitTestResult.h" @@ -49,6 +50,7 @@ #include "PlatformString.h" #include "PluginData.h" #include "PluginDataChromium.h" +#include "Settings.h" #include "StringExtras.h" #include "WebDataSourceImpl.h" #include "WebDevToolsAgentPrivate.h" @@ -246,7 +248,12 @@ void FrameLoaderClientImpl::detachedFromParent3() // go to a page and then navigate to a new page without getting any asserts // or crashes. m_webFrame->frame()->script()->proxy()->clearForClose(); - + + // Alert the client that the frame is being detached. This is the last + // chance we have to communicate with the client. + if (m_webFrame->client()) + m_webFrame->client()->frameDetached(m_webFrame); + // Stop communicating with the WebFrameClient at this point since we are no // longer associated with the Page. m_webFrame->setClient(0); @@ -1390,6 +1397,14 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( if (!webPlugin->initialize(container.get())) return 0; + if (m_webFrame->frame()->view()->zoomFactor() != 1) { + // There's a saved zoom level, so tell the plugin about it since + // WebViewImpl::setZoomLevel was called before the plugin was created. + webPlugin->setZoomFactor( + m_webFrame->frame()->view()->zoomFactor(), + m_webFrame->frame()->page()->settings()->zoomMode() == ZoomTextOnly); + } + // The element might have been removed during plugin initialization! if (!element->renderer()) return 0; diff --git a/WebKit/chromium/src/FrameNetworkingContextImpl.h b/WebKit/chromium/src/FrameNetworkingContextImpl.h new file mode 100644 index 0000000..8670506 --- /dev/null +++ b/WebKit/chromium/src/FrameNetworkingContextImpl.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef FrameNetworkingContextImpl_h +#define FrameNetworkingContextImpl_h + +#include "FrameNetworkingContext.h" + +namespace WebKit { + +class FrameNetworkingContextImpl : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextImpl> create(WebCore::Frame* frame) + { + return adoptRef(new FrameNetworkingContextImpl(frame)); + } + +private: + FrameNetworkingContextImpl(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } +}; + +} + +#endif diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 5b5afef..0f672a3 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -85,9 +85,6 @@ namespace WebCore { //---------------------------------------------------------------------- // GraphicsContext3DInternal -// Uncomment this to render to a separate window for debugging -// #define RENDER_TO_DEBUGGING_WINDOW - class GraphicsContext3DInternal { public: GraphicsContext3DInternal(); @@ -105,8 +102,7 @@ public: void reshape(int width, int height); void paintRenderingResultsToCanvas(CanvasRenderingContext* context); - void beginPaint(CanvasRenderingContext* context); - void endPaint(); + bool paintsIntoCanvasBuffer() const; void prepareTexture(); @@ -300,6 +296,7 @@ public: void deleteTexture(unsigned); void synthesizeGLError(unsigned long error); + bool supportsBGRA(); private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; @@ -452,17 +449,10 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon #endif } -void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext* context) +bool GraphicsContext3DInternal::paintsIntoCanvasBuffer() const { // If the gpu compositor is on then skip the readback and software rendering path. - if (m_webViewImpl->isAcceleratedCompositingActive()) - return; - - paintRenderingResultsToCanvas(context); -} - -void GraphicsContext3DInternal::endPaint() -{ + return !m_webViewImpl->isAcceleratedCompositingActive(); } void GraphicsContext3DInternal::reshape(int width, int height) @@ -910,6 +900,7 @@ DELEGATE_TO_IMPL_1(deleteShader, unsigned) DELEGATE_TO_IMPL_1(deleteTexture, unsigned) DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long) +DELEGATE_TO_IMPL_R(supportsBGRA, bool) //---------------------------------------------------------------------- // GraphicsContext3D @@ -1226,8 +1217,11 @@ DELEGATE_TO_INTERNAL_6(vertexAttribPointer, unsigned long, int, int, bool, unsig DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*) -DELEGATE_TO_INTERNAL_1(beginPaint, CanvasRenderingContext*) -DELEGATE_TO_INTERNAL(endPaint) + +bool GraphicsContext3D::paintsIntoCanvasBuffer() const +{ + return m_internal->paintsIntoCanvasBuffer(); +} DELEGATE_TO_INTERNAL_R(createBuffer, unsigned) DELEGATE_TO_INTERNAL_R(createFramebuffer, unsigned) @@ -1244,6 +1238,7 @@ DELEGATE_TO_INTERNAL_1(deleteShader, unsigned) DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned) DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long) +DELEGATE_TO_INTERNAL_R(supportsBGRA, bool) bool GraphicsContext3D::isGLES2Compliant() const { diff --git a/WebKit/chromium/src/SpeechInputClientImpl.cpp b/WebKit/chromium/src/SpeechInputClientImpl.cpp index 66525e3..9c59bae 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -51,41 +51,45 @@ SpeechInputClientImpl::~SpeechInputClientImpl() { } -bool SpeechInputClientImpl::startRecognition(WebCore::SpeechInputListener* listener) +void SpeechInputClientImpl::setListener(WebCore::SpeechInputListener* listener) { m_listener = listener; - return m_controller->startRecognition(); } -void SpeechInputClientImpl::stopRecording() +bool SpeechInputClientImpl::startRecognition(int requestId) { ASSERT(m_listener); - m_controller->stopRecording(); + return m_controller->startRecognition(requestId); } -void SpeechInputClientImpl::cancelRecognition() +void SpeechInputClientImpl::stopRecording(int requestId) { ASSERT(m_listener); - m_controller->cancelRecognition(); + m_controller->stopRecording(requestId); } -void SpeechInputClientImpl::didCompleteRecording() +void SpeechInputClientImpl::cancelRecognition(int requestId) { ASSERT(m_listener); - m_listener->didCompleteRecording(); + m_controller->cancelRecognition(requestId); } -void SpeechInputClientImpl::didCompleteRecognition() +void SpeechInputClientImpl::didCompleteRecording(int requestId) { ASSERT(m_listener); - m_listener->didCompleteRecognition(); - m_listener = 0; + m_listener->didCompleteRecording(requestId); } -void SpeechInputClientImpl::setRecognitionResult(const WebString& result) +void SpeechInputClientImpl::didCompleteRecognition(int requestId) { ASSERT(m_listener); - m_listener->setRecognitionResult(result); + m_listener->didCompleteRecognition(requestId); +} + +void SpeechInputClientImpl::setRecognitionResult(int requestId, const WebString& result) +{ + ASSERT(m_listener); + m_listener->setRecognitionResult(requestId, result); } } // namespace WebKit diff --git a/WebKit/chromium/src/SpeechInputClientImpl.h b/WebKit/chromium/src/SpeechInputClientImpl.h index 5762da8..0ab54c1 100644 --- a/WebKit/chromium/src/SpeechInputClientImpl.h +++ b/WebKit/chromium/src/SpeechInputClientImpl.h @@ -53,18 +53,19 @@ public: virtual ~SpeechInputClientImpl(); // SpeechInputClient methods. - bool startRecognition(WebCore::SpeechInputListener*); - void stopRecording(); - void cancelRecognition(); + void setListener(WebCore::SpeechInputListener*); + bool startRecognition(int); + void stopRecording(int); + void cancelRecognition(int); // WebSpeechInputListener methods. - void didCompleteRecording(); - void setRecognitionResult(const WebString&); - void didCompleteRecognition(); + void didCompleteRecording(int); + void setRecognitionResult(int, const WebString&); + void didCompleteRecognition(int); private: WebSpeechInputController* m_controller; // To call into the embedder. - WebCore::SpeechInputListener* m_listener; // Valid when recognition is in progress. + WebCore::SpeechInputListener* m_listener; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebAnimationControllerImpl.cpp b/WebKit/chromium/src/WebAnimationControllerImpl.cpp index 32a7a61..15df140 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.cpp +++ b/WebKit/chromium/src/WebAnimationControllerImpl.cpp @@ -87,4 +87,24 @@ unsigned WebAnimationControllerImpl::numberOfActiveAnimations() const return controller->numberOfActiveAnimations(); } +void WebAnimationControllerImpl::suspendAnimations() const +{ + AnimationController* controller = animationController(); + if (!controller) + return; + if (!m_frameImpl->frame()) + return; + controller->suspendAnimations(m_frameImpl->frame()->document()); +} + +void WebAnimationControllerImpl::resumeAnimations() const +{ + AnimationController* controller = animationController(); + if (!controller) + return; + if (!m_frameImpl->frame()) + return; + controller->resumeAnimations(m_frameImpl->frame()->document()); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebAnimationControllerImpl.h b/WebKit/chromium/src/WebAnimationControllerImpl.h index 66dfe98..62b89f0 100644 --- a/WebKit/chromium/src/WebAnimationControllerImpl.h +++ b/WebKit/chromium/src/WebAnimationControllerImpl.h @@ -52,6 +52,8 @@ public: const WebString& propertyName, double time); virtual unsigned numberOfActiveAnimations() const; + virtual void suspendAnimations() const; + virtual void resumeAnimations() const; private: WebFrameImpl* m_frameImpl; WebCore::AnimationController* animationController() const; diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 4de5624..f4b1a86 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -36,6 +36,7 @@ #include "InjectedScriptHost.h" #include "InspectorBackendDispatcher.h" #include "InspectorController.h" +#include "InspectorValues.h" #include "Page.h" #include "PageGroup.h" #include "PlatformString.h" @@ -63,7 +64,11 @@ using WebCore::DocumentLoader; using WebCore::FrameLoader; using WebCore::InjectedScriptHost; +using WebCore::InspectorArray; +using WebCore::InspectorBackendDispatcher; using WebCore::InspectorController; +using WebCore::InspectorObject; +using WebCore::InspectorValue; using WebCore::Node; using WebCore::Page; using WebCore::ResourceError; @@ -232,7 +237,7 @@ void WebDevToolsAgentImpl::detach() void WebDevToolsAgentImpl::frontendLoaded() { inspectorController()->connectFrontend(); - m_client->runtimeFeatureStateChanged(kFrontendConnectedFeatureName, true); + m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, "true"); } void WebDevToolsAgentImpl::didNavigate() @@ -263,17 +268,22 @@ void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& feature, bool enabled) { - if (feature == kApuAgentFeatureName) - setApuAgentEnabled(enabled); - else if (feature == kTimelineFeatureName) - setTimelineProfilingEnabled(enabled); - else if (feature == kResourceTrackingFeatureName) { + setRuntimeProperty(feature, enabled ? String("true") : String("false")); +} + +void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebString& value) +{ + if (name == kApuAgentFeatureName) + setApuAgentEnabled(value == "true"); + else if (name == kTimelineFeatureName) + setTimelineProfilingEnabled(value == "true"); + else if (name == kResourceTrackingFeatureName) { InspectorController* ic = inspectorController(); - if (enabled) + if (value == "true") ic->enableResourceTracking(false /* not sticky */, false /* no reload */); else ic->disableResourceTracking(false /* not sticky */); - } else if (feature == kFrontendConnectedFeatureName && enabled && !inspectorController()->hasFrontend()) + } else if (name == kFrontendConnectedFeatureName && value == "true" && !inspectorController()->hasFrontend()) frontendLoaded(); } @@ -282,6 +292,8 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) m_apuAgentEnabled = enabled; InspectorController* ic = inspectorController(); if (enabled) { + if (!ic->hasFrontend()) + frontendLoaded(); m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); ic->startTimelineProfiler(); if (!m_resourceTrackingWasEnabled) { @@ -296,9 +308,9 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) ic->disableResourceTracking(false); m_resourceTrackingWasEnabled = false; } - m_client->runtimeFeatureStateChanged( + m_client->runtimePropertyChanged( kApuAgentFeatureName, - enabled); + enabled ? String("true") : String("false")); } WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() @@ -412,22 +424,22 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message) void WebDevToolsAgentImpl::resourceTrackingWasEnabled() { - m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, true); + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true"); } void WebDevToolsAgentImpl::resourceTrackingWasDisabled() { - m_client->runtimeFeatureStateChanged(kResourceTrackingFeatureName, false); + m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false"); } void WebDevToolsAgentImpl::timelineProfilerWasStarted() { - m_client->runtimeFeatureStateChanged(kTimelineFeatureName, true); + m_client->runtimePropertyChanged(kTimelineFeatureName, "true"); } void WebDevToolsAgentImpl::timelineProfilerWasStopped() { - m_client->runtimeFeatureStateChanged(kTimelineFeatureName, false); + m_client->runtimePropertyChanged(kTimelineFeatureName, "false"); } void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script) @@ -455,6 +467,43 @@ void WebDevToolsAgent::debuggerPauseScript() DebuggerAgentManager::pauseScript(); } +void WebDevToolsAgent::interruptAndDispatch(MessageDescriptor* d) +{ + class DebuggerTask : public WebCore::ScriptDebugServer::Task { + public: + DebuggerTask(WebDevToolsAgent::MessageDescriptor* descriptor) : m_descriptor(descriptor) { } + virtual ~DebuggerTask() { } + virtual void run() + { + if (WebDevToolsAgent* webagent = m_descriptor->agent()) + webagent->dispatchOnInspectorBackend(m_descriptor->message()); + } + private: + OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; + }; + WebCore::ScriptDebugServer::interruptAndRun(new DebuggerTask(d)); +} + +bool WebDevToolsAgent::shouldInterruptForMessage(const WebString& message) +{ + String commandName; + if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) + return false; + return commandName == InspectorBackendDispatcher::pauseCmd + || commandName == InspectorBackendDispatcher::setBreakpointCmd + || commandName == InspectorBackendDispatcher::removeBreakpointCmd + || commandName == InspectorBackendDispatcher::activateBreakpointsCmd + || commandName == InspectorBackendDispatcher::deactivateBreakpointsCmd + || commandName == InspectorBackendDispatcher::startProfilingCmd + || commandName == InspectorBackendDispatcher::stopProfilingCmd + || commandName == InspectorBackendDispatcher::getProfileCmd; +} + +void WebDevToolsAgent::processPendingMessages() +{ + WebCore::ScriptDebugServer::shared().runPendingTasks(); +} + void WebDevToolsAgent::setMessageLoopDispatchHandler(MessageLoopDispatchHandler handler) { DebuggerAgentManager::setMessageLoopDispatchHandler(handler); diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index a0d2647..73b8a1e 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -77,6 +77,7 @@ public: virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); virtual void setRuntimeFeatureEnabled(const WebString& feature, bool enabled); + virtual void setRuntimeProperty(const WebString& name, const WebString& value); virtual void setTimelineProfilingEnabled(bool enable); virtual void identifierForInitialRequest(unsigned long, WebFrame*, const WebURLRequest&); diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index c1b09c4..905bc6d 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -100,17 +100,6 @@ WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( // Put each DevTools frontend Page into its own (single page) group so that it's not // deferred along with the inspected page. m_webViewImpl->page()->setGroupName(String()); - - WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); - v8::HandleScope scope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); - - // Debugger commands should be sent using special method. - BoundObject debuggerCommandExecutorObj(frameContext, this, "RemoteDebuggerCommandExecutor"); - debuggerCommandExecutorObj.addProtoFunction( - "DebuggerPauseScript", - WebDevToolsFrontendImpl::jsDebuggerPauseScript); - debuggerCommandExecutorObj.build(); } WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() @@ -123,7 +112,7 @@ void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& messa v8::HandleScope scope; v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); v8::Context::Scope contextScope(frameContext); - v8::Handle<v8::Value> dispatchFunction = frameContext->Global()->Get(v8::String::New("devtools$$dispatch")); + v8::Handle<v8::Value> dispatchFunction = frameContext->Global()->Get(v8::String::New("WebInspector_syncDispatch")); ASSERT(dispatchFunction->IsFunction()); v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); Vector< v8::Handle<v8::Value> > args; @@ -138,11 +127,4 @@ void WebDevToolsFrontendImpl::frontendLoaded() m_client->sendFrontendLoaded(); } -v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerPauseScript(const v8::Arguments& args) -{ - WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); - frontend->m_client->sendDebuggerPauseScript(); - return v8::Undefined(); -} - } // namespace WebKit diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/WebKit/chromium/src/WebDevToolsFrontendImpl.h index e4f22fe..bde906f 100644 --- a/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -70,8 +70,6 @@ public: void frontendLoaded(); private: - static v8::Handle<v8::Value> jsDebuggerPauseScript(const v8::Arguments& args); - WebKit::WebViewImpl* m_webViewImpl; WebKit::WebDevToolsFrontendClient* m_client; String m_applicationLocale; diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp index 30b619b..2e05d52 100644 --- a/WebKit/chromium/src/WebEntities.cpp +++ b/WebKit/chromium/src/WebEntities.cpp @@ -33,6 +33,7 @@ #include <string.h> +#include "HTMLEntityTable.h" #include "PlatformString.h" #include "StringBuilder.h" #include <wtf/HashMap.h> @@ -41,59 +42,51 @@ using namespace WebCore; +namespace WebKit { + namespace { -// 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 -// namespace to prevent name collisions. -#include "HTMLEntityNames.cpp" // NOLINT -} -namespace WebKit { +void populateMapFromXMLEntities(WTF::HashMap<int, WTF::String>& map) +{ + ASSERT(map.isEmpty()); + map.set(0x003c, "lt"); + map.set(0x003e, "gt"); + map.set(0x0026, "amp"); + map.set(0x0027, "apos"); + map.set(0x0022, "quot"); +} -void populateMap(WTF::HashMap<int, WTF::String>& map, - const Entity* entities, - size_t entitiesCount, - bool standardHTML) +void populateMapFromHTMLEntityTable(WTF::HashMap<int, WTF::String>& map) { ASSERT(map.isEmpty()); - const Entity* entity = &entities[0]; - for (size_t i = 0; i < entitiesCount; i++, entity++) { - int code = entity->code; - String name = entity->name; - // For consistency, use the lowe case for entities that have both. - if (map.contains(code) && map.get(code) == name.lower()) + const HTMLEntityTableEntry* entry = HTMLEntityTable::firstEntry(); + const HTMLEntityTableEntry* end = HTMLEntityTable::lastEntry() + 1; + for (; entry != end; ++entry) { + String entity = entry->entity; + int value = entry->value; + ASSERT(value && !entity.isEmpty()); + if (entity[entity.length() - 1] != ';') + continue; // We want the canonical version that ends in ; + // For consistency, use the lower case for entities that have both. + if (map.contains(value) && map.get(value) == entity.lower()) continue; - // Don't register %, ⊅ and &supl;. - if (standardHTML && (code == '%' || code == 0x2285 || code == 0x00b9)) + // Don't register %, ⊅ and &supl; for some unknown reason. + if (value == '%' || value == 0x2285 || value == 0x00b9) continue; - map.set(code, name); + map.set(value, entity); } - if (standardHTML) - map.set(static_cast<int>(0x0027), String("#39")); + // We add #39 for some unknown reason. + map.set(0x0027, String("#39")); } -static const Entity xmlBuiltInEntityCodes[] = { - { "lt", 0x003c }, - { "gt", 0x003e }, - { "amp", 0x0026 }, - { "apos", 0x0027 }, - { "quot", 0x0022 } -}; +} WebEntities::WebEntities(bool xmlEntities) { if (xmlEntities) - populateMap(m_entitiesMap, - xmlBuiltInEntityCodes, - sizeof(xmlBuiltInEntityCodes) / sizeof(Entity), - false); + populateMapFromXMLEntities(m_entitiesMap); else - populateMap(m_entitiesMap, - wordlist, - sizeof(wordlist) / sizeof(Entity), - true); + populateMapFromHTMLEntityTable(m_entitiesMap); } String WebEntities::entityNameByCode(int code) const diff --git a/WebKit/chromium/src/WebEntities.h b/WebKit/chromium/src/WebEntities.h index a01cc5d..f210566 100644 --- a/WebKit/chromium/src/WebEntities.h +++ b/WebKit/chromium/src/WebEntities.h @@ -36,6 +36,7 @@ namespace WebKit { +// FIXME: This class is wrong and needs to be removed. class WebEntities { public: // ', %, ⊅, &supl; are not defined by the HTML standards. diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 410ac3b..a863862 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -34,81 +34,16 @@ #include "WebGraphicsContext3DDefaultImpl.h" +#include "app/gfx/gl/gl_bindings.h" +#include "app/gfx/gl/gl_context.h" #include "NotImplemented.h" +#include <wtf/PassOwnPtr.h> #include <stdio.h> #include <string.h> -#if OS(LINUX) -#include <dlfcn.h> -#endif - namespace WebKit { -// Uncomment this to render to a separate window for debugging -// #define RENDER_TO_DEBUGGING_WINDOW - -#if OS(DARWIN) -#define USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER -#endif - -bool WebGraphicsContext3DDefaultImpl::s_initializedGLEW = false; - -#if OS(LINUX) -WebGraphicsContext3DDefaultImpl::GLConnection* WebGraphicsContext3DDefaultImpl::s_gl = 0; - -WebGraphicsContext3DDefaultImpl::GLConnection* WebGraphicsContext3DDefaultImpl::GLConnection::create() -{ - Display* dpy = XOpenDisplay(0); - if (!dpy) { - printf("GraphicsContext3D: error opening X display\n"); - return 0; - } - - // We use RTLD_GLOBAL semantics so that GLEW initialization works; - // GLEW expects to be able to open the current process's handle - // and do dlsym's of GL entry points from there. - void* libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!libGL) { - XCloseDisplay(dpy); - printf("GraphicsContext3D: error opening libGL.so.1: %s\n", dlerror()); - return 0; - } - - PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) dlsym(libGL, "glXChooseFBConfig"); - PFNGLXCREATENEWCONTEXTPROC createNewContext = (PFNGLXCREATENEWCONTEXTPROC) dlsym(libGL, "glXCreateNewContext"); - PFNGLXCREATEPBUFFERPROC createPbuffer = (PFNGLXCREATEPBUFFERPROC) dlsym(libGL, "glXCreatePbuffer"); - PFNGLXDESTROYPBUFFERPROC destroyPbuffer = (PFNGLXDESTROYPBUFFERPROC) dlsym(libGL, "glXDestroyPbuffer"); - PFNGLXMAKECURRENTPROC makeCurrent = (PFNGLXMAKECURRENTPROC) dlsym(libGL, "glXMakeCurrent"); - PFNGLXDESTROYCONTEXTPROC destroyContext = (PFNGLXDESTROYCONTEXTPROC) dlsym(libGL, "glXDestroyContext"); - PFNGLXGETCURRENTCONTEXTPROC getCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC) dlsym(libGL, "glXGetCurrentContext"); - if (!chooseFBConfig || !createNewContext || !createPbuffer - || !destroyPbuffer || !makeCurrent || !destroyContext - || !getCurrentContext) { - XCloseDisplay(dpy); - dlclose(libGL); - printf("GraphicsContext3D: error looking up bootstrapping entry points\n"); - return 0; - } - return new GLConnection(dpy, - libGL, - chooseFBConfig, - createNewContext, - createPbuffer, - destroyPbuffer, - makeCurrent, - destroyContext, - getCurrentContext); -} - -WebGraphicsContext3DDefaultImpl::GLConnection::~GLConnection() -{ - XCloseDisplay(m_display); - dlclose(m_libGL); -} - -#endif // OS(LINUX) - WebGraphicsContext3DDefaultImpl::VertexAttribPointerState::VertexAttribPointerState() : enabled(false) , buffer(0) @@ -134,20 +69,6 @@ WebGraphicsContext3DDefaultImpl::WebGraphicsContext3DDefaultImpl() , m_scanline(0) #endif , m_boundArrayBuffer(0) -#if OS(WINDOWS) - , m_canvasWindow(0) - , m_canvasDC(0) - , m_contextObj(0) -#elif PLATFORM(CG) - , m_pbuffer(0) - , m_contextObj(0) - , m_renderOutput(0) -#elif OS(LINUX) - , m_contextObj(0) - , m_pbuffer(0) -#else -#error Must port to your platform -#endif { } @@ -155,7 +76,7 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() { if (m_initialized) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias) { glDeleteRenderbuffersEXT(1, &m_multisampleColorBuffer); if (m_attributes.depth || m_attributes.stencil) @@ -171,220 +92,19 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() delete[] m_scanline; #endif glDeleteFramebuffersEXT(1, &m_fbo); -#endif // !RENDER_TO_DEBUGGING_WINDOW -#if OS(WINDOWS) - wglewMakeCurrent(0, 0); - wglewDeleteContext(m_contextObj); - ReleaseDC(m_canvasWindow, m_canvasDC); - DestroyWindow(m_canvasWindow); -#elif PLATFORM(CG) - CGLSetCurrentContext(0); - CGLDestroyContext(m_contextObj); - CGLDestroyPBuffer(m_pbuffer); - if (m_renderOutput) - delete[] m_renderOutput; -#elif OS(LINUX) - s_gl->makeCurrent(0, 0); - s_gl->destroyContext(m_contextObj); - s_gl->destroyPbuffer(m_pbuffer); -#else -#error Must port to your platform -#endif - m_contextObj = 0; + + m_glContext->Destroy(); } } bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) { -#if OS(WINDOWS) - if (!s_initializedGLEW) { - // Do this only the first time through. - if (!wglewInit()) { - printf("WebGraphicsContext3DDefaultImpl: wglewInit failed\n"); - return false; - } - } - - WNDCLASS wc; - if (!GetClassInfo(GetModuleHandle(0), L"CANVASGL", &wc)) { - ZeroMemory(&wc, sizeof(WNDCLASS)); - wc.style = CS_OWNDC; - wc.hInstance = GetModuleHandle(0); - wc.lpfnWndProc = DefWindowProc; - wc.lpszClassName = L"CANVASGL"; - - if (!RegisterClass(&wc)) { - printf("WebGraphicsContext3DDefaultImpl: RegisterClass failed\n"); - return false; - } - } - - m_canvasWindow = CreateWindow(L"CANVASGL", L"CANVASGL", - WS_CAPTION, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, 0, 0, GetModuleHandle(0), 0); - if (!m_canvasWindow) { - printf("WebGraphicsContext3DDefaultImpl: CreateWindow failed\n"); - return false; - } - - // get the device context - m_canvasDC = GetDC(m_canvasWindow); - if (!m_canvasDC) { - printf("WebGraphicsContext3DDefaultImpl: GetDC failed\n"); - return false; - } - - // find default pixel format - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR)); - pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - pfd.nVersion = 1; -#ifdef RENDER_TO_DEBUGGING_WINDOW - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; -#else - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; -#endif - int pixelformat = ChoosePixelFormat(m_canvasDC, &pfd); - - // set the pixel format for the dc - if (!SetPixelFormat(m_canvasDC, pixelformat, &pfd)) { - printf("WebGraphicsContext3DDefaultImpl: SetPixelFormat failed\n"); - return false; - } - - // create rendering context - m_contextObj = wglewCreateContext(m_canvasDC); - if (!m_contextObj) { - printf("WebGraphicsContext3DDefaultImpl: wglCreateContext failed\n"); - return false; - } - - if (!wglewMakeCurrent(m_canvasDC, m_contextObj)) { - printf("WebGraphicsContext3DDefaultImpl: wglMakeCurrent failed\n"); - return false; - } - -#ifdef RENDER_TO_DEBUGGING_WINDOW - typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); - PFNWGLSWAPINTERVALEXTPROC setSwapInterval = 0; - setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglewGetProcAddress("wglSwapIntervalEXT"); - if (setSwapInterval) - setSwapInterval(1); -#endif // RENDER_TO_DEBUGGING_WINDOW - -#elif PLATFORM(CG) - // Create a 1x1 pbuffer and associated context to bootstrap things - CGLPixelFormatAttribute attribs[] = { - (CGLPixelFormatAttribute) kCGLPFAPBuffer, - (CGLPixelFormatAttribute) 0 - }; - CGLPixelFormatObj pixelFormat; - GLint numPixelFormats; - if (CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats) != kCGLNoError) { - printf("WebGraphicsContext3DDefaultImpl: error choosing pixel format\n"); - return false; - } - if (!pixelFormat) { - printf("WebGraphicsContext3DDefaultImpl: no pixel format selected\n"); - return false; - } - CGLContextObj context; - CGLError res = CGLCreateContext(pixelFormat, 0, &context); - CGLDestroyPixelFormat(pixelFormat); - if (res != kCGLNoError) { - printf("WebGraphicsContext3DDefaultImpl: error creating context\n"); + if (!gfx::GLContext::InitializeOneOff()) return false; - } - CGLPBufferObj pbuffer; - if (CGLCreatePBuffer(1, 1, GL_TEXTURE_2D, GL_RGBA, 0, &pbuffer) != kCGLNoError) { - CGLDestroyContext(context); - printf("WebGraphicsContext3DDefaultImpl: error creating pbuffer\n"); - return false; - } - if (CGLSetPBuffer(context, pbuffer, 0, 0, 0) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("WebGraphicsContext3DDefaultImpl: error attaching pbuffer to context\n"); - return false; - } - if (CGLSetCurrentContext(context) != kCGLNoError) { - CGLDestroyContext(context); - CGLDestroyPBuffer(pbuffer); - printf("WebGraphicsContext3DDefaultImpl: error making context current\n"); - return false; - } - m_pbuffer = pbuffer; - m_contextObj = context; -#elif OS(LINUX) - if (!s_gl) { - s_gl = GLConnection::create(); - if (!s_gl) - return false; - } - - int configAttrs[] = { - GLX_DRAWABLE_TYPE, - GLX_PBUFFER_BIT, - GLX_RENDER_TYPE, - GLX_RGBA_BIT, - GLX_DOUBLEBUFFER, - 0, - 0 - }; - int nelements = 0; - GLXFBConfig* config = s_gl->chooseFBConfig(0, configAttrs, &nelements); - if (!config) { - printf("WebGraphicsContext3DDefaultImpl: glXChooseFBConfig failed\n"); - return false; - } - if (!nelements) { - printf("WebGraphicsContext3DDefaultImpl: glXChooseFBConfig returned 0 elements\n"); - XFree(config); - return false; - } - GLXContext context = s_gl->createNewContext(config[0], GLX_RGBA_TYPE, 0, True); - if (!context) { - printf("WebGraphicsContext3DDefaultImpl: glXCreateNewContext failed\n"); - XFree(config); - return false; - } - int pbufferAttrs[] = { - GLX_PBUFFER_WIDTH, - 1, - GLX_PBUFFER_HEIGHT, - 1, - 0 - }; - GLXPbuffer pbuffer = s_gl->createPbuffer(config[0], pbufferAttrs); - XFree(config); - if (!pbuffer) { - printf("WebGraphicsContext3DDefaultImpl: glxCreatePbuffer failed\n"); + + m_glContext = WTF::adoptPtr(gfx::GLContext::CreateOffscreenGLContext(0)); + if (!m_glContext) return false; - } - if (!s_gl->makeCurrent(pbuffer, context)) { - printf("WebGraphicsContext3DDefaultImpl: glXMakeCurrent failed\n"); - return false; - } - m_contextObj = context; - m_pbuffer = pbuffer; -#else -#error Must port to your platform -#endif - - if (!s_initializedGLEW) { - // Initialize GLEW and check for GL 2.0 support by the drivers. - GLenum glewInitResult = glewInit(); - if (glewInitResult != GLEW_OK) { - printf("WebGraphicsContext3DDefaultImpl: GLEW initialization failed\n"); - return false; - } - if (!glewIsSupported("GL_VERSION_2_0")) { - printf("WebGraphicsContext3DDefaultImpl: OpenGL 2.0 not supported\n"); - return false; - } - s_initializedGLEW = true; - } m_attributes = attributes; validateAttributes(); @@ -423,22 +143,7 @@ void WebGraphicsContext3DDefaultImpl::validateAttributes() bool WebGraphicsContext3DDefaultImpl::makeContextCurrent() { -#if OS(WINDOWS) - if (wglewGetCurrentContext() != m_contextObj) - if (wglewMakeCurrent(m_canvasDC, m_contextObj)) - return true; -#elif PLATFORM(CG) - if (CGLGetCurrentContext() != m_contextObj) - if (CGLSetCurrentContext(m_contextObj) == kCGLNoError) - return true; -#elif OS(LINUX) - if (s_gl->getCurrentContext() != m_contextObj) - if (s_gl->makeCurrent(m_pbuffer, m_contextObj)) - return true; -#else -#error Must port to your platform -#endif - return false; + return m_glContext->MakeCurrent(); } int WebGraphicsContext3DDefaultImpl::width() @@ -500,23 +205,12 @@ static int createTextureObject(GLenum target) void WebGraphicsContext3DDefaultImpl::reshape(int width, int height) { -#ifdef RENDER_TO_DEBUGGING_WINDOW - SetWindowPos(m_canvasWindow, HWND_TOP, 0, 0, width, height, - SWP_NOMOVE); - ShowWindow(m_canvasWindow, SW_SHOW); -#endif - m_cachedWidth = width; m_cachedHeight = height; makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW -#ifdef USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER - // GL_TEXTURE_RECTANGLE_ARB is the best supported render target on Mac OS X - GLenum target = GL_TEXTURE_RECTANGLE_ARB; -#else GLenum target = GL_TEXTURE_2D; -#endif + if (!m_texture) { // Generate the texture object m_texture = createTextureObject(target); @@ -658,7 +352,6 @@ void WebGraphicsContext3DDefaultImpl::reshape(int width, int height) if (mustRestoreFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif // RENDER_TO_DEBUGGING_WINDOW #ifdef FLIP_FRAMEBUFFER_VERTICALLY if (m_scanline) { @@ -700,9 +393,6 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, makeContextCurrent(); -#ifdef RENDER_TO_DEBUGGING_WINDOW - SwapBuffers(m_canvasDC); -#else // Earlier versions of this code used the GPU to flip the // framebuffer vertically before reading it back for compositing // via software. This code was quite complicated, used a lot of @@ -732,13 +422,9 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, mustRestorePackAlignment = true; } -#if PLATFORM(SKIA) + // FIXME: OpenGL ES 2 does not support GL_BGRA so this fails when + // using that backend. glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels); -#elif PLATFORM(CG) - glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels); -#else -#error Must port to your platform -#endif if (mustRestorePackAlignment) glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); @@ -751,7 +437,6 @@ bool WebGraphicsContext3DDefaultImpl::readBackFramebuffer(unsigned char* pixels, flipVertically(pixels, m_cachedWidth, m_cachedHeight); #endif -#endif // RENDER_TO_DEBUGGING_WINDOW return true; } @@ -760,6 +445,14 @@ void WebGraphicsContext3DDefaultImpl::synthesizeGLError(unsigned long error) m_syntheticErrors.add(error); } +bool WebGraphicsContext3DDefaultImpl::supportsBGRA() +{ + // Supported since OpenGL 1.2. However, glTexImage2D() must be modified + // to translate the internalFormat from GL_BGRA to GL_RGBA, since the + // former is not accepted by desktop GL. Return false until this is done. + return false; +} + // Helper macros to reduce the amount of code. #define DELEGATE_TO_GL(name, glname) \ @@ -916,38 +609,36 @@ void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long long x, long y, unsigned long width, unsigned long height, long border) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } -#endif + glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } void WebGraphicsContext3DDefaultImpl::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { makeContextCurrent(); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } -#endif + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } DELEGATE_TO_GL_1(cullFace, CullFace, unsigned long) @@ -1242,11 +933,11 @@ DELEGATE_TO_GL_1R(isBuffer, IsBuffer, WebGLId, bool) DELEGATE_TO_GL_1R(isEnabled, IsEnabled, unsigned long, bool) -DELEGATE_TO_GL_1R(isFramebuffer, IsFramebuffer, WebGLId, bool) +DELEGATE_TO_GL_1R(isFramebuffer, IsFramebufferEXT, WebGLId, bool) DELEGATE_TO_GL_1R(isProgram, IsProgram, WebGLId, bool) -DELEGATE_TO_GL_1R(isRenderbuffer, IsRenderbuffer, WebGLId, bool) +DELEGATE_TO_GL_1R(isRenderbuffer, IsRenderbufferEXT, WebGLId, bool) DELEGATE_TO_GL_1R(isShader, IsShader, WebGLId, bool) @@ -1266,7 +957,6 @@ void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long w // 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(); -#ifndef RENDER_TO_DEBUGGING_WINDOW if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) { glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); @@ -1274,12 +964,11 @@ void WebGraphicsContext3DDefaultImpl::readPixels(long x, long y, unsigned long w glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); glFlush(); } -#endif + glReadPixels(x, y, width, height, format, type, pixels); -#ifndef RENDER_TO_DEBUGGING_WINDOW + if (m_attributes.antialias && m_boundFBO == m_multisampleFBO) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -#endif } void WebGraphicsContext3DDefaultImpl::releaseShaderCompiler() @@ -1431,7 +1120,7 @@ unsigned WebGraphicsContext3DDefaultImpl::createBuffer() { makeContextCurrent(); GLuint o; - glGenBuffers(1, &o); + glGenBuffersARB(1, &o); return o; } @@ -1470,7 +1159,7 @@ unsigned WebGraphicsContext3DDefaultImpl::createTexture() void WebGraphicsContext3DDefaultImpl::deleteBuffer(unsigned buffer) { makeContextCurrent(); - glDeleteBuffers(1, &buffer); + glDeleteBuffersARB(1, &buffer); } void WebGraphicsContext3DDefaultImpl::deleteFramebuffer(unsigned framebuffer) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index 8223a1c..cf5f5b4 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -36,25 +36,14 @@ #include "WebGraphicsContext3D.h" #include <wtf/ListHashSet.h> +#include <wtf/OwnPtr.h> -#if OS(WINDOWS) -#include <windows.h> -#endif - -#include "GL/glew.h" -#if OS(WINDOWS) -#include "GL/wglew.h" -#endif - -#if PLATFORM(CG) -#include <OpenGL/OpenGL.h> -#else +#if !PLATFORM(CG) #define FLIP_FRAMEBUFFER_VERTICALLY #endif - -#if OS(LINUX) -#include "GL/glxew.h" -#endif +namespace gfx { +class GLContext; +} namespace WebKit { @@ -88,6 +77,7 @@ public: virtual void prepareTexture(); virtual void synthesizeGLError(unsigned long error); + virtual bool supportsBGRA(); virtual void activeTexture(unsigned long texture); virtual void attachShader(WebGLId program, WebGLId shader); @@ -323,103 +313,7 @@ private: // Errors raised by synthesizeGLError(). ListHashSet<unsigned long> m_syntheticErrors; - static bool s_initializedGLEW; -#if OS(WINDOWS) - HWND m_canvasWindow; - HDC m_canvasDC; - HGLRC m_contextObj; -#elif PLATFORM(CG) - CGLPBufferObj m_pbuffer; - CGLContextObj m_contextObj; - unsigned char* m_renderOutput; -#elif OS(LINUX) - GLXContext m_contextObj; - GLXPbuffer m_pbuffer; - - // In order to avoid problems caused by linking against libGL, we - // dynamically look up all the symbols we need. - // http://code.google.com/p/chromium/issues/detail?id=16800 - class GLConnection { - public: - ~GLConnection(); - - static GLConnection* create(); - - GLXFBConfig* chooseFBConfig(int screen, const int *attrib_list, int *nelements) - { - return m_glXChooseFBConfig(m_display, screen, attrib_list, nelements); - } - - GLXContext createNewContext(GLXFBConfig config, int renderType, GLXContext shareList, Bool direct) - { - return m_glXCreateNewContext(m_display, config, renderType, shareList, direct); - } - - GLXPbuffer createPbuffer(GLXFBConfig config, const int *attribList) - { - return m_glXCreatePbuffer(m_display, config, attribList); - } - - void destroyPbuffer(GLXPbuffer pbuf) - { - m_glXDestroyPbuffer(m_display, pbuf); - } - - Bool makeCurrent(GLXDrawable drawable, GLXContext ctx) - { - return m_glXMakeCurrent(m_display, drawable, ctx); - } - - void destroyContext(GLXContext ctx) - { - m_glXDestroyContext(m_display, ctx); - } - - GLXContext getCurrentContext() - { - return m_glXGetCurrentContext(); - } - - private: - Display* m_display; - void* m_libGL; - PFNGLXCHOOSEFBCONFIGPROC m_glXChooseFBConfig; - PFNGLXCREATENEWCONTEXTPROC m_glXCreateNewContext; - PFNGLXCREATEPBUFFERPROC m_glXCreatePbuffer; - PFNGLXDESTROYPBUFFERPROC m_glXDestroyPbuffer; - typedef Bool (* PFNGLXMAKECURRENTPROC)(Display* dpy, GLXDrawable drawable, GLXContext ctx); - PFNGLXMAKECURRENTPROC m_glXMakeCurrent; - typedef void (* PFNGLXDESTROYCONTEXTPROC)(Display* dpy, GLXContext ctx); - PFNGLXDESTROYCONTEXTPROC m_glXDestroyContext; - typedef GLXContext (* PFNGLXGETCURRENTCONTEXTPROC)(void); - PFNGLXGETCURRENTCONTEXTPROC m_glXGetCurrentContext; - - GLConnection(Display* display, - void* libGL, - PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig, - PFNGLXCREATENEWCONTEXTPROC createNewContext, - PFNGLXCREATEPBUFFERPROC createPbuffer, - PFNGLXDESTROYPBUFFERPROC destroyPbuffer, - PFNGLXMAKECURRENTPROC makeCurrent, - PFNGLXDESTROYCONTEXTPROC destroyContext, - PFNGLXGETCURRENTCONTEXTPROC getCurrentContext) - : m_libGL(libGL) - , m_display(display) - , m_glXChooseFBConfig(chooseFBConfig) - , m_glXCreateNewContext(createNewContext) - , m_glXCreatePbuffer(createPbuffer) - , m_glXDestroyPbuffer(destroyPbuffer) - , m_glXMakeCurrent(makeCurrent) - , m_glXDestroyContext(destroyContext) - , m_glXGetCurrentContext(getCurrentContext) - { - } - }; - - static GLConnection* s_gl; -#else - #error Must port WebGraphicsContext3DDefaultImpl to your platform -#endif + OwnPtr<gfx::GLContext> m_glContext; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebIDBKey.cpp b/WebKit/chromium/src/WebIDBKey.cpp index 1c4c685..413a9e6 100644 --- a/WebKit/chromium/src/WebIDBKey.cpp +++ b/WebKit/chromium/src/WebIDBKey.cpp @@ -30,7 +30,12 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBBindingUtilities.h" #include "IDBKey.h" +#include "IDBKeyPath.h" +#include "SerializedScriptValue.h" +#include "WebIDBKeyPath.h" +#include "WebSerializedScriptValue.h" using namespace WebCore; @@ -50,6 +55,13 @@ WebIDBKey WebIDBKey::createInvalid() return key; } +WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) +{ + if (serializedScriptValue.isNull()) + return WebIDBKey::createInvalid(); + return WebCore::createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); +} + void WebIDBKey::assign(const WebIDBKey& value) { m_private = value.m_private; diff --git a/WebKit/chromium/src/WebIDBKeyPath.cpp b/WebKit/chromium/src/WebIDBKeyPath.cpp new file mode 100644 index 0000000..9eb33d6 --- /dev/null +++ b/WebKit/chromium/src/WebIDBKeyPath.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebIDBKeyPath.h" + +#if ENABLE(INDEXED_DATABASE) + +#include "IDBKeyPath.h" +#include "WebString.h" +#include "WebVector.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath) +{ + WTF::Vector<IDBKeyPathElement> idbElements; + IDBKeyPathParseError idbError; + IDBParseKeyPath(keyPath, idbElements, idbError); + return WebIDBKeyPath(idbElements, static_cast<int>(idbError)); +} + +WebIDBKeyPath::WebIDBKeyPath(const WTF::Vector<IDBKeyPathElement>& elements, int parseError) + : m_private(new WTF::Vector<IDBKeyPathElement>(elements)) + , m_parseError(parseError) +{ +} + +int WebIDBKeyPath::parseError() const +{ + return m_parseError; +} + +void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath) +{ + m_parseError = keyPath.m_parseError; + m_private.reset(new WTF::Vector<IDBKeyPathElement>(keyPath)); +} + +void WebIDBKeyPath::reset() +{ + m_private.reset(0); +} + +WebIDBKeyPath::operator const WTF::Vector<WebCore::IDBKeyPathElement, 0>&() const +{ + return *m_private.get(); +} + +} // namespace WebKit + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index 1d717ea..786d573 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "WebKit.h" -#include "AtomicString.h" #include "DOMTimer.h" #include "Logging.h" #include "Page.h" @@ -43,6 +42,7 @@ #include <wtf/Assertions.h> #include <wtf/Threading.h> +#include <wtf/text/AtomicString.h> namespace WebKit { diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 38d91df..6aa8439 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -113,6 +113,11 @@ WebString WebNotification::replaceId() const return m_private->replaceId(); } +void WebNotification::detachPresenter() +{ + m_private->detachPresenter(); +} + void WebNotification::dispatchDisplayEvent() { RefPtr<Event> event = Event::create("display", false, true); diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h index 03f0a3b..a7f2fb4 100644 --- a/WebKit/chromium/src/WebPageSerializerImpl.h +++ b/WebKit/chromium/src/WebPageSerializerImpl.h @@ -32,10 +32,10 @@ #define WebPageSerializerImpl_h #include "PlatformString.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> #include "StringBuilder.h" #include "WebEntities.h" diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp index 6b04320..57e3635 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -46,6 +46,12 @@ WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( : m_webcoreMock(new WebCore::SpeechInputClientMock()) , m_listener(listener) { + m_webcoreMock->setListener(this); +} + +WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() +{ + m_webcoreMock->setListener(0); } void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& result) @@ -53,34 +59,34 @@ void WebSpeechInputControllerMockImpl::setMockRecognitionResult(const WebString& m_webcoreMock->setRecognitionResult(result); } -void WebSpeechInputControllerMockImpl::didCompleteRecording() +void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) { - m_listener->didCompleteRecording(); + m_listener->didCompleteRecording(requestId); } -void WebSpeechInputControllerMockImpl::didCompleteRecognition() +void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) { - m_listener->didCompleteRecognition(); + m_listener->didCompleteRecognition(requestId); } -void WebSpeechInputControllerMockImpl::setRecognitionResult(const WTF::String& result) +void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WTF::String& result) { - m_listener->setRecognitionResult(result); + m_listener->setRecognitionResult(requestId, result); } -bool WebSpeechInputControllerMockImpl::startRecognition() +bool WebSpeechInputControllerMockImpl::startRecognition(int requestId) { - return m_webcoreMock->startRecognition(this); + return m_webcoreMock->startRecognition(requestId); } -void WebSpeechInputControllerMockImpl::cancelRecognition() +void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) { - m_webcoreMock->cancelRecognition(); + m_webcoreMock->cancelRecognition(requestId); } -void WebSpeechInputControllerMockImpl::stopRecording() +void WebSpeechInputControllerMockImpl::stopRecording(int requestId) { - m_webcoreMock->stopRecording(); + m_webcoreMock->stopRecording(requestId); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h index 046abf3..38a15df 100644 --- a/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h @@ -47,16 +47,17 @@ class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener , public WebSpeechInputControllerMock { public: WebSpeechInputControllerMockImpl(WebSpeechInputListener*); + virtual ~WebSpeechInputControllerMockImpl(); // WebCore::SpeechInputListener methods. - void didCompleteRecording(); - void didCompleteRecognition(); - void setRecognitionResult(const WTF::String& result); + void didCompleteRecording(int requestId); + void didCompleteRecognition(int requestId); + void setRecognitionResult(int requestId, const WTF::String& result); // WebSpeechInputController methods. - bool startRecognition(); - void cancelRecognition(); - void stopRecording(); + bool startRecognition(int requestId); + void cancelRecognition(int requestId); + void stopRecording(int requestId); // WebSpeechInputControllerMock methods. void setMockRecognitionResult(const WebString& result); diff --git a/WebKit/chromium/src/WebString.cpp b/WebKit/chromium/src/WebString.cpp index bbbe9ce..a091ef4 100644 --- a/WebKit/chromium/src/WebString.cpp +++ b/WebKit/chromium/src/WebString.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebString.h" -#include "AtomicString.h" #include "PlatformString.h" #include <wtf/text/CString.h> +#include <wtf/text/AtomicString.h> #include "WebCString.h" diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 8733a2a..62b20d5 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -1949,8 +1949,14 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + + // FIXME: Current callers always want the level to be "author". It probably makes sense to let + // callers specify this though, since in other cases the caller will probably want "user" level. + // + // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns.release(), 0, - static_cast<UserContentInjectedFrames>(injectIn)); + static_cast<UserContentInjectedFrames>(injectIn), + UserStyleSheet::AuthorLevel); } void WebView::removeAllUserContent() diff --git a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index dc46b07..f8a1386 100644 --- a/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -45,12 +45,15 @@ namespace { -gint getDoubleClickTime() +bool countsAsDoubleClick(gint timeDiff, gint xDiff, gint yDiff) { static GtkSettings* settings = gtk_settings_get_default(); gint doubleClickTime = 250; - g_object_get(G_OBJECT(settings), "gtk-double-click-time", &doubleClickTime, NULL); - return doubleClickTime; + gint doubleClickDistance = 5; + g_object_get(G_OBJECT(settings), + "gtk-double-click-time", &doubleClickTime, + "gtk-double-click-distance", &doubleClickDistance, 0); + return timeDiff <= doubleClickTime && abs(xDiff) <= doubleClickDistance && abs(yDiff) <= doubleClickDistance; } } // namespace @@ -404,9 +407,13 @@ WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventButton* event) static int numClicks = 0; static GdkWindow* eventWindow = 0; static gint lastLeftClickTime = 0; + static gint lastLeftClickX = 0; + static gint lastLeftClickY = 0; - gint time_diff = event->time - lastLeftClickTime; - if (eventWindow == event->window && time_diff < getDoubleClickTime()) + gint timeDiff = event->time - lastLeftClickTime; + gint xDiff = event->x - lastLeftClickX; + gint yDiff = event->y - lastLeftClickY; + if (eventWindow == event->window && countsAsDoubleClick(timeDiff, xDiff, yDiff)) numClicks++; else numClicks = 1; @@ -414,6 +421,8 @@ WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventButton* event) result.clickCount = numClicks; eventWindow = event->window; lastLeftClickTime = event->time; + lastLeftClickX = event->x; + lastLeftClickY = event->y; } result.button = WebMouseEvent::ButtonNone; diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 895c68b..0fd66c9 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -34,22 +34,6 @@ * DevTools frontend together. It is also responsible for overriding existing * WebInspector functionality while it is getting upstreamed into WebCore. */ - -/** - * Dispatches raw message from the host. - * @param {string} remoteName - * @prama {string} methodName - * @param {string} param1, param2, param3 Arguments to dispatch. - */ -devtools$$dispatch = function(message) -{ - var args = typeof message === "string" ? JSON.parse(message) : message; - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - devtools.ToolsAgent = function() { this.profilerAgent_ = new devtools.ProfilerAgent(); @@ -75,30 +59,6 @@ devtools.tools = null; var context = {}; // Used by WebCore's inspector routines. -(function() { - WebInspector._paramsObject = {}; - - var queryParams = window.location.search; - if (queryParams) { - var params = queryParams.substring(1).split("&"); - for (var i = 0; i < params.length; ++i) { - var pair = params[i].split("="); - WebInspector._paramsObject[pair[0]] = pair[1]; - } - } - if ("page" in WebInspector._paramsObject) { - WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); - WebInspector.socket.onmessage = function(message) { devtools$$dispatch(message.data); } - WebInspector.socket.onerror = function(error) { console.err(error); } - WebInspector.socket.onopen = function() { - WebInspector.socketOpened = true; - if (WebInspector.loadedDone) - WebInspector.doLoadedDone(); - }; - InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); - InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); - } -})(); /////////////////////////////////////////////////////////////////////////////// // Here and below are overrides to existing WebInspector methods only. // TODO(pfeldman): Patch WebCore and upstream changes. @@ -114,24 +74,15 @@ WebInspector.loaded = function() Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; Preferences.onlineDetectionEnabled = false; - if ("page" in WebInspector._paramsObject) { - WebInspector.loadedDone = true; - if (WebInspector.socketOpened) - WebInspector.doLoadedDone(); - return; - } - WebInspector.doLoadedDone(); -} -WebInspector.doLoadedDone = function() { - oldLoaded.call(this); + oldLoaded.call(WebInspector); } devtools.domContentLoaded = function() { - WebInspector.setAttachedWindow(WebInspector._paramsObject.docked === "true"); - if (WebInspector._paramsObject.toolbar_color && WebInspector._paramsObject.text_color) - WebInspector.setToolbarColors(WebInspector._paramsObject.toolbar_color, WebInspector._paramsObject.text_color); + WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true"); + if (WebInspector.queryParamsObject.toolbar_color && WebInspector.queryParamsObject.text_color) + WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbar_color, WebInspector.queryParamsObject.text_color); } document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); @@ -243,10 +194,3 @@ WebInspector.resetToolbarColors = function() if (window.RemoteDebuggerAgent) { RemoteDebuggerAgent.setContextId = function() {}; } - - -// Support for pause while renderer is busy (is dispatched on IO thread). -InspectorBackend.pause = function() -{ - RemoteDebuggerCommandExecutor.DebuggerPauseScript(); -}; diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js deleted file mode 100644 index cda84e5..0000000 --- a/WebKit/chromium/src/js/InjectDispatch.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @fileoverview Injects "injected" object into the inspectable page. - */ - - -var InspectorControllerDispatcher = {}; - -/** - * Main dispatch method, all calls from the host to InspectorController go - * through this one. - * @param {string} functionName Function to call - * @param {string} json_args JSON-serialized call parameters. - * @return {string} JSON-serialized result of the dispatched call. - */ -InspectorControllerDispatcher.dispatch = function(functionName, json_args) -{ - var params = JSON.parse(json_args); - InspectorBackend[functionName].apply(InspectorBackend, params); -}; - -/** - * 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) { - var args = Array.prototype.slice.call(arguments); - var call = JSON.stringify(args); - DevToolsAgentHost.dispatch(call, method); -}; - -function close() { - // This method is called when InspectorFrontend closes in layout tests. -} - -function inspectedPageDestroyed() { -} diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 764f624..41574b4 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1069,25 +1069,6 @@ TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callbac /** - * Performs sequence of steps. - * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2, - * action2,...,actionN]. - */ -TestSuite.prototype._performSteps = function(actions) -{ - var test = this; - var i = 0; - function doNextAction() { - if (i > 0) - actions[i++](); - if (i < actions.length - 1) - test._waitForScriptPause(actions[i++], doNextAction); - } - doNextAction(); -}; - - -/** * Waits until all the scripts are parsed and asynchronously executes the code * in the inspected page. */ @@ -1128,131 +1109,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb /** - * Waits until all debugger scripts are parsed and executes "a()" in the - * inspected page. - */ -TestSuite.prototype._executeFunctionForStepTest = function() -{ - this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]); -}; - - -/** - * Tests step over in the debugger. - */ -TestSuite.prototype.testStepOver = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 6, - lineText: " return y;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step out in the debugger. - */ -TestSuite.prototype.testStepOut = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-out").click(); - }, - { - functionsOnStack: ["a",""], - lineNumber: 8, - lineText: " printResult(result);" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step in in the debugger. - */ -TestSuite.prototype.testStepIn = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-into").click(); - }, - { - functionsOnStack: ["fact","d","a",""], - lineNumber: 10, - lineText: " var r = 1;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** * Gets a XPathResult matching given xpath. * @param {string} xpath * @param {number} resultType @@ -1503,116 +1359,6 @@ TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) /** - * Tests that all elements in prototype chain of an object have expected - * intrinic proprties(__proto__, constructor, prototype). - */ -TestSuite.prototype.testDebugIntrinsicProperties = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]); - - this._waitForScriptPause( - { - functionsOnStack: ["callDebugger", "handleClick", ""], - lineNumber: 29, - lineText: " debugger;" - }, - expandLocalScope); - - var localScopeSection = null; - function expandLocalScope() { - test._expandScopeSections(function(sections, i) { - if (i === 0) { - test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local."); - localScopeSection = sections[i]; - return true; - } - return false; - }, - examineLocalScope); - } - - function examineLocalScope() { - var scopeExpectations = [ - "a", "Child", [ - "__proto__", "Child", [ - "__proto__", "Parent", [ - "__proto__", "Object", null, - "constructor", "function Parent(n) {", [ - "name", '"Parent"', null, - "prototype", 'Parent', [ - "parentProtoField", "11", null, - ] - ], - "parentProtoField", "11", null, - ], - "constructor", "function Child(n) {", null, - "childProtoField", "21", null, - ], - - "parentField", "10", null, - "childField", "20", null, - ] - ]; - checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations); - } - - var propQueue = []; - var index = 0; - var expectedFinalIndex = 5; - - function expandAndCheckNextProperty() { - if (index === propQueue.length) { - test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects."); - test.releaseControl(); - return; - } - - // Read next property data from the queue. - var treeElement = propQueue[index].treeElement; - var path = propQueue[index].path; - var expectations = propQueue[index].expectations; - index++; - - // Expand the property. - test._hookGetPropertiesCallback(function() { - checkProperty(treeElement, path, expectations); - }, - function() { - treeElement.expand(); - }); - } - - function checkProperty(treeElement, path, expectations) { - for (var i = 0; i < expectations.length; i += 3) { - var name = expectations[i]; - var description = expectations[i+1]; - var value = expectations[i+2]; - - var propertyPath = path + "." + name; - var propertyTreeElement = test._findChildProperty(treeElement, name, path); - test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.'); - test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.'); - if (value) { - // Schedule property content check. - propQueue.push({ - treeElement: propertyTreeElement, - path: propertyPath, - expectations: value, - }); - } - } - // Check next property in the queue. - expandAndCheckNextProperty(); - } - - test.takeControl(); -}; - - -/** * Tests "Pause" button will pause debugger when a snippet is evaluated. */ TestSuite.prototype.testPauseInEval = function() @@ -1647,101 +1393,6 @@ TestSuite.createKeyEvent = function(keyIdentifier) /** - * Tests console eval. - */ -TestSuite.prototype.testConsoleEval = function() -{ - var test = this; - this.evaluateInConsole_("123", - function(resultText) { - test.assertEquals("123", resultText); - test.releaseControl(); - }); - - this.takeControl(); -}; - - -/** - * Tests console log. - */ -TestSuite.prototype.testConsoleLog = function() -{ - WebInspector.showConsole(); - var messages = WebInspector.console.messages; - var index = 0; - - var test = this; - var assertNext = function(line, message, opt_class, opt_count, opt_substr) { - var elem = messages[index++].toMessageElement(); - var clazz = elem.getAttribute("class"); - var expectation = (opt_count || '') + 'console_test_page.html:' + line + message; - if (opt_substr) - test.assertContains(elem.textContent, expectation); - else - test.assertEquals(expectation, elem.textContent); - if (opt_class) - test.assertContains(clazz, "console-" + opt_class); - }; - - assertNext("5", "log", "log-level"); - assertNext("7", "debug", "log-level"); - assertNext("9", "info", "log-level"); - assertNext("11", "warn", "warning-level"); - assertNext("13", "error", "error-level"); - assertNext("15", "Message format number 1, 2 and 3.5"); - assertNext("17", "Message format for string"); - assertNext("19", "Object Object"); - assertNext("22", "repeated", "log-level", 5); - assertNext("26", "count: 1"); - assertNext("26", "count: 2"); - assertNext("29", "group", "group-title"); - index++; - assertNext("33", "timer:", "log-level", "", true); - assertNext("35", "1 2 3", "log-level"); - assertNext("37", "HTMLDocument", "log-level"); - assertNext("39", "<html>", "log-level", "", true); -}; - - -/** - * Tests eval of global objects. - */ -TestSuite.prototype.testEvalGlobal = function() -{ - WebInspector.showConsole(); - - var inputs = ["foo", "foobar"]; - var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"]; - - // Do not change code below - simply add inputs and expectations above. - var initEval = function(input) { - WebInspector.console.prompt.text = input; - WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter")); - }; - var test = this; - var messagesCount = 0; - var inputIndex = 0; - this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", - function(commandResult) { - messagesCount++; - if (messagesCount === expectations.length) { - var messages = WebInspector.console.messages; - for (var i = 0; i < expectations; ++i) { - var elem = messages[i++].toMessageElement(); - test.assertEquals(elem.textContent, expectations[i]); - } - test.releaseControl(); - } else if (messagesCount % 2 === 0) - initEval(inputs[inputIndex++]); - }, true); - - initEval(inputs[inputIndex++]); - this.takeControl(); -}; - - -/** * Tests the message loop re-entrancy. */ TestSuite.prototype.testMessageLoopReentrant = function() |