diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Tools/DumpRenderTree | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Tools/DumpRenderTree')
44 files changed, 1508 insertions, 173 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index 02378cb6c..774ca9008 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -231,6 +231,9 @@ 'dependencies': [ 'ImageDiff#host', ], + 'sources/': [ + ['include', 'chromium/TestShellLinux\\.cpp$'], + ], },{ # OS!="android" 'sources/': [ ['exclude', '(Android)\\.cpp$'] diff --git a/Tools/DumpRenderTree/DumpRenderTreePrefix.h b/Tools/DumpRenderTree/DumpRenderTreePrefix.h index 1344754a6..010ca019d 100644 --- a/Tools/DumpRenderTree/DumpRenderTreePrefix.h +++ b/Tools/DumpRenderTree/DumpRenderTreePrefix.h @@ -32,7 +32,11 @@ #endif +#if defined(WIN32) || defined(_WIN32) + // If we don't define these, they get defined in windef.h. // We want to use std::min and std::max #define max max #define min min + +#endif diff --git a/Tools/DumpRenderTree/LayoutTestController.cpp b/Tools/DumpRenderTree/LayoutTestController.cpp index ae1164e5a..077b08238 100644 --- a/Tools/DumpRenderTree/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/LayoutTestController.cpp @@ -1886,22 +1886,6 @@ static JSValueRef pauseTransitionAtTimeOnElementWithIdCallback(JSContextRef cont return JSValueMakeBoolean(context, controller->pauseTransitionAtTimeOnElementWithId(propertyName.get(), time, elementId.get())); } -static JSValueRef sampleSVGAnimationForElementAtTimeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> animationId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - double time = JSValueToNumber(context, arguments[1], exception); - ASSERT(!*exception); - JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception)); - ASSERT(!*exception); - - LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeBoolean(context, controller->sampleSVGAnimationForElementAtTime(animationId.get(), time, elementId.get())); -} - static JSValueRef numberOfActiveAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount != 0) @@ -2421,7 +2405,6 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/Tools/DumpRenderTree/LayoutTestController.h b/Tools/DumpRenderTree/LayoutTestController.h index 6617cfe27..45265db6d 100644 --- a/Tools/DumpRenderTree/LayoutTestController.h +++ b/Tools/DumpRenderTree/LayoutTestController.h @@ -292,7 +292,6 @@ public: bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId); bool pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId); - bool sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId); unsigned numberOfActiveAnimations() const; void suspendAnimations() const; void resumeAnimations() const; diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index 989e16d8f..65dcaecd3 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -29,7 +29,7 @@ #include <assert.h> #include <string.h> -#if defined(ANDROID) +#if defined(XP_UNIX) || defined(ANDROID) #include <unistd.h> #endif diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp index c07bb2739..81fd33cb8 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -773,7 +773,7 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) return NPERR_NO_ERROR; } if (variable == NPPVpluginDescriptionString) { - *((char **)value) = const_cast<char*>("Simple Netscape plug-in that handles test content for WebKit"); + *((char **)value) = const_cast<char*>("Simple Netscape® plug-in that handles test content for WebKit"); return NPERR_NO_ERROR; } if (variable == NPPVpluginNeedsXEmbed) { diff --git a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npapi.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h index 627bc97a9..627bc97a9 100644 --- a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npapi.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h diff --git a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h index 54a603dbb..54a603dbb 100644 --- a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h diff --git a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h index e435ae2ab..e435ae2ab 100644 --- a/Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h diff --git a/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp new file mode 100644 index 000000000..14901aed6 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp @@ -0,0 +1,899 @@ +/* + * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "LayoutTestController.h" + +#include "CString.h" +#include "DatabaseTracker.h" +#include "Document.h" +#include "DocumentLoader.h" +#include "DocumentMarker.h" +#include "DumpRenderTree.h" +#include "DumpRenderTreeBlackBerry.h" +#include "DumpRenderTreeSupport.h" +#include "EditingBehaviorTypes.h" +#include "EditorClientBlackBerry.h" +#include "Element.h" +#include "Frame.h" +#include "HTMLInputElement.h" +#include "JSElement.h" +#include "KURL.h" +#include "NotImplemented.h" +#include "OwnArrayPtr.h" +#include "Page.h" +#include "RenderTreeAsText.h" +#include "SchemeRegistry.h" +#include "SecurityOrigin.h" +#include "SecurityPolicy.h" +#include "Settings.h" +#include "UnusedParam.h" +#include "WorkQueue.h" +#include "WorkQueueItem.h" +#include "WorkerThread.h" + +#include <JavaScriptCore/APICast.h> +#include <SharedPointer.h> +#include <WebPage.h> +#include <WebSettings.h> + +using WebCore::toElement; +using WebCore::toJS; + +LayoutTestController::~LayoutTestController() +{ +} + +void LayoutTestController::addDisallowedURL(JSStringRef url) +{ + UNUSED_PARAM(url); + notImplemented(); +} + +void LayoutTestController::clearAllDatabases() +{ +#if ENABLE(DATABASE) + WebCore::DatabaseTracker::tracker().deleteAllDatabases(); +#endif +} + +void LayoutTestController::clearBackForwardList() +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->clearBackForwardList(true); +} + +void LayoutTestController::clearPersistentUserStyleSheet() +{ + notImplemented(); +} + +JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name) +{ + UNUSED_PARAM(name); + notImplemented(); + return 0; +} + +JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) +{ + UNUSED_PARAM(name); + notImplemented(); + return 0; +} + +void LayoutTestController::dispatchPendingLoadRequests() +{ + notImplemented(); +} + +void LayoutTestController::display() +{ + notImplemented(); +} + +static WTF::String jsStringRefToWebCoreString(JSStringRef str) +{ + size_t strArrSize = JSStringGetMaximumUTF8CStringSize(str); + OwnArrayPtr<char> strArr = adoptArrayPtr(new char[strArrSize]); + JSStringGetUTF8CString(str, strArr.get(), strArrSize); + return WTF::String::fromUTF8(strArr.get()); +} + +void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) +{ + if (!mainFrame) + return; + + WTF::String nameStr = jsStringRefToWebCoreString(name); + WTF::String valueStr = jsStringRefToWebCoreString(value); + + mainFrame->editor()->command(nameStr).execute(valueStr); +} + +bool LayoutTestController::isCommandEnabled(JSStringRef name) +{ + if (!mainFrame) + return false; + + WTF::String nameStr = jsStringRefToWebCoreString(name); + + return mainFrame->editor()->command(nameStr).isEnabled(); +} + +void LayoutTestController::keepWebHistory() +{ + notImplemented(); +} + +void LayoutTestController::notifyDone() +{ + if (m_waitToDump && (!topLoadingFrame || BlackBerry::WebKit::DumpRenderTree::currentInstance()->loadFinished()) && !WorkQueue::shared()->count()) + dump(); + + m_waitToDump = false; + waitForPolicy = false; +} + +JSStringRef LayoutTestController::pathToLocalResource(JSContextRef, JSStringRef url) +{ + return JSStringRetain(url); +} + +void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target) +{ + size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(url); + OwnArrayPtr<char> urlArr = adoptArrayPtr(new char[urlArrSize]); + JSStringGetUTF8CString(url, urlArr.get(), urlArrSize); + + WebCore::KURL base = mainFrame->loader()->documentLoader()->response().url(); + WebCore::KURL absolute(base, urlArr.get()); + + JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absolute.string().utf8().data())); + WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target)); +} + +void LayoutTestController::setAcceptsEditing(bool acceptsEditing) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->setAcceptsEditing(acceptsEditing); +} + +void LayoutTestController::setAppCacheMaximumSize(unsigned long long quota) +{ + UNUSED_PARAM(quota); + notImplemented(); +} + +void LayoutTestController::setAuthorAndUserStylesEnabled(bool enable) +{ + mainFrame->page()->settings()->setAuthorAndUserStylesEnabled(enable); +} + +void LayoutTestController::setCacheModel(int) +{ + notImplemented(); +} + +void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive) +{ + UNUSED_PARAM(setDelegate); + UNUSED_PARAM(permissive); + notImplemented(); +} + +void LayoutTestController::clearApplicationCacheForOrigin(OpaqueJSString*) +{ + // FIXME: Implement to support deleting all application caches for an origin. + notImplemented(); +} + +long long LayoutTestController::localStorageDiskUsageForOrigin(JSStringRef) +{ + // FIXME: Implement to support getting disk usage in bytes for an origin. + notImplemented(); + return 0; +} + +JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) +{ + // FIXME: Implement to get origins that contain application caches. + notImplemented(); + return JSValueMakeUndefined(context); +} + +void LayoutTestController::setDatabaseQuota(unsigned long long quota) +{ + if (!mainFrame) + return; + + WebCore::DatabaseTracker::tracker().setQuota(mainFrame->document()->securityOrigin(), quota); +} + +void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) +{ + WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, jsStringRefToWebCoreString(scheme)); +} + +void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) +{ + UNUSED_PARAM(iconDatabaseEnabled); + notImplemented(); +} + +void LayoutTestController::setJavaScriptProfilingEnabled(bool profilingEnabled) +{ + UNUSED_PARAM(profilingEnabled); + notImplemented(); +} + +void LayoutTestController::setMainFrameIsFirstResponder(bool flag) +{ + UNUSED_PARAM(flag); + notImplemented(); +} + +void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef path) +{ + UNUSED_PARAM(path); + notImplemented(); +} + +void LayoutTestController::setPopupBlockingEnabled(bool flag) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setJavaScriptOpenWindowsAutomatically(!flag); +} + +void LayoutTestController::setPrivateBrowsingEnabled(bool flag) +{ + UNUSED_PARAM(flag); + notImplemented(); +} + +void LayoutTestController::setXSSAuditorEnabled(bool flag) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setXSSAuditorEnabled(flag); +} + +void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->setSelectTrailingWhitespaceEnabled(flag); +} + +void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) +{ + UNUSED_PARAM(flag); + notImplemented(); +} + +void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles) +{ + if (!mainFrame) + return; + + mainFrame->page()->setTabKeyCyclesThroughElements(cycles); +} + +void LayoutTestController::setUseDashboardCompatibilityMode(bool flag) +{ + UNUSED_PARAM(flag); + notImplemented(); +} + +void LayoutTestController::setUserStyleSheetEnabled(bool flag) +{ + UNUSED_PARAM(flag); + notImplemented(); +} + +void LayoutTestController::setUserStyleSheetLocation(JSStringRef path) +{ + WTF::String pathStr = jsStringRefToWebCoreString(path); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setUserStyleSheetLocation(pathStr.utf8().data()); +} + +void LayoutTestController::waitForPolicyDelegate() +{ + setWaitToDump(true); + waitForPolicy = true; +} + +size_t LayoutTestController::webHistoryItemCount() +{ + SharedArray<BlackBerry::WebKit::WebPage::BackForwardEntry> backForwardList; + unsigned size; + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->getBackForwardList(backForwardList, size); + return size; +} + +int LayoutTestController::windowCount() +{ + notImplemented(); + return 0; +} + +bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) +{ + UNUSED_PARAM(id); + notImplemented(); + return false; +} + +JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const +{ + UNUSED_PARAM(propertyName); + UNUSED_PARAM(pageNumber); + notImplemented(); + return 0; +} + +void LayoutTestController::setWaitToDump(bool waitToDump) +{ + // Change from 30s to 35s because some test cases in multipart need 30 seconds, + // refer to http/tests/multipart/resources/multipart-wait-before-boundary.php please. + static const double kWaitToDumpWatchdogInterval = 35.0; + m_waitToDump = waitToDump; + if (m_waitToDump) + BlackBerry::WebKit::DumpRenderTree::currentInstance()->setWaitToDumpWatchdog(kWaitToDumpWatchdogInterval); +} + +void LayoutTestController::setWindowIsKey(bool windowIsKey) +{ + m_windowIsKey = windowIsKey; + notImplemented(); +} + +bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) +{ + if (!mainFrame) + return false; + + int nameLen = JSStringGetMaximumUTF8CStringSize(animationName); + int idLen = JSStringGetMaximumUTF8CStringSize(elementId); + OwnArrayPtr<char> name = adoptArrayPtr(new char[nameLen]); + OwnArrayPtr<char> eId = adoptArrayPtr(new char[idLen]); + + JSStringGetUTF8CString(animationName, name.get(), nameLen); + JSStringGetUTF8CString(elementId, eId.get(), idLen); + + WebCore::AnimationController* animationController = mainFrame->animation(); + if (!animationController) + return false; + + WebCore::Node* node = mainFrame->document()->getElementById(eId.get()); + if (!node || !node->renderer()) + return false; + + return animationController->pauseAnimationAtTime(node->renderer(), name.get(), time); +} + +bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) +{ + if (!mainFrame) + return false; + + int nameLen = JSStringGetMaximumUTF8CStringSize(propertyName); + int idLen = JSStringGetMaximumUTF8CStringSize(elementId); + OwnArrayPtr<char> name = adoptArrayPtr(new char[nameLen]); + OwnArrayPtr<char> eId = adoptArrayPtr(new char[idLen]); + + JSStringGetUTF8CString(propertyName, name.get(), nameLen); + JSStringGetUTF8CString(elementId, eId.get(), idLen); + + WebCore::AnimationController* animationController = mainFrame->animation(); + if (!animationController) + return false; + + WebCore::Node* node = mainFrame->document()->getElementById(eId.get()); + if (!node || !node->renderer()) + return false; + + return animationController->pauseTransitionAtTime(node->renderer(), name.get(), time); +} + +unsigned LayoutTestController::numberOfActiveAnimations() const +{ + if (!mainFrame) + return false; + + WebCore::AnimationController* animationController = mainFrame->animation(); + if (!animationController) + return false; + + return animationController->numberOfActiveAnimations(mainFrame->document()); +} + +unsigned int LayoutTestController::workerThreadCount() const +{ +#if ENABLE_WORKERS + return WebCore::WorkerThread::workerThreadCount(); +#else + return 0; +#endif +} + +void LayoutTestController::removeAllVisitedLinks() +{ + notImplemented(); +} + +void LayoutTestController::disableImageLoading() +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setLoadsImagesAutomatically(false); +} + +JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) +{ + WTF::String idStr = jsStringRefToWebCoreString(id); + WebCore::Element* coreElement = mainFrame->document()->getElementById(AtomicString(idStr)); + if (!coreElement) + return 0; + + CString counterValueStr = counterValueForElement(coreElement).utf8(); + if (counterValueStr.isNull()) + return 0; + + JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueStr.data())); + return counterValue; +} + +void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value) +{ + if (!mainFrame) + return; + + WTF::String keyStr = jsStringRefToWebCoreString(key); + WTF::String valueStr = jsStringRefToWebCoreString(value); + + if (keyStr == "WebKitUsesPageCachePreferenceKey") + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setMaximumPagesInCache(1); + else if (keyStr == "WebKitUsePreHTML5ParserQuirks") + mainFrame->page()->settings()->setUsePreHTML5ParserQuirks(true); + else if (keyStr == "WebKitTabToLinksPreferenceKey") + DumpRenderTreeSupport::setLinksIncludedInFocusChain(valueStr == "true" || valueStr == "1"); + else if (keyStr == "WebKitHyperlinkAuditingEnabled") + mainFrame->page()->settings()->setHyperlinkAuditingEnabled(valueStr == "true" || valueStr == "1"); +} + +void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies) +{ + UNUSED_PARAM(alwaysAcceptCookies); + notImplemented(); +} + +void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ + DumpRenderTreeSupport::setMockGeolocationPosition(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), latitude, longitude, accuracy); +} + +void LayoutTestController::setMockGeolocationError(int code, JSStringRef message) +{ + WTF::String messageStr = jsStringRefToWebCoreString(message); + DumpRenderTreeSupport::setMockGeolocationError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), code, messageStr); +} + +void LayoutTestController::showWebInspector() +{ + notImplemented(); +} + +void LayoutTestController::closeWebInspector() +{ + notImplemented(); +} + +void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) +{ + UNUSED_PARAM(callId); + UNUSED_PARAM(script); + notImplemented(); +} + +void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) +{ + UNUSED_PARAM(worldID); + UNUSED_PARAM(globalObject); + UNUSED_PARAM(script); + notImplemented(); +} + +void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) +{ + UNUSED_PARAM(source); + UNUSED_PARAM(runAtStart); + UNUSED_PARAM(allFrames); + notImplemented(); +} + +void LayoutTestController::addUserStyleSheet(JSStringRef, bool) +{ + notImplemented(); +} + +JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int, int, int, int, int, int, int) const +{ + notImplemented(); + return 0; +} + +int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) +{ + notImplemented(); + return -1; +} + +int LayoutTestController::numberOfPages(float, float) +{ + notImplemented(); + return -1; +} + +bool LayoutTestController::isPageBoxVisible(int) const +{ + notImplemented(); + return false; +} + +void LayoutTestController::setScrollbarPolicy(JSStringRef, JSStringRef) +{ + notImplemented(); +} + +void LayoutTestController::setWebViewEditable(bool) +{ + notImplemented(); +} + +void LayoutTestController::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) +{ + notImplemented(); +} + +bool LayoutTestController::callShouldCloseOnWebView() +{ + notImplemented(); + return false; +} + +void LayoutTestController::setFrameFlatteningEnabled(bool enable) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setFrameFlatteningEnabled(enable); +} + +void LayoutTestController::setSpatialNavigationEnabled(bool enable) +{ + notImplemented(); +} + +void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) +{ + WebCore::SecurityPolicy::addOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)), + jsStringRefToWebCoreString(destinationProtocol), + jsStringRefToWebCoreString(destinationHost), + allowDestinationSubdomains); +} + +void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) +{ + WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)), + jsStringRefToWebCoreString(destinationProtocol), + jsStringRefToWebCoreString(destinationHost), + allowDestinationSubdomains); +} + +void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) +{ + if (!mainFrame) + return; + + mainFrame->page()->settings()->setAllowFileAccessFromFileURLs(enabled); +} + +void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) +{ + if (!mainFrame) + return; + + mainFrame->page()->settings()->setAllowUniversalAccessFromFileURLs(enabled); +} + +void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ + notImplemented(); +} + +void LayoutTestController::apiTestGoToCurrentBackForwardItem() +{ + notImplemented(); +} + +void LayoutTestController::setJavaScriptCanAccessClipboard(bool flag) +{ + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->setJavaScriptCanAccessClipboard(flag); +} + +JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) +{ + return DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(context, value); +} + +JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const +{ + notImplemented(); + return 0; +} + +JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const +{ + WebCore::Element* element = toElement(toJS(toJS(context), nodeObject)); + if (!element) + return 0; + + JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(WebCore::markerTextForListItem(element).utf8().data())); + return markerText; +} + +void LayoutTestController::setPluginsEnabled(bool flag) +{ + notImplemented(); +} + +void LayoutTestController::setEditingBehavior(const char* editingBehavior) +{ + if (!mainFrame) + return; + WebCore::EditingBehaviorType type = WebCore::EditingUnixBehavior; + if (!strcmp(editingBehavior, "win")) + type = WebCore::EditingWindowsBehavior; + else if (!strcmp(editingBehavior, "mac")) + type = WebCore::EditingMacBehavior; + else if (!strcmp(editingBehavior, "unix")) + type = WebCore::EditingUnixBehavior; + else + CRASH(); + mainFrame->page()->settings()->setEditingBehaviorType(type); +} + +void LayoutTestController::abortModal() +{ + notImplemented(); +} + +void LayoutTestController::clearAllApplicationCaches() +{ + notImplemented(); +} + +void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) +{ + notImplemented(); +} + +void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + notImplemented(); +} + +void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) +{ + notImplemented(); +} + +void LayoutTestController::setGeolocationPermission(bool allow) +{ + setGeolocationPermissionCommon(allow); + DumpRenderTreeSupport::setMockGeolocationPermission(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), allow); +} + +void LayoutTestController::setViewModeMediaFeature(const JSStringRef mode) +{ + notImplemented(); +} + +void LayoutTestController::suspendAnimations() const +{ + if (mainFrame && mainFrame->animation()) + mainFrame->animation()->suspendAnimations(); +} + +void LayoutTestController::resumeAnimations() const +{ + if (mainFrame && mainFrame->animation()) + mainFrame->animation()->resumeAnimations(); +} + +bool LayoutTestController::hasSpellingMarker(int from, int length) +{ + if (!mainFrame) + return false; + + return mainFrame->editor()->selectionStartHasMarkerFor(WebCore::DocumentMarker::Spelling, from, length); +} + +JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) +{ + notImplemented(); + return JSValueMakeUndefined(context); +} + +void LayoutTestController::setSerializeHTTPLoads(bool) +{ + // FIXME: Implement if needed for https://bugs.webkit.org/show_bug.cgi?id=50758. + notImplemented(); +} + +void LayoutTestController::setMinimumTimerInterval(double) +{ + notImplemented(); +} + +void LayoutTestController::setTextDirection(JSStringRef) +{ + notImplemented(); +} + +void LayoutTestController::allowRoundingHacks() +{ + notImplemented(); +} + +void LayoutTestController::goBack() +{ + // FIXME: implement to enable loader/navigation-while-deferring-loads.html + notImplemented(); +} + +void LayoutTestController::setDefersLoading(bool) +{ + // FIXME: implement to enable loader/navigation-while-deferring-loads.html + notImplemented(); +} + +JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) +{ + notImplemented(); + return JSValueMakeUndefined(context); +} + +void LayoutTestController::observeStorageTrackerNotifications(unsigned) +{ + notImplemented(); +} + +void LayoutTestController::syncLocalStorage() +{ + notImplemented(); +} + +void LayoutTestController::deleteAllLocalStorage() +{ + notImplemented(); +} + +void LayoutTestController::setAsynchronousSpellCheckingEnabled(bool) +{ + notImplemented(); +} + +void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) +{ + JSC::ExecState* exec = toJS(context); + WebCore::Element* element = toElement(toJS(exec, nodeObject)); + if (!element) + return; + WebCore::HTMLInputElement* inputElement = element->toInputElement(); + if (!inputElement) + return; + + inputElement->setAutofilled(autofilled); +} + +int LayoutTestController::numberOfPendingGeolocationPermissionRequests() +{ + return DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()); +} + +bool LayoutTestController::hasGrammarMarker(int from, int length) +{ + if (!mainFrame) + return false; + + return mainFrame->editor()->selectionStartHasMarkerFor(WebCore::DocumentMarker::Grammar, from, length); +} + +void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) +{ + if (!mainFrame) + return; + + DumpRenderTreeSupport::dumpConfigurationForViewport(mainFrame, deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight); +} + +bool LayoutTestController::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) +{ + WebCore::FindOptions options = 0; + + JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); + JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); + if (!JSValueIsNumber(context, lengthValue)) + return false; + + WTF::String nameStr = jsStringRefToWebCoreString(target); + + size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); + for (size_t i = 0; i < length; ++i) { + JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0); + if (!JSValueIsString(context, value)) + continue; + + JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0)); + + if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive")) + options |= WebCore::CaseInsensitive; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) + options |= WebCore::AtWordStarts; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) + options |= WebCore::TreatMedialCapitalAsWordStart; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) + options |= WebCore::Backwards; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) + options |= WebCore::WrapAround; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) + options |= WebCore::StartInSelection; + } + return BlackBerry::WebKit::DumpRenderTree::currentInstance()->findString(nameStr, options); +} + +void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL) +{ + // FIXME: Implement. +} + +void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) +{ + JSC::ExecState* exec = toJS(context); + WebCore::Element* element = toElement(toJS(exec, nodeObject)); + if (!element) + return; + WebCore::HTMLInputElement* inputElement = element->toInputElement(); + if (!inputElement) + return; + + inputElement->setValueForUser(jsStringRefToWebCoreString(value)); +} + +long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef origin) +{ + // FIXME: Implement to support getting disk usage by all application caches for an origin. + return 0; +} + +void LayoutTestController::addChromeInputField() +{ +} + +void LayoutTestController::removeChromeInputField() +{ +} + +void LayoutTestController::focusWebView() +{ +} + +void LayoutTestController::setBackingScaleFactor(double) +{ +} + diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp new file mode 100644 index 000000000..fdb4a2930 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Portions of this file are Copyright 2005 Google Inc. + */ + +#include "config.h" +#include "PNGImageEncoder.h" + +#include "SkBitmap.h" +#include "SkUnPreMultiply.h" + +extern "C" { +#include "png.h" +} + +#include <OwnArrayPtr.h> + +// This code is almost a mirror of the code in WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp +// since we can't include this private WebCore file in a WebKit-client application. + +// Converts BGRA->RGBA and RGBA->BGRA and undoes alpha premultiplication. +static void preMultipliedBGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output) +{ + SkBitmap inputBitmap; + inputBitmap.setConfig(SkBitmap::kARGB_8888_Config, numberOfPixels, 1); + inputBitmap.setPixels(const_cast<unsigned char*>(input)); + for (int x = 0; x < numberOfPixels; x++) { + uint32_t srcPixel = *inputBitmap.getAddr32(x, 0); + SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(srcPixel); + unsigned char* pixelOut = &output[x * 4]; + pixelOut[0] = SkColorGetR(unmultiplied); + pixelOut[1] = SkColorGetG(unmultiplied); + pixelOut[2] = SkColorGetB(unmultiplied); + pixelOut[3] = SkColorGetA(unmultiplied); + } +} + +// Passed around as the io_ptr in the png structs so our callbacks know where +// to write data. +struct PNGEncoderState { + PNGEncoderState(Vector<unsigned char>* o) : m_out(o) { } + Vector<unsigned char>* m_out; +}; + +// Called by libpng to flush its internal buffer to ours. +void encoderWriteCallback(png_structp png, png_bytep data, png_size_t size) +{ + PNGEncoderState* state = static_cast<PNGEncoderState*>(png_get_io_ptr(png)); + ASSERT(state->m_out); + + size_t oldSize = state->m_out->size(); + state->m_out->resize(oldSize + size); + memcpy(&(*state->m_out)[oldSize], data, size); +} + +// Automatically destroys the given write structs on destruction to make +// cleanup and error handling code cleaner. +class PNGWriteStructDestroyer { +public: + PNGWriteStructDestroyer(png_struct** ps, png_info** pi) + : m_pngStruct(ps) + , m_pngInfo(pi) + { + } + + ~PNGWriteStructDestroyer() + { + png_destroy_write_struct(m_pngStruct, m_pngInfo); + } + +private: + png_struct** m_pngStruct; + png_info** m_pngInfo; +}; + +typedef void (*PixelConversionFunc)(const unsigned char*, int, unsigned char*); +static bool encodeImpl(const unsigned char* input, int imageWidth, int imageHeight, int bytesPerRow, Vector<unsigned char>* output, PixelConversionFunc conversionFunc) +{ + int inputColorComponents = 4; + int outputColorComponents = 4; + int pngOutputColorType = PNG_COLOR_TYPE_RGB_ALPHA; + + if (imageWidth < 0) + imageWidth = 0; + + if (imageHeight < 0) + imageHeight = 0; + + // Row stride should be at least as long as the length of the data. + if (inputColorComponents * imageWidth > bytesPerRow) { + ASSERT(false); + return false; + } + + png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + if (!pngPtr) + return false; + + png_info* infoPtr = png_create_info_struct(pngPtr); + if (!infoPtr) { + png_destroy_write_struct(&pngPtr, 0); + return false; + } + PNGWriteStructDestroyer destroyer(&pngPtr, &infoPtr); + + if (setjmp(png_jmpbuf(pngPtr))) { + // The destroyer will ensure that the structures are cleaned up in this + // case, even though we may get here as a jump from random parts of the + // PNG library called below. + return false; + } + + // Set our callback for libpng to give us the data. + PNGEncoderState state(output); + png_set_write_fn(pngPtr, &state, encoderWriteCallback, 0); + + png_set_IHDR(pngPtr, infoPtr, imageWidth, imageHeight, 8, pngOutputColorType, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + png_write_info(pngPtr, infoPtr); + + OwnArrayPtr<unsigned char> rowPixels = adoptArrayPtr(new unsigned char[imageWidth * outputColorComponents]); + for (int y = 0; y < imageHeight; y ++) { + conversionFunc(&input[y * bytesPerRow], imageWidth, rowPixels.get()); + png_write_row(pngPtr, rowPixels.get()); + } + + png_write_end(pngPtr, infoPtr); + return true; +} + +bool encodeSkBitmapToPNG(const SkBitmap& image, Vector<unsigned char>* output) +{ + if (image.config() != SkBitmap::kARGB_8888_Config) + return false; // Only support ARGB at 8 bpp now. + + image.lockPixels(); + bool result = encodeImpl(static_cast<unsigned char*>(image.getPixels()), image.width(), image.height(), image.rowBytes(), output, preMultipliedBGRAtoRGBA); + image.unlockPixels(); + return result; +} diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h new file mode 100644 index 000000000..3407bdce8 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PNGImageEncoder_h +#define PNGImageEncoder_h + +#include <Vector.h> + +class SkBitmap; + +bool encodeSkBitmapToPNG(const SkBitmap&, WTF::Vector<unsigned char>* output); + +#endif // PNGImageEncoder_h diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp new file mode 100644 index 000000000..4bea0c146 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "PixelDumpSupportBlackBerry.h" + +#include "DumpRenderTreeBlackBerry.h" +#include "PNGImageEncoder.h" +#include "PixelDumpSupport.h" +#include "WebPage.h" +#include "WebPageClient.h" + +#include <BlackBerryPlatformWindow.h> +#include <MD5.h> +#include <Vector.h> +#include <skia/SkDevice.h> + +using namespace BlackBerry::WebKit; +using namespace BlackBerry; +using namespace WTF; + +PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool /*incrementalRepaint*/, bool /*sweepHorizontally*/, bool /*drawSelectionRect*/) +{ + Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window(); + ASSERT(window); + + const Platform::IntRect& windowRect = window->viewportRect(); + + SkBitmap* bitmap = new SkBitmap; + bitmap->setConfig(SkBitmap::kARGB_8888_Config, windowRect.width(), windowRect.height()); // We use 32-bit RGBA since that is the pixel format that ImageDiff expects. + bitmap->allocPixels(); + + SkCanvas* canvas = new SkCanvas; + canvas->setBitmapDevice(*bitmap); + + // We need to force a synchronous update to the window or we may get an empty bitmap. + // For example, running DRT with one test case that finishes before the screen is updated. + window->post(windowRect); + + const SkBitmap* windowBitmap = static_cast<const SkBitmap*>(lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess)); + canvas->drawBitmap(*windowBitmap, 0, 0); // Draw the bitmap at (0, 0). + Platform::Graphics::releaseBufferBackingImage(window->buffer()); + return BitmapContext::createByAdoptingBitmapAndContext(bitmap, canvas); +} + +void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33]) +{ + const SkBitmap& bitmap = context->canvas()->getDevice()->accessBitmap(false); + ASSERT(bitmap.bytesPerPixel() == 4); // 32-bit RGBA + + int pixelsWide = bitmap.width(); + int pixelsHigh = bitmap.height(); + int bytesPerRow = bitmap.rowBytes(); + unsigned char* pixelData = (unsigned char*)bitmap.getPixels(); + + MD5 md5; + for (int i = 0; i < pixelsHigh; ++i) { + md5.addBytes(pixelData, 4 * pixelsWide); + pixelData += bytesPerRow; + } + + Vector<uint8_t, 16> hash; + md5.checksum(hash); + + hashString[0] = '\0'; + for (int i = 0; i < 16; ++i) + snprintf(hashString, 33, "%s%02x", hashString, hash[i]); +} + +static void printPNG(SkCanvas* canvas, const char* checksum) +{ + Vector<unsigned char> pngData; + encodeSkBitmapToPNG(canvas->getDevice()->accessBitmap(false), &pngData); + printPNG(pngData.data(), pngData.size(), checksum); +} + +void dumpBitmap(BitmapContext* context, const char* checksum) +{ + printPNG(context->canvas(), checksum); +} diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h new file mode 100644 index 000000000..b52d3da18 --- /dev/null +++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PixelDumpSupportBlackBerry_h +#define PixelDumpSupportBlackBerry_h + +#include <PassRefPtr.h> +#include <RefCounted.h> +#include <skia/SkBitmap.h> +#include <skia/SkCanvas.h> + +class BitmapContext : public RefCounted<BitmapContext> { +public: + + static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(SkBitmap* bitmap, SkCanvas* canvas) + { + return adoptRef(new BitmapContext(bitmap, canvas)); + } + + ~BitmapContext() + { + delete m_bitmap; + delete m_canvas; + } + + SkCanvas* canvas() { return m_canvas; } + +private: + + BitmapContext(SkBitmap* bitmap, SkCanvas* canvas) + : m_bitmap(bitmap) + , m_canvas(canvas) + { + } + + SkBitmap* m_bitmap; + SkCanvas* m_canvas; + +}; + +#endif // PixelDumpSupportBlackBerry_h diff --git a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp index 07e51130c..e194a0080 100644 --- a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp +++ b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp @@ -24,7 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if defined(WIN32) || defined(_WIN32) #define min min +#endif // FIXME: We need to be able to include these defines from a config.h somewhere. #define JS_EXPORT_PRIVATE diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp index 9acc42dfb..cc73b2dbd 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/EventSender.cpp @@ -354,7 +354,15 @@ void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*) { - printf("Filename being dragged: %s\n", currentDragData.fileContentFilename().utf8().data()); + WebString filename; + WebVector<WebDragData::Item> items = currentDragData.items(); + for (size_t i = 0; i < items.size(); ++i) { + if (items[i].storageType == WebDragData::Item::StorageTypeBinaryData) { + filename = items[i].title; + break; + } + } + printf("Filename being dragged: %s\n", filename.utf8().data()); } WebMouseEvent::Button EventSender::getButtonTypeFromButtonNumber(int buttonCode) @@ -869,8 +877,12 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian { currentDragData.initialize(); Vector<string> files = arguments[0].toStringVector(); - for (size_t i = 0; i < files.size(); ++i) - currentDragData.appendToFilenames(webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i])); + for (size_t i = 0; i < files.size(); ++i) { + WebDragData::Item item; + item.storageType = WebDragData::Item::StorageTypeFilename; + item.filenameData = webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]); + currentDragData.addItem(item); + } currentDragEffectsAllowed = WebKit::WebDragOperationCopy; // Provide a drag source. diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index b0347c853..3c3b83ba2 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -159,7 +159,6 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHorizontally); bindMethod("resetPageVisibility", &LayoutTestController::resetPageVisibility); bindMethod("resumeAnimations", &LayoutTestController::resumeAnimations); - bindMethod("sampleSVGAnimationForElementAtTime", &LayoutTestController::sampleSVGAnimationForElementAtTime); bindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing); bindMethod("setAllowDisplayOfInsecureContent", &LayoutTestController::setAllowDisplayOfInsecureContent); bindMethod("setAllowFileAccessFromFileURLs", &LayoutTestController::setAllowFileAccessFromFileURLs); @@ -1146,19 +1145,6 @@ void LayoutTestController::resumeAnimations(const CppArgumentList&, CppVariant* result->setNull(); } -void LayoutTestController::sampleSVGAnimationForElementAtTime(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 3) { - result->setNull(); - return; - } - WebString animationId = cppVariantToWebString(arguments[0]); - double time = arguments[1].toDouble(); - WebString elementId = cppVariantToWebString(arguments[2]); - bool success = m_shell->webView()->mainFrame()->pauseSVGAnimation(animationId, time, elementId); - result->set(success); -} - void LayoutTestController::disableImageLoading(const CppArgumentList&, CppVariant* result) { m_shell->preferences()->loadsImagesAutomatically = false; @@ -1535,6 +1521,8 @@ void LayoutTestController::overridePreference(const CppArgumentList& arguments, prefs->tabsToLinks = cppVariantToBool(value); else if (key == "WebKitWebGLEnabled") prefs->experimentalWebGLEnabled = cppVariantToBool(value); + else if (key == "WebKitCSSRegionsEnabled") + prefs->experimentalCSSRegionsEnabled = cppVariantToBool(value); else if (key == "WebKitHyperlinkAuditingEnabled") prefs->hyperlinkAuditingEnabled = cppVariantToBool(value); else if (key == "WebKitEnableCaretBrowsing") diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h index a686e8605..99bd0c469 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h @@ -244,7 +244,6 @@ public: void numberOfActiveAnimations(const CppArgumentList&, CppVariant*); void suspendAnimations(const CppArgumentList&, CppVariant*); void resumeAnimations(const CppArgumentList&, CppVariant*); - void sampleSVGAnimationForElementAtTime(const CppArgumentList&, CppVariant*); void disableImageLoading(const CppArgumentList&, CppVariant*); void setIconDatabaseEnabled(const CppArgumentList&, CppVariant*); void dumpSelectionRect(const CppArgumentList&, CppVariant*); diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index f576d2417..c175fda99 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -116,6 +116,7 @@ TestShell::TestShell(bool testShellMode) , m_stressOpt(false) , m_stressDeopt(false) , m_dumpWhenFinished(true) + , m_isDisplayingModalDialog(false) { WebRuntimeFeatures::enableDataTransferItems(true); WebRuntimeFeatures::enableGeolocation(true); @@ -128,6 +129,7 @@ TestShell::TestShell(bool testShellMode) WebRuntimeFeatures::enableVideoTrack(true); WebRuntimeFeatures::enableGamepad(true); WebRuntimeFeatures::enableShadowDOM(true); + WebRuntimeFeatures::enableStyleScoped(true); m_webPermissions = adoptPtr(new WebPermissions(this)); m_accessibilityController = adoptPtr(new AccessibilityController(this)); @@ -240,6 +242,7 @@ void TestShell::runFileTest(const TestParams& params) m_prefs.acceleratedCompositingForVideoEnabled = true; m_prefs.accelerated2dCanvasEnabled = true; m_prefs.deferred2dCanvasEnabled = true; + m_prefs.mockScrollbarsEnabled = true; m_prefs.applyTo(m_webView); } diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 1ee5ce9a1..4bbaf61fb 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -163,6 +163,9 @@ public: // testing where we only want to have the output from the last load. void setDumpWhenFinished(bool dumpWhenFinished) { m_dumpWhenFinished = dumpWhenFinished; } + void setIsDisplayingModalDialog(bool isDisplayingModalDialog) { m_isDisplayingModalDialog = isDisplayingModalDialog; } + bool isDisplayingModalDialog() const { return m_isDisplayingModalDialog; } + WebViewHost* createNewWindow(const WebKit::WebURL&); void closeWindow(WebViewHost*); void closeRemainingWindows(); @@ -234,6 +237,7 @@ private: bool m_stressDeopt; std::string m_javaScriptFlags; bool m_dumpWhenFinished; + bool m_isDisplayingModalDialog; // List of all windows in this process. diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp index 872ebfb4a..0e3ce6c52 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp @@ -80,6 +80,7 @@ void WebPreferences::reset() defaultTextEncodingName = WebString::fromUTF8("ISO-8859-1"); developerExtrasEnabled = true; experimentalWebGLEnabled = false; + experimentalCSSRegionsEnabled = true; javaEnabled = false; javaScriptCanAccessClipboard = true; javaScriptCanOpenWindowsAutomatically = true; @@ -117,6 +118,7 @@ void WebPreferences::reset() forceCompositingMode = false; hixie76WebSocketProtocolEnabled = true; perTilePaintingEnabled = false; + mockScrollbarsEnabled = false; } static void setStandardFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) @@ -192,6 +194,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setDefaultTextEncodingName(defaultTextEncodingName); settings->setDeveloperExtrasEnabled(developerExtrasEnabled); settings->setExperimentalWebGLEnabled(experimentalWebGLEnabled); + settings->setExperimentalCSSRegionsEnabled(experimentalCSSRegionsEnabled); settings->setJavaEnabled(javaEnabled); settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); settings->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); @@ -222,6 +225,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); settings->setHixie76WebSocketProtocolEnabled(hixie76WebSocketProtocolEnabled); settings->setPerTilePaintingEnabled(perTilePaintingEnabled); + settings->setMockScrollbarsEnabled(mockScrollbarsEnabled); // Fixed values. settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); @@ -231,7 +235,6 @@ void WebPreferences::applyTo(WebView* webView) settings->setEditableLinkBehaviorNeverLive(); settings->setEnableScrollAnimator(false); settings->setFontRenderingModeNormal(); - settings->setMockScrollbarsEnabled(false); settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); settings->setUsesEncodingDetector(false); settings->setImagesEnabled(true); @@ -240,4 +243,5 @@ void WebPreferences::applyTo(WebView* webView) settings->setFullScreenEnabled(true); settings->setValidationMessageTimerMagnification(-1); settings->setVisualWordMovementEnabled(false); + settings->setPasswordEchoEnabled(false); } diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h index ee04a2094..1cb9ab26c 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ b/Tools/DumpRenderTree/chromium/WebPreferences.h @@ -82,6 +82,7 @@ struct WebPreferences { WebKit::WebString defaultTextEncodingName; bool developerExtrasEnabled; bool experimentalWebGLEnabled; + bool experimentalCSSRegionsEnabled; bool javaEnabled; bool javaScriptCanAccessClipboard; bool javaScriptCanOpenWindowsAutomatically; @@ -110,6 +111,7 @@ struct WebPreferences { bool acceleratedPaintingEnabled; bool hixie76WebSocketProtocolEnabled; bool perTilePaintingEnabled; + bool mockScrollbarsEnabled; WebPreferences() { reset(); } void reset(); diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp index 0f442a676..24fc144cb 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp @@ -29,6 +29,8 @@ */ #include "config.h" +#if ENABLE(MEDIA_STREAM) + #include "WebUserMediaClientMock.h" #include "WebMediaStreamRegistry.h" @@ -81,3 +83,5 @@ 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 4d91839c6..1942e3bdc 100644 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h +++ b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h @@ -31,6 +31,8 @@ #ifndef WebUserMediaClientMock_h #define WebUserMediaClientMock_h +#if ENABLE(MEDIA_STREAM) + #include "WebUserMediaClient.h" #include "platform/WebCommon.h" #include "platform/WebString.h" @@ -57,4 +59,6 @@ private: } // namespace WebKit +#endif // ENABLE(MEDIA_STREAM) + #endif // WebUserMediaClientMock_h diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index befa3b718..81603b37f 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -47,6 +47,7 @@ #include "WebFrame.h" #include "WebGeolocationClientMock.h" #include "WebHistoryItem.h" +#include "WebIntent.h" #include "WebKit.h" #include "WebNode.h" #include "WebPluginParams.h" @@ -137,7 +138,10 @@ static string descriptionSuitableForTestResult(const string& url) // dragging a file. static void addDRTFakeFileToDataObject(WebDragData* dragData) { - dragData->appendToFilenames(WebString::fromUTF8("DRTFakeFile")); + WebDragData::Item item; + item.storageType = WebDragData::Item::StorageTypeFilename; + item.filenameData = WebString::fromUTF8("DRTFakeFile"); + dragData->addItem(item); } // Get a debugging string from a WebNavigationType. @@ -709,6 +713,7 @@ WebDeviceOrientationClient* WebViewHost::deviceOrientationClient() return deviceOrientationClientMock(); } +#if ENABLE(MEDIA_STREAM) WebUserMediaClient* WebViewHost::userMediaClient() { return userMediaClientMock(); @@ -720,6 +725,7 @@ WebUserMediaClientMock* WebViewHost::userMediaClientMock() m_userMediaClientMock = WebUserMediaClientMock::create(); return m_userMediaClientMock.get(); } +#endif // WebWidgetClient ----------------------------------------------------------- @@ -893,11 +899,21 @@ WebRect WebViewHost::windowResizerRect() void WebViewHost::runModal() { + if (m_shell->isDisplayingModalDialog()) { + // DumpRenderTree doesn't support real modal dialogs, so a test shouldn't try to start two modal dialogs at the same time. + ASSERT_NOT_REACHED(); + return; + } + // This WebViewHost might get deleted before RunMessageLoop() returns, so keep a copy of the m_shell member variable around. + ASSERT(m_shell->webViewHost() != this); + TestShell* shell = m_shell; + shell->setIsDisplayingModalDialog(true); bool oldState = webkit_support::MessageLoopNestableTasksAllowed(); webkit_support::MessageLoopSetNestableTasksAllowed(true); m_inModalLoop = true; webkit_support::RunMessageLoop(); webkit_support::MessageLoopSetNestableTasksAllowed(oldState); + shell->setIsDisplayingModalDialog(false); } bool WebViewHost::enterFullScreen() @@ -923,7 +939,11 @@ WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& par WebMediaPlayer* WebViewHost::createMediaPlayer(WebFrame* frame, WebMediaPlayerClient* client) { +#if ENABLE(MEDIA_STREAM) return webkit_support::CreateMediaPlayer(frame, client, testMediaStreamClient()); +#else + return webkit_support::CreateMediaPlayer(frame, client); +#endif } WebApplicationCacheHost* WebViewHost::createApplicationCacheHost(WebFrame* frame, WebApplicationCacheHostClient* client) @@ -1294,6 +1314,14 @@ bool WebViewHost::willCheckAndDispatchMessageEvent(WebFrame* source, WebSecurity return false; } +void WebViewHost::dispatchIntent(WebFrame* source, const WebIntentRequest& request) +{ + printf("Received Web Intent: action=%s type=%s\n", + request.intent().action().utf8().data(), + request.intent().type().utf8().data()); + m_currentRequest = request; +} + // Public functions ----------------------------------------------------------- WebViewHost::WebViewHost(TestShell* shell) @@ -1636,6 +1664,7 @@ void WebViewHost::exitFullScreenNow() webView()->didExitFullScreen(); } +#if ENABLE(MEDIA_STREAM) webkit_support::MediaStreamUtil* WebViewHost::mediaStreamUtil() { return userMediaClientMock(); @@ -1647,6 +1676,7 @@ webkit_support::TestMediaStreamClient* WebViewHost::testMediaStreamClient() m_testMediaStreamClient = adoptPtr(new webkit_support::TestMediaStreamClient(mediaStreamUtil())); return m_testMediaStreamClient.get(); } +#endif // Painting functions --------------------------------------------------------- diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 6f759728f..f80f438ad 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -37,6 +37,7 @@ #include "WebAccessibilityNotification.h" #include "WebCursorInfo.h" #include "WebFrameClient.h" +#include "WebIntentRequest.h" #include "WebSpellCheckClient.h" #include "WebViewClient.h" #include <wtf/HashMap.h> @@ -163,7 +164,9 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl virtual WebKit::WebGeolocationClient* geolocationClient(); virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*); virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); +#if ENABLE(MEDIA_STREAM) virtual WebKit::WebUserMediaClient* userMediaClient(); +#endif virtual void printPage(WebKit::WebFrame*); // WebKit::WebWidgetClient @@ -235,6 +238,7 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl 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 bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* source, WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent); + virtual void dispatchIntent(WebKit::WebFrame* source, const WebKit::WebIntentRequest&); WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock(); @@ -305,9 +309,11 @@ private: void didNotAcquirePointerLock(); #endif +#if ENABLE(MEDIA_STREAM) WebKit::WebUserMediaClientMock* userMediaClientMock(); webkit_support::MediaStreamUtil* mediaStreamUtil(); webkit_support::TestMediaStreamClient* testMediaStreamClient(); +#endif // Causes navigation actions just printout the intended navigation instead // of taking you to the page. This is used for cases like mailto, where you @@ -385,8 +391,10 @@ private: OwnPtr<WebKit::WebDeviceOrientationClientMock> m_deviceOrientationClientMock; OwnPtr<MockWebSpeechInputController> m_speechInputControllerMock; +#if ENABLE(MEDIA_STREAM) OwnPtr<WebKit::WebUserMediaClientMock> m_userMediaClientMock; OwnPtr<webkit_support::TestMediaStreamClient> m_testMediaStreamClient; +#endif OwnPtr<TestNavigationController> m_navigationController; @@ -404,6 +412,9 @@ private: PointerLockWillFailSync } m_pointerLockPlannedResult; #endif + + // For web intents: holds the current request, if any. + WebKit::WebIntentRequest m_currentRequest; }; #endif // WebViewHost_h diff --git a/Tools/DumpRenderTree/efl/CMakeLists.txt b/Tools/DumpRenderTree/efl/CMakeLists.txt index 09726f628..436dd6d85 100644 --- a/Tools/DumpRenderTree/efl/CMakeLists.txt +++ b/Tools/DumpRenderTree/efl/CMakeLists.txt @@ -35,9 +35,10 @@ SET(DumpRenderTree_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${SQLITE_LIBRARIES} + ${Glib_LIBRARIES} + ${LIBSOUP24_LIBRARIES} ) -SET(DumpRenderTree_LIBRARIES ${DumpRenderTree_LIBRARIES}) SET(DumpRenderTree_INCLUDE_DIRECTORIES "${WEBKIT_DIR}/efl/ewk" ${WEBKIT_DIR}/efl @@ -58,6 +59,7 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${WEBCORE_DIR}/platform/graphics ${WEBCORE_DIR}/platform/graphics/cairo ${WEBCORE_DIR}/platform/network + ${WEBCORE_DIR}/platform/network/soup ${WEBCORE_DIR}/plugins ${WEBCORE_DIR}/rendering ${WEBCORE_DIR}/rendering/style @@ -68,13 +70,16 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${JAVASCRIPTCORE_DIR} ${JAVASCRIPTCORE_DIR}/API ${JAVASCRIPTCORE_DIR}/assembler + ${JAVASCRIPTCORE_DIR}/bytecode ${JAVASCRIPTCORE_DIR}/dfg ${JAVASCRIPTCORE_DIR}/heap ${JAVASCRIPTCORE_DIR}/interpreter ${JAVASCRIPTCORE_DIR}/jit + ${JAVASCRIPTCORE_DIR}/llint ${JAVASCRIPTCORE_DIR}/runtime ${JAVASCRIPTCORE_DIR}/ForwardingHeaders ${JAVASCRIPTCORE_DIR}/wtf + ${JAVASCRIPTCORE_DIR}/wtf/gobject ${JAVASCRIPTCORE_DIR}/wtf/efl ${TOOLS_DIR}/DumpRenderTree ${TOOLS_DIR}/DumpRenderTree/cairo @@ -87,6 +92,8 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} + ${Glib_INCLUDE_DIRS} + ${LIBSOUP24_INCLUDE_DIRS} ) SET(DumpRenderTree_LINK_FLAGS @@ -94,30 +101,9 @@ SET(DumpRenderTree_LINK_FLAGS ${EDJE_LDFLAGS} ${EFLDEPS_LDFLAGS} ${EVAS_LDFLAGS} + ${LIBSOUP24_LDFLAGS} ) -IF (ENABLE_GLIB_SUPPORT) - LIST(APPEND DumpRenderTree_INCLUDE_DIRECTORIES "${JAVASCRIPTCORE_DIR}/wtf/gobject") - - LIST(APPEND DumpRenderTree_LIBRARIES - ${Gdk_LIBRARIES} - ${Glib_LIBRARIES} - ${Gthread_LIBRARIES} - ) -ENDIF () - -IF (WTF_USE_SOUP) - LIST(APPEND DumpRenderTree_LIBRARIES ${LIBSOUP24_LIBRARIES}) - LIST(APPEND DumpRenderTree_LINK_FLAGS ${LIBSOUP24_LDFLAGS}) - LIST(APPEND DumpRenderTree_INCLUDE_DIRECTORIES ${LIBSOUP24_INCLUDE_DIRS} ${WEBCORE_DIR}/platform/network/soup) -ENDIF () - -IF (WTF_USE_CURL) - LIST(APPEND DumpRenderTree_LIBRARIES ${CURL_LIBRARIES}) - LIST(APPEND DumpRenderTree_LINK_FLAGS ${CURL_LDFLAGS}) - LIST(APPEND DumpRenderTree_INCLUDE_DIRECTORIES ${WEBCORE_DIR}/platform/network/curl) -ENDIF () - ADD_DEFINITIONS(-DFONTS_CONF_DIR="${TOOLS_DIR}/DumpRenderTree/gtk/fonts" -DDATA_DIR="${THEME_BINARY_DIR}") diff --git a/Tools/DumpRenderTree/efl/EventSender.cpp b/Tools/DumpRenderTree/efl/EventSender.cpp index 89130f00a..93fafb9cd 100644 --- a/Tools/DumpRenderTree/efl/EventSender.cpp +++ b/Tools/DumpRenderTree/efl/EventSender.cpp @@ -98,6 +98,11 @@ enum EvasMouseEvent { EvasMouseEventClick = EvasMouseEventMove | EvasMouseEventDown | EvasMouseEventUp, }; +enum ZoomEvent { + ZoomIn, + ZoomOut +}; + static void setEvasModifiers(Evas* evas, EvasKeyModifier modifiers) { static const char* modifierNames[] = { "Control", "Shift", "Alt", "Super" }; @@ -451,6 +456,60 @@ static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function return JSValueMakeUndefined(context); } +static void textZoom(ZoomEvent zoomEvent) +{ + Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); + if (!view) + return; + + float zoomFactor = ewk_view_text_zoom_get(view); + if (zoomEvent == ZoomIn) + zoomFactor *= zoomMultiplierRatio; + else + zoomFactor /= zoomMultiplierRatio; + + ewk_view_text_zoom_set(view, zoomFactor); +} + +static void pageZoom(ZoomEvent zoomEvent) +{ + Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); + if (!view) + return; + + float zoomFactor = ewk_view_page_zoom_get(view); + if (zoomEvent == ZoomIn) + zoomFactor *= zoomMultiplierRatio; + else + zoomFactor /= zoomMultiplierRatio; + + ewk_view_page_zoom_set(view, zoomFactor); +} + +static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + textZoom(ZoomIn); + return JSValueMakeUndefined(context); +} + +static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + textZoom(ZoomOut); + return JSValueMakeUndefined(context); +} + +static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + pageZoom(ZoomIn); + return JSValueMakeUndefined(context); +} + +static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + pageZoom(ZoomOut); + return JSValueMakeUndefined(context); +} + static JSStaticFunction staticFunctions[] = { { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -460,6 +519,10 @@ static JSStaticFunction staticFunctions[] = { { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp index 66594f702..1998c2eb8 100644 --- a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp +++ b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp @@ -616,11 +616,6 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop return DumpRenderTreeSupportEfl::pauseTransition(browser->mainFrame(), propertyName->ustring().utf8().data(), elementId->ustring().utf8().data(), time); } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - return DumpRenderTreeSupportEfl::pauseSVGAnimation(browser->mainFrame(), animationId->ustring().utf8().data(), elementId->ustring().utf8().data(), time); -} - unsigned LayoutTestController::numberOfActiveAnimations() const { return DumpRenderTreeSupportEfl::activeAnimationsCount(browser->mainFrame()); diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp index 250189090..397b6c6dc 100644 --- a/Tools/DumpRenderTree/gtk/EventSender.cpp +++ b/Tools/DumpRenderTree/gtk/EventSender.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> * Copyright (C) 2009 Holger Hans Peter Freyther * Copyright (C) 2010 Igalia S.L. + * Copyright (C) 2012 ChangSeok Oh <shivamidow@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +35,7 @@ #include "DumpRenderTree.h" #include "WebCoreSupport/DumpRenderTreeSupportGtk.h" +#include "WebKitMutationObserver.h" #include <GOwnPtrGtk.h> #include <GRefPtrGtk.h> #include <GtkVersioning.h> @@ -248,7 +250,7 @@ static gboolean sendClick(gpointer) static JSValueRef scheduleAsynchronousClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - g_idle_add(sendClick, 0); + g_timeout_add(0, sendClick, 0); return JSValueMakeUndefined(context); } @@ -611,10 +613,9 @@ void replaySavedEvents() endOfQueue = 0; } -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static GdkEvent* createKeyPressEvent(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - if (argumentCount < 1) - return JSValueMakeUndefined(context); + g_return_val_if_fail(argumentCount >= 1, 0); guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0; // handle location argument. @@ -623,7 +624,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS location = (int)JSValueToNumber(context, arguments[2], exception); JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + g_return_val_if_fail((!exception || !*exception), 0); + int gdkKeySym = GDK_VoidSymbol; if (location == DOM_KEY_LOCATION_NUMPAD) { if (JSStringIsEqualToUTF8CString(character, "leftArrow")) @@ -717,10 +719,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS JSStringRelease(character); WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); + g_return_val_if_fail(view, 0); - // create and send the event GdkEvent* pressEvent = gdk_event_new(GDK_KEY_PRESS); pressEvent->key.keyval = gdkKeySym; pressEvent->key.state = modifiers; @@ -732,18 +732,31 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS // When synthesizing an event, an invalid hardware_keycode value // can cause it to be badly processed by Gtk+. - GdkKeymapKey* keys; - gint n_keys; - if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), gdkKeySym, &keys, &n_keys)) { - pressEvent->key.hardware_keycode = keys[0].keycode; - g_free(keys); - } + GOwnPtr<GdkKeymapKey> keys; + gint nKeys; + if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), gdkKeySym, &keys.outPtr(), &nKeys)) + pressEvent->key.hardware_keycode = keys.get()[0].keycode; + + return pressEvent; +} +static void sendKeyDown(GdkEvent* pressEvent) +{ + g_return_if_fail(pressEvent); GdkEvent* releaseEvent = gdk_event_copy(pressEvent); + releaseEvent->type = GDK_KEY_RELEASE; + dispatchEvent(pressEvent); - releaseEvent->key.type = GDK_KEY_RELEASE; dispatchEvent(releaseEvent); + DumpRenderTreeSupportGtk::deliverAllMutationsIfNecessary(); +} + +static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + GdkEvent* pressEvent = createKeyPressEvent(context, argumentCount, arguments, exception); + sendKeyDown(pressEvent); + return JSValueMakeUndefined(context); } @@ -811,6 +824,21 @@ static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function return JSValueMakeUndefined(context); } +static gboolean sendAsynchronousKeyDown(gpointer userData) +{ + sendKeyDown(static_cast<GdkEvent*>(userData)); + return FALSE; +} + +static JSValueRef scheduleAsynchronousKeyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + GdkEvent* pressEvent = createKeyPressEvent(context, argumentCount, arguments, exception); + if (pressEvent) + g_timeout_add(0, sendAsynchronousKeyDown, static_cast<gpointer>(pressEvent)); + + return JSValueMakeUndefined(context); +} + static JSStaticFunction staticFunctions[] = { { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -827,6 +855,7 @@ static JSStaticFunction staticFunctions[] = { { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scheduleAsynchronousKeyDown", scheduleAsynchronousKeyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 87ecdd05e..1266ccb12 100644 --- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -585,8 +585,7 @@ void LayoutTestController::setPluginsEnabled(bool flag) bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) { - // FIXME: implement - return false; + return DumpRenderTreeSupportGtk::elementDoesAutoCompleteForElementWithId(mainFrame, id); } void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) @@ -788,16 +787,6 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop return returnValue; } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - gchar* name = JSStringCopyUTF8CString(animationId); - gchar* element = JSStringCopyUTF8CString(elementId); - bool returnValue = DumpRenderTreeSupportGtk::pauseSVGAnimation(mainFrame, name, time, element); - g_free(name); - g_free(element); - return returnValue; -} - unsigned LayoutTestController::numberOfActiveAnimations() const { return DumpRenderTreeSupportGtk::numberOfActiveAnimations(mainFrame); diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig index 11fee7169..cc0d74e5d 100644 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig @@ -38,6 +38,11 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO WARNING_CFLAGS = -Wall -W -Wno-unused-parameter LINKER_DISPLAYS_MANGLED_NAMES = YES; +CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +CLANG_CXX_LIBRARY_1060 = libstdc++; +CLANG_CXX_LIBRARY_1070 = libc++; +CLANG_CXX_LIBRARY_1080 = libc++; +CLANG_CXX_LIBRARY_1090 = libc++; REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index 3012a70d8..3c3b18122 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -648,9 +648,10 @@ static void resetDefaultsToConsistentValues() [preferences setAcceleratedDrawingEnabled:NO]; #endif [preferences setWebGLEnabled:NO]; + [preferences setCSSRegionsEnabled:YES]; [preferences setUsePreHTML5ParserQuirks:NO]; [preferences setAsynchronousSpellCheckingEnabled:NO]; - [preferences setHixie76WebSocketProtocolEnabled:YES]; + [preferences setHixie76WebSocketProtocolEnabled:NO]; [preferences setMockScrollbarsEnabled:YES]; #if ENABLE(WEB_AUDIO) @@ -680,13 +681,18 @@ static void setDefaultsToConsistentValuesForTesting() [WebPreferences _switchNetworkLoaderToNewTestingSession]; } -static void* runThread(void* arg) +static void runThread(void* arg) { static ThreadIdentifier previousId = 0; ThreadIdentifier currentId = currentThread(); // Verify 2 successive threads do not get the same Id. ASSERT(previousId != currentId); previousId = currentId; +} + +static void* runPthread(void* arg) +{ + runThread(arg); return 0; } @@ -694,10 +700,10 @@ static void testThreadIdentifierMap() { // Imitate 'foreign' threads that are not created by WTF. pthread_t pthread; - pthread_create(&pthread, 0, &runThread, 0); + pthread_create(&pthread, 0, &runPthread, 0); pthread_join(pthread, 0); - pthread_create(&pthread, 0, &runThread, 0); + pthread_create(&pthread, 0, &runPthread, 0); pthread_join(pthread, 0); // Now create another thread using WTF. On OSX, it will have the same pthread handle diff --git a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 4bc48d264..edd3c6191 100644 --- a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -849,16 +849,6 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop return [mainFrame _pauseTransitionOfProperty:nameNS onNode:[[mainFrame DOMDocument] getElementById:idNS] atTime:time]; } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - RetainPtr<CFStringRef> animationIDCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, animationId)); - NSString *animationIDNS = (NSString *)animationIDCF.get(); - RetainPtr<CFStringRef> elementIDCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId)); - NSString *elementIDNS = (NSString *)elementIDCF.get(); - - return [mainFrame _pauseSVGAnimation:elementIDNS onSMILNode:[[mainFrame DOMDocument] getElementById:animationIDNS] atTime:time]; -} - unsigned LayoutTestController::numberOfActiveAnimations() const { return [mainFrame _numberOfActiveAnimations]; diff --git a/Tools/DumpRenderTree/mac/UIDelegate.mm b/Tools/DumpRenderTree/mac/UIDelegate.mm index 493c02d5c..87eece441 100644 --- a/Tools/DumpRenderTree/mac/UIDelegate.mm +++ b/Tools/DumpRenderTree/mac/UIDelegate.mm @@ -195,7 +195,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", [text UTF8String]); } -- (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id<WebGeolocationPolicyListener>)listener +- (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id<WebAllowDenyPolicyListener>)listener { if (!gLayoutTestController->isGeolocationPermissionSet()) { if (!m_pendingGeolocationPermissionListeners) @@ -230,7 +230,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil; ASSERT(gLayoutTestController->isGeolocationPermissionSet()); m_timer = 0; NSEnumerator* enumerator = [m_pendingGeolocationPermissionListeners objectEnumerator]; - id<WebGeolocationPolicyListener> listener; + id<WebAllowDenyPolicyListener> listener; while ((listener = [enumerator nextObject])) { if (gLayoutTestController->geolocationPermission()) [listener allow]; diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index 3e4590e7f..3da678c19 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -463,6 +463,14 @@ void EventSender::touchEnd() m_touchActive = false; } +#if QT_VERSION >= 0x050000 +void EventSender::touchCancel() +{ + sendTouchEvent(QEvent::TouchCancel); + m_touchActive = false; +} +#endif + void EventSender::clearTouchPoints() { m_touchPoints.clear(); @@ -478,6 +486,14 @@ void EventSender::releaseTouchPoint(int index) m_touchPoints[index].setState(Qt::TouchPointReleased); } +void EventSender::cancelTouchPoint(int index) +{ + // FIXME: No cancellation state in Qt 5, mapped to release instead. + // PlatformTouchEvent conversion later will map all touch points to + // cancelled. + releaseTouchPoint(index); +} + void EventSender::sendTouchEvent(QEvent::Type type) { #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index 736818442..e808db955 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -73,6 +73,9 @@ public slots: void touchStart(); void touchMove(); void touchEnd(); +#if QT_VERSION >= 0x050000 + void touchCancel(); +#endif void zoomPageIn(); void zoomPageOut(); void textZoomIn(); @@ -80,6 +83,7 @@ public slots: void scalePageBy(float scaleFactor, float x, float y); void clearTouchPoints(); void releaseTouchPoint(int index); + void cancelTouchPoint(int index); protected: void timerEvent(QTimerEvent*); diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 037668034..66fdf1eac 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -562,15 +562,6 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString& p return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(const QString& animationId, - double time, - const QString& elementId) -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseSVGAnimation(frame, animationId, time, elementId); -} - unsigned LayoutTestController::numberOfActiveAnimations() const { QWebFrame* frame = m_drt->webPage()->mainFrame(); @@ -701,6 +692,8 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian settings->setAttribute(QWebSettings::PluginsEnabled, value.toBool()); else if (name == "WebKitWebGLEnabled") settings->setAttribute(QWebSettings::WebGLEnabled, value.toBool()); + else if (name == "WebKitCSSRegionsEnabled") + settings->setAttribute(QWebSettings::CSSRegionsEnabled, value.toBool()); else if (name == "WebKitHyperlinkAuditingEnabled") settings->setAttribute(QWebSettings::HyperlinkAuditingEnabled, value.toBool()); else if (name == "WebKitHixie76WebSocketProtocolEnabled") diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h index 8c5d6e280..475b92407 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -184,7 +184,6 @@ public slots: bool pauseAnimationAtTimeOnElementWithId(const QString& animationName, double time, const QString& elementId); bool pauseTransitionAtTimeOnElementWithId(const QString& propertyName, double time, const QString& elementId); - bool sampleSVGAnimationForElementAtTime(const QString& animationId, double time, const QString& elementId); bool elementDoesAutoCompleteForElementWithId(const QString& elementId); unsigned numberOfActiveAnimations() const; diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index cbcd92198..efe946dd1 100644 --- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -36,8 +36,8 @@ VPATH = ../../unix/TestNetscapePlugin ../../TestNetscapePlugIn INCLUDEPATH += \ - ../../unix/TestNetscapePlugin/ForwardingHeaders \ - ../../unix/TestNetscapePlugin/ForwardingHeaders/WebKit \ + ../../TestNetscapePlugIn/unix/ForwardingHeaders \ + ../../TestNetscapePlugIn/unix/ForwardingHeaders/WebKit \ ../../TestNetscapePlugIn DESTDIR = $${ROOT_BUILD_DIR}/lib/plugins diff --git a/Tools/DumpRenderTree/qt/main.cpp b/Tools/DumpRenderTree/qt/main.cpp index b562108c8..176336770 100644 --- a/Tools/DumpRenderTree/qt/main.cpp +++ b/Tools/DumpRenderTree/qt/main.cpp @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) QApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); -#if QT_VERSION <= QT_VERSION_CHECK(5, 0, 0) // FIXME: need a way to port this to Qt5. +#if QT_VERSION <= QT_VERSION_CHECK(5, 0, 0) #ifdef Q_WS_X11 QX11Info::setAppDpiY(0, 96); QX11Info::setAppDpiX(0, 96); @@ -170,6 +170,8 @@ int main(int argc, char* argv[]) * default font, but with the correct paint-device DPI. */ QApplication::setFont(QWidget().font()); +#else + QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true); #endif #if HAVE(SIGNAL_H) diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp index 1ec5c5e60..196f4ea9b 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp @@ -722,27 +722,13 @@ void dump() BSTR resultString = 0; if (dumpTree) { + ::InvalidateRect(webViewWindow, 0, TRUE); + ::SendMessage(webViewWindow, WM_PAINT, 0, 0); + if (::gLayoutTestController->dumpAsText()) { - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); wstring result = dumpFramesAsText(frame); resultString = SysAllocStringLen(result.data(), result.size()); } else { - bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg\\W3C-SVG-1.1") != string::npos); - unsigned width; - unsigned height; - if (isSVGW3CTest) { - width = 480; - height = 360; - } else { - width = LayoutTestController::maxViewWidth; - height = LayoutTestController::maxViewHeight; - } - - ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); - COMPtr<IWebFramePrivate> framePrivate; if (FAILED(frame->QueryInterface(&framePrivate))) goto fail; @@ -880,7 +866,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) prefsPrivate->setFrameFlatteningEnabled(FALSE); prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); prefsPrivate->setLoadsSiteIconsIgnoringImageLoadingPreference(FALSE); - prefsPrivate->setHixie76WebSocketProtocolEnabled(TRUE); + prefsPrivate->setHixie76WebSocketProtocolEnabled(FALSE); } setAlwaysAcceptCookies(false); @@ -946,6 +932,22 @@ static void resetWebViewToConsistentStateBeforeTesting() framePrivate->clearOpener(); } +static void sizeWebViewForCurrentTest() +{ + bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg\\W3C-SVG-1.1") != string::npos); + unsigned width; + unsigned height; + if (isSVGW3CTest) { + width = 480; + height = 360; + } else { + width = LayoutTestController::maxViewWidth; + height = LayoutTestController::maxViewHeight; + } + + ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); +} + static void runTest(const string& testPathOrURL) { static BSTR methodBStr = SysAllocString(TEXT("GET")); @@ -985,6 +987,7 @@ static void runTest(const string& testPathOrURL) done = false; topLoadingFrame = 0; + sizeWebViewForCurrentTest(); gLayoutTestController->setIconDatabaseEnabled(false); if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) diff --git a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp index c69c4749d..5185a8fd7 100644 --- a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -1097,31 +1097,6 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop return SUCCEEDED(hr) && wasRunning; } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(animationId); - COMPtr<IDOMElement> element; - HRESULT hr = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - if (FAILED(hr)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR elementIdBSTR = JSStringCopyBSTR(elementId); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseSVGAnimation(elementIdBSTR, element.get(), time, &wasRunning); - SysFreeString(elementIdBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - unsigned LayoutTestController::numberOfActiveAnimations() const { COMPtr<IWebFramePrivate> framePrivate(Query, frame); diff --git a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index b2f7fb479..ff746440e 100644 --- a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -399,12 +399,6 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima return false; } -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - // FIXME: implement - return false; -} - void LayoutTestController::setCacheModel(int) { // FIXME: implement |