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 | |
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')
63 files changed, 1023 insertions, 273 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index 982c767fd..4145b9cc0 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -78,6 +78,7 @@ 'target_name': 'TestRunner', 'type': 'static_library', 'dependencies': [ + 'TestRunner_resources', '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', @@ -111,13 +112,77 @@ ], }, { + 'target_name': 'TestRunner_resources', + 'type': 'none', + 'dependencies': [ + 'ImageDiff', + 'copy_TestNetscapePlugIn', + ], + 'conditions': [ + ['OS=="win"', { + 'dependencies': [ + 'LayoutTestHelper', + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': ['<(ahem_path)'], + }], + }], + ['OS=="mac"', { + 'dependencies': [ + 'LayoutTestHelper', + ], + 'mac_bundle_resources': [ + '<(ahem_path)', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', + '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', + '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png', + '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', + ], + }], + ['use_x11 == 1', { + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(ahem_path)', + '<(tools_dir)/DumpRenderTree/chromium/fonts.conf', + ] + }], + }], + ['OS=="android"', { + 'dependencies!': [ + 'ImageDiff', + 'copy_TestNetscapePlugIn', + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(ahem_path)', + '<(tools_dir)/DumpRenderTree/chromium/android_main_fonts.xml', + '<(tools_dir)/DumpRenderTree/chromium/android_fallback_fonts.xml', + ] + }], + }], + ['OS=="android" and android_build_type==0', { + 'dependencies': [ + 'ImageDiff#host', + ], + }], + ], + }, + { 'target_name': 'DumpRenderTree', 'type': 'executable', 'mac_bundle': 1, 'dependencies': [ - 'ImageDiff', 'TestRunner', - 'copy_TestNetscapePlugIn', '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources', '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', @@ -126,7 +191,6 @@ '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', ], 'include_dirs': [ @@ -153,7 +217,6 @@ }], ['OS=="win"', { 'dependencies': [ - 'LayoutTestHelper', '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL', '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2', ], @@ -177,10 +240,6 @@ }, }], ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': ['<(ahem_path)'], - }], },{ # OS!="win" 'sources/': [ ['exclude', 'Win\\.cpp$'], @@ -212,21 +271,6 @@ ['OS=="mac"', { 'dependencies': [ '<(source_dir)/WebKit/chromium/WebKit.gyp:copy_mesa', - 'LayoutTestHelper', - ], - 'mac_bundle_resources': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', - '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png', - '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', ], },{ # OS!="mac" 'sources/': [ @@ -246,8 +290,6 @@ 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/chromium/fonts.conf', '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', ] }], @@ -286,17 +328,9 @@ '<(chromium_src_dir)/tools/android/forwarder/forwarder.gyp:forwarder', '<(chromium_src_dir)/tools/android/md5sum/md5sum.gyp:md5sum', ], - 'dependencies!': [ - 'ImageDiff', - 'copy_TestNetscapePlugIn', - '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', - ], 'copies': [{ 'destination': '<(PRODUCT_DIR)', 'files': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/chromium/android_main_fonts.xml', - '<(tools_dir)/DumpRenderTree/chromium/android_fallback_fonts.xml', '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', ] }], @@ -305,11 +339,6 @@ ['exclude', 'Android\\.cpp$'], ], }], - ['OS=="android" and android_build_type==0', { - 'dependencies': [ - 'ImageDiff#host', - ], - }], ['inside_chromium_build==1 and component=="shared_library"', { 'sources': [ '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp', diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 832ffc991..4562aaf73 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -8,6 +8,8 @@ 'chromium/DumpRenderTree.cpp', 'chromium/DRTTestRunner.cpp', 'chromium/DRTTestRunner.h', + 'chromium/MockConstraints.cpp', + 'chromium/MockConstraints.h', 'chromium/MockGrammarCheck.cpp', 'chromium/MockGrammarCheck.h', 'chromium/MockSpellCheck.cpp', @@ -56,6 +58,8 @@ 'chromium/WebViewHost.h', 'chromium/WebViewHostOutputSurface.cpp', 'chromium/WebViewHostOutputSurface.h', + 'chromium/WebViewHostSoftwareOutputDevice.cpp', + 'chromium/WebViewHostSoftwareOutputDevice.h', ], 'test_runner_files': [ 'DumpRenderTree.h', diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt index 59492dd79..65a7427cd 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt @@ -21,6 +21,7 @@ SET(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NullNPPGetValuePointer.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PassDifferentNPPStruct.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableNPObjectInvokeDefault.cpp + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableObjectOverridesAllProperties.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PrivateBrowsing.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp ) diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp index 9f7a7c1be..fe28a2911 100644 --- a/Tools/DumpRenderTree/TestRunner.cpp +++ b/Tools/DumpRenderTree/TestRunner.cpp @@ -699,13 +699,6 @@ static JSValueRef computedStyleIncludingVisitedInfoCallback(JSContextRef context return controller->computedStyleIncludingVisitedInfo(context, arguments[0]); } -static JSValueRef layerTreeAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - // Has mac & windows implementation - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(context, controller->layerTreeAsText().get()); -} - static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1087,10 +1080,40 @@ static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObj if (argumentCount < 3) return JSValueMakeUndefined(context); + double latitude = JSValueToNumber(context, arguments[0], 0); + double longitude = JSValueToNumber(context, arguments[1], 0); + double accuracy = JSValueToNumber(context, arguments[2], 0); + + bool canProvideAltitude = false; + double altitude = 0.; + if (argumentCount > 3 && !JSValueIsUndefined(context, arguments[3])) { + canProvideAltitude = true; + altitude = JSValueToNumber(context, arguments[3], 0); + } + + bool canProvideAltitudeAccuracy = false; + double altitudeAccuracy = 0.; + if (argumentCount > 4 && !JSValueIsUndefined(context, arguments[4])) { + canProvideAltitudeAccuracy = true; + altitudeAccuracy = JSValueToNumber(context, arguments[4], 0); + } + + bool canProvideHeading = false; + double heading = 0.; + if (argumentCount > 5 && !JSValueIsUndefined(context, arguments[5])) { + canProvideHeading = true; + heading = JSValueToNumber(context, arguments[5], 0); + } + + bool canProvideSpeed = false; + double speed = 0.; + if (argumentCount > 6 && !JSValueIsUndefined(context, arguments[6])) { + canProvideSpeed = true; + speed = JSValueToNumber(context, arguments[6], 0); + } + TestRunner* controller = reinterpret_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setMockGeolocationPosition(JSValueToNumber(context, arguments[0], NULL), // latitude - JSValueToNumber(context, arguments[1], NULL), // longitude - JSValueToNumber(context, arguments[2], NULL)); // accuracy + controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed); return JSValueMakeUndefined(context); } @@ -2214,7 +2237,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "ignoreLegacyWebNotificationPermissionRequests", ignoreLegacyWebNotificationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/Tools/DumpRenderTree/TestRunner.h b/Tools/DumpRenderTree/TestRunner.h index edd0dfda7..fa76c7642 100644 --- a/Tools/DumpRenderTree/TestRunner.h +++ b/Tools/DumpRenderTree/TestRunner.h @@ -100,7 +100,7 @@ public: void setAutomaticLinkDetectionEnabled(bool flag); void setMainFrameIsFirstResponder(bool flag); void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); - void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); void setMockGeolocationPositionUnavailableError(JSStringRef message); void addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language); void setMockSpeechInputDumpRect(bool flag); @@ -336,8 +336,6 @@ public: // Simulate a request an embedding application could make, populating per-session credential storage. void authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password); - JSRetainPtr<JSStringRef> layerTreeAsText() const; - JSRetainPtr<JSStringRef> markerTextForListItem(JSContextRef, JSValueRef nodeObject) const; JSValueRef originsWithLocalStorage(JSContextRef); diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index fa57c46fe..00321ac9b 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -193,7 +193,7 @@ void DumpRenderTree::runTest(const String& url) FILE* current = fopen(m_currentTestFile.utf8().data(), "w"); fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current); fclose(current); - m_page->load(url.utf8().data(), 0, false); + m_page->load(url, BlackBerry::Platform::String::emptyString(), false); } void DumpRenderTree::doneDrt() diff --git a/Tools/DumpRenderTree/blackberry/EventSender.cpp b/Tools/DumpRenderTree/blackberry/EventSender.cpp index 5c30ea408..ab7f808f8 100644 --- a/Tools/DumpRenderTree/blackberry/EventSender.cpp +++ b/Tools/DumpRenderTree/blackberry/EventSender.cpp @@ -151,6 +151,7 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); bool needsAltKeyModifier = false; + bool needsCtrlKeyModifier = false; if (argumentCount > 1) { if (JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0)) { int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); @@ -160,6 +161,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS needsShiftKeyModifier = true; else if (JSStringIsEqualToUTF8CString(string, "altKey")) needsAltKeyModifier = true; + else if (JSStringIsEqualToUTF8CString(string, "ctrlKey")) + needsCtrlKeyModifier = true; JSStringRelease(string); } } @@ -172,6 +175,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS modifiers |= KEYMOD_SHIFT; if (needsAltKeyModifier) modifiers |= KEYMOD_ALT; + if (needsCtrlKeyModifier) + modifiers |= KEYMOD_CTRL; page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyChar, modifiers)); diff --git a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp index 62be5fe18..c9d013775 100644 --- a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp @@ -437,6 +437,8 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) DumpRenderTreeSupport::setLinksIncludedInFocusChain(valueStr == "true" || valueStr == "1"); else if (keyStr == "WebKitHyperlinkAuditingEnabled") mainFrame->page()->settings()->setHyperlinkAuditingEnabled(valueStr == "true" || valueStr == "1"); + else if (keyStr == "WebSocketsEnabled") + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setWebSocketsEnabled(valueStr == "true" || valueStr == "1"); } void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) @@ -585,12 +587,6 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(context, value); } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - notImplemented(); - return 0; -} - JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { WebCore::Element* element = toElement(toJS(toJS(context), nodeObject)); @@ -623,7 +619,7 @@ void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) { - notImplemented(); + DumpRenderTreeSupport::setMockDeviceOrientation(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) diff --git a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp index a948fcb02..394e40832 100644 --- a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp @@ -61,7 +61,7 @@ bool LoadHTMLStringItem::invoke() const JSStringGetUTF8CString(m_content.get(), content.get(), contentSize); JSStringGetUTF8CString(m_baseURL.get(), baseURL.get(), baseURLSize); JSStringGetUTF8CString(m_unreachableURL.get(), unreachableURL.get(), unreachableURLSize); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : 0); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : ""); return true; } @@ -74,11 +74,11 @@ bool ReloadItem::invoke() const bool ScriptItem::invoke() const { BlackBerry::WebKit::JavaScriptDataType type; - BlackBerry::WebKit::WebString result; + BlackBerry::Platform::String result; size_t scriptArrSize = JSStringGetMaximumUTF8CStringSize(m_script.get()); OwnArrayPtr<char> script = adoptArrayPtr(new char[scriptArrSize]); JSStringGetUTF8CString(m_script.get(), script.get(), scriptArrSize); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(script.get(), type, result); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(BlackBerry::Platform::String::fromRawData(script.get(), scriptArrSize), type, result); return true; } 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> diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index c1e480134..69a4211a0 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -68,7 +68,6 @@ volatile bool done = false; static bool dumpPixelsForCurrentTest; static int dumpTree = true; static int printSeparators = true; -static int useX11Window = false; static String dumpFramesAsText(Evas_Object* frame) { @@ -194,7 +193,6 @@ static bool parseCommandLineOptions(int argc, char** argv) static const option options[] = { {"notree", no_argument, &dumpTree, false}, {"tree", no_argument, &dumpTree, true}, - {"gui", no_argument, &useX11Window, true}, {0, 0, 0, 0} }; @@ -420,7 +418,7 @@ void dump() static Ecore_Evas* initEcoreEvas() { - Ecore_Evas* ecoreEvas = useX11Window ? ecore_evas_new(0, 0, 0, 800, 600, 0) : ecore_evas_buffer_new(800, 600); + Ecore_Evas* ecoreEvas = ecore_evas_new(0, 0, 0, 800, 600, 0); if (!ecoreEvas) { shutdownEfl(); exit(EXIT_FAILURE); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index 51a78c9b4..993135ee4 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -139,7 +139,7 @@ Evas_Object* DumpRenderTreeChrome::createView() const return view; } -Evas_Object* DumpRenderTreeChrome::createWebInspectorView() +Evas_Object* DumpRenderTreeChrome::createInspectorView() { Evas_Object* inspectorView = drtViewAdd(m_evas); if (!inspectorView) @@ -161,9 +161,9 @@ Evas_Object* DumpRenderTreeChrome::createWebInspectorView() return inspectorView; } -void DumpRenderTreeChrome::removeWebInspectorView() +void DumpRenderTreeChrome::removeInspectorView() { - Evas_Object* inspectorView = ewk_view_web_inspector_view_get(mainView()); + Evas_Object* inspectorView = ewk_view_inspector_view_get(mainView()); if (!inspectorView) return; @@ -171,14 +171,14 @@ void DumpRenderTreeChrome::removeWebInspectorView() evas_object_smart_callback_del(mainFrame, "load,finished", onInspectorFrameLoadFinished); evas_object_del(inspectorView); - ewk_view_web_inspector_view_set(mainView(), 0); + ewk_view_inspector_view_set(mainView(), 0); } void DumpRenderTreeChrome::waitInspectorLoadFinished() { // Waits until the page has finished loading. // Because it can't complete loading inspector.html before loading testURL. - Evas_Object* inspectorView = ewk_view_web_inspector_view_get(mainView()); + Evas_Object* inspectorView = ewk_view_inspector_view_get(mainView()); if (inspectorView) ecore_main_loop_begin(); } @@ -318,6 +318,7 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setSerializeHTTPLoads(false); DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(mainView(), 9); DumpRenderTreeSupportEfl::setCSSRegionsEnabled(mainView(), true); + DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(false); // Reset capacities for the memory cache for dead objects. static const unsigned cacheTotalCapacity = 8192 * 1024; @@ -676,19 +677,19 @@ void DumpRenderTreeChrome::onWebViewPopulateVisitedLinks(void*, Evas_Object* ewk void DumpRenderTreeChrome::onInspectorViewCreate(void*, Evas_Object*, void*) { - Evas_Object* inspectorView = browser->createWebInspectorView(); + Evas_Object* inspectorView = browser->createInspectorView(); if (inspectorView) - ewk_view_web_inspector_view_set(browser->mainView(), inspectorView); + ewk_view_inspector_view_set(browser->mainView(), inspectorView); } void DumpRenderTreeChrome::onInspectorViewClose(void*, Evas_Object*, void*) { - browser->removeWebInspectorView(); + browser->removeInspectorView(); } void DumpRenderTreeChrome::onInspectorFrameLoadFinished(void*, Evas_Object*, void*) { - Evas_Object* inspectorView = ewk_view_web_inspector_view_get(browser->mainView()); + Evas_Object* inspectorView = ewk_view_inspector_view_get(browser->mainView()); if (inspectorView) ecore_main_loop_quit(); } diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h index 267c20003..32a365490 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h @@ -48,8 +48,8 @@ public: Evas_Object* createNewWindow(); void removeWindow(Evas_Object*); - Evas_Object* createWebInspectorView(); - void removeWebInspectorView(); + Evas_Object* createInspectorView(); + void removeInspectorView(); void waitInspectorLoadFinished(); const Vector<Evas_Object*>& extraViews() const; diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp index ed31de328..d24bf3606 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp @@ -153,15 +153,15 @@ static int64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Securit return defaultOriginQuota; } -static bool shouldUseSingleBackingStore() +static bool shouldUseTiledBackingStore() { - const char* useSingleBackingStore = getenv("DRT_USE_SINGLE_BACKING_STORE"); - return useSingleBackingStore && *useSingleBackingStore == '1'; + const char* useTiledBackingStore = getenv("DRT_USE_TILED_BACKING_STORE"); + return useTiledBackingStore && *useTiledBackingStore == '1'; } static bool chooseAndInitializeAppropriateSmartClass(Ewk_View_Smart_Class* api) { - return shouldUseSingleBackingStore() ? ewk_view_single_smart_set(api) : ewk_view_tiled_smart_set(api); + return !shouldUseTiledBackingStore() ? ewk_view_single_smart_set(api) : ewk_view_tiled_smart_set(api); } // Taken from the file "WebKit/Tools/DumpRenderTree/chromium/WebViewHost.cpp". diff --git a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp index 964b31c76..19703aee6 100644 --- a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp +++ b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp @@ -109,7 +109,7 @@ void TestRunner::display() void TestRunner::keepWebHistory() { - notImplemented(); + DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(true); } JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) @@ -117,13 +117,6 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return DumpRenderTreeSupportEfl::computedStyleIncludingVisitedInfo(context, value); } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - String result = DumpRenderTreeSupportEfl::layerTreeAsText(browser->mainFrame()); - - return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString(result.utf8().data())); -} - size_t TestRunner::webHistoryItemCount() { const Ewk_History* history = ewk_view_history_get(browser->mainView()); @@ -372,7 +365,7 @@ void TestRunner::setMockDeviceOrientation(bool, double, bool, double, bool, doub notImplemented(); } -void TestRunner::setMockGeolocationPosition(double, double, double) +void TestRunner::setMockGeolocationPosition(double, double, double, bool, double, bool, double, bool, double, bool, double) { // FIXME: Implement for Geolocation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=28264. @@ -739,13 +732,13 @@ void TestRunner::setAsynchronousSpellCheckingEnabled(bool) void TestRunner::showWebInspector() { - ewk_view_web_inspector_show(browser->mainView()); + ewk_view_inspector_show(browser->mainView()); browser->waitInspectorLoadFinished(); } void TestRunner::closeWebInspector() { - ewk_view_web_inspector_close(browser->mainView()); + ewk_view_inspector_close(browser->mainView()); } void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) diff --git a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index 6b9edc94b..25c49e314 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -56,18 +56,21 @@ static inline gchar* replaceCharactersForResults(gchar* str) AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) : m_element(element) { - g_object_ref(m_element); + if (m_element) + g_object_ref(m_element); } AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) : m_element(other.m_element) { - g_object_ref(m_element); + if (m_element) + g_object_ref(m_element); } AccessibilityUIElement::~AccessibilityUIElement() { - g_object_unref(m_element); + if (m_element) + g_object_unref(m_element); } void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements) diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index 1f96622bb..f574c11e8 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -516,6 +516,7 @@ static void resetDefaultsToConsistentValues() DumpRenderTreeSupportGtk::setCSSGridLayoutEnabled(webView, false); DumpRenderTreeSupportGtk::setCSSRegionsEnabled(webView, true); + DumpRenderTreeSupportGtk::setCSSCustomFilterEnabled(webView, false); DumpRenderTreeSupportGtk::setShadowDOMEnabled(true); DumpRenderTreeSupportGtk::setStyleScopedEnabled(true); } diff --git a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp index db9628927..32d3dd5cb 100644 --- a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp @@ -112,13 +112,6 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo(context, value); } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - // FIXME: implement - JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithUTF8CString("")); - return string; -} - size_t TestRunner::webHistoryItemCount() { WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); @@ -437,7 +430,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo // See https://bugs.webkit.org/show_bug.cgi?id=30335. } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool, double, bool, double, bool, double, bool, double) { WebKitWebView* view = WEBKIT_WEB_VIEW(g_slist_nth_data(webViewList, 0)); if (!view) @@ -790,6 +783,9 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) } else if (g_str_equal(originalName.get(), "WebKitCSSRegionsEnabled")) { DumpRenderTreeSupportGtk::setCSSRegionsEnabled(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); return; + } else if (g_str_equal(originalName.get(), "WebKitCSSCustomFilterEnabled")) { + DumpRenderTreeSupportGtk::setCSSCustomFilterEnabled(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); + return; } else { fprintf(stderr, "TestRunner::overridePreference tried to override " "unknown preference '%s'.\n", originalName.get()); diff --git a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm b/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm index 6e0213241..0909b86fa 100644 --- a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm +++ b/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm @@ -79,6 +79,7 @@ static id findAccessibleObjectById(id obj, NSString *idAttribute) return obj; END_AX_OBJC_EXCEPTIONS + BEGIN_AX_OBJC_EXCEPTIONS NSArray *children = [obj accessibilityAttributeValue:NSAccessibilityChildrenAttribute]; NSUInteger childrenCount = [children count]; for (NSUInteger i = 0; i < childrenCount; ++i) { @@ -86,6 +87,7 @@ static id findAccessibleObjectById(id obj, NSString *idAttribute) if (result) return result; } + END_AX_OBJC_EXCEPTIONS return 0; } diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 99f525622..3bc7a2a84 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" CLANG_WARN_CXX0X_EXTENSIONS = NO; -HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include ForwardingHeaders mac/InternalHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport; +HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include ForwardingHeaders mac/InternalHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport ${SRCROOT}/../../Source/JavaScriptCore/icu; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index 30ac8254c..f70e26259 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -57,6 +57,8 @@ #import "WorkQueueItem.h" #import <Carbon/Carbon.h> #import <CoreFoundation/CoreFoundation.h> +#import <JavaScriptCore/HeapStatistics.h> +#import <JavaScriptCore/Options.h> #import <WebCore/FoundationExtras.h> #import <WebKit/DOMElement.h> #import <WebKit/DOMExtensions.h> @@ -87,6 +89,7 @@ #import <getopt.h> #import <objc/objc-runtime.h> #import <wtf/Assertions.h> +#import <wtf/FastMalloc.h> #import <wtf/RetainPtr.h> #import <wtf/Threading.h> #import <wtf/ObjcRuntimeExtras.h> @@ -917,7 +920,9 @@ int main(int argc, const char *argv[]) [DumpRenderTreeApplication sharedApplication]; // Force AppKit to init itself dumpRenderTree(argc, argv); [WebCoreStatistics garbageCollectJavaScriptObjects]; - [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts + [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts + if (JSC::Options::logHeapStatisticsAtExit()) + JSC::HeapStatistics::reportSuccess(); [pool release]; return 0; } @@ -1179,6 +1184,10 @@ void dump() if (gTestRunner->dumpAsAudio()) printf("Content-Transfer-Encoding: base64\n"); + WTF::FastMallocStatistics mallocStats = WTF::fastMallocStatistics(); + printf("DumpMalloc: %li\n", mallocStats.committedVMBytes); + printf("DumpJSHeap: %li\n", JSC::HeapStatistics::usedJSHeap()); + if (resultData) { fwrite([resultData bytes], 1, [resultData length], stdout); diff --git a/Tools/DumpRenderTree/mac/EventSendingController.mm b/Tools/DumpRenderTree/mac/EventSendingController.mm index dc8b26693..482bf93db 100644 --- a/Tools/DumpRenderTree/mac/EventSendingController.mm +++ b/Tools/DumpRenderTree/mac/EventSendingController.mm @@ -299,21 +299,31 @@ static NSEventType eventTypeForMouseButtonAndAction(int button, MouseAction acti clickCount++; } +static int modifierFlags(const NSString* modifierName) +{ + int flags = 0; + if ([modifierName isEqual:@"ctrlKey"]) + flags |= NSControlKeyMask; + else if ([modifierName isEqual:@"shiftKey"] || [modifierName isEqual:@"rangeSelectionKey"]) + flags |= NSShiftKeyMask; + else if ([modifierName isEqual:@"altKey"]) + flags |= NSAlternateKeyMask; + else if ([modifierName isEqual:@"metaKey"] || [modifierName isEqual:@"addSelectionKey"]) + flags |= NSCommandKeyMask; + + return flags; +} + static int buildModifierFlags(const WebScriptObject* modifiers) { int flags = 0; - if (![modifiers isKindOfClass:[WebScriptObject class]]) + if ([modifiers isKindOfClass:[NSString class]]) + return modifierFlags((NSString*)modifiers); + else if (![modifiers isKindOfClass:[WebScriptObject class]]) return flags; for (unsigned i = 0; [[modifiers webScriptValueAtIndex:i] isKindOfClass:[NSString class]]; i++) { NSString* modifierName = (NSString*)[modifiers webScriptValueAtIndex:i]; - if ([modifierName isEqual:@"ctrlKey"]) - flags |= NSControlKeyMask; - else if ([modifierName isEqual:@"shiftKey"] || [modifierName isEqual:@"rangeSelectionKey"]) - flags |= NSShiftKeyMask; - else if ([modifierName isEqual:@"altKey"]) - flags |= NSAlternateKeyMask; - else if ([modifierName isEqual:@"metaKey"] || [modifierName isEqual:@"addSelectionKey"]) - flags |= NSCommandKeyMask; + flags |= modifierFlags(modifierName); } return flags; } diff --git a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm b/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm index 5156d5186..6f75b7e16 100644 --- a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm +++ b/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm @@ -23,9 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <wtf/Platform.h> #import "MockGeolocationProvider.h" - @implementation MockGeolocationProvider + (MockGeolocationProvider *)shared diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h index d4063b81a..293ea49d0 100644 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h +++ b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h @@ -48,7 +48,8 @@ typedef HashMap<uint64_t, WebView *> NotificationViewMap; + (MockWebNotificationProvider *)shared; - (void)simulateWebNotificationClick:(uint64_t)notificationID; -- (void)setWebNotificationOrigin:(NSString*)origin permission:(BOOL)allowed; +- (void)setWebNotificationOrigin:(NSString *)origin permission:(BOOL)allowed; +- (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin; - (void)removeAllWebNotificationPermissions; - (void)reset; diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm index 2b693fda2..4365d15d0 100644 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm +++ b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm @@ -107,7 +107,7 @@ uint64_t id = [notificationID unsignedLongLongValue]; NotificationIDMap::iterator it = _notifications.find(id); ASSERT(it != _notifications.end()); - [it->second.get() dispatchCloseEvent]; + [it->value.get() dispatchCloseEvent]; _notifications.remove(it); _notificationViewMap.remove(id); } @@ -129,7 +129,7 @@ return WebNotificationPermissionDenied; } -- (void)setWebNotificationOrigin:(NSString*)origin permission:(BOOL)allowed +- (void)setWebNotificationOrigin:(NSString *)origin permission:(BOOL)allowed { [_permissions.get() setObject:[NSNumber numberWithBool:allowed] forKey:origin]; } diff --git a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm index 71f739063..0cf9c4a19 100644 --- a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm +++ b/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm @@ -186,11 +186,11 @@ PassRefPtr<BitmapContext> createPagedBitmapContext() { int pageWidthInPixels = TestRunner::maxViewWidth; int pageHeightInPixels = TestRunner::maxViewHeight; - int numberOfPages = [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; + int numberOfPages = [mainFrame numberOfPagesWithPageWidth:pageWidthInPixels pageHeight:pageHeightInPixels]; size_t rowBytes = 0; void* buffer = 0; RefPtr<BitmapContext> bitmapContext = createBitmapContext(pageWidthInPixels, numberOfPages * (pageHeightInPixels + 1) - 1, rowBytes, buffer); - [mainFrame printToCGContext:bitmapContext->cgContext():pageWidthInPixels:pageHeightInPixels]; + [mainFrame printToCGContext:bitmapContext->cgContext() pageWidth:pageWidthInPixels pageHeight:pageHeightInPixels]; return bitmapContext.release(); } diff --git a/Tools/DumpRenderTree/mac/TestRunnerMac.mm b/Tools/DumpRenderTree/mac/TestRunnerMac.mm index 1a0a04dc7..b520e096f 100644 --- a/Tools/DumpRenderTree/mac/TestRunnerMac.mm +++ b/Tools/DumpRenderTree/mac/TestRunnerMac.mm @@ -42,6 +42,8 @@ #import <JavaScriptCore/JSRetainPtr.h> #import <JavaScriptCore/JSStringRef.h> #import <JavaScriptCore/JSStringRefCF.h> +#import <WebCore/GeolocationPosition.h> +#import <WebCore/PageVisibilityState.h> #import <WebKit/DOMDocument.h> #import <WebKit/DOMElement.h> #import <WebKit/WebApplicationCache.h> @@ -108,6 +110,10 @@ @end +@interface WebGeolocationPosition (Internal) +- (id)initWithGeolocationPosition:(PassRefPtr<WebCore::GeolocationPosition>)coreGeolocationPosition; +@end + TestRunner::~TestRunner() { } @@ -269,12 +275,6 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return [[mainFrame webView] _computedStyleIncludingVisitedInfo:context forElement:value]; } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame _layerTreeAsText])); - return string; -} - JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; @@ -472,9 +472,16 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo [orientation release]; } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { - WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:currentTime() latitude:latitude longitude:longitude accuracy:accuracy]; + WebGeolocationPosition *position = nil; + if (!providesAltitude && !providesAltitudeAccuracy && !providesHeading && !providesSpeed) { + // Test the exposed API. + position = [[WebGeolocationPosition alloc] initWithTimestamp:currentTime() latitude:latitude longitude:longitude accuracy:accuracy]; + } else { + RefPtr<WebCore::GeolocationPosition> coreGeolocationPosition = WebCore::GeolocationPosition::create(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); + position = [[WebGeolocationPosition alloc] initWithGeolocationPosition:(coreGeolocationPosition.release())]; + } [[MockGeolocationProvider shared] setPosition:position]; [position release]; } @@ -892,8 +899,8 @@ unsigned worldIDForWorld(WebScriptWorld *world) { WorldMap::const_iterator end = worldMap().end(); for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { - if (it->second == world) - return it->first; + if (it->value == world) + return it->key; } return 0; @@ -915,7 +922,7 @@ void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef glo if (!worldID) world = [WebScriptWorld world]; else { - RetainPtr<WebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->second; + RetainPtr<WebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value; if (!worldSlot) worldSlot.adoptNS([[WebScriptWorld alloc] init]); world = worldSlot.get(); @@ -1148,12 +1155,26 @@ void TestRunner::setBackingScaleFactor(double backingScaleFactor) void TestRunner::resetPageVisibility() { - // FIXME: Implement. + WebView *webView = [mainFrame webView]; + if ([webView respondsToSelector:@selector(_setVisibilityState:isInitialState:)]) { + [webView _setVisibilityState:WebCore::PageVisibilityStateVisible isInitialState:NO]; + } } -void TestRunner::setPageVisibility(const char*) +void TestRunner::setPageVisibility(const char* newVisibility) { - // FIXME: Implement. + if (!newVisibility) + return; + + WebView *webView = [mainFrame webView]; + if (!strcmp(newVisibility, "visible")) + [webView _setVisibilityState:WebCore::PageVisibilityStateVisible isInitialState:NO]; + else if (!strcmp(newVisibility, "hidden")) + [webView _setVisibilityState:WebCore::PageVisibilityStateHidden isInitialState:NO]; + else if (!strcmp(newVisibility, "prerender")) + [webView _setVisibilityState:WebCore::PageVisibilityStatePrerender isInitialState:NO]; + else if (!strcmp(newVisibility, "preview")) + [webView _setVisibilityState:WebCore::PageVisibilityStatePreview isInitialState:NO]; } void TestRunner::sendWebIntentResponse(JSStringRef) diff --git a/Tools/DumpRenderTree/mac/UIDelegate.mm b/Tools/DumpRenderTree/mac/UIDelegate.mm index 1b6103ac8..3473d1797 100644 --- a/Tools/DumpRenderTree/mac/UIDelegate.mm +++ b/Tools/DumpRenderTree/mac/UIDelegate.mm @@ -293,8 +293,19 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; - (void)webView:(WebView *)webView decidePolicyForNotificationRequestFromOrigin:(WebSecurityOrigin *)origin listener:(id<WebAllowDenyPolicyListener>)listener { - [(MockWebNotificationProvider *)[webView _notificationProvider] setWebNotificationOrigin:[origin stringValue] permission:YES]; - [listener allow]; + MockWebNotificationProvider *provider = (MockWebNotificationProvider *)[webView _notificationProvider]; + switch ([provider policyForOrigin:origin]) { + case WebNotificationPermissionAllowed: + [listener allow]; + break; + case WebNotificationPermissionDenied: + [listener deny]; + break; + case WebNotificationPermissionNotAllowed: + [provider setWebNotificationOrigin:[origin stringValue] permission:YES]; + [listener allow]; + break; + } } - (void)dealloc diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index baf025aed..1b8d8d3d7 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -17,7 +17,7 @@ INCLUDEPATH += \ $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \ $${ROOT_WEBKIT_DIR}/Source/WTF -QT = core gui network testlib webkit widgets +QT = core gui network testlib webkitwidgets widgets have?(QTPRINTSUPPORT): QT += printsupport macx: QT += xml diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp index 1baae7cb8..260360142 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp @@ -59,7 +59,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext&, const QString &message) { - if (type == QtCriticalMsg) { + if (type == QtCriticalMsg || type == QtFatalMsg) { fprintf(stderr, "%s\n", qPrintable(message)); return; } diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 46120a7b0..0d28cbcc1 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -471,6 +471,8 @@ DumpRenderTree::DumpRenderTree() DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true); DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(webPage(), true); + DumpRenderTreeSupportQt::enableMockScrollbars(); + QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); QApplication::sendEvent(m_mainView, &event); } @@ -947,6 +949,23 @@ void DumpRenderTree::dump() } else image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame); + if (DumpRenderTreeSupportQt::trackRepaintRects(m_page->mainFrame())) { + QVector<QRect> repaintRects; + DumpRenderTreeSupportQt::getTrackedRepaintRects(m_page->mainFrame(), repaintRects); + QImage mask(image.size(), image.format()); + mask.fill(QColor(0, 0, 0, 0.66 * 255)); + + QPainter maskPainter(&mask); + maskPainter.setCompositionMode(QPainter::CompositionMode_Source); + for (int i = 0; i < repaintRects.size(); ++i) + maskPainter.fillRect(repaintRects[i], Qt::transparent); + + QPainter painter(&image); + painter.drawImage(image.rect(), mask); + + DumpRenderTreeSupportQt::setTrackRepaintRects(m_page->mainFrame(), false); + } + QCryptographicHash hash(QCryptographicHash::Md5); for (int row = 0; row < image.height(); ++row) hash.addData(reinterpret_cast<const char*>(image.scanLine(row)), image.width() * 4); diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index f0c64c369..fe1e96b67 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -72,6 +72,7 @@ EventSender::EventSender(QWebPage* parent) startOfQueue = 0; m_eventLoop = 0; m_currentButton = 0; + m_currentDragActionsAllowed = 0; resetClickCount(); m_page->view()->installEventFilter(this); // This is a hack that works because we normally scroll 60 pixels (3*20) per tick, but Apple scrolls 120. @@ -184,6 +185,13 @@ void EventSender::mouseUp(int button) } sendOrQueueEvent(event); + + if (m_currentDragData.urls().isEmpty()) + return; + + event = new QDropEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, m_mouseButtons, Qt::NoModifier); + sendEvent(m_page, event); + m_currentDragData.clear(); } void EventSender::mouseMoveTo(int x, int y) @@ -201,6 +209,31 @@ void EventSender::mouseMoveTo(int x, int y) } sendOrQueueEvent(event); + + if (m_currentDragData.urls().isEmpty()) + return; + + Qt::MouseButtons mouseButtons = m_mouseButtons | Qt::LeftButton; + event = new QDragMoveEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, mouseButtons, Qt::NoModifier); + sendEvent(m_page, event); +} + +// Simulates a mouse down event for drag without sending an actual mouse down event. +void EventSender::beginDragWithFiles(const QStringList& files) +{ + m_currentDragData.clear(); + QList<QUrl> fileUrls; + QUrl baseUrl = m_page->mainFrame()->baseUrl(); + foreach (const QString& file, files) { + QUrl resolvedUrl = baseUrl.resolved(file); + fileUrls.append(resolvedUrl); + } + + m_currentDragData.setUrls(fileUrls); + m_currentDragActionsAllowed = Qt::CopyAction; + Qt::MouseButtons mouseButtons = m_mouseButtons | Qt::LeftButton; + QDragEnterEvent* event = new QDragEnterEvent(m_mousePos, m_currentDragActionsAllowed, &m_currentDragData, mouseButtons, Qt::NoModifier); + sendEvent(m_page, event); } #ifndef QT_NO_WHEELEVENT diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index 8a4d9362a..e6d9257d2 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -37,12 +37,14 @@ #include <QEvent> #include <QEventLoop> #include <QGesture> +#include <QMimeData> #include <QMouseEvent> #include <QObject> #include <QPoint> #include <QString> #include <QStringList> #include <QTouchEvent> +#include <Qt> #include <qwebpage.h> #include <qwebframe.h> @@ -87,6 +89,7 @@ public Q_SLOTS: #ifndef QT_NO_GESTURES void gestureTap(int x, int y); #endif + void beginDragWithFiles(const QStringList& files); protected: void timerEvent(QTimerEvent*); @@ -111,6 +114,8 @@ private: int m_currentButton; bool m_mouseButtonPressed; bool m_drag; + QMimeData m_currentDragData; + Qt::DropActions m_currentDragActionsAllowed; QEventLoop* m_eventLoop; QWebFrame* frameUnderMouse() const; QBasicTimer m_clickTimer; diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 9a92013ed..81f781430 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -236,6 +236,7 @@ void TestRunner::simulateLegacyWebNotificationClick(const QString& title) void TestRunner::display() { + DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame, true); emit showPage(); } @@ -677,6 +678,8 @@ void TestRunner::overridePreference(const QString& name, const QVariant& value) settings->setAttribute(QWebSettings::HyperlinkAuditingEnabled, value.toBool()); else if (name == "WebKitAcceleratedCompositingEnabled") settings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, value.toBool()); + else if (name == "WebKitDisplayImagesKey") + settings->setAttribute(QWebSettings::AutoLoadImages, value.toBool()); else printf("ERROR: TestRunner::overridePreference() does not support the '%s' preference\n", name.toLatin1().data()); @@ -938,11 +941,6 @@ void TestRunner::setAutomaticLinkDetectionEnabled(bool) // FIXME: Implement this. } -QString TestRunner::layerTreeAsText() -{ - return DumpRenderTreeSupportQt::layerTreeAsText(m_drt->webPage()->mainFrame()); -} - void TestRunner::setTextDirection(const QString& directionName) { if (directionName == "auto") diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.h b/Tools/DumpRenderTree/qt/TestRunnerQt.h index 311bcd9de..9c58f1d83 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.h +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.h @@ -270,7 +270,6 @@ public Q_SLOTS: long long localStorageDiskUsageForOrigin(const QString& originIdentifier); void observeStorageTrackerNotifications(unsigned number); void syncLocalStorage(); - QString layerTreeAsText(); void setTextDirection(const QString& directionName); void goBack(); void setDefersLoading(bool); diff --git a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp index 9e76c8dda..995c5f115 100644 --- a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ b/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp @@ -58,7 +58,7 @@ AccessibilityController::~AccessibilityController() UnhookWinEvent(m_notificationsEventHook); for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) - JSValueUnprotect(frame->globalContext(), it->second); + JSValueUnprotect(frame->globalContext(), it->value); } AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) @@ -299,7 +299,7 @@ void AccessibilityController::removeNotificationListener() void AccessibilityController::winNotificationReceived(PlatformUIElement element, const string& eventName) { for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) { - COMPtr<IServiceProvider> thisServiceProvider(Query, it->first); + COMPtr<IServiceProvider> thisServiceProvider(Query, it->key); if (!thisServiceProvider) continue; @@ -322,7 +322,7 @@ void AccessibilityController::winNotificationReceived(PlatformUIElement element, JSRetainPtr<JSStringRef> jsNotification(Adopt, JSStringCreateWithUTF8CString(eventName.c_str())); JSValueRef argument = JSValueMakeString(frame->globalContext(), jsNotification.get()); - JSObjectCallAsFunction(frame->globalContext(), it->second, NULL, 1, &argument, NULL); + JSObjectCallAsFunction(frame->globalContext(), it->value, 0, 1, &argument, 0); } } diff --git a/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp index 90b9ae0fc..6859780f3 100644 --- a/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ b/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp @@ -66,7 +66,7 @@ wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long ide if (it == m_urlMap.end()) return L"<unknown>"; - return urlSuitableForTestResult(it->second); + return urlSuitableForTestResult(it->value); } wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request) diff --git a/Tools/DumpRenderTree/win/TestRunnerWin.cpp b/Tools/DumpRenderTree/win/TestRunnerWin.cpp index c4400fdcb..3e48ade65 100644 --- a/Tools/DumpRenderTree/win/TestRunnerWin.cpp +++ b/Tools/DumpRenderTree/win/TestRunnerWin.cpp @@ -179,21 +179,6 @@ JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, J return JSValueMakeUndefined(context); } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR textBSTR = 0; - HRESULT hr = framePrivate->layerTreeAsText(&textBSTR); - - wstring text(textBSTR, SysStringLen(textBSTR)); - SysFreeString(textBSTR); - JSRetainPtr<JSStringRef> textValueJS(Adopt, JSStringCreateWithCharacters(text.data(), text.length())); - return textValueJS; -} - JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { COMPtr<IWebView> webView; @@ -414,7 +399,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo // See https://bugs.webkit.org/show_bug.cgi?id=30335. } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { // FIXME: Implement for Geolocation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=28264. @@ -1246,8 +1231,8 @@ unsigned worldIDForWorld(IWebScriptWorld* world) { WorldMap::const_iterator end = worldMap().end(); for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { - if (it->second == world) - return it->first; + if (it->value == world) + return it->key; } return 0; @@ -1271,7 +1256,7 @@ void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef glo if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) return; } else { - COMPtr<IWebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->second; + COMPtr<IWebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value; if (!worldSlot && FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(worldSlot), reinterpret_cast<void**>(&worldSlot)))) return; world = worldSlot; diff --git a/Tools/DumpRenderTree/wx/TestRunnerWx.cpp b/Tools/DumpRenderTree/wx/TestRunnerWx.cpp index e780cfe52..35a9137e7 100644 --- a/Tools/DumpRenderTree/wx/TestRunnerWx.cpp +++ b/Tools/DumpRenderTree/wx/TestRunnerWx.cpp @@ -333,7 +333,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo // See https://bugs.webkit.org/show_bug.cgi?id=30335. } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { // FIXME: Implement for Geolocation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=28264. @@ -497,11 +497,6 @@ bool TestRunner::callShouldCloseOnWebView() return false; } -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - return 0; -} - JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const { return 0; |