diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Tools/DumpRenderTree/chromium | |
parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) | |
download | qtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
25 files changed, 715 insertions, 100 deletions
diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp index f4f3aed22..8aee7c5b2 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp @@ -166,7 +166,6 @@ DRTTestRunner::DRTTestRunner(TestShell* shell) bindMethod("findString", &DRTTestRunner::findString); bindMethod("isCommandEnabled", &DRTTestRunner::isCommandEnabled); bindMethod("hasCustomPageSizeStyle", &DRTTestRunner::hasCustomPageSizeStyle); - bindMethod("layerTreeAsText", &DRTTestRunner::layerTreeAsText); bindMethod("loseCompositorContext", &DRTTestRunner::loseCompositorContext); bindMethod("markerTextForListItem", &DRTTestRunner::markerTextForListItem); bindMethod("notifyDone", &DRTTestRunner::notifyDone); @@ -1904,11 +1903,6 @@ void DRTTestRunner::startSpeechInput(const CppArgumentList& arguments, CppVarian input->startSpeechInput(); } -void DRTTestRunner::layerTreeAsText(const CppArgumentList& args, CppVariant* result) -{ - result->set(m_shell->webView()->mainFrame()->layerTreeAsText(m_showDebugLayerTree).utf8()); -} - void DRTTestRunner::loseCompositorContext(const CppArgumentList& args, CppVariant*) { int numTimes; diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h index 55940acd1..3041b86a7 100644 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h +++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h @@ -355,8 +355,6 @@ public: #endif void startSpeechInput(const CppArgumentList&, CppVariant*); - void layerTreeAsText(const CppArgumentList& args, CppVariant* result); - void loseCompositorContext(const CppArgumentList& args, CppVariant* result); void markerTextForListItem(const CppArgumentList&, CppVariant*); diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 0949aa7a6..30ce28851 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -55,6 +55,7 @@ static const char optionStartupDialog[] = "--testshell-startup-dialog"; static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps"; static const char optionHardwareAcceleratedGL[] = "--enable-hardware-gpu"; +static const char optionEnableSoftwareCompositing[] = "--enable-software-compositing"; static const char optionEnableThreadedCompositing[] = "--enable-threaded-compositing"; static const char optionForceCompositingMode[] = "--force-compositing-mode"; static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas"; @@ -125,6 +126,7 @@ int main(int argc, char* argv[]) bool allowExternalPages = false; bool startupDialog = false; bool acceleratedCompositingForVideoEnabled = false; + bool softwareCompositingEnabled = false; bool threadedCompositingEnabled = false; bool forceCompositingMode = false; bool accelerated2DCanvasEnabled = false; @@ -159,6 +161,8 @@ int main(int argc, char* argv[]) hardwareAcceleratedGL = true; else if (argument == optionEnableAcceleratedCompositingForVideo) acceleratedCompositingForVideoEnabled = true; + else if (argument == optionEnableSoftwareCompositing) + softwareCompositingEnabled = true; else if (argument == optionEnableThreadedCompositing) threadedCompositingEnabled = true; else if (argument == optionForceCompositingMode) @@ -211,6 +215,7 @@ int main(int argc, char* argv[]) TestShell shell; shell.setAllowExternalPages(allowExternalPages); shell.setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); + shell.setSoftwareCompositingEnabled(softwareCompositingEnabled); shell.setThreadedCompositingEnabled(threadedCompositingEnabled); shell.setForceCompositingMode(forceCompositingMode); shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled); diff --git a/Tools/DumpRenderTree/chromium/MockConstraints.cpp b/Tools/DumpRenderTree/chromium/MockConstraints.cpp new file mode 100644 index 000000000..a4f15842e --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockConstraints.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2012 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" +#if ENABLE(MEDIA_STREAM) + +#include "MockConstraints.h" + +#include <public/WebMediaConstraints.h> + +using namespace WebKit; + +namespace MockConstraints { + +static bool isSupported(const WebString& constraint) +{ + return constraint == "valid_and_supported_1" || constraint == "valid_and_supported_2"; +} + +static bool isValid(const WebString& constraint) +{ + return isSupported(constraint) || constraint == "valid_but_unsupported_1" || constraint == "valid_but_unsupported_2"; +} + +bool verifyConstraints(const WebMediaConstraints& constraints) +{ + WebVector<WebMediaConstraint> mandatoryConstraints; + constraints.getMandatoryConstraints(mandatoryConstraints); + if (mandatoryConstraints.size()) { + for (size_t i = 0; i < mandatoryConstraints.size(); ++i) { + const WebMediaConstraint& curr = mandatoryConstraints[i]; + if (!isSupported(curr.m_name) || curr.m_value != "1") + return false; + } + } + + WebVector<WebMediaConstraint> optionalConstraints; + constraints.getOptionalConstraints(optionalConstraints); + if (optionalConstraints.size()) { + for (size_t i = 0; i < optionalConstraints.size(); ++i) { + const WebMediaConstraint& curr = optionalConstraints[i]; + if (!isValid(curr.m_name) || curr.m_value != "0") + return false; + } + } + + return true; +} + +} // namespace MockConstraints + +#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockConstraints.h b/Tools/DumpRenderTree/chromium/MockConstraints.h new file mode 100644 index 000000000..6bf0da9b1 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockConstraints.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 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 MockConstraints_h +#define MockConstraints_h + +#if ENABLE(MEDIA_STREAM) + +namespace WebKit { +class WebMediaConstraints; +} + +namespace MockConstraints { + +bool verifyConstraints(const WebKit::WebMediaConstraints&); + +} // namespace MockConstraints + +#endif // ENABLE(MEDIA_STREAM) + +#endif // MockConstraints_h + diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp index b2d50feb3..d6e5e7f05 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp @@ -33,19 +33,25 @@ #include "MockWebRTCPeerConnectionHandler.h" +#include "MockConstraints.h" #include <public/WebMediaConstraints.h> +#include <public/WebMediaStreamComponent.h> +#include <public/WebMediaStreamDescriptor.h> #include <public/WebRTCPeerConnectionHandlerClient.h> #include <public/WebRTCSessionDescription.h> #include <public/WebRTCSessionDescriptionRequest.h> +#include <public/WebRTCStatsRequest.h> +#include <public/WebRTCStatsResponse.h> #include <public/WebRTCVoidRequest.h> #include <public/WebString.h> #include <public/WebVector.h> +#include <wtf/DateMath.h> using namespace WebKit; class RTCSessionDescriptionRequestSuccededTask : public MethodTask<MockWebRTCPeerConnectionHandler> { public: - RTCSessionDescriptionRequestSuccededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCSessionDescriptionRequest& request, const WebKit::WebRTCSessionDescription& result) + RTCSessionDescriptionRequestSuccededTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request, const WebRTCSessionDescription& result) : MethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) , m_result(result) @@ -58,13 +64,13 @@ public: } private: - WebKit::WebRTCSessionDescriptionRequest m_request; - WebKit::WebRTCSessionDescription m_result; + WebRTCSessionDescriptionRequest m_request; + WebRTCSessionDescription m_result; }; class RTCSessionDescriptionRequestFailedTask : public MethodTask<MockWebRTCPeerConnectionHandler> { public: - RTCSessionDescriptionRequestFailedTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCSessionDescriptionRequest& request) + RTCSessionDescriptionRequestFailedTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request) : MethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) { @@ -76,12 +82,31 @@ public: } private: - WebKit::WebRTCSessionDescriptionRequest m_request; + WebRTCSessionDescriptionRequest m_request; +}; + +class RTCStatsRequestSucceededTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +public: + RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request, const WebKit::WebRTCStatsResponse& response) + : MethodTask<MockWebRTCPeerConnectionHandler>(object) + , m_request(request) + , m_response(response) + { + } + + virtual void runIfValid() OVERRIDE + { + m_request.requestSucceeded(m_response); + } + +private: + WebKit::WebRTCStatsRequest m_request; + WebKit::WebRTCStatsResponse m_response; }; class RTCVoidRequestTask : public MethodTask<MockWebRTCPeerConnectionHandler> { public: - RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCVoidRequest& request, bool succeeded) + RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, const WebRTCVoidRequest& request, bool succeeded) : MethodTask<MockWebRTCPeerConnectionHandler>(object) , m_request(request) , m_succeeded(succeeded) @@ -97,56 +122,107 @@ public: } private: - WebKit::WebRTCVoidRequest m_request; + WebRTCVoidRequest m_request; bool m_succeeded; }; +class StringDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +public: + StringDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const WebString& data) + : MethodTask<MockWebRTCPeerConnectionHandler>(object) + , m_dataChannel(dataChannel) + , m_data(data) + { + } + + virtual void runIfValid() OVERRIDE + { + m_dataChannel.dataArrived(m_data); + } + +private: + WebRTCDataChannel m_dataChannel; + WebString m_data; +}; + +class CharPtrDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +public: + CharPtrDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const char* data, size_t length) + : MethodTask<MockWebRTCPeerConnectionHandler>(object) + , m_dataChannel(dataChannel) + , m_length(length) + { + m_data = new char[m_length]; + memcpy(m_data, data, m_length); + } + + virtual void runIfValid() OVERRIDE + { + m_dataChannel.dataArrived(m_data, m_length); + delete m_data; + } + +private: + WebRTCDataChannel m_dataChannel; + char* m_data; + size_t m_length; +}; + +class DataChannelReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +public: + DataChannelReadyStateTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, WebRTCDataChannel::ReadyState state) + : MethodTask<MockWebRTCPeerConnectionHandler>(object) + , m_dataChannel(dataChannel) + , m_state(state) + { + } + + virtual void runIfValid() OVERRIDE + { + m_dataChannel.readyStateChanged(m_state); + } + +private: + WebRTCDataChannel m_dataChannel; + WebRTCDataChannel::ReadyState m_state; +}; + +class RTCPeerConnectionReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> { +public: + RTCPeerConnectionReadyStateTask(MockWebRTCPeerConnectionHandler* object, WebRTCPeerConnectionHandlerClient* client, WebRTCPeerConnectionHandlerClient::ReadyState state) + : MethodTask<MockWebRTCPeerConnectionHandler>(object) + , m_client(client) + , m_state(state) + { + } + + virtual void runIfValid() OVERRIDE + { + m_client->didChangeReadyState(m_state); + } + +private: + WebRTCPeerConnectionHandlerClient* m_client; + WebRTCPeerConnectionHandlerClient::ReadyState m_state; +}; + ///////////////////// MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client) : m_client(client) + , m_stopped(false) + , m_streamCount(0) { } -static bool isSupportedConstraint(const WebString& constraint) -{ - return constraint == "valid_and_supported_1" || constraint == "valid_and_supported_2"; -} - -static bool isValidConstraint(const WebString& constraint) -{ - return isSupportedConstraint(constraint) || constraint == "valid_but_unsupported_1" || constraint == "valid_but_unsupported_2"; -} - bool MockWebRTCPeerConnectionHandler::initialize(const WebRTCConfiguration&, const WebMediaConstraints& constraints) { - WebVector<WebString> mandatoryConstraintNames; - constraints.getMandatoryConstraintNames(mandatoryConstraintNames); - if (mandatoryConstraintNames.size()) { - for (size_t i = 0; i < mandatoryConstraintNames.size(); ++i) { - if (!isSupportedConstraint(mandatoryConstraintNames[i])) - return false; - WebString value; - constraints.getMandatoryConstraintValue(mandatoryConstraintNames[i], value); - if (value != "1") - return false; - } - } - - WebVector<WebString> optionalConstraintNames; - constraints.getOptionalConstraintNames(optionalConstraintNames); - if (optionalConstraintNames.size()) { - for (size_t i = 0; i < optionalConstraintNames.size(); ++i) { - if (!isValidConstraint(optionalConstraintNames[i])) - return false; - WebString value; - constraints.getOptionalConstraintValue(optionalConstraintNames[i], value); - if (value != "0") - return false; - } + if (MockConstraints::verifyConstraints(constraints)) { + postTask(new RTCPeerConnectionReadyStateTask(this, m_client, WebRTCPeerConnectionHandlerClient::ReadyStateActive)); + return true; } - return true; + return false; } void MockWebRTCPeerConnectionHandler::createOffer(const WebRTCSessionDescriptionRequest& request, const WebMediaConstraints& constraints) @@ -212,6 +288,7 @@ bool MockWebRTCPeerConnectionHandler::addICECandidate(const WebRTCICECandidate& bool MockWebRTCPeerConnectionHandler::addStream(const WebMediaStreamDescriptor& stream, const WebMediaConstraints&) { + m_streamCount += 1; m_client->didAddRemoteStream(stream); m_client->negotiationNeeded(); return true; @@ -219,12 +296,70 @@ bool MockWebRTCPeerConnectionHandler::addStream(const WebMediaStreamDescriptor& void MockWebRTCPeerConnectionHandler::removeStream(const WebMediaStreamDescriptor& stream) { + m_streamCount -= 1; m_client->didRemoveRemoteStream(stream); m_client->negotiationNeeded(); } +void MockWebRTCPeerConnectionHandler::getStats(const WebRTCStatsRequest& request) +{ + WebRTCStatsResponse response = request.createResponse(); + double currentDate = WTF::jsCurrentTime(); + if (request.hasSelector()) { + WebMediaStreamDescriptor stream = request.stream(); + WebMediaStreamComponent component = request.component(); + // FIXME: There is no check that the fetched values are valid. + size_t reportIndex = response.addReport(); + response.addElement(reportIndex, true, currentDate); + response.addStatistic(reportIndex, true, "type", "video"); + } else { + for (int i = 0; i < m_streamCount; ++i) { + size_t reportIndex = response.addReport(); + response.addElement(reportIndex, true, currentDate); + response.addStatistic(reportIndex, true, "type", "audio"); + reportIndex = response.addReport(); + response.addElement(reportIndex, true, currentDate); + response.addStatistic(reportIndex, true, "type", "video"); + } + } + postTask(new RTCStatsRequestSucceededTask(this, request, response)); +} + void MockWebRTCPeerConnectionHandler::stop() { + m_stopped = true; +} + +bool MockWebRTCPeerConnectionHandler::openDataChannel(const WebRTCDataChannel& dataChannel) +{ + if (m_stopped) + return false; + + postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateOpen)); + return true; +} + +void MockWebRTCPeerConnectionHandler::closeDataChannel(const WebRTCDataChannel& dataChannel) +{ + postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateClosed)); +} + +bool MockWebRTCPeerConnectionHandler::sendStringData(const WebRTCDataChannel& dataChannel, const WebString& data) +{ + if (m_stopped) + return false; + + postTask(new StringDataTask(this, dataChannel, data)); + return true; +} + +bool MockWebRTCPeerConnectionHandler::sendRawData(const WebRTCDataChannel& dataChannel, const char* data, size_t length) +{ + if (m_stopped) + return false; + + postTask(new CharPtrDataTask(this, dataChannel, data, length)); + return true; } #endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h index 2bf139afa..0e3448f21 100644 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h +++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h @@ -34,9 +34,11 @@ #if ENABLE(MEDIA_STREAM) #include "Task.h" +#include <public/WebRTCDataChannel.h> #include <public/WebRTCPeerConnectionHandler.h> #include <public/WebRTCSessionDescription.h> #include <public/WebRTCSessionDescriptionRequest.h> +#include <public/WebRTCStatsRequest.h> namespace WebKit { class WebRTCPeerConnectionHandlerClient; @@ -58,8 +60,14 @@ public: virtual bool addICECandidate(const WebKit::WebRTCICECandidate&) OVERRIDE; virtual bool addStream(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaConstraints&) OVERRIDE; virtual void removeStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; + virtual void getStats(const WebKit::WebRTCStatsRequest&) OVERRIDE; virtual void stop() OVERRIDE; + virtual bool openDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE; + virtual bool sendStringData(const WebKit::WebRTCDataChannel&, const WebKit::WebString&) OVERRIDE; + virtual bool sendRawData(const WebKit::WebRTCDataChannel&, const char*, size_t) OVERRIDE; + virtual void closeDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE; + // Task related methods TaskList* taskList() { return &m_taskList; } @@ -67,9 +75,11 @@ private: MockWebRTCPeerConnectionHandler() { } WebKit::WebRTCPeerConnectionHandlerClient* m_client; + bool m_stopped; TaskList m_taskList; WebKit::WebRTCSessionDescription m_localDescription; WebKit::WebRTCSessionDescription m_remoteDescription; + int m_streamCount; }; #endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp index 716222f9a..13c8ff1ec 100644 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp +++ b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp @@ -52,7 +52,7 @@ void MockWebSpeechInputController::addMockRecognitionResult(const WebString& res String langString = String::fromUTF8(language.utf8().data()); if (!m_recognitionResults.contains(langString)) m_recognitionResults.set(langString, Vector<WebSpeechInputResult>()); - m_recognitionResults.find(langString)->second.append(res); + m_recognitionResults.find(langString)->value.append(res); } } diff --git a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp b/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp index 0c5400f5e..a21588f74 100644 --- a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp +++ b/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp @@ -75,7 +75,7 @@ bool NotificationPresenter::simulateClick(const WebString& title) if (m_activeNotifications.find(id) == m_activeNotifications.end()) return false; - const WebNotification& notification = m_activeNotifications.find(id)->second; + const WebNotification& notification = m_activeNotifications.find(id)->value; WebNotification eventTarget(notification); eventTarget.dispatchClickEvent(); return true; @@ -89,7 +89,7 @@ bool NotificationPresenter::show(const WebNotification& notification) WTF::String replaceId(notification.replaceId().data(), notification.replaceId().length()); if (m_replacements.find(replaceId) != m_replacements.end()) printf("REPLACING NOTIFICATION %s\n", - m_replacements.find(replaceId)->second.utf8().data()); + m_replacements.find(replaceId)->value.utf8().data()); m_replacements.set(replaceId, WTF::String(identifier.data(), identifier.length())); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp index b795aeb83..d60822be8 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp @@ -221,8 +221,48 @@ static string roleToString(WebAccessibilityRole role) return result.append("HorizontalRule"); case WebAccessibilityRoleLegend: return result.append("Legend"); + case WebAccessibilityRoleApplicationAlert: + return result.append("Alert"); + case WebAccessibilityRoleApplicationAlertDialog: + return result.append("AlertDialog"); + case WebAccessibilityRoleApplicationDialog: + return result.append("ApplicationDialog"); + case WebAccessibilityRoleDirectory: + return result.append("Directory"); + case WebAccessibilityRoleDocumentMath: + return result.append("Math"); + case WebAccessibilityRoleEditableText: + return result.append("EditableText"); + case WebAccessibilityRoleFooter: + return result.append("Footer"); + case WebAccessibilityRoleIgnored: + return result.append("Ignored"); + case WebAccessibilityRoleListItem: + return result.append("ListItem"); + case WebAccessibilityRoleMenuListPopup: + return result.append("MenuListPopup"); + case WebAccessibilityRoleMenuListOption: + return result.append("MenuListOption"); + case WebAccessibilityRolePresentational: + return result.append("Presentational"); + case WebAccessibilityRoleSpinButton: + return result.append("SpinButton"); + case WebAccessibilityRoleSpinButtonPart: + return result.append("SpinButtonPart"); + case WebAccessibilityRoleTabList: + return result.append("TabList"); + case WebAccessibilityRoleTabPanel: + return result.append("TabPanel"); + case WebAccessibilityRoleTab: + return result.append("Tab"); + case WebAccessibilityRoleTreeRole: + return result.append("Tree"); + case WebAccessibilityRoleTreeGrid: + return result.append("TreeGrid"); + case WebAccessibilityRoleTreeItemRole: + return result.append("TreeItem"); + case WebAccessibilityRoleUnknown: default: - // Also matches WebAccessibilityRoleUnknown. return result.append("Unknown"); } } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp index 9b4a3b646..1b29d2b0f 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp @@ -203,10 +203,10 @@ bool CppNPObject::setProperty(NPObject* npObj, NPIdentifier ident, const NPVaria CppBoundClass::~CppBoundClass() { for (MethodList::iterator i = m_methods.begin(); i != m_methods.end(); ++i) - delete i->second; + delete i->value; for (PropertyList::iterator i = m_properties.begin(); i != m_properties.end(); ++i) - delete i->second; + delete i->value; // Unregister ourselves if we were bound to a frame. if (m_boundToFrame) @@ -237,7 +237,7 @@ bool CppBoundClass::invoke(NPIdentifier ident, } callback = m_fallbackCallback.get(); } else - callback = (*method).second; + callback = (*method).value; // Build a CppArgumentList argument vector from the NPVariants coming in. CppArgumentList cppArguments(argumentCount); @@ -260,7 +260,7 @@ bool CppBoundClass::getProperty(NPIdentifier ident, NPVariant* result) const } CppVariant cppValue; - if (!callback->second->getValue(&cppValue)) + if (!callback->value->getValue(&cppValue)) return false; cppValue.copyToNPVariant(result); return true; @@ -274,7 +274,7 @@ bool CppBoundClass::setProperty(NPIdentifier ident, const NPVariant* value) CppVariant cppValue; cppValue.set(*value); - return (*callback).second->setValue(cppValue); + return (*callback).value->setValue(cppValue); } void CppBoundClass::bindCallback(const string& name, Callback* callback) @@ -282,7 +282,7 @@ void CppBoundClass::bindCallback(const string& name, Callback* callback) NPIdentifier ident = WebBindings::getStringIdentifier(name.c_str()); MethodList::iterator oldCallback = m_methods.find(ident); if (oldCallback != m_methods.end()) { - delete oldCallback->second; + delete oldCallback->value; if (!callback) { m_methods.remove(oldCallback); return; @@ -309,7 +309,7 @@ void CppBoundClass::bindProperty(const string& name, PropertyCallback* callback) NPIdentifier ident = WebBindings::getStringIdentifier(name.c_str()); PropertyList::iterator oldCallback = m_properties.find(ident); if (oldCallback != m_properties.end()) { - delete oldCallback->second; + delete oldCallback->value; if (!callback) { m_properties.remove(oldCallback); return; diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index e5e9ded6a..32585faa1 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -108,6 +108,7 @@ TestShell::TestShell() , m_dumpPixelsForCurrentTest(false) , m_allowExternalPages(false) , m_acceleratedCompositingForVideoEnabled(false) + , m_softwareCompositingEnabled(false) , m_threadedCompositingEnabled(false) , m_forceCompositingMode(false) , m_accelerated2dCanvasEnabled(false) @@ -399,7 +400,7 @@ static string dumpFramesAsText(WebFrame* frame, bool recursive) // Add header for all but the main frame. Skip empty frames. if (frame->parent() && !frame->document().documentElement().isNull()) { result.append("\n--------\nFrame: '"); - result.append(frame->name().utf8().data()); + result.append(frame->uniqueName().utf8().data()); result.append("'\n--------\n"); } @@ -425,7 +426,7 @@ static string dumpFramesAsPrintedText(WebFrame* frame, bool recursive) // Add header for all but the main frame. Skip empty frames. if (frame->parent() && !frame->document().documentElement().isNull()) { result.append("\n--------\nFrame: '"); - result.append(frame->name().utf8().data()); + result.append(frame->uniqueName().utf8().data()); result.append("'\n--------\n"); } @@ -445,7 +446,7 @@ static void dumpFrameScrollPosition(WebFrame* frame, bool recursive) WebSize offset = frame->scrollOffset(); if (offset.width > 0 || offset.height > 0) { if (frame->parent()) - printf("frame '%s' ", frame->name().utf8().data()); + printf("frame '%s' ", frame->uniqueName().utf8().data()); printf("scrolled to %d,%d\n", offset.width, offset.height); } diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 405034a4e..44b5ae388 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -130,6 +130,8 @@ public: void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; } void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; } + bool softwareCompositingEnabled() { return m_softwareCompositingEnabled; } + void setSoftwareCompositingEnabled(bool enabled) { m_softwareCompositingEnabled = enabled; } void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; } void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; } void setAccelerated2dCanvasEnabled(bool enabled) { m_accelerated2dCanvasEnabled = enabled; } @@ -226,6 +228,7 @@ private: int m_timeout; // timeout value in millisecond bool m_allowExternalPages; bool m_acceleratedCompositingForVideoEnabled; + bool m_softwareCompositingEnabled; bool m_threadedCompositingEnabled; bool m_forceCompositingMode; bool m_accelerated2dCanvasEnabled; diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp index c78c9ed12..c54ebedea 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp @@ -33,6 +33,7 @@ #include "platform/WebKitPlatformSupport.h" #include "WebPluginContainer.h" #include "WebPluginParams.h" +#include "WebTouchPoint.h" #include <wtf/Assertions.h> #include <wtf/text/CString.h> @@ -76,16 +77,61 @@ static void premultiplyAlpha(const unsigned colorIn[3], float alpha, float color colorOut[3] = alpha; } +static const char* pointState(WebKit::WebTouchPoint::State state) +{ + switch (state) { + case WebKit::WebTouchPoint::StateReleased: + return "Released"; + case WebKit::WebTouchPoint::StatePressed: + return "Pressed"; + case WebKit::WebTouchPoint::StateMoved: + return "Moved"; + case WebKit::WebTouchPoint::StateCancelled: + return "Cancelled"; + default: + return "Unknown"; + } + + ASSERT_NOT_REACHED(); + return 0; +} + +static void printTouchList(const WebKit::WebTouchPoint* points, int length) +{ + for (int i = 0; i < length; ++i) + printf("* %d, %d: %s\n", points[i].position.x, points[i].position.y, pointState(points[i].state)); +} + +static void printEventDetails(const WebKit::WebInputEvent& event) +{ + if (WebKit::WebInputEvent::isTouchEventType(event.type)) { + const WebKit::WebTouchEvent& touch = static_cast<const WebKit::WebTouchEvent&>(event); + printTouchList(touch.touches, touch.touchesLength); + printTouchList(touch.changedTouches, touch.changedTouchesLength); + printTouchList(touch.targetTouches, touch.targetTouchesLength); + } else if (WebKit::WebInputEvent::isMouseEventType(event.type) || event.type == WebKit::WebInputEvent::MouseWheel) { + const WebKit::WebMouseEvent& mouse = static_cast<const WebKit::WebMouseEvent&>(event); + printf("* %d, %d\n", mouse.x, mouse.y); + } else if (WebKit::WebInputEvent::isGestureEventType(event.type)) { + const WebKit::WebGestureEvent& gesture = static_cast<const WebKit::WebGestureEvent&>(event); + printf("* %d, %d\n", gesture.x, gesture.y); + } +} + TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame, const WebKit::WebPluginParams& params) : m_frame(frame) , m_container(0) , m_context(0) + , m_acceptsTouchEvent(false) + , m_printEventDetails(false) { static const WebString kAttributePrimitive = WebString::fromUTF8("primitive"); static const WebString kAttributeBackgroundColor = WebString::fromUTF8("background-color"); static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primitive-color"); static const WebString kAttributeOpacity = WebString::fromUTF8("opacity"); + static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts-touch"); + static const WebString kAttributePrintEventDetails = WebString::fromUTF8("print-event-details"); ASSERT(params.attributeNames.size() == params.attributeValues.size()); size_t size = params.attributeNames.size(); @@ -101,6 +147,10 @@ TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame, parseColor(attributeValue, m_scene.primitiveColor); else if (attributeName == kAttributeOpacity) m_scene.opacity = parseOpacity(attributeValue); + else if (attributeName == kAttributeAcceptsTouch) + m_acceptsTouchEvent = parseBoolean(attributeValue); + else if (attributeName == kAttributePrintEventDetails) + m_printEventDetails = parseBoolean(attributeValue); } } @@ -129,6 +179,7 @@ bool TestWebPlugin::initialize(WebPluginContainer* container) m_container = container; m_container->setBackingTextureId(m_colorTexture); + m_container->setIsAcceptingTouchEvents(m_acceptsTouchEvent); return true; } @@ -208,6 +259,12 @@ float TestWebPlugin::parseOpacity(const WebString& string) return static_cast<float>(atof(string.utf8().data())); } +bool TestWebPlugin::parseBoolean(const WebString& string) +{ + static const WebString kPrimitiveTrue = WebString::fromUTF8("true"); + return string == kPrimitiveTrue; +} + bool TestWebPlugin::initScene() { float color[4]; @@ -407,6 +464,31 @@ bool TestWebPlugin::handleInputEvent(const WebKit::WebInputEvent& event, WebKit: } printf("Plugin received event: %s\n", eventName ? eventName : "unknown"); + if (m_printEventDetails) + printEventDetails(event); + return false; +} + +bool TestWebPlugin::handleDragStatusUpdate(WebKit::WebDragStatus dragStatus, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebPoint& position, const WebKit::WebPoint& screenPosition) +{ + const char* dragStatusName = 0; + switch (dragStatus) { + case WebKit::WebDragStatusEnter: + dragStatusName = "DragEnter"; + break; + case WebKit::WebDragStatusOver: + dragStatusName = "DragOver"; + break; + case WebKit::WebDragStatusLeave: + dragStatusName = "DragLeave"; + break; + case WebKit::WebDragStatusDrop: + dragStatusName = "DragDrop"; + break; + case WebKit::WebDragStatusUnknown: + ASSERT_NOT_REACHED(); + } + printf("Plugin received event: %s\n", dragStatusName); return false; } diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.h b/Tools/DumpRenderTree/chromium/TestWebPlugin.h index 025b11095..aa6533e32 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.h +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.h @@ -42,6 +42,9 @@ class WebGraphicsContext3D; // background-color: black (default), red, green, blue. // primitive-color: black (default), red, green, blue. // opacity: [0.0 - 1.0]. Default is 1.0. +// +// Whether the plugin accepts touch events or not can be customized using the +// 'accepts-touch' plugin parameter (defaults to false). class TestWebPlugin : public WebKit::WebPlugin { public: TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&); @@ -62,6 +65,7 @@ public: virtual void updateVisibility(bool) { } virtual bool acceptsInputEvents() { return true; } virtual bool handleInputEvent(const WebKit::WebInputEvent&, WebKit::WebCursorInfo&); + virtual bool handleDragStatusUpdate(WebKit::WebDragStatus, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebPoint& position, const WebKit::WebPoint& screenPosition); virtual void didReceiveResponse(const WebKit::WebURLResponse&) { } virtual void didReceiveData(const char* data, int dataLength) { } virtual void didFinishLoading() { } @@ -104,6 +108,7 @@ private: Primitive parsePrimitive(const WebKit::WebString&); void parseColor(const WebKit::WebString&, unsigned color[3]); float parseOpacity(const WebKit::WebString&); + bool parseBoolean(const WebKit::WebString&); // Functions for loading and drawing scene. bool initScene(); @@ -124,6 +129,9 @@ private: unsigned m_colorTexture; unsigned m_framebuffer; Scene m_scene; + + bool m_acceptsTouchEvent; + bool m_printEventDetails; }; #endif // TestPepperPlugin_h diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index 5eebf596d..3bc2cdd9f 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -156,9 +156,9 @@ typedef void (*SetFontFamilyWrapper)(WebSettings*, const WebString&, UScriptCode static void applyFontMap(WebSettings* settings, const WebPreferences::ScriptFontFamilyMap& map, SetFontFamilyWrapper setter) { for (WebPreferences::ScriptFontFamilyMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { - const WebString& font = iter->second; + const WebString& font = iter->value; if (!font.isNull() && !font.isEmpty()) - (*setter)(settings, font, static_cast<UScriptCode>(iter->first)); + (*setter)(settings, font, static_cast<UScriptCode>(iter->key)); } } diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp index a373c3b30..ed13ffa58 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp @@ -33,15 +33,41 @@ #include "WebUserMediaClientMock.h" +#include "MockConstraints.h" #include "WebDocument.h" #include "WebMediaStreamRegistry.h" #include "WebUserMediaRequest.h" -#include "platform/WebMediaStreamDescriptor.h" -#include "platform/WebMediaStreamSource.h" -#include "platform/WebVector.h" +#include <public/WebMediaConstraints.h> +#include <public/WebMediaStreamDescriptor.h> +#include <public/WebMediaStreamSource.h> +#include <public/WebVector.h> #include <wtf/Assertions.h> -namespace WebKit { +using namespace WebKit; + +class UserMediaRequestTask : public MethodTask<WebUserMediaClientMock> { +public: + UserMediaRequestTask(WebUserMediaClientMock* object, const WebUserMediaRequest& request, const WebMediaStreamDescriptor result) + : MethodTask<WebUserMediaClientMock>(object) + , m_request(request) + , m_result(result) + { + } + + virtual void runIfValid() OVERRIDE + { + if (m_result.isNull()) + m_request.requestFailed(); + else + m_request.requestSucceeded(m_result); + } + +private: + WebUserMediaRequest m_request; + WebMediaStreamDescriptor m_result; +}; + +//////////////////////////////// class MockExtraData : public WebMediaStreamDescriptor::ExtraData { public: @@ -59,7 +85,18 @@ void WebUserMediaClientMock::requestUserMedia(const WebUserMediaRequest& streamR WebUserMediaRequest request = streamRequest; if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) { - request.requestFailed(); + postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); + return; + } + + WebMediaConstraints constraints = request.audioConstraints(); + if (!constraints.isNull() && !MockConstraints::verifyConstraints(constraints)) { + postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); + return; + } + constraints = request.videoConstraints(); + if (!constraints.isNull() && !MockConstraints::verifyConstraints(constraints)) { + postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); return; } @@ -74,18 +111,16 @@ void WebUserMediaClientMock::requestUserMedia(const WebUserMediaRequest& streamR if (request.video()) videoSources[0].initialize("MockVideoDevice#1", WebMediaStreamSource::TypeVideo, "Mock video device"); - WebKit::WebMediaStreamDescriptor descriptor; - descriptor.initialize("foobar", audioSources, videoSources); + WebMediaStreamDescriptor stream; + stream.initialize("foobar", audioSources, videoSources); - descriptor.setExtraData(new MockExtraData()); + stream.setExtraData(new MockExtraData()); - request.requestSucceeded(descriptor); + postTask(new UserMediaRequestTask(this, request, stream)); } void WebUserMediaClientMock::cancelUserMediaRequest(const WebUserMediaRequest&) { } -} // namespace WebKit - #endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h index e2415985c..9e1beba4a 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h @@ -33,28 +33,30 @@ #if ENABLE(MEDIA_STREAM) +#include "Task.h" #include "WebUserMediaClient.h" -#include "platform/WebCommon.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" #include "webkit/support/test_media_stream_client.h" +#include <public/WebCommon.h> +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/PassOwnPtr.h> -namespace WebKit { - -class WebUserMediaClientMock : public WebUserMediaClient { +class WebUserMediaClientMock : public WebKit::WebUserMediaClient { public: static PassOwnPtr<WebUserMediaClientMock> create(); ~WebUserMediaClientMock() { } - virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&, const WebVector<WebMediaStreamSource>&) OVERRIDE; - virtual void cancelUserMediaRequest(const WebUserMediaRequest&); + virtual void requestUserMedia(const WebKit::WebUserMediaRequest&, const WebKit::WebVector<WebKit::WebMediaStreamSource>&, const WebKit::WebVector<WebKit::WebMediaStreamSource>&) OVERRIDE; + virtual void cancelUserMediaRequest(const WebKit::WebUserMediaRequest&); + + // Task related methods + TaskList* taskList() { return &m_taskList; } private: WebUserMediaClientMock() { } -}; -} // namespace WebKit + TaskList m_taskList; +}; #endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index f8d804e96..c7ab475e7 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -65,6 +65,7 @@ #include "WebUserMediaClientMock.h" #include "WebView.h" #include "WebViewHostOutputSurface.h" +#include "WebViewHostSoftwareOutputDevice.h" #include "WebWindowFeatures.h" #include "platform/WebSerializedScriptValue.h" #include "skia/ext/platform_canvas.h" @@ -288,11 +289,14 @@ WebStorageNamespace* WebViewHost::createSessionStorageNamespace(unsigned quota) return webkit_support::CreateSessionStorageNamespace(quota); } -WebKit::WebCompositorOutputSurface* WebViewHost::createOutputSurface() +WebCompositorOutputSurface* WebViewHost::createOutputSurface() { if (!webView()) return 0; - return new WebKit::WebViewHostOutputSurface(adoptPtr(webkit_support::CreateGraphicsContext3D(WebKit::WebGraphicsContext3D::Attributes(), webView()))); + + if (m_shell->softwareCompositingEnabled()) + return WebViewHostOutputSurface::createSoftware(adoptPtr(new WebViewHostSoftwareOutputDevice)).leakPtr(); + return WebViewHostOutputSurface::create3d(adoptPtr(webkit_support::CreateGraphicsContext3D(WebGraphicsContext3D::Attributes(), webView()))).leakPtr(); } void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine) @@ -1096,7 +1100,7 @@ void WebViewHost::unableToImplementPolicyWithError(WebFrame* frame, const WebURL { printf("Policy delegate: unable to implement policy with error domain '%s', " "error code %d, in frame '%s'\n", - error.domain.utf8().data(), error.reason, frame->name().utf8().data()); + error.domain.utf8().data(), error.reason, frame->uniqueName().utf8().data()); } void WebViewHost::willPerformClientRedirect(WebFrame* frame, const WebURL& from, const WebURL& to, @@ -1399,7 +1403,7 @@ void WebViewHost::deleteFileSystem(WebKit::WebFrame* frame, WebKit::WebFileSyste webkit_support::DeleteFileSystem(frame, type, callbacks); } -bool WebViewHost::willCheckAndDispatchMessageEvent(WebFrame* source, WebSecurityOrigin target, WebDOMMessageEvent event) +bool WebViewHost::willCheckAndDispatchMessageEvent(WebFrame* sourceFrame, WebFrame* targetFrame, WebSecurityOrigin target, WebDOMMessageEvent event) { if (m_shell->testRunner()->shouldInterceptPostMessage()) { fputs("intercepted postMessage\n", stdout); @@ -1745,7 +1749,7 @@ void WebViewHost::updateSessionHistory(WebFrame* frame) void WebViewHost::printFrameDescription(WebFrame* webframe) { - string name8 = webframe->name().utf8(); + string name8 = webframe->uniqueName().utf8(); if (webframe == webView()->mainFrame()) { if (!name8.length()) { fputs("main frame", stdout); @@ -1770,7 +1774,7 @@ void WebViewHost::printFrameUserGestureStatus(WebFrame* webframe, const char* ms void WebViewHost::printResourceDescription(unsigned identifier) { ResourceMap::iterator it = m_resourceIdentifierMap.find(identifier); - printf("%s", it != m_resourceIdentifierMap.end() ? it->second.c_str() : "<unknown>"); + printf("%s", it != m_resourceIdentifierMap.end() ? it->value.c_str() : "<unknown>"); } void WebViewHost::setPendingExtraData(PassOwnPtr<TestShellExtraData> extraData) diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 4a3627f90..c9e17b07f 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -52,6 +52,7 @@ class MockWebSpeechInputController; class MockWebSpeechRecognizer; class SkCanvas; class TestShell; +class WebUserMediaClientMock; namespace WebKit { class WebFrame; @@ -66,7 +67,6 @@ class WebSharedWorkerClient; class WebSpeechInputController; class WebSpeechInputListener; class WebURL; -class WebUserMediaClientMock; struct WebRect; struct WebURLError; struct WebWindowFeatures; @@ -268,7 +268,9 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual void didDetectXSS(WebKit::WebFrame*, const WebKit::WebURL&, bool didBlockEntirePage); virtual void openFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, long long size, bool create, WebKit::WebFileSystemCallbacks*); virtual void deleteFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, WebKit::WebFileSystemCallbacks*); - virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* source, WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent); + virtual bool willCheckAndDispatchMessageEvent( + WebKit::WebFrame* sourceFrame, WebKit::WebFrame* targetFrame, + WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent); virtual void registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo&); virtual void dispatchIntent(WebKit::WebFrame*, const WebKit::WebIntentRequest&); virtual void deliveredIntentResult(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&); @@ -343,7 +345,7 @@ private: void discardBackingStore(); #if ENABLE(MEDIA_STREAM) - WebKit::WebUserMediaClientMock* userMediaClientMock(); + WebUserMediaClientMock* userMediaClientMock(); webkit_support::TestMediaStreamClient* testMediaStreamClient(); #endif @@ -430,7 +432,7 @@ private: #endif #if ENABLE(MEDIA_STREAM) - OwnPtr<WebKit::WebUserMediaClientMock> m_userMediaClientMock; + OwnPtr<WebUserMediaClientMock> m_userMediaClientMock; OwnPtr<webkit_support::TestMediaStreamClient> m_testMediaStreamClient; #endif diff --git a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp index 1d1b5840e..09a0af501 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp @@ -27,22 +27,41 @@ #include "WebViewHostOutputSurface.h" +#include <public/WebCompositorSoftwareOutputDevice.h> #include <public/WebGraphicsContext3D.h> #include <wtf/Assertions.h> namespace WebKit { +PassOwnPtr<WebViewHostOutputSurface> WebViewHostOutputSurface::create3d(PassOwnPtr<WebKit::WebGraphicsContext3D> context3d) +{ + return adoptPtr(new WebViewHostOutputSurface(context3d)); +} + +PassOwnPtr<WebViewHostOutputSurface> WebViewHostOutputSurface::createSoftware(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice> softwareDevice) +{ + return adoptPtr(new WebViewHostOutputSurface(softwareDevice)); +} + WebViewHostOutputSurface::WebViewHostOutputSurface(PassOwnPtr<WebKit::WebGraphicsContext3D> context) : m_context(context) { } +WebViewHostOutputSurface::WebViewHostOutputSurface(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice> softwareDevice) + : m_softwareDevice(softwareDevice) +{ +} + WebViewHostOutputSurface::~WebViewHostOutputSurface() { } bool WebViewHostOutputSurface::bindToClient(WebCompositorOutputSurfaceClient*) { + if (!m_context) + return true; + return m_context->makeContextCurrent(); } @@ -56,6 +75,11 @@ WebGraphicsContext3D* WebViewHostOutputSurface::context3D() const return m_context.get(); } +WebCompositorSoftwareOutputDevice* WebViewHostOutputSurface::softwareDevice() const +{ + return m_softwareDevice.get(); +} + void WebViewHostOutputSurface::sendFrameToParentCompositor(const WebCompositorFrame&) { ASSERT_NOT_REACHED(); diff --git a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h index 412bc539d..bbd61a21a 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h +++ b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h @@ -33,22 +33,29 @@ namespace WebKit { class WebCompositorOutputSurfaceClient; +class WebCompositorSoftwareOutputDevice; class WebGraphicsContext3D; class WebViewHostOutputSurface : public WebKit::WebCompositorOutputSurface { public: - explicit WebViewHostOutputSurface(PassOwnPtr<WebKit::WebGraphicsContext3D>); + static PassOwnPtr<WebViewHostOutputSurface> create3d(PassOwnPtr<WebKit::WebGraphicsContext3D>); + static PassOwnPtr<WebViewHostOutputSurface> createSoftware(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice>); virtual ~WebViewHostOutputSurface(); virtual bool bindToClient(WebCompositorOutputSurfaceClient*) OVERRIDE; virtual const WebKit::WebCompositorOutputSurface::Capabilities& capabilities() const OVERRIDE; virtual WebGraphicsContext3D* context3D() const OVERRIDE; + virtual WebCompositorSoftwareOutputDevice* softwareDevice() const OVERRIDE; virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE; private: + explicit WebViewHostOutputSurface(PassOwnPtr<WebKit::WebGraphicsContext3D>); + explicit WebViewHostOutputSurface(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice>); + WebKit::WebCompositorOutputSurface::Capabilities m_capabilities; OwnPtr<WebKit::WebGraphicsContext3D> m_context; + OwnPtr<WebKit::WebCompositorSoftwareOutputDevice> m_softwareDevice; }; } diff --git a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp new file mode 100644 index 000000000..ecee9940d --- /dev/null +++ b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 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 "WebViewHostSoftwareOutputDevice.h" + +#include "SkBitmap.h" +#include "SkDevice.h" +#include <public/WebSize.h> +#include <wtf/Assertions.h> + +namespace WebKit { + +WebImage* WebViewHostSoftwareOutputDevice::lock(bool forWrite) +{ + ASSERT(m_device); + m_image = m_device->accessBitmap(forWrite); + return &m_image; +} + +void WebViewHostSoftwareOutputDevice::unlock() +{ + m_image.reset(); +} + +void WebViewHostSoftwareOutputDevice::didChangeViewportSize(WebSize size) +{ + if (m_device && size.width == m_device->width() && size.height == m_device->height()) + return; + + m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, size.width, size.height, true)); +} + + +} diff --git a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h new file mode 100644 index 000000000..5bd551ff9 --- /dev/null +++ b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebViewHostSoftwareOutputDevice_h +#define WebViewHostSoftwareOutputDevice_h + +#include <public/WebCompositorSoftwareOutputDevice.h> +#include <public/WebImage.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +class SkDevice; + +namespace WebKit { + +struct WebSize; + +class WebViewHostSoftwareOutputDevice : public WebKit::WebCompositorSoftwareOutputDevice { +public: + virtual WebImage* lock(bool forWrite) OVERRIDE; + virtual void unlock() OVERRIDE; + + virtual void didChangeViewportSize(WebSize) OVERRIDE; + +private: + OwnPtr<SkDevice> m_device; + WebImage m_image; +}; + +} + +#endif // WebViewHostSoftwareOutputDevice_h diff --git a/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml b/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml index 5ab6c2d59..79193b7c4 100644 --- a/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml +++ b/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml @@ -7,7 +7,32 @@ </family> <family> <fileset> - <file>DroidSansFallback.ttf</file> + <file>kochi-mincho.ttf</file> </fileset> </family> -</familyset>
\ No newline at end of file + <family> + <fileset> + <file>lohit_hi.ttf</file> + </fileset> + </family> + <family> + <fileset> + <file>lohit_ta.ttf</file> + </fileset> + </family> + <family> + <fileset> + <file>MuktiNarrow.ttf</file> + </fileset> + </family> + <family> + <fileset> + <file>Garuda.ttf</file> + </fileset> + </family> + <family> + <fileset> + <file>lohit_pa.ttf</file> + </fileset> + </family> +</familyset> |