diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Tools/DumpRenderTree | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Tools/DumpRenderTree')
291 files changed, 6892 insertions, 31240 deletions
diff --git a/Tools/DumpRenderTree/AccessibilityController.cpp b/Tools/DumpRenderTree/AccessibilityController.cpp index 49d453a84..80c689c68 100644 --- a/Tools/DumpRenderTree/AccessibilityController.cpp +++ b/Tools/DumpRenderTree/AccessibilityController.cpp @@ -24,6 +24,9 @@ */ #include "config.h" + +#if HAVE(ACCESSIBILITY) + #include "AccessibilityController.h" #include "AccessibilityUIElement.h" @@ -162,3 +165,4 @@ void AccessibilityController::resetToConsistentState() setLogScrollingStartEvents(false); setLogAccessibilityEvents(false); } +#endif // HAVE(ACCESSIBILITY) diff --git a/Tools/DumpRenderTree/AccessibilityController.h b/Tools/DumpRenderTree/AccessibilityController.h index a6cdc4686..1bb066fa0 100644 --- a/Tools/DumpRenderTree/AccessibilityController.h +++ b/Tools/DumpRenderTree/AccessibilityController.h @@ -34,6 +34,9 @@ #if PLATFORM(WIN) #include <windows.h> #endif +#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) +#include <atk/atk.h> +#endif class AccessibilityController { public: @@ -65,6 +68,10 @@ public: void winNotificationReceived(PlatformUIElement, const std::string& eventName); #endif +#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) + AtkObject* childElementById(AtkObject* parent, const char* id); +#endif + private: static JSClassRef getJSClass(); diff --git a/Tools/DumpRenderTree/AccessibilityUIElement.cpp b/Tools/DumpRenderTree/AccessibilityUIElement.cpp index b079d9a85..77d11a221 100644 --- a/Tools/DumpRenderTree/AccessibilityUIElement.cpp +++ b/Tools/DumpRenderTree/AccessibilityUIElement.cpp @@ -24,9 +24,14 @@ */ #include "config.h" + +#if HAVE(ACCESSIBILITY) + #include "AccessibilityUIElement.h" +#include <JavaScriptCore/JSObjectRef.h> #include <JavaScriptCore/JSRetainPtr.h> +#include <limits.h> // Static Functions @@ -201,22 +206,24 @@ static JSValueRef uiElementForSearchPredicateCallback(JSContextRef context, JSOb { AccessibilityUIElement* startElement = 0; bool isDirectionNext = true; - JSStringRef searchKey = 0; + bool visibleOnly = false; + JSValueRef searchKey = 0; JSStringRef searchText = 0; - if (argumentCount == 4) { + if (argumentCount == 5) { JSObjectRef startElementObject = JSValueToObject(context, arguments[0], exception); if (startElementObject) startElement = toAXElement(startElementObject); - isDirectionNext = JSValueToBoolean(context, arguments[1]); - if (JSValueIsString(context, arguments[2])) - searchKey = JSValueToStringCopy(context, arguments[2], exception); + isDirectionNext = JSValueToBoolean(context, arguments[1]); + + searchKey = arguments[2]; + if (JSValueIsString(context, arguments[3])) searchText = JSValueToStringCopy(context, arguments[3], exception); + + visibleOnly = JSValueToBoolean(context, arguments[4]); } - - JSObjectRef resultObject = AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(startElement, isDirectionNext, searchKey, searchText)); - if (searchKey) - JSStringRelease(searchKey); + JSObjectRef resultObject = AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText, visibleOnly)); + if (searchText) JSStringRelease(searchText); @@ -233,6 +240,61 @@ static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef functio return JSValueMakeNumber(context, (double)toAXElement(thisObject)->indexOfChild(childElement)); } +#if PLATFORM(IOS) + +static JSValueRef headerElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 1) + return 0; + + unsigned index = JSValueToNumber(context, arguments[0], exception); + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->headerElementAtIndex(index)); +} + +static JSValueRef linkedElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedElement()); +} + +static JSValueRef elementsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 2) + return 0; + + unsigned location = JSValueToNumber(context, arguments[0], exception); + unsigned length = JSValueToNumber(context, arguments[1], exception); + + Vector<AccessibilityUIElement> elements; + toAXElement(thisObject)->elementsForRange(location, length, elements); + + unsigned elementsSize = elements.size(); + JSValueRef valueElements[elementsSize]; + for (unsigned k = 0; k < elementsSize; ++k) + valueElements[k] = AccessibilityUIElement::makeJSAccessibilityUIElement(context, elements[k]); + + return JSObjectMakeArray(context, elementsSize, valueElements, 0); +} + +static JSValueRef increaseTextSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + toAXElement(thisObject)->increaseTextSelection(); + return JSValueMakeUndefined(context); +} + +static JSValueRef decreaseTextSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + toAXElement(thisObject)->decreaseTextSelection(); + return JSValueMakeUndefined(context); +} + +static JSValueRef assistiveTechnologySimulatedFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + toAXElement(thisObject)->assistiveTechnologySimulatedFocus(); + return JSValueMakeUndefined(context); +} + +#endif + static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int indexNumber = -1; @@ -361,16 +423,19 @@ static JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef return result; } +static JSValueRef isPressActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->isPressActionSupported()); +} -static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef isIncrementActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - JSStringRef action = 0; - if (argumentCount == 1) - action = JSValueToStringCopy(context, arguments[0], exception); - JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action)); - if (action) - JSStringRelease(action); - return result; + return JSValueMakeBoolean(context, toAXElement(thisObject)->isIncrementActionSupported()); +} + +static JSValueRef isDecrementActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->isDecrementActionSupported()); } static JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -480,6 +545,12 @@ static JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSOb return JSValueMakeUndefined(context); } +static JSValueRef scrollToMakeVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + toAXElement(thisObject)->scrollToMakeVisible(); + return JSValueMakeUndefined(context); +} + static JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { toAXElement(thisObject)->takeFocus(); @@ -787,6 +858,12 @@ static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSOb return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber()); } +static JSValueRef getPathDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> pathDescription(Adopt, toAXElement(thisObject)->pathDescription()); + return JSValueMakeString(context, pathDescription.get()); +} + static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange()); @@ -940,10 +1017,87 @@ static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObj return JSValueMakeUndefined(context); } +#if PLATFORM(IOS) + +static JSValueRef stringForSelectionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->stringForSelection()); + return JSValueMakeString(context, labelString.get()); +} + +static JSValueRef getIPhoneLabelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->iphoneLabel()); + return JSValueMakeString(context, labelString.get()); +} + +static JSValueRef getIPhoneHintCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> hintString(Adopt, toAXElement(thisObject)->iphoneHint()); + return JSValueMakeString(context, hintString.get()); +} + +static JSValueRef getIPhoneValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneValue()); + return JSValueMakeString(context, valueString.get()); +} + +static JSValueRef getIPhoneIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneIdentifier()); + return JSValueMakeString(context, valueString.get()); +} + + +static JSValueRef getIPhoneTraitsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneTraits()); + return JSValueMakeString(context, valueString.get()); +} + +static JSValueRef getIPhoneIsElementCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->iphoneIsElement()); +} + +static JSValueRef getIPhoneElementTextPositionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextPosition()); +} + +static JSValueRef getIPhoneElementTextLengthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextLength()); +} + +#endif // PLATFORM(IOS) + +#if PLATFORM(MAC) && !PLATFORM(IOS) +static JSValueRef supportedActionsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->supportedActions()); + return JSValueMakeString(context, valueString.get()); +} + +static JSValueRef mathPostscriptsDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->mathPostscriptsDescription()); + return JSValueMakeString(context, valueString.get()); +} + +static JSValueRef mathPrescriptsDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->mathPrescriptsDescription()); + return JSValueMakeString(context, valueString.get()); +} + +#endif + // Implementation // Unsupported methods on various platforms. -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) || PLATFORM(IOS) JSStringRef AccessibilityUIElement::speak() { return 0; } JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; } JSStringRef AccessibilityUIElement::rangeForPosition(int, int) { return 0; } @@ -955,9 +1109,15 @@ AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const { retur AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef) const { return 0; } #endif +#if !PLATFORM(MAC) && !PLATFORM(IOS) +JSStringRef AccessibilityUIElement::pathDescription() const { return 0; } +#endif + #if !PLATFORM(WIN) bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement) { + if (!otherElement) + return false; return platformUIElement() == otherElement->platformUIElement(); } #endif @@ -1071,6 +1231,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "pathDescription", getPathDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1104,6 +1265,22 @@ JSClassRef AccessibilityUIElement::getJSClass() { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "horizontalScrollbar", horizontalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "verticalScrollbar", verticalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#if PLATFORM(IOS) + { "iphoneLabel", getIPhoneLabelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneHint", getIPhoneHintCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneValue", getIPhoneValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneIdentifier", getIPhoneIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneTraits", getIPhoneTraitsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneIsElement", getIPhoneIsElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneElementTextPosition", getIPhoneElementTextPositionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "iphoneElementTextLength", getIPhoneElementTextLengthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "stringForSelection", stringForSelectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#endif // PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) + { "supportedActions", supportedActionsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "mathPostscriptsDescription", mathPostscriptsDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "mathPrescriptsDescription", mathPrescriptsDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#endif { 0, 0, 0, 0 } }; @@ -1143,7 +1320,9 @@ JSClassRef AccessibilityUIElement::getJSClass() { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isPressActionSupported", isPressActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isIncrementActionSupported", isIncrementActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isDecrementActionSupported", isDecrementActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "disclosedByRow", disclosedByRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "increment", incrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1178,6 +1357,16 @@ JSClassRef AccessibilityUIElement::getJSClass() { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollToMakeVisible", scrollToMakeVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#if PLATFORM(IOS) + { "linkedElement", linkedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "headerElementAtIndex", headerElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "elementsForRange", elementsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "increaseTextSelection", increaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "decreaseTextSelection", decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + +#endif { 0, 0, 0 } }; @@ -1189,3 +1378,4 @@ JSClassRef AccessibilityUIElement::getJSClass() static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition); return accessibilityUIElementClass; } +#endif diff --git a/Tools/DumpRenderTree/AccessibilityUIElement.h b/Tools/DumpRenderTree/AccessibilityUIElement.h index b5b23d8bd..ebbf7f3d4 100644 --- a/Tools/DumpRenderTree/AccessibilityUIElement.h +++ b/Tools/DumpRenderTree/AccessibilityUIElement.h @@ -45,7 +45,7 @@ typedef struct objc_object* PlatformUIElement; #include <oleacc.h> typedef COMPtr<IAccessible> PlatformUIElement; -#elif PLATFORM(GTK) +#elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) #include <atk/atk.h> typedef AtkObject* PlatformUIElement; #else @@ -109,7 +109,9 @@ public: bool boolAttributeValue(JSStringRef attribute); bool isAttributeSupported(JSStringRef attribute); bool isAttributeSettable(JSStringRef attribute); - bool isActionSupported(JSStringRef action); + bool isPressActionSupported(); + bool isIncrementActionSupported(); + bool isDecrementActionSupported(); JSStringRef role(); JSStringRef subrole(); JSStringRef roleDescription(); @@ -127,6 +129,7 @@ public: double intValue() const; double minValue(); double maxValue(); + JSStringRef pathDescription() const; JSStringRef valueDescription(); int insertionPointLineNumber(); JSStringRef selectedTextRange(); @@ -197,8 +200,15 @@ public: JSStringRef stringForRange(unsigned location, unsigned length); JSStringRef attributedStringForRange(unsigned location, unsigned length); bool attributedStringRangeIsMisspelled(unsigned location, unsigned length); - AccessibilityUIElement uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText); - + AccessibilityUIElement uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly); +#if PLATFORM(IOS) + void elementsForRange(unsigned location, unsigned length, Vector<AccessibilityUIElement>& elements); + JSStringRef stringForSelection(); + void increaseTextSelection(); + void decreaseTextSelection(); + AccessibilityUIElement linkedElement(); +#endif + // Table-specific AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row); @@ -232,6 +242,29 @@ public: // Make sure you call remove, because you can't rely on objects being deallocated in a timely fashion. void removeNotificationListener(); +#if PLATFORM(IOS) + JSStringRef iphoneLabel(); + JSStringRef iphoneValue(); + JSStringRef iphoneTraits(); + JSStringRef iphoneHint(); + JSStringRef iphoneIdentifier(); + bool iphoneIsElement(); + int iphoneElementTextPosition(); + int iphoneElementTextLength(); + AccessibilityUIElement headerElementAtIndex(unsigned); + // This will simulate the accessibilityDidBecomeFocused API in UIKit. + void assistiveTechnologySimulatedFocus(); +#endif // PLATFORM(IOS) + +#if PLATFORM(MAC) && !PLATFORM(IOS) + // Returns an ordered list of supported actions for an element. + JSStringRef supportedActions(); + + // A general description of the elements making up multiscript pre/post objects. + JSStringRef mathPostscriptsDescription() const; + JSStringRef mathPrescriptsDescription() const; +#endif + private: static JSClassRef getJSClass(); PlatformUIElement m_element; diff --git a/Tools/DumpRenderTree/DefaultPolicyDelegate.h b/Tools/DumpRenderTree/DefaultPolicyDelegate.h new file mode 100644 index 000000000..6ff5becca --- /dev/null +++ b/Tools/DumpRenderTree/DefaultPolicyDelegate.h @@ -0,0 +1,13 @@ +// +// DefaultPolicyDelegate.h +// DumpRenderTree +// +// Created by Anders Carlsson on 7/9/13. +// +// + +#import <WebKit/WebDefaultPolicyDelegate.h> + +@interface DefaultPolicyDelegate : WebDefaultPolicyDelegate + +@end diff --git a/Tools/DumpRenderTree/DefaultPolicyDelegate.m b/Tools/DumpRenderTree/DefaultPolicyDelegate.m new file mode 100644 index 000000000..4515bfb0e --- /dev/null +++ b/Tools/DumpRenderTree/DefaultPolicyDelegate.m @@ -0,0 +1,34 @@ +// +// DefaultPolicyDelegate.m +// DumpRenderTree +// +// Created by Anders Carlsson on 7/9/13. +// +// + +#import "DefaultPolicyDelegate.h" + +#import <WebKit/WebPolicyDelegatePrivate.h> +#import <WebKit/WebViewPrivate.h> + +@implementation DefaultPolicyDelegate + +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener +{ + if ([WebView _canHandleRequest:request]) { + [listener use]; + return; + } + + WebNavigationType navType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue]; + if (navType == WebNavigationTypePlugInRequest) { + [listener use]; + return; + } + + // The default WebKit policy delegate passes the URL along to -[NSWorkspace openURL:] here, + // but we don't want to do that so we just ignore the navigation completely. + [listener ignore]; +} + +@end diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp deleted file mode 100644 index cc8333209..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ /dev/null @@ -1,544 +0,0 @@ -# -# Copyright (C) 2011 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -{ - 'variables': { - 'ahem_path': '../../DumpRenderTree/qt/fonts/AHEM____.TTF', - 'tools_dir': '../..', - 'source_dir': '../../../Source', - 'conditions': [ - # Location of the chromium src directory and target type is different - # if webkit is built inside chromium or as standalone project. - ['inside_chromium_build==0', { - # Webkit is being built outside of the full chromium project. - # e.g. via build-webkit --chromium - 'chromium_src_dir': '<(source_dir)/WebKit/chromium', - },{ - # WebKit is checked out in src/chromium/third_party/WebKit - 'chromium_src_dir': '<(tools_dir)/../../..', - }], - ], - }, - 'includes': [ - '../DumpRenderTree.gypi', - '../../../Source/WebKit/chromium/features.gypi', - ], - 'targets': [ - { - 'target_name': 'ImageDiff', - 'type': 'executable', - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx', - ], - 'include_dirs': [ - '<(DEPTH)', - ], - 'sources': [ - '<(tools_dir)/DumpRenderTree/chromium/ImageDiff.cpp', - ], - 'conditions': [ - ['OS=="android" and android_build_type==0', { - # The Chromium Android port will compare images on host rather - # than target (a device or emulator) for performance reasons. - 'toolsets': ['host'], - }], - ['OS=="android" and android_build_type!=0', { - 'type': 'none', - }], - ], - }, - { - 'target_name': 'TestRunner', - 'type': 'static_library', - 'defines': [ - 'WEBTESTRUNNER_IMPLEMENTATION=1', - ], - 'dependencies': [ - 'TestRunner_resources', - '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', - '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_wtf_support', - '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_test_support', - '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '<(source_dir)/WebKit/chromium/public', - '<(DEPTH)', - '../chromium/TestRunner/public', - '../chromium/TestRunner/src', - '../../../Source', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '../chromium/TestRunner/public', - '../../../Source', - ], - }, - 'sources': [ - '<@(test_runner_files)', - ], - 'conditions': [ - ['toolkit_uses_gtk == 1', { - 'defines': [ - 'WTF_USE_GTK=1', - ], - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:gtk', - ], - 'include_dirs': [ - '<(source_dir)/WebKit/chromium/public/gtk', - ], - }], - ], - }, - { - 'target_name': 'TestRunner_resources', - 'type': 'none', - 'dependencies': [ - 'ImageDiff', - 'copy_TestNetscapePlugIn', - ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - 'LayoutTestHelper', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': ['<(ahem_path)'], - }], - }], - ['OS=="mac"', { - 'dependencies': [ - 'LayoutTestHelper', - ], - 'all_dependent_settings': { - 'mac_bundle_resources': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', - '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png', - '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', - ], - }, - }], - ['use_x11 == 1', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/chromium/fonts.conf', - ] - }], - }], - ['OS=="android"', { - 'dependencies!': [ - 'ImageDiff', - 'copy_TestNetscapePlugIn', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/chromium/android_main_fonts.xml', - '<(tools_dir)/DumpRenderTree/chromium/android_fallback_fonts.xml', - ] - }], - }], - ['OS=="android" and android_build_type==0', { - 'dependencies': [ - 'ImageDiff#host', - ], - }], - ], - }, - { - 'target_name': 'DumpRenderTree', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ - 'TestRunner', - '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources', - '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', - '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', - '<(chromium_src_dir)/base/base.gyp:test_support_base', - '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', - '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', - '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', - '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '<(source_dir)/WebKit/chromium/public', - '<(tools_dir)/DumpRenderTree', - '<(DEPTH)', - ], - 'defines': [ - # Technically not a unit test but require functions available only to - # unit tests. - 'UNIT_TEST', - ], - 'sources': [ - '<@(drt_files)', - ], - 'conditions': [ - ['OS=="mac" or OS=="win" or toolkit_uses_gtk==1', { - # These platforms have their own implementations of - # checkLayoutTestSystemDependencies() and openStartupDialog(). - 'sources/': [ - ['exclude', 'TestShellStub\\.cpp$'], - ], - }], - ['OS=="win"', { - 'dependencies': [ - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2', - ], - 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc', - ], - 'conditions': [ - ['inside_chromium_build==1', { - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - }, - }], - ], - },{ # OS!="win" - 'sources/': [ - ['exclude', 'Win\\.cpp$'], - ], - 'actions': [ - { - 'action_name': 'repack_locale', - 'variables': { - 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py', - 'pak_inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources_100_percent.pak', - ]}, - 'inputs': [ - '<(repack_path)', - '<@(pak_inputs)', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ], - 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], - 'process_outputs_as_mac_bundle_resources': 1, - }, - ], # actions - }], - ['OS=="mac"', { - 'dependencies': [ - '<(source_dir)/WebKit/chromium/WebKit.gyp:copy_mesa', - ], - },{ # OS!="mac" - 'sources/': [ - # .mm is already excluded by common.gypi - ['exclude', 'Mac\\.cpp$'], - ], - }], - ['os_posix!=1 or OS=="mac"', { - 'sources/': [ - ['exclude', 'Posix\\.cpp$'], - ], - }], - ['use_x11 == 1', { - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ] - }], - 'variables': { - # FIXME: Enable warnings on other platforms. - 'chromium_code': 1, - }, - 'conditions': [ - ['linux_use_tcmalloc == 1', { - 'dependencies': [ - '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', - ], - }], - ], - },{ # use_x11 != 1 - 'sources/': [ - ['exclude', 'X11\\.cpp$'], - ] - }], - ['toolkit_uses_gtk == 1', { - 'defines': [ - 'WTF_USE_GTK=1', - ], - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:gtk', - ], - 'include_dirs': [ - '<(source_dir)/WebKit/chromium/public/gtk', - ], - }], - ['OS=="android"', { - 'type': 'shared_library', - 'dependencies': [ - '<(chromium_src_dir)/base/base.gyp:test_support_base', - '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code', - '<(chromium_src_dir)/tools/android/forwarder/forwarder.gyp:forwarder', - '<(chromium_src_dir)/tools/android/md5sum/md5sum.gyp:md5sum', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ] - }], - }, { # OS!="android" - 'sources/': [ - ['exclude', 'Android\\.cpp$'], - ], - }], - ['inside_chromium_build==0', { - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers', - ] - }], - ], - }, - { - 'target_name': 'TestNetscapePlugIn', - 'type': 'loadable_module', - 'sources': [ '<@(test_plugin_files)' ], - 'dependencies': [ - '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn', - '<(tools_dir)/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders', - ], - 'conditions': [ - ['OS=="mac"', { - 'mac_bundle': 1, - 'product_extension': 'plugin', - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ] - }, - 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', - 'INFOPLIST_FILE': '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist', - }, - }], - ['os_posix == 1 and OS != "mac"', { - 'cflags': [ - '-fvisibility=default', - ], - }], - ['OS=="win"', { - 'defines': [ - # This seems like a hack, but this is what Safari Win does. - 'snprintf=_snprintf', - ], - 'sources': [ - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def', - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc', - ], - # The .rc file requires that the name of the dll is npTestNetscapePlugIn.dll. - 'product_name': 'npTestNetscapePlugIn', - }], - ], - }, - { - 'target_name': 'copy_TestNetscapePlugIn', - 'type': 'none', - 'dependencies': [ - 'TestNetscapePlugIn', - ], - 'conditions': [ - ['OS=="win"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'], - }], - }], - ['OS=="mac"', { - 'dependencies': ['TestNetscapePlugIn'], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins/', - 'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'], - }], - }], - ['os_posix == 1 and OS != "mac"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'], - }], - }], - ], - }, - ], # targets - 'conditions': [ - ['OS=="win"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'], - }], - }], - ['OS=="mac"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelper.mm'], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', - ], - }, - }], - }], - ['os_posix==1 and OS!="mac" and gcc_version>=46', { - 'target_defaults': { - # Disable warnings about c++0x compatibility, as some names (such - # as nullptr) conflict with upcoming c++0x types. - 'cflags_cc': ['-Wno-c++0x-compat'], - }, - }], - ['OS=="android"', { - # Wrap libDumpRenderTree.so into an android apk for execution. - 'targets': [{ - 'target_name': 'DumpRenderTree_apk', - 'type': 'none', - 'dependencies': [ - '<(chromium_src_dir)/base/base.gyp:base', - '<(chromium_src_dir)/media/media.gyp:media_java', - '<(chromium_src_dir)/net/net.gyp:net', - 'DumpRenderTree', - ], - 'variables': { - 'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)DumpRenderTree<(SHARED_LIB_SUFFIX)', - 'input_jars_paths': [ - '<(PRODUCT_DIR)/lib.java/chromium_base.jar', - '<(PRODUCT_DIR)/lib.java/chromium_net.jar', - '<(PRODUCT_DIR)/lib.java/chromium_media.jar', - ], - 'conditions': [ - ['inside_chromium_build==1', { - 'ant_build_to_chromium_src': '<(ant_build_out)/../../', - }, { - 'ant_build_to_chromium_src': '<(chromium_src_dir)', - }], - ], - }, - # Part of the following was copied from <(chromium_src_dir)/build/apk_test.gpyi. - # Not including it because gyp include doesn't support variable in path or under - # conditions. And we also have some different requirements. - 'actions': [{ - 'action_name': 'apk_DumpRenderTree', - 'message': 'Building DumpRenderTree test apk.', - 'inputs': [ - '<(chromium_src_dir)/testing/android/AndroidManifest.xml', - '<(chromium_src_dir)/testing/android/generate_native_test.py', - '<(input_shlib_path)', - '<@(input_jars_paths)', - ], - 'outputs': [ - '<(PRODUCT_DIR)/DumpRenderTree_apk/DumpRenderTree-debug.apk', - ], - 'action': [ - '<(chromium_src_dir)/testing/android/generate_native_test.py', - '--native_library', - '<(input_shlib_path)', - '--jars', - '"<@(input_jars_paths)"', - '--output', - '<(PRODUCT_DIR)/DumpRenderTree_apk', - '--strip-binary=<(android_strip)', - '--ant-args', - '-DANDROID_SDK=<(android_sdk)', - '--ant-args', - '-DANDROID_SDK_ROOT=<(android_sdk_root)', - '--ant-args', - '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', - '--ant-args', - '-DANDROID_SDK_VERSION=<(android_sdk_version)', - '--ant-args', - '-DANDROID_TOOLCHAIN=<(android_toolchain)', - '--ant-args', - '-DANDROID_GDBSERVER=<(android_gdbserver)', - '--ant-args', - '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-args', - '-DCHROMIUM_SRC=<(ant_build_to_chromium_src)', - '--app_abi', - '<(android_app_abi)', - ], - }], - }], - }], - ['clang==1', { - 'target_defaults': { - # FIXME: Add -Wglobal-constructors after fixing existing bugs. - 'cflags': ['-Wunused-parameter'], - 'xcode_settings': { - 'WARNING_CFLAGS': ['-Wunused-parameter'], - }, - }, - }], - ], # conditions -} diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi deleted file mode 100644 index ac4d2a622..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ /dev/null @@ -1,128 +0,0 @@ -{ - 'variables': { - 'drt_files': [ - 'DumpRenderTree.h', - 'DumpRenderTreeCommon.cpp', - 'chromium/DRTDevToolsAgent.cpp', - 'chromium/DRTDevToolsAgent.h', - 'chromium/DRTDevToolsClient.cpp', - 'chromium/DRTDevToolsClient.h', - 'chromium/DumpRenderTree.cpp', - 'chromium/DRTTestRunner.cpp', - 'chromium/DRTTestRunner.h', - 'chromium/MockConstraints.cpp', - 'chromium/MockConstraints.h', - 'chromium/MockGrammarCheck.cpp', - 'chromium/MockGrammarCheck.h', - 'chromium/MockSpellCheck.cpp', - 'chromium/MockSpellCheck.h', - 'chromium/MockWebKitPlatformSupport.cpp', - 'chromium/MockWebKitPlatformSupport.h', - 'chromium/MockWebMediaStreamCenter.cpp', - 'chromium/MockWebMediaStreamCenter.h', - 'chromium/MockWebPrerenderingSupport.cpp', - 'chromium/MockWebPrerenderingSupport.h', - 'chromium/MockWebRTCPeerConnectionHandler.cpp', - 'chromium/MockWebRTCPeerConnectionHandler.h', - 'chromium/MockWebSpeechInputController.cpp', - 'chromium/MockWebSpeechInputController.h', - 'chromium/MockWebSpeechRecognizer.cpp', - 'chromium/MockWebSpeechRecognizer.h', - 'chromium/NotificationPresenter.h', - 'chromium/NotificationPresenter.cpp', - 'chromium/Task.h', - 'chromium/Task.cpp', - 'chromium/TestEventPrinter.h', - 'chromium/TestEventPrinter.cpp', - 'chromium/TestNavigationController.cpp', - 'chromium/TestNavigationController.h', - 'chromium/TestShell.cpp', - 'chromium/TestShell.h', - 'chromium/TestShellAndroid.cpp', - 'chromium/TestShellMac.mm', - 'chromium/TestShellPosix.cpp', - 'chromium/TestShellStub.cpp', - 'chromium/TestShellWin.cpp', - 'chromium/TestShellX11.cpp', - 'chromium/TestWebPlugin.cpp', - 'chromium/TestWebPlugin.h', - 'chromium/WebPermissions.cpp', - 'chromium/WebPermissions.h', - 'chromium/WebPreferences.cpp', - 'chromium/WebPreferences.h', - 'chromium/WebThemeControlDRTWin.cpp', - 'chromium/WebThemeControlDRTWin.h', - 'chromium/WebThemeEngineDRTMac.mm', - 'chromium/WebThemeEngineDRTMac.h', - 'chromium/WebThemeEngineDRTWin.cpp', - 'chromium/WebThemeEngineDRTWin.h', - 'chromium/WebUserMediaClientMock.cpp', - 'chromium/WebUserMediaClientMock.h', - 'chromium/WebViewHost.cpp', - 'chromium/WebViewHost.h', - 'chromium/WebViewHostOutputSurface.cpp', - 'chromium/WebViewHostOutputSurface.h', - 'chromium/WebViewHostSoftwareOutputDevice.cpp', - 'chromium/WebViewHostSoftwareOutputDevice.h', - ], - 'test_runner_files': [ - 'chromium/TestRunner/public/WebAccessibilityController.h', - 'chromium/TestRunner/public/WebTestDelegate.h', - 'chromium/TestRunner/public/WebEventSender.h', - 'chromium/TestRunner/public/WebTask.h', - 'chromium/TestRunner/public/WebTestInterfaces.h', - 'chromium/TestRunner/public/WebTestProxy.h', - 'chromium/TestRunner/src/AccessibilityControllerChromium.cpp', - 'chromium/TestRunner/src/AccessibilityControllerChromium.h', - 'chromium/TestRunner/src/AccessibilityUIElementChromium.cpp', - 'chromium/TestRunner/src/AccessibilityUIElementChromium.h', - 'chromium/TestRunner/src/CppBoundClass.cpp', - 'chromium/TestRunner/src/CppBoundClass.h', - 'chromium/TestRunner/src/CppVariant.cpp', - 'chromium/TestRunner/src/CppVariant.h', - 'chromium/TestRunner/src/EventSender.cpp', - 'chromium/TestRunner/src/EventSender.h', - 'chromium/TestRunner/src/GamepadController.cpp', - 'chromium/TestRunner/src/GamepadController.h', - 'chromium/TestRunner/src/KeyCodeMapping.cpp', - 'chromium/TestRunner/src/KeyCodeMapping.h', - 'chromium/TestRunner/src/TestInterfaces.cpp', - 'chromium/TestRunner/src/TestInterfaces.h', - 'chromium/TestRunner/src/TextInputController.cpp', - 'chromium/TestRunner/src/TextInputController.h', - 'chromium/TestRunner/src/TestRunner.cpp', - 'chromium/TestRunner/src/TestRunner.h', - 'chromium/TestRunner/src/WebAccessibilityController.cpp', - 'chromium/TestRunner/src/WebEventSender.cpp', - 'chromium/TestRunner/src/WebTask.cpp', - 'chromium/TestRunner/src/WebTestInterfaces.cpp', - 'chromium/TestRunner/src/WebTestProxy.cpp', - ], - 'test_plugin_files': [ - 'TestNetscapePlugIn/PluginObject.cpp', - 'TestNetscapePlugIn/PluginObject.h', - 'TestNetscapePlugIn/PluginObjectMac.mm', - 'TestNetscapePlugIn/PluginTest.cpp', - 'TestNetscapePlugIn/PluginTest.h', - 'TestNetscapePlugIn/TestObject.cpp', - 'TestNetscapePlugIn/TestObject.h', - 'TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp', - 'TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp', - 'TestNetscapePlugIn/Tests/FormValue.cpp', - 'TestNetscapePlugIn/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp', - 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp', - 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp', - 'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp', - 'TestNetscapePlugIn/Tests/NPPNewFails.cpp', - 'TestNetscapePlugIn/Tests/NPRuntimeCallsWithNullNPP.cpp', - 'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp', - 'TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp', - 'TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp', - 'TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp', - 'TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp', - 'TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp', - 'TestNetscapePlugIn/Tests/PrivateBrowsing.cpp', - 'TestNetscapePlugIn/main.cpp', - ], - } -} diff --git a/Tools/DumpRenderTree/DumpRenderTree.h b/Tools/DumpRenderTree/DumpRenderTree.h index 4c6a47210..47f88e58f 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.h +++ b/Tools/DumpRenderTree/DumpRenderTree.h @@ -40,8 +40,6 @@ #include "DumpRenderTreeWin.h" #elif PLATFORM(GTK) #include "DumpRenderTreeGtk.h" -#elif PLATFORM(WX) -#include "DumpRenderTreeWx.h" #elif PLATFORM(EFL) #include "DumpRenderTreeEfl.h" #elif PLATFORM(BLACKBERRY) @@ -66,11 +64,12 @@ void dump(); void displayWebView(); struct TestCommand { - TestCommand() : shouldDumpPixels(false) { } + TestCommand() : shouldDumpPixels(false), timeout(30000) { } std::string pathOrURL; bool shouldDumpPixels; std::string expectedPixelHash; + int timeout; // in ms }; TestCommand parseInputLine(const std::string&); diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln new file mode 100644 index 000000000..285e25259 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestNetscapePlugin", "TestNetscapePlugin\TestNetscapePlugin.vcxproj", "{C0737398-3565-439E-A2B8-AB2BE4D5430C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiffLauncher", "ImageDiff\ImageDiffLauncher.vcxproj", "{DD7949B6-F2B4-47C2-9C42-E21E84CB1017}" + ProjectSection(ProjectDependencies) = postProject + {59CC0547-70AC-499C-9B19-EC01C6F61137} = {59CC0547-70AC-499C-9B19-EC01C6F61137} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiff", "ImageDiff\ImageDiff.vcxproj", "{59CC0547-70AC-499C-9B19-EC01C6F61137}" + ProjectSection(ProjectDependencies) = postProject + {C0737398-3565-439E-A2B8-AB2BE4D5430C} = {C0737398-3565-439E-A2B8-AB2BE4D5430C} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTree", "DumpRenderTree\DumpRenderTree.vcxproj", "{6567DFD4-D6DE-4CD5-825D-17E353D160E1}" + ProjectSection(ProjectDependencies) = postProject + {DD7949B6-F2B4-47C2-9C42-E21E84CB1017} = {DD7949B6-F2B4-47C2-9C42-E21E84CB1017} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTreeLauncher", "DumpRenderTree\DumpRenderTreeLauncher.vcxproj", "{2974EA02-840B-4995-8719-8920A61006F1}" + ProjectSection(ProjectDependencies) = postProject + {6567DFD4-D6DE-4CD5-825D-17E353D160E1} = {6567DFD4-D6DE-4CD5-825D-17E353D160E1} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.ActiveCfg = Debug|Win32 + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.Build.0 = Debug|Win32 + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.ActiveCfg = Release|Win32 + {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.Build.0 = Release|Win32 + {DD7949B6-F2B4-47C2-9C42-E21E84CB1017}.Debug|Win32.ActiveCfg = Debug|Win32 + {DD7949B6-F2B4-47C2-9C42-E21E84CB1017}.Debug|Win32.Build.0 = Debug|Win32 + {DD7949B6-F2B4-47C2-9C42-E21E84CB1017}.Release|Win32.ActiveCfg = Release|Win32 + {DD7949B6-F2B4-47C2-9C42-E21E84CB1017}.Release|Win32.Build.0 = Release|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.ActiveCfg = Debug|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.Build.0 = Debug|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.ActiveCfg = Release|Win32 + {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.Build.0 = Release|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.ActiveCfg = Debug|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.Build.0 = Debug|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.ActiveCfg = Release|Win32 + {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.Build.0 = Release|Win32 + {2974EA02-840B-4995-8719-8920A61006F1}.Debug|Win32.ActiveCfg = Debug|Win32 + {2974EA02-840B-4995-8719-8920A61006F1}.Debug|Win32.Build.0 = Debug|Win32 + {2974EA02-840B-4995-8719-8920A61006F1}.Release|Win32.ActiveCfg = Release|Win32 + {2974EA02-840B-4995-8719-8920A61006F1}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj new file mode 100644 index 000000000..06dafbb07 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj @@ -0,0 +1,282 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugSuffix|Win32"> + <Configuration>DebugSuffix</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugSuffix|x64"> + <Configuration>DebugSuffix</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|Win32"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|x64"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|Win32"> + <Configuration>Production</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|x64"> + <Configuration>Production</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|Win32"> + <Configuration>Release_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|x64"> + <Configuration>Release_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{6567DFD4-D6DE-4CD5-825D-17E353D160E1}</ProjectGuid> + <RootNamespace>DumpRenderTree</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeReleaseWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeReleaseWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebugWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebugWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\AccessibilityController.cpp" /> + <ClCompile Include="..\..\AccessibilityTextMarker.cpp" /> + <ClCompile Include="..\..\AccessibilityUIElement.cpp" /> + <ClCompile Include="..\..\cairo\PixelDumpSupportCairo.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\cg\PixelDumpSupportCG.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\CyclicRedundancyCheck.cpp" /> + <ClCompile Include="..\..\DumpRenderTreeCommon.cpp" /> + <ClCompile Include="..\..\GCController.cpp" /> + <ClCompile Include="..\..\JavaScriptThreading.cpp" /> + <ClCompile Include="..\..\PixelDumpSupport.cpp" /> + <ClCompile Include="..\..\TestRunner.cpp" /> + <ClCompile Include="..\..\win\AccessibilityControllerWin.cpp" /> + <ClCompile Include="..\..\win\AccessibilityUIElementWin.cpp" /> + <ClCompile Include="..\..\win\DRTDataObject.cpp" /> + <ClCompile Include="..\..\win\DRTDesktopNotificationPresenter.cpp" /> + <ClCompile Include="..\..\win\DRTDropSource.cpp" /> + <ClCompile Include="..\..\win\DumpRenderTree.cpp" /> + <ClCompile Include="..\..\win\EditingDelegate.cpp" /> + <ClCompile Include="..\..\win\EventSender.cpp" /> + <ClCompile Include="..\..\win\FrameLoadDelegate.cpp" /> + <ClCompile Include="..\..\win\GCControllerWin.cpp" /> + <ClCompile Include="..\..\win\HistoryDelegate.cpp" /> + <ClCompile Include="..\..\win\MD5.cpp" /> + <ClCompile Include="..\..\win\PixelDumpSupportWin.cpp" /> + <ClCompile Include="..\..\win\PolicyDelegate.cpp" /> + <ClCompile Include="..\..\win\ResourceLoadDelegate.cpp" /> + <ClCompile Include="..\..\win\TestRunnerWin.cpp" /> + <ClCompile Include="..\..\win\TextInputController.cpp" /> + <ClCompile Include="..\..\win\TextInputControllerWin.cpp" /> + <ClCompile Include="..\..\win\UIDelegate.cpp" /> + <ClCompile Include="..\..\win\WorkQueueItemWin.cpp" /> + <ClCompile Include="..\..\WorkQueue.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\AccessibilityController.h" /> + <ClInclude Include="..\..\AccessibilityTextMarker.h" /> + <ClInclude Include="..\..\AccessibilityUIElement.h" /> + <ClInclude Include="..\..\cairo\PixelDumpSupportCairo.h"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild> + </ClInclude> + <ClInclude Include="..\..\cg\PixelDumpSupportCG.h"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild> + </ClInclude> + <ClInclude Include="..\..\config.h" /> + <ClInclude Include="..\..\CyclicRedundancyCheck.h" /> + <ClInclude Include="..\..\DumpRenderTree.h" /> + <ClInclude Include="..\..\DumpRenderTreePrefix.h" /> + <ClInclude Include="..\..\GCController.h" /> + <ClInclude Include="..\..\JavaScriptThreading.h" /> + <ClInclude Include="..\..\PixelDumpSupport.h" /> + <ClInclude Include="..\..\TestRunner.h" /> + <ClInclude Include="..\..\win\DraggingInfo.h" /> + <ClInclude Include="..\..\win\DRTDataObject.h" /> + <ClInclude Include="..\..\win\DRTDesktopNotificationPresenter.h" /> + <ClInclude Include="..\..\win\DRTDropSource.h" /> + <ClInclude Include="..\..\win\DumpRenderTreeWin.h" /> + <ClInclude Include="..\..\win\EditingDelegate.h" /> + <ClInclude Include="..\..\win\EventSender.h" /> + <ClInclude Include="..\..\win\FrameLoadDelegate.h" /> + <ClInclude Include="..\..\win\HistoryDelegate.h" /> + <ClInclude Include="..\..\win\MD5.h" /> + <ClInclude Include="..\..\win\PolicyDelegate.h" /> + <ClInclude Include="..\..\win\ResourceLoadDelegate.h" /> + <ClInclude Include="..\..\win\TextInputController.h" /> + <ClInclude Include="..\..\win\UIDelegate.h" /> + <ClInclude Include="..\..\WorkQueue.h" /> + <ClInclude Include="..\..\WorkQueueItem.h" /> + <CustomBuildStep Include="MD5.h" /> + <CustomBuildStep Include="..\cairo\PixelDumpSupportCairo.h"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> + </CustomBuildStep> + <CustomBuildStep Include="..\cg\PixelDumpSupportCG.h" /> + </ItemGroup> + <ItemGroup> + <None Include="DumpRenderTreePostBuild.cmd" /> + <None Include="DumpRenderTreePreBuild.cmd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj.filters b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj.filters new file mode 100644 index 000000000..17161e70e --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj.filters @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Controllers"> + <UniqueIdentifier>{f76f7e03-4f6a-46fd-a3e6-3cc4d2f7e918}</UniqueIdentifier> + </Filter> + <Filter Include="Delegates"> + <UniqueIdentifier>{964367be-8e77-444f-9b05-7c906d89e35e}</UniqueIdentifier> + </Filter> + <Filter Include="Support"> + <UniqueIdentifier>{59309c9f-8148-4c01-a552-888c6c065f73}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\AccessibilityController.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\GCController.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\TestRunner.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\AccessibilityControllerWin.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\DRTDataObject.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\DRTDropSource.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\EventSender.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\GCControllerWin.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\TestRunnerWin.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\TextInputController.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\TextInputControllerWin.cpp"> + <Filter>Controllers</Filter> + </ClCompile> + <ClCompile Include="..\..\win\DRTDesktopNotificationPresenter.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\HistoryDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\PolicyDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\ResourceLoadDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\UIDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\EditingDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\win\FrameLoadDelegate.cpp"> + <Filter>Delegates</Filter> + </ClCompile> + <ClCompile Include="..\..\AccessibilityTextMarker.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\win\AccessibilityUIElementWin.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\AccessibilityUIElement.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\CyclicRedundancyCheck.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\DumpRenderTreeCommon.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\win\DumpRenderTree.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\win\MD5.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\PixelDumpSupport.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\win\WorkQueueItemWin.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\cairo\PixelDumpSupportCairo.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\cg\PixelDumpSupportCG.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\win\PixelDumpSupportWin.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\WorkQueue.cpp"> + <Filter>Support</Filter> + </ClCompile> + <ClCompile Include="..\..\JavaScriptThreading.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\AccessibilityController.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\GCController.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\TestRunner.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\win\DRTDataObject.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\win\DRTDropSource.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\win\EventSender.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\win\TextInputController.h"> + <Filter>Controllers</Filter> + </ClInclude> + <ClInclude Include="..\..\win\DRTDesktopNotificationPresenter.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\HistoryDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\PolicyDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\ResourceLoadDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\UIDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\EditingDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\win\FrameLoadDelegate.h"> + <Filter>Delegates</Filter> + </ClInclude> + <ClInclude Include="..\..\config.h" /> + <ClInclude Include="..\..\AccessibilityTextMarker.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\AccessibilityUIElement.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\DumpRenderTreePrefix.h" /> + <ClInclude Include="..\..\CyclicRedundancyCheck.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\win\DraggingInfo.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\DumpRenderTree.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\win\DumpRenderTreeWin.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\win\MD5.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\PixelDumpSupport.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\cairo\PixelDumpSupportCairo.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\cg\PixelDumpSupportCG.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\WorkQueue.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\WorkQueueItem.h"> + <Filter>Support</Filter> + </ClInclude> + <ClInclude Include="..\..\JavaScriptThreading.h" /> + </ItemGroup> + <ItemGroup> + <None Include="DumpRenderTreePostBuild.cmd" /> + <None Include="DumpRenderTreePreBuild.cmd" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeApple.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeApple.props new file mode 100644 index 000000000..b5045231e --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeApple.props @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..\cg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <AdditionalDependencies>CoreGraphics$(DebugSuffix).lib;CoreFoundation$(DebugSuffix).lib;CFNetwork$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeCommon.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeCommon.props new file mode 100644 index 000000000..fe840d2f6 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeCommon.props @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..;$(ProjectDir)\..\..\win;$(ConfigurationBuildDir)\Include;$(ConfigurationBuildDir)\Include\private;$(ConfigurationBuildDir)\Include\DumpRenderTree\ForwardingHeaders;$(ConfigurationBuildDir)\Include\JavaScriptCore;$(ConfigurationBuildDir)\Include\private\JavaScriptCore;$(ConfigurationBuildDir)\Include\WebCoreTestSupport;$(ConfigurationBuildDir)\Include\WebCore;$(WebKit_Libraries)\Include;$(WebKit_Libraries)\Include\private;$(WebKit_Libraries)\Include\WebCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableSpecificWarnings>4146;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ForcedIncludeFiles>DumpRenderTreePrefix.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> + </ClCompile> + <Link> + <AdditionalOptions>/NXCOMPAT %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>WTF$(DebugSuffix).lib;JavaScriptCore$(DebugSuffix).lib;WebKitGUID$(DebugSuffix).lib;WebKit$(DebugSuffix).lib;WebCoreTestSupport$(DebugSuffix).lib;gdi32.lib;ole32.lib;oleaut32.lib;user32.lib;shlwapi.lib;oleacc.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebug.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebug.props new file mode 100644 index 000000000..9c75bc73f --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebug.props @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\FeatureDefines.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="DumpRenderTreeCommon.props" /> + <Import Project="DumpRenderTreeApple.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebugWinCairo.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebugWinCairo.props new file mode 100644 index 000000000..77fc5cc88 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebugWinCairo.props @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\FeatureDefinesCairo.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\WinCairo.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\cURL.props" /> + <Import Project="..\..\..\..\Source\WebKit\WebKit.vcxproj\WebKit\WebKitCFLite.props" /> + <Import Project="DumpRenderTreeCommon.props" /> + </ImportGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..\cairo;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncher.vcxproj b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncher.vcxproj new file mode 100644 index 000000000..620391b42 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncher.vcxproj @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugSuffix|Win32"> + <Configuration>DebugSuffix</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugSuffix|x64"> + <Configuration>DebugSuffix</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|Win32"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|x64"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|Win32"> + <Configuration>Production</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|x64"> + <Configuration>Production</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|Win32"> + <Configuration>Release_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|x64"> + <Configuration>Release_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{2974EA02-840B-4995-8719-8920A61006F1}</ProjectGuid> + <RootNamespace>DumpRenderTreeLauncher</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="DumpRenderTreeLauncherDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'"> + <Link> + <AdditionalOptions>/SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\win\DLLLauncher\DLLLauncherMain.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherCommon.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherCommon.props new file mode 100644 index 000000000..7a96a94db --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherCommon.props @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <TargetName>DumpRenderTree</TargetName> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <PreprocessorDefinitions>USE_CONSOLE_ENTRY_POINT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)DumpRenderTree$(DebugSuffix).exe</OutputFile> + <SubSystem>Console</SubSystem> + <ProgramDatabaseFile>$(TargetDir)$(TargetName)Launcher.pdb</ProgramDatabaseFile> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherDebug.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherDebug.props new file mode 100644 index 000000000..d71530a4b --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherDebug.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="DumpRenderTreeLauncherCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherProduction.props new file mode 100644 index 000000000..bbac39e8e --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherProduction.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\production.props" /> + <Import Project="DumpRenderTreeLauncherCommon.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherRelease.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherRelease.props new file mode 100644 index 000000000..e0b4f3e74 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherRelease.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="DumpRenderTreeLauncherCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPostBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePostBuild.cmd index 26707cac6..26707cac6 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPostBuild.cmd +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePostBuild.cmd diff --git a/Tools/DumpRenderTree/win/DumpRenderTreePreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePreBuild.cmd index c2f85c790..43c41c896 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTreePreBuild.cmd +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePreBuild.cmd @@ -10,11 +10,11 @@ mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders" mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\runtime" mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" -xcopy /y /d "%PROJECTDIR%\..\ForwardingHeaders\wtf\*.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" -xcopy /y /d "%PROJECTDIR%\..\ForwardingHeaders\runtime\*.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\runtime" +xcopy /y /d "%PROJECTDIR%\..\..\ForwardingHeaders\wtf\*.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" +xcopy /y /d "%PROJECTDIR%\..\..\ForwardingHeaders\runtime\*.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\runtime" if "%CONFIGURATIONNAME%"=="Debug_Cairo_CFLite" xcopy /y /d "%CONFIGURATIONBUILDDIR%\include\WebCore\ForwardingHeaders\wtf\MD5.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" if "%CONFIGURATIONNAME%"=="Release_Cairo_CFLite" xcopy /y /d "%CONFIGURATIONBUILDDIR%\include\WebCore\ForwardingHeaders\wtf\MD5.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" -if "%CONFIGURATIONNAME%"=="Debug_Cairo" xcopy /y /d "%TARGETDIR%\..\include\WebCore\ForwardingHeaders\wtf\MD5.h" -if "%CONFIGURATIONNAME%"=="Release_Cairo" xcopy /y /d "%TARGETDIR%\..\include\WebCore\ForwardingHeaders\wtf\MD5.h" +if "%CONFIGURATIONNAME%"=="Debug_Cairo" xcopy /y /d "%CONFIGURATIONBUILDDIR%\include\WebCore\ForwardingHeaders\wtf\MD5.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" +if "%CONFIGURATIONNAME%"=="Release_Cairo" xcopy /y /d "%CONFIGURATIONBUILDDIR%\include\WebCore\ForwardingHeaders\wtf\MD5.h" "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree\ForwardingHeaders\wtf" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeProduction.props new file mode 100644 index 000000000..d019339ad --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeProduction.props @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\FeatureDefines.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\production.props" /> + <Import Project="DumpRenderTreeApple.props" /> + <Import Project="DumpRenderTreeCommon.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeRelease.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeRelease.props new file mode 100644 index 000000000..8bcd226d6 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeRelease.props @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\FeatureDefines.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="DumpRenderTreeCommon.props" /> + <Import Project="DumpRenderTreeApple.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeReleaseWinCairo.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeReleaseWinCairo.props new file mode 100644 index 000000000..d2e6434d8 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeReleaseWinCairo.props @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\FeatureDefinesCairo.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\WinCairo.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\cURL.props" /> + <Import Project="..\..\..\..\Source\WebKit\WebKit.vcxproj\WebKit\WebKitCFLite.props" /> + <Import Project="DumpRenderTreeCommon.props" /> + </ImportGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir)\..\..\cairo;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiff.vcxproj b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiff.vcxproj new file mode 100644 index 000000000..fefaa7214 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiff.vcxproj @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugSuffix|Win32"> + <Configuration>DebugSuffix</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugSuffix|x64"> + <Configuration>DebugSuffix</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|Win32"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|x64"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|Win32"> + <Configuration>Production</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|x64"> + <Configuration>Production</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|Win32"> + <Configuration>Release_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|x64"> + <Configuration>Release_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{59CC0547-70AC-499C-9B19-EC01C6F61137}</ProjectGuid> + <RootNamespace>ImageDiff</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffReleaseWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffReleaseWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebugWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebugWinCairo.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\cg\ImageDiffCG.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\win\ImageDiffCairo.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\win\ImageDiffWin.cpp" /> + </ItemGroup> + <ItemGroup> + <None Include="ImageDiffPostBuild.cmd" /> + <None Include="ImageDiffPreBuild.cmd" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommon.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommon.props new file mode 100644 index 000000000..481dd6611 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommon.props @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalOptions>/NXCOMPAT %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>WTF$(DebugSuffix).lib;JavaScriptCore$(DebugSuffix).lib;CoreGraphics$(DebugSuffix).lib;CoreFoundation$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommonWinCairo.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommonWinCairo.props new file mode 100644 index 000000000..4a7b11db6 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommonWinCairo.props @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalOptions>/NXCOMPAT %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>JavaScriptCore.lib;CFLite.lib;%(AdditionalDependencies)</AdditionalDependencies> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> +</Project> diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebug.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebug.props new file mode 100644 index 000000000..e1a01da8e --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebug.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="ImageDiffCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebugWinCairo.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebugWinCairo.props new file mode 100644 index 000000000..1ede8e67f --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebugWinCairo.props @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\WinCairo.props" /> + <Import Project="ImageDiffCommonWinCairo.props" /> + </ImportGroup> +</Project> diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncher.vcxproj b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncher.vcxproj new file mode 100644 index 000000000..3c6d90c3c --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncher.vcxproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugSuffix|Win32"> + <Configuration>DebugSuffix</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugSuffix|x64"> + <Configuration>DebugSuffix</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|Win32"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|x64"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|Win32"> + <Configuration>Production</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|x64"> + <Configuration>Production</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|Win32"> + <Configuration>Release_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|x64"> + <Configuration>Release_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DD7949B6-F2B4-47C2-9C42-E21E84CB1017}</ProjectGuid> + <RootNamespace>ImageDiffLauncher</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="ImageDiffLauncherDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\win\DLLLauncher\DLLLauncherMain.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherCommon.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherCommon.props new file mode 100644 index 000000000..d2518ea56 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherCommon.props @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <TargetName>ImageDiff</TargetName> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <PreprocessorDefinitions>USE_CONSOLE_ENTRY_POINT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)ImageDiff$(DebugSuffix).exe</OutputFile> + <SubSystem>Console</SubSystem> + <ProgramDatabaseFile>$(TargetDir)$(TargetName)Launcher.pdb</ProgramDatabaseFile> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherDebug.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherDebug.props new file mode 100644 index 000000000..caeb2c270 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherDebug.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="ImageDiffLauncherCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherProduction.props new file mode 100644 index 000000000..c927a95f3 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherProduction.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\production.props" /> + <Import Project="ImageDiffLauncherCommon.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherRelease.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherRelease.props new file mode 100644 index 000000000..a9b230b60 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherRelease.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="ImageDiffLauncherCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/win/ImageDiffPostBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPostBuild.cmd index 26707cac6..26707cac6 100644 --- a/Tools/DumpRenderTree/win/ImageDiffPostBuild.cmd +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPostBuild.cmd diff --git a/Tools/DumpRenderTree/win/ImageDiffPreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPreBuild.cmd index a77077674..a77077674 100644 --- a/Tools/DumpRenderTree/win/ImageDiffPreBuild.cmd +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPreBuild.cmd diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props new file mode 100644 index 000000000..731805d77 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\production.props" /> + <Import Project="ImageDiffCommon.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffRelease.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffRelease.props new file mode 100644 index 000000000..274a760b7 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffRelease.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="ImageDiffCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffReleaseWinCairo.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffReleaseWinCairo.props new file mode 100644 index 000000000..d3a08b48d --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffReleaseWinCairo.props @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\WinCairo.props" /> + <Import Project="ImageDiffCommonWinCairo.props" /> + </ImportGroup> +</Project> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.def index ac41e7ede..a0ea7a984 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.def @@ -1,6 +1,4 @@ -LIBRARY "npTestNetscapePlugin"
-
-EXPORTS
- NP_GetEntryPoints @1
- NP_Initialize @2
- NP_Shutdown @3
+EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.rc index c0b38ee5f..a9446c9f7 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.rc @@ -1,102 +1,102 @@ -// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "windows.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""windows.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904e4"
- BEGIN
- VALUE "CompanyName", "Apple Inc."
- VALUE "FileDescription", "Simple Netscape plug-in that handles test content for WebKit"
- VALUE "FileExtents", "testnetscape|png"
- VALUE "FileOpenName", "test netscape content|PNG image"
- VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009"
- VALUE "MIMEType", "application/x-webkit-test-netscape|image/png"
- VALUE "OriginalFilename", "npTestNetscapePlugin.dll"
- VALUE "ProductName", "WebKit Test PlugIn"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1252
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "windows.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""windows.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Apple Inc." + VALUE "FileDescription", "Simple Netscape plug-in that handles test content for WebKit" + VALUE "FileExtents", "testnetscape|png" + VALUE "FileOpenName", "test netscape content|PNG image" + VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009" + VALUE "MIMEType", "application/x-webkit-test-netscape|image/png" + VALUE "OriginalFilename", "npTestNetscapePlugin.dll" + VALUE "ProductName", "WebKit Test PlugIn" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj new file mode 100644 index 000000000..cbba93b14 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugSuffix|Win32"> + <Configuration>DebugSuffix</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugSuffix|x64"> + <Configuration>DebugSuffix</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|Win32"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug_WinCairo|x64"> + <Configuration>Debug_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|Win32"> + <Configuration>Production</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Production|x64"> + <Configuration>Production</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|Win32"> + <Configuration>Release_WinCairo</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release_WinCairo|x64"> + <Configuration>Release_WinCairo</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\TestNetscapePlugIn\main.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\PluginObject.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\PluginTest.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\TestObject.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\DocumentOpenInDestroyStream.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\EvaluateJSAfterRemovingPluginElement.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\FormValue.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLNotifyWithURLThatFailsToLoad.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLWithJavaScriptURL.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLWithJavaScriptURLDestroyingPlugin.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetUserAgentWithNullNPPFromNPPNew.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\LogNPPSetWindow.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPDeallocateCalledBeforeNPShutdown.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPPNewFails.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPPSetWindowCalledDuringDestruction.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeCallsWithNullNPP.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeRemoveProperty.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NullNPPGetValuePointer.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PassDifferentNPPStruct.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PluginScriptableNPObjectInvokeDefault.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PluginScriptableObjectOverridesAllProperties.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PrivateBrowsing.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\ToStringAndValueOfObject.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\CallJSThatDestroysPlugin.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\DrawsGradient.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\DumpWindowRect.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\GetValueNetscapeWindow.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowlessPaintRectCoordinates.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowRegionIsSetToClipRect.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\win\WindowedPluginTest.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\win\WindowGeometryTest.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\TestNetscapePlugIn\PluginObject.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\PluginTest.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\TestObject.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\win\WindowedPluginTest.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\win\WindowGeometryTest.h" /> + <ClInclude Include="resource.h" /> + </ItemGroup> + <ItemGroup> + <None Include="TestNetscapePlugin.def" /> + <None Include="TestNetscapePluginPostBuild.cmd" /> + <None Include="TestNetscapePluginPreBuild.cmd" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="TestNetscapePlugin.rc" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C0737398-3565-439E-A2B8-AB2BE4D5430C}</ProjectGuid> + <RootNamespace>TestNetscapePlugin</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginRelease.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginProduction.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="TestNetscapePluginDebug.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'"> + <Link /> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'"> + <Link /> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj.filters b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj.filters new file mode 100644 index 000000000..da42a5708 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj.filters @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="..\..\TestNetscapePlugIn\main.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\PluginObject.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\PluginTest.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\TestObject.cpp" /> + <ClCompile Include="..\..\TestNetscapePlugIn\win\WindowedPluginTest.cpp"> + <Filter>win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\win\WindowGeometryTest.cpp"> + <Filter>win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\DocumentOpenInDestroyStream.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\EvaluateJSAfterRemovingPluginElement.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\FormValue.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLNotifyWithURLThatFailsToLoad.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLWithJavaScriptURL.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetURLWithJavaScriptURLDestroyingPlugin.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\GetUserAgentWithNullNPPFromNPPNew.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\LogNPPSetWindow.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPDeallocateCalledBeforeNPShutdown.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPPNewFails.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPPSetWindowCalledDuringDestruction.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeCallsWithNullNPP.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NPRuntimeRemoveProperty.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\NullNPPGetValuePointer.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PassDifferentNPPStruct.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PluginScriptableNPObjectInvokeDefault.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PluginScriptableObjectOverridesAllProperties.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\PrivateBrowsing.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\ToStringAndValueOfObject.cpp"> + <Filter>Tests</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\CallJSThatDestroysPlugin.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\DrawsGradient.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\DumpWindowRect.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\GetValueNetscapeWindow.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowlessPaintRectCoordinates.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + <ClCompile Include="..\..\TestNetscapePlugIn\Tests\win\WindowRegionIsSetToClipRect.cpp"> + <Filter>Tests\win</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\TestNetscapePlugIn\PluginObject.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\PluginTest.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\TestObject.h" /> + <ClInclude Include="..\..\TestNetscapePlugIn\win\WindowedPluginTest.h"> + <Filter>win</Filter> + </ClInclude> + <ClInclude Include="..\..\TestNetscapePlugIn\win\WindowGeometryTest.h"> + <Filter>win</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Resources</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Filter Include="win"> + <UniqueIdentifier>{aa1f1b22-247a-4070-93ee-9c1bb139a200}</UniqueIdentifier> + </Filter> + <Filter Include="Resources"> + <UniqueIdentifier>{a13508d3-bda2-4026-bd33-320d54d4ae5a}</UniqueIdentifier> + </Filter> + <Filter Include="Tests"> + <UniqueIdentifier>{33b0adeb-c8af-4e7a-b827-3ea7ed8a095b}</UniqueIdentifier> + </Filter> + <Filter Include="Tests\win"> + <UniqueIdentifier>{62e11b7d-49c8-463f-8897-fcc43d8f314c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="TestNetscapePlugin.def"> + <Filter>Resources</Filter> + </None> + <None Include="TestNetscapePluginPostBuild.cmd" /> + <None Include="TestNetscapePluginPreBuild.cmd" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="TestNetscapePlugin.rc"> + <Filter>Resources</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginCommon.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginCommon.props new file mode 100644 index 000000000..ff33e6f28 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginCommon.props @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <TargetName>np$(ProjectName)$(DebugSuffix)</TargetName> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\TestNetscapePlugIn;$(ProjectDir)..\..\TestNetscapePlugIn\win;$(ConfigurationBuildDir)\Include;$(ConfigurationBuildDir)\Include\private;$(ConfigurationBuildDir)\Include\JavaScriptCore;$(ConfigurationBuildDir)\Include\WebCore\ForwardingHeaders;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>snprintf=_snprintf;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>TestNetscapePlugin.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginDebug.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginDebug.props new file mode 100644 index 000000000..d56c0e6b4 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginDebug.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\debug.props" /> + <Import Project="TestNetscapePluginCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPostBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPostBuild.cmd new file mode 100644 index 000000000..26707cac6 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPostBuild.cmd @@ -0,0 +1 @@ +if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPreBuild.cmd index a77077674..a77077674 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginPreBuild.cmd +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPreBuild.cmd diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props new file mode 100644 index 000000000..d367b0c63 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\production.props" /> + <Import Project="TestNetscapePluginCommon.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginRelease.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginRelease.props new file mode 100644 index 000000000..478ed3a84 --- /dev/null +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginRelease.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets"> + <Import Project="$(WebKit_Libraries)\tools\vsprops\common.props" /> + <Import Project="$(WebKit_Libraries)\tools\vsprops\release.props" /> + <Import Project="TestNetscapePluginCommon.props" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/resource.h b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/resource.h index b0ce34048..b0ce34048 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/resource.h +++ b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/resource.h diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index f35ebccdf..97672ab9f 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -39,8 +39,11 @@ 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; }; 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; }; 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; }; + 1A2FB84E178C80930059FD96 /* DefaultPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */; }; + 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */; }; 1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A31EB3713466AC100017372 /* ConvertPoint.cpp */; }; 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */; }; + 1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */; }; 1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */; }; 1A66C35114576A920099A115 /* ContentsScaleFactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */; }; 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F024C0BB9B056008CFA34 /* TestObject.h */; }; @@ -57,6 +60,7 @@ 29CFBA10122736E600BC30C0 /* AccessibilityTextMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CFBA0E122736E600BC30C0 /* AccessibilityTextMarker.h */; }; 29CFBA11122736E600BC30C0 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA0F122736E600BC30C0 /* AccessibilityTextMarker.cpp */; }; 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; }; + 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CE88FA117124CEE00734FC0 /* JavaScriptThreading.cpp */; }; 2D403F05150871F9005358D2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; }; 2D403F06150871F9005358D2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; 2D403F08150871F9005358D2 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; }; @@ -109,6 +113,8 @@ A8B91BFF0CF522B4008F91FF /* CheckedMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = A8B91BF90CF522B4008F91FF /* CheckedMalloc.h */; }; A8D79CEA0FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A8D79CE80FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h */; }; A8D79CEB0FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m in Sources */ = {isa = PBXBuildFile; fileRef = A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */; }; + AA5A15EF16E15CD000F7C561 /* AccessibilityControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA5A15ED16E15CD000F7C561 /* AccessibilityControllerIOS.mm */; }; + AA5A15F016E15CD000F7C561 /* AccessibilityUIElementIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA5A15EE16E15CD000F7C561 /* AccessibilityUIElementIOS.mm */; }; AE8259F308D22463000507AB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; }; AE8259F408D22463000507AB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; }; B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A752A108AF5D1F00138E45 /* QuartzCore.framework */; }; @@ -119,7 +125,6 @@ BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */; }; BC0E26150E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */; }; BC47412A0D038A4C0072B006 /* JavaScriptThreading.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4741290D038A4C0072B006 /* JavaScriptThreading.h */; }; - BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */; }; BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */; }; BC9D90250C97472E0099A4A3 /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9D90220C97472E0099A4A3 /* WorkQueue.h */; }; BC9D90260C97472E0099A4A3 /* WorkQueueItem.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */; }; @@ -222,8 +227,8 @@ dstPath = DumpRenderTree.resources; dstSubfolderSpec = 7; files = ( - 8CCDA82A151A72D10003F937 /* SampleFont.sfont in Copy Font Files */, 5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */, + 8CCDA82A151A72D10003F937 /* SampleFont.sfont in Copy Font Files */, 5DB9AC980F722C3600684641 /* WebKitWeightWatcher100.ttf in Copy Font Files */, 5DB9AC990F722C3600684641 /* WebKitWeightWatcher200.ttf in Copy Font Files */, 5DB9AC9A0F722C3600684641 /* WebKitWeightWatcher300.ttf in Copy Font Files */, @@ -251,8 +256,11 @@ 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; }; 1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; }; 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; }; + 1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultPolicyDelegate.h; sourceTree = "<group>"; }; + 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DefaultPolicyDelegate.m; sourceTree = "<group>"; }; 1A31EB3713466AC100017372 /* ConvertPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertPoint.cpp; sourceTree = "<group>"; }; 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURLDestroyingPlugin.cpp; sourceTree = "<group>"; }; + 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToStringAndValueOfObject.cpp; sourceTree = "<group>"; }; 1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURL.cpp; sourceTree = "<group>"; }; 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentsScaleFactor.cpp; sourceTree = "<group>"; }; 1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = "<group>"; }; @@ -269,6 +277,7 @@ 29CFBA0E122736E600BC30C0 /* AccessibilityTextMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTextMarker.h; sourceTree = "<group>"; }; 29CFBA0F122736E600BC30C0 /* AccessibilityTextMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTextMarker.cpp; sourceTree = "<group>"; }; 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityTextMarkerMac.mm; path = mac/AccessibilityTextMarkerMac.mm; sourceTree = "<group>"; }; + 2CE88FA117124CEE00734FC0 /* JavaScriptThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptThreading.cpp; sourceTree = "<group>"; }; 2D403EA215087142005358D2 /* LayoutTestHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LayoutTestHelper.m; path = mac/LayoutTestHelper.m; sourceTree = "<group>"; }; 2D403F19150871F9005358D2 /* LayoutTestHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = LayoutTestHelper; sourceTree = BUILT_PRODUCTS_DIR; }; 31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockWebNotificationProvider.h; path = mac/MockWebNotificationProvider.h; sourceTree = "<group>"; }; @@ -319,6 +328,8 @@ A8B91BF90CF522B4008F91FF /* CheckedMalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CheckedMalloc.h; path = mac/CheckedMalloc.h; sourceTree = "<group>"; }; A8D79CE80FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreeFileDraggingSource.h; sourceTree = "<group>"; }; A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DumpRenderTreeFileDraggingSource.m; sourceTree = "<group>"; }; + AA5A15ED16E15CD000F7C561 /* AccessibilityControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerIOS.mm; path = ios/AccessibilityControllerIOS.mm; sourceTree = "<group>"; }; + AA5A15EE16E15CD000F7C561 /* AccessibilityUIElementIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityUIElementIOS.mm; path = ios/AccessibilityUIElementIOS.mm; sourceTree = "<group>"; }; AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */ = {isa = PBXFileReference; lastKnownFileType = file; name = "AHEM____.TTF"; path = "qt/fonts/AHEM____.TTF"; sourceTree = "<group>"; }; AE8257EF08D22389000507AB /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; B5A7526708AF4A4A00138E45 /* ImageDiff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ImageDiff; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -330,7 +341,6 @@ BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityUIElementMac.mm; path = mac/AccessibilityUIElementMac.mm; sourceTree = "<group>"; }; BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityCommonMac.mm; path = mac/AccessibilityCommonMac.mm; sourceTree = "<group>"; }; BC4741290D038A4C0072B006 /* JavaScriptThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptThreading.h; sourceTree = "<group>"; }; - BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaScriptThreadingPthreads.cpp; path = pthreads/JavaScriptThreadingPthreads.cpp; sourceTree = "<group>"; }; BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; BC9D90220C97472E0099A4A3 /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WorkQueueItem.h; sourceTree = "<group>"; }; @@ -396,8 +406,8 @@ 141BF439096A455900E0753C /* Carbon.framework in Frameworks */, 141BF436096A455900E0753C /* Cocoa.framework in Frameworks */, 141BF438096A455900E0753C /* JavaScriptCore.framework in Frameworks */, - 141BF435096A455900E0753C /* WebKit.framework in Frameworks */, 0F37A4AA11E6629100275F54 /* QuartzCore.framework in Frameworks */, + 141BF435096A455900E0753C /* WebKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -415,10 +425,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5DE8AE4413A2C15900D6A37D /* libWebCoreTestSupport.dylib in Frameworks */, AE8259F308D22463000507AB /* Carbon.framework in Frameworks */, A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */, A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */, + 5DE8AE4413A2C15900D6A37D /* libWebCoreTestSupport.dylib in Frameworks */, 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */, 9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */, ); @@ -440,6 +450,8 @@ 08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = { isa = PBXGroup; children = ( + 1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */, + 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */, 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */, 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */, 1422A2750AF6F4BD00E1A883 /* Delegates */, @@ -450,12 +462,12 @@ A8B91BF70CF522B4008F91FF /* CheckedMalloc.cpp */, A8B91BF90CF522B4008F91FF /* CheckedMalloc.h */, BC4741290D038A4C0072B006 /* JavaScriptThreading.h */, - BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */, BCA18C0A0C9B59EF00114369 /* DumpRenderTreeMac.h */, BCA18B730C9B08F100114369 /* DumpRenderTreeDraggingInfo.h */, BCA18B740C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm */, A8D79CE80FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h */, A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */, + 2CE88FA117124CEE00734FC0 /* JavaScriptThreading.cpp */, 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */, 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */, 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */, @@ -482,8 +494,8 @@ 141BF448096A45C800E0753C /* Info.plist */, 1AC6C77F0D07589B00CD3161 /* main.cpp */, 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */, - 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */, 141BF447096A45C800E0753C /* PluginObject.h */, + 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */, 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */, 1A215A8011F2609C008AD0F5 /* PluginTest.h */, 1AC6C7810D07589B00CD3161 /* TestObject.cpp */, @@ -495,8 +507,10 @@ 1422A2690AF6F45200E1A883 /* Controllers */ = { isa = PBXGroup; children = ( + BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */, BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */, BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */, + AA5A15ED16E15CD000F7C561 /* AccessibilityControllerIOS.mm */, BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */, 80045AEB147718E7008290A8 /* AccessibilityNotificationHandler.h */, 80045AEC147718E7008290A8 /* AccessibilityNotificationHandler.mm */, @@ -505,9 +519,8 @@ 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */, BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */, BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */, + AA5A15EE16E15CD000F7C561 /* AccessibilityUIElementIOS.mm */, BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */, - BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */, - BC0E26140E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm */, BCA18B360C9B021900114369 /* AppleScriptController.h */, BCA18B370C9B021900114369 /* AppleScriptController.m */, BCA18B6B0C9B08DB00114369 /* EventSendingController.h */, @@ -515,9 +528,6 @@ BCF6C64F0C98E9C000AC063E /* GCController.cpp */, 14770FE00A22ADF7009342EE /* GCController.h */, BCA18B210C9B014B00114369 /* GCControllerMac.mm */, - BC0131D80C9772010087317D /* TestRunner.cpp */, - BC0131D90C9772010087317D /* TestRunner.h */, - BCA18B220C9B014B00114369 /* TestRunnerMac.mm */, E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */, E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */, 31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */, @@ -526,6 +536,9 @@ BCA18B6E0C9B08DB00114369 /* NavigationController.m */, BCA18B2F0C9B01B400114369 /* ObjCController.h */, BCA18B300C9B01B400114369 /* ObjCController.m */, + BC0131D80C9772010087317D /* TestRunner.cpp */, + BC0131D90C9772010087317D /* TestRunner.h */, + BCA18B220C9B014B00114369 /* TestRunnerMac.mm */, BCA18B3A0C9B024900114369 /* TextInputController.h */, BCA18B480C9B02C400114369 /* TextInputController.m */, ); @@ -546,10 +559,10 @@ BCA18B5C0C9B08C200114369 /* PolicyDelegate.mm */, BCA18B5D0C9B08C200114369 /* ResourceLoadDelegate.h */, BCA18B5E0C9B08C200114369 /* ResourceLoadDelegate.mm */, - BCA18B5F0C9B08C200114369 /* UIDelegate.h */, - BCA18B600C9B08C200114369 /* UIDelegate.mm */, 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */, 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */, + BCA18B5F0C9B08C200114369 /* UIDelegate.h */, + BCA18B600C9B08C200114369 /* UIDelegate.mm */, ); name = Delegates; sourceTree = "<group>"; @@ -580,6 +593,7 @@ 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */, 1A1E4296141141C400388758 /* PrivateBrowsing.cpp */, 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */, + 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */, ); path = Tests; sourceTree = "<group>"; @@ -587,9 +601,9 @@ 1A31EB3613466AC100017372 /* mac */ = { isa = PBXGroup; children = ( + 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */, 1A31EB3713466AC100017372 /* ConvertPoint.cpp */, 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */, - 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */, ); path = mac; sourceTree = "<group>"; @@ -615,8 +629,8 @@ children = ( 9340995408540CAF007F3BC8 /* DumpRenderTree */, B5A7526708AF4A4A00138E45 /* ImageDiff */, - 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */, 2D403F19150871F9005358D2 /* LayoutTestHelper */, + 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */, ); name = Products; sourceTree = "<group>"; @@ -625,6 +639,7 @@ isa = PBXGroup; children = ( AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */, + 8CCDA81F151A56550003F937 /* SampleFont.sfont */, 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */, 375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */, 375F09730DAC3CB600C8B4E5 /* WebKitWeightWatcher300.ttf */, @@ -634,7 +649,6 @@ 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */, 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */, 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */, - 8CCDA81F151A56550003F937 /* SampleFont.sfont */, ); name = Resources; sourceTree = "<group>"; @@ -642,11 +656,11 @@ A803FF6409CAACC1009B2A37 /* Frameworks */ = { isa = PBXGroup; children = ( - 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */, BCB284B20CFA82CB007E533E /* ApplicationServices.framework */, AE8257EF08D22389000507AB /* Carbon.framework */, A84F608908B136DA00E9745F /* Cocoa.framework */, A817090308B164D300CCB9FB /* JavaScriptCore.framework */, + 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */, 23BCB88F0EA57623003C6289 /* OpenGL.framework */, B5A752A108AF5D1F00138E45 /* QuartzCore.framework */, 9335435F03D75502008635CE /* WebKit.framework */, @@ -712,8 +726,8 @@ buildActionMask = 2147483647; files = ( 141BF453096A45EB00E0753C /* PluginObject.h in Headers */, - 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */, 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */, + 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -721,6 +735,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 80045AED147718E7008290A8 /* AccessibilityNotificationHandler.h in Headers */, + 29CFBA10122736E600BC30C0 /* AccessibilityTextMarker.h in Headers */, BC0E24E00E2D9451001B6BC2 /* AccessibilityUIElement.h in Headers */, BCA18B380C9B021900114369 /* AppleScriptController.h in Headers */, A8B91BFF0CF522B4008F91FF /* CheckedMalloc.h in Headers */, @@ -735,8 +751,10 @@ BCA18B6F0C9B08DB00114369 /* EventSendingController.h in Headers */, BCA18B630C9B08C200114369 /* FrameLoadDelegate.h in Headers */, 14770FE20A22ADF7009342EE /* GCController.h in Headers */, + 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */, BC47412A0D038A4C0072B006 /* JavaScriptThreading.h in Headers */, - BC0131DB0C9772010087317D /* TestRunner.h in Headers */, + E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */, + 31117B3C15D9A56A00163BC8 /* MockWebNotificationProvider.h in Headers */, BCA18B710C9B08DB00114369 /* NavigationController.h in Headers */, BCA18B310C9B01B400114369 /* ObjCController.h in Headers */, BCA18B7D0C9B08F100114369 /* ObjCPlugin.h in Headers */, @@ -744,19 +762,16 @@ BCB284C70CFA83C4007E533E /* PixelDumpSupport.h in Headers */, BCB284D00CFA83CC007E533E /* PixelDumpSupportCG.h in Headers */, BCA18B650C9B08C200114369 /* PolicyDelegate.h in Headers */, + 1A2FB84E178C80930059FD96 /* DefaultPolicyDelegate.h in Headers */, BCA18B670C9B08C200114369 /* ResourceLoadDelegate.h in Headers */, + 3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */, + BC0131DB0C9772010087317D /* TestRunner.h in Headers */, BCA18B3C0C9B024900114369 /* TextInputController.h in Headers */, BCA18B690C9B08C200114369 /* UIDelegate.h in Headers */, 4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */, + 417DAA1D137B3E24007C57FB /* WebCoreTestSupport.h in Headers */, BC9D90250C97472E0099A4A3 /* WorkQueue.h in Headers */, BC9D90260C97472E0099A4A3 /* WorkQueueItem.h in Headers */, - 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */, - E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */, - 29CFBA10122736E600BC30C0 /* AccessibilityTextMarker.h in Headers */, - 3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */, - 417DAA1D137B3E24007C57FB /* WebCoreTestSupport.h in Headers */, - 80045AED147718E7008290A8 /* AccessibilityNotificationHandler.h in Headers */, - 31117B3C15D9A56A00163BC8 /* MockWebNotificationProvider.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -865,6 +880,8 @@ /* Begin PBXProject section */ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; + attributes = { + }; buildConfigurationList = 149C29C308902C6D008A9EFC /* Build configuration list for PBXProject "DumpRenderTree" */; compatibilityVersion = "Xcode 2.4"; developmentRegion = English; @@ -905,36 +922,37 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1AC6C8490D07638600CD3161 /* main.cpp in Sources */, - 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */, - 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */, - 0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */, - 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */, + 1A66C35114576A920099A115 /* ContentsScaleFactor.cpp in Sources */, + 1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */, + 1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */, 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */, - 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */, - 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */, - 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */, - C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */, - C0EC3C9C12787F0500939164 /* NullNPPGetValuePointer.cpp in Sources */, C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp in Sources */, - 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */, + 51CACBD815D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp in Sources */, + 4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */, + 1AFF66BC137DEFD200791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp in Sources */, + 1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */, 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */, + 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */, + 51134C9916014FDC001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp in Sources */, + 515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */, + 1AC6C8490D07638600CD3161 /* main.cpp in Sources */, 1ACF898D132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp in Sources */, - 1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */, + 5113DE6715F6CBE5005EC8B3 /* NPPNewFails.cpp in Sources */, C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp in Sources */, - 1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */, - 1AFF66BC137DEFD200791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp in Sources */, - 4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */, - 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */, - 1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */, - 1A66C35114576A920099A115 /* ContentsScaleFactor.cpp in Sources */, + 1AD8683F163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp in Sources */, + 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */, + 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */, + C0EC3C9C12787F0500939164 /* NullNPPGetValuePointer.cpp in Sources */, + C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */, + 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */, + 0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */, + 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */, 515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */, + 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */, + 1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */, 5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */, - 51CACBD815D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp in Sources */, - 515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */, - 5113DE6715F6CBE5005EC8B3 /* NPPNewFails.cpp in Sources */, - 51134C9916014FDC001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp in Sources */, - 1AD8683F163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp in Sources */, + 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */, + 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -950,15 +968,19 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + BC0E26150E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm in Sources */, BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */, BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */, + 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */, + 29CFBA11122736E600BC30C0 /* AccessibilityTextMarker.cpp in Sources */, + 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */, BC0E24E10E2D9451001B6BC2 /* AccessibilityUIElement.cpp in Sources */, BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */, - BC0E26150E2DA4C6001B6BC3 /* AccessibilityCommonMac.mm in Sources */, BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */, A8B91BFD0CF522B4008F91FF /* CheckedMalloc.cpp in Sources */, 53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */, BCA18C470C9B5B9400114369 /* DumpRenderTree.mm in Sources */, + 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */, BCA18B7B0C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm in Sources */, A8D79CEB0FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m in Sources */, A8B91ADA0CF3B32F008F91FF /* DumpRenderTreePasteboard.m in Sources */, @@ -968,9 +990,11 @@ BCA18B640C9B08C200114369 /* FrameLoadDelegate.mm in Sources */, BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */, BCA18B230C9B014B00114369 /* GCControllerMac.mm in Sources */, - BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */, - BC0131DA0C9772010087317D /* TestRunner.cpp in Sources */, - BCA18B240C9B014B00114369 /* TestRunnerMac.mm in Sources */, + AA5A15EF16E15CD000F7C561 /* AccessibilityControllerIOS.mm in Sources */, + 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, + 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */, + E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */, + 31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */, BCA18B720C9B08DB00114369 /* NavigationController.m in Sources */, BCA18B320C9B01B400114369 /* ObjCController.m in Sources */, BCA18B7E0C9B08F100114369 /* ObjCPlugin.m in Sources */, @@ -979,21 +1003,18 @@ BCB284CD0CFA83C8007E533E /* PixelDumpSupportCG.cpp in Sources */, BCB284D60CFA83D1007E533E /* PixelDumpSupportMac.mm in Sources */, BCA18B660C9B08C200114369 /* PolicyDelegate.mm in Sources */, + AA5A15F016E15CD000F7C561 /* AccessibilityUIElementIOS.mm in Sources */, BCA18B680C9B08C200114369 /* ResourceLoadDelegate.mm in Sources */, + 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */, + BC0131DA0C9772010087317D /* TestRunner.cpp in Sources */, + BCA18B240C9B014B00114369 /* TestRunnerMac.mm in Sources */, BCA18B490C9B02C400114369 /* TextInputController.m in Sources */, + 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */, BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */, 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */, 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */, BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */, BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */, - 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, - E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */, - 29CFBA11122736E600BC30C0 /* AccessibilityTextMarker.cpp in Sources */, - 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */, - 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */, - 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */, - 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */, - 31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp index 48d832258..3cb97ebfd 100644 --- a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp +++ b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp @@ -66,17 +66,20 @@ TestCommand parseInputLine(const std::string& inputLine) if (!tokenizer.hasNext()) die(inputLine); - result.pathOrURL = tokenizer.next(); - if (!tokenizer.hasNext()) - return result; - std::string arg = tokenizer.next(); - if (arg != std::string("-p") && arg != std::string("--pixel-test")) - die(inputLine); - result.shouldDumpPixels = true; - - if (tokenizer.hasNext()) - result.expectedPixelHash = tokenizer.next(); + result.pathOrURL = arg; + while (tokenizer.hasNext()) { + arg = tokenizer.next(); + if (arg == std::string("--timeout")) { + std::string timeoutToken = tokenizer.next(); + result.timeout = atoi(timeoutToken.c_str()); + } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) { + result.shouldDumpPixels = true; + if (tokenizer.hasNext()) + result.expectedPixelHash = tokenizer.next(); + } else + die(inputLine); + } return result; } diff --git a/Tools/DumpRenderTree/JavaScriptThreading.cpp b/Tools/DumpRenderTree/JavaScriptThreading.cpp new file mode 100644 index 000000000..66de156c7 --- /dev/null +++ b/Tools/DumpRenderTree/JavaScriptThreading.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. + * (C) 2007 Graham Dennis (graham.dennis@gmail.com) + * (C) 2007 Eric Seidel <eric@webkit.org> + * (C) 2012 Patrick Ganstere <paroga@paroga.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JavaScriptThreading.h" + +#include <JavaScriptCore/JavaScriptCore.h> +#include <stdlib.h> +#include <wtf/Assertions.h> +#include <wtf/HashSet.h> +#include <wtf/Vector.h> + +static const size_t javaScriptThreadsCount = 4; +static bool javaScriptThreadsShouldTerminate; +static JSContextGroupRef javaScriptThreadsGroup; + +static Mutex& javaScriptThreadsMutex() +{ + DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); + return staticMutex; +} + +typedef HashSet<ThreadIdentifier> ThreadSet; +static ThreadSet& javaScriptThreads() +{ + DEFINE_STATIC_LOCAL(ThreadSet, staticJavaScriptThreads, ()); + ASSERT(!javaScriptThreadsMutex().tryLock()); + return staticJavaScriptThreads; +} + +// This function exercises JSC in a loop until javaScriptThreadsShouldTerminate +// becomes true or it probabilistically decides to spawn a replacement thread and exit. +void runJavaScriptThread(void*) +{ + static const char* const script = + "var array = [];" + "for (var i = 0; i < 1024; i++) {" + " array.push(String(i));" + "}"; + + JSGlobalContextRef ctx; + { + MutexLocker locker(javaScriptThreadsMutex()); + ctx = JSGlobalContextCreateInGroup(javaScriptThreadsGroup, 0); + } + + JSStringRef scriptRef; + { + MutexLocker locker(javaScriptThreadsMutex()); + scriptRef = JSStringCreateWithUTF8CString(script); + } + + while (true) { + { + MutexLocker locker(javaScriptThreadsMutex()); + JSValueRef exception = 0; + JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); + ASSERT(!exception); + } + + { + MutexLocker locker(javaScriptThreadsMutex()); + const size_t valuesCount = 1024; + JSValueRef values[valuesCount]; + for (size_t i = 0; i < valuesCount; ++i) + values[i] = JSObjectMake(ctx, 0, 0); + } + + { + MutexLocker locker(javaScriptThreadsMutex()); + if (javaScriptThreadsShouldTerminate) + break; + } + + // Respawn probabilistically. + if (rand() % 5) + continue; + + MutexLocker locker(javaScriptThreadsMutex()); + ThreadIdentifier thread = currentThread(); + detachThread(thread); + javaScriptThreads().remove(thread); + javaScriptThreads().add(createThread(&runJavaScriptThread, 0, 0)); + break; + } + + MutexLocker locker(javaScriptThreadsMutex()); + JSStringRelease(scriptRef); + JSGarbageCollect(ctx); + JSGlobalContextRelease(ctx); +} + +void startJavaScriptThreads() +{ + javaScriptThreadsGroup = JSContextGroupCreate(); + + MutexLocker locker(javaScriptThreadsMutex()); + + for (size_t i = 0; i < javaScriptThreadsCount; ++i) + javaScriptThreads().add(createThread(&runJavaScriptThread, 0, 0)); +} + +void stopJavaScriptThreads() +{ + { + MutexLocker locker(javaScriptThreadsMutex()); + javaScriptThreadsShouldTerminate = true; + } + + Vector<ThreadIdentifier, javaScriptThreadsCount> threads; + { + MutexLocker locker(javaScriptThreadsMutex()); + copyToVector(javaScriptThreads(), threads); + ASSERT(threads.size() == javaScriptThreadsCount); + } + + for (size_t i = 0; i < javaScriptThreadsCount; ++i) + waitForThreadCompletion(threads[i]); + + javaScriptThreads().clear(); + + JSContextGroupRelease(javaScriptThreadsGroup); +} diff --git a/Tools/DumpRenderTree/Makefile b/Tools/DumpRenderTree/Makefile index 1f1dbbcb3..344ef480b 100644 --- a/Tools/DumpRenderTree/Makefile +++ b/Tools/DumpRenderTree/Makefile @@ -1,2 +1,9 @@ SCRIPTS_PATH = ../Scripts + +ifneq (,$(findstring iphoneos,$(SDKROOT))) + OTHER_OPTIONS += -target All-iOS +else ifneq (,$(findstring iphonesimulator,$(SDKROOT))) + OTHER_OPTIONS += -target All-iOS +endif + include ../../Makefile.shared diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt index 384b5bfb0..512032359 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt @@ -1,6 +1,6 @@ -SET(WEBKIT_TESTNETSCAPEPLUGIN_DIR "${TOOLS_DIR}/DumpRenderTree/TestNetscapePlugIn") +set(WEBKIT_TESTNETSCAPEPLUGIN_DIR "${TOOLS_DIR}/DumpRenderTree/TestNetscapePlugIn") -SET(WebKitTestNetscapePlugin_SOURCES +set(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/PluginObject.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/PluginTest.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/TestObject.cpp @@ -13,6 +13,7 @@ SET(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURL.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/LogNPPSetWindow.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPDeallocateCalledBeforeNPShutdown.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPNewFails.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/NPPSetWindowCalledDuringDestruction.cpp @@ -24,15 +25,21 @@ SET(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableNPObjectInvokeDefault.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableObjectOverridesAllProperties.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PrivateBrowsing.cpp + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/ToStringAndValueOfObject.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp ) -SET(WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES +set(WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR} ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/unix/ForwardingHeaders ${WEBCORE_DIR} ) -INCLUDE_DIRECTORIES(${WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES}) +include_directories(${WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES}) -ADD_LIBRARY(TestNetscapePlugin SHARED ${WebKitTestNetscapePlugin_SOURCES}) +set(WebKitTestNetscapePlugin_LIBRARIES + ${X11_LIBRARIES} +) + +add_library(TestNetscapePlugin SHARED ${WebKitTestNetscapePlugin_SOURCES}) +target_link_libraries(TestNetscapePlugin ${WebKitTestNetscapePlugin_LIBRARIES}) diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp index c9af49c59..d78a29bae 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp @@ -58,9 +58,11 @@ private: if (error != NPERR_NO_ERROR) { log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct failed with error %d", error); + notifyDone(); return NPERR_GENERIC_ERROR; } log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succeeded"); + notifyDone(); return NPERR_NO_ERROR; } diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/ToStringAndValueOfObject.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/ToStringAndValueOfObject.cpp new file mode 100644 index 000000000..e46d1416b --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/ToStringAndValueOfObject.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013 Cisco Systems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginTest.h" + +#include <string.h> + +using namespace std; + +class ToStringAndValueOfObject : public PluginTest { +public: + ToStringAndValueOfObject(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + +private: + class ScriptableObject : public Object<ScriptableObject> { + public: + bool hasMethod(NPIdentifier methodName) + { + return identifierIs(methodName, "toString") + || identifierIs(methodName, "valueOf"); + } + + bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result) + { + if (identifierIs(methodName, "toString")) { + // Return classname as string. + char* className = static_cast<char*>(pluginTest()->NPN_MemAlloc(11)); + strcpy(className, "TestObject"); + STRINGZ_TO_NPVARIANT(className, *result); + return true; + } + if (identifierIs(methodName, "valueOf")) { + // Return some number. + DOUBLE_TO_NPVARIANT(123456789, *result); + return true; + } + return false; + } + + private: + ToStringAndValueOfObject* pluginTest() const { return static_cast<ToStringAndValueOfObject*>(Object<ScriptableObject>::pluginTest()); } + }; + + virtual NPError NPP_GetValue(NPPVariable variable, void* value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + *(NPObject**)value = ScriptableObject::create(this); + + return NPERR_NO_ERROR; + } +}; + +static PluginTest::Register<ToStringAndValueOfObject> ToStringAndValueOfObject("to-string-and-value-of-object"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp index 0beb7de0a..1d851ead7 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp @@ -69,7 +69,7 @@ public: return true; } private: - virtual NPError NPP_SetWindow(NPWindow*) + NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) { if (testConvert()) executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/CallJSThatDestroysPlugin.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/CallJSThatDestroysPlugin.cpp index 39c6365a6..39c6365a6 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/CallJSThatDestroysPlugin.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/CallJSThatDestroysPlugin.cpp diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp index 97a4cf389..256acc003 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -351,6 +351,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window) if (obj->logSetWindow) { pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height); obj->logSetWindow = FALSE; + executeScript(obj, "testRunner.notifyDone();"); } if (obj->onSetWindow) diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj deleted file mode 100644 index 86414e21f..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj +++ /dev/null @@ -1,568 +0,0 @@ -<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePlugin"
- ProjectGUID="{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
- RootNamespace="TestNetscapePlugin"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginDebug.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginRelease.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginDebugCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginDebugAll.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Production|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginProduction.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\TestNetscapePluginReleaseCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Tests"
- >
- <File
- RelativePath=".\CallJSThatDestroysPlugin.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\EvaluateJSAfterRemovingPluginElement.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\FormValue.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\GetURLNotifyWithURLThatFailsToLoad.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\GetURLWithJavaScriptURL.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\GetURLWithJavaScriptURLDestroyingPlugin.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\GetUserAgentWithNullNPPFromNPPNew.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPDeallocateCalledBeforeNPShutdown.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPPNewFails.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPPSetWindowCalledDuringDestruction.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPRuntimeCallsWithNullNPP.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\NullNPPGetValuePointer.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PassDifferentNPPStruct.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PluginScriptableObjectOverridesAllProperties.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\PrivateBrowsing.cpp"
- >
- </File>
- <Filter
- Name="win"
- >
- <File
- RelativePath="..\Tests\win\DrawsGradient.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\DumpWindowRect.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\GetValueNetscapeWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\NPNInvalidateRectInvalidatesWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\WindowlessPaintRectCoordinates.cpp"
- >
- </File>
- <File
- RelativePath="..\Tests\win\WindowRegionIsSetToClipRect.cpp"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="win"
- >
- <File
- RelativePath=".\WindowedPluginTest.cpp"
- >
- </File>
- <File
- RelativePath=".\WindowedPluginTest.h"
- >
- </File>
- <File
- RelativePath=".\WindowGeometryTest.cpp"
- >
- </File>
- <File
- RelativePath=".\WindowGeometryTest.h"
- >
- </File>
- </Filter>
- <File
- RelativePath="..\main.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginObject.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginObject.h"
- >
- </File>
- <File
- RelativePath="..\PluginTest.cpp"
- >
- </File>
- <File
- RelativePath="..\PluginTest.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.def"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.rc"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin_debug.def"
- >
- </File>
- <File
- RelativePath="..\TestObject.cpp"
- >
- </File>
- <File
- RelativePath="..\TestObject.h"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops deleted file mode 100644 index 6e8014d0d..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginCommon.vsprops +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)..";"$(ConfigurationBuildDir)\Include";"$(ConfigurationBuildDir)\Include\JavaScriptCore";"$(ConfigurationBuildDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include""
- PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
- DisableSpecificWarnings="4819"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="Msimg32.lib"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
- ModuleDefinitionFile="TestNetscapePlugin$(WebKitConfigSuffix).def"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops deleted file mode 100644 index c0e2d4ea0..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebug.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginDebug"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops deleted file mode 100644 index 552f4bfbc..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugAll.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginDebugAll"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops deleted file mode 100644 index 901d0d368..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginDebugCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginDebugCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops deleted file mode 100644 index fddc49b07..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginProduction.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginProduction"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops deleted file mode 100644 index 73415e992..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginRelease.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginRelease"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops deleted file mode 100644 index 404f863f0..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePluginReleaseCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePluginReleaseCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\TestNetscapePluginCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def deleted file mode 100644 index 158fb7c2b..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin_debug.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY "npTestNetscapePlugin_debug" - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp index fe28a2911..fdb3aaaf1 100644 --- a/Tools/DumpRenderTree/TestRunner.cpp +++ b/Tools/DumpRenderTree/TestRunner.cpp @@ -32,10 +32,11 @@ #include "WorkQueue.h" #include "WorkQueueItem.h" -#include <cstring> #include <JavaScriptCore/JSContextRef.h> +#include <JavaScriptCore/JSCTestRunnerUtils.h> #include <JavaScriptCore/JSObjectRef.h> #include <JavaScriptCore/JSRetainPtr.h> +#include <cstring> #include <locale.h> #include <stdio.h> #include <wtf/Assertions.h> @@ -44,6 +45,16 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/RefPtr.h> +#if PLATFORM(MAC) +#include <Carbon/Carbon.h> +#endif + +const unsigned TestRunner::viewWidth = 800; +const unsigned TestRunner::viewHeight = 600; + +const unsigned TestRunner::w3cSVGViewWidth = 480; +const unsigned TestRunner::w3cSVGViewHeight = 360; + TestRunner::TestRunner(const std::string& testPathOrURL, const std::string& expectedPixelHash) : m_disallowIncreaseForApplicationCacheQuota(false) , m_dumpApplicationCacheDelegateCallbacks(false) @@ -548,15 +559,6 @@ static JSValueRef decodeHostNameCallback(JSContextRef context, JSObjectRef funct return JSValueMakeString(context, decodedHostName.get()); } -static JSValueRef disableImageLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - // Has mac implementation, needs windows implementation - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->disableImageLoading(); - - return JSValueMakeUndefined(context); -} - static JSValueRef dispatchPendingLoadRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac implementation, needs windows implementation @@ -689,16 +691,6 @@ static JSValueRef keepWebHistoryCallback(JSContextRef context, JSObjectRef funct return JSValueMakeUndefined(context); } -static JSValueRef computedStyleIncludingVisitedInfoCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 1) - return JSValueMakeUndefined(context); - - // Has mac implementation - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return controller->computedStyleIncludingVisitedInfo(context, arguments[0]); -} - static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -875,7 +867,7 @@ static JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectR TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); double size = JSValueToNumber(context, arguments[0], NULL); - if (!isnan(size)) + if (!std::isnan(size)) controller->setAppCacheMaximumSize(static_cast<unsigned long long>(size)); return JSValueMakeUndefined(context); @@ -890,7 +882,7 @@ static JSValueRef setApplicationCacheOriginQuotaCallback(JSContextRef context, J TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); double size = JSValueToNumber(context, arguments[0], NULL); - if (!isnan(size)) + if (!std::isnan(size)) controller->setApplicationCacheOriginQuota(static_cast<unsigned long long>(size)); return JSValueMakeUndefined(context); @@ -948,17 +940,6 @@ static JSValueRef setAuthorAndUserStylesEnabledCallback(JSContextRef context, JS return JSValueMakeUndefined(context); } -static JSValueRef setAutofilledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 2 || !arguments[0]) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setAutofilled(context, arguments[0], JSValueToBoolean(context, arguments[1])); - - return JSValueMakeUndefined(context); -} - static JSValueRef setCacheModelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has Mac implementation. @@ -999,7 +980,7 @@ static JSValueRef setDatabaseQuotaCallback(JSContextRef context, JSObjectRef fun TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); double quota = JSValueToNumber(context, arguments[0], NULL); - if (!isnan(quota)) + if (!std::isnan(quota)) controller->setDatabaseQuota(static_cast<unsigned long long>(quota)); return JSValueMakeUndefined(context); @@ -1308,18 +1289,6 @@ static JSValueRef setPrintingCallback(JSContextRef context, JSObjectRef function } -static JSValueRef setFrameFlatteningEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - // Has mac & windows implementation - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setFrameFlatteningEnabled(JSValueToBoolean(context, arguments[0])); - - return JSValueMakeUndefined(context); -} - static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1548,16 +1517,6 @@ static JSValueRef resetPageVisibilityCallback(JSContextRef context, JSObjectRef return JSValueMakeUndefined(context); } -static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setSmartInsertDeleteEnabled(JSValueToBoolean(context, arguments[0])); - return JSValueMakeUndefined(context); -} - static JSValueRef setAutomaticLinkDetectionEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) @@ -1568,16 +1527,6 @@ static JSValueRef setAutomaticLinkDetectionEnabledCallback(JSContextRef context, return JSValueMakeUndefined(context); } -static JSValueRef setSelectTrailingWhitespaceEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setSelectTrailingWhitespaceEnabled(JSValueToBoolean(context, arguments[0])); - return JSValueMakeUndefined(context); -} - static JSValueRef setStopProvisionalFrameLoadsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1585,16 +1534,6 @@ static JSValueRef setStopProvisionalFrameLoadsCallback(JSContextRef context, JSO return JSValueMakeUndefined(context); } -static JSValueRef setAsynchronousSpellCheckingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setAsynchronousSpellCheckingEnabled(JSValueToBoolean(context, arguments[0])); - return JSValueMakeUndefined(context); -} - static JSValueRef showWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1645,58 +1584,6 @@ static JSValueRef evaluateScriptInIsolatedWorldAndReturnValueCallback(JSContextR return JSValueMakeUndefined(context); } -static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - bool autoCompletes = controller->elementDoesAutoCompleteForElementWithId(elementId.get()); - - return JSValueMakeBoolean(context, autoCompletes); -} - -static JSValueRef pauseAnimationAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> animationName(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); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeBoolean(context, controller->pauseAnimationAtTimeOnElementWithId(animationName.get(), time, elementId.get())); -} - -static JSValueRef pauseTransitionAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> propertyName(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); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeBoolean(context, controller->pauseTransitionAtTimeOnElementWithId(propertyName.get(), time, elementId.get())); -} - -static JSValueRef numberOfActiveAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 0) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(context, controller->numberOfActiveAnimations()); -} - static JSValueRef waitForPolicyDelegateCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1831,39 +1718,6 @@ static JSValueRef setWebViewEditableCallback(JSContextRef context, JSObjectRef f return JSValueMakeUndefined(context); } -static JSValueRef sendWebIntentResponseCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - JSRetainPtr<JSStringRef> response; - if (argumentCount == 1) { - response.adopt(JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - } else - response.adopt(JSStringCreateWithUTF8CString(0)); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->sendWebIntentResponse(response.get()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef deliverWebIntentCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> action(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - JSRetainPtr<JSStringRef> type(Adopt, JSValueToStringCopy(context, arguments[1], exception)); - ASSERT(!*exception); - JSRetainPtr<JSStringRef> data(Adopt, JSValueToStringCopy(context, arguments[2], exception)); - ASSERT(!*exception); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->deliverWebIntent(action.get(), type.get(), data.get()); - - return JSValueMakeUndefined(context); -} - static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1871,14 +1725,6 @@ static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, return JSValueMakeUndefined(context); } -static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - if (argumentCount < 1) - return JSValueMakeUndefined(context); - return JSValueMakeString(context, controller->markerTextForListItem(context, arguments[0]).get()); -} - static JSValueRef authenticateSessionCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // authenticateSession(url, username, password) @@ -1982,13 +1828,7 @@ static JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectR return JSValueMakeNumber(context, controller->webHistoryItemCount()); } -static JSValueRef getWorkerThreadCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(context, controller->workerThreadCount()); -} - -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(EFL) static JSValueRef getPlatformNameCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1999,6 +1839,15 @@ static JSValueRef getPlatformNameCallback(JSContextRef context, JSObjectRef this } #endif +static JSValueRef getSecureEventInputIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ +#if PLATFORM(MAC) + return JSValueMakeBoolean(context, IsSecureEventInputEnabled()); +#else + return JSValueMakeBoolean(context, false); +#endif +} + static JSValueRef getTitleTextDirectionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -2028,20 +1877,6 @@ static JSValueRef simulateLegacyWebNotificationClickCallback(JSContextRef contex return JSValueMakeUndefined(context); } -static JSValueRef setMinimumTimerIntervalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - double minimum = JSValueToNumber(context, arguments[0], exception); - ASSERT(!*exception); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setMinimumTimerInterval(minimum); - - return JSValueMakeUndefined(context); -} - static JSValueRef setTextDirectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount == 1) { @@ -2079,6 +1914,14 @@ static JSValueRef setStorageDatabaseIdleIntervalCallback(JSContextRef context, J return JSValueMakeUndefined(context); } +static JSValueRef closeIdleLocalStorageDatabasesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + controller->closeIdleLocalStorageDatabases(); + + return JSValueMakeUndefined(context); +} + static JSValueRef grantWebNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) @@ -2132,6 +1975,22 @@ static JSValueRef simulateWebNotificationClickCallback(JSContextRef context, JSO return JSValueMakeUndefined(context); } +static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + return JSC::numberOfDFGCompiles(context, arguments[0]); +} + +static JSValueRef neverInlineFunction(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + return JSC::setNeverInline(context, arguments[0]); +} + static void testRunnerObjectFinalize(JSObjectRef object) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object)); @@ -2144,7 +2003,6 @@ void TestRunner::makeWindowObject(JSContextRef context, JSObjectRef windowObject { JSRetainPtr<JSStringRef> testRunnerStr(Adopt, JSStringCreateWithUTF8CString("testRunner")); ref(); - ref(); JSClassRef classRef = getJSClass(); JSValueRef layoutTestContollerObject = JSObjectMake(context, classRef, this); @@ -2170,10 +2028,10 @@ JSStaticValue* TestRunner::staticValues() static JSStaticValue staticValues[] = { { "globalFlag", getGlobalFlagCallback, setGlobalFlagCallback, kJSPropertyAttributeNone }, { "webHistoryItemCount", getWebHistoryItemCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "workerThreadCount", getWorkerThreadCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(EFL) { "platformName", getPlatformNameCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, #endif + { "secureEventInputIsEnabled", getSecureEventInputIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "titleTextDirection", getTitleTextDirectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0, 0 } }; @@ -2198,10 +2056,7 @@ JSStaticFunction* TestRunner::staticFunctions() { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "computedStyleIncludingVisitedInfo", computedStyleIncludingVisitedInfoCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "deliverWebIntent", deliverWebIntentCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "disallowIncreaseForApplicationCacheQuota", disallowIncreaseForApplicationCacheQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "dispatchPendingLoadRequests", dispatchPendingLoadRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2225,7 +2080,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "dumpTitleChanges", dumpTitleChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "dumpIconChanges", dumpIconChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "dumpWillCacheResponse", dumpWillCacheResponseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "evaluateScriptInIsolatedWorldAndReturnValue", evaluateScriptInIsolatedWorldAndReturnValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2238,13 +2092,9 @@ JSStaticFunction* TestRunner::staticFunctions() { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2257,7 +2107,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "resetPageVisibility", resetPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "sendWebIntentResponse", sendWebIntentResponseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2268,7 +2117,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setAutofilled", setAutofilledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2279,13 +2127,11 @@ JSStaticFunction* TestRunner::staticFunctions() { "setDefersLoading", setDefersLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setUseDeferredFrameLoading", setUseDeferredFrameLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAutomaticLinkDetectionEnabled", setAutomaticLinkDetectionEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setMinimumTimerInterval", setMinimumTimerIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationPositionUnavailableError", setMockGeolocationPositionUnavailableErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2299,9 +2145,7 @@ JSStaticFunction* TestRunner::staticFunctions() { "setPluginsEnabled", setPluginsEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setPrinting", setPrintingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSerializeHTTPLoads", setSerializeHTTPLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2317,7 +2161,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setJavaScriptCanAccessClipboard", setJavaScriptCanAccessClipboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setAsynchronousSpellCheckingEnabled", setAsynchronousSpellCheckingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "simulateLegacyWebNotificationClick", simulateLegacyWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2344,10 +2187,13 @@ JSStaticFunction* TestRunner::staticFunctions() { "preciseTime", preciseTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setHasCustomFullScreenBehavior", setHasCustomFullScreenBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setStorageDatabaseIdleInterval", setStorageDatabaseIdleIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "closeIdleLocalStorageDatabases", closeIdleLocalStorageDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "grantWebNotificationPermission", grantWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; @@ -2429,6 +2275,3 @@ void TestRunner::setShouldPaintBrokenImage(bool shouldPaintBrokenImage) { m_shouldPaintBrokenImage = shouldPaintBrokenImage; } - -const unsigned TestRunner::maxViewWidth = 800; -const unsigned TestRunner::maxViewHeight = 600; diff --git a/Tools/DumpRenderTree/TestRunner.h b/Tools/DumpRenderTree/TestRunner.h index fa76c7642..f5133922b 100644 --- a/Tools/DumpRenderTree/TestRunner.h +++ b/Tools/DumpRenderTree/TestRunner.h @@ -41,6 +41,13 @@ class TestRunner : public RefCounted<TestRunner> { public: static PassRefPtr<TestRunner> create(const std::string& testPathOrURL, const std::string& expectedPixelHash); + + static const unsigned viewWidth; + static const unsigned viewHeight; + + static const unsigned w3cSVGViewWidth; + static const unsigned w3cSVGViewHeight; + ~TestRunner(); void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception); @@ -56,8 +63,6 @@ public: bool callShouldCloseOnWebView(); JSStringRef copyDecodedHostName(JSStringRef name); JSStringRef copyEncodedHostName(JSStringRef name); - void deliverWebIntent(JSStringRef action, JSStringRef type, JSStringRef data); - void disableImageLoading(); void dispatchPendingLoadRequests(); void display(); void displayInvalidatedRegion(); @@ -68,7 +73,6 @@ public: long long applicationCacheDiskUsageForOrigin(JSStringRef name); bool isCommandEnabled(JSStringRef name); void keepWebHistory(); - JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); void notifyDone(); int numberOfPendingGeolocationPermissionRequests(); void overridePreference(JSStringRef key, JSStringRef value); @@ -82,14 +86,12 @@ public: void queueNonLoadingScript(JSStringRef script); void queueReload(); void removeAllVisitedLinks(); - void sendWebIntentResponse(JSStringRef response); void setAcceptsEditing(bool); void setAllowUniversalAccessFromFileURLs(bool); void setAllowFileAccessFromFileURLs(bool); void setAppCacheMaximumSize(unsigned long long quota); void setApplicationCacheOriginQuota(unsigned long long); void setAuthorAndUserStylesEnabled(bool); - void setAutofilled(JSContextRef, JSValueRef nodeObject, bool autofilled); void setCacheModel(int); void setCustomPolicyDelegate(bool setDelegate, bool permissive); void setDatabaseQuota(unsigned long long quota); @@ -108,8 +110,6 @@ public: void setPluginsEnabled(bool); void setPopupBlockingEnabled(bool); void setPrivateBrowsingEnabled(bool); - void setSelectTrailingWhitespaceEnabled(bool); - void setSmartInsertDeleteEnabled(bool); void setTabKeyCyclesThroughElements(bool); void setUseDashboardCompatibilityMode(bool flag); void setUserStyleSheetEnabled(bool flag); @@ -117,7 +117,6 @@ public: void setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value); void setViewModeMediaFeature(JSStringRef); void setXSSAuditorEnabled(bool flag); - void setFrameFlatteningEnabled(bool); void setSpatialNavigationEnabled(bool); void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy); void startSpeechInput(JSContextRef inputElement); @@ -126,10 +125,9 @@ public: void waitForPolicyDelegate(); size_t webHistoryItemCount(); - unsigned workerThreadCount() const; int windowCount(); -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(EFL) JSRetainPtr<JSStringRef> platformName() const; #endif @@ -142,8 +140,6 @@ public: void removeAllWebNotificationPermissions(); void simulateWebNotificationClick(JSValueRef notification); - bool elementDoesAutoCompleteForElementWithId(JSStringRef id); - bool dumpAsAudio() const { return m_dumpAsAudio; } void setDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; } @@ -288,10 +284,6 @@ public: const std::string& encodedAudioData() const { return m_encodedAudioData; } void setEncodedAudioData(const std::string& encodedAudioData) { m_encodedAudioData = encodedAudioData; } - - bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId); - bool pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId); - unsigned numberOfActiveAnimations() const; void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains); void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains); @@ -304,7 +296,6 @@ public: bool geolocationPermission() const { return m_geolocationPermission; } void setDeveloperExtrasEnabled(bool); - void setAsynchronousSpellCheckingEnabled(bool); void showWebInspector(); void closeWebInspector(); void evaluateInWebInspector(long callId, JSStringRef script); @@ -336,8 +327,6 @@ public: // Simulate a request an embedding application could make, populating per-session credential storage. void authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password); - JSRetainPtr<JSStringRef> markerTextForListItem(JSContextRef, JSValueRef nodeObject) const; - JSValueRef originsWithLocalStorage(JSContextRef); void deleteAllLocalStorage(); void deleteLocalStorageForOrigin(JSStringRef originIdentifier); @@ -348,11 +337,6 @@ public: void setShouldPaintBrokenImage(bool); bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; } - static const unsigned maxViewWidth; - static const unsigned maxViewHeight; - - void setMinimumTimerInterval(double); - void setTextDirection(JSStringRef); const std::string& titleTextDirection() const { return m_titleTextDirection; } void setTitleTextDirection(const std::string& direction) { m_titleTextDirection = direction; } @@ -362,6 +346,7 @@ public: bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; } void setStorageDatabaseIdleInterval(double); + void closeIdleLocalStorageDatabases(); bool hasPendingWebNotificationClick() const { return m_hasPendingWebNotificationClick; } diff --git a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.h b/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h index 7225757e6..7225757e6 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.h +++ b/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h diff --git a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp b/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp index 8f2c802c9..1ea4f4aac 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityCallbacks.cpp +++ b/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp @@ -29,12 +29,22 @@ #include "config.h" #include "AccessibilityCallbacks.h" +#if HAVE(ACCESSIBILITY) + #include "AccessibilityController.h" #include "DumpRenderTree.h" +#include <atk/atk.h> +#include <wtf/gobject/GOwnPtr.h> + +#if PLATFORM(GTK) #include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include <gtk/gtk.h> #include <webkit/webkit.h> -#include <wtf/gobject/GOwnPtr.h> +#endif + +#if PLATFORM(EFL) +#include "DumpRenderTreeChrome.h" +#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" +#endif static guint stateChangeListenerId = 0; static guint focusEventListenerId = 0; @@ -61,14 +71,10 @@ static void printAccessibilityEvent(AtkObject* accessible, const gchar* signalNa objectName = "(No name)"; GOwnPtr<gchar> signalNameAndValue(signalValue ? g_strdup_printf("%s = %s", signalName, signalValue) : g_strdup(signalName)); - printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n", - signalNameAndValue.get(), objectName, objectRole); + printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n", signalNameAndValue.get(), objectName, objectRole); } -static gboolean axObjectEventListener(GSignalInvocationHint *signalHint, - guint numParamValues, - const GValue *paramValues, - gpointer data) +static gboolean axObjectEventListener(GSignalInvocationHint *signalHint, guint numParamValues, const GValue *paramValues, gpointer data) { // At least we should receive the instance emitting the signal. if (numParamValues < 1) @@ -78,25 +84,25 @@ static gboolean axObjectEventListener(GSignalInvocationHint *signalHint, if (!accessible || !ATK_IS_OBJECT(accessible)) return TRUE; - GSignalQuery signal_query; + GSignalQuery signalQuery; GOwnPtr<gchar> signalName; GOwnPtr<gchar> signalValue; - g_signal_query(signalHint->signal_id, &signal_query); + g_signal_query(signalHint->signal_id, &signalQuery); - if (!g_strcmp0(signal_query.signal_name, "state-change")) { + if (!g_strcmp0(signalQuery.signal_name, "state-change")) { signalName.set(g_strdup_printf("state-change:%s", g_value_get_string(¶mValues[1]))); signalValue.set(g_strdup_printf("%d", g_value_get_boolean(¶mValues[2]))); - } else if (!g_strcmp0(signal_query.signal_name, "focus-event")) { + } else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) { signalName.set(g_strdup("focus-event")); signalValue.set(g_strdup_printf("%d", g_value_get_boolean(¶mValues[1]))); - } else if (!g_strcmp0(signal_query.signal_name, "children-changed")) { + } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) { signalName.set(g_strdup("children-changed")); signalValue.set(g_strdup_printf("%d", g_value_get_uint(¶mValues[1]))); - } else if (!g_strcmp0(signal_query.signal_name, "property-change")) { + } else if (!g_strcmp0(signalQuery.signal_name, "property-change")) signalName.set(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail))); - } else - signalName.set(g_strdup(signal_query.signal_name)); + else + signalName.set(g_strdup(signalQuery.signal_name)); printAccessibilityEvent(accessible, signalName.get(), signalValue.get()); @@ -110,15 +116,19 @@ void connectAccessibilityCallbacks() // Ensure that accessibility is initialized for the WebView by querying for // the root accessible object, which will create the full hierarchy. +#if PLATFORM(GTK) DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame); +#elif PLATFORM(EFL) + DumpRenderTreeSupportEfl::rootAccessibleElement(browser->mainFrame()); +#endif // Add global listeners for AtkObject's signals. - stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:state-change"); - focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:focus-event"); - activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:active-descendant-changed"); - childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:children-changed"); - propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:property-change"); - visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "Gtk:AtkObject:visible-data-changed"); + stateChangeListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:state-change"); + focusEventListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:focus-event"); + activeDescendantChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:active-descendant-changed"); + childrenChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:children-changed"); + propertyChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:property-change"); + visibleDataChangedListenerId = atk_add_global_event_listener(axObjectEventListener, "ATK:AtkObject:visible-data-changed"); // Ensure the Atk interface types are registered, otherwise // the AtkDocument signal handlers below won't get registered. @@ -157,3 +167,4 @@ void disconnectAccessibilityCallbacks() } } +#endif diff --git a/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp b/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp new file mode 100644 index 000000000..ddeaf2834 --- /dev/null +++ b/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AccessibilityController.h" + +#if HAVE(ACCESSIBILITY) + +#include "AccessibilityCallbacks.h" +#include "AccessibilityUIElement.h" +#include "DumpRenderTree.h" + +#include <atk/atk.h> + +static bool loggingAccessibilityEvents = false; + +AccessibilityController::AccessibilityController() +{ +} + +AccessibilityController::~AccessibilityController() +{ +} + +AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) +{ + // FIXME: implement + return 0; +} + + +void AccessibilityController::setLogFocusEvents(bool) +{ +} + +void AccessibilityController::setLogScrollingStartEvents(bool) +{ +} + +void AccessibilityController::setLogValueChangeEvents(bool) +{ +} + +void AccessibilityController::setLogAccessibilityEvents(bool logAccessibilityEvents) +{ + if (logAccessibilityEvents == loggingAccessibilityEvents) + return; + + if (!logAccessibilityEvents) { + disconnectAccessibilityCallbacks(); + loggingAccessibilityEvents = false; + return; + } + + connectAccessibilityCallbacks(); + loggingAccessibilityEvents = true; +} + +bool AccessibilityController::addNotificationListener(JSObjectRef) +{ + return false; +} + +void AccessibilityController::removeNotificationListener() +{ +} + +AtkObject* AccessibilityController::childElementById(AtkObject* parent, const char* id) +{ + if (!ATK_IS_OBJECT(parent)) + return 0; + + bool parentFound = false; + AtkAttributeSet* attributeSet(atk_object_get_attributes(parent)); + for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { + AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); + if (!strcmp(attribute->name, "html-id")) { + if (!strcmp(attribute->value, id)) + parentFound = true; + break; + } + } + atk_attribute_set_free(attributeSet); + + if (parentFound) + return parent; + + int childCount = atk_object_get_n_accessible_children(parent); + for (int i = 0; i < childCount; i++) { + AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id); + if (ATK_IS_OBJECT(result)) + return result; + } + + return 0; +} + +#endif diff --git a/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp b/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp new file mode 100644 index 000000000..009b8a8d8 --- /dev/null +++ b/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp @@ -0,0 +1,1070 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AccessibilityUIElement.h" + +#if HAVE(ACCESSIBILITY) + +#include <JavaScriptCore/JSStringRef.h> +#include <atk/atk.h> +#include <wtf/Assertions.h> +#include <wtf/gobject/GOwnPtr.h> +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> +#include <wtf/unicode/CharacterNames.h> + +static String coreAttributeToAtkAttribute(JSStringRef attribute) +{ + size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute); + GOwnPtr<gchar> buffer(static_cast<gchar*>(g_malloc(bufferSize))); + JSStringGetUTF8CString(attribute, buffer.get(), bufferSize); + + String attributeString = String::fromUTF8(buffer.get()); + if (attributeString == "AXPlaceholderValue") + return "placeholder-text"; + + return ""; +} + +static String getAttributeSetValueForId(AtkObject* accessible, const char* id) +{ + const char* attributeValue = 0; + AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible); + for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { + AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); + if (!strcmp(atkAttribute->name, id)) { + attributeValue = atkAttribute->value; + break; + } + } + + String atkAttributeValue = String::fromUTF8(attributeValue); + atk_attribute_set_free(attributeSet); + + return atkAttributeValue; +} + +static inline String roleToString(AtkRole role) +{ + switch (role) { + case ATK_ROLE_ALERT: + return "AXRole: AXAlert"; + case ATK_ROLE_CANVAS: + return "AXRole: AXCanvas"; + case ATK_ROLE_CHECK_BOX: + return "AXRole: AXCheckBox"; + case ATK_ROLE_COLUMN_HEADER: + return "AXRole: AXColumnHeader"; + case ATK_ROLE_COMBO_BOX: + return "AXRole: AXComboBox"; + case ATK_ROLE_DOCUMENT_FRAME: + return "AXRole: AXWebArea"; + case ATK_ROLE_ENTRY: + return "AXRole: AXTextField"; + case ATK_ROLE_FOOTER: + return "AXRole: AXFooter"; + case ATK_ROLE_FORM: + return "AXRole: AXForm"; + case ATK_ROLE_GROUPING: + return "AXRole: AXGroup"; + case ATK_ROLE_HEADING: + return "AXRole: AXHeading"; + case ATK_ROLE_IMAGE: + return "AXRole: AXImage"; + case ATK_ROLE_IMAGE_MAP: + return "AXRole: AXImageMap"; + case ATK_ROLE_LABEL: + return "AXRole: AXLabel"; + case ATK_ROLE_LINK: + return "AXRole: AXLink"; + case ATK_ROLE_LIST: + return "AXRole: AXList"; + case ATK_ROLE_LIST_BOX: + return "AXRole: AXListBox"; + case ATK_ROLE_LIST_ITEM: + return "AXRole: AXListItem"; + case ATK_ROLE_MENU: + return "AXRole: AXMenu"; + case ATK_ROLE_MENU_BAR: + return "AXRole: AXMenuBar"; + case ATK_ROLE_MENU_ITEM: + return "AXRole: AXMenuItem"; + case ATK_ROLE_PAGE_TAB: + return "AXRole: AXTab"; + case ATK_ROLE_PAGE_TAB_LIST: + return "AXRole: AXTabGroup"; + case ATK_ROLE_PANEL: + return "AXRole: AXGroup"; + case ATK_ROLE_PARAGRAPH: + return "AXRole: AXParagraph"; + case ATK_ROLE_PASSWORD_TEXT: + return "AXRole: AXPasswordField"; + case ATK_ROLE_PUSH_BUTTON: + return "AXRole: AXButton"; + case ATK_ROLE_RADIO_BUTTON: + return "AXRole: AXRadioButton"; + case ATK_ROLE_ROW_HEADER: + return "AXRole: AXRowHeader"; + case ATK_ROLE_RULER: + return "AXRole: AXRuler"; + case ATK_ROLE_SCROLL_BAR: + return "AXRole: AXScrollBar"; + case ATK_ROLE_SCROLL_PANE: + return "AXRole: AXScrollArea"; + case ATK_ROLE_SECTION: + return "AXRole: AXDiv"; + case ATK_ROLE_SEPARATOR: + return "AXRole: AXHorizontalRule"; + case ATK_ROLE_SLIDER: + return "AXRole: AXSlider"; + case ATK_ROLE_SPIN_BUTTON: + return "AXRole: AXSpinButton"; + case ATK_ROLE_TABLE: + return "AXRole: AXTable"; + case ATK_ROLE_TABLE_CELL: + return "AXRole: AXCell"; + case ATK_ROLE_TABLE_COLUMN_HEADER: + return "AXRole: AXColumnHeader"; + case ATK_ROLE_TABLE_ROW: + return "AXRole: AXRow"; + case ATK_ROLE_TABLE_ROW_HEADER: + return "AXRole: AXRowHeader"; + case ATK_ROLE_TOGGLE_BUTTON: + return "AXRole: AXToggleButton"; + case ATK_ROLE_TOOL_BAR: + return "AXRole: AXToolbar"; + case ATK_ROLE_TOOL_TIP: + return "AXRole: AXUserInterfaceTooltip"; + case ATK_ROLE_TREE: + return "AXRole: AXTree"; + case ATK_ROLE_TREE_TABLE: + return "AXRole: AXTreeGrid"; + case ATK_ROLE_TREE_ITEM: + return "AXRole: AXTreeItem"; + case ATK_ROLE_WINDOW: + return "AXRole: AXWindow"; + case ATK_ROLE_UNKNOWN: + return "AXRole: AXUnknown"; + default: + // We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which + // our DRT isn't properly handling. + return "AXRole: FIXME not identified"; + } +} + +static inline gchar* replaceCharactersForResults(gchar* str) +{ + String uString = String::fromUTF8(str); + + // The object replacement character is passed along to ATs so we need to be + // able to test for their presence and do so without causing test failures. + uString.replace(objectReplacementCharacter, "<obj>"); + + // The presence of newline characters in accessible text of a single object + // is appropriate, but it makes test results (especially the accessible tree) + // harder to read. + uString.replace("\n", "<\\n>"); + + return g_strdup(uString.utf8().data()); +} + +static bool checkElementState(PlatformUIElement element, AtkStateType stateType) +{ + if (!ATK_IS_OBJECT(element)) + return false; + + GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element))); + return atk_state_set_contains_state(stateSet.get(), stateType); +} + +AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) + : m_element(element) +{ + if (m_element) + g_object_ref(m_element); +} + +AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) + : m_element(other.m_element) +{ + if (m_element) + g_object_ref(m_element); +} + +AccessibilityUIElement::~AccessibilityUIElement() +{ + if (m_element) + g_object_unref(m_element); +} + +void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements) +{ + // FIXME: implement +} + +void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&) +{ + // FIXME: implement +} + +void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children) +{ + int count = childrenCount(); + for (int i = 0; i < count; i++) { + AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i); + children.append(AccessibilityUIElement(child)); + } +} + +void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end) +{ + for (unsigned i = start; i < end; i++) { + AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i); + elementVector.append(AccessibilityUIElement(child)); + } +} + +int AccessibilityUIElement::rowCount() +{ + if (!m_element) + return 0; + + ASSERT(ATK_IS_TABLE(m_element)); + + return atk_table_get_n_rows(ATK_TABLE(m_element)); +} + +int AccessibilityUIElement::columnCount() +{ + if (!m_element) + return 0; + + ASSERT(ATK_IS_TABLE(m_element)); + + return atk_table_get_n_columns(ATK_TABLE(m_element)); +} + +int AccessibilityUIElement::childrenCount() +{ + if (!m_element) + return 0; + + ASSERT(ATK_IS_OBJECT(m_element)); + + return atk_object_get_n_accessible_children(ATK_OBJECT(m_element)); +} + +AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) +{ + if (!m_element) + return 0; + + return AccessibilityUIElement(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element), x, y, ATK_XY_WINDOW)); +} + +AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) +{ + // FIXME: implement + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) +{ + Vector<AccessibilityUIElement> children; + getChildrenWithRange(children, index, index + 1); + + if (children.size() == 1) + return children.at(0); + + return 0; +} + +unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) +{ + // FIXME: implement + return 0; +} + +static char* getAtkAttributeSetAsString(AtkObject* accessible) +{ + GString* str = g_string_new(0); + + AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible); + for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { + AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); + GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); + g_string_append(str, attributeData.get()); + if (attributes->next) + g_string_append(str, ", "); + } + atk_attribute_set_free(attributeSet); + + return g_string_free(str, FALSE); +} + +JSStringRef AccessibilityUIElement::allAttributes() +{ + if (!m_element || !ATK_IS_OBJECT(m_element)) + return JSStringCreateWithCharacters(0, 0); + + GOwnPtr<char> attributeData(getAtkAttributeSetAsString(ATK_OBJECT(m_element))); + return JSStringCreateWithUTF8CString(attributeData.get()); +} + +JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +AccessibilityUIElement AccessibilityUIElement::titleUIElement() +{ + if (!m_element) + return 0; + + AtkRelationSet* set = atk_object_ref_relation_set(ATK_OBJECT(m_element)); + if (!set) + return 0; + + AtkObject* target = 0; + int count = atk_relation_set_get_n_relations(set); + for (int i = 0; i < count; i++) { + AtkRelation* relation = atk_relation_set_get_relation(set, i); + if (atk_relation_get_relation_type(relation) == ATK_RELATION_LABELLED_BY) { + GPtrArray* targetList = atk_relation_get_target(relation); + if (targetList->len) + target = static_cast<AtkObject*>(g_ptr_array_index(targetList, 0)); + } + } + + g_object_unref(set); + return target ? AccessibilityUIElement(target) : 0; +} + +AccessibilityUIElement AccessibilityUIElement::parentElement() +{ + if (!m_element) + return 0; + + ASSERT(ATK_IS_OBJECT(m_element)); + + AtkObject* parent = atk_object_get_parent(ATK_OBJECT(m_element)); + return parent ? AccessibilityUIElement(parent) : 0; +} + +JSStringRef AccessibilityUIElement::attributesOfChildren() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::parameterizedAttributeNames() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::role() +{ + AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); + if (!role) + return JSStringCreateWithCharacters(0, 0); + + String roleString = roleToString(role); + return JSStringCreateWithUTF8CString(roleString.utf8().data()); +} + +JSStringRef AccessibilityUIElement::subrole() +{ + return 0; +} + +JSStringRef AccessibilityUIElement::roleDescription() +{ + return 0; +} + +JSStringRef AccessibilityUIElement::title() +{ + const gchar* name = atk_object_get_name(ATK_OBJECT(m_element)); + GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name ? name : "")); + + return JSStringCreateWithUTF8CString(axTitle.get()); +} + +JSStringRef AccessibilityUIElement::description() +{ + const gchar* description = atk_object_get_description(ATK_OBJECT(m_element)); + + if (!description) + return JSStringCreateWithCharacters(0, 0); + + GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description)); + + return JSStringCreateWithUTF8CString(axDesc.get()); +} + +JSStringRef AccessibilityUIElement::stringValue() +{ + if (!m_element || !ATK_IS_TEXT(m_element)) + return JSStringCreateWithCharacters(0, 0); + + GOwnPtr<gchar> text(atk_text_get_text(ATK_TEXT(m_element), 0, -1)); + GOwnPtr<gchar> textWithReplacedCharacters(replaceCharactersForResults(text.get())); + GOwnPtr<gchar> axValue(g_strdup_printf("AXValue: %s", textWithReplacedCharacters.get())); + + return JSStringCreateWithUTF8CString(axValue.get()); +} + +JSStringRef AccessibilityUIElement::language() +{ + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + + const gchar* locale = atk_object_get_object_locale(ATK_OBJECT(m_element)); + if (!locale) + return JSStringCreateWithCharacters(0, 0); + + GOwnPtr<char> axValue(g_strdup_printf("AXLanguage: %s", locale)); + return JSStringCreateWithUTF8CString(axValue.get()); +} + +double AccessibilityUIElement::x() +{ + int x, y; + + atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN); + + return x; +} + +double AccessibilityUIElement::y() +{ + int x, y; + + atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN); + + return y; +} + +double AccessibilityUIElement::width() +{ + int width, height; + + atk_component_get_size(ATK_COMPONENT(m_element), &width, &height); + + return width; +} + +double AccessibilityUIElement::height() +{ + int width, height; + + atk_component_get_size(ATK_COMPONENT(m_element), &width, &height); + + return height; +} + +double AccessibilityUIElement::clickPointX() +{ + // Note: This is not something we have in ATK. + return 0.f; +} + +double AccessibilityUIElement::clickPointY() +{ + // Note: This is not something we have in ATK. + return 0.f; +} + +JSStringRef AccessibilityUIElement::orientation() const +{ + if (!m_element || !ATK_IS_OBJECT(m_element)) + return JSStringCreateWithCharacters(0, 0); + + const char* axOrientation = 0; + if (checkElementState(m_element, ATK_STATE_HORIZONTAL)) + axOrientation = "AXOrientation: AXHorizontalOrientation"; + else if (checkElementState(m_element, ATK_STATE_VERTICAL)) + axOrientation = "AXOrientation: AXVerticalOrientation"; + + if (!axOrientation) + return JSStringCreateWithCharacters(0, 0); + + return JSStringCreateWithUTF8CString(axOrientation); +} + +double AccessibilityUIElement::intValue() const +{ + GValue value = { 0, { { 0 } } }; + + if (!ATK_IS_VALUE(m_element)) + return 0.0f; + + atk_value_get_current_value(ATK_VALUE(m_element), &value); + if (!G_VALUE_HOLDS_FLOAT(&value)) + return 0.0f; + return g_value_get_float(&value); +} + +double AccessibilityUIElement::minValue() +{ + GValue value = { 0, { { 0 } } }; + + if (!ATK_IS_VALUE(m_element)) + return 0.0f; + + atk_value_get_minimum_value(ATK_VALUE(m_element), &value); + if (!G_VALUE_HOLDS_FLOAT(&value)) + return 0.0f; + return g_value_get_float(&value); +} + +double AccessibilityUIElement::maxValue() +{ + GValue value = { 0, { { 0 } } }; + + if (!ATK_IS_VALUE(m_element)) + return 0.0f; + + atk_value_get_maximum_value(ATK_VALUE(m_element), &value); + if (!G_VALUE_HOLDS_FLOAT(&value)) + return 0.0f; + return g_value_get_float(&value); +} + +JSStringRef AccessibilityUIElement::valueDescription() +{ + // FIXME: implement after it has been implemented in ATK. + // See: https://bugzilla.gnome.org/show_bug.cgi?id=684576 + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::isEnabled() +{ + return checkElementState(m_element, ATK_STATE_ENABLED); +} + +int AccessibilityUIElement::insertionPointLineNumber() +{ + // FIXME: implement + return 0; +} + +bool AccessibilityUIElement::isPressActionSupported() +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isIncrementActionSupported() +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isDecrementActionSupported() +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isRequired() const +{ + return checkElementState(m_element, ATK_STATE_REQUIRED); +} + +bool AccessibilityUIElement::isFocused() const +{ + if (!ATK_IS_OBJECT(m_element)) + return false; + + GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); + gboolean isFocused = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSED); + + return isFocused; +} + +bool AccessibilityUIElement::isSelected() const +{ + return checkElementState(m_element, ATK_STATE_SELECTED); +} + +int AccessibilityUIElement::hierarchicalLevel() const +{ + // FIXME: implement + return 0; +} + +bool AccessibilityUIElement::ariaIsGrabbed() const +{ + return false; +} + +JSStringRef AccessibilityUIElement::ariaDropEffects() const +{ + return 0; +} + +bool AccessibilityUIElement::isExpanded() const +{ + if (!ATK_IS_OBJECT(m_element)) + return false; + + GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); + gboolean isExpanded = atk_state_set_contains_state(stateSet.get(), ATK_STATE_EXPANDED); + + return isExpanded; +} + +bool AccessibilityUIElement::isChecked() const +{ + if (!ATK_IS_OBJECT(m_element)) + return false; + + GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); + gboolean isChecked = atk_state_set_contains_state(stateSet.get(), ATK_STATE_CHECKED); + + return isChecked; +} + +JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfRowHeaders() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfColumns() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfRows() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfVisibleCells() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfHeader() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +int AccessibilityUIElement::indexInTable() +{ + // FIXME: implement + return 0; +} + +static JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange) +{ + GOwnPtr<gchar> rangeString(g_strdup("{0, 0}")); + + if (!element) + return JSStringCreateWithUTF8CString(rangeString.get()); + + ASSERT(ATK_IS_OBJECT(element)); + + AtkObject* axTable = atk_object_get_parent(ATK_OBJECT(element)); + if (!axTable || !ATK_IS_TABLE(axTable)) + return JSStringCreateWithUTF8CString(rangeString.get()); + + // Look for the cell in the table. + gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element)); + if (indexInParent == -1) + return JSStringCreateWithUTF8CString(rangeString.get()); + + int row = -1; + int column = -1; + row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent); + column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent); + + // Get the actual values, if row and columns are valid values. + if (row != -1 && column != -1) { + int base = 0; + int length = 0; + if (isRowRange) { + base = row; + length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column); + } else { + base = column; + length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column); + } + rangeString.set(g_strdup_printf("{%d, %d}", base, length)); + } + + return JSStringCreateWithUTF8CString(rangeString.get()); +} + +JSStringRef AccessibilityUIElement::rowIndexRange() +{ + // Range in table for rows. + return indexRangeInTable(m_element, true); +} + +JSStringRef AccessibilityUIElement::columnIndexRange() +{ + // Range in table for columns. + return indexRangeInTable(m_element, false); +} + +int AccessibilityUIElement::lineForIndex(int) +{ + // FIXME: implement + return 0; +} + +JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) +{ + // FIXME: implement + return false; +} + +AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly) +{ + // FIXME: implement + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) +{ + if (!m_element) + return 0; + + ASSERT(ATK_IS_TABLE(m_element)); + + // Adopt the AtkObject representing the cell because + // at_table_ref_at() transfers full ownership. + GRefPtr<AtkObject> foundCell = adoptGRef(atk_table_ref_at(ATK_TABLE(m_element), row, column)); + return foundCell ? AccessibilityUIElement(foundCell.get()) : 0; +} + +JSStringRef AccessibilityUIElement::selectedTextRange() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) +{ + // FIXME: implement +} + +JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) +{ + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + + String atkAttributeName = coreAttributeToAtkAttribute(attribute); + if (atkAttributeName.isEmpty()) + return JSStringCreateWithCharacters(0, 0); + + String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element), atkAttributeName.utf8().data()); + return JSStringCreateWithUTF8CString(attributeValue.utf8().data()); +} + +double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) +{ + // FIXME: implement + return 0.0f; +} + +bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) +{ + return false; +} + +static void alterCurrentValue(PlatformUIElement element, int factor) +{ + if (!element) + return; + + ASSERT(ATK_IS_VALUE(element)); + + GValue currentValue = G_VALUE_INIT; + atk_value_get_current_value(ATK_VALUE(element), ¤tValue); + + GValue increment = G_VALUE_INIT; + atk_value_get_minimum_increment(ATK_VALUE(element), &increment); + + GValue newValue = G_VALUE_INIT; + g_value_init(&newValue, G_TYPE_FLOAT); + + g_value_set_float(&newValue, g_value_get_float(¤tValue) + factor * g_value_get_float(&increment)); + atk_value_set_current_value(ATK_VALUE(element), &newValue); + + g_value_unset(&newValue); + g_value_unset(&increment); + g_value_unset(¤tValue); +} + +void AccessibilityUIElement::increment() +{ + alterCurrentValue(m_element, 1); +} + +void AccessibilityUIElement::decrement() +{ + alterCurrentValue(m_element, -1); +} + +void AccessibilityUIElement::press() +{ + if (!m_element) + return; + + ASSERT(ATK_IS_OBJECT(m_element)); + + if (!ATK_IS_ACTION(m_element)) + return; + + // Only one action per object is supported so far. + atk_action_do_action(ATK_ACTION(m_element), 0); +} + +void AccessibilityUIElement::showMenu() +{ + // FIXME: implement +} + +AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::disclosedByRow() +{ + return 0; +} + +JSStringRef AccessibilityUIElement::accessibilityValue() const +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::documentEncoding() +{ + AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); + if (role != ATK_ROLE_DOCUMENT_FRAME) + return JSStringCreateWithCharacters(0, 0); + + return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding")); +} + +JSStringRef AccessibilityUIElement::documentURI() +{ + AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); + if (role != ATK_ROLE_DOCUMENT_FRAME) + return JSStringCreateWithCharacters(0, 0); + + return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI")); +} + +JSStringRef AccessibilityUIElement::url() +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) +{ + // FIXME: implement + return false; +} + +void AccessibilityUIElement::removeNotificationListener() +{ + // FIXME: implement +} + +bool AccessibilityUIElement::isFocusable() const +{ + if (!ATK_IS_OBJECT(m_element)) + return false; + + GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); + gboolean isFocusable = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSABLE); + + return isFocusable; +} + +bool AccessibilityUIElement::isSelectable() const +{ + return checkElementState(m_element, ATK_STATE_SELECTABLE); +} + +bool AccessibilityUIElement::isMultiSelectable() const +{ + return checkElementState(m_element, ATK_STATE_MULTISELECTABLE); +} + +bool AccessibilityUIElement::isSelectedOptionActive() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isVisible() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isOffScreen() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isCollapsed() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isIgnored() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::hasPopup() const +{ + if (!m_element || !ATK_IS_OBJECT(m_element)) + return false; + + return equalIgnoringCase(getAttributeSetValueForId(ATK_OBJECT(m_element), "aria-haspopup"), "true"); +} + +void AccessibilityUIElement::takeFocus() +{ + // FIXME: implement +} + +void AccessibilityUIElement::takeSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::addSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::removeSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::scrollToMakeVisible() +{ + // FIXME: implement +} + +void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) +{ + // FIXME: implement +} + +void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) +{ + // FIXME: implement +} + +#endif diff --git a/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp index cdac14ff5..5b6b699f9 100644 --- a/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp @@ -77,3 +77,8 @@ void AccessibilityController::removeNotificationListener() { } +AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef) +{ + notImplemented(); + return 0; +} diff --git a/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp index 63fbd36c9..dc6635466 100644 --- a/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp @@ -235,7 +235,19 @@ int AccessibilityUIElement::insertionPointLineNumber() return 0; } -bool AccessibilityUIElement::isActionSupported(JSStringRef) +bool AccessibilityUIElement::isPressActionSupported() +{ + notImplemented(); + return 0; +} + +bool AccessibilityUIElement::isIncrementActionSupported() +{ + notImplemented(); + return 0; +} + +bool AccessibilityUIElement::isDecrementActionSupported() { notImplemented(); return 0; @@ -349,7 +361,7 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) return 0; } -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement*, bool, JSStringRef, JSStringRef) +AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef) { notImplemented(); return 0; @@ -544,6 +556,21 @@ bool AccessibilityUIElement::hasPopup() const return false; } +void AccessibilityUIElement::scrollToMakeVisible() +{ + notImplemented(); +} + +void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int, int, int, int) +{ + notImplemented(); +} + +void AccessibilityUIElement::scrollToGlobalPoint(int, int) +{ + notImplemented(); +} + void AccessibilityUIElement::takeFocus() { notImplemented(); diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index d674ab5e7..4f803af04 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -22,7 +22,7 @@ #include "APICast.h" #include "AccessibilityController.h" #include "BackForwardController.h" -#include "BackForwardListImpl.h" +#include "BackForwardListBlackBerry.h" #include "Credential.h" #include "DatabaseTracker.h" #include "DocumentLoader.h" @@ -37,9 +37,13 @@ #include "FrameLoaderTypes.h" #include "FrameTree.h" #include "FrameView.h" +#include "HTTPParsers.h" #include "HistoryItem.h" +#include "HitTestResult.h" #include "IntSize.h" #include "JSDOMBinding.h" +#include "MouseEvent.h" +#include "Node.h" #include "NotImplemented.h" #include "Page.h" #include "PageGroup.h" @@ -138,16 +142,36 @@ static bool shouldLogFrameLoadDelegates(const String& url) return url.contains("loading/"); } +static bool shouldDumpAsText(const String& url) +{ + return url.contains("dumpAsText/"); +} + namespace BlackBerry { namespace WebKit { DumpRenderTree* DumpRenderTree::s_currentInstance = 0; -bool DumpRenderTree::s_selectTrailingWhitespaceEnabled = false; static void createFile(const String& fileName) { FILE* fd = fopen(fileName.utf8().data(), "wb"); - fclose(fd); + if (fd) + fclose(fd); +} + +static bool isFullUrl(const String& url) +{ + static Vector<String> *prefixes = 0; + if (!prefixes) { + prefixes = new Vector<String>(); + prefixes->append("http://"); + prefixes->append("file://"); + } + for (unsigned i = 0; i < prefixes->size(); ++i) { + if (url.startsWith(prefixes->at(i), false)) + return true; + } + return false; } DumpRenderTree::DumpRenderTree(BlackBerry::WebKit::WebPage* page) @@ -158,6 +182,8 @@ DumpRenderTree::DumpRenderTree(BlackBerry::WebKit::WebPage* page) , m_waitToDumpWatchdogTimer(this, &DumpRenderTree::waitToDumpWatchdogTimerFired) , m_workTimer(this, &DumpRenderTree::processWork) , m_acceptsEditing(true) + , m_policyDelegateEnabled(false) + , m_policyDelegateIsPermissive(false) { const char* workerNumber = getenv("WORKER_NUMBER") ? getenv("WORKER_NUMBER") : "0"; String sdcardPath = SDCARD_PATH; @@ -193,9 +219,14 @@ void DumpRenderTree::runTest(const String& url, const String& imageHash) freopen(stderrFile.utf8().data(), "wb", stderr); } FILE* current = fopen(m_currentTestFile.utf8().data(), "w"); - fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current); - fclose(current); - m_page->load(url, BlackBerry::Platform::String::emptyString(), false); + if (current) { + fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current); + fclose(current); + } + BlackBerry::Platform::NetworkRequest request; + STATIC_LOCAL_STRING(s_get, "GET"); + request.setRequestUrl(url, s_get); + m_page->load(request); } void DumpRenderTree::doneDrt() @@ -221,7 +252,9 @@ void DumpRenderTree::runCurrentTest() m_currentHttpTest = m_currentTest->utf8().data(); m_currentHttpTest.remove(0, strlen(httpTestSyntax)); runTest(httpPrefixURL + m_currentHttpTest, imageHash); - } else + } else if (isFullUrl(*m_currentTest)) + runTest(*m_currentTest, imageHash); + else runTest(kSDCLayoutTestsURI + *m_currentTest, imageHash); } @@ -255,19 +288,26 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, cons { gTestRunner = TestRunner::create(url.utf8().data(), imageHash.utf8().data()); + if (shouldDumpAsText(url)) { + gTestRunner->setDumpAsText(true); + gTestRunner->setGeneratePixelResults(false); + } gTestRunner->setIconDatabaseEnabled(false); DumpRenderTreeSupport::resetGeolocationMock(m_page); topLoadingFrame = 0; m_loadFinished = false; - s_selectTrailingWhitespaceEnabled = false; - + m_policyDelegateEnabled = false; + m_policyDelegateIsPermissive = false; + waitForPolicy = false; testDone = false; WorkQueue::shared()->clear(); WorkQueue::shared()->setFrozen(false); WebSettings* settings = m_page->settings(); + // Apply new settings to current page, see more in the destructor of WebSettingsTransaction. + WebSettingsTransaction webSettingTransaction(settings); settings->setTextReflowMode(WebSettings::TextReflowDisabled); settings->setJavaScriptEnabled(true); @@ -277,21 +317,24 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, cons settings->setDefaultFontSize(16); settings->setDefaultFixedFontSize(13); settings->setMinimumFontSize(1); - settings->setSerifFontFamily("Times"); - settings->setFixedFontFamily("Courier New"); - settings->setSansSerifFontFamily("Arial"); - settings->setStandardFontFamily("Times"); + STATIC_LOCAL_STRING(s_arial, "Arial"); + STATIC_LOCAL_STRING(s_courier, "Courier New"); + STATIC_LOCAL_STRING(s_times, "Times"); + settings->setSerifFontFamily(s_times); + settings->setFixedFontFamily(s_courier); + settings->setSansSerifFontFamily(s_arial); + settings->setStandardFontFamily(s_times); settings->setXSSAuditorEnabled(false); - settings->setFrameFlatteningEnabled(false); settings->setMaximumPagesInCache(0); settings->setPluginsEnabled(true); - // Apply new settings to current page, see more in the destructor of WebSettingsTransaction. - WebSettingsTransaction webSettingTransaction(settings); BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->clearBackForwardList(false); setAcceptsEditing(true); DumpRenderTreeSupport::setLinksIncludedInFocusChain(true); +#if ENABLE(STYLE_SCOPED) + DumpRenderTreeSupport::setStyleScopedEnabled(true); +#endif m_page->setVirtualViewportSize(Platform::IntSize(800, 600)); m_page->resetVirtualViewportOnCommitted(false); @@ -313,7 +356,7 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, cons page->settings()->setUsePreHTML5ParserQuirks(false); // FIXME: Other ports also clear history/backForwardList allong with visited links. page->group().removeVisitedLinks(); - if (mainFrame = page->mainFrame()) { + if ((mainFrame = page->mainFrame())) { mainFrame->tree()->clearName(); mainFrame->loader()->setOpener(0); // [WebKit bug #86899] Reset JS state settings. @@ -431,7 +474,7 @@ static String dumpHistoryItem(PassRefPtr<WebCore::HistoryItem> item, int indent, start = 6; } for (int i = start; i < indent; i++) - result = result + " "; + result = result + ' '; String url = item->urlString(); if (url.contains("file://")) { @@ -453,7 +496,7 @@ static String dumpHistoryItem(PassRefPtr<WebCore::HistoryItem> item, int indent, if (item->isTargetItem()) result = result + " **nav target**"; - result = result + "\n"; + result = result + '\n'; WebCore::HistoryItemVector children = item->children(); // Must sort to eliminate arbitrary result ordering which defeats reproducible testing. @@ -471,7 +514,8 @@ static String dumpBackForwardListForWebView() // FORMAT: // " (file test):fast/loader/resources/click-fragment-link.html **nav target**" // "curr-> (file test):fast/loader/resources/click-fragment-link.html#testfragment **nav target**" - WebCore::BackForwardListImpl* bfList = static_cast<WebCore::BackForwardListImpl*>(mainFrame->page()->backForward()->client()); + WebCore::BackForwardListBlackBerry* bfList = static_cast<WebCore::BackForwardListBlackBerry*>(mainFrame->page()->backForward()->client()); + int maxItems = bfList->capacity(); WebCore::HistoryItemVector entries; bfList->backListWithLimit(maxItems, entries); @@ -514,9 +558,6 @@ void DumpRenderTree::dump() dumpToFile(result); if (!runFromCommandLine) { - // signal end of text block - fputs("#EOF\n", stdout); - // There are two scenarios for dumping pixels: // 1. When the test case explicitly asks for it by calling dumpAsText(true) with that extra true passed as a parameter value, from JavaScript bool explicitPixelResults = gTestRunner->dumpAsText() && gTestRunner->generatePixelResults(); @@ -525,8 +566,11 @@ void DumpRenderTree::dump() // But only if m_enablePixelTests is set, to say that the user wants to run pixel tests at all. bool generatePixelResults = m_enablePixelTests && (explicitPixelResults || implicitPixelResults); - if (generatePixelResults) + if (generatePixelResults) { + // signal end of text block + fputs("#EOF\n", stdout); dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); + } String crashFile = dumpFile + ".crash"; unlink(crashFile.utf8().data()); @@ -575,6 +619,16 @@ void DumpRenderTree::locationChangeForFrame(WebCore::Frame* frame) } // FrameLoadClient delegates. +bool DumpRenderTree::willSendRequestForFrame(WebCore::Frame* frame, WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse) +{ + if (!testDone && (gTestRunner->willSendRequestReturnsNull() || (gTestRunner->willSendRequestReturnsNullOnRedirect() && !redirectResponse.isNull()))) { + request = WebCore::ResourceRequest(); + return false; + } + + return true; +} + void DumpRenderTree::didStartProvisionalLoadForFrame(WebCore::Frame* frame) { if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) @@ -621,9 +675,10 @@ void DumpRenderTree::didFinishLoadForFrame(WebCore::Frame* frame) if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) printf("%s - didFinishLoadForFrame\n", drtFrameDescription(frame).utf8().data()); - if (frame == topLoadingFrame) + if (frame == topLoadingFrame) { m_loadFinished = true; - locationChangeForFrame(frame); + locationChangeForFrame(frame); + } } void DumpRenderTree::didFinishDocumentLoadForFrame(WebCore::Frame* frame) @@ -669,7 +724,7 @@ void DumpRenderTree::didReceiveTitleForFrame(const String& title, WebCore::Frame } // ChromeClient delegates. -void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID) +void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNumber, const String&) { printf("CONSOLE MESSAGE: "); if (lineNumber) @@ -822,9 +877,9 @@ bool DumpRenderTree::shouldInsertText(const String& text, WebCore::Range* range, return m_acceptsEditing; } -void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request) +void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, WebCore::Frame* frame) { - if (!waitForPolicy) + if (testDone || !m_policyDelegateEnabled) return; const char* typeDescription; @@ -851,10 +906,34 @@ void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::Navigatio typeDescription = "illegal value"; } - printf("Policy delegate: attempt to load %s with navigation type '%s'\n", request.url().string().utf8().data(), typeDescription); - // FIXME: do originating part. + bool shouldWaitForResponse = !request.url().string().startsWith("mailto:"); + printf("Policy delegate: attempt to load %s with navigation type '%s'", request.url().string().utf8().data(), typeDescription); + // Originating part, borrowed from Chromium. + RefPtr<WebCore::Node> node; + for (const WebCore::Event* event = action.event(); event; event = event->underlyingEvent()) { + if (event->isMouseEvent()) { + const WebCore::MouseEvent* mouseEvent = static_cast<const WebCore::MouseEvent*>(event); + node = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false).innerNonSharedNode(); + break; + } + } + if (node.get()) + printf(" originating from %s\n", drtDumpPath(node.get()).utf8().data()); + else + printf("\n"); + + if (waitForPolicy && !shouldWaitForResponse) + gTestRunner->notifyDone(); +} - gTestRunner->notifyDone(); +void DumpRenderTree::didDecidePolicyForResponse(const WebCore::ResourceResponse& response) +{ + if (!testDone && m_policyDelegateEnabled) { + if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) + printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", response.suggestedFilename().utf8().data()); + if (waitForPolicy) + gTestRunner->notifyDone(); + } } void DumpRenderTree::didDispatchWillPerformClientRedirect() @@ -869,7 +948,7 @@ void DumpRenderTree::didHandleOnloadEventsForFrame(WebCore::Frame* frame) printf("%s - didHandleOnloadEventsForFrame\n", drtFrameDescription(frame).utf8().data()); } -void DumpRenderTree::didReceiveResponseForFrame(WebCore::Frame* frame, const WebCore::ResourceResponse& response) +void DumpRenderTree::didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse& response) { if (!testDone && gTestRunner->dumpResourceResponseMIMETypes()) printf("%s has MIME type %s\n", response.url().lastPathComponent().utf8().data(), response.mimeType().utf8().data()); @@ -889,6 +968,11 @@ bool DumpRenderTree::didReceiveAuthenticationChallenge(WebCore::Credential& cred return true; } +void DumpRenderTree::setCustomPolicyDelegate(bool setDelegate, bool permissive) +{ + m_policyDelegateEnabled = setDelegate; + m_policyDelegateIsPermissive = permissive; +} } } diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index daca112c9..6aa4a8a3d 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -63,6 +63,7 @@ public: bool loadFinished() const { return m_loadFinished; } // FrameLoaderClient delegates + bool willSendRequestForFrame(WebCore::Frame*, WebCore::ResourceRequest&, const WebCore::ResourceResponse&); void didStartProvisionalLoadForFrame(WebCore::Frame*); void didCommitLoadForFrame(WebCore::Frame*); void didFailProvisionalLoadForFrame(WebCore::Frame*); @@ -71,10 +72,13 @@ public: void didFinishDocumentLoadForFrame(WebCore::Frame*); void didClearWindowObjectInWorld(WebCore::DOMWrapperWorld*, JSGlobalContextRef, JSObjectRef windowObject); void didReceiveTitleForFrame(const String& title, WebCore::Frame*); - void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&); + void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::Frame*); + void didDecidePolicyForResponse(const WebCore::ResourceResponse&); void didDispatchWillPerformClientRedirect(); void didHandleOnloadEventsForFrame(WebCore::Frame*); void didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse&); + bool policyDelegateEnabled() const { return m_policyDelegateEnabled; } + bool policyDelegateIsPermissive() const { return m_policyDelegateIsPermissive; } // ChromeClient delegates void addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID); @@ -101,12 +105,11 @@ public: bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction); bool shouldInsertText(const String&, WebCore::Range*, int insertAction); - bool isSelectTrailingWhitespaceEnabled() const { return s_selectTrailingWhitespaceEnabled; } - void setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; } bool didReceiveAuthenticationChallenge(WebCore::Credential&); // BlackBerry::Platform::BlackBerryPlatformLayoutTestClient method virtual void addTest(const char* testFile); + void setCustomPolicyDelegate(bool setDelegate, bool permissive); private: void runTest(const String& url, const String& imageHash); void runTests(); @@ -146,7 +149,8 @@ private: bool m_acceptsEditing; bool m_loadFinished; - static bool s_selectTrailingWhitespaceEnabled; + bool m_policyDelegateEnabled; + bool m_policyDelegateIsPermissive; }; } } diff --git a/Tools/DumpRenderTree/blackberry/EventSender.cpp b/Tools/DumpRenderTree/blackberry/EventSender.cpp index 0f76914a2..7fafb9eb0 100644 --- a/Tools/DumpRenderTree/blackberry/EventSender.cpp +++ b/Tools/DumpRenderTree/blackberry/EventSender.cpp @@ -26,6 +26,7 @@ #include "DumpRenderTreeSupport.h" #include "IntPoint.h" #include "NotImplemented.h" +#include "WebKitThreadViewportAccessor.h" #include "WebPage.h" #include <BlackBerryPlatformKeyboardEvent.h> @@ -46,45 +47,62 @@ void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type); // Callbacks -static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +static bool setDragModeCallback(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +void setMouseEventDocumentPos(BlackBerry::Platform::MouseEvent &event, const BlackBerry::WebKit::WebPage* page) +{ + // We have added document viewport position and document content position as members of the mouse event, when we create the event, we should initialize them as well. + BlackBerry::Platform::ViewportAccessor* viewportAccessor = page->webkitThreadViewportAccessor(); + IntPoint documentContentPos = viewportAccessor->roundToDocumentFromPixelContents(BlackBerry::Platform::FloatPoint(viewportAccessor->pixelContentsFromViewport(lastMousePosition))); + IntPoint documentViewportMousePos = viewportAccessor->roundToDocumentFromPixelContents(BlackBerry::Platform::FloatPoint(lastMousePosition)); + event.populateDocumentPosition(documentViewportMousePos, documentContentPos); +} + +static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, 0, lastMousePosition, IntPoint::zero(), 0, 0)); + BlackBerry::Platform::MouseEvent event(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, 0, lastMousePosition, IntPoint::zero(), 0, 0, 0); + + setMouseEventDocumentPos(event, page); + + page->mouseEvent(event); return JSValueMakeUndefined(context); } -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - page->mouseEvent(BlackBerry::Platform::MouseEvent(0, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0)); + BlackBerry::Platform::MouseEvent event(0, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0); + + setMouseEventDocumentPos(event, page); + + page->mouseEvent(event); return JSValueMakeUndefined(context); } -static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 2) return JSValueMakeUndefined(context); @@ -96,32 +114,35 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function lastMousePosition = IntPoint(x, y); BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0)); + BlackBerry::Platform::MouseEvent event(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0); + setMouseEventDocumentPos(event, page); + + page->mouseEvent(event); return JSValueMakeUndefined(context); } -static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) return JSValueMakeUndefined(context); JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); ASSERT(!*exception); - short charCode = 0; + unsigned charCode = 0; bool needsShiftKeyModifier = false; if (JSStringIsEqualToUTF8CString(character, "leftArrow")) charCode = KEYCODE_LEFT; @@ -187,31 +208,31 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS return JSValueMakeUndefined(context); } -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 2) return JSValueMakeUndefined(context); @@ -221,19 +242,23 @@ static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef functi int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); ASSERT(!exception || !*exception); - BlackBerry::Platform::TouchPoint touch; - touch.m_id = touches.isEmpty() ? 0 : touches.last().m_id + 1; + int id = touches.isEmpty() ? 0 : touches.last().id() + 1; + + // pixelViewportPosition is unused in the WebKit layer, so use this for screen position IntPoint pos(x, y); - touch.m_pos = pos; - touch.m_screenPos = pos; - touch.m_state = BlackBerry::Platform::TouchPoint::TouchPressed; + + BlackBerry::Platform::TouchPoint touch(id, BlackBerry::Platform::TouchPoint::TouchPressed, pos, pos, 0); + + // Unfortunately we don't know the scroll position at this point, so use pos for the content position too. + // This assumes scroll position is 0,0 + touch.populateDocumentPosition(pos, pos); touches.append(touch); return JSValueMakeUndefined(context); } -static JSValueRef updateTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef updateTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 3) return JSValueMakeUndefined(context); @@ -249,21 +274,26 @@ static JSValueRef updateTouchPointCallback(JSContextRef context, JSObjectRef fun return JSValueMakeUndefined(context); BlackBerry::Platform::TouchPoint& touch = touches[index]; + + // pixelViewportPosition is unused in the WebKit layer IntPoint pos(x, y); - touch.m_pos = pos; - touch.m_screenPos = pos; - touch.m_state = BlackBerry::Platform::TouchPoint::TouchMoved; + + // Unfortunately we don't know the scroll position at this point, so use pos for the content position too. + // This assumes scroll position is 0,0 + touch.populateDocumentPosition(pos, pos); + touch.setScreenPosition(pos); + touch.updateState(BlackBerry::Platform::TouchPoint::TouchMoved); return JSValueMakeUndefined(context); } -static JSValueRef setTouchModifierCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef setTouchModifierCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { if (!touchActive) { sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchStart); @@ -273,22 +303,22 @@ static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef function, return JSValueMakeUndefined(context); } -static JSValueRef touchCancelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef touchCancelCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef touchMoveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef touchMoveCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove); return JSValueMakeUndefined(context); } -static JSValueRef touchEndCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef touchEndCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { for (unsigned i = 0; i < touches.size(); ++i) - if (touches[i].m_state != BlackBerry::Platform::TouchPoint::TouchReleased) { + if (touches[i].state() != BlackBerry::Platform::TouchPoint::TouchReleased) { sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove); return JSValueMakeUndefined(context); } @@ -297,20 +327,20 @@ static JSValueRef touchEndCallback(JSContextRef context, JSObjectRef function, J return JSValueMakeUndefined(context); } -static JSValueRef clearTouchPointsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef clearTouchPointsCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { touches.clear(); touchActive = false; return JSValueMakeUndefined(context); } -static JSValueRef cancelTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef cancelTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) { notImplemented(); return JSValueMakeUndefined(context); } -static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) return JSValueMakeUndefined(context); @@ -320,7 +350,7 @@ static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef fu if (index < 0 || index >= (int)touches.size()) return JSValueMakeUndefined(context); - touches[index].m_state = BlackBerry::Platform::TouchPoint::TouchReleased; + touches[index].updateState(BlackBerry::Platform::TouchPoint::TouchReleased); return JSValueMakeUndefined(context); } @@ -334,15 +364,15 @@ void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type type) Vector<BlackBerry::Platform::TouchPoint> t; for (Vector<BlackBerry::Platform::TouchPoint>::iterator it = touches.begin(); it != touches.end(); ++it) { - if (it->m_state != BlackBerry::Platform::TouchPoint::TouchReleased) { - it->m_state = BlackBerry::Platform::TouchPoint::TouchStationary; + if (it->state() != BlackBerry::Platform::TouchPoint::TouchReleased) { + it->updateState(BlackBerry::Platform::TouchPoint::TouchStationary); t.append(*it); } } touches = t; } -static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 3) return JSValueMakeUndefined(context); @@ -392,7 +422,7 @@ static JSStaticValue staticValues[] = { { 0, 0, 0, 0 } }; -static JSClassRef getClass(JSContextRef context) +static JSClassRef getClass(JSContextRef) { static JSClassRef eventSenderClass = 0; diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp index 5a1b89a4c..82b448d13 100644 --- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp @@ -32,9 +32,6 @@ #include "WebPageClient.h" #include <BlackBerryPlatformWindow.h> -#if USE(SKIA) -#include <SkDevice.h> -#endif #include <wtf/MD5.h> #include <wtf/Vector.h> @@ -62,31 +59,7 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool const Platform::IntSize& windowSize = window->viewportSize(); unsigned char* data = new unsigned char[windowSize.width() * windowSize.height() * 4]; - // 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); - -#if USE(SKIA) - SkBitmap bitmap; - bitmap.setConfig(SkBitmap::kARGB_8888_Config, windowSize.width(), windowSize.height()); - bitmap.allocPixels(); - bitmap.eraseARGB(0, 0, 0, 0); - - SkCanvas canvas(bitmap); - backingStore->drawContents(&canvas, windowRect, windowSize); - - // Read that SkBitmap rather than change it. So use false on accessBitmap. - const SkBitmap& contentsBitmap = canvas.getDevice()->accessBitmap(false/*changePixels*/); - contentsBitmap.lockPixels(); - - const unsigned char* windowPixels = 0; - if (!contentsBitmap.empty()) { - windowPixels = static_cast<const unsigned char*>(contentsBitmap.getPixels()); - if (windowPixels) - memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4); - } -#else - BlackBerry::Platform::Graphics::Buffer* buffer = BlackBerry::Platform::Graphics::createBuffer(windowSize, BlackBerry::Platform::Graphics::TemporaryBuffer); + BlackBerry::Platform::Graphics::Buffer* buffer = BlackBerry::Platform::Graphics::createBuffer(windowSize, BlackBerry::Platform::Graphics::AlwaysBacked); BlackBerry::Platform::Graphics::Drawable* drawable = BlackBerry::Platform::Graphics::lockBufferDrawable(buffer); if (drawable) { backingStore->drawContents(drawable, windowRect, windowSize); @@ -95,7 +68,6 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool BlackBerry::Platform::Graphics::releaseBufferDrawable(buffer); } BlackBerry::Platform::Graphics::destroyBuffer(buffer); -#endif return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height()); } diff --git a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp index f06f4a84c..04a215e75 100644 --- a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp @@ -42,7 +42,6 @@ #include "Settings.h" #include "WorkQueue.h" #include "WorkQueueItem.h" -#include "WorkerThread.h" #include <JavaScriptCore/APICast.h> #include <SharedPointer.h> @@ -50,7 +49,6 @@ #include <WebSettings.h> #include <wtf/OwnArrayPtr.h> -#include <wtf/UnusedParam.h> #include <wtf/text/CString.h> using WebCore::toElement; @@ -191,9 +189,7 @@ void TestRunner::setCacheModel(int) void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) { - UNUSED_PARAM(setDelegate); - UNUSED_PARAM(permissive); - notImplemented(); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->setCustomPolicyDelegate(setDelegate, permissive); } void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString*) @@ -263,17 +259,6 @@ void TestRunner::setXSSAuditorEnabled(bool flag) BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setXSSAuditorEnabled(flag); } -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->setSelectTrailingWhitespaceEnabled(flag); -} - -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - UNUSED_PARAM(flag); - notImplemented(); -} - void TestRunner::setTabKeyCyclesThroughElements(bool cycles) { if (!mainFrame) @@ -297,11 +282,12 @@ void TestRunner::setUserStyleSheetEnabled(bool flag) void TestRunner::setUserStyleSheetLocation(JSStringRef path) { String pathStr = jsStringRefToWebCoreString(path); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setUserStyleSheetLocation(pathStr.utf8().data()); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setUserStyleSheetLocation(pathStr); } void TestRunner::waitForPolicyDelegate() { + setCustomPolicyDelegate(true, true); setWaitToDump(true); waitForPolicy = true; } @@ -319,13 +305,6 @@ int TestRunner::windowCount() return 0; } -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - UNUSED_PARAM(id); - notImplemented(); - return false; -} - void TestRunner::setWaitToDump(bool waitToDump) { // Change from 30s to 35s because some test cases in multipart need 30 seconds, @@ -342,85 +321,11 @@ void TestRunner::setWindowIsKey(bool windowIsKey) notImplemented(); } -bool TestRunner::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 TestRunner::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 TestRunner::numberOfActiveAnimations() const -{ - if (!mainFrame) - return false; - - WebCore::AnimationController* animationController = mainFrame->animation(); - if (!animationController) - return false; - - return animationController->numberOfActiveAnimations(mainFrame->document()); -} - -unsigned TestRunner::workerThreadCount() const -{ -#if ENABLE_WORKERS - return WebCore::WorkerThread::workerThreadCount(); -#else - return 0; -#endif -} - void TestRunner::removeAllVisitedLinks() { notImplemented(); } -void TestRunner::disableImageLoading() -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setLoadsImagesAutomatically(false); -} - void TestRunner::overridePreference(JSStringRef key, JSStringRef value) { if (!mainFrame) @@ -439,6 +344,10 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) mainFrame->page()->settings()->setHyperlinkAuditingEnabled(valueStr == "true" || valueStr == "1"); else if (keyStr == "WebSocketsEnabled") BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setWebSocketsEnabled(valueStr == "true" || valueStr == "1"); + else if (keyStr == "WebKitDefaultTextEncodingName") + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setDefaultTextEncodingName(valueStr); + else if (keyStr == "WebKitDisplayImagesKey") + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setLoadsImagesAutomatically(valueStr == "true" || valueStr == "1"); } void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) @@ -447,15 +356,15 @@ void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) notImplemented(); } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { - DumpRenderTreeSupport::setMockGeolocationPosition(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), latitude, longitude, accuracy); + DumpRenderTreeSupport::setMockGeolocationPosition(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); } -void TestRunner::setMockGeolocationError(int code, JSStringRef message) +void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) { String messageStr = jsStringRefToWebCoreString(message); - DumpRenderTreeSupport::setMockGeolocationError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), code, messageStr); + DumpRenderTreeSupport::setMockGeolocationPositionUnavailableError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), messageStr); } void TestRunner::showWebInspector() @@ -514,7 +423,7 @@ void TestRunner::setWebViewEditable(bool) notImplemented(); } -void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) +void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) { notImplemented(); } @@ -525,12 +434,7 @@ bool TestRunner::callShouldCloseOnWebView() return false; } -void TestRunner::setFrameFlatteningEnabled(bool enable) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setFrameFlatteningEnabled(enable); -} - -void TestRunner::setSpatialNavigationEnabled(bool enable) +void TestRunner::setSpatialNavigationEnabled(bool) { notImplemented(); } @@ -567,7 +471,7 @@ void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) mainFrame->page()->settings()->setAllowUniversalAccessFromFileURLs(enabled); } -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef, JSStringRef) { notImplemented(); } @@ -582,28 +486,7 @@ void TestRunner::setJavaScriptCanAccessClipboard(bool flag) BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->setJavaScriptCanAccessClipboard(flag); } -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - return DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(context, value); -} - -JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const -{ - notImplemented(); - return 0; -} - -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - WebCore::Element* element = toElement(toJS(toJS(context), nodeObject)); - if (!element) - return 0; - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(WebCore::markerTextForListItem(element).utf8().data())); - return markerText; -} - -void TestRunner::setPluginsEnabled(bool flag) +void TestRunner::setPluginsEnabled(bool) { notImplemented(); } @@ -618,7 +501,7 @@ void TestRunner::clearAllApplicationCaches() notImplemented(); } -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) +void TestRunner::setApplicationCacheOriginQuota(unsigned long long) { notImplemented(); } @@ -628,7 +511,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo DumpRenderTreeSupport::setMockDeviceOrientation(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } -void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) +void TestRunner::addMockSpeechInputResult(JSStringRef, double, JSStringRef) { notImplemented(); } @@ -639,7 +522,7 @@ void TestRunner::setGeolocationPermission(bool allow) DumpRenderTreeSupport::setMockGeolocationPermission(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), allow); } -void TestRunner::setViewModeMediaFeature(const JSStringRef mode) +void TestRunner::setViewModeMediaFeature(const JSStringRef) { notImplemented(); } @@ -650,11 +533,6 @@ void TestRunner::setSerializeHTTPLoads(bool) notImplemented(); } -void TestRunner::setMinimumTimerInterval(double) -{ - notImplemented(); -} - void TestRunner::setTextDirection(JSStringRef) { notImplemented(); @@ -693,24 +571,6 @@ void TestRunner::deleteAllLocalStorage() notImplemented(); } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - notImplemented(); -} - -void TestRunner::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 TestRunner::numberOfPendingGeolocationPermissionRequests() { return DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()); @@ -757,12 +617,12 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe // Our layout tests assume find will wrap and highlight all matches. BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(), - !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */); + !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */, false /* selectActiveMatchOnClear */); return mainFrame->page()->findString(nameStr, options); } -void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) +void TestRunner::deleteLocalStorageForOrigin(JSStringRef) { // FIXME: Implement. } @@ -780,7 +640,7 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JS inputElement->setValueForUser(jsStringRefToWebCoreString(value)); } -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef origin) +long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef) { // FIXME: Implement to support getting disk usage by all application caches for an origin. return 0; @@ -806,11 +666,11 @@ void TestRunner::setMockSpeechInputDumpRect(bool) { } -void TestRunner::grantWebNotificationPermission(JSStringRef origin) +void TestRunner::grantWebNotificationPermission(JSStringRef) { } -void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) +void TestRunner::denyWebNotificationPermission(JSStringRef) { } @@ -818,11 +678,11 @@ void TestRunner::removeAllWebNotificationPermissions() { } -void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) +void TestRunner::simulateWebNotificationClick(JSValueRef) { } -void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) +void TestRunner::simulateLegacyWebNotificationClick(JSStringRef) { } @@ -841,18 +701,13 @@ void TestRunner::setAutomaticLinkDetectionEnabled(bool) notImplemented(); } -void TestRunner::sendWebIntentResponse(JSStringRef) -{ - notImplemented(); -} - -void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) +void TestRunner::setStorageDatabaseIdleInterval(double) { + // FIXME: Implement this. notImplemented(); } -void TestRunner::setStorageDatabaseIdleInterval(double) +void TestRunner::closeIdleLocalStorageDatabases() { - // FIXME: Implement this. notImplemented(); } diff --git a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp index 394e40832..827b5ebce 100644 --- a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp +++ b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp @@ -21,6 +21,7 @@ #include "DumpRenderTreeBlackBerry.h" #include "Frame.h" +#include "FrameLoadRequest.h" #include "KURL.h" #include "WebPage.h" #include <wtf/OwnArrayPtr.h> @@ -46,7 +47,7 @@ bool LoadItem::invoke() const return false; KURL kurl = KURL(KURL(), url.get()); - frame->loader()->load(kurl, false); + frame->loader()->load(FrameLoadRequest(frame, ResourceRequest(kurl))); return true; } @@ -61,7 +62,8 @@ bool LoadHTMLStringItem::invoke() const JSStringGetUTF8CString(m_content.get(), content.get(), contentSize); JSStringGetUTF8CString(m_baseURL.get(), baseURL.get(), baseURLSize); JSStringGetUTF8CString(m_unreachableURL.get(), unreachableURL.get(), unreachableURLSize); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : ""); + STATIC_LOCAL_STRING(s_textHtml, "text/html"); + BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(BlackBerry::Platform::String::fromUtf8(content.get()), BlackBerry::Platform::String::fromUtf8(baseURL.get()), s_textHtml, unreachableURLSize ? BlackBerry::Platform::String::fromUtf8(unreachableURL.get()) : BlackBerry::Platform::String::emptyString()); return true; } diff --git a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp index 1f7f172ab..43936d65d 100644 --- a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp +++ b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp @@ -26,17 +26,17 @@ #include "config.h" #include "WebArchiveDumpSupport.h" -#include <CoreFoundation/CoreFoundation.h> #include <CFNetwork/CFNetwork.h> +#include <CoreFoundation/CoreFoundation.h> #include <wtf/RetainPtr.h> extern "C" { -CFURLRef CFURLResponseGetURL(CFURLResponseRef response); -CFStringRef CFURLResponseGetMIMEType(CFURLResponseRef response); -CFStringRef CFURLResponseGetTextEncodingName(CFURLResponseRef response); -SInt64 CFURLResponseGetExpectedContentLength(CFURLResponseRef response); -CFHTTPMessageRef CFURLResponseGetHTTPResponse(CFURLResponseRef response); +CFURLRef CFURLResponseGetURL(CFURLResponseRef); +CFStringRef CFURLResponseGetMIMEType(CFURLResponseRef); +CFStringRef CFURLResponseGetTextEncodingName(CFURLResponseRef); +SInt64 CFURLResponseGetExpectedContentLength(CFURLResponseRef); +CFHTTPMessageRef CFURLResponseGetHTTPResponse(CFURLResponseRef); CFTypeID CFURLResponseGetTypeID(void); @@ -44,11 +44,6 @@ CFTypeID CFURLResponseGetTypeID(void); static void convertMIMEType(CFMutableStringRef mimeType) { -#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - // Workaround for <rdar://problem/5539824> on Leopard - if (CFStringCompare(mimeType, CFSTR("text/xml"), kCFCompareAnchored | kCFCompareCaseInsensitive) == kCFCompareEqualTo) - CFStringReplaceAll(mimeType, CFSTR("application/xml")); -#endif // Workaround for <rdar://problem/6234318> with Dashcode 2.0 if (CFStringCompare(mimeType, CFSTR("application/x-javascript"), kCFCompareAnchored | kCFCompareCaseInsensitive) == kCFCompareEqualTo) CFStringReplaceAll(mimeType, CFSTR("text/javascript")); @@ -70,7 +65,7 @@ static void convertWebResourceDataToString(CFMutableDictionaryRef resource) stringEncoding = kCFStringEncodingUTF8; CFDataRef data = static_cast<CFDataRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceData"))); - RetainPtr<CFStringRef> dataAsString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding)); + RetainPtr<CFStringRef> dataAsString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding)); if (dataAsString) CFDictionarySetValue(resource, CFSTR("WebResourceData"), dataAsString.get()); } @@ -109,17 +104,17 @@ static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef proper if (CFGetTypeID(responseData) != CFDataGetTypeID()) return; - RetainPtr<CFURLResponseRef> response(AdoptCF, createCFURLResponseFromResponseData(responseData)); + RetainPtr<CFURLResponseRef> response = adoptCF(createCFURLResponseFromResponseData(responseData)); if (!response) return; - RetainPtr<CFMutableDictionaryRef> responseDictionary(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + RetainPtr<CFMutableDictionaryRef> responseDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - RetainPtr<CFMutableStringRef> urlString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get())))); + RetainPtr<CFMutableStringRef> urlString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get())))); normalizeWebResourceURL(urlString.get()); CFDictionarySetValue(responseDictionary.get(), CFSTR("URL"), urlString.get()); - RetainPtr<CFMutableStringRef> mimeTypeString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get()))); + RetainPtr<CFMutableStringRef> mimeTypeString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get()))); convertMIMEType(mimeTypeString.get()); CFDictionarySetValue(responseDictionary.get(), CFSTR("MIMEType"), mimeTypeString.get()); @@ -128,17 +123,17 @@ static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef proper CFDictionarySetValue(responseDictionary.get(), CFSTR("textEncodingName"), textEncodingName); SInt64 expectedContentLength = CFURLResponseGetExpectedContentLength(response.get()); - RetainPtr<CFNumberRef> expectedContentLengthNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength)); + RetainPtr<CFNumberRef> expectedContentLengthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength)); CFDictionarySetValue(responseDictionary.get(), CFSTR("expectedContentLength"), expectedContentLengthNumber.get()); if (CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(response.get())) { - RetainPtr<CFDictionaryRef> allHeaders(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpMessage)); - RetainPtr<CFMutableDictionaryRef> allHeaderFields(AdoptCF, CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get())); + RetainPtr<CFDictionaryRef> allHeaders = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpMessage)); + RetainPtr<CFMutableDictionaryRef> allHeaderFields = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get())); normalizeHTTPResponseHeaderFields(allHeaderFields.get()); CFDictionarySetValue(responseDictionary.get(), CFSTR("allHeaderFields"), allHeaderFields.get()); CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(httpMessage); - RetainPtr<CFNumberRef> statusCodeNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode)); + RetainPtr<CFNumberRef> statusCodeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode)); CFDictionarySetValue(responseDictionary.get(), CFSTR("statusCode"), statusCodeNumber.get()); } @@ -149,7 +144,7 @@ static CFComparisonResult compareResourceURLs(const void *val1, const void *val2 { CFStringRef url1 = static_cast<CFStringRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(val1), CFSTR("WebResourceURL"))); CFStringRef url2 = static_cast<CFStringRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(val2), CFSTR("WebResourceURL"))); - + return CFStringCompare(url1, url2, kCFCompareAnchored); } @@ -157,16 +152,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) { CFErrorRef error = 0; CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - CFIndex bytesCount = CFDataGetLength(webArchiveData); - RetainPtr<CFReadStreamRef> readStream(AdoptCF, CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull)); - CFReadStreamOpen(readStream.get()); - RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateFromStream(kCFAllocatorDefault, readStream.get(), bytesCount, kCFPropertyListMutableContainersAndLeaves, &format, 0)); - CFReadStreamClose(readStream.get()); -#else - RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error)); -#endif + RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error)); if (!propertyList) { if (error) @@ -174,7 +160,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting data to property list."))); } - RetainPtr<CFMutableArrayRef> resources(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); + RetainPtr<CFMutableArrayRef> resources = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); CFArrayAppendValue(resources.get(), propertyList.get()); while (CFArrayGetCount(resources.get())) { @@ -207,12 +193,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) } error = 0; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get())); -#else - RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error)); -#endif + RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error)); if (!xmlData) { if (error) @@ -220,8 +201,8 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting property list to data."))); } - RetainPtr<CFStringRef> xmlString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8)); - RetainPtr<CFMutableStringRef> string(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get())); + RetainPtr<CFStringRef> xmlString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8)); + RetainPtr<CFMutableStringRef> string = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get())); // Replace "Apple Computer" with "Apple" in the DTD declaration. CFStringFindAndReplace(string.get(), CFSTR("-//Apple Computer//"), CFSTR("-//Apple//"), CFRangeMake(0, CFStringGetLength(string.get())), 0); diff --git a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp index 7fa5110bb..900f1ba15 100644 --- a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp +++ b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp @@ -75,7 +75,7 @@ static const CFStringRef kUTTypePNG = CFSTR("public.png"); static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining) { unsigned char buffer[2048]; - RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, bytesRemaining)); + RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining)); while (bytesRemaining > 0) { size_t bytesToRead = min(bytesRemaining, 2048); @@ -83,8 +83,8 @@ static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining) CFDataAppendBytes(data.get(), buffer, static_cast<CFIndex>(bytesRead)); bytesRemaining -= static_cast<int>(bytesRead); } - RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(data.get())); - return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateWithPNGDataProvider(dataProvider.get(), 0, false, kCGRenderingIntentDefault)); + RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get())); + return adoptCF(CGImageCreateWithPNGDataProvider(dataProvider.get(), 0, false, kCGRenderingIntentDefault)); } static void releaseMallocBuffer(void* info, const void* data, size_t size) @@ -100,12 +100,12 @@ static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImage // Draw base image in bitmap context void* baseBuffer = calloc(height, rowBytes); - RetainPtr<CGContextRef> baseContext(AdoptCF, CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, CGImageGetColorSpace(baseImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + RetainPtr<CGContextRef> baseContext = adoptCF(CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, CGImageGetColorSpace(baseImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); CGContextDrawImage(baseContext.get(), CGRectMake(0, 0, width, height), baseImage); // Draw test image in bitmap context void* buffer = calloc(height, rowBytes); - RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(buffer, width, height, 8, rowBytes, CGImageGetColorSpace(testImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(buffer, width, height, 8, rowBytes, CGImageGetColorSpace(testImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); CGContextDrawImage(context.get(), CGRectMake(0, 0, width, height), testImage); // Compare the content of the 2 bitmaps @@ -154,8 +154,8 @@ static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImage } static CGColorSpaceRef diffColorspace = CGColorSpaceCreateDeviceGray(); - RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer)); - diffImage.adoptCF(CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider.get(), 0, false, kCGRenderingIntentDefault)); + RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer)); + diffImage = adoptCF(CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider.get(), 0, false, kCGRenderingIntentDefault)); } else free(diffBuffer); @@ -242,8 +242,8 @@ int main(int argc, const char* argv[]) if (difference > 0.0f) { if (diffImage) { - RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0)); - RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0)); + RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0)); + RetainPtr<CGImageDestinationRef> imageDest = adoptCF(CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0)); CGImageDestinationAddImage(imageDest.get(), diffImage.get(), 0); CGImageDestinationFinalize(imageDest.get()); printf("Content-Length: %lu\n", CFDataGetLength(imageData.get())); diff --git a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp b/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp index bf59b03ec..3168d20a5 100644 --- a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp +++ b/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp @@ -57,8 +57,8 @@ static const CFStringRef kUTTypePNG = CFSTR("public.png"); static void printPNG(CGImageRef image, const char* checksum) { - RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0)); - RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0)); + RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0)); + RetainPtr<CGImageDestinationRef> imageDest = adoptCF(CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0)); CGImageDestinationAddImage(imageDest.get(), image, 0); CGImageDestinationFinalize(imageDest.get()); @@ -108,6 +108,6 @@ void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashStrin void dumpBitmap(BitmapContext* context, const char* checksum) { - RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(context->cgContext())); + RetainPtr<CGImageRef> image = adoptCF(CGBitmapContextCreateImage(context->cgContext())); printPNG(image.get(), checksum); } diff --git a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.h b/Tools/DumpRenderTree/cg/PixelDumpSupportCG.h index f0c974631..353a6b605 100644 --- a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.h +++ b/Tools/DumpRenderTree/cg/PixelDumpSupportCG.h @@ -70,7 +70,7 @@ private: BitmapContext(PlatformBitmapBuffer buffer, CGContextRef context) : m_buffer(buffer) - , m_context(AdoptCF, context) + , m_context(adoptCF(context)) { } diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp deleted file mode 100644 index eb21b2c85..000000000 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DRTDevToolsAgent.h" - -#include "DRTDevToolsClient.h" - -#include "Task.h" -#include "platform/WebCString.h" -#include "WebDevToolsAgent.h" -#include "WebView.h" -#include "webkit/support/webkit_support.h" - -using namespace WebKit; -using namespace WebTestRunner; - -DRTDevToolsAgent::DRTDevToolsAgent() - : m_drtDevToolsClient(0) - , m_webView(0) -{ - static int devToolsAgentCounter = 0; - - m_routingID = ++devToolsAgentCounter; -} - -void DRTDevToolsAgent::reset() -{ - m_taskList.revokeAll(); -} - -void DRTDevToolsAgent::setWebView(WebView* webView) -{ - m_webView = webView; -} - -void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebString& data) -{ - if (m_drtDevToolsClient) - m_drtDevToolsClient->asyncCall(data); -} - -void DRTDevToolsAgent::runtimePropertyChanged(const WebString& name, const WebString& value) -{ - // FIXME: Implement. -} - -WebDevToolsAgentClient::WebKitClientMessageLoop* DRTDevToolsAgent::createClientMessageLoop() -{ - return webkit_support::CreateDevToolsMessageLoop(); -} - -void DRTDevToolsAgent::asyncCall(const WebString& args) -{ - postTask(new AsyncCallTask(this, args)); -} - -void DRTDevToolsAgent::call(const WebString& args) -{ - WebDevToolsAgent* agent = webDevToolsAgent(); - if (agent) - agent->dispatchOnInspectorBackend(args); -} - -WebDevToolsAgent* DRTDevToolsAgent::webDevToolsAgent() -{ - if (!m_webView) - return 0; - return m_webView->devToolsAgent(); -} - -void DRTDevToolsAgent::attach(DRTDevToolsClient* client) -{ - ASSERT(!m_drtDevToolsClient); - m_drtDevToolsClient = client; - WebDevToolsAgent* agent = webDevToolsAgent(); - if (agent) - agent->attach(); -} - -void DRTDevToolsAgent::detach() -{ - ASSERT(m_drtDevToolsClient); - WebDevToolsAgent* agent = webDevToolsAgent(); - if (agent) - agent->detach(); - m_drtDevToolsClient = 0; -} - -bool DRTDevToolsAgent::evaluateInWebInspector(long callID, const std::string& script) -{ - WebDevToolsAgent* agent = webDevToolsAgent(); - if (!agent) - return false; - agent->evaluateInWebInspector(callID, WebString::fromUTF8(script)); - return true; -} diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h deleted file mode 100644 index c13aef7fa..000000000 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DRTDevToolsAgent_h -#define DRTDevToolsAgent_h - -#include "WebDevToolsAgentClient.h" -#include "WebTask.h" -#include "platform/WebString.h" -#include <wtf/HashMap.h> -#include <wtf/Noncopyable.h> - -namespace WebKit { - -class WebCString; -class WebDevToolsAgent; -class WebView; -struct WebDevToolsMessageData; - -} // namespace WebKit - -class DRTDevToolsClient; - -class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient { - WTF_MAKE_NONCOPYABLE(DRTDevToolsAgent); -public: - DRTDevToolsAgent(); - virtual ~DRTDevToolsAgent() { } - void reset(); - - void setWebView(WebKit::WebView*); - - // WebDevToolsAgentClient implementation. - virtual void sendMessageToInspectorFrontend(const WebKit::WebString&); - virtual int hostIdentifier() { return m_routingID; } - virtual void runtimePropertyChanged(const WebKit::WebString& name, const WebKit::WebString& value); - virtual WebKitClientMessageLoop* createClientMessageLoop(); - - void asyncCall(const WebKit::WebString& args); - - void attach(DRTDevToolsClient*); - void detach(); - - bool evaluateInWebInspector(long callID, const std::string& script); - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - -private: - void call(const WebKit::WebString& args); - WebKit::WebDevToolsAgent* webDevToolsAgent(); - - class AsyncCallTask: public WebTestRunner::WebMethodTask<DRTDevToolsAgent> { - public: - AsyncCallTask(DRTDevToolsAgent* object, const WebKit::WebString& args) - : WebTestRunner::WebMethodTask<DRTDevToolsAgent>(object), m_args(args) { } - virtual void runIfValid() { m_object->call(m_args); } - - private: - WebKit::WebString m_args; - }; - - WebTestRunner::WebTaskList m_taskList; - DRTDevToolsClient* m_drtDevToolsClient; - int m_routingID; - WebKit::WebView* m_webView; -}; - -#endif // DRTDevToolsAgent_h diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp deleted file mode 100644 index 08df1d52a..000000000 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DRTDevToolsClient.h" - -#include "DRTDevToolsAgent.h" -#include "Task.h" -#include "WebDevToolsAgent.h" -#include "WebDevToolsFrontend.h" -#include "WebFrame.h" -#include "WebScriptSource.h" -#include "WebView.h" -#include "webkit/support/webkit_support.h" -#include <wtf/PassOwnPtr.h> - -using namespace WebKit; -using namespace WebTestRunner; - -DRTDevToolsClient::DRTDevToolsClient(DRTDevToolsAgent* agent, WebView* webView) - : m_webView(webView) - , m_drtDevToolsAgent(agent) -{ - m_webDevToolsFrontend = adoptPtr(WebDevToolsFrontend::create(m_webView, this, WebString::fromUTF8("en-US"))); - m_drtDevToolsAgent->attach(this); -} - -DRTDevToolsClient::~DRTDevToolsClient() -{ - // There is a chance that the page will be destroyed at detach step of - // m_drtDevToolsAgent and we should clean pending requests a bit earlier. - m_taskList.revokeAll(); - if (m_drtDevToolsAgent) - m_drtDevToolsAgent->detach(); -} - -void DRTDevToolsClient::reset() -{ - m_taskList.revokeAll(); -} - -void DRTDevToolsClient::sendMessageToBackend(const WebString& data) -{ - if (m_drtDevToolsAgent) - m_drtDevToolsAgent->asyncCall(data); -} - -void DRTDevToolsClient::activateWindow() -{ - // Not implemented. -} - -void DRTDevToolsClient::closeWindow() -{ - // Not implemented. -} - -void DRTDevToolsClient::dockWindow() -{ - // Not implemented. -} - -void DRTDevToolsClient::undockWindow() -{ - // Not implemented. -} - -void DRTDevToolsClient::asyncCall(const WebString& args) -{ - postTask(new AsyncCallTask(this, args)); -} - -void DRTDevToolsClient::call(const WebString& args) -{ - m_webDevToolsFrontend->dispatchOnInspectorFrontend(args); -} - diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h deleted file mode 100644 index 5f486ddd0..000000000 --- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DRTDevToolsClient_h -#define DRTDevToolsClient_h - -#include "WebDevToolsFrontendClient.h" -#include "WebTask.h" -#include "platform/WebString.h" -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> -namespace WebKit { - -class WebDevToolsFrontend; -struct WebDevToolsMessageData; -class WebView; - -} // namespace WebKit - -class DRTDevToolsAgent; - -class DRTDevToolsClient : public WebKit::WebDevToolsFrontendClient { - WTF_MAKE_NONCOPYABLE(DRTDevToolsClient); -public: - DRTDevToolsClient(DRTDevToolsAgent*, WebKit::WebView*); - virtual ~DRTDevToolsClient(); - void reset(); - - // WebDevToolsFrontendClient implementation - virtual void sendMessageToBackend(const WebKit::WebString&); - - virtual void activateWindow(); - virtual void closeWindow(); - virtual void dockWindow(); - virtual void undockWindow(); - - void asyncCall(const WebKit::WebString& args); - - void allMessagesProcessed(); - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - - private: - void call(const WebKit::WebString& args); - class AsyncCallTask: public WebTestRunner::WebMethodTask<DRTDevToolsClient> { - public: - AsyncCallTask(DRTDevToolsClient* object, const WebKit::WebString& args) - : WebTestRunner::WebMethodTask<DRTDevToolsClient>(object), m_args(args) { } - virtual void runIfValid() { m_object->call(m_args); } - - private: - WebKit::WebString m_args; - }; - - WebTestRunner::WebTaskList m_taskList; - WebKit::WebView* m_webView; - DRTDevToolsAgent* m_drtDevToolsAgent; - WTF::OwnPtr<WebKit::WebDevToolsFrontend> m_webDevToolsFrontend; -}; - -#endif // DRTDevToolsClient_h diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp deleted file mode 100644 index e2255c793..000000000 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp +++ /dev/null @@ -1,1405 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) - * Copyright (C) 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DRTTestRunner.h" - -#include "DRTDevToolsAgent.h" -#include "MockWebSpeechInputController.h" -#include "MockWebSpeechRecognizer.h" -#include "Task.h" -#include "TestShell.h" -#include "WebAnimationController.h" -#include "WebBindings.h" -#include "WebConsoleMessage.h" -#include "WebDeviceOrientation.h" -#include "WebDeviceOrientationClientMock.h" -#include "WebDocument.h" -#include "WebElement.h" -#include "WebFindOptions.h" -#include "WebFrame.h" -#include "WebGeolocationClientMock.h" -#include "WebIDBFactory.h" -#include "WebInputElement.h" -#include "WebIntent.h" -#include "WebIntentRequest.h" -#include "WebKit.h" -#include "WebNotificationPresenter.h" -#include "WebPermissions.h" -#include "WebPrintParams.h" -#include "WebScriptSource.h" -#include "WebSecurityPolicy.h" -#include "WebSettings.h" -#include "WebSurroundingText.h" -#include "WebView.h" -#include "WebViewHost.h" -#include "WebWorkerInfo.h" -#include "platform/WebData.h" -#include "platform/WebSerializedScriptValue.h" -#include "platform/WebSize.h" -#include "platform/WebURL.h" -#include "v8/include/v8.h" -#include "webkit/support/webkit_support.h" -#include <algorithm> -#include <cctype> -#include <clocale> -#include <cstdlib> -#include <limits> -#include <sstream> -#include <wtf/OwnArrayPtr.h> -#include <wtf/text/WTFString.h> - -#if OS(LINUX) || OS(ANDROID) -#include "linux/WebFontRendering.h" -#endif - -using namespace WebCore; -using namespace WebKit; -using namespace WebTestRunner; -using namespace std; - -class EmptyWebDeliveredIntentClient : public WebKit::WebDeliveredIntentClient { -public: - EmptyWebDeliveredIntentClient() { } - ~EmptyWebDeliveredIntentClient() { } - - virtual void postResult(const WebSerializedScriptValue& data) const { } - virtual void postFailure(const WebSerializedScriptValue& data) const { } - virtual void destroy() { } -}; - -DRTTestRunner::DRTTestRunner(TestShell* shell) - : m_shell(shell) - , m_closeRemainingWindows(false) - , m_deferMainResourceDataLoad(false) - , m_showDebugLayerTree(false) - , m_workQueue(this) - , m_intentClient(adoptPtr(new EmptyWebDeliveredIntentClient)) - , m_shouldStayOnPageAfterHandlingBeforeUnload(false) -{ - - // Initialize the map that associates methods of this class with the names - // they will use when called by JavaScript. The actual binding of those - // names to their methods will be done by calling bindToJavaScript() (defined - // by CppBoundClass, the parent to DRTTestRunner). -#if ENABLE(INPUT_SPEECH) - bindMethod("addMockSpeechInputResult", &DRTTestRunner::addMockSpeechInputResult); - bindMethod("setMockSpeechInputDumpRect", &DRTTestRunner::setMockSpeechInputDumpRect); -#endif -#if ENABLE(SCRIPTED_SPEECH) - bindMethod("addMockSpeechRecognitionResult", &DRTTestRunner::addMockSpeechRecognitionResult); - bindMethod("setMockSpeechRecognitionError", &DRTTestRunner::setMockSpeechRecognitionError); - bindMethod("wasMockSpeechRecognitionAborted", &DRTTestRunner::wasMockSpeechRecognitionAborted); -#endif - bindMethod("clearAllDatabases", &DRTTestRunner::clearAllDatabases); - bindMethod("closeWebInspector", &DRTTestRunner::closeWebInspector); -#if ENABLE(POINTER_LOCK) - bindMethod("didAcquirePointerLock", &DRTTestRunner::didAcquirePointerLock); - bindMethod("didLosePointerLock", &DRTTestRunner::didLosePointerLock); - bindMethod("didNotAcquirePointerLock", &DRTTestRunner::didNotAcquirePointerLock); -#endif - bindMethod("disableAutoResizeMode", &DRTTestRunner::disableAutoResizeMode); - bindMethod("display", &DRTTestRunner::display); - bindMethod("displayInvalidatedRegion", &DRTTestRunner::displayInvalidatedRegion); - bindMethod("dumpAsText", &DRTTestRunner::dumpAsText); - bindMethod("dumpBackForwardList", &DRTTestRunner::dumpBackForwardList); - bindMethod("dumpChildFramesAsText", &DRTTestRunner::dumpChildFramesAsText); - bindMethod("dumpChildFrameScrollPositions", &DRTTestRunner::dumpChildFrameScrollPositions); - bindMethod("dumpEditingCallbacks", &DRTTestRunner::dumpEditingCallbacks); - bindMethod("dumpFrameLoadCallbacks", &DRTTestRunner::dumpFrameLoadCallbacks); - bindMethod("dumpProgressFinishedCallback", &DRTTestRunner::dumpProgressFinishedCallback); - bindMethod("dumpUserGestureInFrameLoadCallbacks", &DRTTestRunner::dumpUserGestureInFrameLoadCallbacks); - bindMethod("dumpResourceLoadCallbacks", &DRTTestRunner::dumpResourceLoadCallbacks); - bindMethod("dumpResourceRequestCallbacks", &DRTTestRunner::dumpResourceRequestCallbacks); - bindMethod("dumpResourceResponseMIMETypes", &DRTTestRunner::dumpResourceResponseMIMETypes); - bindMethod("dumpSelectionRect", &DRTTestRunner::dumpSelectionRect); - bindMethod("dumpStatusCallbacks", &DRTTestRunner::dumpWindowStatusChanges); - bindMethod("dumpTitleChanges", &DRTTestRunner::dumpTitleChanges); - bindMethod("dumpPermissionClientCallbacks", &DRTTestRunner::dumpPermissionClientCallbacks); - bindMethod("dumpCreateView", &DRTTestRunner::dumpCreateView); - bindMethod("enableAutoResizeMode", &DRTTestRunner::enableAutoResizeMode); - bindMethod("evaluateInWebInspector", &DRTTestRunner::evaluateInWebInspector); -#if ENABLE(NOTIFICATIONS) - bindMethod("grantWebNotificationPermission", &DRTTestRunner::grantWebNotificationPermission); -#endif - bindMethod("notifyDone", &DRTTestRunner::notifyDone); - bindMethod("numberOfPendingGeolocationPermissionRequests", &DRTTestRunner:: numberOfPendingGeolocationPermissionRequests); - bindMethod("overridePreference", &DRTTestRunner::overridePreference); - bindMethod("pathToLocalResource", &DRTTestRunner::pathToLocalResource); - bindMethod("queueBackNavigation", &DRTTestRunner::queueBackNavigation); - bindMethod("queueForwardNavigation", &DRTTestRunner::queueForwardNavigation); - bindMethod("queueLoadingScript", &DRTTestRunner::queueLoadingScript); - bindMethod("queueLoad", &DRTTestRunner::queueLoad); - bindMethod("queueLoadHTMLString", &DRTTestRunner::queueLoadHTMLString); - bindMethod("queueNonLoadingScript", &DRTTestRunner::queueNonLoadingScript); - bindMethod("queueReload", &DRTTestRunner::queueReload); - bindMethod("repaintSweepHorizontally", &DRTTestRunner::repaintSweepHorizontally); - bindMethod("setAllowDisplayOfInsecureContent", &DRTTestRunner::setAllowDisplayOfInsecureContent); - bindMethod("setAllowFileAccessFromFileURLs", &DRTTestRunner::setAllowFileAccessFromFileURLs); - bindMethod("setAllowRunningOfInsecureContent", &DRTTestRunner::setAllowRunningOfInsecureContent); - bindMethod("setAllowUniversalAccessFromFileURLs", &DRTTestRunner::setAllowUniversalAccessFromFileURLs); - bindMethod("setAlwaysAcceptCookies", &DRTTestRunner::setAlwaysAcceptCookies); - bindMethod("setAuthorAndUserStylesEnabled", &DRTTestRunner::setAuthorAndUserStylesEnabled); - bindMethod("setCanOpenWindows", &DRTTestRunner::setCanOpenWindows); - bindMethod("setCloseRemainingWindowsWhenComplete", &DRTTestRunner::setCloseRemainingWindowsWhenComplete); - bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate); - bindMethod("setDatabaseQuota", &DRTTestRunner::setDatabaseQuota); - bindMethod("setDeferMainResourceDataLoad", &DRTTestRunner::setDeferMainResourceDataLoad); - bindMethod("setAudioData", &DRTTestRunner::setAudioData); - bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission); - bindMethod("setJavaScriptCanAccessClipboard", &DRTTestRunner::setJavaScriptCanAccessClipboard); - bindMethod("setMockDeviceOrientation", &DRTTestRunner::setMockDeviceOrientation); - bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError); - bindMethod("setMockGeolocationPosition", &DRTTestRunner::setMockGeolocationPosition); - bindMethod("setPluginsEnabled", &DRTTestRunner::setPluginsEnabled); -#if ENABLE(POINTER_LOCK) - bindMethod("setPointerLockWillRespondAsynchronously", &DRTTestRunner::setPointerLockWillRespondAsynchronously); - bindMethod("setPointerLockWillFailSynchronously", &DRTTestRunner::setPointerLockWillFailSynchronously); -#endif - bindMethod("setPopupBlockingEnabled", &DRTTestRunner::setPopupBlockingEnabled); - bindMethod("setPOSIXLocale", &DRTTestRunner::setPOSIXLocale); - bindMethod("setPrinting", &DRTTestRunner::setPrinting); - bindMethod("setSelectTrailingWhitespaceEnabled", &DRTTestRunner::setSelectTrailingWhitespaceEnabled); - bindMethod("setBackingScaleFactor", &DRTTestRunner::setBackingScaleFactor); - bindMethod("setSmartInsertDeleteEnabled", &DRTTestRunner::setSmartInsertDeleteEnabled); - bindMethod("setStopProvisionalFrameLoads", &DRTTestRunner::setStopProvisionalFrameLoads); - bindMethod("setUserStyleSheetEnabled", &DRTTestRunner::setUserStyleSheetEnabled); - bindMethod("setUserStyleSheetLocation", &DRTTestRunner::setUserStyleSheetLocation); - bindMethod("setWillSendRequestClearHeader", &DRTTestRunner::setWillSendRequestClearHeader); - bindMethod("setWillSendRequestReturnsNull", &DRTTestRunner::setWillSendRequestReturnsNull); - bindMethod("setWillSendRequestReturnsNullOnRedirect", &DRTTestRunner::setWillSendRequestReturnsNullOnRedirect); - bindMethod("setWindowIsKey", &DRTTestRunner::setWindowIsKey); - bindMethod("setXSSAuditorEnabled", &DRTTestRunner::setXSSAuditorEnabled); - bindMethod("showWebInspector", &DRTTestRunner::showWebInspector); -#if ENABLE(NOTIFICATIONS) - bindMethod("simulateLegacyWebNotificationClick", &DRTTestRunner::simulateLegacyWebNotificationClick); -#endif - bindMethod("testRepaint", &DRTTestRunner::testRepaint); - bindMethod("waitForPolicyDelegate", &DRTTestRunner::waitForPolicyDelegate); - bindMethod("waitUntilDone", &DRTTestRunner::waitUntilDone); - bindMethod("windowCount", &DRTTestRunner::windowCount); - bindMethod("setImagesAllowed", &DRTTestRunner::setImagesAllowed); - bindMethod("setScriptsAllowed", &DRTTestRunner::setScriptsAllowed); - bindMethod("setStorageAllowed", &DRTTestRunner::setStorageAllowed); - bindMethod("setPluginsAllowed", &DRTTestRunner::setPluginsAllowed); - - bindMethod("setShouldStayOnPageAfterHandlingBeforeUnload", &DRTTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload); - - // Shared properties. - // webHistoryItemCount is used by tests in LayoutTests\http\tests\history - bindProperty("webHistoryItemCount", &m_webHistoryItemCount); - bindProperty("titleTextDirection", &m_titleTextDirection); - bindProperty("interceptPostMessage", &m_interceptPostMessage); - bindMethod("sendWebIntentResponse", &DRTTestRunner::sendWebIntentResponse); - bindMethod("deliverWebIntent", &DRTTestRunner::deliverWebIntent); -} - -DRTTestRunner::~DRTTestRunner() -{ -} - -DRTTestRunner::WorkQueue::~WorkQueue() -{ - reset(); -} - -void DRTTestRunner::WorkQueue::processWorkSoon() -{ - if (m_controller->m_shell->webViewHost()->topLoadingFrame()) - return; - - if (!m_queue.isEmpty()) { - // We delay processing queued work to avoid recursion problems. - postTask(new WorkQueueTask(this)); - } else if (!m_controller->m_waitUntilDone) - m_controller->m_shell->testFinished(); -} - -void DRTTestRunner::WorkQueue::processWork() -{ - TestShell* shell = m_controller->m_shell; - // Quit doing work once a load is in progress. - while (!m_queue.isEmpty()) { - bool startedLoad = m_queue.first()->run(shell); - delete m_queue.takeFirst(); - if (startedLoad) - return; - } - - if (!m_controller->m_waitUntilDone && !shell->webViewHost()->topLoadingFrame()) - shell->testFinished(); -} - -void DRTTestRunner::WorkQueue::reset() -{ - m_frozen = false; - while (!m_queue.isEmpty()) - delete m_queue.takeFirst(); -} - -void DRTTestRunner::WorkQueue::addWork(WorkItem* work) -{ - if (m_frozen) { - delete work; - return; - } - m_queue.append(work); -} - -void DRTTestRunner::dumpAsText(const CppArgumentList& arguments, CppVariant* result) -{ - m_dumpAsText = true; - m_generatePixelResults = false; - - // Optional paramater, describing whether it's allowed to dump pixel results in dumpAsText mode. - if (arguments.size() > 0 && arguments[0].isBool()) - m_generatePixelResults = arguments[0].value.boolValue; - - result->setNull(); -} - -void DRTTestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpEditingCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpBackForwardList(const CppArgumentList&, CppVariant* result) -{ - m_dumpBackForwardList = true; - result->setNull(); -} - -void DRTTestRunner::dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpFrameLoadCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpProgressFinishedCallback(const CppArgumentList&, CppVariant* result) -{ - m_dumpProgressFinishedCallback = true; - result->setNull(); -} - -void DRTTestRunner::dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpUserGestureInFrameLoadCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpResourceLoadCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpResourceRequestCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant* result) -{ - m_dumpResourceResponseMIMETypes = true; - result->setNull(); -} - -void DRTTestRunner::dumpChildFrameScrollPositions(const CppArgumentList&, CppVariant* result) -{ - m_dumpChildFrameScrollPositions = true; - result->setNull(); -} - -void DRTTestRunner::dumpChildFramesAsText(const CppArgumentList&, CppVariant* result) -{ - m_dumpChildFramesAsText = true; - result->setNull(); -} - -void DRTTestRunner::dumpWindowStatusChanges(const CppArgumentList&, CppVariant* result) -{ - m_dumpWindowStatusChanges = true; - result->setNull(); -} - -void DRTTestRunner::dumpTitleChanges(const CppArgumentList&, CppVariant* result) -{ - m_dumpTitleChanges = true; - result->setNull(); -} - -void DRTTestRunner::dumpPermissionClientCallbacks(const CppArgumentList&, CppVariant* result) -{ - m_dumpPermissionClientCallbacks = true; - result->setNull(); -} - -void DRTTestRunner::dumpCreateView(const CppArgumentList&, CppVariant* result) -{ - m_dumpCreateView = true; - result->setNull(); -} - -void DRTTestRunner::waitUntilDone(const CppArgumentList&, CppVariant* result) -{ - if (!webkit_support::BeingDebugged()) - postDelayedTask(new NotifyDoneTimedOutTask(this), m_shell->layoutTestTimeout()); - m_waitUntilDone = true; - result->setNull(); -} - -void DRTTestRunner::notifyDone(const CppArgumentList&, CppVariant* result) -{ - // Test didn't timeout. Kill the timeout timer. - m_taskList.revokeAll(); - - completeNotifyDone(false); - result->setNull(); -} - -void DRTTestRunner::completeNotifyDone(bool isTimeout) -{ - if (m_waitUntilDone && !m_shell->webViewHost()->topLoadingFrame() && m_workQueue.isEmpty()) { - if (isTimeout) - m_shell->testTimedOut(); - else - m_shell->testFinished(); - } - m_waitUntilDone = false; -} - -class WorkItemBackForward : public DRTTestRunner::WorkItem { -public: - WorkItemBackForward(int distance) : m_distance(distance) { } - bool run(TestShell* shell) - { - shell->goToOffset(m_distance); - return true; // FIXME: Did it really start a navigation? - } - -private: - int m_distance; -}; - -void DRTTestRunner::queueBackNavigation(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isNumber()) - m_workQueue.addWork(new WorkItemBackForward(-arguments[0].toInt32())); - result->setNull(); -} - -void DRTTestRunner::queueForwardNavigation(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isNumber()) - m_workQueue.addWork(new WorkItemBackForward(arguments[0].toInt32())); - result->setNull(); -} - -class WorkItemReload : public DRTTestRunner::WorkItem { -public: - bool run(TestShell* shell) - { - shell->reload(); - return true; - } -}; - -void DRTTestRunner::queueReload(const CppArgumentList&, CppVariant* result) -{ - m_workQueue.addWork(new WorkItemReload); - result->setNull(); -} - -class WorkItemLoadingScript : public DRTTestRunner::WorkItem { -public: - WorkItemLoadingScript(const string& script) : m_script(script) { } - bool run(TestShell* shell) - { - shell->webView()->mainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(m_script))); - return true; // FIXME: Did it really start a navigation? - } - -private: - string m_script; -}; - -class WorkItemNonLoadingScript : public DRTTestRunner::WorkItem { -public: - WorkItemNonLoadingScript(const string& script) : m_script(script) { } - bool run(TestShell* shell) - { - shell->webView()->mainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(m_script))); - return false; - } - -private: - string m_script; -}; - -void DRTTestRunner::queueLoadingScript(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) - m_workQueue.addWork(new WorkItemLoadingScript(arguments[0].toString())); - result->setNull(); -} - -void DRTTestRunner::queueNonLoadingScript(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) - m_workQueue.addWork(new WorkItemNonLoadingScript(arguments[0].toString())); - result->setNull(); -} - -class WorkItemLoad : public DRTTestRunner::WorkItem { -public: - WorkItemLoad(const WebURL& url, const WebString& target) - : m_url(url) - , m_target(target) { } - bool run(TestShell* shell) - { - shell->webViewHost()->loadURLForFrame(m_url, m_target); - return true; // FIXME: Did it really start a navigation? - } - -private: - WebURL m_url; - WebString m_target; -}; - -void DRTTestRunner::queueLoad(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) { - // FIXME: Implement WebURL::resolve() and avoid GURL. - GURL currentURL = m_shell->webView()->mainFrame()->document().url(); - GURL fullURL = currentURL.Resolve(arguments[0].toString()); - - string target = ""; - if (arguments.size() > 1 && arguments[1].isString()) - target = arguments[1].toString(); - - m_workQueue.addWork(new WorkItemLoad(fullURL, WebString::fromUTF8(target))); - } - result->setNull(); -} - -class WorkItemLoadHTMLString : public DRTTestRunner::WorkItem { -public: - WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL) - : m_html(html) - , m_baseURL(baseURL) { } - WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL, const WebURL& unreachableURL) - : m_html(html) - , m_baseURL(baseURL) - , m_unreachableURL(unreachableURL) { } - bool run(TestShell* shell) - { - shell->webView()->mainFrame()->loadHTMLString( - WebKit::WebData(m_html.data(), m_html.length()), m_baseURL, m_unreachableURL); - return true; - } - -private: - std::string m_html; - WebURL m_baseURL; - WebURL m_unreachableURL; -}; - -void DRTTestRunner::queueLoadHTMLString(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) { - string html = arguments[0].toString(); - WebURL baseURL(GURL("")); - if (arguments.size() > 1 && arguments[1].isString()) - baseURL = WebURL(GURL(arguments[1].toString())); - if (arguments.size() > 2 && arguments[2].isString()) - m_workQueue.addWork(new WorkItemLoadHTMLString(html, baseURL, WebURL(GURL(arguments[2].toString())))); - else - m_workQueue.addWork(new WorkItemLoadHTMLString(html, baseURL)); - } - result->setNull(); -} - -void DRTTestRunner::reset() -{ - TestRunner::reset(); - if (m_shell) - m_shell->webViewHost()->setDeviceScaleFactor(1); - m_dumpAsText = false; - m_dumpAsAudio = false; - m_dumpCreateView = false; - m_dumpEditingCallbacks = false; - m_dumpFrameLoadCallbacks = false; - m_dumpProgressFinishedCallback = false; - m_dumpUserGestureInFrameLoadCallbacks = false; - m_dumpResourceLoadCallbacks = false; - m_dumpResourceRequestCallbacks = false; - m_dumpResourceResponseMIMETypes = false; - m_dumpBackForwardList = false; - m_dumpChildFrameScrollPositions = false; - m_dumpChildFramesAsText = false; - m_dumpWindowStatusChanges = false; - m_dumpSelectionRect = false; - m_dumpTitleChanges = false; - m_dumpPermissionClientCallbacks = false; - m_generatePixelResults = true; - m_waitUntilDone = false; - m_canOpenWindows = false; - m_testRepaint = false; - m_sweepHorizontally = false; - m_stopProvisionalFrameLoads = false; - m_deferMainResourceDataLoad = true; - m_webHistoryItemCount.set(0); - m_titleTextDirection.set("ltr"); - m_interceptPostMessage.set(false); - m_userStyleSheetLocation = WebURL(); - m_isPrinting = false; - - webkit_support::SetAcceptAllCookies(false); - - // Reset the default quota for each origin to 5MB - webkit_support::SetDatabaseQuota(5 * 1024 * 1024); - - setlocale(LC_ALL, ""); - - if (m_closeRemainingWindows) - m_shell->closeRemainingWindows(); - else - m_closeRemainingWindows = true; - m_workQueue.reset(); - m_taskList.revokeAll(); - m_shouldStayOnPageAfterHandlingBeforeUnload = false; -} - -void DRTTestRunner::locationChangeDone() -{ - m_webHistoryItemCount.set(m_shell->navigationEntryCount()); - - // No more new work after the first complete load. - m_workQueue.setFrozen(true); - - if (!m_waitUntilDone) - m_workQueue.processWorkSoon(); -} - -void DRTTestRunner::policyDelegateDone() -{ - ASSERT(m_waitUntilDone); - m_shell->testFinished(); - m_waitUntilDone = false; -} - -void DRTTestRunner::setCanOpenWindows(const CppArgumentList&, CppVariant* result) -{ - m_canOpenWindows = true; - result->setNull(); -} - -void DRTTestRunner::windowCount(const CppArgumentList&, CppVariant* result) -{ - result->set(static_cast<int>(m_shell->windowCount())); -} - -void DRTTestRunner::setCloseRemainingWindowsWhenComplete(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_closeRemainingWindows = arguments[0].value.boolValue; - result->setNull(); -} - -void DRTTestRunner::setAlwaysAcceptCookies(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0) - webkit_support::SetAcceptAllCookies(cppVariantToBool(arguments[0])); - result->setNull(); -} - -void DRTTestRunner::showWebInspector(const CppArgumentList&, CppVariant* result) -{ - m_shell->showDevTools(); - result->setNull(); -} - -void DRTTestRunner::closeWebInspector(const CppArgumentList& args, CppVariant* result) -{ - m_shell->closeDevTools(); - result->setNull(); -} - -void DRTTestRunner::setWindowIsKey(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->setFocus(m_shell->webView(), arguments[0].value.boolValue); - result->setNull(); -} - -void DRTTestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->userStyleSheetLocation = arguments[0].value.boolValue ? m_userStyleSheetLocation : WebURL(); - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setUserStyleSheetLocation(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) { - m_userStyleSheetLocation = webkit_support::LocalFileToDataURL( - webkit_support::RewriteLayoutTestsURL(arguments[0].toString())); - m_shell->preferences()->userStyleSheetLocation = m_userStyleSheetLocation; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setAuthorAndUserStylesEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->authorAndUserStylesEnabled = arguments[0].value.boolValue; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setPopupBlockingEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - bool blockPopups = arguments[0].toBoolean(); - m_shell->preferences()->javaScriptCanOpenWindowsAutomatically = !blockPopups; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setImagesAllowed(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setImagesAllowed(arguments[0].toBoolean()); - result->setNull(); -} - -void DRTTestRunner::setScriptsAllowed(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setScriptsAllowed(arguments[0].toBoolean()); - result->setNull(); -} - -void DRTTestRunner::setStorageAllowed(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setStorageAllowed(arguments[0].toBoolean()); - result->setNull(); -} - -void DRTTestRunner::setPluginsAllowed(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setPluginsAllowed(arguments[0].toBoolean()); - result->setNull(); -} - -void DRTTestRunner::setCustomPolicyDelegate(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - bool enable = arguments[0].value.boolValue; - bool permissive = false; - if (arguments.size() > 1 && arguments[1].isBool()) - permissive = arguments[1].value.boolValue; - m_shell->webViewHost()->setCustomPolicyDelegate(enable, permissive); - } - result->setNull(); -} - -void DRTTestRunner::waitForPolicyDelegate(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->waitForPolicyDelegate(); - m_waitUntilDone = true; - result->setNull(); -} - -void DRTTestRunner::setWillSendRequestClearHeader(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) { - string header = arguments[0].toString(); - if (!header.empty()) - m_shell->webViewHost()->addClearHeader(String::fromUTF8(header.c_str())); - } - result->setNull(); -} - -void DRTTestRunner::setWillSendRequestReturnsNullOnRedirect(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webViewHost()->setBlockRedirects(arguments[0].value.boolValue); - result->setNull(); -} - -void DRTTestRunner::setWillSendRequestReturnsNull(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webViewHost()->setRequestReturnNull(arguments[0].value.boolValue); - result->setNull(); -} - -void DRTTestRunner::pathToLocalResource(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() <= 0 || !arguments[0].isString()) - return; - - string url = arguments[0].toString(); -#if OS(WINDOWS) - if (!url.find("/tmp/")) { - // We want a temp file. - const unsigned tempPrefixLength = 5; - size_t bufferSize = MAX_PATH; - OwnArrayPtr<WCHAR> tempPath = adoptArrayPtr(new WCHAR[bufferSize]); - DWORD tempLength = ::GetTempPathW(bufferSize, tempPath.get()); - if (tempLength + url.length() - tempPrefixLength + 1 > bufferSize) { - bufferSize = tempLength + url.length() - tempPrefixLength + 1; - tempPath = adoptArrayPtr(new WCHAR[bufferSize]); - tempLength = GetTempPathW(bufferSize, tempPath.get()); - ASSERT(tempLength < bufferSize); - } - string resultPath(WebString(tempPath.get(), tempLength).utf8()); - resultPath.append(url.substr(tempPrefixLength)); - result->set(resultPath); - return; - } -#endif - - // Some layout tests use file://// which we resolve as a UNC path. Normalize - // them to just file:///. - string lowerUrl = url; - transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower); - while (!lowerUrl.find("file:////")) { - url = url.substr(0, 8) + url.substr(9); - lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9); - } - result->set(webkit_support::RewriteLayoutTestsURL(url).spec()); -} - -void DRTTestRunner::setStopProvisionalFrameLoads(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - m_stopProvisionalFrameLoads = true; -} - -void DRTTestRunner::setSmartInsertDeleteEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webViewHost()->setSmartInsertDeleteEnabled(arguments[0].value.boolValue); - result->setNull(); -} - -void DRTTestRunner::setSelectTrailingWhitespaceEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webViewHost()->setSelectTrailingWhitespaceEnabled(arguments[0].value.boolValue); - result->setNull(); -} - -void DRTTestRunner::enableAutoResizeMode(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 4) { - result->set(false); - return; - } - int minWidth = cppVariantToInt32(arguments[0]); - int minHeight = cppVariantToInt32(arguments[1]); - WebKit::WebSize minSize(minWidth, minHeight); - - int maxWidth = cppVariantToInt32(arguments[2]); - int maxHeight = cppVariantToInt32(arguments[3]); - WebKit::WebSize maxSize(maxWidth, maxHeight); - - m_shell->webView()->enableAutoResizeMode(minSize, maxSize); - result->set(true); -} - -void DRTTestRunner::disableAutoResizeMode(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() !=2) { - result->set(false); - return; - } - int newWidth = cppVariantToInt32(arguments[0]); - int newHeight = cppVariantToInt32(arguments[1]); - WebKit::WebSize newSize(newWidth, newHeight); - - m_shell->webViewHost()->setWindowRect(WebRect(0, 0, newSize.width, newSize.height)); - m_shell->webView()->disableAutoResizeMode(); - m_shell->webView()->resize(newSize); - result->set(true); -} - -#if ENABLE(NOTIFICATIONS) -void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 1 || !arguments[0].isString()) { - result->set(false); - return; - } -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - m_shell->notificationPresenter()->grantPermission(cppVariantToWebString(arguments[0])); -#endif - result->set(true); -} - -void DRTTestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 1 || !arguments[0].isString()) { - result->set(false); - return; - } -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - if (m_shell->notificationPresenter()->simulateClick(cppVariantToWebString(arguments[0]))) - result->set(true); - else -#endif - result->set(false); -} -#endif - -void DRTTestRunner::setDeferMainResourceDataLoad(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() == 1) - m_deferMainResourceDataLoad = cppVariantToBool(arguments[0]); -} - -void DRTTestRunner::dumpSelectionRect(const CppArgumentList& arguments, CppVariant* result) -{ - m_dumpSelectionRect = true; - result->setNull(); -} - -void DRTTestRunner::display(const CppArgumentList& arguments, CppVariant* result) -{ - WebViewHost* host = m_shell->webViewHost(); - const WebKit::WebSize& size = m_shell->webView()->size(); - WebRect rect(0, 0, size.width, size.height); - host->proxy()->setPaintRect(rect); - host->paintInvalidatedRegion(); - host->displayRepaintMask(); - result->setNull(); -} - -void DRTTestRunner::displayInvalidatedRegion(const CppArgumentList& arguments, CppVariant* result) -{ - WebViewHost* host = m_shell->webViewHost(); - host->paintInvalidatedRegion(); - host->displayRepaintMask(); - result->setNull(); -} - -void DRTTestRunner::testRepaint(const CppArgumentList&, CppVariant* result) -{ - m_testRepaint = true; - result->setNull(); -} - -void DRTTestRunner::repaintSweepHorizontally(const CppArgumentList&, CppVariant* result) -{ - m_sweepHorizontally = true; - result->setNull(); -} - -void DRTTestRunner::setJavaScriptCanAccessClipboard(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->javaScriptCanAccessClipboard = arguments[0].value.boolValue; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setXSSAuditorEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->XSSAuditorEnabled = arguments[0].value.boolValue; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setAllowUniversalAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->allowUniversalAccessFromFileURLs = arguments[0].value.boolValue; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setAllowDisplayOfInsecureContent(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setDisplayingInsecureContentAllowed(arguments[0].toBoolean()); - - result->setNull(); -} - -void DRTTestRunner::setAllowFileAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->allowFileAccessFromFileURLs = arguments[0].value.boolValue; - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setAllowRunningOfInsecureContent(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_shell->webPermissions()->setRunningInsecureContentAllowed(arguments[0].value.boolValue); - - result->setNull(); -} - -// Sets map based on scriptFontPairs, a collapsed vector of pairs of ISO 15924 -// four-letter script code and font such as: -// { "Arab", "My Arabic Font", "Grek", "My Greek Font" } -static void setFontMap(WebPreferences::ScriptFontFamilyMap& map, const Vector<WebString>& scriptFontPairs) -{ - map.clear(); - size_t i = 0; - while (i + 1 < scriptFontPairs.size()) { - const WebString& script = scriptFontPairs[i++]; - const WebString& font = scriptFontPairs[i++]; - - int32_t code = u_getPropertyValueEnum(UCHAR_SCRIPT, script.utf8().data()); - if (code >= 0 && code < USCRIPT_CODE_LIMIT) - map.set(static_cast<int>(code), font); - } -} - -void DRTTestRunner::overridePreference(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 2 || !arguments[0].isString()) - return; - - string key = arguments[0].toString(); - CppVariant value = arguments[1]; - WebPreferences* prefs = m_shell->preferences(); - if (key == "WebKitStandardFont") - prefs->standardFontFamily = cppVariantToWebString(value); - else if (key == "WebKitFixedFont") - prefs->fixedFontFamily = cppVariantToWebString(value); - else if (key == "WebKitSerifFont") - prefs->serifFontFamily = cppVariantToWebString(value); - else if (key == "WebKitSansSerifFont") - prefs->sansSerifFontFamily = cppVariantToWebString(value); - else if (key == "WebKitCursiveFont") - prefs->cursiveFontFamily = cppVariantToWebString(value); - else if (key == "WebKitFantasyFont") - prefs->fantasyFontFamily = cppVariantToWebString(value); - else if (key == "WebKitStandardFontMap") - setFontMap(prefs->standardFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitFixedFontMap") - setFontMap(prefs->fixedFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitSerifFontMap") - setFontMap(prefs->serifFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitSansSerifFontMap") - setFontMap(prefs->sansSerifFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitCursiveFontMap") - setFontMap(prefs->cursiveFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitFantasyFontMap") - setFontMap(prefs->fantasyFontMap, cppVariantToWebStringArray(value)); - else if (key == "WebKitDefaultFontSize") - prefs->defaultFontSize = cppVariantToInt32(value); - else if (key == "WebKitDefaultFixedFontSize") - prefs->defaultFixedFontSize = cppVariantToInt32(value); - else if (key == "WebKitMinimumFontSize") - prefs->minimumFontSize = cppVariantToInt32(value); - else if (key == "WebKitMinimumLogicalFontSize") - prefs->minimumLogicalFontSize = cppVariantToInt32(value); - else if (key == "WebKitDefaultTextEncodingName") - prefs->defaultTextEncodingName = cppVariantToWebString(value); - else if (key == "WebKitJavaScriptEnabled") - prefs->javaScriptEnabled = cppVariantToBool(value); - else if (key == "WebKitWebSecurityEnabled") - prefs->webSecurityEnabled = cppVariantToBool(value); - else if (key == "WebKitJavaScriptCanOpenWindowsAutomatically") - prefs->javaScriptCanOpenWindowsAutomatically = cppVariantToBool(value); - else if (key == "WebKitSupportsMultipleWindows") - prefs->supportsMultipleWindows = cppVariantToBool(value); - else if (key == "WebKitDisplayImagesKey") - prefs->loadsImagesAutomatically = cppVariantToBool(value); - else if (key == "WebKitPluginsEnabled") - prefs->pluginsEnabled = cppVariantToBool(value); - else if (key == "WebKitDOMPasteAllowedPreferenceKey") - prefs->DOMPasteAllowed = cppVariantToBool(value); - else if (key == "WebKitDeveloperExtrasEnabledPreferenceKey") - prefs->developerExtrasEnabled = cppVariantToBool(value); - else if (key == "WebKitShrinksStandaloneImagesToFit") - prefs->shrinksStandaloneImagesToFit = cppVariantToBool(value); - else if (key == "WebKitTextAreasAreResizable") - prefs->textAreasAreResizable = cppVariantToBool(value); - else if (key == "WebKitJavaEnabled") - prefs->javaEnabled = cppVariantToBool(value); - else if (key == "WebKitUsesPageCachePreferenceKey") - prefs->usesPageCache = cppVariantToBool(value); - else if (key == "WebKitPageCacheSupportsPluginsPreferenceKey") - prefs->pageCacheSupportsPlugins = cppVariantToBool(value); - else if (key == "WebKitJavaScriptCanAccessClipboard") - prefs->javaScriptCanAccessClipboard = cppVariantToBool(value); - else if (key == "WebKitXSSAuditorEnabled") - prefs->XSSAuditorEnabled = cppVariantToBool(value); - else if (key == "WebKitLocalStorageEnabledPreferenceKey") - prefs->localStorageEnabled = cppVariantToBool(value); - else if (key == "WebKitOfflineWebApplicationCacheEnabled") - prefs->offlineWebApplicationCacheEnabled = cppVariantToBool(value); - else if (key == "WebKitTabToLinksPreferenceKey") - prefs->tabsToLinks = cppVariantToBool(value); - else if (key == "WebKitWebGLEnabled") - prefs->experimentalWebGLEnabled = cppVariantToBool(value); - else if (key == "WebKitCSSRegionsEnabled") - prefs->experimentalCSSRegionsEnabled = cppVariantToBool(value); - else if (key == "WebKitCSSGridLayoutEnabled") - prefs->experimentalCSSGridLayoutEnabled = cppVariantToBool(value); - else if (key == "WebKitHyperlinkAuditingEnabled") - prefs->hyperlinkAuditingEnabled = cppVariantToBool(value); - else if (key == "WebKitEnableCaretBrowsing") - prefs->caretBrowsingEnabled = cppVariantToBool(value); - else if (key == "WebKitAllowDisplayingInsecureContent") - prefs->allowDisplayOfInsecureContent = cppVariantToBool(value); - else if (key == "WebKitAllowRunningInsecureContent") - prefs->allowRunningOfInsecureContent = cppVariantToBool(value); - else if (key == "WebKitCSSCustomFilterEnabled") - prefs->cssCustomFilterEnabled = cppVariantToBool(value); - else if (key == "WebKitShouldRespectImageOrientation") - prefs->shouldRespectImageOrientation = cppVariantToBool(value); - else if (key == "WebKitWebAudioEnabled") { - ASSERT(cppVariantToBool(value)); - } else { - string message("Invalid name for preference: "); - message.append(key); - printErrorMessage(message); - } - m_shell->applyPreferences(); -} - -void DRTTestRunner::clearAllDatabases(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - webkit_support::ClearAllDatabases(); -} - -void DRTTestRunner::setDatabaseQuota(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if ((arguments.size() >= 1) && arguments[0].isNumber()) - webkit_support::SetDatabaseQuota(arguments[0].toInt32()); -} - -void DRTTestRunner::setPOSIXLocale(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() == 1 && arguments[0].isString()) - setlocale(LC_ALL, arguments[0].toString().c_str()); -} - -void DRTTestRunner::setPrinting(const CppArgumentList& arguments, CppVariant* result) -{ - setIsPrinting(true); - result->setNull(); -} - -void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - Vector<WebViewHost*> windowList = m_shell->windowList(); - int numberOfRequests = 0; - for (size_t i = 0; i < windowList.size(); i++) - numberOfRequests += windowList[i]->geolocationClientMock()->numberOfPendingPermissionRequests(); - result->set(numberOfRequests); -} - -void DRTTestRunner::evaluateInWebInspector(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isString()) - return; - m_shell->drtDevToolsAgent()->evaluateInWebInspector(arguments[0].toInt32(), arguments[1].toString()); -} - -void DRTTestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber()) - return; - - WebDeviceOrientation orientation; - orientation.setNull(false); - if (arguments[0].toBoolean()) - orientation.setAlpha(arguments[1].toDouble()); - if (arguments[2].toBoolean()) - orientation.setBeta(arguments[3].toDouble()); - if (arguments[4].toBoolean()) - orientation.setGamma(arguments[5].toDouble()); - - // Note that we only call setOrientation on the main page's mock since this is all that the - // tests require. If necessary, we could get a list of WebViewHosts from the TestShell and - // call setOrientation on each DeviceOrientationClientMock. - m_shell->webViewHost()->deviceOrientationClientMock()->setOrientation(orientation); -} - -// FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually. -// https://bugs.webkit.org/show_bug.cgi?id=52368 -void DRTTestRunner::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isBool()) - return; - Vector<WebViewHost*> windowList = m_shell->windowList(); - for (size_t i = 0; i < windowList.size(); i++) - windowList[i]->geolocationClientMock()->setPermission(arguments[0].toBoolean()); -} - -void DRTTestRunner::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber()) - return; - Vector<WebViewHost*> windowList = m_shell->windowList(); - for (size_t i = 0; i < windowList.size(); i++) - windowList[i]->geolocationClientMock()->setPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble()); -} - -void DRTTestRunner::setMockGeolocationPositionUnavailableError(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 1 || !arguments[0].isString()) - return; - Vector<WebViewHost*> windowList = m_shell->windowList(); - // FIXME: Benjamin - for (size_t i = 0; i < windowList.size(); i++) - windowList[i]->geolocationClientMock()->setPositionUnavailableError(cppVariantToWebString(arguments[0])); -} - -#if ENABLE(INPUT_SPEECH) -void DRTTestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isNumber() || !arguments[2].isString()) - return; - - if (MockWebSpeechInputController* controller = m_shell->webViewHost()->speechInputControllerMock()) - controller->addMockRecognitionResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble(), cppVariantToWebString(arguments[2])); -} - -void DRTTestRunner::setMockSpeechInputDumpRect(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isBool()) - return; - - if (MockWebSpeechInputController* controller = m_shell->webViewHost()->speechInputControllerMock()) - controller->setDumpRect(arguments[0].value.boolValue); -} -#endif - -#if ENABLE(SCRIPTED_SPEECH) -void DRTTestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isNumber()) - return; - - if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer()) - recognizer->addMockResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble()); -} - -void DRTTestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isString()) - return; - - if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer()) - recognizer->setError(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); -} - -void DRTTestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant* result) -{ - result->set(false); - if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer()) - result->set(recognizer->wasAborted()); -} -#endif - -void DRTTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() == 1 && arguments[0].isBool()) - m_shouldStayOnPageAfterHandlingBeforeUnload = arguments[0].toBoolean(); - - result->setNull(); -} - -void DRTTestRunner::sendWebIntentResponse(const CppArgumentList& arguments, CppVariant* result) -{ - v8::HandleScope scope; - v8::Local<v8::Context> ctx = m_shell->webView()->mainFrame()->mainWorldScriptContext(); - result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8()); - v8::Context::Scope cscope(ctx); - - WebKit::WebIntentRequest* request = m_shell->webViewHost()->currentIntentRequest(); - if (request->isNull()) - return; - - if (arguments.size() == 1) { - WebKit::WebCString reply = cppVariantToWebString(arguments[0]).utf8(); - v8::Handle<v8::Value> v8value = v8::String::New(reply.data(), reply.length()); - request->postResult(WebKit::WebSerializedScriptValue::serialize(v8value)); - } else { - v8::Handle<v8::Value> v8value = v8::String::New("ERROR"); - request->postFailure(WebKit::WebSerializedScriptValue::serialize(v8value)); - } - result->setNull(); -} - -void DRTTestRunner::deliverWebIntent(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 3) - return; - - v8::HandleScope scope; - v8::Local<v8::Context> ctx = m_shell->webView()->mainFrame()->mainWorldScriptContext(); - result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8()); - v8::Context::Scope cscope(ctx); - - WebString action = cppVariantToWebString(arguments[0]); - WebString type = cppVariantToWebString(arguments[1]); - WebKit::WebCString data = cppVariantToWebString(arguments[2]).utf8(); - WebSerializedScriptValue serializedData = WebSerializedScriptValue::serialize( - v8::String::New(data.data(), data.length())); - - WebIntent intent = WebIntent::create(action, type, serializedData.toString(), WebVector<WebString>(), WebVector<WebString>()); - - m_shell->webView()->mainFrame()->deliverIntent(intent, 0, m_intentClient.get()); -} - -class InvokeCallbackTask : public WebMethodTask<DRTTestRunner> { -public: - InvokeCallbackTask(DRTTestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments) - : WebMethodTask<DRTTestRunner>(object) - , m_callbackArguments(callbackArguments) - , m_numberOfArguments(numberOfArguments) - { - } - - virtual void runIfValid() - { - CppVariant invokeResult; - m_callbackArguments[0].invokeDefault(m_callbackArguments.get(), m_numberOfArguments, invokeResult); - } - -private: - OwnArrayPtr<CppVariant> m_callbackArguments; - uint32_t m_numberOfArguments; -}; - -void DRTTestRunner::setBackingScaleFactor(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isObject()) - return; - - float value = arguments[0].value.doubleValue; - m_shell->webViewHost()->setDeviceScaleFactor(value); - - OwnArrayPtr<CppVariant> callbackArguments = adoptArrayPtr(new CppVariant[1]); - callbackArguments[0].set(arguments[1]); - result->setNull(); - postTask(new InvokeCallbackTask(this, callbackArguments.release(), 1)); -} - -void DRTTestRunner::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) { - m_shell->preferences()->pluginsEnabled = arguments[0].toBoolean(); - m_shell->applyPreferences(); - } - result->setNull(); -} - -void DRTTestRunner::setAudioData(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1 || !arguments[0].isObject()) - return; - - // Check that passed-in object is, in fact, an ArrayBufferView. - NPObject* npobject = NPVARIANT_TO_OBJECT(arguments[0]); - if (!npobject) - return; - if (!WebBindings::getArrayBufferView(npobject, &m_audioData)) - return; - - setShouldDumpAsAudio(true); -} - -#if ENABLE(POINTER_LOCK) -void DRTTestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->didAcquirePointerLock(); - result->setNull(); -} - -void DRTTestRunner::didNotAcquirePointerLock(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->didNotAcquirePointerLock(); - result->setNull(); -} - -void DRTTestRunner::didLosePointerLock(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->didLosePointerLock(); - result->setNull(); -} - -void DRTTestRunner::setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->setPointerLockWillRespondAsynchronously(); - result->setNull(); -} - -void DRTTestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant* result) -{ - m_shell->webViewHost()->setPointerLockWillFailSynchronously(); - result->setNull(); -} -#endif diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h deleted file mode 100644 index 49f27c36b..000000000 --- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) - * Copyright (C) 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - DRTTestRunner class: - Bound to a JavaScript window.testRunner object using the - CppBoundClass::bindToJavascript(), this allows layout tests that are run in - the test_shell (or, in principle, any web page loaded into a client app built - with this class) to control various aspects of how the tests are run and what - sort of output they produce. -*/ - -#ifndef DRTTestRunner_h -#define DRTTestRunner_h - -#include "TestRunner/src/TestRunner.h" -#include "WebDeliveredIntentClient.h" -#include "WebTask.h" -#include "WebTextDirection.h" -#include "platform/WebArrayBufferView.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include <wtf/Deque.h> -#include <wtf/OwnPtr.h> - -namespace WebKit { -class WebGeolocationClientMock; -} - -namespace webkit_support { -class ScopedTempDirectory; -} - - -class TestShell; - -using WebTestRunner::CppArgumentList; -using WebTestRunner::CppVariant; - -class DRTTestRunner : public WebTestRunner::TestRunner { -public: - // Builds the property and method lists needed to bind this class to a JS - // object. - DRTTestRunner(TestShell*); - - ~DRTTestRunner(); - - // This function sets a flag that tells the test_shell to dump pages as - // plain text, rather than as a text representation of the renderer's state. - // It takes an optional argument, whether to dump pixels results or not. - void dumpAsText(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for each editing command. It takes no arguments, and - // ignores any that may be present. - void dumpEditingCallbacks(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for each frame load callback. It takes no arguments, and - // ignores any that may be present. - void dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for the progress finished callback. It takes no - // arguments, and ignores any that may be present. - void dumpProgressFinishedCallback(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print a line of - // user gesture status text for some frame load callbacks. It takes no - // arguments, and ignores any that may be present. - void dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print out a text - // representation of the back/forward list. It ignores all arguments. - void dumpBackForwardList(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print out the - // scroll offsets of the child frames. It ignores all. - void dumpChildFrameScrollPositions(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to recursively - // dump all frames as plain text if the dumpAsText flag is set. - // It takes no arguments, and ignores any that may be present. - void dumpChildFramesAsText(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to dump a descriptive - // line for each resource load callback. It takes no arguments, and ignores - // any that may be present. - void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for each element that requested a resource. It takes no - // arguments, and ignores any that may be present. - void dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to dump the MIME type - // for each resource that was loaded. It takes no arguments, and ignores any - // that may be present. - void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to dump all calls - // to window.status(). - // It takes no arguments, and ignores any that may be present. - void dumpWindowStatusChanges(const CppArgumentList&, CppVariant*); - - // This function sets a flag that tells the test_shell to dump all calls to - // WebViewClient::createView(). - // It takes no arguments, and ignores any that may be present. - void dumpCreateView(const CppArgumentList&, CppVariant*); - - // Functions for dealing with windows. By default we block all new windows. - void windowCount(const CppArgumentList&, CppVariant*); - void setCanOpenWindows(const CppArgumentList&, CppVariant*); - void setCloseRemainingWindowsWhenComplete(const CppArgumentList&, CppVariant*); - - // By default, tests end when page load is complete. These methods are used - // to delay the completion of the test until notifyDone is called. - void waitUntilDone(const CppArgumentList&, CppVariant*); - void notifyDone(const CppArgumentList&, CppVariant*); - - // Methods for adding actions to the work queue. Used in conjunction with - // waitUntilDone/notifyDone above. - void queueBackNavigation(const CppArgumentList&, CppVariant*); - void queueForwardNavigation(const CppArgumentList&, CppVariant*); - void queueReload(const CppArgumentList&, CppVariant*); - void queueLoadingScript(const CppArgumentList&, CppVariant*); - void queueNonLoadingScript(const CppArgumentList&, CppVariant*); - void queueLoad(const CppArgumentList&, CppVariant*); - void queueLoadHTMLString(const CppArgumentList&, CppVariant*); - - // Changes the cookie policy from the default to allow all cookies. - void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*); - - // Shows DevTools window. - void showWebInspector(const CppArgumentList&, CppVariant*); - void closeWebInspector(const CppArgumentList&, CppVariant*); - - // Gives focus to the window. - void setWindowIsKey(const CppArgumentList&, CppVariant*); - - - // Passes through to WebPreferences which allows the user to have a custom - // style sheet. - void setUserStyleSheetEnabled(const CppArgumentList&, CppVariant*); - void setUserStyleSheetLocation(const CppArgumentList&, CppVariant*); - - // Passes this preference through to WebSettings. - void setAuthorAndUserStylesEnabled(const CppArgumentList&, CppVariant*); - - // Causes navigation actions just printout the intended navigation instead - // of taking you to the page. This is used for cases like mailto, where you - // don't actually want to open the mail program. - void setCustomPolicyDelegate(const CppArgumentList&, CppVariant*); - - // Delays completion of the test until the policy delegate runs. - void waitForPolicyDelegate(const CppArgumentList&, CppVariant*); - - // Causes WillSendRequest to clear certain headers. - void setWillSendRequestClearHeader(const CppArgumentList&, CppVariant*); - - // Causes WillSendRequest to block redirects. - void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList&, CppVariant*); - - // Causes WillSendRequest to return an empty request. - void setWillSendRequestReturnsNull(const CppArgumentList&, CppVariant*); - - // Converts a URL starting with file:///tmp/ to the local mapping. - void pathToLocalResource(const CppArgumentList&, CppVariant*); - - // Set the WebPreference that controls webkit's popup blocking. - void setPopupBlockingEnabled(const CppArgumentList&, CppVariant*); - - // If true, causes provisional frame loads to be stopped for the remainder of - // the test. - void setStopProvisionalFrameLoads(const CppArgumentList&, CppVariant*); - - // Enable or disable smart insert/delete. This is enabled by default. - void setSmartInsertDeleteEnabled(const CppArgumentList&, CppVariant*); - - // Enable or disable trailing whitespace selection on double click. - void setSelectTrailingWhitespaceEnabled(const CppArgumentList&, CppVariant*); - void enableAutoResizeMode(const CppArgumentList&, CppVariant*); - void disableAutoResizeMode(const CppArgumentList&, CppVariant*); - void dumpSelectionRect(const CppArgumentList&, CppVariant*); - -#if ENABLE(NOTIFICATIONS) - // Grants permission for desktop notifications to an origin - void grantWebNotificationPermission(const CppArgumentList&, CppVariant*); - // Simulates a click on a desktop notification. - void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*); -#endif - - void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*); - - // Deals with Web Audio WAV file data. - void setAudioData(const CppArgumentList&, CppVariant*); - const WebKit::WebArrayBufferView& audioData() const { return m_audioData; } - - void dumpTitleChanges(const CppArgumentList&, CppVariant*); - void display(const CppArgumentList&, CppVariant*); - void displayInvalidatedRegion(const CppArgumentList&, CppVariant*); - void testRepaint(const CppArgumentList&, CppVariant*); - void repaintSweepHorizontally(const CppArgumentList&, CppVariant*); - - void setJavaScriptCanAccessClipboard(const CppArgumentList&, CppVariant*); - void setXSSAuditorEnabled(const CppArgumentList&, CppVariant*); - void overridePreference(const CppArgumentList&, CppVariant*); - void setAllowUniversalAccessFromFileURLs(const CppArgumentList&, CppVariant*); - void setAllowDisplayOfInsecureContent(const CppArgumentList&, CppVariant*); - void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*); - void setAllowRunningOfInsecureContent(const CppArgumentList&, CppVariant*); - - - // Clears all databases. - void clearAllDatabases(const CppArgumentList&, CppVariant*); - // Sets the default quota for all origins - void setDatabaseQuota(const CppArgumentList&, CppVariant*); - - // Calls setlocale(LC_ALL, ...) for a specified locale. - // Resets between tests. - void setPOSIXLocale(const CppArgumentList&, CppVariant*); - - // Causes layout to happen as if targetted to printed pages. - void setPrinting(const CppArgumentList&, CppVariant*); - - // Gets the number of geolocation permissions requests pending. - void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*); - - // Allows layout tests to exec scripts at WebInspector side. - void evaluateInWebInspector(const CppArgumentList&, CppVariant*); - - // DeviceOrientation related functions - void setMockDeviceOrientation(const CppArgumentList&, CppVariant*); - - // Geolocation related functions. - void setGeolocationPermission(const CppArgumentList&, CppVariant*); - void setMockGeolocationPosition(const CppArgumentList&, CppVariant*); - void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*); - - // Speech input related functions. -#if ENABLE(INPUT_SPEECH) - void addMockSpeechInputResult(const CppArgumentList&, CppVariant*); - void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*); -#endif -#if ENABLE(SCRIPTED_SPEECH) - void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*); - void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*); - void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*); -#endif - - // WebPermissionClient related. - void setImagesAllowed(const CppArgumentList&, CppVariant*); - void setScriptsAllowed(const CppArgumentList&, CppVariant*); - void setStorageAllowed(const CppArgumentList&, CppVariant*); - void setPluginsAllowed(const CppArgumentList&, CppVariant*); - void dumpPermissionClientCallbacks(const CppArgumentList&, CppVariant*); - - // Enable or disable plugins. - void setPluginsEnabled(const CppArgumentList&, CppVariant*); - - void setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList&, CppVariant*); - -#if ENABLE(POINTER_LOCK) - void didAcquirePointerLock(const CppArgumentList&, CppVariant*); - void didNotAcquirePointerLock(const CppArgumentList&, CppVariant*); - void didLosePointerLock(const CppArgumentList&, CppVariant*); - void setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant*); - void setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant*); -#endif - - // Expects one string argument for sending successful result, zero - // arguments for sending a failure result. - void sendWebIntentResponse(const CppArgumentList&, CppVariant*); - - // Cause the web intent to be delivered to this context. - void deliverWebIntent(const CppArgumentList&, CppVariant*); - - // Used to set the device scale factor. - void setBackingScaleFactor(const CppArgumentList&, CppVariant*); - -public: - // The following methods are not exposed to JavaScript. - void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); } - - bool shouldDumpAsAudio() const { return m_dumpAsAudio; } - void setShouldDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; } - bool shouldDumpAsText() { return m_dumpAsText; } - void setShouldDumpAsText(bool value) { m_dumpAsText = value; } - bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; } - bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; } - void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; } - bool shouldDumpProgressFinishedCallback() { return m_dumpProgressFinishedCallback; } - void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; } - bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; } - void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; } - bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; } - void setShouldDumpResourceRequestCallbacks(bool value) { m_dumpResourceRequestCallbacks = value; } - bool shouldDumpResourceRequestCallbacks() { return m_dumpResourceRequestCallbacks; } - void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; } - bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; } - bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; } - bool shouldDumpSelectionRect() { return m_dumpSelectionRect; } - bool shouldDumpBackForwardList() { return m_dumpBackForwardList; } - bool shouldDumpTitleChanges() { return m_dumpTitleChanges; } - bool shouldDumpPermissionClientCallbacks() { return m_dumpPermissionClientCallbacks; } - bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; } - bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; } - bool shouldGeneratePixelResults() { return m_generatePixelResults; } - void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; } - bool shouldDumpCreateView() { return m_dumpCreateView; } - bool canOpenWindows() { return m_canOpenWindows; } - bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; } - bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; } - void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; } - void setTitleTextDirection(WebKit::WebTextDirection dir) - { - m_titleTextDirection.set(dir == WebKit::WebTextDirectionLeftToRight ? "ltr" : "rtl"); - } - - bool shouldInterceptPostMessage() - { - return m_interceptPostMessage.isBool() && m_interceptPostMessage.toBoolean(); - } - - void setIsPrinting(bool value) { m_isPrinting = value; } - bool isPrinting() { return m_isPrinting; } - - bool testRepaint() const { return m_testRepaint; } - bool sweepHorizontally() const { return m_sweepHorizontally; } - - // Called by the webview delegate when the toplevel frame load is done. - void locationChangeDone(); - - // Called by the webview delegate when the policy delegate runs if the - // waitForPolicyDelegate was called. - void policyDelegateDone(); - - // Reinitializes all static values. The reset() method should be called - // before the start of each test (currently from TestShell::runFileTest). - void reset(); - - // A single item in the work queue. - class WorkItem { - public: - virtual ~WorkItem() { } - - // Returns true if this started a load. - virtual bool run(TestShell*) = 0; - }; - - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - - bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } - -private: - friend class WorkItem; - friend class WorkQueue; - - // Helper class for managing events queued by methods like queueLoad or - // queueScript. - class WorkQueue { - public: - WorkQueue(DRTTestRunner* controller) : m_frozen(false), m_controller(controller) { } - virtual ~WorkQueue(); - void processWorkSoon(); - - // Reset the state of the class between tests. - void reset(); - - void addWork(WorkItem*); - - void setFrozen(bool frozen) { m_frozen = frozen; } - bool isEmpty() { return m_queue.isEmpty(); } - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - - private: - void processWork(); - class WorkQueueTask: public WebTestRunner::WebMethodTask<WorkQueue> { - public: - WorkQueueTask(WorkQueue* object): WebTestRunner::WebMethodTask<WorkQueue>(object) { } - virtual void runIfValid() { m_object->processWork(); } - }; - - WebTestRunner::WebTaskList m_taskList; - Deque<WorkItem*> m_queue; - bool m_frozen; - DRTTestRunner* m_controller; - }; - void completeNotifyDone(bool isTimeout); - class NotifyDoneTimedOutTask: public WebTestRunner::WebMethodTask<DRTTestRunner> { - public: - NotifyDoneTimedOutTask(DRTTestRunner* object): WebTestRunner::WebMethodTask<DRTTestRunner>(object) { } - virtual void runIfValid() { m_object->completeNotifyDone(true); } - }; - - // Used for test timeouts. - WebTestRunner::WebTaskList m_taskList; - - // Non-owning pointer. The DRTTestRunner is owned by the host. - TestShell* m_shell; - - // If true, the test_shell will produce a plain text dump rather than a - // text representation of the renderer. - bool m_dumpAsText; - - // If true, the test_shell will output a base64 encoded WAVE file. - bool m_dumpAsAudio; - - // If true, the test_shell will write a descriptive line for each editing - // command. - bool m_dumpEditingCallbacks; - - // If true, the test_shell will draw the bounds of the current selection rect - // taking possible transforms of the selection rect into account. - bool m_dumpSelectionRect; - - // If true, the test_shell will output a descriptive line for each frame - // load callback. - bool m_dumpFrameLoadCallbacks; - - // If true, the test_shell will output a descriptive line for the progress - // finished callback. - bool m_dumpProgressFinishedCallback; - - // If true, the test_shell will output a line of the user gesture status - // text for some frame load callbacks. - bool m_dumpUserGestureInFrameLoadCallbacks; - - // If true, the test_shell will output a descriptive line for each resource - // load callback. - bool m_dumpResourceLoadCallbacks; - - // If true, the test_shell will output a descriptive line for each resource - // request callback. - bool m_dumpResourceRequestCallbacks; - - // If true, the test_shell will output the MIME type for each resource that - // was loaded. - bool m_dumpResourceResponseMIMETypes; - - // If true, the test_shell will produce a dump of the back forward list as - // well. - bool m_dumpBackForwardList; - - // If true, the test_shell will print out the child frame scroll offsets as - // well. - bool m_dumpChildFrameScrollPositions; - - // If true and if dump_as_text_ is true, the test_shell will recursively - // dump all frames as plain text. - bool m_dumpChildFramesAsText; - - // If true, the test_shell will dump all changes to window.status. - bool m_dumpWindowStatusChanges; - - // If true, output a message when the page title is changed. - bool m_dumpTitleChanges; - - // If true, output a descriptive line each time a permission client - // callback is invoked. Currently only implemented for allowImage. - bool m_dumpPermissionClientCallbacks; - - // If true, the test_shell will generate pixel results in dumpAsText mode - bool m_generatePixelResults; - - // If true, output a descriptive line each time WebViewClient::createView - // is invoked. - bool m_dumpCreateView; - - // If true, new windows can be opened via javascript or by plugins. By - // default, set to false and can be toggled to true using - // setCanOpenWindows(). - bool m_canOpenWindows; - - // When reset is called, go through and close all but the main test shell - // window. By default, set to true but toggled to false using - // setCloseRemainingWindowsWhenComplete(). - bool m_closeRemainingWindows; - - // If true, pixel dump will be produced as a series of 1px-tall, view-wide - // individual paints over the height of the view. - bool m_testRepaint; - // If true and test_repaint_ is true as well, pixel dump will be produced as - // a series of 1px-wide, view-tall paints across the width of the view. - bool m_sweepHorizontally; - - // If true, stops provisional frame loads during the - // DidStartProvisionalLoadForFrame callback. - bool m_stopProvisionalFrameLoads; - - // If true, don't dump output until notifyDone is called. - bool m_waitUntilDone; - - // If false, all new requests will not defer the main resource data load. - bool m_deferMainResourceDataLoad; - - // If true, we will show extended information in the graphics layer tree. - bool m_showDebugLayerTree; - - // If true, layout is to target printed pages. - bool m_isPrinting; - - WorkQueue m_workQueue; - - // Bound variable counting the number of top URLs visited. - CppVariant m_webHistoryItemCount; - - // Bound variable tracking the directionality of the <title> tag. - CppVariant m_titleTextDirection; - - // Bound variable to set whether postMessages should be intercepted or not - CppVariant m_interceptPostMessage; - - WebKit::WebURL m_userStyleSheetLocation; - - // WAV audio data is stored here. - WebKit::WebArrayBufferView m_audioData; - - // Mock object for testing delivering web intents. - OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient; - - bool m_shouldStayOnPageAfterHandlingBeforeUnload; -}; - -#endif // DRTTestRunner_h diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp deleted file mode 100644 index bbd16af32..000000000 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DumpRenderTree.h" - -#include "MockWebKitPlatformSupport.h" -#include "TestShell.h" -#include "webkit/support/webkit_support.h" -#include <public/WebCompositorSupport.h> -#include <v8/include/v8-testing.h> -#include <v8/include/v8.h> -#include <wtf/OwnPtr.h> -#include <wtf/Vector.h> - -using namespace std; - -static const char optionComplexText[] = "--complex-text"; -static const char optionDumpPixels[] = "--pixel-tests"; -static const char optionDumpPixelsShortForm[] = "-p"; -static const char optionNotree[] = "--notree"; -static const char optionThreaded[] = "--threaded"; -static const char optionDebugRenderTree[] = "--debug-render-tree"; -static const char optionDebugLayerTree[] = "--debug-layer-tree"; - -static const char optionAllowExternalPages[] = "--allow-external-pages"; -static const char optionStartupDialog[] = "--testshell-startup-dialog"; -static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps"; - -static const char optionHardwareAcceleratedGL[] = "--enable-hardware-gpu"; -static const char optionEnableSoftwareCompositing[] = "--enable-software-compositing"; -static const char optionEnableThreadedCompositing[] = "--enable-threaded-compositing"; -static const char optionForceCompositingMode[] = "--force-compositing-mode"; -static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas"; -static const char optionEnableDeferred2DCanvas[] = "--enable-deferred-2d-canvas"; -static const char optionEnableAcceleratedPainting[] = "--enable-accelerated-painting"; -static const char optionEnableAcceleratedCompositingForVideo[] = "--enable-accelerated-video"; -static const char optionEnableAcceleratedFixedPosition[] = "--enable-accelerated-fixed-position"; -static const char optionUseGraphicsContext3DImplementation[] = "--use-graphics-context-3d-implementation="; -static const char optionEnablePerTilePainting[] = "--enable-per-tile-painting"; -static const char optionEnableDeferredImageDecoding[] = "--enable-deferred-image-decoding"; - -static const char optionStressOpt[] = "--stress-opt"; -static const char optionStressDeopt[] = "--stress-deopt"; -static const char optionJavaScriptFlags[] = "--js-flags="; -static const char optionEncodeBinary[] = "--encode-binary"; -static const char optionNoTimeout[] = "--no-timeout"; -static const char optionWebCoreLogChannels[] = "--webcore-log-channels="; - -class WebKitSupportTestEnvironment { -public: - WebKitSupportTestEnvironment() - { - m_mockPlatform = MockWebKitPlatformSupport::create(); - webkit_support::SetUpTestEnvironment(m_mockPlatform.get()); - } - ~WebKitSupportTestEnvironment() - { - webkit_support::TearDownTestEnvironment(); - } -private: - OwnPtr<MockWebKitPlatformSupport> m_mockPlatform; -}; - -static void runTest(TestShell& shell, TestParams& params, const string& inputLine, const bool forceDumpPixels) -{ - int oldTimeoutMsec = shell.layoutTestTimeout(); - TestCommand command = parseInputLine(inputLine); - params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL); - params.pixelHash = command.shouldDumpPixels; - webkit_support::SetCurrentDirectoryForFileURL(params.testUrl); - v8::V8::SetFlagsFromString(shell.javaScriptFlags().c_str(), shell.javaScriptFlags().length()); - if (shell.stressOpt() || shell.stressDeopt()) { - if (shell.stressOpt()) - v8::Testing::SetStressRunType(v8::Testing::kStressTypeOpt); - else - v8::Testing::SetStressRunType(v8::Testing::kStressTypeDeopt); - for (int i = 0; i < v8::Testing::GetStressRuns(); i++) { - v8::Testing::PrepareStressRun(i); - bool isLastLoad = (i == (v8::Testing::GetStressRuns() - 1)); - shell.setDumpWhenFinished(isLastLoad); - shell.resetTestController(); - shell.runFileTest(params, command.shouldDumpPixels || forceDumpPixels); - } - } else { - shell.resetTestController(); - shell.runFileTest(params, command.shouldDumpPixels || forceDumpPixels); - } - shell.setLayoutTestTimeout(oldTimeoutMsec); -} - -int main(int argc, char* argv[]) -{ - WebKitSupportTestEnvironment testEnvironment; - platformInit(&argc, &argv); - - TestParams params; - Vector<string> tests; - bool serverMode = false; - bool dumpAllPixels = false; - bool allowExternalPages = false; - bool startupDialog = false; - bool acceleratedCompositingForVideoEnabled = false; - bool acceleratedCompositingForFixedPositionEnabled = false; - bool softwareCompositingEnabled = false; - bool threadedCompositingEnabled = false; - bool forceCompositingMode = false; - bool accelerated2DCanvasEnabled = false; - bool deferred2DCanvasEnabled = false; - bool acceleratedPaintingEnabled = false; - bool perTilePaintingEnabled = false; - bool deferredImageDecodingEnabled = false; - bool stressOpt = false; - bool stressDeopt = false; - bool hardwareAcceleratedGL = false; - string javaScriptFlags; - bool encodeBinary = false; - bool noTimeout = false; - bool acceleratedAnimationEnabled = false; - for (int i = 1; i < argc; ++i) { - string argument(argv[i]); - if (argument == "-") - serverMode = true; - else if (argument == optionDumpPixels || argument == optionDumpPixelsShortForm) - dumpAllPixels = true; - else if (argument == optionNotree) - params.dumpTree = false; - else if (argument == optionDebugRenderTree) - params.debugRenderTree = true; - else if (argument == optionDebugLayerTree) - params.debugLayerTree = true; - else if (argument == optionAllowExternalPages) - allowExternalPages = true; - else if (argument == optionStartupDialog) - startupDialog = true; - else if (argument == optionCheckLayoutTestSystemDeps) - return checkLayoutTestSystemDependencies() ? EXIT_SUCCESS : EXIT_FAILURE; - else if (argument == optionHardwareAcceleratedGL) - hardwareAcceleratedGL = true; - else if (argument == optionEnableAcceleratedCompositingForVideo) - acceleratedCompositingForVideoEnabled = true; - else if (argument == optionEnableAcceleratedFixedPosition) - acceleratedCompositingForFixedPositionEnabled = true; - else if (argument == optionEnableSoftwareCompositing) - softwareCompositingEnabled = true; - else if (argument == optionEnableThreadedCompositing) - threadedCompositingEnabled = true; - else if (argument == optionForceCompositingMode) - forceCompositingMode = true; - else if (argument == optionEnableAccelerated2DCanvas) - accelerated2DCanvasEnabled = true; - else if (argument == optionEnableDeferred2DCanvas) - deferred2DCanvasEnabled = true; - else if (argument == optionEnableAcceleratedPainting) - acceleratedPaintingEnabled = true; - else if (!argument.find(optionUseGraphicsContext3DImplementation)) { - string implementation = argument.substr(strlen(optionUseGraphicsContext3DImplementation)); - if (!implementation.compare("IN_PROCESS")) - webkit_support::SetGraphicsContext3DImplementation(webkit_support::IN_PROCESS); - else if (!implementation.compare("IN_PROCESS_COMMAND_BUFFER")) - webkit_support::SetGraphicsContext3DImplementation(webkit_support::IN_PROCESS_COMMAND_BUFFER); - else - fprintf(stderr, "Unknown GraphicContext3D implementation %s\n", implementation.c_str()); - } else if (argument == optionEnablePerTilePainting) - perTilePaintingEnabled = true; - else if (argument == optionEnableDeferredImageDecoding) - deferredImageDecodingEnabled = true; - else if (argument == optionStressOpt) - stressOpt = true; - else if (argument == optionStressDeopt) - stressDeopt = true; - else if (!argument.find(optionJavaScriptFlags)) - javaScriptFlags = argument.substr(strlen(optionJavaScriptFlags)); - else if (argument == optionEncodeBinary) - encodeBinary = true; - else if (argument == optionNoTimeout) - noTimeout = true; - else if (!argument.find(optionWebCoreLogChannels)) { - string channels = argument.substr(strlen(optionWebCoreLogChannels)); - webkit_support::EnableWebCoreLogChannels(channels); - } else if (argument.size() && argument[0] == '-') - fprintf(stderr, "Unknown option: %s\n", argv[i]); - else - tests.append(argument); - } - if (stressOpt && stressDeopt) { - fprintf(stderr, "--stress-opt and --stress-deopt are mutually exclusive.\n"); - return EXIT_FAILURE; - } - - webkit_support::SetUpGLBindings(hardwareAcceleratedGL ? webkit_support::GL_BINDING_DEFAULT : webkit_support::GL_BINDING_SOFTWARE_RENDERER); - - if (startupDialog) - openStartupDialog(); - - { // Explicit scope for the TestShell instance. - TestShell shell; - shell.setAllowExternalPages(allowExternalPages); - shell.setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); - shell.setAcceleratedCompositingForFixedPositionEnabled(acceleratedCompositingForFixedPositionEnabled); - shell.setSoftwareCompositingEnabled(softwareCompositingEnabled); - shell.setThreadedCompositingEnabled(threadedCompositingEnabled); - shell.setForceCompositingMode(forceCompositingMode); - shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled); - shell.setDeferred2dCanvasEnabled(deferred2DCanvasEnabled); - shell.setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); - shell.setAcceleratedAnimationEnabled(acceleratedAnimationEnabled); - shell.setPerTilePaintingEnabled(perTilePaintingEnabled); - shell.setDeferredImageDecodingEnabled(deferredImageDecodingEnabled); - shell.setJavaScriptFlags(javaScriptFlags); - shell.setStressOpt(stressOpt); - shell.setStressDeopt(stressDeopt); - shell.setEncodeBinary(encodeBinary); - if (noTimeout) { - // 0x20000000ms is big enough for the purpose to avoid timeout in debugging. - shell.setLayoutTestTimeout(0x20000000); - } - shell.initialize(); - if (serverMode && !tests.size()) { -#if OS(ANDROID) - // Send a signal to host to indicate DRT is ready to process commands. - puts("#READY"); - fflush(stdout); -#endif - params.printSeparators = true; - char testString[2048]; // 2048 is the same as the sizes of other platforms. - while (fgets(testString, sizeof(testString), stdin)) { - char* newLinePosition = strchr(testString, '\n'); - if (newLinePosition) - *newLinePosition = '\0'; - if (testString[0] == '\0') - continue; - // Explicitly quit on platforms where EOF is not reliable. - if (!strcmp(testString, "QUIT")) - break; - runTest(shell, params, testString, dumpAllPixels); - } - } else if (!tests.size()) - puts("#EOF"); - else { - params.printSeparators = tests.size() > 1; - for (unsigned i = 0; i < tests.size(); i++) - runTest(shell, params, tests[i], dumpAllPixels); - } - - shell.callJSGC(); - shell.callJSGC(); - - // When we finish the last test, cleanup the DRTTestRunner. - // It may have references to not-yet-cleaned up windows. By cleaning up - // here we help purify reports. - shell.resetTestController(); - } - - // Shutdown WebCompositor after TestShell is destructed properly. - WebKit::Platform::current()->compositorSupport()->shutdown(); - - return EXIT_SUCCESS; -} diff --git a/Tools/DumpRenderTree/chromium/ImageDiff.cpp b/Tools/DumpRenderTree/chromium/ImageDiff.cpp deleted file mode 100644 index 906813d9c..000000000 --- a/Tools/DumpRenderTree/chromium/ImageDiff.cpp +++ /dev/null @@ -1,515 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file input format is based loosely on -// WebKitTools/DumpRenderTree/ImageDiff.m - -// The exact format of this tool's output to stdout is important, to match -// what the run-webkit-tests script expects. - -#include "webkit/support/webkit_support_gfx.h" -#include <algorithm> -#include <iterator> -#include <limits.h> -#include <stdio.h> -#include <string.h> -#include <vector> - -#if defined(_WIN32) -#include <windows.h> -#define PATH_MAX MAX_PATH -#define strtok_r strtok_s -#endif - -// Define macro here to make ImageDiff independent of WTF. -#ifdef NDEBUG -#define ASSERT(assertion) do { } while (0) -#else -#define ASSERT(assertion) do \ - if (!(assertion)) { \ - fprintf(stderr, "ASSERT failed at %s:%d: " #assertion ".", __FILE__, __LINE__); \ - exit(1); \ - } \ -while (0) -#endif - -using namespace std; - -// Causes the app to remain open, waiting for pairs of filenames on stdin. -// The caller is then responsible for terminating this app. -static const char optionPollStdin[] = "--use-stdin"; -static const char optionGenerateDiff[] = "--diff"; - -// If --diff is passed, causes the app to output the image difference -// metric (percentageDifferent()) on stdout. -static const char optionWrite[] = "--write-image-diff-metrics"; - -// Use weightedPercentageDifferent() instead of the default image -// comparator proc. -static const char optionWeightedIntensity[] = "--weighted-intensity"; - -// Return codes used by this utility. -static const int statusSame = 0; -static const int statusDifferent = 1; -static const int statusError = 2; - -// Color codes. -static const unsigned int rgbaRed = 0x000000ff; -static const unsigned int rgbaAlpha = 0xff000000; - -class Image { -public: - Image() - : m_width(0) - , m_height(0) { } - - Image(const Image& image) - : m_width(image.m_width) - , m_height(image.m_height) - , m_data(image.m_data) { } - - bool hasImage() const { return m_width > 0 && m_height > 0; } - int width() const { return m_width; } - int height() const { return m_height; } - const unsigned char* data() const { return &m_data.front(); } - - // Creates the image from stdin with the given data length. On success, it - // will return true. On failure, no other methods should be accessed. - bool createFromStdin(size_t byteLength) - { - if (!byteLength) - return false; - - unsigned char* source = new unsigned char[byteLength]; - if (fread(source, 1, byteLength, stdin) != byteLength) { - delete [] source; - return false; - } - - if (!webkit_support::DecodePNG(source, byteLength, &m_data, &m_width, &m_height)) { - delete [] source; - clear(); - return false; - } - delete [] source; - return true; - } - - // Creates the image from the given filename on disk, and returns true on - // success. - bool createFromFilename(const char* filename) - { - FILE* f = fopen(filename, "rb"); - if (!f) - return false; - - vector<unsigned char> compressed; - const int bufSize = 1024; - unsigned char buf[bufSize]; - size_t numRead = 0; - while ((numRead = fread(buf, 1, bufSize, f)) > 0) - std::copy(buf, &buf[numRead], std::back_inserter(compressed)); - - fclose(f); - - if (!webkit_support::DecodePNG(&compressed[0], compressed.size(), &m_data, &m_width, &m_height)) { - clear(); - return false; - } - return true; - } - - void clear() - { - m_width = m_height = 0; - m_data.clear(); - } - - // Returns the RGBA value of the pixel at the given location - const unsigned int pixelAt(int x, int y) const - { - ASSERT(x >= 0 && x < m_width); - ASSERT(y >= 0 && y < m_height); - return *reinterpret_cast<const unsigned int*>(&(m_data[(y * m_width + x) * 4])); - } - - void setPixelAt(int x, int y, unsigned int color) const - { - ASSERT(x >= 0 && x < m_width); - ASSERT(y >= 0 && y < m_height); - void* addr = &const_cast<unsigned char*>(&m_data.front())[(y * m_width + x) * 4]; - *reinterpret_cast<unsigned int*>(addr) = color; - } - -private: - // pixel dimensions of the image - int m_width, m_height; - - vector<unsigned char> m_data; -}; - -typedef float (*ImageComparisonProc) (const Image&, const Image&); - -float percentageDifferent(const Image& baseline, const Image& actual) -{ - int w = min(baseline.width(), actual.width()); - int h = min(baseline.height(), actual.height()); - - // Compute pixels different in the overlap - int pixelsDifferent = 0; - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { - if (baseline.pixelAt(x, y) != actual.pixelAt(x, y)) - pixelsDifferent++; - } - } - - // Count pixels that are a difference in size as also being different - int maxWidth = max(baseline.width(), actual.width()); - int maxHeight = max(baseline.height(), actual.height()); - - // ...pixels off the right side, but not including the lower right corner - pixelsDifferent += (maxWidth - w) * h; - - // ...pixels along the bottom, including the lower right corner - pixelsDifferent += (maxHeight - h) * maxWidth; - - // Like the WebKit ImageDiff tool, we define percentage different in terms - // of the size of the 'actual' bitmap. - float totalPixels = static_cast<float>(actual.width()) * static_cast<float>(actual.height()); - if (!totalPixels) - return 100.0f; // When the bitmap is empty, they are 100% different. - return static_cast<float>(pixelsDifferent) / totalPixels * 100; -} - -inline unsigned int maxOf3(unsigned int a, unsigned int b, unsigned int c) -{ - if (a < b) - return std::max(b, c); - return std::max(a, c); -} - -inline unsigned int getRedComponent(unsigned int color) -{ - return (color << 24) >> 24; -} - -inline unsigned int getGreenComponent(unsigned int color) -{ - return (color << 16) >> 24; -} - -inline unsigned int getBlueComponent(unsigned int color) -{ - return (color << 8) >> 24; -} - -/// Rank small-pixel-count high-intensity changes as more important than -/// large-pixel-count low-intensity changes. -float weightedPercentageDifferent(const Image& baseline, const Image& actual) -{ - int w = min(baseline.width(), actual.width()); - int h = min(baseline.height(), actual.height()); - - float weightedPixelsDifferent = 0; - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { - unsigned int actualColor = actual.pixelAt(x, y); - unsigned int baselineColor = baseline.pixelAt(x, y); - if (baselineColor != actualColor) { - unsigned int actualR = getRedComponent(actualColor); - unsigned int actualG = getGreenComponent(actualColor); - unsigned int actualB = getBlueComponent(actualColor); - unsigned int baselineR = getRedComponent(baselineColor); - unsigned int baselineG = getGreenComponent(baselineColor); - unsigned int baselineB = getBlueComponent(baselineColor); - unsigned int deltaR = std::max(actualR, baselineR) - - std::min(actualR, baselineR); - unsigned int deltaG = std::max(actualG, baselineG) - - std::min(actualG, baselineG); - unsigned int deltaB = std::max(actualB, baselineB) - - std::min(actualB, baselineB); - weightedPixelsDifferent += - static_cast<float>(maxOf3(deltaR, deltaG, deltaB)) / 255; - } - } - } - - int maxWidth = max(baseline.width(), actual.width()); - int maxHeight = max(baseline.height(), actual.height()); - - weightedPixelsDifferent += (maxWidth - w) * h; - - weightedPixelsDifferent += (maxHeight - h) * maxWidth; - - float totalPixels = static_cast<float>(actual.width()) - * static_cast<float>(actual.height()); - if (!totalPixels) - return 100.0f; - return weightedPixelsDifferent / totalPixels * 100; -} - - -void printHelp() -{ - fprintf(stderr, - "Usage:\n" - " ImageDiff <compare file> <reference file>\n" - " Compares two files on disk, returning 0 when they are the same\n" - " ImageDiff --use-stdin\n" - " Stays open reading pairs of filenames from stdin, comparing them,\n" - " and sending 0 to stdout when they are the same\n" - " ImageDiff --diff <compare file> <reference file> <output file>\n" - " Compares two files on disk, outputs an image that visualizes the" - " difference to <output file>\n" - " --write-image-diff-metrics prints a difference metric to stdout\n" - " --weighted-intensity weights the difference metric by intensity\n" - " at each pixel\n"); - /* For unfinished webkit-like-mode (see below) - "\n" - " ImageDiff -s\n" - " Reads stream input from stdin, should be EXACTLY of the format\n" - " \"Content-length: <byte length> <data>Content-length: ...\n" - " it will take as many file pairs as given, and will compare them as\n" - " (cmp_file, reference_file) pairs\n"); - */ -} - -int compareImages(const char* file1, const char* file2, - ImageComparisonProc comparator) -{ - Image actualImage; - Image baselineImage; - - if (!actualImage.createFromFilename(file1)) { - fprintf(stderr, "ImageDiff: Unable to open file \"%s\"\n", file1); - return statusError; - } - if (!baselineImage.createFromFilename(file2)) { - fprintf(stderr, "ImageDiff: Unable to open file \"%s\"\n", file2); - return statusError; - } - - float percent = (*comparator)(actualImage, baselineImage); - if (percent > 0.0) { - // failure: The WebKit version also writes the difference image to - // stdout, which seems excessive for our needs. - printf("diff: %01.2f%% failed\n", percent); - return statusDifferent; - } - - // success - printf("diff: %01.2f%% passed\n", percent); - return statusSame; - -} - -// Untested mode that acts like WebKit's image comparator. I wrote this but -// decided it's too complicated. We may use it in the future if it looks useful. -int untestedCompareImages(ImageComparisonProc comparator) -{ - Image actualImage; - Image baselineImage; - char buffer[2048]; - while (fgets(buffer, sizeof(buffer), stdin)) { - if (!strncmp("Content-length: ", buffer, 16)) { - char* context; - strtok_r(buffer, " ", &context); - int imageSize = strtol(strtok_r(0, " ", &context), 0, 10); - - bool success = false; - if (imageSize > 0 && !actualImage.hasImage()) { - if (!actualImage.createFromStdin(imageSize)) { - fputs("Error, input image can't be decoded.\n", stderr); - return 1; - } - } else if (imageSize > 0 && !baselineImage.hasImage()) { - if (!baselineImage.createFromStdin(imageSize)) { - fputs("Error, baseline image can't be decoded.\n", stderr); - return 1; - } - } else { - fputs("Error, image size must be specified.\n", stderr); - return 1; - } - } - - if (actualImage.hasImage() && baselineImage.hasImage()) { - float percent = (*comparator)(actualImage, baselineImage); - if (percent > 0.0) { - // failure: The WebKit version also writes the difference image to - // stdout, which seems excessive for our needs. - printf("diff: %01.2f%% failed\n", percent); - } else { - // success - printf("diff: %01.2f%% passed\n", percent); - } - actualImage.clear(); - baselineImage.clear(); - } - fflush(stdout); - } - return 0; -} - -bool createImageDiff(const Image& image1, const Image& image2, Image* out) -{ - int w = min(image1.width(), image2.width()); - int h = min(image1.height(), image2.height()); - *out = Image(image1); - bool same = (image1.width() == image2.width()) && (image1.height() == image2.height()); - - // FIXME: do something with the extra pixels if the image sizes are different. - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { - unsigned int basePixel = image1.pixelAt(x, y); - if (basePixel != image2.pixelAt(x, y)) { - // Set differing pixels red. - out->setPixelAt(x, y, rgbaRed | rgbaAlpha); - same = false; - } else { - // Set same pixels as faded. - unsigned int alpha = basePixel & rgbaAlpha; - unsigned int newPixel = basePixel - ((alpha / 2) & rgbaAlpha); - out->setPixelAt(x, y, newPixel); - } - } - } - - return same; -} - -static bool writeFile(const char* outFile, const unsigned char* data, size_t dataSize) -{ - FILE* file = fopen(outFile, "wb"); - if (!file) { - fprintf(stderr, "ImageDiff: Unable to create file \"%s\"\n", outFile); - return false; - } - if (dataSize != fwrite(data, 1, dataSize, file)) { - fclose(file); - fprintf(stderr, "ImageDiff: Unable to write data to file \"%s\"\n", outFile); - return false; - } - fclose(file); - return true; -} - -int diffImages(const char* file1, const char* file2, const char* outFile, - bool shouldWritePercentages, ImageComparisonProc comparator) -{ - Image actualImage; - Image baselineImage; - - if (!actualImage.createFromFilename(file1)) { - fprintf(stderr, "ImageDiff: Unable to open file \"%s\"\n", file1); - return statusError; - } - if (!baselineImage.createFromFilename(file2)) { - fprintf(stderr, "ImageDiff: Unable to open file \"%s\"\n", file2); - return statusError; - } - - Image diffImage; - bool same = createImageDiff(baselineImage, actualImage, &diffImage); - if (same) - return statusSame; - - vector<unsigned char> pngData; - webkit_support::EncodeRGBAPNG(diffImage.data(), diffImage.width(), diffImage.height(), - diffImage.width() * 4, &pngData); - if (!writeFile(outFile, &pngData.front(), pngData.size())) - return statusError; - - if (shouldWritePercentages) { - float percent = (*comparator)(actualImage, baselineImage); - fprintf(stdout, "%.3f\n", percent); - } - - return statusDifferent; -} - -int main(int argc, const char* argv[]) -{ - std::vector<const char*> values; - bool pollStdin = false; - bool generateDiff = false; - bool shouldWritePercentages = false; - ImageComparisonProc comparator = percentageDifferent; - for (int i = 1; i < argc; ++i) { - if (!strcmp(argv[i], optionPollStdin)) - pollStdin = true; - else if (!strcmp(argv[i], optionGenerateDiff)) - generateDiff = true; - else if (!strcmp(argv[i], optionWrite)) - shouldWritePercentages = true; - else if (!strcmp(argv[i], optionWeightedIntensity)) - comparator = weightedPercentageDifferent; - else - values.push_back(argv[i]); - } - - if (pollStdin) { - // Watch stdin for filenames. - const size_t bufferSize = PATH_MAX; - char stdinBuffer[bufferSize]; - char firstName[bufferSize]; - bool haveFirstName = false; - while (fgets(stdinBuffer, bufferSize, stdin)) { - if (!stdinBuffer[0]) - continue; - - if (haveFirstName) { - // compareImages writes results to stdout unless an error occurred. - if (compareImages(firstName, stdinBuffer, - comparator) == statusError) - printf("error\n"); - fflush(stdout); - haveFirstName = false; - } else { - // Save the first filename in another buffer and wait for the second - // filename to arrive via stdin. - strcpy(firstName, stdinBuffer); - haveFirstName = true; - } - } - return 0; - } - - if (generateDiff) { - if (values.size() == 3) - return diffImages(values[0], values[1], values[2], - shouldWritePercentages, comparator); - } else if (values.size() == 2) - return compareImages(argv[1], argv[2], comparator); - - printHelp(); - return statusError; -} diff --git a/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm b/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm deleted file mode 100644 index 5ecac6692..000000000 --- a/Tools/DumpRenderTree/chromium/LayoutTestHelper.mm +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2012 Apple Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <AppKit/AppKit.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> - -// This is a simple helper app that changes the color sync profile to the -// generic profile and back when done. This program is managed by the layout -// test script, so it can do the job for multiple DumpRenderTree while they are -// running layout tests. - -namespace { - -#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - -CFURLRef sUserColorProfileURL; - -void installLayoutTestColorProfile() -{ - // To make sure we get consistent colors (not dependent on the chosen color - // space of the main display), we force the generic RGB color profile. - // This causes a change the user can see. - - CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID()); - - if (!sUserColorProfileURL) { - CFDictionaryRef deviceInfo = ColorSyncDeviceCopyDeviceInfo(kColorSyncDisplayDeviceClass, mainDisplayID); - - if (!deviceInfo) { - NSLog(@"No display attached to system; not setting main display's color profile."); - CFRelease(mainDisplayID); - return; - } - - CFDictionaryRef profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles); - if (profileInfo) { - sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(profileInfo, CFSTR("1")); - CFRetain(sUserColorProfileURL); - } else { - profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncFactoryProfiles); - CFDictionaryRef factoryProfile = (CFDictionaryRef)CFDictionaryGetValue(profileInfo, CFSTR("1")); - sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(factoryProfile, kColorSyncDeviceProfileURL); - CFRetain(sUserColorProfileURL); - } - - CFRelease(deviceInfo); - } - - ColorSyncProfileRef genericRGBProfile = ColorSyncProfileCreateWithName(kColorSyncGenericRGBProfile); - CFErrorRef error; - CFURLRef profileURL = ColorSyncProfileGetURL(genericRGBProfile, &error); - if (!profileURL) { - NSLog(@"Failed to get URL of Generic RGB color profile! Many pixel tests may fail as a result. Error: %@", error); - - if (sUserColorProfileURL) { - CFRelease(sUserColorProfileURL); - sUserColorProfileURL = 0; - } - - CFRelease(genericRGBProfile); - CFRelease(mainDisplayID); - return; - } - - CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, profileURL); - - if (!ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo)) { - NSLog(@"Failed to set color profile for main display! Many pixel tests may fail as a result."); - - if (sUserColorProfileURL) { - CFRelease(sUserColorProfileURL); - sUserColorProfileURL = 0; - } - } - - CFRelease(profileInfo); - CFRelease(genericRGBProfile); - CFRelease(mainDisplayID); -} - -void restoreUserColorProfile(void) -{ - // This is used as a signal handler, and thus the calls into ColorSync are unsafe. - // But we might as well try to restore the user's color profile, we're going down anyway... - - if (!sUserColorProfileURL) - return; - - CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID()); - CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, sUserColorProfileURL); - ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo); - CFRelease(mainDisplayID); - CFRelease(profileInfo); -} - -#else // For Snow Leopard and before, use older CM* API. - -const char colorProfilePath[] = "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"; - -CMProfileLocation initialColorProfileLocation; // The locType field is initialized to 0 which is the same as cmNoProfileBase. - -void installLayoutTestColorProfile() -{ - // To make sure we get consistent colors (not dependent on the Main display), - // we force the generic rgb color profile. This cases a change the user can - // see. - const CMDeviceScope scope = { kCFPreferencesCurrentUser, kCFPreferencesCurrentHost }; - - CMProfileRef profile = 0; - int error = CMGetProfileByAVID((CMDisplayIDType)kCGDirectMainDisplay, &profile); - if (!error) { - UInt32 size = sizeof(initialColorProfileLocation); - error = NCMGetProfileLocation(profile, &initialColorProfileLocation, &size); - CMCloseProfile(profile); - } - if (error) { - NSLog(@"failed to get the current color profile, pixmaps won't match. Error: %d", (int)error); - initialColorProfileLocation.locType = cmNoProfileBase; - return; - } - - CMProfileLocation location; - location.locType = cmPathBasedProfile; - strncpy(location.u.pathLoc.path, colorProfilePath, sizeof(location.u.pathLoc.path)); - error = CMSetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)kCGDirectMainDisplay, &scope, cmDefaultProfileID, &location); - if (error) { - NSLog(@"failed install the generic color profile, pixmaps won't match. Error: %d", (int)error); - initialColorProfileLocation.locType = cmNoProfileBase; - } -} - -void restoreUserColorProfile(void) -{ - // This is used as a signal handler, and thus the calls into ColorSync are unsafe. - // But we might as well try to restore the user's color profile, we're going down anyway... - if (initialColorProfileLocation.locType != cmNoProfileBase) { - const CMDeviceScope scope = { kCFPreferencesCurrentUser, kCFPreferencesCurrentHost }; - int error = CMSetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)kCGDirectMainDisplay, &scope, cmDefaultProfileID, &initialColorProfileLocation); - if (error) { - NSLog(@"Failed to restore color profile, use System Preferences -> Displays -> Color to reset. Error: %d", (int)error); - } - initialColorProfileLocation.locType = cmNoProfileBase; - } -} - -#endif - -void simpleSignalHandler(int sig) -{ - // Try to restore the color profile and try to go down cleanly - restoreUserColorProfile(); - exit(128 + sig); -} - -} // namespace - -int main(int argc, char* argv[]) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - // Hooks the ways we might get told to clean up... - signal(SIGINT, simpleSignalHandler); - signal(SIGHUP, simpleSignalHandler); - signal(SIGTERM, simpleSignalHandler); - - // Save off the current profile, and then install the layout test profile. - installLayoutTestColorProfile(); - - // Let the script know we're ready - printf("ready\n"); - fflush(stdout); - - // Wait for any key (or signal) - getchar(); - - // Restore the profile - restoreUserColorProfile(); - - [pool release]; - return 0; -} diff --git a/Tools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp b/Tools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp deleted file mode 100644 index 25efdcdcb..000000000 --- a/Tools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> - -static BOOL fontSmoothingEnabled = FALSE; - -static void saveInitialSettings(void) -{ - ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothingEnabled, 0); -} - -// Technically, all we need to do is disable ClearType. However, -// for some reason, the call to SPI_SETFONTSMOOTHINGTYPE doesn't -// seem to work, so we just disable font smoothing all together -// (which works reliably) -static void installLayoutTestSettings(void) -{ - ::SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, 0, 0); -} - -static void restoreInitialSettings(void) -{ - ::SystemParametersInfo(SPI_SETFONTSMOOTHING, static_cast<UINT>(fontSmoothingEnabled), 0, 0); -} - -static void simpleSignalHandler(int signalNumber) -{ - // Try to restore the settings and then go down cleanly - restoreInitialSettings(); - exit(128 + signalNumber); -} - -int main(int, char*[]) -{ - // Hooks the ways we might get told to clean up... - signal(SIGINT, simpleSignalHandler); - signal(SIGTERM, simpleSignalHandler); - - saveInitialSettings(); - - installLayoutTestSettings(); - - // Let the script know we're ready - printf("ready\n"); - fflush(stdout); - - // Wait for any key (or signal) - getchar(); - - restoreInitialSettings(); - - return EXIT_SUCCESS; -} diff --git a/Tools/DumpRenderTree/chromium/MockConstraints.cpp b/Tools/DumpRenderTree/chromium/MockConstraints.cpp deleted file mode 100644 index a4f15842e..000000000 --- a/Tools/DumpRenderTree/chromium/MockConstraints.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#if ENABLE(MEDIA_STREAM) - -#include "MockConstraints.h" - -#include <public/WebMediaConstraints.h> - -using namespace WebKit; - -namespace MockConstraints { - -static bool isSupported(const WebString& constraint) -{ - return constraint == "valid_and_supported_1" || constraint == "valid_and_supported_2"; -} - -static bool isValid(const WebString& constraint) -{ - return isSupported(constraint) || constraint == "valid_but_unsupported_1" || constraint == "valid_but_unsupported_2"; -} - -bool verifyConstraints(const WebMediaConstraints& constraints) -{ - WebVector<WebMediaConstraint> mandatoryConstraints; - constraints.getMandatoryConstraints(mandatoryConstraints); - if (mandatoryConstraints.size()) { - for (size_t i = 0; i < mandatoryConstraints.size(); ++i) { - const WebMediaConstraint& curr = mandatoryConstraints[i]; - if (!isSupported(curr.m_name) || curr.m_value != "1") - return false; - } - } - - WebVector<WebMediaConstraint> optionalConstraints; - constraints.getOptionalConstraints(optionalConstraints); - if (optionalConstraints.size()) { - for (size_t i = 0; i < optionalConstraints.size(); ++i) { - const WebMediaConstraint& curr = optionalConstraints[i]; - if (!isValid(curr.m_name) || curr.m_value != "0") - return false; - } - } - - return true; -} - -} // namespace MockConstraints - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockConstraints.h b/Tools/DumpRenderTree/chromium/MockConstraints.h deleted file mode 100644 index 6bf0da9b1..000000000 --- a/Tools/DumpRenderTree/chromium/MockConstraints.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockConstraints_h -#define MockConstraints_h - -#if ENABLE(MEDIA_STREAM) - -namespace WebKit { -class WebMediaConstraints; -} - -namespace MockConstraints { - -bool verifyConstraints(const WebKit::WebMediaConstraints&); - -} // namespace MockConstraints - -#endif // ENABLE(MEDIA_STREAM) - -#endif // MockConstraints_h - diff --git a/Tools/DumpRenderTree/chromium/MockGrammarCheck.cpp b/Tools/DumpRenderTree/chromium/MockGrammarCheck.cpp deleted file mode 100644 index e004476ed..000000000 --- a/Tools/DumpRenderTree/chromium/MockGrammarCheck.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockGrammarCheck.h" - -#include "WebTextCheckingResult.h" -#include "platform/WebString.h" - -#include <wtf/ASCIICType.h> -#include <wtf/Assertions.h> -#include <wtf/text/WTFString.h> - -using namespace WebKit; - -bool MockGrammarCheck::checkGrammarOfString(const WebString& text, Vector<WebTextCheckingResult>* results) -{ - ASSERT(results); - WTF::String stringText(text.data(), text.length()); - if (stringText.find(isASCIIAlpha) == static_cast<size_t>(-1)) - return true; - - // Find matching grammatical errors from known ones. This function has to - // check all errors because the given text may consist of two or more - // sentences that have grammatical errors. - static const struct { - const char* text; - int location; - int length; - } grammarErrors[] = { - {"I have a issue.", 7, 1}, - {"I have an grape.", 7, 2}, - {"I have an kiwi.", 7, 2}, - {"I have an muscat.", 7, 2}, - {"You has the right.", 4, 3}, - {"apple orange zz.", 0, 16}, - {"apple zz orange.", 0, 16}, - {"apple,zz,orange.", 0, 16}, - {"orange,zz,apple.", 0, 16}, - {"the the adlj adaasj sdklj. there there", 0, 38}, - {"zz apple orange.", 0, 16}, - }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(grammarErrors); ++i) { - int offset = 0; - while ((offset = stringText.find(grammarErrors[i].text, offset)) != -1) { - results->append(WebTextCheckingResult(WebTextCheckingTypeGrammar, offset + grammarErrors[i].location, grammarErrors[i].length)); - offset += grammarErrors[i].length; - } - } - return false; -} diff --git a/Tools/DumpRenderTree/chromium/MockGrammarCheck.h b/Tools/DumpRenderTree/chromium/MockGrammarCheck.h deleted file mode 100644 index 64271b3fa..000000000 --- a/Tools/DumpRenderTree/chromium/MockGrammarCheck.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockGrammarCheck_h -#define MockGrammarCheck_h - -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - -namespace WebKit { - -class WebString; -struct WebTextCheckingResult; - -} - -// A mock implementation of a grammar-checker used for WebKit tests. This class -// only implements the minimal functionarities required by WebKit tests, i.e. -// this class just compares the given string with known grammar mistakes in -// webkit tests and adds grammar markers on them. Even though this is sufficent -// for webkit tests, this class is not suitable for any other usages. -class MockGrammarCheck { -public: - static bool checkGrammarOfString(const WebKit::WebString&, Vector<WebKit::WebTextCheckingResult>*); -}; - -#endif // MockSpellCheck_h diff --git a/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp b/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp deleted file mode 100644 index 7593c7190..000000000 --- a/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockSpellCheck.h" - -#include <wtf/ASCIICType.h> -#include <wtf/Assertions.h> -#include <wtf/text/WTFString.h> - -using namespace WebKit; - -MockSpellCheck::MockSpellCheck() - : m_initialized(false) { } - -MockSpellCheck::~MockSpellCheck() { } - -static bool isNotASCIIAlpha(UChar ch) { return !isASCIIAlpha(ch); } - -bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset, int* misspelledLength) -{ - ASSERT(misspelledOffset); - ASSERT(misspelledLength); - - // Initialize this spellchecker. - initializeIfNeeded(); - - // Reset the result values as our spellchecker does. - *misspelledOffset = 0; - *misspelledLength = 0; - - // Convert to a String because we store String instances in - // m_misspelledWords and WebString has no find(). - WTF::String stringText(text.data(), text.length()); - int skippedLength = 0; - - while (!stringText.isEmpty()) { - // Extract the first possible English word from the given string. - // The given string may include non-ASCII characters or numbers. So, we - // should filter out such characters before start looking up our - // misspelled-word table. - // (This is a simple version of our SpellCheckWordIterator class.) - // If the given string doesn't include any ASCII characters, we can treat the - // string as valid one. - // Unfortunately, This implementation splits a contraction, i.e. "isn't" is - // split into two pieces "isn" and "t". This is OK because webkit tests - // don't have misspelled contractions. - int wordOffset = stringText.find(isASCIIAlpha); - if (wordOffset == -1) - return true; - int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset); - int wordLength = wordEnd == -1 ? static_cast<int>(stringText.length()) - wordOffset : wordEnd - wordOffset; - - // Look up our misspelled-word table to check if the extracted word is a - // known misspelled word, and return the offset and the length of the - // extracted word if this word is a known misspelled word. - // (See the comment in MockSpellCheck::initializeIfNeeded() why we use a - // misspelled-word table.) - WTF::String word = stringText.substring(wordOffset, wordLength); - if (m_misspelledWords.contains(word)) { - *misspelledOffset = wordOffset + skippedLength; - *misspelledLength = wordLength; - break; - } - - ASSERT(0 < wordOffset + wordLength); - stringText = stringText.substring(wordOffset + wordLength); - skippedLength += wordOffset + wordLength; - } - - return false; -} - -void MockSpellCheck::fillSuggestionList(const WebString& word, WebVector<WebString>* suggestions) -{ - if (word == WebString::fromUTF8("wellcome")) { - WebVector<WebString> result(suggestions->size() + 1); - for (size_t i = 0; i < suggestions->size(); ++i) - result[i] = (*suggestions)[i]; - result[suggestions->size()] = WebString::fromUTF8("welcome"); - suggestions->swap(result); - } -} - -bool MockSpellCheck::initializeIfNeeded() -{ - // Exit if we have already initialized this object. - if (m_initialized) - return false; - - // Create a table that consists of misspelled words used in WebKit layout - // tests. - // Since WebKit layout tests don't have so many misspelled words as - // well-spelled words, it is easier to compare the given word with misspelled - // ones than to compare with well-spelled ones. - static const char* misspelledWords[] = { - // These words are known misspelled words in webkit tests. - // If there are other misspelled words in webkit tests, please add them in - // this array. - "foo", - "Foo", - "baz", - "fo", - "LibertyF", - "chello", - "xxxtestxxx", - "XXxxx", - "Textx", - "blockquoted", - "asd", - "Lorem", - "Nunc", - "Curabitur", - "eu", - "adlj", - "adaasj", - "sdklj", - "jlkds", - "jsaada", - "jlda", - "zz", - "contentEditable", - // The following words are used by unit tests. - "ifmmp", - "qwertyuiopasd", - "qwertyuiopasdf", - "wellcome" - }; - - m_misspelledWords.clear(); - for (size_t i = 0; i < arraysize(misspelledWords); ++i) - m_misspelledWords.add(WTF::String::fromUTF8(misspelledWords[i]), false); - - // Mark as initialized to prevent this object from being initialized twice - // or more. - m_initialized = true; - - // Since this MockSpellCheck class doesn't download dictionaries, this - // function always returns false. - return false; -} diff --git a/Tools/DumpRenderTree/chromium/MockSpellCheck.h b/Tools/DumpRenderTree/chromium/MockSpellCheck.h deleted file mode 100644 index b7d07878e..000000000 --- a/Tools/DumpRenderTree/chromium/MockSpellCheck.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockSpellCheck_h -#define MockSpellCheck_h - -#include "platform/WebString.h" -#include "platform/WebVector.h" -#include <wtf/HashMap.h> -#include <wtf/text/StringHash.h> -#include <wtf/text/WTFString.h> - -// A mock implementation of a spell-checker used for WebKit tests. -// This class only implements the minimal functionarities required by WebKit -// tests, i.e. this class just compares the given string with known misspelled -// words in webkit tests and mark them as missspelled. -// Even though this is sufficent for webkit tests, this class is not suitable -// for any other usages. -class MockSpellCheck { -public: - MockSpellCheck(); - ~MockSpellCheck(); - - // Checks the spellings of the specified text. - // This function returns true if the text consists of valid words, and - // returns false if it includes invalid words. - // When the given text includes invalid words, this function sets the - // position of the first invalid word to misspelledOffset, and the length of - // the first invalid word to misspelledLength, respectively. - // For example, when the given text is " zz zz", this function sets 3 to - // misspelledOffset and 2 to misspelledLength, respectively. - bool spellCheckWord(const WebKit::WebString& text, - int* misspelledOffset, - int* misspelledLength); - - void fillSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions); - -private: - // Initialize the internal resources if we need to initialize it. - // Initializing this object may take long time. To prevent from hurting - // the performance of test_shell, we initialize this object when - // SpellCheckWord() is called for the first time. - // To be compliant with SpellCheck:InitializeIfNeeded(), this function - // returns true if this object is downloading a dictionary, otherwise - // it returns false. - bool initializeIfNeeded(); - - // A table that consists of misspelled words. - HashMap<WTF::String, bool> m_misspelledWords; - - // A flag representing whether or not this object is initialized. - bool m_initialized; -}; - -#endif // MockSpellCheck_h diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp deleted file mode 100644 index 79ae9f229..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockWebKitPlatformSupport.h" - -#include "MockWebMediaStreamCenter.h" -#include "MockWebRTCPeerConnectionHandler.h" -#include <wtf/Assertions.h> -#include <wtf/PassOwnPtr.h> - -using namespace WebKit; - -PassOwnPtr<MockWebKitPlatformSupport> MockWebKitPlatformSupport::create() -{ - return adoptPtr(new MockWebKitPlatformSupport()); -} - -MockWebKitPlatformSupport::MockWebKitPlatformSupport() -{ -} - -MockWebKitPlatformSupport::~MockWebKitPlatformSupport() -{ -} - -void MockWebKitPlatformSupport::cryptographicallyRandomValues(unsigned char*, size_t) -{ - CRASH(); -} - -#if ENABLE(MEDIA_STREAM) -WebMediaStreamCenter* MockWebKitPlatformSupport::createMediaStreamCenter(WebMediaStreamCenterClient* client) -{ - if (!m_mockMediaStreamCenter) - m_mockMediaStreamCenter = adoptPtr(new MockWebMediaStreamCenter(client)); - - return m_mockMediaStreamCenter.get(); -} - -WebRTCPeerConnectionHandler* MockWebKitPlatformSupport::createRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client) -{ - return new MockWebRTCPeerConnectionHandler(client); -} -#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h deleted file mode 100644 index 1e5443809..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebKitPlatformSupport_h -#define MockWebKitPlatformSupport_h - -#include <public/Platform.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -class MockWebKitPlatformSupport : public WebKit::Platform { -public: - static PassOwnPtr<MockWebKitPlatformSupport> create(); - ~MockWebKitPlatformSupport(); - - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) OVERRIDE; - -#if ENABLE(MEDIA_STREAM) - virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter(WebKit::WebMediaStreamCenterClient*) OVERRIDE; - virtual WebKit::WebRTCPeerConnectionHandler* createRTCPeerConnectionHandler(WebKit::WebRTCPeerConnectionHandlerClient*) OVERRIDE; -#endif // ENABLE(MEDIA_STREAM) - -private: - MockWebKitPlatformSupport(); - -#if ENABLE(MEDIA_STREAM) - OwnPtr<WebKit::WebMediaStreamCenter> m_mockMediaStreamCenter; -#endif // ENABLE(MEDIA_STREAM) -}; - -#endif // MockWebKitPlatformSupport_h diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp deleted file mode 100644 index e0f761934..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#if ENABLE(MEDIA_STREAM) - -#include "MockWebMediaStreamCenter.h" - -#include <public/WebAudioDestinationConsumer.h> -#include <public/WebMediaStreamCenterClient.h> -#include <public/WebMediaStreamComponent.h> -#include <public/WebMediaStreamDescriptor.h> -#include <public/WebMediaStreamSource.h> -#include <public/WebMediaStreamSourcesRequest.h> -#include <public/WebVector.h> - -using namespace WebKit; - -MockWebMediaStreamCenter::MockWebMediaStreamCenter(WebMediaStreamCenterClient* client) -{ -} - -void MockWebMediaStreamCenter::queryMediaStreamSources(const WebMediaStreamSourcesRequest& request) -{ - WebVector<WebMediaStreamSource> audioSources, videoSources; - request.didCompleteQuery(audioSources, videoSources); -} - -void MockWebMediaStreamCenter::didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent& component) -{ - component.source().setReadyState(WebMediaStreamSource::ReadyStateLive); -} - -void MockWebMediaStreamCenter::didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent& component) -{ - component.source().setReadyState(WebMediaStreamSource::ReadyStateMuted); -} - -bool MockWebMediaStreamCenter::didAddMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) -{ - return true; -}; - -bool MockWebMediaStreamCenter::didRemoveMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) -{ - return true; -}; - -void MockWebMediaStreamCenter::didStopLocalMediaStream(const WebMediaStreamDescriptor& stream) -{ - WebVector<WebMediaStreamComponent> audioComponents; - stream.audioSources(audioComponents); - for (size_t i = 0; i < audioComponents.size(); ++i) - audioComponents[i].source().setReadyState(WebMediaStreamSource::ReadyStateEnded); - - WebVector<WebMediaStreamComponent> videoComponents; - stream.videoSources(videoComponents); - for (size_t i = 0; i < videoComponents.size(); ++i) - videoComponents[i].source().setReadyState(WebMediaStreamSource::ReadyStateEnded); -} - -class MockWebAudioDestinationConsumer : public WebAudioDestinationConsumer { -public: - virtual ~MockWebAudioDestinationConsumer() { } - virtual void consumeAudio(const WebVector<const float*>&, size_t number_of_frames) OVERRIDE { } -}; - -void MockWebMediaStreamCenter::didCreateMediaStream(WebMediaStreamDescriptor& stream) -{ - WebVector<WebMediaStreamComponent> audioComponents; - stream.audioSources(audioComponents); - for (size_t i = 0; i < audioComponents.size(); ++i) { - WebMediaStreamSource source = audioComponents[i].source(); - if (source.requiresAudioConsumer()) { - MockWebAudioDestinationConsumer* consumer = new MockWebAudioDestinationConsumer(); - source.addAudioConsumer(consumer); - source.removeAudioConsumer(consumer); - delete consumer; - } - } -} - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h deleted file mode 100644 index 7d532e743..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebMediaStreamCenter_h -#define MockWebMediaStreamCenter_h - -#if ENABLE(MEDIA_STREAM) -#include <public/WebMediaStreamCenter.h> - -namespace WebKit { -class WebMediaStreamCenterClient; -}; - -class MockWebMediaStreamCenter : public WebKit::WebMediaStreamCenter { -public: - explicit MockWebMediaStreamCenter(WebKit::WebMediaStreamCenterClient*); - - virtual void queryMediaStreamSources(const WebKit::WebMediaStreamSourcesRequest&) OVERRIDE; - virtual void didEnableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; - virtual void didDisableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; - virtual bool didAddMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; - virtual bool didRemoveMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE; - virtual void didStopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; - virtual void didCreateMediaStream(WebKit::WebMediaStreamDescriptor&) OVERRIDE; - -private: - MockWebMediaStreamCenter() { } -}; - -#endif // ENABLE(MEDIA_STREAM) -#endif // MockWebMediaStreamCenter_h - diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp deleted file mode 100644 index d667d8865..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockWebPrerenderingSupport.h" - -#include <wtf/Assertions.h> - -MockWebPrerenderingSupport::MockWebPrerenderingSupport() -{ - ASSERT(!current()); - initialize(this); -} - -MockWebPrerenderingSupport::~MockWebPrerenderingSupport() -{ - ASSERT(current() == this); - shutdown(); -} - -void MockWebPrerenderingSupport::add(const WebKit::WebPrerender&) -{ -} - -void MockWebPrerenderingSupport::cancel(const WebKit::WebPrerender&) -{ -} - -void MockWebPrerenderingSupport::abandon(const WebKit::WebPrerender&) -{ -} diff --git a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h b/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h deleted file mode 100644 index b5d4af53d..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebPrerenderingSupport.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebPrerenderingSupport_h -#define MockWebPrerenderingSupport_h - -#include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupport.h" - -class MockWebPrerenderingSupport : public WebKit::WebPrerenderingSupport { -public: - MockWebPrerenderingSupport(); - virtual ~MockWebPrerenderingSupport(); - -private: - void add(const WebKit::WebPrerender&) OVERRIDE; - void cancel(const WebKit::WebPrerender&) OVERRIDE; - void abandon(const WebKit::WebPrerender&) OVERRIDE; -}; - -#endif // MockWebPrerenderingSupport_h diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp deleted file mode 100644 index cfd76de74..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#if ENABLE(MEDIA_STREAM) - -#include "MockWebRTCPeerConnectionHandler.h" - -#include "MockConstraints.h" -#include "Task.h" -#include <public/WebMediaConstraints.h> -#include <public/WebMediaStreamComponent.h> -#include <public/WebMediaStreamDescriptor.h> -#include <public/WebRTCPeerConnectionHandlerClient.h> -#include <public/WebRTCSessionDescription.h> -#include <public/WebRTCSessionDescriptionRequest.h> -#include <public/WebRTCStatsRequest.h> -#include <public/WebRTCStatsResponse.h> -#include <public/WebRTCVoidRequest.h> -#include <public/WebString.h> -#include <public/WebVector.h> -#include <wtf/DateMath.h> - -using namespace WebKit; -using namespace WebTestRunner; - -class RTCSessionDescriptionRequestSuccededTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - RTCSessionDescriptionRequestSuccededTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request, const WebRTCSessionDescription& result) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_request(request) - , m_result(result) - { - } - - virtual void runIfValid() OVERRIDE - { - m_request.requestSucceeded(m_result); - } - -private: - WebRTCSessionDescriptionRequest m_request; - WebRTCSessionDescription m_result; -}; - -class RTCSessionDescriptionRequestFailedTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - RTCSessionDescriptionRequestFailedTask(MockWebRTCPeerConnectionHandler* object, const WebRTCSessionDescriptionRequest& request) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_request(request) - { - } - - virtual void runIfValid() OVERRIDE - { - m_request.requestFailed("TEST_ERROR"); - } - -private: - WebRTCSessionDescriptionRequest m_request; -}; - -class RTCStatsRequestSucceededTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request, const WebKit::WebRTCStatsResponse& response) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_request(request) - , m_response(response) - { - } - - virtual void runIfValid() OVERRIDE - { - m_request.requestSucceeded(m_response); - } - -private: - WebKit::WebRTCStatsRequest m_request; - WebKit::WebRTCStatsResponse m_response; -}; - -class RTCVoidRequestTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, const WebRTCVoidRequest& request, bool succeeded) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_request(request) - , m_succeeded(succeeded) - { - } - - virtual void runIfValid() OVERRIDE - { - if (m_succeeded) - m_request.requestSucceeded(); - else - m_request.requestFailed("TEST_ERROR"); - } - -private: - WebRTCVoidRequest m_request; - bool m_succeeded; -}; - -class StringDataTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - StringDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const WebString& data) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_dataChannel(dataChannel) - , m_data(data) - { - } - - virtual void runIfValid() OVERRIDE - { - m_dataChannel.dataArrived(m_data); - } - -private: - WebRTCDataChannel m_dataChannel; - WebString m_data; -}; - -class CharPtrDataTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - CharPtrDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const char* data, size_t length) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_dataChannel(dataChannel) - , m_length(length) - { - m_data = new char[m_length]; - memcpy(m_data, data, m_length); - } - - virtual void runIfValid() OVERRIDE - { - m_dataChannel.dataArrived(m_data, m_length); - delete [] m_data; - } - -private: - WebRTCDataChannel m_dataChannel; - char* m_data; - size_t m_length; -}; - -class DataChannelReadyStateTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - DataChannelReadyStateTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, WebRTCDataChannel::ReadyState state) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_dataChannel(dataChannel) - , m_state(state) - { - } - - virtual void runIfValid() OVERRIDE - { - m_dataChannel.readyStateChanged(m_state); - } - -private: - WebRTCDataChannel m_dataChannel; - WebRTCDataChannel::ReadyState m_state; -}; - -class RTCPeerConnectionReadyStateTask : public WebMethodTask<MockWebRTCPeerConnectionHandler> { -public: - RTCPeerConnectionReadyStateTask(MockWebRTCPeerConnectionHandler* object, WebRTCPeerConnectionHandlerClient* client, WebRTCPeerConnectionHandlerClient::ReadyState state) - : WebMethodTask<MockWebRTCPeerConnectionHandler>(object) - , m_client(client) - , m_state(state) - { - } - - virtual void runIfValid() OVERRIDE - { - m_client->didChangeReadyState(m_state); - } - -private: - WebRTCPeerConnectionHandlerClient* m_client; - WebRTCPeerConnectionHandlerClient::ReadyState m_state; -}; - -///////////////////// - -MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client) - : m_client(client) - , m_stopped(false) - , m_streamCount(0) -{ -} - -bool MockWebRTCPeerConnectionHandler::initialize(const WebRTCConfiguration&, const WebMediaConstraints& constraints) -{ - if (MockConstraints::verifyConstraints(constraints)) { - postTask(new RTCPeerConnectionReadyStateTask(this, m_client, WebRTCPeerConnectionHandlerClient::ReadyStateActive)); - return true; - } - - return false; -} - -void MockWebRTCPeerConnectionHandler::createOffer(const WebRTCSessionDescriptionRequest& request, const WebMediaConstraints& constraints) -{ - WebString shouldSucceed; - if (constraints.getMandatoryConstraintValue("succeed", shouldSucceed) && shouldSucceed == "true") { - WebRTCSessionDescription sessionDescription; - sessionDescription.initialize("offer", "local"); - postTask(new RTCSessionDescriptionRequestSuccededTask(this, request, sessionDescription)); - } else - postTask(new RTCSessionDescriptionRequestFailedTask(this, request)); -} - -void MockWebRTCPeerConnectionHandler::createAnswer(const WebRTCSessionDescriptionRequest& request, const WebMediaConstraints&) -{ - if (!m_remoteDescription.isNull()) { - WebRTCSessionDescription sessionDescription; - sessionDescription.initialize("answer", "local"); - postTask(new RTCSessionDescriptionRequestSuccededTask(this, request, sessionDescription)); - } else - postTask(new RTCSessionDescriptionRequestFailedTask(this, request)); -} - -void MockWebRTCPeerConnectionHandler::setLocalDescription(const WebRTCVoidRequest& request, const WebRTCSessionDescription& localDescription) -{ - if (!localDescription.isNull() && localDescription.sdp() == "local") { - m_localDescription = localDescription; - postTask(new RTCVoidRequestTask(this, request, true)); - } else - postTask(new RTCVoidRequestTask(this, request, false)); -} - -void MockWebRTCPeerConnectionHandler::setRemoteDescription(const WebRTCVoidRequest& request, const WebRTCSessionDescription& remoteDescription) -{ - if (!remoteDescription.isNull() && remoteDescription.sdp() == "remote") { - m_remoteDescription = remoteDescription; - postTask(new RTCVoidRequestTask(this, request, true)); - } else - postTask(new RTCVoidRequestTask(this, request, false)); -} - -WebRTCSessionDescription MockWebRTCPeerConnectionHandler::localDescription() -{ - return m_localDescription; -} - -WebRTCSessionDescription MockWebRTCPeerConnectionHandler::remoteDescription() -{ - return m_remoteDescription; -} - -bool MockWebRTCPeerConnectionHandler::updateICE(const WebRTCConfiguration&, const WebMediaConstraints&) -{ - m_client->didChangeICEState(WebRTCPeerConnectionHandlerClient::ICEStateGathering); - return true; -} - -bool MockWebRTCPeerConnectionHandler::addICECandidate(const WebRTCICECandidate& iceCandidate) -{ - m_client->didGenerateICECandidate(iceCandidate); - return true; -} - -bool MockWebRTCPeerConnectionHandler::addStream(const WebMediaStreamDescriptor& stream, const WebMediaConstraints&) -{ - m_streamCount += 1; - m_client->didAddRemoteStream(stream); - m_client->negotiationNeeded(); - return true; -} - -void MockWebRTCPeerConnectionHandler::removeStream(const WebMediaStreamDescriptor& stream) -{ - m_streamCount -= 1; - m_client->didRemoveRemoteStream(stream); - m_client->negotiationNeeded(); -} - -void MockWebRTCPeerConnectionHandler::getStats(const WebRTCStatsRequest& request) -{ - WebRTCStatsResponse response = request.createResponse(); - double currentDate = WTF::jsCurrentTime(); - if (request.hasSelector()) { - WebMediaStreamDescriptor stream = request.stream(); - WebMediaStreamComponent component = request.component(); - // FIXME: There is no check that the fetched values are valid. - size_t reportIndex = response.addReport(); - response.addElement(reportIndex, true, currentDate); - response.addStatistic(reportIndex, true, "type", "video"); - } else { - for (int i = 0; i < m_streamCount; ++i) { - size_t reportIndex = response.addReport(); - response.addElement(reportIndex, true, currentDate); - response.addStatistic(reportIndex, true, "type", "audio"); - reportIndex = response.addReport(); - response.addElement(reportIndex, true, currentDate); - response.addStatistic(reportIndex, true, "type", "video"); - } - } - postTask(new RTCStatsRequestSucceededTask(this, request, response)); -} - -void MockWebRTCPeerConnectionHandler::stop() -{ - m_stopped = true; -} - -bool MockWebRTCPeerConnectionHandler::openDataChannel(const WebRTCDataChannel& dataChannel) -{ - if (m_stopped) - return false; - - WebRTCDataChannel remoteDataChannel; - remoteDataChannel.initialize("MockRemoteDataChannel", dataChannel.reliable()); - remoteDataChannel.readyStateChanged(WebRTCDataChannel::ReadyStateOpen); - m_client->didAddRemoteDataChannel(remoteDataChannel); - - postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateOpen)); - return true; -} - -void MockWebRTCPeerConnectionHandler::closeDataChannel(const WebRTCDataChannel& dataChannel) -{ - postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateClosed)); -} - -bool MockWebRTCPeerConnectionHandler::sendStringData(const WebRTCDataChannel& dataChannel, const WebString& data) -{ - if (m_stopped) - return false; - - dataChannel.dataArrived(data); - return true; -} - -bool MockWebRTCPeerConnectionHandler::sendRawData(const WebRTCDataChannel& dataChannel, const char* data, size_t length) -{ - if (m_stopped) - return false; - - dataChannel.dataArrived(data, length); - return true; -} - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h deleted file mode 100644 index a1522f4fb..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebRTCPeerConnectionHandler_h -#define MockWebRTCPeerConnectionHandler_h - -#if ENABLE(MEDIA_STREAM) - -#include "WebTask.h" -#include <public/WebRTCDataChannel.h> -#include <public/WebRTCPeerConnectionHandler.h> -#include <public/WebRTCSessionDescription.h> -#include <public/WebRTCSessionDescriptionRequest.h> -#include <public/WebRTCStatsRequest.h> - -namespace WebKit { -class WebRTCPeerConnectionHandlerClient; -}; - -class MockWebRTCPeerConnectionHandler : public WebKit::WebRTCPeerConnectionHandler { -public: - explicit MockWebRTCPeerConnectionHandler(WebKit::WebRTCPeerConnectionHandlerClient*); - - virtual bool initialize(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE; - - virtual void createOffer(const WebKit::WebRTCSessionDescriptionRequest&, const WebKit::WebMediaConstraints&) OVERRIDE; - virtual void createAnswer(const WebKit::WebRTCSessionDescriptionRequest&, const WebKit::WebMediaConstraints&) OVERRIDE; - virtual void setLocalDescription(const WebKit::WebRTCVoidRequest&, const WebKit::WebRTCSessionDescription&) OVERRIDE; - virtual void setRemoteDescription(const WebKit::WebRTCVoidRequest&, const WebKit::WebRTCSessionDescription&) OVERRIDE; - virtual WebKit::WebRTCSessionDescription localDescription() OVERRIDE; - virtual WebKit::WebRTCSessionDescription remoteDescription() OVERRIDE; - virtual bool updateICE(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE; - virtual bool addICECandidate(const WebKit::WebRTCICECandidate&) OVERRIDE; - virtual bool addStream(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaConstraints&) OVERRIDE; - virtual void removeStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; - virtual void getStats(const WebKit::WebRTCStatsRequest&) OVERRIDE; - virtual void stop() OVERRIDE; - - virtual bool openDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE; - virtual bool sendStringData(const WebKit::WebRTCDataChannel&, const WebKit::WebString&) OVERRIDE; - virtual bool sendRawData(const WebKit::WebRTCDataChannel&, const char*, size_t) OVERRIDE; - virtual void closeDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE; - - // WebTask related methods - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - -private: - MockWebRTCPeerConnectionHandler() { } - - WebKit::WebRTCPeerConnectionHandlerClient* m_client; - bool m_stopped; - WebTestRunner::WebTaskList m_taskList; - WebKit::WebRTCSessionDescription m_localDescription; - WebKit::WebRTCSessionDescription m_remoteDescription; - int m_streamCount; -}; - -#endif // ENABLE(MEDIA_STREAM) - -#endif // MockWebRTCPeerConnectionHandler_h - diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp deleted file mode 100644 index 528455bd6..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockWebSpeechInputController.h" - -#include "Task.h" -#include "WebSpeechInputListener.h" -#include "platform/WebCString.h" -#include "platform/WebVector.h" -#include <wtf/text/CString.h> -#include <wtf/text/StringBuilder.h> - -#if ENABLE(INPUT_SPEECH) - -using namespace WebKit; -using namespace WebTestRunner; - -PassOwnPtr<MockWebSpeechInputController> MockWebSpeechInputController::create(WebSpeechInputListener* listener) -{ - return adoptPtr(new MockWebSpeechInputController(listener)); -} - -void MockWebSpeechInputController::addMockRecognitionResult(const WebString& result, double confidence, const WebString& language) -{ - WebSpeechInputResult res; - res.assign(result, confidence); - - if (language.isEmpty()) - m_resultsForEmptyLanguage.append(res); - else { - String langString = String::fromUTF8(language.utf8().data()); - if (!m_recognitionResults.contains(langString)) - m_recognitionResults.set(langString, Vector<WebSpeechInputResult>()); - m_recognitionResults.find(langString)->value.append(res); - } -} - -void MockWebSpeechInputController::setDumpRect(bool dumpRect) -{ - m_dumpRect = dumpRect; -} - -void MockWebSpeechInputController::clearResults() -{ - m_resultsForEmptyLanguage.clear(); - m_recognitionResults.clear(); - m_dumpRect = false; -} - -bool MockWebSpeechInputController::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin) -{ - if (m_speechTask) - return false; - - m_requestId = requestId; - m_requestRect = elementRect; - m_recording = true; - m_language = String::fromUTF8(language.utf8().data()); - - m_speechTask = new SpeechTask(this); - postTask(m_speechTask); - - return true; -} - -void MockWebSpeechInputController::cancelRecognition(int requestId) -{ - if (m_speechTask) { - ASSERT(requestId == m_requestId); - - m_speechTask->stop(); - m_recording = false; - m_listener->didCompleteRecognition(m_requestId); - m_requestId = 0; - } -} - -void MockWebSpeechInputController::stopRecording(int requestId) -{ - ASSERT(requestId == m_requestId); - if (m_speechTask && m_recording) { - m_speechTask->stop(); - speechTaskFired(); - } -} - -MockWebSpeechInputController::MockWebSpeechInputController(WebSpeechInputListener* listener) - : m_listener(listener) - , m_speechTask(0) - , m_recording(false) - , m_requestId(-1) - , m_dumpRect(false) -{ -} - -static WebSpeechInputResultArray makeRectResult(const WebRect& rect) -{ - StringBuilder sb; - sb.append(String::number(rect.x)); - sb.append(","); - sb.append(String::number(rect.y)); - sb.append(","); - sb.append(String::number(rect.width)); - sb.append(","); - sb.append(String::number(rect.height)); - - WebSpeechInputResult res; - res.assign(WebString(sb.characters(), sb.length()), 1.0); - - WebSpeechInputResultArray results; - results.assign(&res, 1); - return results; -} - -void MockWebSpeechInputController::speechTaskFired() -{ - if (m_recording) { - m_recording = false; - m_listener->didCompleteRecording(m_requestId); - - m_speechTask = new SpeechTask(this); - postTask(m_speechTask); - } else { - bool noResultsFound = false; - // We take a copy of the requestId here so that if scripts destroyed the input element - // inside one of the callbacks below, we'll still know what this session's requestId was. - int requestId = m_requestId; - m_requestId = 0; - - if (m_dumpRect) { - m_listener->setRecognitionResult(requestId, makeRectResult(m_requestRect)); - } else if (m_language.isEmpty()) { - // Empty language case must be handled separately to avoid problems with HashMap and empty keys. - if (!m_resultsForEmptyLanguage.isEmpty()) - m_listener->setRecognitionResult(requestId, m_resultsForEmptyLanguage); - else - noResultsFound = true; - } else { - if (m_recognitionResults.contains(m_language)) - m_listener->setRecognitionResult(requestId, m_recognitionResults.get(m_language)); - else - noResultsFound = true; - } - - if (noResultsFound) { - // Can't avoid setting a result even if no result was set for the given language. - // This would avoid generating the events used to check the results and the test would timeout. - String error("error: no result found for language '"); - error.append(m_language); - error.append("'"); - - WebSpeechInputResult res; - res.assign(WebString::fromUTF8(error.utf8().data()), 1.0); - - Vector<WebSpeechInputResult> results; - results.append(res); - - m_listener->setRecognitionResult(requestId, results); - } - } -} - -MockWebSpeechInputController::SpeechTask::SpeechTask(MockWebSpeechInputController* mock) - : WebMethodTask<MockWebSpeechInputController>::WebMethodTask(mock) -{ -} - -void MockWebSpeechInputController::SpeechTask::stop() -{ - m_object->m_speechTask = 0; - cancel(); - delete(this); -} - -void MockWebSpeechInputController::SpeechTask::runIfValid() -{ - m_object->m_speechTask = 0; - m_object->speechTaskFired(); -} - -#endif diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h b/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h deleted file mode 100644 index 075f2541f..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebSpeechInputController_h -#define MockWebSpeechInputController_h - -#if ENABLE(INPUT_SPEECH) - -#include "WebTask.h" -#include "platform/WebRect.h" -#include "WebSpeechInputController.h" -#include "WebSpeechInputResult.h" -#include <wtf/Compiler.h> -#include <wtf/HashMap.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> -#include <wtf/text/AtomicString.h> -#include <wtf/text/StringHash.h> - -namespace WebKit { -class WebSecurityOrigin; -class WebSpeechInputListener; -class WebString; -} - -class MockWebSpeechInputController : public WebKit::WebSpeechInputController { -public: - static PassOwnPtr<MockWebSpeechInputController> create(WebKit::WebSpeechInputListener*); - - void addMockRecognitionResult(const WebKit::WebString& result, double confidence, const WebKit::WebString& language); - void setDumpRect(bool); - void clearResults(); - - // WebSpeechInputController implementation: - virtual bool startRecognition(int requestId, const WebKit::WebRect& elementRect, const WebKit::WebString& language, const WebKit::WebString& grammar, const WebKit::WebSecurityOrigin&) OVERRIDE; - virtual void cancelRecognition(int requestId) OVERRIDE; - virtual void stopRecording(int requestId) OVERRIDE; - - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - -private: - MockWebSpeechInputController(WebKit::WebSpeechInputListener*); - void speechTaskFired(); - - class SpeechTask : public WebTestRunner::WebMethodTask<MockWebSpeechInputController> { - public: - SpeechTask(MockWebSpeechInputController*); - void stop(); - - private: - virtual void runIfValid() OVERRIDE; - }; - - WebKit::WebSpeechInputListener* m_listener; - - WebTestRunner::WebTaskList m_taskList; - SpeechTask* m_speechTask; - - bool m_recording; - int m_requestId; - WebKit::WebRect m_requestRect; - String m_language; - - HashMap<String, Vector<WebKit::WebSpeechInputResult> > m_recognitionResults; - Vector<WebKit::WebSpeechInputResult> m_resultsForEmptyLanguage; - bool m_dumpRect; -}; - -#endif // ENABLE(INPUT_SPEECH) - -#endif // MockWebSpeechInputController_h diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp deleted file mode 100644 index 40d3cb4ba..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MockWebSpeechRecognizer.h" - -#if ENABLE(SCRIPTED_SPEECH) - -#include "Task.h" -#include "WebSpeechRecognitionResult.h" -#include "WebSpeechRecognizerClient.h" - -using namespace WebKit; -using namespace WebTestRunner; - -namespace { - -// Task class for calling a client function that does not take any parameters. -typedef void (WebSpeechRecognizerClient::*ClientFunctionPointer)(const WebSpeechRecognitionHandle&); -class ClientCallTask : public MockWebSpeechRecognizer::Task { -public: - ClientCallTask(MockWebSpeechRecognizer* mock, ClientFunctionPointer function) - : MockWebSpeechRecognizer::Task(mock) - , m_function(function) - { - } - - virtual void run() OVERRIDE { (m_recognizer->client()->*m_function)(m_recognizer->handle()); } - -private: - ClientFunctionPointer m_function; -}; - -// Task for delivering a result event. -class ResultTask : public MockWebSpeechRecognizer::Task { -public: - ResultTask(MockWebSpeechRecognizer* mock, const WebString transcript, float confidence) - : MockWebSpeechRecognizer::Task(mock) - , m_transcript(transcript) - , m_confidence(confidence) - { - } - - virtual void run() OVERRIDE - { - WebVector<WebString> transcripts(static_cast<size_t>(1)); - WebVector<float> confidences(static_cast<size_t>(1)); - transcripts[0] = m_transcript; - confidences[0] = m_confidence; - WebVector<WebSpeechRecognitionResult> finalResults(static_cast<size_t>(1)); - WebVector<WebSpeechRecognitionResult> interimResults; - finalResults[0].assign(transcripts, confidences, true); - - m_recognizer->client()->didReceiveResults(m_recognizer->handle(), finalResults, interimResults); - } - -private: - WebString m_transcript; - float m_confidence; -}; - -// Task for delivering a nomatch event. -class NoMatchTask : public MockWebSpeechRecognizer::Task { -public: - NoMatchTask(MockWebSpeechRecognizer* mock) : MockWebSpeechRecognizer::Task(mock) { } - virtual void run() OVERRIDE { m_recognizer->client()->didReceiveNoMatch(m_recognizer->handle(), WebSpeechRecognitionResult()); } -}; - -// Task for delivering an error event. -class ErrorTask : public MockWebSpeechRecognizer::Task { -public: - ErrorTask(MockWebSpeechRecognizer* mock, int code, const WebString& message) - : MockWebSpeechRecognizer::Task(mock) - , m_code(code) - , m_message(message) - { - } - - virtual void run() OVERRIDE { m_recognizer->client()->didReceiveError(m_recognizer->handle(), m_message, static_cast<WebSpeechRecognizerClient::ErrorCode>(m_code)); } - -private: - int m_code; - WebString m_message; -}; - -} // namespace - -PassOwnPtr<MockWebSpeechRecognizer> MockWebSpeechRecognizer::create() -{ - return adoptPtr(new MockWebSpeechRecognizer()); -} - -void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionParams& params, WebSpeechRecognizerClient* client) -{ - m_wasAborted = false; - m_handle = handle; - m_client = client; - - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStart))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartAudio))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSound))); - - if (!m_mockTranscripts.isEmpty()) { - ASSERT(m_mockTranscripts.size() == m_mockConfidences.size()); - - for (size_t i = 0; i < m_mockTranscripts.size(); ++i) - m_taskQueue.append(adoptPtr(new ResultTask(this, m_mockTranscripts[i], m_mockConfidences[i]))); - - m_mockTranscripts.clear(); - m_mockConfidences.clear(); - } else - m_taskQueue.append(adoptPtr(new NoMatchTask(this))); - - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSound))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndAudio))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); - - startTaskQueue(); -} - -void MockWebSpeechRecognizer::stop(const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* client) -{ - m_handle = handle; - m_client = client; - - // FIXME: Implement. - ASSERT_NOT_REACHED(); -} - -void MockWebSpeechRecognizer::abort(const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* client) -{ - m_handle = handle; - m_client = client; - - clearTaskQueue(); - m_wasAborted = true; - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); - startTaskQueue(); -} - -void MockWebSpeechRecognizer::addMockResult(const WebString& transcript, float confidence) -{ - m_mockTranscripts.append(transcript); - m_mockConfidences.append(confidence); -} - -void MockWebSpeechRecognizer::setError(int code, const WebString& message) -{ - clearTaskQueue(); - m_taskQueue.append(adoptPtr(new ErrorTask(this, code, message))); - m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd))); - startTaskQueue(); -} - -MockWebSpeechRecognizer::MockWebSpeechRecognizer() - : m_wasAborted(false) - , m_taskQueueRunning(false) -{ -} - -MockWebSpeechRecognizer::~MockWebSpeechRecognizer() -{ -} - -void MockWebSpeechRecognizer::startTaskQueue() -{ - if (m_taskQueueRunning) - return; - postTask(new StepTask(this)); - m_taskQueueRunning = true; -} - -void MockWebSpeechRecognizer::clearTaskQueue() -{ - m_taskQueue.clear(); - m_taskQueueRunning = false; -} - -void MockWebSpeechRecognizer::StepTask::runIfValid() -{ - if (m_object->m_taskQueue.isEmpty()) { - m_object->m_taskQueueRunning = false; - return; - } - - OwnPtr<Task> task = m_object->m_taskQueue[0].release(); - m_object->m_taskQueue.remove(0); - task->run(); - - if (m_object->m_taskQueue.isEmpty()) { - m_object->m_taskQueueRunning = false; - return; - } - - postTask(new StepTask(m_object)); -} - -#endif // ENABLE(SCRIPTED_SPEECH) diff --git a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h b/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h deleted file mode 100644 index 419c5e504..000000000 --- a/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MockWebSpeechRecognizer_h -#define MockWebSpeechRecognizer_h - -#if ENABLE(SCRIPTED_SPEECH) - -#include "WebSpeechRecognizer.h" -#include "WebTask.h" -#include <wtf/Compiler.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -namespace WebKit { -class WebSpeechRecognitionHandle; -class WebSpeechRecognitionParams; -class WebSpeechRecognizerClient; -} - -class MockWebSpeechRecognizer : public WebKit::WebSpeechRecognizer { -public: - static PassOwnPtr<MockWebSpeechRecognizer> create(); - ~MockWebSpeechRecognizer(); - - // WebSpeechRecognizer implementation: - virtual void start(const WebKit::WebSpeechRecognitionHandle&, const WebKit::WebSpeechRecognitionParams&, WebKit::WebSpeechRecognizerClient*) OVERRIDE; - virtual void stop(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE; - virtual void abort(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE; - - // Methods accessed by layout tests: - void addMockResult(const WebKit::WebString& transcript, float confidence); - void setError(int code, const WebKit::WebString& message); - bool wasAborted() const { return m_wasAborted; } - - // Methods accessed from Task objects: - WebKit::WebSpeechRecognizerClient* client() { return m_client; } - WebKit::WebSpeechRecognitionHandle& handle() { return m_handle; } - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - - class Task { - public: - Task(MockWebSpeechRecognizer* recognizer) : m_recognizer(recognizer) { } - virtual ~Task() { } - virtual void run() = 0; - protected: - MockWebSpeechRecognizer* m_recognizer; - }; - -private: - MockWebSpeechRecognizer(); - void startTaskQueue(); - void clearTaskQueue(); - - WebTestRunner::WebTaskList m_taskList; - WebKit::WebSpeechRecognitionHandle m_handle; - WebKit::WebSpeechRecognizerClient* m_client; - Vector<WebKit::WebString> m_mockTranscripts; - Vector<float> m_mockConfidences; - bool m_wasAborted; - - // Queue of tasks to be run. - Vector<OwnPtr<Task> > m_taskQueue; - bool m_taskQueueRunning; - - // Task for stepping the queue. - class StepTask : public WebTestRunner::WebMethodTask<MockWebSpeechRecognizer> { - public: - StepTask(MockWebSpeechRecognizer* object) : WebTestRunner::WebMethodTask<MockWebSpeechRecognizer>(object) { } - virtual void runIfValid() OVERRIDE; - }; -}; - -#endif // ENABLE(SCRIPTED_SPEECH) - -#endif // MockWebSpeechRecognizer_h diff --git a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp b/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp deleted file mode 100644 index a21588f74..000000000 --- a/Tools/DumpRenderTree/chromium/NotificationPresenter.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "NotificationPresenter.h" - -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "WebNotification.h" -#include "WebNotificationPermissionCallback.h" -#include "WebSecurityOrigin.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "googleurl/src/gurl.h" -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -using namespace WebKit; - -static WebString identifierForNotification(const WebNotification& notification) -{ - if (notification.isHTML()) - return notification.url().spec().utf16(); - return notification.title(); -} - -static void deferredDisplayDispatch(void* context) -{ - WebNotification* notification = static_cast<WebNotification*>(context); - notification->dispatchDisplayEvent(); - delete notification; -} - -NotificationPresenter::~NotificationPresenter() -{ -} - -void NotificationPresenter::grantPermission(const WebString& origin) -{ - m_allowedOrigins.add(WTF::String(origin.data(), origin.length())); -} - -bool NotificationPresenter::simulateClick(const WebString& title) -{ - WTF::String id(title.data(), title.length()); - if (m_activeNotifications.find(id) == m_activeNotifications.end()) - return false; - - const WebNotification& notification = m_activeNotifications.find(id)->value; - WebNotification eventTarget(notification); - eventTarget.dispatchClickEvent(); - return true; -} - -// The output from all these methods matches what DumpRenderTree produces. -bool NotificationPresenter::show(const WebNotification& notification) -{ - WebString identifier = identifierForNotification(notification); - if (!notification.replaceId().isEmpty()) { - WTF::String replaceId(notification.replaceId().data(), notification.replaceId().length()); - if (m_replacements.find(replaceId) != m_replacements.end()) - printf("REPLACING NOTIFICATION %s\n", - m_replacements.find(replaceId)->value.utf8().data()); - - m_replacements.set(replaceId, WTF::String(identifier.data(), identifier.length())); - } - - if (notification.isHTML()) { - printf("DESKTOP NOTIFICATION: contents at %s\n", - notification.url().spec().data()); - } else { - printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", - notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : "", - notification.iconURL().isEmpty() ? "" : - notification.iconURL().spec().data(), - notification.title().isEmpty() ? "" : - notification.title().utf8().data(), - notification.body().isEmpty() ? "" : - notification.body().utf8().data()); - } - - WTF::String id(identifier.data(), identifier.length()); - m_activeNotifications.set(id, notification); - - webKitPlatformSupport()->callOnMainThread(deferredDisplayDispatch, new WebNotification(notification)); - return true; -} - -void NotificationPresenter::cancel(const WebNotification& notification) -{ - WebString identifier = identifierForNotification(notification); - printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data()); - WebNotification eventTarget(notification); - eventTarget.dispatchCloseEvent(false); - - WTF::String id(identifier.data(), identifier.length()); - m_activeNotifications.remove(id); -} - -void NotificationPresenter::objectDestroyed(const WebKit::WebNotification& notification) -{ - WebString identifier = identifierForNotification(notification); - WTF::String id(identifier.data(), identifier.length()); - m_activeNotifications.remove(id); -} - -WebNotificationPresenter::Permission NotificationPresenter::checkPermission(const WebSecurityOrigin& origin) -{ - // Check with the layout test controller - WebString originString = origin.toString(); - bool allowed = m_allowedOrigins.find(WTF::String(originString.data(), originString.length())) != m_allowedOrigins.end(); - return allowed ? WebNotificationPresenter::PermissionAllowed - : WebNotificationPresenter::PermissionDenied; -} - -void NotificationPresenter::requestPermission( - const WebSecurityOrigin& origin, - WebNotificationPermissionCallback* callback) -{ - printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", - origin.toString().utf8().data()); - callback->permissionRequestComplete(); -} - -#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Tools/DumpRenderTree/chromium/NotificationPresenter.h b/Tools/DumpRenderTree/chromium/NotificationPresenter.h deleted file mode 100644 index e98cc7294..000000000 --- a/Tools/DumpRenderTree/chromium/NotificationPresenter.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef NotificationPresenter_h -#define NotificationPresenter_h - -#include "WebNotification.h" -#include "WebNotificationPresenter.h" -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/text/StringHash.h> -#include <wtf/text/WTFString.h> - -class TestShell; - -// A class that implements WebNotificationPresenter for DRT. -class NotificationPresenter : public WebKit::WebNotificationPresenter { -public: - explicit NotificationPresenter(TestShell*) { } - virtual ~NotificationPresenter(); - - // Called by the DRTTestRunner to simulate a user granting permission. - void grantPermission(const WebKit::WebString& origin); - - // Called by the DRTTestRunner to simulate a user clicking on a notification. - bool simulateClick(const WebKit::WebString& notificationIdentifier); - - // WebKit::WebNotificationPresenter interface - virtual bool show(const WebKit::WebNotification&); - virtual void cancel(const WebKit::WebNotification&); - virtual void objectDestroyed(const WebKit::WebNotification&); - virtual Permission checkPermission(const WebKit::WebSecurityOrigin&); - virtual void requestPermission(const WebKit::WebSecurityOrigin&, WebKit::WebNotificationPermissionCallback*); - - void reset() { m_allowedOrigins.clear(); } - -private: - // Set of allowed origins. - HashSet<WTF::String> m_allowedOrigins; - - // Map of active notifications. - HashMap<WTF::String, WebKit::WebNotification> m_activeNotifications; - - // Map of active replacement IDs to the titles of those notifications - HashMap<WTF::String, WTF::String> m_replacements; -}; - -#endif // NotificationPresenter_h diff --git a/Tools/DumpRenderTree/chromium/Task.cpp b/Tools/DumpRenderTree/chromium/Task.cpp deleted file mode 100644 index a619017f5..000000000 --- a/Tools/DumpRenderTree/chromium/Task.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "Task.h" - -#include "WebKit.h" -#include "WebTask.h" -#include "platform/WebKitPlatformSupport.h" -#include "webkit/support/webkit_support.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -using namespace WebKit; -using namespace WebTestRunner; - -namespace { - -void invokeTask(void* context) -{ - WebTask* task = static_cast<WebTask*>(context); - task->run(); - delete task; -} - -class TaskWrapper : public webkit_support::TaskAdaptor { -public: - explicit TaskWrapper(WebTask* task) - : m_task(adoptPtr(task)) - { - } - virtual ~TaskWrapper() { } - virtual void Run() - { - m_task->run(); - } - -private: - OwnPtr<WebTask> m_task; -}; - -} - -void postTask(WebTask* task) -{ - webKitPlatformSupport()->callOnMainThread(invokeTask, static_cast<void*>(task)); -} - -void postDelayedTask(WebTask* task, long long ms) -{ - webkit_support::PostDelayedTask(new TaskWrapper(task), ms); -} diff --git a/Tools/DumpRenderTree/chromium/Task.h b/Tools/DumpRenderTree/chromium/Task.h deleted file mode 100644 index c8755a83c..000000000 --- a/Tools/DumpRenderTree/chromium/Task.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef Task_h -#define Task_h - -namespace WebTestRunner { -class WebTask; -} - -void postTask(WebTestRunner::WebTask*); -void postDelayedTask(WebTestRunner::WebTask*, long long ms); - -#endif // Task_h diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp b/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp deleted file mode 100644 index aa2bf830f..000000000 --- a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestEventPrinter.h" - -#include <stdio.h> -#include <stdlib.h> -#include <wtf/Assertions.h> -#include <wtf/text/Base64.h> - -TestEventPrinter::TestEventPrinter() - : m_encodeBinary(false) -{ -} - -TestEventPrinter::~TestEventPrinter() -{ -} - -// ---------------------------------------------------------------- - -void TestEventPrinter::handleTestHeader(const char*) const -{ -} - -void TestEventPrinter::handleTimedOut() const -{ - fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n"); - fprintf(stdout, "FAIL: Timed out waiting for notifyDone to be called\n"); -} - -void TestEventPrinter::handleTextHeader() const -{ - printf("Content-Type: text/plain\n"); -} - -void TestEventPrinter::handleTextFooter() const -{ - printf("#EOF\n"); -} - -void TestEventPrinter::handleAudio(const void* audioData, size_t audioSize) const -{ - printf("Content-Type: audio/wav\n"); - handleBinary(audioData, audioSize); -} - -void TestEventPrinter::handleAudioFooter() const -{ - printf("#EOF\n"); - fprintf(stderr, "#EOF\n"); -} - -void TestEventPrinter::handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const -{ - ASSERT(actualHash); - printf("\nActualHash: %s\n", actualHash); - if (expectedHash && expectedHash[0]) - printf("\nExpectedHash: %s\n", expectedHash); - if (imageData && imageSize) { - printf("Content-Type: image/png\n"); - handleBinary(imageData, imageSize); - } -} - -void TestEventPrinter::handleTestFooter(bool) const -{ - printf("#EOF\n"); - fprintf(stderr, "#EOF\n"); -} - -void TestEventPrinter::handleBinary(const void* data, size_t size) const -{ - Vector<char> base64; - if (m_encodeBinary) { - base64Encode(static_cast<const char*>(data), size, base64, Base64InsertLFs); - data = base64.data(); - size = base64.size(); - printf("Content-Transfer-Encoding: base64\n"); - } - // Printf formatting for size_t on 32-bit, 64-bit, and on Windows is hard so just cast to an int. - printf("Content-Length: %d\n", static_cast<int>(size)); - if (fwrite(data, 1, size, stdout) != size) { - fprintf(stderr, "Short write to stdout.\n"); - exit(1); - } -} diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.h b/Tools/DumpRenderTree/chromium/TestEventPrinter.h deleted file mode 100644 index c1a7e2dcd..000000000 --- a/Tools/DumpRenderTree/chromium/TestEventPrinter.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestEventPrinter_h -#define TestEventPrinter_h - -#include <wtf/PassOwnPtr.h> - -class TestEventPrinter { -public: - TestEventPrinter(); - ~TestEventPrinter(); - void handleTestHeader(const char* url) const; - void handleTimedOut() const; - void handleTextHeader() const; - void handleTextFooter() const; - void handleAudio(const void* audioData, size_t audioSize) const; - void handleAudioFooter() const; - void handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const; - void handleTestFooter(bool dumpedAnything) const; - - // Set if binary output data should be encoded in base64. Default is off. - void setEncodeBinary(bool encodeBinary) { m_encodeBinary = encodeBinary; } - -private: - void handleBinary(const void* data, size_t) const; - - bool m_encodeBinary; -}; - -#endif // TestEventPrinter_h diff --git a/Tools/DumpRenderTree/chromium/TestNavigationController.cpp b/Tools/DumpRenderTree/chromium/TestNavigationController.cpp deleted file mode 100644 index ad6fcfff4..000000000 --- a/Tools/DumpRenderTree/chromium/TestNavigationController.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestNavigationController.h" - -#include "TestShell.h" -#include <wtf/Assertions.h> - -using namespace WebKit; -using namespace std; - -// ---------------------------------------------------------------------------- -// TestNavigationEntry - -PassRefPtr<TestNavigationEntry> TestNavigationEntry::create() -{ - return adoptRef(new TestNavigationEntry); -} - -PassRefPtr<TestNavigationEntry> TestNavigationEntry::create( - int pageID, const WebURL& url, const WebString& title, const WebString& targetFrame) -{ - return adoptRef(new TestNavigationEntry(pageID, url, title, targetFrame)); -} - -TestNavigationEntry::TestNavigationEntry() - : m_pageID(-1) { } - -TestNavigationEntry::TestNavigationEntry( - int pageID, const WebURL& url, const WebString& title, const WebString& targetFrame) - : m_pageID(pageID) - , m_url(url) - , m_title(title) - , m_targetFrame(targetFrame) { } - -TestNavigationEntry::~TestNavigationEntry() { } - -void TestNavigationEntry::setContentState(const WebHistoryItem& state) -{ - m_state = state; -} - -// ---------------------------------------------------------------------------- -// TestNavigationController - -TestNavigationController::TestNavigationController(NavigationHost* host) - : m_pendingEntry(0) - , m_lastCommittedEntryIndex(-1) - , m_pendingEntryIndex(-1) - , m_host(host) - , m_maxPageID(-1) { } - -TestNavigationController::~TestNavigationController() -{ - discardPendingEntry(); -} - -void TestNavigationController::reset() -{ - m_entries.clear(); - discardPendingEntry(); - - m_lastCommittedEntryIndex = -1; -} - -void TestNavigationController::reload() -{ - // Base the navigation on where we are now... - int currentIndex = currentEntryIndex(); - - // If we are no where, then we can't reload. - // FIXME: We should add a CanReload method. - if (currentIndex == -1) - return; - - discardPendingEntry(); - - m_pendingEntryIndex = currentIndex; - navigateToPendingEntry(true); -} - -void TestNavigationController::goToOffset(int offset) -{ - int index = m_lastCommittedEntryIndex + offset; - if (index < 0 || index >= entryCount()) - return; - - goToIndex(index); -} - -void TestNavigationController::goToIndex(int index) -{ - ASSERT(index >= 0); - ASSERT(index < static_cast<int>(m_entries.size())); - - discardPendingEntry(); - - m_pendingEntryIndex = index; - navigateToPendingEntry(false); -} - -void TestNavigationController::loadEntry(TestNavigationEntry* entry) -{ - // When navigating to a new page, we don't know for sure if we will actually - // end up leaving the current page. The new page load could for example - // result in a download or a 'no content' response (e.g., a mailto: URL). - discardPendingEntry(); - m_pendingEntry = entry; - navigateToPendingEntry(false); -} - - -TestNavigationEntry* TestNavigationController::lastCommittedEntry() const -{ - if (m_lastCommittedEntryIndex == -1) - return 0; - return m_entries[m_lastCommittedEntryIndex].get(); -} - -TestNavigationEntry* TestNavigationController::activeEntry() const -{ - TestNavigationEntry* entry = m_pendingEntry.get(); - if (!entry) - entry = lastCommittedEntry(); - return entry; -} - -int TestNavigationController::currentEntryIndex() const -{ - if (m_pendingEntryIndex != -1) - return m_pendingEntryIndex; - return m_lastCommittedEntryIndex; -} - - -TestNavigationEntry* TestNavigationController::entryAtIndex(int index) const -{ - if (index < 0 || index >= entryCount()) - return 0; - return m_entries[index].get(); -} - -TestNavigationEntry* TestNavigationController::entryWithPageID(int32_t pageID) const -{ - int index = entryIndexWithPageID(pageID); - return (index != -1) ? m_entries[index].get() : 0; -} - -void TestNavigationController::didNavigateToEntry(TestNavigationEntry* entry) -{ - // If the entry is that of a page with PageID larger than any this Tab has - // seen before, then consider it a new navigation. - if (entry->pageID() > maxPageID()) { - insertEntry(entry); - return; - } - - // Otherwise, we just need to update an existing entry with matching PageID. - // If the existing entry corresponds to the entry which is pending, then we - // must update the current entry index accordingly. When navigating to the - // same URL, a new PageID is not created. - - int existingEntryIndex = entryIndexWithPageID(entry->pageID()); - TestNavigationEntry* existingEntry = (existingEntryIndex != -1) ? - m_entries[existingEntryIndex].get() : 0; - if (!existingEntry) { - // No existing entry, then simply ignore this navigation! - } else if (existingEntry == m_pendingEntry.get()) { - // The given entry might provide a new URL... e.g., navigating back to a - // page in session history could have resulted in a new client redirect. - existingEntry->setURL(entry->URL()); - existingEntry->setContentState(entry->contentState()); - m_lastCommittedEntryIndex = m_pendingEntryIndex; - m_pendingEntryIndex = -1; - m_pendingEntry.clear(); - } else if (m_pendingEntry && m_pendingEntry->pageID() == -1 - && GURL(m_pendingEntry->URL()) == GURL(existingEntry->URL().spec())) { - // Not a new navigation - discardPendingEntry(); - } else { - // The given entry might provide a new URL... e.g., navigating to a page - // might result in a client redirect, which should override the URL of the - // existing entry. - existingEntry->setURL(entry->URL()); - existingEntry->setContentState(entry->contentState()); - - // The navigation could have been issued by the renderer, so be sure that - // we update our current index. - m_lastCommittedEntryIndex = existingEntryIndex; - } - - updateMaxPageID(); -} - -void TestNavigationController::discardPendingEntry() -{ - m_pendingEntry.clear(); - m_pendingEntryIndex = -1; -} - -void TestNavigationController::insertEntry(TestNavigationEntry* entry) -{ - discardPendingEntry(); - - // Prune any entry which are in front of the current entry - int currentSize = static_cast<int>(m_entries.size()); - if (currentSize > 0) { - while (m_lastCommittedEntryIndex < (currentSize - 1)) { - m_entries.removeLast(); - currentSize--; - } - } - - m_entries.append(RefPtr<TestNavigationEntry>(entry)); - m_lastCommittedEntryIndex = static_cast<int>(m_entries.size()) - 1; - updateMaxPageID(); -} - -int TestNavigationController::entryIndexWithPageID(int32 pageID) const -{ - for (int i = static_cast<int>(m_entries.size()) - 1; i >= 0; --i) { - if (m_entries[i]->pageID() == pageID) - return i; - } - return -1; -} - -void TestNavigationController::navigateToPendingEntry(bool reload) -{ - // For session history navigations only the pending_entry_index_ is set. - if (!m_pendingEntry) { - ASSERT(m_pendingEntryIndex != -1); - m_pendingEntry = m_entries[m_pendingEntryIndex]; - } - - if (m_host->navigate(*m_pendingEntry.get(), reload)) { - // Note: this is redundant if navigation completed synchronously because - // DidNavigateToEntry call this as well. - updateMaxPageID(); - } else - discardPendingEntry(); -} - -void TestNavigationController::updateMaxPageID() -{ - TestNavigationEntry* entry = activeEntry(); - if (entry) - m_maxPageID = max(m_maxPageID, entry->pageID()); -} diff --git a/Tools/DumpRenderTree/chromium/TestNavigationController.h b/Tools/DumpRenderTree/chromium/TestNavigationController.h deleted file mode 100644 index f23a2ae92..000000000 --- a/Tools/DumpRenderTree/chromium/TestNavigationController.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestNavigationController_h -#define TestNavigationController_h - -#include "WebDataSource.h" -#include "WebHistoryItem.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "webkit/support/webkit_support.h" -#include <string> -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> -#include <wtf/Vector.h> - -// Associated with browser-initated navigations to hold tracking data. -class TestShellExtraData : public WebKit::WebDataSource::ExtraData { -public: - TestShellExtraData(int32_t pendingPageID) - : pendingPageID(pendingPageID) - , requestCommitted(false) { } - - // Contains the page_id for this navigation or -1 if there is none yet. - int32_t pendingPageID; - - // True if we have already processed the "DidCommitLoad" event for this - // request. Used by session history. - bool requestCommitted; -}; - -// Stores one back/forward navigation state for the test shell. -class TestNavigationEntry: public RefCounted<TestNavigationEntry> { -public: - static PassRefPtr<TestNavigationEntry> create(); - static PassRefPtr<TestNavigationEntry> create( - int pageID, - const WebKit::WebURL&, - const WebKit::WebString& title, - const WebKit::WebString& targetFrame); - - // Virtual to allow test_shell to extend the class. - virtual ~TestNavigationEntry(); - - // Set / Get the URI - void setURL(const WebKit::WebURL& url) { m_url = url; } - const WebKit::WebURL& URL() const { return m_url; } - - // Set / Get the title - void setTitle(const WebKit::WebString& title) { m_title = title; } - const WebKit::WebString& title() const { return m_title; } - - // Set / Get a state. - void setContentState(const WebKit::WebHistoryItem&); - const WebKit::WebHistoryItem& contentState() const { return m_state; } - - // Get the page id corresponding to the tab's state. - void setPageID(int pageID) { m_pageID = pageID; } - int32_t pageID() const { return m_pageID; } - - const WebKit::WebString& targetFrame() const { return m_targetFrame; } - -private: - TestNavigationEntry(); - TestNavigationEntry(int pageID, - const WebKit::WebURL&, - const WebKit::WebString& title, - const WebKit::WebString& targetFrame); - - // Describes the current page that the tab represents. This is not relevant - // for all tab contents types. - int32_t m_pageID; - - WebKit::WebURL m_url; - WebKit::WebString m_title; - WebKit::WebHistoryItem m_state; - WebKit::WebString m_targetFrame; -}; - -class NavigationHost { -public: - virtual bool navigate(const TestNavigationEntry&, bool reload) = 0; -}; - -// Test shell's NavigationController. The goal is to be as close to the Chrome -// version as possible. -class TestNavigationController { - WTF_MAKE_NONCOPYABLE(TestNavigationController); -public: - TestNavigationController(NavigationHost*); - ~TestNavigationController(); - - void reset(); - - // Causes the controller to reload the current (or pending) entry. - void reload(); - - // Causes the controller to go to the specified offset from current. Does - // nothing if out of bounds. - void goToOffset(int); - - // Causes the controller to go to the specified index. - void goToIndex(int); - - // Causes the controller to load the specified entry. - // NOTE: Do not pass an entry that the controller already owns! - void loadEntry(TestNavigationEntry*); - - // Returns the last committed entry, which may be null if there are no - // committed entries. - TestNavigationEntry* lastCommittedEntry() const; - - // Returns the number of entries in the NavigationControllerBase, excluding - // the pending entry if there is one. - int entryCount() const { return static_cast<int>(m_entries.size()); } - - // Returns the active entry, which is the pending entry if a navigation is in - // progress or the last committed entry otherwise. NOTE: This can be 0!! - // - // If you are trying to get the current state of the NavigationControllerBase, - // this is the method you will typically want to call. - TestNavigationEntry* activeEntry() const; - - // Returns the index from which we would go back/forward or reload. This is - // the m_lastCommittedEntryIndex if m_pendingEntryIndex is -1. Otherwise, - // it is the m_pendingEntryIndex. - int currentEntryIndex() const; - - // Returns the entry at the specified index. Returns 0 if out of bounds. - TestNavigationEntry* entryAtIndex(int) const; - - // Return the entry with the corresponding type and page ID, or 0 if - // not found. - TestNavigationEntry* entryWithPageID(int32_t) const; - - // Returns the index of the last committed entry. - int lastCommittedEntryIndex() const { return m_lastCommittedEntryIndex; } - - // Used to inform us of a navigation being committed for a tab. Any entry - // located forward to the current entry will be deleted. The new entry - // becomes the current entry. - void didNavigateToEntry(TestNavigationEntry*); - - // Used to inform us to discard its pending entry. - void discardPendingEntry(); - -private: - // Inserts an entry after the current position, removing all entries after it. - // The new entry will become the active one. - void insertEntry(TestNavigationEntry*); - - int maxPageID() const { return m_maxPageID; } - void navigateToPendingEntry(bool reload); - - // Return the index of the entry with the corresponding type and page ID, - // or -1 if not found. - int entryIndexWithPageID(int32_t) const; - - // Updates the max page ID with that of the given entry, if is larger. - void updateMaxPageID(); - - // List of NavigationEntry for this tab - typedef Vector<RefPtr<TestNavigationEntry> > NavigationEntryList; - typedef NavigationEntryList::iterator NavigationEntryListIterator; - NavigationEntryList m_entries; - - // An entry we haven't gotten a response for yet. This will be discarded - // when we navigate again. It's used only so we know what the currently - // displayed tab is. - RefPtr<TestNavigationEntry> m_pendingEntry; - - // currently visible entry - int m_lastCommittedEntryIndex; - - // index of pending entry if it is in entries_, or -1 if pending_entry_ is a - // new entry (created by LoadURL). - int m_pendingEntryIndex; - - NavigationHost* m_host; - int m_maxPageID; -}; - -#endif // TestNavigationController_h - diff --git a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h b/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h deleted file mode 100644 index 9fa3fff3b..000000000 --- a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "bindings/npapi.h" - -// These are defined in WebCore/brdige/npapi.h and we need them on Linux/Win. -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif diff --git a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h b/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h deleted file mode 100644 index 59ae666b9..000000000 --- a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h +++ /dev/null @@ -1,8 +0,0 @@ -#include "npapi.h" -#include "bindings/npfunctions.h" - -// Non-standard event types can be passed to HandleEvent. -// npapi.h that comes with WebKit.framework adds these events. -#define getFocusEvent (osEvt + 16) -#define loseFocusEvent (osEvt + 17) -#define adjustCursorEvent (osEvt + 18) diff --git a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h b/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h deleted file mode 100644 index 597d4ad7c..000000000 --- a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h +++ /dev/null @@ -1 +0,0 @@ -#include "bindings/npruntime.h" diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h deleted file mode 100644 index f2ec50869..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebAccessibilityController.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebAccessibilityController_h -#define WebAccessibilityController_h - -namespace WebKit { -class WebAccessibilityObject; -} - -namespace WebTestRunner { - -class AccessibilityController; - -class WebAccessibilityController { -public: -#if WEBTESTRUNNER_IMPLEMENTATION - explicit WebAccessibilityController(AccessibilityController*); -#endif - - void setFocusedElement(const WebKit::WebAccessibilityObject&); - void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName); - bool shouldLogAccessibilityEvents(); - -private: - AccessibilityController* m_private; -}; - -} - -#endif // WebAccessibilityController_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h deleted file mode 100644 index 47c59efe6..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebEventSender.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebEventSender_h -#define WebEventSender_h - -#include "WebKit/chromium/public/WebDragOperation.h" - -namespace WebKit { -class WebDragData; -} - -namespace WebTestRunner { - -class EventSender; - -class WebEventSender { -public: -#if WEBTESTRUNNER_IMPLEMENTATION - explicit WebEventSender(EventSender*); -#endif - - // Simulate drag&drop system call. - void doDragDrop(const WebKit::WebDragData&, WebKit::WebDragOperationsMask); - -private: - EventSender* m_private; -}; - -} - -#endif // WebEventSender_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h deleted file mode 100644 index ef73e177e..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebTask_h -#define WebTask_h - -namespace WebTestRunner { - -class WebTaskList; - -// WebTask represents a task which can run by WebTestDelegate::postTask() or -// WebTestDelegate::postDelayedTask(). -class WebTask { -public: - explicit WebTask(WebTaskList*); - virtual ~WebTask(); - - // The main code of this task. - // An implementation of run() should return immediately if cancel() was called. - virtual void run() = 0; - virtual void cancel() = 0; - -protected: - WebTaskList* m_taskList; -}; - -class WebTaskList { -public: - WebTaskList(); - ~WebTaskList(); - void registerTask(WebTask*); - void unregisterTask(WebTask*); - void revokeAll(); - -private: - class Private; - Private* m_private; -}; - -// A task containing an object pointer of class T. Derived classes should -// override runIfValid() which in turn can safely invoke methods on the -// m_object. The Class T must have "WebTaskList* taskList()". -template<class T> -class WebMethodTask : public WebTask { -public: - explicit WebMethodTask(T* object) - : WebTask(object->taskList()) - , m_object(object) - { - } - - virtual ~WebMethodTask() { } - - virtual void run() - { - if (m_object) - runIfValid(); - } - - virtual void cancel() - { - m_object = 0; - m_taskList->unregisterTask(this); - m_taskList = 0; - } - - virtual void runIfValid() = 0; - -protected: - T* m_object; -}; - -} - -#endif // WebTask_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h deleted file mode 100644 index ab47d4f9d..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebTestDelegate_h -#define WebTestDelegate_h - -#include "Platform/chromium/public/WebString.h" -#include "Platform/chromium/public/WebVector.h" - -namespace WebKit { -struct WebContextMenuData; -class WebGamepads; -} - -namespace WebTestRunner { - -class WebTask; - -class WebTestDelegate { -public: - virtual void clearContextMenuData() = 0; - virtual void clearEditCommand() = 0; - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) = 0; - virtual void setEditCommand(const std::string& name, const std::string& value) = 0; - virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; - virtual void setGamepadData(const WebKit::WebGamepads&) = 0; - virtual void printMessage(const std::string& message) = 0; - - // The delegate takes ownership of the WebTask objects and is responsible - // for deleting them. - virtual void postTask(WebTask*) = 0; - virtual void postDelayedTask(WebTask*, long long ms) = 0; - - virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; - virtual long long getCurrentTimeInMillisecond() = 0; - virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0; -}; - -} - -#endif // WebTestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h deleted file mode 100644 index 52520a6b5..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebTestInterfaces_h -#define WebTestInterfaces_h - -namespace WebKit { -class WebFrame; -class WebView; -} - -namespace WebTestRunner { - -class WebAccessibilityController; -class WebEventSender; -class WebTestDelegate; - -class WebTestInterfaces { -public: - WebTestInterfaces(); - ~WebTestInterfaces(); - - void setWebView(WebKit::WebView*); - void setDelegate(WebTestDelegate*); - void bindTo(WebKit::WebFrame*); - void resetAll(); - - WebAccessibilityController* accessibilityController(); - WebEventSender* eventSender(); - -private: - class Internal; - Internal* m_internal; -}; - -} - -#endif // WebTestInterfaces_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h deleted file mode 100644 index b4a593cee..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebTestProxy_h -#define WebTestProxy_h - -#include "Platform/chromium/public/WebRect.h" -#include "WebKit/chromium/public/WebAccessibilityNotification.h" -#include "WebKit/chromium/public/WebDragOperation.h" -#include "WebKit/chromium/public/WebNavigationPolicy.h" - -namespace WebKit { -class WebAccessibilityObject; -class WebDragData; -class WebFrame; -class WebImage; -struct WebPoint; -struct WebSize; -} - -namespace WebTestRunner { - -class WebTestDelegate; -class WebTestInterfaces; - -class WebTestProxyBase { -public: - void setInterfaces(WebTestInterfaces*); - void setDelegate(WebTestDelegate*); - - void setPaintRect(const WebKit::WebRect&); - WebKit::WebRect paintRect() const; - -protected: - WebTestProxyBase(); - ~WebTestProxyBase(); - - void didInvalidateRect(const WebKit::WebRect&); - void didScrollRect(int, int, const WebKit::WebRect&); - void scheduleComposite(); - void scheduleAnimation(); - void setWindowRect(const WebKit::WebRect&); - void show(WebKit::WebNavigationPolicy); - void didAutoResize(const WebKit::WebSize&); - void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification); - void startDragging(WebKit::WebFrame*, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&); - -private: - WebTestInterfaces* m_testInterfaces; - WebTestDelegate* m_delegate; - - WebKit::WebRect m_paintRect; -}; - -// Use this template to inject methods into your WebViewClient implementation -// required for the running layout tests. -template<class WebViewClientImpl, typename T> -class WebTestProxy : public WebViewClientImpl, public WebTestProxyBase { -public: - explicit WebTestProxy(T t) - : WebViewClientImpl(t) - { - } - - virtual ~WebTestProxy() { } - - virtual void didInvalidateRect(const WebKit::WebRect& rect) - { - WebTestProxyBase::didInvalidateRect(rect); - WebViewClientImpl::didInvalidateRect(rect); - } - virtual void didScrollRect(int dx, int dy, const WebKit::WebRect& clipRect) - { - WebTestProxyBase::didScrollRect(dx, dy, clipRect); - WebViewClientImpl::didScrollRect(dx, dy, clipRect); - } - virtual void scheduleComposite() - { - WebTestProxyBase::scheduleComposite(); - WebViewClientImpl::scheduleComposite(); - } - virtual void scheduleAnimation() - { - WebTestProxyBase::scheduleAnimation(); - WebViewClientImpl::scheduleAnimation(); - } - virtual void setWindowRect(const WebKit::WebRect& rect) - { - WebTestProxyBase::setWindowRect(rect); - WebViewClientImpl::setWindowRect(rect); - } - virtual void show(WebKit::WebNavigationPolicy policy) - { - WebTestProxyBase::show(policy); - WebViewClientImpl::show(policy); - } - virtual void didAutoResize(const WebKit::WebSize& newSize) - { - WebTestProxyBase::didAutoResize(newSize); - WebViewClientImpl::didAutoResize(newSize); - } - virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& object, WebKit::WebAccessibilityNotification notification) - { - WebTestProxyBase::postAccessibilityNotification(object, notification); - WebViewClientImpl::postAccessibilityNotification(object, notification); - } - virtual void startDragging(WebKit::WebFrame* frame, const WebKit::WebDragData& data, WebKit::WebDragOperationsMask mask, const WebKit::WebImage& image, const WebKit::WebPoint& point) - { - WebTestProxyBase::startDragging(frame, data, mask, image, point); - WebViewClientImpl::startDragging(frame, data, mask, image, point); - } -}; - -} - -#endif // WebTestProxy_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp deleted file mode 100644 index 5f1b4f9a9..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "AccessibilityControllerChromium.h" - -#include "TestDelegate.h" -#include "WebAccessibilityObject.h" -#include "WebElement.h" -#include "WebFrame.h" -#include "WebNode.h" -#include "WebView.h" -#include "platform/WebCString.h" - -using namespace WebKit; - -namespace WebTestRunner { - -AccessibilityController::AccessibilityController() - : m_logAccessibilityEvents(false) -{ - - bindMethod("logAccessibilityEvents", &AccessibilityController::logAccessibilityEventsCallback); - bindMethod("addNotificationListener", &AccessibilityController::addNotificationListenerCallback); - bindMethod("removeNotificationListener", &AccessibilityController::removeNotificationListenerCallback); - - bindProperty("focusedElement", &AccessibilityController::focusedElementGetterCallback); - bindProperty("rootElement", &AccessibilityController::rootElementGetterCallback); - - bindMethod("accessibleElementById", &AccessibilityController::accessibleElementByIdGetterCallback); - - bindFallbackMethod(&AccessibilityController::fallbackCallback); -} - -void AccessibilityController::bindToJavascript(WebFrame* frame, const WebString& classname) -{ - WebAccessibilityObject::enableAccessibility(); - CppBoundClass::bindToJavascript(frame, classname); -} - -void AccessibilityController::reset() -{ - m_rootElement = WebAccessibilityObject(); - m_focusedElement = WebAccessibilityObject(); - m_elements.clear(); - - m_logAccessibilityEvents = false; -} - -void AccessibilityController::setFocusedElement(const WebAccessibilityObject& focusedElement) -{ - m_focusedElement = focusedElement; -} - -AccessibilityUIElement* AccessibilityController::getFocusedElement() -{ - if (m_focusedElement.isNull()) - m_focusedElement = m_webView->accessibilityObject(); - return m_elements.getOrCreate(m_focusedElement); -} - -AccessibilityUIElement* AccessibilityController::getRootElement() -{ - if (m_rootElement.isNull()) - m_rootElement = m_webView->accessibilityObject(); - return m_elements.createRoot(m_rootElement); -} - -AccessibilityUIElement* AccessibilityController::findAccessibleElementByIdRecursive(const WebAccessibilityObject& obj, const WebString& id) -{ - if (obj.isNull() || obj.isDetached()) - return 0; - - WebNode node = obj.node(); - if (!node.isNull() && node.isElementNode()) { - WebElement element = node.to<WebElement>(); - element.getAttribute("id"); - if (element.getAttribute("id") == id) - return m_elements.getOrCreate(obj); - } - - unsigned childCount = obj.childCount(); - for (unsigned i = 0; i < childCount; i++) { - if (AccessibilityUIElement* result = findAccessibleElementByIdRecursive(obj.childAt(i), id)) - return result; - } - - return 0; -} - -AccessibilityUIElement* AccessibilityController::getAccessibleElementById(const std::string& id) -{ - if (m_rootElement.isNull()) - m_rootElement = m_webView->accessibilityObject(); - - if (!m_rootElement.updateBackingStoreAndCheckValidity()) - return 0; - - return findAccessibleElementByIdRecursive(m_rootElement, WebString::fromUTF8(id.c_str())); -} - -bool AccessibilityController::shouldLogAccessibilityEvents() -{ - return m_logAccessibilityEvents; -} - -void AccessibilityController::notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName) -{ - // Call notification listeners on the element. - AccessibilityUIElement* element = m_elements.getOrCreate(target); - element->notificationReceived(notificationName); - - // Call global notification listeners. - size_t callbackCount = m_notificationCallbacks.size(); - for (size_t i = 0; i < callbackCount; i++) { - CppVariant arguments[2]; - arguments[0].set(*element->getAsCppVariant()); - arguments[1].set(notificationName); - CppVariant invokeResult; - m_notificationCallbacks[i].invokeDefault(arguments, 2, invokeResult); - } -} - -void AccessibilityController::logAccessibilityEventsCallback(const CppArgumentList&, CppVariant* result) -{ - m_logAccessibilityEvents = true; - result->setNull(); -} - -void AccessibilityController::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 1 || !arguments[0].isObject()) { - result->setNull(); - return; - } - - m_notificationCallbacks.push_back(arguments[0]); - result->setNull(); -} - -void AccessibilityController::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void AccessibilityController::focusedElementGetterCallback(CppVariant* result) -{ - result->set(*(getFocusedElement()->getAsCppVariant())); -} - -void AccessibilityController::rootElementGetterCallback(CppVariant* result) -{ - result->set(*(getRootElement()->getAsCppVariant())); -} - -void AccessibilityController::accessibleElementByIdGetterCallback(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1 || !arguments[0].isString()) - return; - - std::string id = arguments[0].toString(); - AccessibilityUIElement* foundElement = getAccessibleElementById(id); - if (!foundElement) - return; - - result->set(*(foundElement->getAsCppVariant())); -} - -void AccessibilityController::fallbackCallback(const CppArgumentList&, CppVariant* result) -{ - m_delegate->printMessage("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on AccessibilityController\n"); - result->setNull(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h deleted file mode 100644 index a9728c615..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AccessibilityControllerChromium_h -#define AccessibilityControllerChromium_h - -#include "AccessibilityUIElementChromium.h" -#include "CppBoundClass.h" - -namespace WebKit { -class WebAccessibilityObject; -class WebFrame; -class WebView; -} - -namespace WebTestRunner { - -class TestDelegate; - -class AccessibilityController : public CppBoundClass { -public: - AccessibilityController(); - - // Shadow to include accessibility initialization. - void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); - void reset(); - - void setFocusedElement(const WebKit::WebAccessibilityObject&); - AccessibilityUIElement* getFocusedElement(); - AccessibilityUIElement* getRootElement(); - AccessibilityUIElement* getAccessibleElementById(const std::string& id); - - bool shouldLogAccessibilityEvents(); - - void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName); - - void setDelegate(TestDelegate* delegate) { m_delegate = delegate; } - void setWebView(WebKit::WebView* webView) { m_webView = webView; } - -private: - // If true, will log all accessibility notifications. - bool m_logAccessibilityEvents; - - // Bound methods and properties - void logAccessibilityEventsCallback(const CppArgumentList&, CppVariant*); - void fallbackCallback(const CppArgumentList&, CppVariant*); - void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); - void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); - - void focusedElementGetterCallback(CppVariant*); - void rootElementGetterCallback(CppVariant*); - void accessibleElementByIdGetterCallback(const CppArgumentList&, CppVariant*); - - AccessibilityUIElement* findAccessibleElementByIdRecursive(const WebKit::WebAccessibilityObject&, const WebKit::WebString& id); - - WebKit::WebAccessibilityObject m_focusedElement; - WebKit::WebAccessibilityObject m_rootElement; - - AccessibilityUIElementList m_elements; - - std::vector<CppVariant> m_notificationCallbacks; - - TestDelegate* m_delegate; - WebKit::WebView* m_webView; -}; - -} - -#endif // AccessibilityControllerChromium_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp deleted file mode 100644 index 7b8f6fbd1..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp +++ /dev/null @@ -1,982 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "AccessibilityUIElementChromium.h" - -#include "WebAccessibilityObject.h" -#include "platform/WebCString.h" -#include "platform/WebPoint.h" -#include "platform/WebRect.h" -#include "platform/WebString.h" -#include <wtf/Assertions.h> -#include <wtf/StringExtras.h> - -using namespace WebKit; -using namespace std; - -namespace WebTestRunner { - -namespace { - -// Map role value to string, matching Safari/Mac platform implementation to -// avoid rebaselining layout tests. -string roleToString(WebAccessibilityRole role) -{ - string result = "AXRole: AX"; - switch (role) { - case WebAccessibilityRoleButton: - return result.append("Button"); - case WebAccessibilityRoleRadioButton: - return result.append("RadioButton"); - case WebAccessibilityRoleCheckBox: - return result.append("CheckBox"); - case WebAccessibilityRoleSlider: - return result.append("Slider"); - case WebAccessibilityRoleTabGroup: - return result.append("TabGroup"); - case WebAccessibilityRoleTextField: - return result.append("TextField"); - case WebAccessibilityRoleStaticText: - return result.append("StaticText"); - case WebAccessibilityRoleTextArea: - return result.append("TextArea"); - case WebAccessibilityRoleScrollArea: - return result.append("ScrollArea"); - case WebAccessibilityRolePopUpButton: - return result.append("PopUpButton"); - case WebAccessibilityRoleMenuButton: - return result.append("MenuButton"); - case WebAccessibilityRoleTable: - return result.append("Table"); - case WebAccessibilityRoleApplication: - return result.append("Application"); - case WebAccessibilityRoleGroup: - return result.append("Group"); - case WebAccessibilityRoleRadioGroup: - return result.append("RadioGroup"); - case WebAccessibilityRoleList: - return result.append("List"); - case WebAccessibilityRoleScrollBar: - return result.append("ScrollBar"); - case WebAccessibilityRoleValueIndicator: - return result.append("ValueIndicator"); - case WebAccessibilityRoleImage: - return result.append("Image"); - case WebAccessibilityRoleMenuBar: - return result.append("MenuBar"); - case WebAccessibilityRoleMenu: - return result.append("Menu"); - case WebAccessibilityRoleMenuItem: - return result.append("MenuItem"); - case WebAccessibilityRoleColumn: - return result.append("Column"); - case WebAccessibilityRoleRow: - return result.append("Row"); - case WebAccessibilityRoleToolbar: - return result.append("Toolbar"); - case WebAccessibilityRoleBusyIndicator: - return result.append("BusyIndicator"); - case WebAccessibilityRoleProgressIndicator: - return result.append("ProgressIndicator"); - case WebAccessibilityRoleWindow: - return result.append("Window"); - case WebAccessibilityRoleDrawer: - return result.append("Drawer"); - case WebAccessibilityRoleSystemWide: - return result.append("SystemWide"); - case WebAccessibilityRoleOutline: - return result.append("Outline"); - case WebAccessibilityRoleIncrementor: - return result.append("Incrementor"); - case WebAccessibilityRoleBrowser: - return result.append("Browser"); - case WebAccessibilityRoleComboBox: - return result.append("ComboBox"); - case WebAccessibilityRoleSplitGroup: - return result.append("SplitGroup"); - case WebAccessibilityRoleSplitter: - return result.append("Splitter"); - case WebAccessibilityRoleColorWell: - return result.append("ColorWell"); - case WebAccessibilityRoleGrowArea: - return result.append("GrowArea"); - case WebAccessibilityRoleSheet: - return result.append("Sheet"); - case WebAccessibilityRoleHelpTag: - return result.append("HelpTag"); - case WebAccessibilityRoleMatte: - return result.append("Matte"); - case WebAccessibilityRoleRuler: - return result.append("Ruler"); - case WebAccessibilityRoleRulerMarker: - return result.append("RulerMarker"); - case WebAccessibilityRoleLink: - return result.append("Link"); - case WebAccessibilityRoleDisclosureTriangle: - return result.append("DisclosureTriangle"); - case WebAccessibilityRoleGrid: - return result.append("Grid"); - case WebAccessibilityRoleCell: - return result.append("Cell"); - case WebAccessibilityRoleColumnHeader: - return result.append("ColumnHeader"); - case WebAccessibilityRoleRowHeader: - return result.append("RowHeader"); - case WebAccessibilityRoleWebCoreLink: - // Maps to Link role. - return result.append("Link"); - case WebAccessibilityRoleImageMapLink: - return result.append("ImageMapLink"); - case WebAccessibilityRoleImageMap: - return result.append("ImageMap"); - case WebAccessibilityRoleListMarker: - return result.append("ListMarker"); - case WebAccessibilityRoleWebArea: - return result.append("WebArea"); - case WebAccessibilityRoleHeading: - return result.append("Heading"); - case WebAccessibilityRoleListBox: - return result.append("ListBox"); - case WebAccessibilityRoleListBoxOption: - return result.append("ListBoxOption"); - case WebAccessibilityRoleTableHeaderContainer: - return result.append("TableHeaderContainer"); - case WebAccessibilityRoleDefinitionListTerm: - return result.append("DefinitionListTerm"); - case WebAccessibilityRoleDefinitionListDefinition: - return result.append("DefinitionListDefinition"); - case WebAccessibilityRoleAnnotation: - return result.append("Annotation"); - case WebAccessibilityRoleSliderThumb: - return result.append("SliderThumb"); - case WebAccessibilityRoleLandmarkApplication: - return result.append("LandmarkApplication"); - case WebAccessibilityRoleLandmarkBanner: - return result.append("LandmarkBanner"); - case WebAccessibilityRoleLandmarkComplementary: - return result.append("LandmarkComplementary"); - case WebAccessibilityRoleLandmarkContentInfo: - return result.append("LandmarkContentInfo"); - case WebAccessibilityRoleLandmarkMain: - return result.append("LandmarkMain"); - case WebAccessibilityRoleLandmarkNavigation: - return result.append("LandmarkNavigation"); - case WebAccessibilityRoleLandmarkSearch: - return result.append("LandmarkSearch"); - case WebAccessibilityRoleApplicationLog: - return result.append("ApplicationLog"); - case WebAccessibilityRoleApplicationMarquee: - return result.append("ApplicationMarquee"); - case WebAccessibilityRoleApplicationStatus: - return result.append("ApplicationStatus"); - case WebAccessibilityRoleApplicationTimer: - return result.append("ApplicationTimer"); - case WebAccessibilityRoleDocument: - return result.append("Document"); - case WebAccessibilityRoleDocumentArticle: - return result.append("DocumentArticle"); - case WebAccessibilityRoleDocumentNote: - return result.append("DocumentNote"); - case WebAccessibilityRoleDocumentRegion: - return result.append("DocumentRegion"); - case WebAccessibilityRoleUserInterfaceTooltip: - return result.append("UserInterfaceTooltip"); - case WebAccessibilityRoleToggleButton: - return result.append("ToggleButton"); - case WebAccessibilityRoleCanvas: - return result.append("Canvas"); - case WebAccessibilityRoleParagraph: - return result.append("Paragraph"); - case WebAccessibilityRoleDiv: - return result.append("Div"); - case WebAccessibilityRoleLabel: - return result.append("Label"); - case WebAccessibilityRoleForm: - return result.append("Form"); - case WebAccessibilityRoleHorizontalRule: - return result.append("HorizontalRule"); - case WebAccessibilityRoleLegend: - return result.append("Legend"); - case WebAccessibilityRoleApplicationAlert: - return result.append("Alert"); - case WebAccessibilityRoleApplicationAlertDialog: - return result.append("AlertDialog"); - case WebAccessibilityRoleApplicationDialog: - return result.append("ApplicationDialog"); - case WebAccessibilityRoleDirectory: - return result.append("Directory"); - case WebAccessibilityRoleDocumentMath: - return result.append("Math"); - case WebAccessibilityRoleEditableText: - return result.append("EditableText"); - case WebAccessibilityRoleFooter: - return result.append("Footer"); - case WebAccessibilityRoleIgnored: - return result.append("Ignored"); - case WebAccessibilityRoleListItem: - return result.append("ListItem"); - case WebAccessibilityRoleMenuListPopup: - return result.append("MenuListPopup"); - case WebAccessibilityRoleMenuListOption: - return result.append("MenuListOption"); - case WebAccessibilityRolePresentational: - return result.append("Presentational"); - case WebAccessibilityRoleSpinButton: - return result.append("SpinButton"); - case WebAccessibilityRoleSpinButtonPart: - return result.append("SpinButtonPart"); - case WebAccessibilityRoleTabList: - return result.append("TabList"); - case WebAccessibilityRoleTabPanel: - return result.append("TabPanel"); - case WebAccessibilityRoleTab: - return result.append("Tab"); - case WebAccessibilityRoleTreeRole: - return result.append("Tree"); - case WebAccessibilityRoleTreeGrid: - return result.append("TreeGrid"); - case WebAccessibilityRoleTreeItemRole: - return result.append("TreeItem"); - case WebAccessibilityRoleUnknown: - default: - return result.append("Unknown"); - } -} - -string getDescription(const WebAccessibilityObject& object) -{ - string description = object.accessibilityDescription().utf8(); - return description.insert(0, "AXDescription: "); -} - -string getHelpText(const WebAccessibilityObject& object) -{ - string helpText = object.helpText().utf8(); - return helpText.insert(0, "AXHelp: "); -} - -string getStringValue(const WebAccessibilityObject& object) -{ - string value = object.stringValue().utf8(); - return value.insert(0, "AXValue: "); -} - -string getRole(const WebAccessibilityObject& object) -{ - string roleString = roleToString(object.roleValue()); - - // Special-case canvas with fallback content because Chromium wants to - // treat this as essentially a separate role that it can map differently depending - // on the platform. - if (object.roleValue() == WebAccessibilityRoleCanvas && object.canvasHasFallbackContent()) - roleString += "WithFallbackContent"; - - return roleString; -} - -string getTitle(const WebAccessibilityObject& object) -{ - string title = object.title().utf8(); - return title.insert(0, "AXTitle: "); -} - -string getOrientation(const WebAccessibilityObject& object) -{ - if (object.isVertical()) - return "AXOrientation: AXVerticalOrientation"; - - return "AXOrientation: AXHorizontalOrientation"; -} - -string getValueDescription(const WebAccessibilityObject& object) -{ - string valueDescription = object.valueDescription().utf8(); - return valueDescription.insert(0, "AXValueDescription: "); -} - -string getAttributes(const WebAccessibilityObject& object) -{ - // FIXME: Concatenate all attributes of the AccessibilityObject. - string attributes(getTitle(object)); - attributes.append("\n"); - attributes.append(getRole(object)); - attributes.append("\n"); - attributes.append(getDescription(object)); - return attributes; -} - - -// Collects attributes into a string, delimited by dashes. Used by all methods -// that output lists of attributes: attributesOfLinkedUIElementsCallback, -// AttributesOfChildrenCallback, etc. -class AttributesCollector { -public: - void collectAttributes(const WebAccessibilityObject& object) - { - m_attributes.append("\n------------\n"); - m_attributes.append(getAttributes(object)); - } - - string attributes() const { return m_attributes; } - -private: - string m_attributes; -}; - -} - -AccessibilityUIElement::AccessibilityUIElement(const WebAccessibilityObject& object, Factory* factory) - : m_accessibilityObject(object) - , m_factory(factory) -{ - - ASSERT(factory); - - // - // Properties - // - - bindProperty("role", &AccessibilityUIElement::roleGetterCallback); - bindProperty("title", &AccessibilityUIElement::titleGetterCallback); - bindProperty("description", &AccessibilityUIElement::descriptionGetterCallback); - bindProperty("helpText", &AccessibilityUIElement::helpTextGetterCallback); - bindProperty("stringValue", &AccessibilityUIElement::stringValueGetterCallback); - bindProperty("x", &AccessibilityUIElement::xGetterCallback); - bindProperty("y", &AccessibilityUIElement::yGetterCallback); - bindProperty("width", &AccessibilityUIElement::widthGetterCallback); - bindProperty("height", &AccessibilityUIElement::heightGetterCallback); - bindProperty("intValue", &AccessibilityUIElement::intValueGetterCallback); - bindProperty("minValue", &AccessibilityUIElement::minValueGetterCallback); - bindProperty("maxValue", &AccessibilityUIElement::maxValueGetterCallback); - bindProperty("valueDescription", &AccessibilityUIElement::valueDescriptionGetterCallback); - bindProperty("childrenCount", &AccessibilityUIElement::childrenCountGetterCallback); - bindProperty("insertionPointLineNumber", &AccessibilityUIElement::insertionPointLineNumberGetterCallback); - bindProperty("selectedTextRange", &AccessibilityUIElement::selectedTextRangeGetterCallback); - bindProperty("isEnabled", &AccessibilityUIElement::isEnabledGetterCallback); - bindProperty("isRequired", &AccessibilityUIElement::isRequiredGetterCallback); - bindProperty("isFocused", &AccessibilityUIElement::isFocusedGetterCallback); - bindProperty("isFocusable", &AccessibilityUIElement::isFocusableGetterCallback); - bindProperty("isSelected", &AccessibilityUIElement::isSelectedGetterCallback); - bindProperty("isSelectable", &AccessibilityUIElement::isSelectableGetterCallback); - bindProperty("isMultiSelectable", &AccessibilityUIElement::isMultiSelectableGetterCallback); - bindProperty("isSelectedOptionActive", &AccessibilityUIElement::isSelectedOptionActiveGetterCallback); - bindProperty("isExpanded", &AccessibilityUIElement::isExpandedGetterCallback); - bindProperty("isChecked", &AccessibilityUIElement::isCheckedGetterCallback); - bindProperty("isVisible", &AccessibilityUIElement::isVisibleGetterCallback); - bindProperty("isOffScreen", &AccessibilityUIElement::isOffScreenGetterCallback); - bindProperty("isCollapsed", &AccessibilityUIElement::isCollapsedGetterCallback); - bindProperty("hasPopup", &AccessibilityUIElement::hasPopupGetterCallback); - bindProperty("isValid", &AccessibilityUIElement::isValidGetterCallback); - bindProperty("isReadOnly", &AccessibilityUIElement::isReadOnlyGetterCallback); - bindProperty("orientation", &AccessibilityUIElement::orientationGetterCallback); - - // - // Methods - // - - bindMethod("allAttributes", &AccessibilityUIElement::allAttributesCallback); - bindMethod("attributesOfLinkedUIElements", &AccessibilityUIElement::attributesOfLinkedUIElementsCallback); - bindMethod("attributesOfDocumentLinks", &AccessibilityUIElement::attributesOfDocumentLinksCallback); - bindMethod("attributesOfChildren", &AccessibilityUIElement::attributesOfChildrenCallback); - bindMethod("lineForIndex", &AccessibilityUIElement::lineForIndexCallback); - bindMethod("boundsForRange", &AccessibilityUIElement::boundsForRangeCallback); - bindMethod("stringForRange", &AccessibilityUIElement::stringForRangeCallback); - bindMethod("childAtIndex", &AccessibilityUIElement::childAtIndexCallback); - bindMethod("elementAtPoint", &AccessibilityUIElement::elementAtPointCallback); - bindMethod("attributesOfColumnHeaders", &AccessibilityUIElement::attributesOfColumnHeadersCallback); - bindMethod("attributesOfRowHeaders", &AccessibilityUIElement::attributesOfRowHeadersCallback); - bindMethod("attributesOfColumns", &AccessibilityUIElement::attributesOfColumnsCallback); - bindMethod("attributesOfRows", &AccessibilityUIElement::attributesOfRowsCallback); - bindMethod("attributesOfVisibleCells", &AccessibilityUIElement::attributesOfVisibleCellsCallback); - bindMethod("attributesOfHeader", &AccessibilityUIElement::attributesOfHeaderCallback); - bindMethod("indexInTable", &AccessibilityUIElement::indexInTableCallback); - bindMethod("rowIndexRange", &AccessibilityUIElement::rowIndexRangeCallback); - bindMethod("columnIndexRange", &AccessibilityUIElement::columnIndexRangeCallback); - bindMethod("cellForColumnAndRow", &AccessibilityUIElement::cellForColumnAndRowCallback); - bindMethod("titleUIElement", &AccessibilityUIElement::titleUIElementCallback); - bindMethod("setSelectedTextRange", &AccessibilityUIElement::setSelectedTextRangeCallback); - bindMethod("attributeValue", &AccessibilityUIElement::attributeValueCallback); - bindMethod("isAttributeSettable", &AccessibilityUIElement::isAttributeSettableCallback); - bindMethod("isActionSupported", &AccessibilityUIElement::isActionSupportedCallback); - bindMethod("parentElement", &AccessibilityUIElement::parentElementCallback); - bindMethod("increment", &AccessibilityUIElement::incrementCallback); - bindMethod("decrement", &AccessibilityUIElement::decrementCallback); - bindMethod("showMenu", &AccessibilityUIElement::showMenuCallback); - bindMethod("press", &AccessibilityUIElement::pressCallback); - bindMethod("isEqual", &AccessibilityUIElement::isEqualCallback); - bindMethod("addNotificationListener", &AccessibilityUIElement::addNotificationListenerCallback); - bindMethod("removeNotificationListener", &AccessibilityUIElement::removeNotificationListenerCallback); - bindMethod("takeFocus", &AccessibilityUIElement::takeFocusCallback); - bindMethod("scrollToMakeVisible", &AccessibilityUIElement::scrollToMakeVisibleCallback); - bindMethod("scrollToMakeVisibleWithSubFocus", &AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback); - bindMethod("scrollToGlobalPoint", &AccessibilityUIElement::scrollToGlobalPointCallback); - - bindFallbackMethod(&AccessibilityUIElement::fallbackCallback); -} - -AccessibilityUIElement* AccessibilityUIElement::getChildAtIndex(unsigned index) -{ - return m_factory->getOrCreate(accessibilityObject().childAt(index)); -} - -bool AccessibilityUIElement::isEqual(const WebKit::WebAccessibilityObject& other) -{ - return accessibilityObject().equals(other); -} - -void AccessibilityUIElement::notificationReceived(const char* notificationName) -{ - size_t callbackCount = m_notificationCallbacks.size(); - for (size_t i = 0; i < callbackCount; i++) { - CppVariant notificationNameArgument; - notificationNameArgument.set(notificationName); - CppVariant invokeResult; - m_notificationCallbacks[i].invokeDefault(¬ificationNameArgument, 1, invokeResult); - } -} - -// -// Properties -// - -void AccessibilityUIElement::roleGetterCallback(CppVariant* result) -{ - result->set(getRole(accessibilityObject())); -} - -void AccessibilityUIElement::titleGetterCallback(CppVariant* result) -{ - result->set(getTitle(accessibilityObject())); -} - -void AccessibilityUIElement::descriptionGetterCallback(CppVariant* result) -{ - result->set(getDescription(accessibilityObject())); -} - -void AccessibilityUIElement::helpTextGetterCallback(CppVariant* result) -{ - result->set(getHelpText(accessibilityObject())); -} - -void AccessibilityUIElement::stringValueGetterCallback(CppVariant* result) -{ - result->set(getStringValue(accessibilityObject())); -} - -void AccessibilityUIElement::xGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().boundingBoxRect().x); -} - -void AccessibilityUIElement::yGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().boundingBoxRect().y); -} - -void AccessibilityUIElement::widthGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().boundingBoxRect().width); -} - -void AccessibilityUIElement::heightGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().boundingBoxRect().height); -} - -void AccessibilityUIElement::intValueGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().valueForRange()); -} - -void AccessibilityUIElement::minValueGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().minValueForRange()); -} - -void AccessibilityUIElement::maxValueGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().maxValueForRange()); -} - -void AccessibilityUIElement::valueDescriptionGetterCallback(CppVariant* result) -{ - result->set(getValueDescription(accessibilityObject())); -} - -void AccessibilityUIElement::childrenCountGetterCallback(CppVariant* result) -{ - int count = 1; // Root object always has only one child, the WebView. - if (!isRoot()) - count = accessibilityObject().childCount(); - result->set(count); -} - -void AccessibilityUIElement::insertionPointLineNumberGetterCallback(CppVariant* result) -{ - if (!accessibilityObject().isFocused()) { - result->set(-1); - return; - } - - int lineNumber = accessibilityObject().selectionEndLineNumber(); - result->set(lineNumber); -} - -void AccessibilityUIElement::selectedTextRangeGetterCallback(CppVariant* result) -{ - unsigned selectionStart = accessibilityObject().selectionStart(); - unsigned selectionEnd = accessibilityObject().selectionEnd(); - char buffer[100]; - snprintf(buffer, sizeof(buffer), "{%d, %d}", selectionStart, selectionEnd - selectionStart); - - result->set(std::string(buffer)); -} - -void AccessibilityUIElement::isEnabledGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isEnabled()); -} - -void AccessibilityUIElement::isRequiredGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isRequired()); -} - -void AccessibilityUIElement::isFocusedGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isFocused()); -} - -void AccessibilityUIElement::isFocusableGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().canSetFocusAttribute()); -} - -void AccessibilityUIElement::isSelectedGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isSelected()); -} - -void AccessibilityUIElement::isSelectableGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().canSetSelectedAttribute()); -} - -void AccessibilityUIElement::isMultiSelectableGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isMultiSelectable()); -} - -void AccessibilityUIElement::isSelectedOptionActiveGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isSelectedOptionActive()); -} - -void AccessibilityUIElement::isExpandedGetterCallback(CppVariant* result) -{ - result->set(!accessibilityObject().isCollapsed()); -} - -void AccessibilityUIElement::isCheckedGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isChecked()); -} - -void AccessibilityUIElement::isVisibleGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isVisible()); -} - -void AccessibilityUIElement::isOffScreenGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isOffScreen()); -} - -void AccessibilityUIElement::isCollapsedGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isCollapsed()); -} - -void AccessibilityUIElement::hasPopupGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().ariaHasPopup()); -} - -void AccessibilityUIElement::isValidGetterCallback(CppVariant* result) -{ - result->set(!accessibilityObject().isDetached()); -} - -void AccessibilityUIElement::isReadOnlyGetterCallback(CppVariant* result) -{ - result->set(accessibilityObject().isReadOnly()); -} - -void AccessibilityUIElement::orientationGetterCallback(CppVariant* result) -{ - result->set(getOrientation(accessibilityObject())); -} - -// -// Methods -// - -void AccessibilityUIElement::allAttributesCallback(const CppArgumentList&, CppVariant* result) -{ - result->set(getAttributes(accessibilityObject())); -} - -void AccessibilityUIElement::attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfChildrenCallback(const CppArgumentList& arguments, CppVariant* result) -{ - AttributesCollector collector; - unsigned size = accessibilityObject().childCount(); - for (unsigned i = 0; i < size; ++i) - collector.collectAttributes(accessibilityObject().childAt(i)); - result->set(collector.attributes()); -} - -void AccessibilityUIElement::parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::lineForIndexCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (!arguments.size() || !arguments[0].isNumber()) { - result->setNull(); - return; - } - - int index = arguments[0].toInt32(); - - WebVector<int> lineBreaks; - accessibilityObject().lineBreaks(lineBreaks); - int line = 0; - int vectorSize = static_cast<int>(lineBreaks.size()); - while (line < vectorSize && lineBreaks[line] <= index) - line++; - result->set(line); -} - -void AccessibilityUIElement::boundsForRangeCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::stringForRangeCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::childAtIndexCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (!arguments.size() || !arguments[0].isNumber()) { - result->setNull(); - return; - } - - AccessibilityUIElement* child = getChildAtIndex(arguments[0].toInt32()); - if (!child) { - result->setNull(); - return; - } - - result->set(*(child->getAsCppVariant())); -} - -void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfColumnsCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfRowsCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::attributesOfHeaderCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::indexInTableCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::rowIndexRangeCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::columnIndexRangeCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::cellForColumnAndRowCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result) -{ - WebAccessibilityObject obj = accessibilityObject().titleUIElement(); - if (obj.isNull()) { - result->setNull(); - return; - } - - result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant())); -} - -void AccessibilityUIElement::setSelectedTextRangeCallback(const CppArgumentList&arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - - int selectionStart = arguments[0].toInt32(); - int selectionEnd = selectionStart + arguments[1].toInt32(); - accessibilityObject().setSelectedTextRange(selectionStart, selectionEnd); -} - -void AccessibilityUIElement::attributeValueCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::isAttributeSettableCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 1 && !arguments[0].isString()) { - result->setNull(); - return; - } - - string attribute = arguments[0].toString(); - bool settable = false; - if (attribute == "AXValue") - settable = accessibilityObject().canSetValueAttribute(); - result->set(settable); -} - -void AccessibilityUIElement::isActionSupportedCallback(const CppArgumentList&, CppVariant* result) -{ - // This one may be really hard to implement. - // Not exposed by AccessibilityObject. - result->setNull(); -} - -void AccessibilityUIElement::parentElementCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::incrementCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::decrementCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::showMenuCallback(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void AccessibilityUIElement::pressCallback(const CppArgumentList&, CppVariant* result) -{ - accessibilityObject().performDefaultAction(); - result->setNull(); -} - -void AccessibilityUIElement::isEqualCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 1 || !arguments[0].isObject()) { - result->setNull(); - return; - } - - result->set(arguments[0].isEqual(*getAsCppVariant())); -} - -void AccessibilityUIElement::addNotificationListenerCallback(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 1 || !arguments[0].isObject()) { - result->setNull(); - return; - } - - m_notificationCallbacks.push_back(arguments[0]); - result->setNull(); -} - -void AccessibilityUIElement::removeNotificationListenerCallback(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void AccessibilityUIElement::takeFocusCallback(const CppArgumentList&, CppVariant* result) -{ - accessibilityObject().setFocused(true); - result->setNull(); -} - -void AccessibilityUIElement::scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant* result) -{ - accessibilityObject().scrollToMakeVisible(); - result->setNull(); -} - -void AccessibilityUIElement::scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 4 - || !arguments[0].isNumber() - || !arguments[1].isNumber() - || !arguments[2].isNumber() - || !arguments[3].isNumber()) - return; - - int x = arguments[0].toInt32(); - int y = arguments[1].toInt32(); - int width = arguments[2].toInt32(); - int height = arguments[3].toInt32(); - accessibilityObject().scrollToMakeVisibleWithSubFocus(WebRect(x, y, width, height)); - result->setNull(); -} - -void AccessibilityUIElement::scrollToGlobalPointCallback(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 2 - || !arguments[0].isNumber() - || !arguments[1].isNumber()) - return; - - int x = arguments[0].toInt32(); - int y = arguments[1].toInt32(); - - accessibilityObject().scrollToGlobalPoint(WebPoint(x, y)); - result->setNull(); -} - -void AccessibilityUIElement::fallbackCallback(const CppArgumentList &, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -RootAccessibilityUIElement::RootAccessibilityUIElement(const WebAccessibilityObject &object, Factory *factory) - : AccessibilityUIElement(object, factory) { } - -AccessibilityUIElement* RootAccessibilityUIElement::getChildAtIndex(unsigned index) -{ - if (index) - return 0; - - return factory()->getOrCreate(accessibilityObject()); -} - - -AccessibilityUIElementList ::~AccessibilityUIElementList() -{ - clear(); -} - -void AccessibilityUIElementList::clear() -{ - for (ElementList::iterator i = m_elements.begin(); i != m_elements.end(); ++i) - delete (*i); - m_elements.clear(); -} - -AccessibilityUIElement* AccessibilityUIElementList::getOrCreate(const WebAccessibilityObject& object) -{ - if (object.isNull()) - return 0; - - size_t elementCount = m_elements.size(); - for (size_t i = 0; i < elementCount; i++) { - if (m_elements[i]->isEqual(object)) - return m_elements[i]; - } - - AccessibilityUIElement* element = new AccessibilityUIElement(object, this); - m_elements.append(element); - return element; -} - -AccessibilityUIElement* AccessibilityUIElementList::createRoot(const WebAccessibilityObject& object) -{ - AccessibilityUIElement* element = new RootAccessibilityUIElement(object, this); - m_elements.append(element); - return element; -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h deleted file mode 100644 index 4dc479e93..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef AccessibilityUIElementChromium_h -#define AccessibilityUIElementChromium_h - -#include "CppBoundClass.h" -#include "WebAccessibilityObject.h" -#include <vector> -#include <wtf/Vector.h> - -namespace WebTestRunner { - -class AccessibilityUIElement : public CppBoundClass { -public: - class Factory { - public: - virtual ~Factory() { } - virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&) = 0; - }; - - AccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); - - virtual AccessibilityUIElement* getChildAtIndex(unsigned); - virtual bool isRoot() const { return false; } - virtual bool isEqual(const WebKit::WebAccessibilityObject&); - - virtual void notificationReceived(const char *notificationName); - -protected: - const WebKit::WebAccessibilityObject& accessibilityObject() const { return m_accessibilityObject; } - - Factory* factory() const { return m_factory; } - -private: - // Bound properties. - void roleGetterCallback(CppVariant*); - void titleGetterCallback(CppVariant*); - void descriptionGetterCallback(CppVariant*); - void helpTextGetterCallback(CppVariant*); - void stringValueGetterCallback(CppVariant*); - void xGetterCallback(CppVariant*); - void yGetterCallback(CppVariant*); - void widthGetterCallback(CppVariant*); - void heightGetterCallback(CppVariant*); - void intValueGetterCallback(CppVariant*); - void minValueGetterCallback(CppVariant*); - void maxValueGetterCallback(CppVariant*); - void valueDescriptionGetterCallback(CppVariant*); - void childrenCountGetterCallback(CppVariant*); - void insertionPointLineNumberGetterCallback(CppVariant*); - void selectedTextRangeGetterCallback(CppVariant*); - void isEnabledGetterCallback(CppVariant*); - void isRequiredGetterCallback(CppVariant*); - void isFocusedGetterCallback(CppVariant*); - void isFocusableGetterCallback(CppVariant*); - void isSelectedGetterCallback(CppVariant*); - void isSelectableGetterCallback(CppVariant*); - void isMultiSelectableGetterCallback(CppVariant*); - void isSelectedOptionActiveGetterCallback(CppVariant*); - void isExpandedGetterCallback(CppVariant*); - void isCheckedGetterCallback(CppVariant*); - void isVisibleGetterCallback(CppVariant*); - void isOffScreenGetterCallback(CppVariant*); - void isCollapsedGetterCallback(CppVariant*); - void hasPopupGetterCallback(CppVariant*); - void isValidGetterCallback(CppVariant*); - void isReadOnlyGetterCallback(CppVariant*); - void orientationGetterCallback(CppVariant*); - - // Bound methods. - void allAttributesCallback(const CppArgumentList&, CppVariant*); - void attributesOfLinkedUIElementsCallback(const CppArgumentList&, CppVariant*); - void attributesOfDocumentLinksCallback(const CppArgumentList&, CppVariant*); - void attributesOfChildrenCallback(const CppArgumentList&, CppVariant*); - void parametrizedAttributeNamesCallback(const CppArgumentList&, CppVariant*); - void lineForIndexCallback(const CppArgumentList&, CppVariant*); - void boundsForRangeCallback(const CppArgumentList&, CppVariant*); - void stringForRangeCallback(const CppArgumentList&, CppVariant*); - void childAtIndexCallback(const CppArgumentList&, CppVariant*); - void elementAtPointCallback(const CppArgumentList&, CppVariant*); - void attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant*); - void attributesOfRowHeadersCallback(const CppArgumentList&, CppVariant*); - void attributesOfColumnsCallback(const CppArgumentList&, CppVariant*); - void attributesOfRowsCallback(const CppArgumentList&, CppVariant*); - void attributesOfVisibleCellsCallback(const CppArgumentList&, CppVariant*); - void attributesOfHeaderCallback(const CppArgumentList&, CppVariant*); - void indexInTableCallback(const CppArgumentList&, CppVariant*); - void rowIndexRangeCallback(const CppArgumentList&, CppVariant*); - void columnIndexRangeCallback(const CppArgumentList&, CppVariant*); - void cellForColumnAndRowCallback(const CppArgumentList&, CppVariant*); - void titleUIElementCallback(const CppArgumentList&, CppVariant*); - void setSelectedTextRangeCallback(const CppArgumentList&, CppVariant*); - void attributeValueCallback(const CppArgumentList&, CppVariant*); - void isAttributeSettableCallback(const CppArgumentList&, CppVariant*); - void isActionSupportedCallback(const CppArgumentList&, CppVariant*); - void parentElementCallback(const CppArgumentList&, CppVariant*); - void incrementCallback(const CppArgumentList&, CppVariant*); - void decrementCallback(const CppArgumentList&, CppVariant*); - void showMenuCallback(const CppArgumentList&, CppVariant*); - void pressCallback(const CppArgumentList&, CppVariant*); - void isEqualCallback(const CppArgumentList&, CppVariant*); - void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); - void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*); - void takeFocusCallback(const CppArgumentList&, CppVariant*); - void scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant*); - void scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList&, CppVariant*); - void scrollToGlobalPointCallback(const CppArgumentList&, CppVariant*); - - void fallbackCallback(const CppArgumentList&, CppVariant*); - - WebKit::WebAccessibilityObject m_accessibilityObject; - Factory* m_factory; - std::vector<CppVariant> m_notificationCallbacks; -}; - - -class RootAccessibilityUIElement : public AccessibilityUIElement { -public: - RootAccessibilityUIElement(const WebKit::WebAccessibilityObject&, Factory*); - - virtual AccessibilityUIElement* getChildAtIndex(unsigned); - virtual bool isRoot() const { return true; } -}; - - -// Provides simple lifetime management of the AccessibilityUIElement instances: -// all AccessibilityUIElements ever created from the controller are stored in -// a list and cleared explicitly. -class AccessibilityUIElementList : public AccessibilityUIElement::Factory { -public: - AccessibilityUIElementList() { } - virtual ~AccessibilityUIElementList(); - - void clear(); - virtual AccessibilityUIElement* getOrCreate(const WebKit::WebAccessibilityObject&); - AccessibilityUIElement* createRoot(const WebKit::WebAccessibilityObject&); - -private: - typedef Vector<AccessibilityUIElement*> ElementList; - ElementList m_elements; -}; - -} - -#endif // AccessibilityUIElementChromium_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp deleted file mode 100644 index 930de6113..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains definitions for CppBoundClass - -// Here's the control flow of a JS method getting forwarded to a class. -// - Something calls our NPObject with a function like "Invoke". -// - CppNPObject's static invoke() function forwards it to its attached -// CppBoundClass's invoke() method. -// - CppBoundClass has then overridden invoke() to look up the function -// name in its internal map of methods, and then calls the appropriate -// method. - -#include "config.h" -#include "CppBoundClass.h" - -#include "WebBindings.h" -#include "WebFrame.h" -#include "platform/WebString.h" -#include <wtf/Assertions.h> -#include <wtf/OwnPtr.h> - -using namespace WebKit; -using namespace std; - -namespace WebTestRunner { - -namespace { - -class CppVariantPropertyCallback : public CppBoundClass::PropertyCallback { -public: - CppVariantPropertyCallback(CppVariant* value) : m_value(value) { } - - virtual bool getValue(CppVariant* value) - { - value->set(*m_value); - return true; - } - - virtual bool setValue(const CppVariant& value) - { - m_value->set(value); - return true; - } - -private: - CppVariant* m_value; -}; - -class GetterPropertyCallback : public CppBoundClass::PropertyCallback { -public: - GetterPropertyCallback(PassOwnPtr<CppBoundClass::GetterCallback> callback) - : m_callback(callback) - { - } - - virtual bool getValue(CppVariant* value) - { - m_callback->run(value); - return true; - } - - virtual bool setValue(const CppVariant& value) { return false; } - -private: - OwnPtr<CppBoundClass::GetterCallback> m_callback; -}; - -} - -// Our special NPObject type. We extend an NPObject with a pointer to a -// CppBoundClass, which is just a C++ interface that we forward all NPObject -// callbacks to. -struct CppNPObject { - NPObject parent; // This must be the first field in the struct. - CppBoundClass* boundClass; - - // - // All following objects and functions are static, and just used to interface - // with NPObject/NPClass. - // - - // An NPClass associates static functions of CppNPObject with the - // function pointers used by the JS runtime. - static NPClass npClass; - - // Allocate a new NPObject with the specified class. - static NPObject* allocate(NPP, NPClass*); - - // Free an object. - static void deallocate(NPObject*); - - // Returns true if the C++ class associated with this NPObject exposes the - // given property. Called by the JS runtime. - static bool hasProperty(NPObject*, NPIdentifier); - - // Returns true if the C++ class associated with this NPObject exposes the - // given method. Called by the JS runtime. - static bool hasMethod(NPObject*, NPIdentifier); - - // If the given method is exposed by the C++ class associated with this - // NPObject, invokes it with the given arguments and returns a result. Otherwise, - // returns "undefined" (in the JavaScript sense). Called by the JS runtime. - static bool invoke(NPObject*, NPIdentifier, - const NPVariant* arguments, uint32_t argumentCount, - NPVariant* result); - - // If the given property is exposed by the C++ class associated with this - // NPObject, returns its value. Otherwise, returns "undefined" (in the - // JavaScript sense). Called by the JS runtime. - static bool getProperty(NPObject*, NPIdentifier, NPVariant* result); - - // If the given property is exposed by the C++ class associated with this - // NPObject, sets its value. Otherwise, does nothing. Called by the JS - // runtime. - static bool setProperty(NPObject*, NPIdentifier, const NPVariant* value); -}; - -// Build CppNPObject's static function pointers into an NPClass, for use -// in constructing NPObjects for the C++ classes. -NPClass CppNPObject::npClass = { - NP_CLASS_STRUCT_VERSION, - CppNPObject::allocate, - CppNPObject::deallocate, - /* NPInvalidateFunctionPtr */ 0, - CppNPObject::hasMethod, - CppNPObject::invoke, - /* NPInvokeDefaultFunctionPtr */ 0, - CppNPObject::hasProperty, - CppNPObject::getProperty, - CppNPObject::setProperty, - /* NPRemovePropertyFunctionPtr */ 0 -}; - -NPObject* CppNPObject::allocate(NPP npp, NPClass* aClass) -{ - CppNPObject* obj = new CppNPObject; - // obj->parent will be initialized by the NPObject code calling this. - obj->boundClass = 0; - return &obj->parent; -} - -void CppNPObject::deallocate(NPObject* npObj) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - delete obj; -} - -bool CppNPObject::hasMethod(NPObject* npObj, NPIdentifier ident) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - return obj->boundClass->hasMethod(ident); -} - -bool CppNPObject::hasProperty(NPObject* npObj, NPIdentifier ident) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - return obj->boundClass->hasProperty(ident); -} - -bool CppNPObject::invoke(NPObject* npObj, NPIdentifier ident, - const NPVariant* arguments, uint32_t argumentCount, - NPVariant* result) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - return obj->boundClass->invoke(ident, arguments, argumentCount, result); -} - -bool CppNPObject::getProperty(NPObject* npObj, NPIdentifier ident, NPVariant* result) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - return obj->boundClass->getProperty(ident, result); -} - -bool CppNPObject::setProperty(NPObject* npObj, NPIdentifier ident, const NPVariant* value) -{ - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - return obj->boundClass->setProperty(ident, value); -} - -CppBoundClass::~CppBoundClass() -{ - for (MethodList::iterator i = m_methods.begin(); i != m_methods.end(); ++i) - delete i->value; - - for (PropertyList::iterator i = m_properties.begin(); i != m_properties.end(); ++i) - delete i->value; - - // Unregister ourselves if we were bound to a frame. - if (m_boundToFrame) - WebBindings::unregisterObject(NPVARIANT_TO_OBJECT(m_selfVariant)); -} - -bool CppBoundClass::hasMethod(NPIdentifier ident) const -{ - return m_methods.find(ident) != m_methods.end(); -} - -bool CppBoundClass::hasProperty(NPIdentifier ident) const -{ - return m_properties.find(ident) != m_properties.end(); -} - -bool CppBoundClass::invoke(NPIdentifier ident, - const NPVariant* arguments, - size_t argumentCount, - NPVariant* result) { - MethodList::const_iterator end = m_methods.end(); - MethodList::const_iterator method = m_methods.find(ident); - Callback* callback; - if (method == end) { - if (!m_fallbackCallback.get()) { - VOID_TO_NPVARIANT(*result); - return false; - } - callback = m_fallbackCallback.get(); - } else - callback = (*method).value; - - // Build a CppArgumentList argument vector from the NPVariants coming in. - CppArgumentList cppArguments(argumentCount); - for (size_t i = 0; i < argumentCount; i++) - cppArguments[i].set(arguments[i]); - - CppVariant cppResult; - callback->run(cppArguments, &cppResult); - - cppResult.copyToNPVariant(result); - return true; -} - -bool CppBoundClass::getProperty(NPIdentifier ident, NPVariant* result) const -{ - PropertyList::const_iterator callback = m_properties.find(ident); - if (callback == m_properties.end()) { - VOID_TO_NPVARIANT(*result); - return false; - } - - CppVariant cppValue; - if (!callback->value->getValue(&cppValue)) - return false; - cppValue.copyToNPVariant(result); - return true; -} - -bool CppBoundClass::setProperty(NPIdentifier ident, const NPVariant* value) -{ - PropertyList::iterator callback = m_properties.find(ident); - if (callback == m_properties.end()) - return false; - - CppVariant cppValue; - cppValue.set(*value); - return (*callback).value->setValue(cppValue); -} - -void CppBoundClass::bindCallback(const string& name, Callback* callback) -{ - NPIdentifier ident = WebBindings::getStringIdentifier(name.c_str()); - MethodList::iterator oldCallback = m_methods.find(ident); - if (oldCallback != m_methods.end()) { - delete oldCallback->value; - if (!callback) { - m_methods.remove(oldCallback); - return; - } - } - - m_methods.set(ident, callback); -} - -void CppBoundClass::bindGetterCallback(const string& name, PassOwnPtr<GetterCallback> callback) -{ - PropertyCallback* propertyCallback = callback ? new GetterPropertyCallback(callback) : 0; - bindProperty(name, propertyCallback); -} - -void CppBoundClass::bindProperty(const string& name, CppVariant* prop) -{ - PropertyCallback* propertyCallback = prop ? new CppVariantPropertyCallback(prop) : 0; - bindProperty(name, propertyCallback); -} - -void CppBoundClass::bindProperty(const string& name, PropertyCallback* callback) -{ - NPIdentifier ident = WebBindings::getStringIdentifier(name.c_str()); - PropertyList::iterator oldCallback = m_properties.find(ident); - if (oldCallback != m_properties.end()) { - delete oldCallback->value; - if (!callback) { - m_properties.remove(oldCallback); - return; - } - } - - m_properties.set(ident, callback); -} - -bool CppBoundClass::isMethodRegistered(const string& name) const -{ - NPIdentifier ident = WebBindings::getStringIdentifier(name.c_str()); - MethodList::const_iterator callback = m_methods.find(ident); - return callback != m_methods.end(); -} - -CppVariant* CppBoundClass::getAsCppVariant() -{ - if (!m_selfVariant.isObject()) { - // Create an NPObject using our static NPClass. The first argument (a - // plugin's instance handle) is passed through to the allocate function - // directly, and we don't use it, so it's ok to be 0. - NPObject* npObj = WebBindings::createObject(0, &CppNPObject::npClass); - CppNPObject* obj = reinterpret_cast<CppNPObject*>(npObj); - obj->boundClass = this; - m_selfVariant.set(npObj); - WebBindings::releaseObject(npObj); // CppVariant takes the reference. - } - ASSERT(m_selfVariant.isObject()); - return &m_selfVariant; -} - -void CppBoundClass::bindToJavascript(WebFrame* frame, const WebString& classname) -{ - // BindToWindowObject will take its own reference to the NPObject, and clean - // up after itself. It will also (indirectly) register the object with V8, - // so we must remember this so we can unregister it when we're destroyed. - frame->bindToWindowObject(classname, NPVARIANT_TO_OBJECT(*getAsCppVariant())); - m_boundToFrame = true; -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h deleted file mode 100644 index 54af6ddce..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - CppBoundClass class: - This base class serves as a parent for C++ classes designed to be bound to - JavaScript objects. - - Subclasses should define the constructor to build the property and method - lists needed to bind this class to a JS object. They should also declare - and define member variables and methods to be exposed to JS through - that object. -*/ - -#ifndef CppBoundClass_h -#define CppBoundClass_h - -#include "CppVariant.h" -#include <wtf/HashMap.h> -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -namespace WebKit { -class WebFrame; -class WebString; -} - -namespace WebTestRunner { - -typedef Vector<CppVariant> CppArgumentList; - -// CppBoundClass lets you map Javascript method calls and property accesses -// directly to C++ method calls and CppVariant* variable access. -class CppBoundClass { - WTF_MAKE_NONCOPYABLE(CppBoundClass); -public: - class PropertyCallback { - public: - virtual ~PropertyCallback() { } - - // Sets |value| to the value of the property. Returns false in case of - // failure. |value| is always non-0. - virtual bool getValue(CppVariant* result) = 0; - - // sets the property value to |value|. Returns false in case of failure. - virtual bool setValue(const CppVariant&) = 0; - }; - - // Callback class for "void function(CppVariant*)" - class GetterCallback { - public: - virtual ~GetterCallback() { } - virtual void run(CppVariant*) = 0; - }; - - // The constructor should call BindMethod, BindProperty, and - // SetFallbackMethod as needed to set up the methods, properties, and - // fallback method. - CppBoundClass() : m_boundToFrame(false) { } - virtual ~CppBoundClass(); - - // Return a CppVariant representing this class, for use with BindProperty(). - // The variant type is guaranteed to be NPVariantType_Object. - CppVariant* getAsCppVariant(); - - // Given a WebFrame, BindToJavascript builds the NPObject that will represent - // the class and binds it to the frame's window under the given name. This - // should generally be called from the WebView delegate's - // WindowObjectCleared(). A class so bound will be accessible to JavaScript - // as window.<classname>. The owner of the CppBoundObject is responsible for - // keeping the object around while the frame is alive, and for destroying it - // afterwards. - void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); - - // Used by a test. Returns true if a method with the specified name exists, - // regardless of whether a fallback is registered. - bool isMethodRegistered(const std::string&) const; - -protected: - // Callback for "void function(const CppArguemntList&, CppVariant*)" - class Callback { - public: - virtual ~Callback() { } - virtual void run(const CppArgumentList&, CppVariant*) = 0; - }; - - // Callback for "void T::method(const CppArguemntList&, CppVariant*)" - template <class T> class MemberCallback : public Callback { - public: - typedef void (T::*MethodType)(const CppArgumentList&, CppVariant*); - MemberCallback(T* object, MethodType method) - : m_object(object) - , m_method(method) { } - virtual ~MemberCallback() { } - - virtual void run(const CppArgumentList& arguments, CppVariant* result) - { - (m_object->*m_method)(arguments, result); - } - - private: - T* m_object; - MethodType m_method; - }; - - // Callback class for "void T::method(CppVariant*)" - template <class T> class MemberGetterCallback : public GetterCallback { - public: - typedef void (T::*MethodType)(CppVariant*); - MemberGetterCallback(T* object, MethodType method) - : m_object(object) - , m_method(method) { } - virtual ~MemberGetterCallback() { } - - virtual void run(CppVariant* result) { (m_object->*m_method)(result); } - - private: - T* m_object; - MethodType m_method; - }; - - // Bind the Javascript method called the string parameter to the C++ method. - void bindCallback(const std::string&, Callback*); - - // A wrapper for bindCallback, to simplify the common case of binding a - // method on the current object. Though not verified here, the method parameter - // must be a method of this CppBoundClass subclass. - template<class T> - void bindMethod(const std::string& name, void (T::*method)(const CppArgumentList&, CppVariant*)) - { - Callback* callback = new MemberCallback<T>(static_cast<T*>(this), method); - bindCallback(name, callback); - } - - // Bind Javascript property |name| to the C++ getter callback |callback|. - // This can be used to create read-only properties. - void bindGetterCallback(const std::string&, PassOwnPtr<GetterCallback>); - - // A wrapper for BindGetterCallback, to simplify the common case of binding a - // property on the current object. Though not verified here, the method parameter - // must be a method of this CppBoundClass subclass. - template<class T> - void bindProperty(const std::string& name, void (T::*method)(CppVariant*)) - { - OwnPtr<GetterCallback> callback = adoptPtr(new MemberGetterCallback<T>(static_cast<T*>(this), method)); - bindGetterCallback(name, callback.release()); - } - - // Bind the Javascript property called |name| to a CppVariant. - void bindProperty(const std::string&, CppVariant*); - - // Bind Javascript property called |name| to a PropertyCallback. - // CppBoundClass assumes control over the life time of the callback. - void bindProperty(const std::string&, PropertyCallback*); - - // Set the fallback callback, which is called when when a callback is - // invoked that isn't bound. - // If it is 0 (its default value), a JavaScript exception is thrown in - // that case (as normally expected). If non 0, the fallback method is - // invoked and the script continues its execution. - // Passing 0 clears out any existing binding. - // It is used for tests and should probably only be used in such cases - // as it may cause unexpected behaviors (a JavaScript object with a - // fallback always returns true when checked for a method's - // existence). - void bindFallbackCallback(PassOwnPtr<Callback> fallbackCallback) - { - m_fallbackCallback = fallbackCallback; - } - - // A wrapper for BindFallbackCallback, to simplify the common case of - // binding a method on the current object. Though not verified here, - // |method| must be a method of this CppBoundClass subclass. - // Passing 0 for |method| clears out any existing binding. - template<class T> - void bindFallbackMethod(void (T::*method)(const CppArgumentList&, CppVariant*)) - { - if (method) { - OwnPtr<Callback> callback = adoptPtr(new MemberCallback<T>(static_cast<T*>(this), method)); - bindFallbackCallback(callback.release()); - } else - bindFallbackCallback(nullptr); - } - - // Some fields are protected because some tests depend on accessing them, - // but otherwise they should be considered private. - - typedef HashMap<NPIdentifier, PropertyCallback*> PropertyList; - typedef HashMap<NPIdentifier, Callback*> MethodList; - // These maps associate names with property and method pointers to be - // exposed to JavaScript. - PropertyList m_properties; - MethodList m_methods; - - // The callback gets invoked when a call is made to an nonexistent method. - OwnPtr<Callback> m_fallbackCallback; - -private: - // NPObject callbacks. - friend struct CppNPObject; - bool hasMethod(NPIdentifier) const; - bool invoke(NPIdentifier, const NPVariant* args, size_t argCount, - NPVariant* result); - bool hasProperty(NPIdentifier) const; - bool getProperty(NPIdentifier, NPVariant* result) const; - bool setProperty(NPIdentifier, const NPVariant*); - - // A lazily-initialized CppVariant representing this class. We retain 1 - // reference to this object, and it is released on deletion. - CppVariant m_selfVariant; - - // True if our np_object has been bound to a WebFrame, in which case it must - // be unregistered with V8 when we delete it. - bool m_boundToFrame; -}; - -} - -#endif // CppBoundClass_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp deleted file mode 100644 index 4d2856e74..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "CppVariant.h" - -#include "WebBindings.h" -#include <limits> -#include <wtf/Assertions.h> -#include <wtf/StringExtras.h> - -using namespace WebKit; -using namespace std; - -namespace WebTestRunner { - -CppVariant::CppVariant() -{ - type = NPVariantType_Null; -} - -// Note that Set() performs a deep copy, which is necessary to safely -// call FreeData() on the value in the destructor. -CppVariant::CppVariant(const CppVariant& original) -{ - type = NPVariantType_Null; - set(original); -} - -// See comment for copy constructor, above. -CppVariant& CppVariant::operator=(const CppVariant& original) -{ - if (&original != this) - set(original); - return *this; -} - -CppVariant::~CppVariant() -{ - freeData(); -} - -void CppVariant::freeData() -{ - WebBindings::releaseVariantValue(this); -} - -bool CppVariant::isEqual(const CppVariant& other) const -{ - if (type != other.type) - return false; - - switch (type) { - case NPVariantType_Bool: - return (value.boolValue == other.value.boolValue); - case NPVariantType_Int32: - return (value.intValue == other.value.intValue); - case NPVariantType_Double: - return (value.doubleValue == other.value.doubleValue); - case NPVariantType_String: { - const NPString *this_value = &value.stringValue; - const NPString *other_value = &other.value.stringValue; - uint32_t len = this_value->UTF8Length; - return len == other_value->UTF8Length - && !strncmp(this_value->UTF8Characters, - other_value->UTF8Characters, len); - } - case NPVariantType_Null: - case NPVariantType_Void: - return true; - case NPVariantType_Object: { - NPObject* thisValue = value.objectValue; - NPObject* otherValue = other.value.objectValue; - return thisValue->_class == otherValue->_class - && thisValue->referenceCount == otherValue->referenceCount; - } - } - return false; -} - -void CppVariant::copyToNPVariant(NPVariant* result) const -{ - result->type = type; - switch (type) { - case NPVariantType_Bool: - result->value.boolValue = value.boolValue; - break; - case NPVariantType_Int32: - result->value.intValue = value.intValue; - break; - case NPVariantType_Double: - result->value.doubleValue = value.doubleValue; - break; - case NPVariantType_String: - WebBindings::initializeVariantWithStringCopy(result, &value.stringValue); - break; - case NPVariantType_Null: - case NPVariantType_Void: - // Nothing to set. - break; - case NPVariantType_Object: - result->type = NPVariantType_Object; - result->value.objectValue = WebBindings::retainObject(value.objectValue); - break; - } -} - -void CppVariant::set(const NPVariant& newValue) -{ - freeData(); - switch (newValue.type) { - case NPVariantType_Bool: - set(newValue.value.boolValue); - break; - case NPVariantType_Int32: - set(newValue.value.intValue); - break; - case NPVariantType_Double: - set(newValue.value.doubleValue); - break; - case NPVariantType_String: - set(newValue.value.stringValue); - break; - case NPVariantType_Null: - case NPVariantType_Void: - type = newValue.type; - break; - case NPVariantType_Object: - set(newValue.value.objectValue); - break; - } -} - -void CppVariant::setNull() -{ - freeData(); - type = NPVariantType_Null; -} - -void CppVariant::set(bool newValue) -{ - freeData(); - type = NPVariantType_Bool; - value.boolValue = newValue; -} - -void CppVariant::set(int32_t newValue) -{ - freeData(); - type = NPVariantType_Int32; - value.intValue = newValue; -} - -void CppVariant::set(double newValue) -{ - freeData(); - type = NPVariantType_Double; - value.doubleValue = newValue; -} - -// The newValue must be a null-terminated string. -void CppVariant::set(const char* newValue) -{ - freeData(); - type = NPVariantType_String; - NPString newString = {newValue, - static_cast<uint32_t>(strlen(newValue))}; - WebBindings::initializeVariantWithStringCopy(this, &newString); -} - -void CppVariant::set(const string& newValue) -{ - freeData(); - type = NPVariantType_String; - NPString newString = {newValue.data(), - static_cast<uint32_t>(newValue.size())}; - WebBindings::initializeVariantWithStringCopy(this, &newString); -} - -void CppVariant::set(const NPString& newValue) -{ - freeData(); - type = NPVariantType_String; - WebBindings::initializeVariantWithStringCopy(this, &newValue); -} - -void CppVariant::set(NPObject* newValue) -{ - freeData(); - type = NPVariantType_Object; - value.objectValue = WebBindings::retainObject(newValue); -} - -string CppVariant::toString() const -{ - ASSERT(isString()); - return string(value.stringValue.UTF8Characters, - value.stringValue.UTF8Length); -} - -int32_t CppVariant::toInt32() const -{ - if (isInt32()) - return value.intValue; - if (isDouble()) - return static_cast<int32_t>(value.doubleValue); - ASSERT_NOT_REACHED(); - return 0; -} - -double CppVariant::toDouble() const -{ - if (isInt32()) - return static_cast<double>(value.intValue); - if (isDouble()) - return value.doubleValue; - ASSERT_NOT_REACHED(); - return 0; -} - -bool CppVariant::toBoolean() const -{ - ASSERT(isBool()); - return value.boolValue; -} - -Vector<string> CppVariant::toStringVector() const -{ - - ASSERT(isObject()); - Vector<string> stringVector; - NPObject* npValue = value.objectValue; - NPIdentifier lengthId = WebBindings::getStringIdentifier("length"); - - if (!WebBindings::hasProperty(0, npValue, lengthId)) - return stringVector; - - NPVariant lengthValue; - if (!WebBindings::getProperty(0, npValue, lengthId, &lengthValue)) - return stringVector; - - int length = 0; - // The length is a double in some cases. - if (NPVARIANT_IS_DOUBLE(lengthValue)) - length = static_cast<int>(NPVARIANT_TO_DOUBLE(lengthValue)); - else if (NPVARIANT_IS_INT32(lengthValue)) - length = NPVARIANT_TO_INT32(lengthValue); - WebBindings::releaseVariantValue(&lengthValue); - - // For sanity, only allow 100 items. - length = min(100, length); - for (int i = 0; i < length; ++i) { - // Get each of the items. - char indexInChar[20]; // Enough size to store 32-bit integer - snprintf(indexInChar, 20, "%d", i); - string index(indexInChar); - NPIdentifier indexId = WebBindings::getStringIdentifier(index.c_str()); - if (!WebBindings::hasProperty(0, npValue, indexId)) - continue; - NPVariant indexValue; - if (!WebBindings::getProperty(0, npValue, indexId, &indexValue)) - continue; - if (NPVARIANT_IS_STRING(indexValue)) { - string item(NPVARIANT_TO_STRING(indexValue).UTF8Characters, - NPVARIANT_TO_STRING(indexValue).UTF8Length); - stringVector.append(item); - } - WebBindings::releaseVariantValue(&indexValue); - } - return stringVector; -} - -bool CppVariant::invoke(const string& method, const CppVariant* arguments, - uint32_t argumentCount, CppVariant& result) const -{ - ASSERT(isObject()); - NPIdentifier methodName = WebBindings::getStringIdentifier(method.c_str()); - NPObject* npObject = value.objectValue; - if (!WebBindings::hasMethod(0, npObject, methodName)) - return false; - NPVariant r; - bool status = WebBindings::invoke(0, npObject, methodName, arguments, argumentCount, &r); - result.set(r); - return status; -} - -bool CppVariant::invokeDefault(const CppVariant* arguments, uint32_t argumentCount, - CppVariant& result) const -{ - ASSERT(isObject()); - NPObject* npObject = value.objectValue; - NPVariant r; - bool status = WebBindings::invokeDefault(0, npObject, arguments, argumentCount, &r); - result.set(r); - return status; -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h deleted file mode 100644 index e82a70b66..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - This file contains the declaration for CppVariant, a type used by C++ classes - that are to be bound to JavaScript objects. - - CppVariant exists primarily as an interface between C++ callers and the - corresponding NPVariant type. CppVariant also provides a number of - convenience constructors and accessors, so that the NPVariantType values - don't need to be exposed, and a destructor to free any memory allocated for - string values. -*/ - -#ifndef CppVariant_h -#define CppVariant_h - -#include "WebBindings.h" -#include <string> -#include <wtf/Vector.h> - -namespace WebTestRunner { - -class CppVariant : public NPVariant { -public: - CppVariant(); - ~CppVariant(); - void setNull(); - void set(bool); - void set(int32_t); - void set(double); - - // Note that setting a CppVariant to a string value involves copying the - // string data, which must be freed with a call to freeData() when the - // CppVariant is set to a different value or is no longer needed. Normally - // this is handled by the other set() methods and by the destructor. - void set(const char*); // Must be a null-terminated string. - void set(const std::string&); - void set(const NPString&); - void set(const NPVariant&); - - // Note that setting a CppVariant to an NPObject involves ref-counting - // the actual object. freeData() should only be called if the CppVariant - // is no longer needed. The other set() methods handle this internally. - // Also, the object's NPClass is expected to be a static object: neither - // the NP runtime nor CppVariant will ever free it. - void set(NPObject*_value); - - // These three methods all perform deep copies of any string data. This - // allows local CppVariants to be released by the destructor without - // corrupting their sources. In performance-critical code, or when strings - // are very long, avoid creating new CppVariants. - // In case of NPObject as the data, the copying involves ref-counting - // as opposed to deep-copying. The ref-counting ensures that sources don't - // get corrupted when the copies get destroyed. - void copyToNPVariant(NPVariant* result) const; - CppVariant& operator=(const CppVariant& original); - CppVariant(const CppVariant& original); - - // Calls NPN_ReleaseVariantValue, which frees any string data - // held by the object and sets its type to null. - // In case of NPObject, the NPN_ReleaseVariantValue decrements - // the ref-count (releases when ref-count becomes 0) - void freeData(); - - // Compares this CppVariant's type and value to another's. They must be - // identical in both type and value to be considered equal. For string and - // object types, a deep comparison is performed; that is, the contents of the - // strings, or the classes and refcounts of the objects, must be the same, - // but they need not be the same pointers. - bool isEqual(const CppVariant&) const; - - // The value of a CppVariant may be read directly from its NPVariant (but - // should only be set using one of the set() methods above). Although the - // type of a CppVariant is likewise public, it can be accessed through these - // functions rather than directly if a caller wishes to avoid dependence on - // the NPVariantType values. - bool isBool() const { return (type == NPVariantType_Bool); } - bool isInt32() const { return (type == NPVariantType_Int32); } - bool isDouble() const { return (type == NPVariantType_Double); } - bool isNumber() const { return (isInt32() || isDouble()); } - bool isString() const { return (type == NPVariantType_String); } - bool isVoid() const { return (type == NPVariantType_Void); } - bool isNull() const { return (type == NPVariantType_Null); } - bool isEmpty() const { return (isVoid() || isNull()); } - bool isObject() const { return (type == NPVariantType_Object); } - - // Converters. The CppVariant must be of a type convertible to these values. - // For example, toInt32() works only if isNumber() is true. - std::string toString() const; - int32_t toInt32() const; - double toDouble() const; - bool toBoolean() const; - // Returns a vector of strings for the specified argument. This is useful - // for converting a JavaScript array of strings into a vector of strings. - Vector<std::string> toStringVector() const; - - // Invoke method of the given name on an object with the supplied arguments. - // The first argument should be the object on which the method is to be - // invoked. Returns whether the method was successfully invoked. If the - // method was invoked successfully, any return value is stored in the - // CppVariant specified by result. - bool invoke(const std::string&, const CppVariant* arguments, - uint32_t argumentCount, CppVariant& result) const; - - // Invoke an object's default method with the supplied arguments. - // The first argument should be the object on which the method is to be - // invoked. Returns whether the method was successfully invoked. If the - // method was invoked successfully, any return value is stored in the - // CppVariant specified by result. - bool invokeDefault(const CppVariant* arguments, - uint32_t argumentCount, CppVariant& result) const; -}; - -} - -#endif // CppVariant_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp deleted file mode 100644 index 773a56b17..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp +++ /dev/null @@ -1,1301 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file contains the definition for EventSender. -// -// Some notes about drag and drop handling: -// Windows drag and drop goes through a system call to doDragDrop. At that -// point, program control is given to Windows which then periodically makes -// callbacks into the webview. This won't work for layout tests, so instead, -// we queue up all the mouse move and mouse up events. When the test tries to -// start a drag (by calling EvenSendingController::doDragDrop), we take the -// events in the queue and replay them. -// The behavior of queuing events and replaying them can be disabled by a -// layout test by setting eventSender.dragMode to false. - -#include "config.h" -#include "EventSender.h" - -#include "KeyCodeMapping.h" -#include "TestDelegate.h" -#include "WebContextMenuData.h" -#include "WebDragOperation.h" -#include "WebEventSender.h" -#include "WebTouchPoint.h" -#include "WebView.h" -#include "platform/WebDragData.h" -#include "platform/WebPoint.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" -#include <wtf/Deque.h> -#include <wtf/StringExtras.h> - -#if OS(WINDOWS) -#include "win/WebInputEventFactory.h" -#endif - -// FIXME: layout before each event? - -using namespace std; -using namespace WebKit; - -namespace WebTestRunner { - -WebPoint EventSender::lastMousePos; -WebMouseEvent::Button EventSender::pressedButton = WebMouseEvent::ButtonNone; -WebMouseEvent::Button EventSender::lastButtonType = WebMouseEvent::ButtonNone; - -namespace { - -struct SavedEvent { - enum SavedEventType { - Unspecified, - MouseUp, - MouseMove, - LeapForward - }; - - SavedEventType type; - WebMouseEvent::Button buttonType; // For MouseUp. - WebPoint pos; // For MouseMove. - int milliseconds; // For LeapForward. - - SavedEvent() - : type(Unspecified) - , buttonType(WebMouseEvent::ButtonNone) - , milliseconds(0) { } -}; - -WebDragData currentDragData; -WebDragOperation currentDragEffect; -WebDragOperationsMask currentDragEffectsAllowed; -bool replayingSavedEvents = false; -Deque<SavedEvent> mouseEventQueue; -int touchModifiers; -Vector<WebTouchPoint> touchPoints; - -// Time and place of the last mouse up event. -double lastClickTimeSec = 0; -WebPoint lastClickPos; -int clickCount = 0; - -// maximum distance (in space and time) for a mouse click -// to register as a double or triple click -const double multipleClickTimeSec = 1; -const int multipleClickRadiusPixels = 5; - -// How much we should scroll per event - the value here is chosen to -// match the WebKit impl and layout test results. -const float scrollbarPixelsPerTick = 40.0f; - -inline bool outsideMultiClickRadius(const WebPoint& a, const WebPoint& b) -{ - return ((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) > - multipleClickRadiusPixels * multipleClickRadiusPixels; -} - -// Used to offset the time the event hander things an event happened. This is -// done so tests can run without a delay, but bypass checks that are time -// dependent (e.g., dragging has a timeout vs selection). -uint32 timeOffsetMs = 0; - -double getCurrentEventTimeSec(TestDelegate* delegate) -{ - return (delegate->getCurrentTimeInMillisecond() + timeOffsetMs) / 1000.0; -} - -void advanceEventTime(int32_t deltaMs) -{ - timeOffsetMs += deltaMs; -} - -void initMouseEvent(WebInputEvent::Type t, WebMouseEvent::Button b, const WebPoint& pos, WebMouseEvent* e, double ts) -{ - e->type = t; - e->button = b; - e->modifiers = 0; - e->x = pos.x; - e->y = pos.y; - e->globalX = pos.x; - e->globalY = pos.y; - e->timeStampSeconds = ts; - e->clickCount = clickCount; -} - -// Returns true if the specified key is the system key. -bool applyKeyModifier(const string& modifierName, WebInputEvent* event) -{ - bool isSystemKey = false; - const char* characters = modifierName.c_str(); - if (!strcmp(characters, "ctrlKey") -#if !OS(MAC_OS_X) - || !strcmp(characters, "addSelectionKey") -#endif - ) { - event->modifiers |= WebInputEvent::ControlKey; - } else if (!strcmp(characters, "shiftKey") || !strcmp(characters, "rangeSelectionKey")) - event->modifiers |= WebInputEvent::ShiftKey; - else if (!strcmp(characters, "altKey")) { - event->modifiers |= WebInputEvent::AltKey; -#if !OS(MAC_OS_X) - // On Windows all keys with Alt modifier will be marked as system key. - // We keep the same behavior on Linux and everywhere non-Mac, see: - // WebKit/chromium/src/gtk/WebInputEventFactory.cpp - // If we want to change this behavior on Linux, this piece of code must be - // kept in sync with the related code in above file. - isSystemKey = true; -#endif -#if OS(MAC_OS_X) - } else if (!strcmp(characters, "metaKey") || !strcmp(characters, "addSelectionKey")) { - event->modifiers |= WebInputEvent::MetaKey; - // On Mac only command key presses are marked as system key. - // See the related code in: WebKit/chromium/src/mac/WebInputEventFactory.cpp - // It must be kept in sync with the related code in above file. - isSystemKey = true; -#else - } else if (!strcmp(characters, "metaKey")) { - event->modifiers |= WebInputEvent::MetaKey; -#endif - } - return isSystemKey; -} - -bool applyKeyModifiers(const CppVariant* argument, WebInputEvent* event) -{ - bool isSystemKey = false; - if (argument->isObject()) { - Vector<string> modifiers = argument->toStringVector(); - for (Vector<string>::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i) - isSystemKey |= applyKeyModifier(*i, event); - } else if (argument->isString()) - isSystemKey = applyKeyModifier(argument->toString(), event); - return isSystemKey; -} - -// Get the edit command corresponding to a keyboard event. -// Returns true if the specified event corresponds to an edit command, the name -// of the edit command will be stored in |*name|. -bool getEditCommand(const WebKeyboardEvent& event, string* name) -{ -#if OS(MAC_OS_X) - // We only cares about Left,Right,Up,Down keys with Command or Command+Shift - // modifiers. These key events correspond to some special movement and - // selection editor commands, and was supposed to be handled in - // WebKit/chromium/src/EditorClientImpl.cpp. But these keys will be marked - // as system key, which prevents them from being handled. Thus they must be - // handled specially. - if ((event.modifiers & ~WebKeyboardEvent::ShiftKey) != WebKeyboardEvent::MetaKey) - return false; - - switch (event.windowsKeyCode) { - case VKEY_LEFT: - *name = "MoveToBeginningOfLine"; - break; - case VKEY_RIGHT: - *name = "MoveToEndOfLine"; - break; - case VKEY_UP: - *name = "MoveToBeginningOfDocument"; - break; - case VKEY_DOWN: - *name = "MoveToEndOfDocument"; - break; - default: - return false; - } - - if (event.modifiers & WebKeyboardEvent::ShiftKey) - name->append("AndModifySelection"); - - return true; -#else - return false; -#endif -} - -// Key event location code introduced in DOM Level 3. -// See also: http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents -enum KeyLocationCode { - DOMKeyLocationStandard = 0x00, - DOMKeyLocationLeft = 0x01, - DOMKeyLocationRight = 0x02, - DOMKeyLocationNumpad = 0x03 -}; - -} - -EventSender::EventSender() - : m_delegate(0) -{ - // Initialize the map that associates methods of this class with the names - // they will use when called by JavaScript. The actual binding of those - // names to their methods will be done by calling bindToJavaScript() (defined - // by CppBoundClass, the parent to EventSender). - bindMethod("addTouchPoint", &EventSender::addTouchPoint); - bindMethod("beginDragWithFiles", &EventSender::beginDragWithFiles); - bindMethod("cancelTouchPoint", &EventSender::cancelTouchPoint); - bindMethod("clearKillRing", &EventSender::clearKillRing); - bindMethod("clearTouchPoints", &EventSender::clearTouchPoints); - bindMethod("contextClick", &EventSender::contextClick); - bindMethod("continuousMouseScrollBy", &EventSender::continuousMouseScrollBy); - bindMethod("dispatchMessage", &EventSender::dispatchMessage); - bindMethod("dumpFilenameBeingDragged", &EventSender::dumpFilenameBeingDragged); - bindMethod("enableDOMUIEventLogging", &EventSender::enableDOMUIEventLogging); - bindMethod("fireKeyboardEventsToElement", &EventSender::fireKeyboardEventsToElement); - bindMethod("keyDown", &EventSender::keyDown); - bindMethod("leapForward", &EventSender::leapForward); - bindMethod("mouseDown", &EventSender::mouseDown); - bindMethod("mouseMoveTo", &EventSender::mouseMoveTo); - bindMethod("mouseScrollBy", &EventSender::mouseScrollBy); - bindMethod("mouseUp", &EventSender::mouseUp); - bindMethod("releaseTouchPoint", &EventSender::releaseTouchPoint); - bindMethod("scheduleAsynchronousClick", &EventSender::scheduleAsynchronousClick); - bindMethod("scheduleAsynchronousKeyDown", &EventSender::scheduleAsynchronousKeyDown); - bindMethod("setTouchModifier", &EventSender::setTouchModifier); - bindMethod("textZoomIn", &EventSender::textZoomIn); - bindMethod("textZoomOut", &EventSender::textZoomOut); - bindMethod("touchCancel", &EventSender::touchCancel); - bindMethod("touchEnd", &EventSender::touchEnd); - bindMethod("touchMove", &EventSender::touchMove); - bindMethod("touchStart", &EventSender::touchStart); - bindMethod("updateTouchPoint", &EventSender::updateTouchPoint); - bindMethod("gestureFlingCancel", &EventSender::gestureFlingCancel); - bindMethod("gestureFlingStart", &EventSender::gestureFlingStart); - bindMethod("gestureScrollBegin", &EventSender::gestureScrollBegin); - bindMethod("gestureScrollEnd", &EventSender::gestureScrollEnd); - bindMethod("gestureScrollFirstPoint", &EventSender::gestureScrollFirstPoint); - bindMethod("gestureScrollUpdate", &EventSender::gestureScrollUpdate); - bindMethod("gestureTap", &EventSender::gestureTap); - bindMethod("gestureTapDown", &EventSender::gestureTapDown); - bindMethod("gestureTapCancel", &EventSender::gestureTapCancel); - bindMethod("gestureLongPress", &EventSender::gestureLongPress); - bindMethod("gestureLongTap", &EventSender::gestureLongTap); - bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap); - bindMethod("zoomPageIn", &EventSender::zoomPageIn); - bindMethod("zoomPageOut", &EventSender::zoomPageOut); - bindMethod("scalePageBy", &EventSender::scalePageBy); - - // When set to true (the default value), we batch mouse move and mouse up - // events so we can simulate drag & drop. - bindProperty("dragMode", &dragMode); -#if OS(WINDOWS) - bindProperty("WM_KEYDOWN", &wmKeyDown); - bindProperty("WM_KEYUP", &wmKeyUp); - bindProperty("WM_CHAR", &wmChar); - bindProperty("WM_DEADCHAR", &wmDeadChar); - bindProperty("WM_SYSKEYDOWN", &wmSysKeyDown); - bindProperty("WM_SYSKEYUP", &wmSysKeyUp); - bindProperty("WM_SYSCHAR", &wmSysChar); - bindProperty("WM_SYSDEADCHAR", &wmSysDeadChar); -#endif -} - -void EventSender::reset() -{ - // The test should have finished a drag and the mouse button state. - ASSERT(currentDragData.isNull()); - currentDragData.reset(); - currentDragEffect = WebKit::WebDragOperationNone; - currentDragEffectsAllowed = WebKit::WebDragOperationNone; - pressedButton = WebMouseEvent::ButtonNone; - dragMode.set(true); -#if OS(WINDOWS) - wmKeyDown.set(WM_KEYDOWN); - wmKeyUp.set(WM_KEYUP); - wmChar.set(WM_CHAR); - wmDeadChar.set(WM_DEADCHAR); - wmSysKeyDown.set(WM_SYSKEYDOWN); - wmSysKeyUp.set(WM_SYSKEYUP); - wmSysChar.set(WM_SYSCHAR); - wmSysDeadChar.set(WM_SYSDEADCHAR); -#endif - lastMousePos = WebPoint(0, 0); - lastClickTimeSec = 0; - lastClickPos = WebPoint(0, 0); - clickCount = 0; - lastButtonType = WebMouseEvent::ButtonNone; - timeOffsetMs = 0; - touchModifiers = 0; - touchPoints.clear(); - m_taskList.revokeAll(); - m_currentGestureLocation = WebPoint(0, 0); -} - -void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask mask) -{ - WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseDown, pressedButton, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - WebPoint clientPoint(event.x, event.y); - WebPoint screenPoint(event.globalX, event.globalY); - currentDragData = dragData; - currentDragEffectsAllowed = mask; - currentDragEffect = webview()->dragTargetDragEnter(dragData, clientPoint, screenPoint, currentDragEffectsAllowed, 0); - - // Finish processing events. - replaySavedEvents(); -} - -void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*) -{ - 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; - } - } - m_delegate->printMessage(std::string("Filename being dragged: ") + filename.utf8().data() + "\n"); -} - -WebMouseEvent::Button EventSender::getButtonTypeFromButtonNumber(int buttonCode) -{ - if (!buttonCode) - return WebMouseEvent::ButtonLeft; - if (buttonCode == 2) - return WebMouseEvent::ButtonRight; - return WebMouseEvent::ButtonMiddle; -} - -int EventSender::getButtonNumberFromSingleArg(const CppArgumentList& arguments) -{ - int buttonCode = 0; - if (arguments.size() > 0 && arguments[0].isNumber()) - buttonCode = arguments[0].toInt32(); - return buttonCode; -} - -void EventSender::updateClickCountForButton(WebMouseEvent::Button buttonType) -{ - if ((getCurrentEventTimeSec(m_delegate) - lastClickTimeSec < multipleClickTimeSec) - && (!outsideMultiClickRadius(lastMousePos, lastClickPos)) - && (buttonType == lastButtonType)) - ++clickCount; - else { - clickCount = 1; - lastButtonType = buttonType; - } -} - -// -// Implemented javascript methods. -// - -void EventSender::mouseDown(const CppArgumentList& arguments, CppVariant* result) -{ - if (result) // Could be 0 if invoked asynchronously. - result->setNull(); - - webview()->layout(); - - int buttonNumber = getButtonNumberFromSingleArg(arguments); - ASSERT(buttonNumber != -1); - - WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); - - updateClickCountForButton(buttonType); - - WebMouseEvent event; - pressedButton = buttonType; - initMouseEvent(WebInputEvent::MouseDown, buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isString())) - applyKeyModifiers(&(arguments[1]), &event); - webview()->handleInputEvent(event); -} - -void EventSender::mouseUp(const CppArgumentList& arguments, CppVariant* result) -{ - if (result) // Could be 0 if invoked asynchronously. - result->setNull(); - - webview()->layout(); - - int buttonNumber = getButtonNumberFromSingleArg(arguments); - ASSERT(buttonNumber != -1); - - WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); - - if (isDragMode() && !replayingSavedEvents) { - SavedEvent savedEvent; - savedEvent.type = SavedEvent::MouseUp; - savedEvent.buttonType = buttonType; - mouseEventQueue.append(savedEvent); - replaySavedEvents(); - } else { - WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseUp, buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isString())) - applyKeyModifiers(&(arguments[1]), &event); - doMouseUp(event); - } -} - -void EventSender::doMouseUp(const WebMouseEvent& e) -{ - webview()->handleInputEvent(e); - - pressedButton = WebMouseEvent::ButtonNone; - lastClickTimeSec = e.timeStampSeconds; - lastClickPos = lastMousePos; - - // If we're in a drag operation, complete it. - if (currentDragData.isNull()) - return; - WebPoint clientPoint(e.x, e.y); - WebPoint screenPoint(e.globalX, e.globalY); - - currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0); - if (currentDragEffect) - webview()->dragTargetDrop(clientPoint, screenPoint, 0); - else - webview()->dragTargetDragLeave(); - webview()->dragSourceEndedAt(clientPoint, screenPoint, currentDragEffect); - webview()->dragSourceSystemDragEnded(); - - currentDragData.reset(); -} - -void EventSender::mouseMoveTo(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - webview()->layout(); - - WebPoint mousePos(arguments[0].toInt32(), arguments[1].toInt32()); - - if (isDragMode() && pressedButton == WebMouseEvent::ButtonLeft && !replayingSavedEvents) { - SavedEvent savedEvent; - savedEvent.type = SavedEvent::MouseMove; - savedEvent.pos = mousePos; - mouseEventQueue.append(savedEvent); - } else { - WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseMove, pressedButton, mousePos, &event, getCurrentEventTimeSec(m_delegate)); - doMouseMove(event); - } -} - -void EventSender::doMouseMove(const WebMouseEvent& e) -{ - lastMousePos = WebPoint(e.x, e.y); - - webview()->handleInputEvent(e); - - if (pressedButton == WebMouseEvent::ButtonNone || currentDragData.isNull()) - return; - WebPoint clientPoint(e.x, e.y); - WebPoint screenPoint(e.globalX, e.globalY); - currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0); -} - -void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) -{ - if (result) - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isString()) - return; - bool generateChar = false; - - // FIXME: I'm not exactly sure how we should convert the string to a key - // event. This seems to work in the cases I tested. - // FIXME: Should we also generate a KEY_UP? - string codeStr = arguments[0].toString(); - - // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when - // Windows uses \r for "Enter". - int code = 0; - int text = 0; - bool needsShiftKeyModifier = false; - if ("\n" == codeStr) { - generateChar = true; - text = code = VKEY_RETURN; - } else if ("rightArrow" == codeStr) - code = VKEY_RIGHT; - else if ("downArrow" == codeStr) - code = VKEY_DOWN; - else if ("leftArrow" == codeStr) - code = VKEY_LEFT; - else if ("upArrow" == codeStr) - code = VKEY_UP; - else if ("insert" == codeStr) - code = VKEY_INSERT; - else if ("delete" == codeStr) - code = VKEY_DELETE; - else if ("pageUp" == codeStr) - code = VKEY_PRIOR; - else if ("pageDown" == codeStr) - code = VKEY_NEXT; - else if ("home" == codeStr) - code = VKEY_HOME; - else if ("end" == codeStr) - code = VKEY_END; - else if ("printScreen" == codeStr) - code = VKEY_SNAPSHOT; - else if ("menu" == codeStr) - code = VKEY_APPS; - else if ("leftControl" == codeStr) - code = VKEY_LCONTROL; - else if ("rightControl" == codeStr) - code = VKEY_RCONTROL; - else if ("leftShift" == codeStr) - code = VKEY_LSHIFT; - else if ("rightShift" == codeStr) - code = VKEY_RSHIFT; - else if ("leftAlt" == codeStr) - code = VKEY_LMENU; - else if ("rightAlt" == codeStr) - code = VKEY_RMENU; - else { - // Compare the input string with the function-key names defined by the - // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key - // name, set its key code. - for (int i = 1; i <= 24; ++i) { - char functionChars[10]; - snprintf(functionChars, 10, "F%d", i); - string functionKeyName(functionChars); - if (functionKeyName == codeStr) { - code = VKEY_F1 + (i - 1); - break; - } - } - if (!code) { - WebString webCodeStr = WebString::fromUTF8(codeStr.data(), codeStr.size()); - ASSERT(webCodeStr.length() == 1); - text = code = webCodeStr.data()[0]; - needsShiftKeyModifier = needsShiftModifier(code); - if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') - code -= 'a' - 'A'; - generateChar = true; - } - } - - // For one generated keyboard event, we need to generate a keyDown/keyUp - // pair; refer to EventSender.cpp in Tools/DumpRenderTree/win. - // On Windows, we might also need to generate a char event to mimic the - // Windows event flow; on other platforms we create a merged event and test - // the event flow that that platform provides. - WebKeyboardEvent eventDown, eventChar, eventUp; - eventDown.type = WebInputEvent::RawKeyDown; - eventDown.modifiers = 0; - eventDown.windowsKeyCode = code; -#if OS(LINUX) && USE(GTK) - eventDown.nativeKeyCode = NativeKeyCodeForWindowsKeyCode(code); -#endif - - if (generateChar) { - eventDown.text[0] = text; - eventDown.unmodifiedText[0] = text; - } - eventDown.setKeyIdentifierFromWindowsKeyCode(); - - if (arguments.size() >= 2 && (arguments[1].isObject() || arguments[1].isString())) - eventDown.isSystemKey = applyKeyModifiers(&(arguments[1]), &eventDown); - - if (needsShiftKeyModifier) - eventDown.modifiers |= WebInputEvent::ShiftKey; - - // See if KeyLocation argument is given. - if (arguments.size() >= 3 && arguments[2].isNumber()) { - int location = arguments[2].toInt32(); - if (location == DOMKeyLocationNumpad) - eventDown.modifiers |= WebInputEvent::IsKeyPad; - } - - eventChar = eventUp = eventDown; - eventUp.type = WebInputEvent::KeyUp; - // EventSender.m forces a layout here, with at least one - // test (fast/forms/focus-control-to-page.html) relying on this. - webview()->layout(); - - // In the browser, if a keyboard event corresponds to an editor command, - // the command will be dispatched to the renderer just before dispatching - // the keyboard event, and then it will be executed in the - // RenderView::handleCurrentKeyboardEvent() method, which is called from - // third_party/WebKit/Source/WebKit/chromium/src/EditorClientImpl.cpp. - // We just simulate the same behavior here. - string editCommand; - if (getEditCommand(eventDown, &editCommand)) - m_delegate->setEditCommand(editCommand, ""); - - webview()->handleInputEvent(eventDown); - - m_delegate->clearEditCommand(); - - if (generateChar) { - eventChar.type = WebInputEvent::Char; - eventChar.keyIdentifier[0] = '\0'; - webview()->handleInputEvent(eventChar); - } - - webview()->handleInputEvent(eventUp); -} - -void EventSender::dispatchMessage(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - -#if OS(WINDOWS) - if (arguments.size() == 3) { - // Grab the message id to see if we need to dispatch it. - int msg = arguments[0].toInt32(); - - // WebKit's version of this function stuffs a MSG struct and uses - // TranslateMessage and DispatchMessage. We use a WebKeyboardEvent, which - // doesn't need to receive the DeadChar and SysDeadChar messages. - if (msg == WM_DEADCHAR || msg == WM_SYSDEADCHAR) - return; - - webview()->layout(); - - unsigned long lparam = static_cast<unsigned long>(arguments[2].toDouble()); - webview()->handleInputEvent(WebInputEventFactory::keyboardEvent(0, msg, arguments[1].toInt32(), lparam)); - } else - ASSERT_NOT_REACHED(); -#endif -} - -bool EventSender::needsShiftModifier(int keyCode) -{ - // If code is an uppercase letter, assign a SHIFT key to - // eventDown.modifier, this logic comes from - // Tools/DumpRenderTree/win/EventSender.cpp - return (keyCode & 0xFF) >= 'A' && (keyCode & 0xFF) <= 'Z'; -} - -void EventSender::leapForward(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1 || !arguments[0].isNumber()) - return; - - int milliseconds = arguments[0].toInt32(); - if (isDragMode() && pressedButton == WebMouseEvent::ButtonLeft && !replayingSavedEvents) { - SavedEvent savedEvent; - savedEvent.type = SavedEvent::LeapForward; - savedEvent.milliseconds = milliseconds; - mouseEventQueue.append(savedEvent); - } else - doLeapForward(milliseconds); -} - -void EventSender::doLeapForward(int milliseconds) -{ - advanceEventTime(milliseconds); -} - -// Apple's port of WebKit zooms by a factor of 1.2 (see -// WebKit/WebView/WebView.mm) -void EventSender::textZoomIn(const CppArgumentList&, CppVariant* result) -{ - webview()->setZoomLevel(true, webview()->zoomLevel() + 1); - result->setNull(); -} - -void EventSender::textZoomOut(const CppArgumentList&, CppVariant* result) -{ - webview()->setZoomLevel(true, webview()->zoomLevel() - 1); - result->setNull(); -} - -void EventSender::zoomPageIn(const CppArgumentList&, CppVariant* result) -{ - webview()->setZoomLevel(false, webview()->zoomLevel() + 1); - result->setNull(); -} - -void EventSender::zoomPageOut(const CppArgumentList&, CppVariant* result) -{ - webview()->setZoomLevel(false, webview()->zoomLevel() - 1); - result->setNull(); -} - -void EventSender::scalePageBy(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber()) - return; - - float scaleFactor = static_cast<float>(arguments[0].toDouble()); - int x = arguments[1].toInt32(); - int y = arguments[2].toInt32(); - webview()->setPageScaleFactor(scaleFactor, WebPoint(x, y)); - result->setNull(); -} - -void EventSender::mouseScrollBy(const CppArgumentList& arguments, CppVariant* result) -{ - handleMouseWheel(arguments, result, false); -} - -void EventSender::continuousMouseScrollBy(const CppArgumentList& arguments, CppVariant* result) -{ - handleMouseWheel(arguments, result, true); -} - -void EventSender::replaySavedEvents() -{ - replayingSavedEvents = true; - while (!mouseEventQueue.isEmpty()) { - SavedEvent e = mouseEventQueue.takeFirst(); - - switch (e.type) { - case SavedEvent::MouseMove: { - WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseMove, pressedButton, e.pos, &event, getCurrentEventTimeSec(m_delegate)); - doMouseMove(event); - break; - } - case SavedEvent::LeapForward: - doLeapForward(e.milliseconds); - break; - case SavedEvent::MouseUp: { - WebMouseEvent event; - initMouseEvent(WebInputEvent::MouseUp, e.buttonType, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - doMouseUp(event); - break; - } - default: - ASSERT_NOT_REACHED(); - } - } - - replayingSavedEvents = false; -} - -// Because actual context menu is implemented by the browser side, -// this function does only what LayoutTests are expecting: -// - Many test checks the count of items. So returning non-zero value makes sense. -// - Some test compares the count before and after some action. So changing the count based on flags -// also makes sense. This function is doing such for some flags. -// - Some test even checks actual string content. So providing it would be also helpful. -// -static Vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, TestDelegate* delegate) -{ - // These constants are based on Safari's context menu because tests are made for it. - static const char* nonEditableMenuStrings[] = { "Back", "Reload Page", "Open in Dashbaord", "<separator>", "View Source", "Save Page As", "Print Page", "Inspect Element", 0 }; - static const char* editableMenuStrings[] = { "Cut", "Copy", "<separator>", "Paste", "Spelling and Grammar", "Substitutions, Transformations", "Font", "Speech", "Paragraph Direction", "<separator>", 0 }; - - // This is possible because mouse events are cancelleable. - if (!contextMenu) - return Vector<WebString>(); - - Vector<WebString> strings; - - if (contextMenu->isEditable) { - for (const char** item = editableMenuStrings; *item; ++item) - strings.append(WebString::fromUTF8(*item)); - WebVector<WebString> suggestions; - delegate->fillSpellingSuggestionList(contextMenu->misspelledWord, &suggestions); - for (size_t i = 0; i < suggestions.size(); ++i) - strings.append(suggestions[i]); - } else { - for (const char** item = nonEditableMenuStrings; *item; ++item) - strings.append(WebString::fromUTF8(*item)); - } - - return strings; -} - -void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* result) -{ - webview()->layout(); - - updateClickCountForButton(WebMouseEvent::ButtonRight); - - // Clears last context menu data because we need to know if the context menu be requested - // after following mouse events. - m_delegate->clearContextMenuData(); - - // Generate right mouse down and up. - WebMouseEvent event; - // This is a hack to work around only allowing a single pressed button since we want to - // test the case where both the left and right mouse buttons are pressed. - if (pressedButton == WebMouseEvent::ButtonNone) - pressedButton = WebMouseEvent::ButtonRight; - initMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - webview()->handleInputEvent(event); - -#if OS(WINDOWS) - initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - webview()->handleInputEvent(event); - - pressedButton = WebMouseEvent::ButtonNone; -#endif - - WebContextMenuData* lastContextMenu = m_delegate->lastContextMenuData(); - result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(lastContextMenu, m_delegate))); -} - -class MouseDownTask: public WebMethodTask<EventSender> { -public: - MouseDownTask(EventSender* obj, const CppArgumentList& arg) - : WebMethodTask<EventSender>(obj), m_arguments(arg) { } - virtual void runIfValid() { m_object->mouseDown(m_arguments, 0); } - -private: - CppArgumentList m_arguments; -}; - -class MouseUpTask: public WebMethodTask<EventSender> { -public: - MouseUpTask(EventSender* obj, const CppArgumentList& arg) - : WebMethodTask<EventSender>(obj), m_arguments(arg) { } - virtual void runIfValid() { m_object->mouseUp(m_arguments, 0); } - -private: - CppArgumentList m_arguments; -}; - -void EventSender::scheduleAsynchronousClick(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - m_delegate->postTask(new MouseDownTask(this, arguments)); - m_delegate->postTask(new MouseUpTask(this, arguments)); -} - -class KeyDownTask : public WebMethodTask<EventSender> { -public: - KeyDownTask(EventSender* obj, const CppArgumentList& arg) - : WebMethodTask<EventSender>(obj), m_arguments(arg) { } - virtual void runIfValid() { m_object->keyDown(m_arguments, 0); } - -private: - CppArgumentList m_arguments; -}; - -void EventSender::scheduleAsynchronousKeyDown(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - m_delegate->postTask(new KeyDownTask(this, arguments)); -} - -void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVariant* result) -{ - currentDragData.initialize(); - Vector<string> files = arguments[0].toStringVector(); - WebVector<WebString> absoluteFilenames(files.size()); - for (size_t i = 0; i < files.size(); ++i) { - WebDragData::Item item; - item.storageType = WebDragData::Item::StorageTypeFilename; - item.filenameData = m_delegate->getAbsoluteWebStringFromUTF8Path(files[i]); - currentDragData.addItem(item); - absoluteFilenames[i] = item.filenameData; - } - currentDragData.setFilesystemId(m_delegate->registerIsolatedFileSystem(absoluteFilenames)); - currentDragEffectsAllowed = WebKit::WebDragOperationCopy; - - // Provide a drag source. - webview()->dragTargetDragEnter(currentDragData, lastMousePos, lastMousePos, currentDragEffectsAllowed, 0); - - // dragMode saves events and then replays them later. We don't need/want that. - dragMode.set(false); - - // Make the rest of eventSender think a drag is in progress. - pressedButton = WebMouseEvent::ButtonLeft; - - result->setNull(); -} - -void EventSender::addTouchPoint(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - WebTouchPoint touchPoint; - touchPoint.state = WebTouchPoint::StatePressed; - touchPoint.position = WebPoint(arguments[0].toInt32(), arguments[1].toInt32()); - touchPoint.screenPosition = touchPoint.position; - - int lowestId = 0; - for (size_t i = 0; i < touchPoints.size(); i++) { - if (touchPoints[i].id == lowestId) - lowestId++; - } - touchPoint.id = lowestId; - touchPoints.append(touchPoint); -} - -void EventSender::clearTouchPoints(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - touchPoints.clear(); -} - -void EventSender::releaseTouchPoint(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - const unsigned index = arguments[0].toInt32(); - ASSERT(index < touchPoints.size()); - - WebTouchPoint* touchPoint = &touchPoints[index]; - touchPoint->state = WebTouchPoint::StateReleased; -} - -void EventSender::setTouchModifier(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - int mask = 0; - const string keyName = arguments[0].toString(); - if (keyName == "shift") - mask = WebInputEvent::ShiftKey; - else if (keyName == "alt") - mask = WebInputEvent::AltKey; - else if (keyName == "ctrl") - mask = WebInputEvent::ControlKey; - else if (keyName == "meta") - mask = WebInputEvent::MetaKey; - - if (arguments[1].toBoolean()) - touchModifiers |= mask; - else - touchModifiers &= ~mask; -} - -void EventSender::updateTouchPoint(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - const unsigned index = arguments[0].toInt32(); - ASSERT(index < touchPoints.size()); - - WebPoint position(arguments[1].toInt32(), arguments[2].toInt32()); - WebTouchPoint* touchPoint = &touchPoints[index]; - touchPoint->state = WebTouchPoint::StateMoved; - touchPoint->position = position; - touchPoint->screenPosition = position; -} - -void EventSender::cancelTouchPoint(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - const unsigned index = arguments[0].toInt32(); - ASSERT(index < touchPoints.size()); - - WebTouchPoint* touchPoint = &touchPoints[index]; - touchPoint->state = WebTouchPoint::StateCancelled; -} - -void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) -{ - ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size()); - webview()->layout(); - - WebTouchEvent touchEvent; - touchEvent.type = type; - touchEvent.modifiers = touchModifiers; - touchEvent.timeStampSeconds = getCurrentEventTimeSec(m_delegate); - touchEvent.touchesLength = touchPoints.size(); - for (unsigned i = 0; i < touchPoints.size(); ++i) - touchEvent.touches[i] = touchPoints[i]; - webview()->handleInputEvent(touchEvent); - - for (unsigned i = 0; i < touchPoints.size(); ++i) { - WebTouchPoint* touchPoint = &touchPoints[i]; - if (touchPoint->state == WebTouchPoint::StateReleased) { - touchPoints.remove(i); - --i; - } else - touchPoint->state = WebTouchPoint::StateStationary; - } -} - -void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant* result, bool continuous) -{ - result->setNull(); - - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - - // Force a layout here just to make sure every position has been - // determined before we send events (as well as all the other methods - // that send an event do). - webview()->layout(); - - int horizontal = arguments[0].toInt32(); - int vertical = arguments[1].toInt32(); - int paged = false; - int hasPreciseScrollingDeltas = false; - - if (arguments.size() > 2 && arguments[2].isBool()) - paged = arguments[2].toBoolean(); - - if (arguments.size() > 3 && arguments[3].isBool()) - hasPreciseScrollingDeltas = arguments[3].toBoolean(); - - WebMouseWheelEvent event; - initMouseEvent(WebInputEvent::MouseWheel, pressedButton, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); - event.wheelTicksX = static_cast<float>(horizontal); - event.wheelTicksY = static_cast<float>(vertical); - event.deltaX = event.wheelTicksX; - event.deltaY = event.wheelTicksY; - event.scrollByPage = paged; - event.hasPreciseScrollingDeltas = hasPreciseScrollingDeltas; - - if (continuous) { - event.wheelTicksX /= scrollbarPixelsPerTick; - event.wheelTicksY /= scrollbarPixelsPerTick; - } else { - event.deltaX *= scrollbarPixelsPerTick; - event.deltaY *= scrollbarPixelsPerTick; - } - webview()->handleInputEvent(event); -} - -void EventSender::touchEnd(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - sendCurrentTouchEvent(WebInputEvent::TouchEnd); -} - -void EventSender::touchMove(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - sendCurrentTouchEvent(WebInputEvent::TouchMove); -} - -void EventSender::touchStart(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - sendCurrentTouchEvent(WebInputEvent::TouchStart); -} - -void EventSender::touchCancel(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - sendCurrentTouchEvent(WebInputEvent::TouchCancel); -} - -void EventSender::gestureScrollBegin(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureScrollBegin, arguments); -} - -void EventSender::gestureScrollEnd(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureScrollEnd, arguments); -} - -void EventSender::gestureScrollUpdate(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureScrollUpdate, arguments); -} - -void EventSender::gestureTap(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureTap, arguments); -} - -void EventSender::gestureTapDown(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureTapDown, arguments); -} - -void EventSender::gestureTapCancel(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureTapCancel, arguments); -} - -void EventSender::gestureLongPress(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureLongPress, arguments); -} - -void EventSender::gestureLongTap(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureLongTap, arguments); -} - -void EventSender::gestureTwoFingerTap(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - gestureEvent(WebInputEvent::GestureTwoFingerTap, arguments); -} - -void EventSender::gestureScrollFirstPoint(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - - WebPoint point(arguments[0].toInt32(), arguments[1].toInt32()); - m_currentGestureLocation = point; -} - -void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& arguments) -{ - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - - WebPoint point(arguments[0].toInt32(), arguments[1].toInt32()); - - WebGestureEvent event; - event.type = type; - - switch (type) { - case WebInputEvent::GestureScrollUpdate: - event.data.scrollUpdate.deltaX = static_cast<float>(arguments[0].toDouble()); - event.data.scrollUpdate.deltaY = static_cast<float>(arguments[1].toDouble()); - event.x = m_currentGestureLocation.x; - event.y = m_currentGestureLocation.y; - m_currentGestureLocation.x = m_currentGestureLocation.x + event.data.scrollUpdate.deltaX; - m_currentGestureLocation.y = m_currentGestureLocation.y + event.data.scrollUpdate.deltaY; - break; - - case WebInputEvent::GestureScrollBegin: - m_currentGestureLocation = WebPoint(point.x, point.y); - event.x = m_currentGestureLocation.x; - event.y = m_currentGestureLocation.y; - break; - case WebInputEvent::GestureScrollEnd: - event.x = m_currentGestureLocation.x; - event.y = m_currentGestureLocation.y; - break; - case WebInputEvent::GestureTap: - if (arguments.size() >= 3) - event.data.tap.tapCount = static_cast<float>(arguments[2].toDouble()); - else - event.data.tap.tapCount = 1; - event.x = point.x; - event.y = point.y; - break; - case WebInputEvent::GestureTapDown: - event.x = point.x; - event.y = point.y; - if (arguments.size() >= 4) { - event.data.tapDown.width = static_cast<float>(arguments[2].toDouble()); - event.data.tapDown.height = static_cast<float>(arguments[3].toDouble()); - } - break; - case WebInputEvent::GestureTapCancel: - event.x = point.x; - event.y = point.y; - break; - case WebInputEvent::GestureLongPress: - event.x = point.x; - event.y = point.y; - if (arguments.size() >= 4) { - event.data.longPress.width = static_cast<float>(arguments[2].toDouble()); - event.data.longPress.height = static_cast<float>(arguments[3].toDouble()); - } - break; - case WebInputEvent::GestureLongTap: - event.x = point.x; - event.y = point.y; - if (arguments.size() >= 4) { - event.data.longPress.width = static_cast<float>(arguments[2].toDouble()); - event.data.longPress.height = static_cast<float>(arguments[3].toDouble()); - } - break; - case WebInputEvent::GestureTwoFingerTap: - event.x = point.x; - event.y = point.y; - if (arguments.size() >= 4) { - event.data.twoFingerTap.firstFingerWidth = static_cast<float>(arguments[2].toDouble()); - event.data.twoFingerTap.firstFingerHeight = static_cast<float>(arguments[3].toDouble()); - } - break; - default: - ASSERT_NOT_REACHED(); - } - - event.globalX = event.x; - event.globalY = event.y; - event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); - webview()->handleInputEvent(event); -} - -void EventSender::gestureFlingCancel(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (!arguments.size()) - return; - - WebGestureEvent event; - event.type = WebInputEvent::GestureFlingCancel; - event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); - webview()->handleInputEvent(event); -} - -void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 4) - return; - - for (int i = 0; i < 4; i++) - if (!arguments[i].isNumber()) - return; - - WebGestureEvent event; - event.type = WebInputEvent::GestureFlingStart; - - event.x = static_cast<float>(arguments[0].toDouble()); - event.y = static_cast<float>(arguments[1].toDouble()); - event.globalX = event.x; - event.globalY = event.y; - - event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble()); - event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble()); - event.timeStampSeconds = getCurrentEventTimeSec(m_delegate); - webview()->handleInputEvent(event); -} - -// -// Unimplemented stubs -// - -void EventSender::enableDOMUIEventLogging(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void EventSender::fireKeyboardEventsToElement(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -void EventSender::clearKillRing(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h deleted file mode 100644 index b1da68487..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - EventSender class: - Bound to a JavaScript window.eventSender object using - CppBoundClass::bindToJavascript(), this allows layout tests to fire DOM events. -*/ - -#ifndef EventSender_h -#define EventSender_h - -#include "CppBoundClass.h" -#include "WebDragOperation.h" -#include "WebInputEvent.h" -#include "WebTask.h" -#include "platform/WebPoint.h" - -namespace WebKit { -class WebDragData; -class WebView; -} - -namespace WebTestRunner { - -class TestDelegate; - -class EventSender : public CppBoundClass { -public: - EventSender(); - - void setDelegate(TestDelegate* delegate) { m_delegate = delegate; } - void setWebView(WebKit::WebView* webView) { m_webView = webView; } - - // Resets some static variable state. - void reset(); - - // Simulate drag&drop system call. - void doDragDrop(const WebKit::WebDragData&, WebKit::WebDragOperationsMask); - - // Test helper for dragging out images. - void dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*); - - // JS callback methods. - void contextClick(const CppArgumentList&, CppVariant*); - void mouseDown(const CppArgumentList&, CppVariant*); - void mouseUp(const CppArgumentList&, CppVariant*); - void mouseMoveTo(const CppArgumentList&, CppVariant*); - void leapForward(const CppArgumentList&, CppVariant*); - void keyDown(const CppArgumentList&, CppVariant*); - void dispatchMessage(const CppArgumentList&, CppVariant*); - // FIXME: These aren't really events. They should be moved to layout controller. - void textZoomIn(const CppArgumentList&, CppVariant*); - void textZoomOut(const CppArgumentList&, CppVariant*); - void zoomPageIn(const CppArgumentList&, CppVariant*); - void zoomPageOut(const CppArgumentList&, CppVariant*); - void scalePageBy(const CppArgumentList&, CppVariant*); - - void mouseScrollBy(const CppArgumentList&, CppVariant*); - void continuousMouseScrollBy(const CppArgumentList&, CppVariant*); - void scheduleAsynchronousClick(const CppArgumentList&, CppVariant*); - void scheduleAsynchronousKeyDown(const CppArgumentList&, CppVariant*); - void beginDragWithFiles(const CppArgumentList&, CppVariant*); - CppVariant dragMode; - - void addTouchPoint(const CppArgumentList&, CppVariant*); - void cancelTouchPoint(const CppArgumentList&, CppVariant*); - void clearTouchPoints(const CppArgumentList&, CppVariant*); - void releaseTouchPoint(const CppArgumentList&, CppVariant*); - void setTouchModifier(const CppArgumentList&, CppVariant*); - void touchCancel(const CppArgumentList&, CppVariant*); - void touchEnd(const CppArgumentList&, CppVariant*); - void touchMove(const CppArgumentList&, CppVariant*); - void touchStart(const CppArgumentList&, CppVariant*); - void updateTouchPoint(const CppArgumentList&, CppVariant*); - - void gestureFlingCancel(const CppArgumentList&, CppVariant*); - void gestureFlingStart(const CppArgumentList&, CppVariant*); - void gestureScrollBegin(const CppArgumentList&, CppVariant*); - void gestureScrollEnd(const CppArgumentList&, CppVariant*); - void gestureScrollFirstPoint(const CppArgumentList&, CppVariant*); - void gestureScrollUpdate(const CppArgumentList&, CppVariant*); - void gestureTap(const CppArgumentList&, CppVariant*); - void gestureTapDown(const CppArgumentList&, CppVariant*); - void gestureTapCancel(const CppArgumentList&, CppVariant*); - void gestureLongPress(const CppArgumentList&, CppVariant*); - void gestureLongTap(const CppArgumentList&, CppVariant*); - void gestureTwoFingerTap(const CppArgumentList&, CppVariant*); - void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&); - - // Unimplemented stubs - void enableDOMUIEventLogging(const CppArgumentList&, CppVariant*); - void fireKeyboardEventsToElement(const CppArgumentList&, CppVariant*); - void clearKillRing(const CppArgumentList&, CppVariant*); - - // Properties used in layout tests. -#if defined(OS_WIN) - CppVariant wmKeyDown; - CppVariant wmKeyUp; - CppVariant wmChar; - CppVariant wmDeadChar; - CppVariant wmSysKeyDown; - CppVariant wmSysKeyUp; - CppVariant wmSysChar; - CppVariant wmSysDeadChar; -#endif - - WebTaskList* taskList() { return &m_taskList; } - -private: - WebKit::WebView* webview() { return m_webView; } - - // Returns true if dragMode is true. - bool isDragMode() { return dragMode.isBool() && dragMode.toBoolean(); } - - // Sometimes we queue up mouse move and mouse up events for drag drop - // handling purposes. These methods dispatch the event. - void doMouseMove(const WebKit::WebMouseEvent&); - void doMouseUp(const WebKit::WebMouseEvent&); - static void doLeapForward(int milliseconds); - void replaySavedEvents(); - - // Helper to return the button type given a button code - static WebKit::WebMouseEvent::Button getButtonTypeFromButtonNumber(int); - - // Helper to extract the button number from the optional argument in - // mouseDown and mouseUp - static int getButtonNumberFromSingleArg(const CppArgumentList&); - - // Returns true if the specified key code passed in needs a shift key - // modifier to be passed into the generated event. - bool needsShiftModifier(int); - - void updateClickCountForButton(WebKit::WebMouseEvent::Button); - - // Compose a touch event from the current touch points and send it. - void sendCurrentTouchEvent(const WebKit::WebInputEvent::Type); - - // Handle a request to send a wheel event. - void handleMouseWheel(const CppArgumentList&, CppVariant*, bool continuous); - - WebTaskList m_taskList; - - TestDelegate* m_delegate; - WebKit::WebView* m_webView; - - // Location of the touch point that initiated a gesture. - WebKit::WebPoint m_currentGestureLocation; - - // Location of last mouseMoveTo event. - static WebKit::WebPoint lastMousePos; - - // Currently pressed mouse button (Left/Right/Middle or None) - static WebKit::WebMouseEvent::Button pressedButton; - - // The last button number passed to mouseDown and mouseUp. - // Used to determine whether the click count continues to - // increment or not. - static WebKit::WebMouseEvent::Button lastButtonType; -}; - -} - -#endif // EventSender_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp deleted file mode 100644 index e9c246af2..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "GamepadController.h" -#include "TestDelegate.h" - -using namespace WebKit; - -namespace WebTestRunner { - -GamepadController::GamepadController() -{ - bindMethod("connect", &GamepadController::connect); - bindMethod("disconnect", &GamepadController::disconnect); - bindMethod("setId", &GamepadController::setId); - bindMethod("setButtonCount", &GamepadController::setButtonCount); - bindMethod("setButtonData", &GamepadController::setButtonData); - bindMethod("setAxisCount", &GamepadController::setAxisCount); - bindMethod("setAxisData", &GamepadController::setAxisData); - - bindFallbackMethod(&GamepadController::fallbackCallback); - - reset(); -} - -void GamepadController::bindToJavascript(WebFrame* frame, const WebString& classname) -{ - CppBoundClass::bindToJavascript(frame, classname); -} - -void GamepadController::setDelegate(TestDelegate* delegate) -{ - m_delegate = delegate; -} - -void GamepadController::reset() -{ - memset(&m_gamepads, 0, sizeof(m_gamepads)); -} - -void GamepadController::connect(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 1) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - m_gamepads.items[index].connected = true; - m_gamepads.length = 0; - for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) - if (m_gamepads.items[i].connected) - m_gamepads.length = i + 1; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::disconnect(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 1) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - m_gamepads.items[index].connected = false; - m_gamepads.length = 0; - for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) - if (m_gamepads.items[i].connected) - m_gamepads.length = i + 1; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::setId(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 2) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - std::string src = args[1].toString(); - const char* p = src.c_str(); - memset(m_gamepads.items[index].id, 0, sizeof(m_gamepads.items[index].id)); - for (unsigned i = 0; *p && i < WebKit::WebGamepad::idLengthCap - 1; ++i) - m_gamepads.items[index].id[i] = *p++; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::setButtonCount(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 2) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - int buttons = args[1].toInt32(); - if (buttons < 0 || buttons >= static_cast<int>(WebKit::WebGamepad::buttonsLengthCap)) - return; - m_gamepads.items[index].buttonsLength = buttons; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::setButtonData(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 3) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - int button = args[1].toInt32(); - if (button < 0 || button >= static_cast<int>(WebKit::WebGamepad::buttonsLengthCap)) - return; - double data = args[2].toDouble(); - m_gamepads.items[index].buttons[button] = data; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::setAxisCount(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 2) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - int axes = args[1].toInt32(); - if (axes < 0 || axes >= static_cast<int>(WebKit::WebGamepad::axesLengthCap)) - return; - m_gamepads.items[index].axesLength = axes; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::setAxisData(const CppArgumentList& args, CppVariant* result) -{ - if (args.size() < 3) { - m_delegate->printMessage("Invalid args"); - return; - } - int index = args[0].toInt32(); - if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap)) - return; - int axis = args[1].toInt32(); - if (axis < 0 || axis >= static_cast<int>(WebKit::WebGamepad::axesLengthCap)) - return; - double data = args[2].toDouble(); - m_gamepads.items[index].axes[axis] = data; - m_delegate->setGamepadData(m_gamepads); - result->setNull(); -} - -void GamepadController::fallbackCallback(const CppArgumentList&, CppVariant* result) -{ - m_delegate->printMessage("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on GamepadController\n"); - result->setNull(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h deleted file mode 100644 index 9058c702d..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GamepadController_h -#define GamepadController_h - -#include "CppBoundClass.h" -#include "platform/WebGamepads.h" - -namespace WebKit { -class WebGamepads; -class WebFrame; -} - -namespace WebTestRunner { - -class TestDelegate; - -class GamepadController : public CppBoundClass { -public: - GamepadController(); - - void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname); - void setDelegate(TestDelegate*); - void reset(); - -private: - // Bound methods and properties - void connect(const CppArgumentList&, CppVariant*); - void disconnect(const CppArgumentList&, CppVariant*); - void setId(const CppArgumentList&, CppVariant*); - void setButtonCount(const CppArgumentList&, CppVariant*); - void setButtonData(const CppArgumentList&, CppVariant*); - void setAxisCount(const CppArgumentList&, CppVariant*); - void setAxisData(const CppArgumentList&, CppVariant*); - void fallbackCallback(const CppArgumentList&, CppVariant*); - - WebKit::WebGamepads m_gamepads; - - TestDelegate* m_delegate; -}; - -} - -#endif // GamepadController_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp deleted file mode 100644 index c339f2f2b..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "KeyCodeMapping.h" - -#include <wtf/UnusedParam.h> - -namespace WebTestRunner { - -int NativeKeyCodeForWindowsKeyCode(int keysym) -{ -#if OS(LINUX) && USE(GTK) - // See /usr/share/X11/xkb/keycodes/* - static const int asciiToKeyCode[] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 22, - 23, - 0, - 0, - 0, - 36, - 0, - 0, - 50, - 37, - 64, - 127, - 66, - 0, - 0, - 0, - 0, - 131, - 0, - 9, - 100, - 102, - 0, - 0, - 65, // ' ' - 112, // '!' - 117, // '"' - 115, // '#' - 110, // '$' - 113, // '%' - 111, // '&' - 114, // ''' - 116, // '(' - 0, // ')' - 107, // '*' - 0, // '+' - 0, // ',' - 118, // '-' - 119, // '.' - 146, // '/' - 19, // '0' - 10, // '1' - 11, // '2' - 12, // '3' - 13, // '4' - 14, // '5' - 15, // '6' - 16, // '7' - 17, // '8' - 18, // '9' - 0, // ':' - 0, // ';' - 0, // '<' - 0, // '=' - 0, // '>' - 0, // '?' - 0, // '@' - 38, // 'A' - 56, // 'B' - 54, // 'C' - 40, // 'D' - 26, // 'E' - 41, // 'F' - 42, // 'G' - 43, // 'H' - 31, // 'I' - 44, // 'J' - 45, // 'K' - 46, // 'L' - 58, // 'M' - 57, // 'N' - 32, // 'O' - 33, // 'P' - 24, // 'Q' - 27, // 'R' - 39, // 'S' - 28, // 'T' - 30, // 'U' - 55, // 'V' - 25, // 'W' - 53, // 'X' - 29, // 'Y' - 52, // 'Z' - 133, // '[' - 134, // '\' - 135, // ']' - 0, // '^' - 0, // '_' - 90, // '`' - 38, // 'a' - 56, // 'b' - 54, // 'c' - 40, // 'd' - 26, // 'e' - 41, // 'f' - 42, // 'g' - 43, // 'h' - 31, // 'i' - 44, // 'j' - 45, // 'k' - 46, // 'l' - 58, // 'm' - 57, // 'n' - 32, // 'o' - 33, // 'p' - 24, // 'q' - 27, // 'r' - 39, // 's' - 28, // 't' - 30, // 'u' - 55, // 'v' - 25, // 'w' - 53, // 'x' - 29, // 'y' - 52, // 'z' - 96, // '{' - 0, // '|' - 0, // '}' - 0, // '~' - 0, // DEL - }; - - if (keysym <= 127) - return asciiToKeyCode[keysym]; - - switch (keysym) { - case VKEY_PRIOR: - return 112; - case VKEY_NEXT: - return 117; - case VKEY_END: - return 115; - case VKEY_HOME: - return 110; - case VKEY_LEFT: - return 113; - case VKEY_UP: - return 111; - case VKEY_RIGHT: - return 114; - case VKEY_DOWN: - return 116; - case VKEY_SNAPSHOT: - return 107; - case VKEY_INSERT: - return 118; - case VKEY_DELETE: - return 119; - case VKEY_APPS: - return 135; - case VKEY_F1: - case VKEY_F1 + 1: - case VKEY_F1 + 2: - case VKEY_F1 + 3: - case VKEY_F1 + 4: - case VKEY_F1 + 5: - case VKEY_F1 + 6: - case VKEY_F1 + 7: - case VKEY_F1 + 8: - case VKEY_F1 + 9: - case VKEY_F1 + 10: - case VKEY_F1 + 11: - case VKEY_F1 + 12: - case VKEY_F1 + 13: - case VKEY_F1 + 14: - case VKEY_F1 + 15: - case VKEY_F1 + 16: - case VKEY_F1 + 17: - case VKEY_F1 + 18: - case VKEY_F1 + 19: - case VKEY_F1 + 20: - case VKEY_F1 + 21: - case VKEY_F1 + 22: - case VKEY_F1 + 23: - return 67 + (keysym - VKEY_F1); - case VKEY_LSHIFT: - return 50; - case VKEY_RSHIFT: - return 62; - case VKEY_LCONTROL: - return 37; - case VKEY_RCONTROL: - return 105; - case VKEY_LMENU: - return 64; - case VKEY_RMENU: - return 108; - - default: - return 0; - } -#else - UNUSED_PARAM(keysym); - return 0; -#endif -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h b/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h deleted file mode 100644 index 87469fac4..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef KeyCodeMapping_h -#define KeyCodeMapping_h - -namespace WebTestRunner { - -// The keycodes match the values of the virtual keycodes found here http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx -enum { - VKEY_RETURN = 0x0D, - VKEY_PRIOR = 0x21, - VKEY_NEXT = 0x22, - VKEY_END = 0x23, - VKEY_HOME = 0x24, - VKEY_LEFT = 0x25, - VKEY_UP = 0x26, - VKEY_RIGHT = 0x27, - VKEY_DOWN = 0x28, - VKEY_SNAPSHOT = 0x2C, - VKEY_INSERT = 0x2D, - VKEY_DELETE = 0x2E, - VKEY_APPS = 0x5D, - VKEY_F1 = 0x70, - VKEY_LSHIFT = 0xA0, - VKEY_RSHIFT = 0xA1, - VKEY_LCONTROL = 0xA2, - VKEY_RCONTROL = 0xA3, - VKEY_LMENU = 0xA4, - VKEY_RMENU = 0xA5, -}; - -// Map a windows keycode to a native keycode on OS(LINUX) && USE(GTK). -int NativeKeyCodeForWindowsKeyCode(int keysym); - -} - -#endif // KeyCodeMapping_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h deleted file mode 100644 index f8eceb6d0..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestDelegate_h -#define TestDelegate_h - -#include "platform/WebString.h" -#include "platform/WebVector.h" - -namespace WebKit { -struct WebContextMenuData; -class WebGamepads; -} - -namespace WebTestRunner { - -class WebTask; - -class TestDelegate { -public: - virtual void clearContextMenuData() = 0; - virtual void clearEditCommand() = 0; - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) = 0; - virtual void setEditCommand(const std::string& name, const std::string& value) = 0; - virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0; - virtual void setGamepadData(const WebKit::WebGamepads&) = 0; - virtual void printMessage(const std::string& message) = 0; - virtual void postTask(WebTask*) = 0; - virtual void postDelayedTask(WebTask*, long long ms) = 0; - virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0; - virtual long long getCurrentTimeInMillisecond() = 0; - virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0; -}; - -} - -#endif // TestDelegate_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp deleted file mode 100644 index f08da5d40..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestInterfaces.h" - -#include "AccessibilityControllerChromium.h" -#include "EventSender.h" -#include "GamepadController.h" -#include "TextInputController.h" -#include "platform/WebString.h" - -using WebKit::WebFrame; -using WebKit::WebString; -using WebKit::WebView; - -namespace WebTestRunner { - -TestInterfaces::TestInterfaces() -{ - m_accessibilityController = adoptPtr(new AccessibilityController()); - m_eventSender = adoptPtr(new EventSender()); - m_gamepadController = adoptPtr(new GamepadController()); - m_textInputController = adoptPtr(new TextInputController()); -} - -TestInterfaces::~TestInterfaces() -{ - m_accessibilityController->setWebView(0); - m_eventSender->setWebView(0); - // m_gamepadController doesn't depend on WebView. - m_textInputController->setWebView(0); - - m_accessibilityController->setDelegate(0); - m_eventSender->setDelegate(0); - m_gamepadController->setDelegate(0); - // m_textInputController doesn't depend on TestDelegate. -} - -void TestInterfaces::setWebView(WebView* webView) -{ - m_accessibilityController->setWebView(webView); - m_eventSender->setWebView(webView); - // m_gamepadController doesn't depend on WebView. - m_textInputController->setWebView(webView); -} - -void TestInterfaces::setDelegate(TestDelegate* delegate) -{ - m_accessibilityController->setDelegate(delegate); - m_eventSender->setDelegate(delegate); - m_gamepadController->setDelegate(delegate); - // m_textInputController doesn't depend on TestDelegate. -} - -void TestInterfaces::bindTo(WebFrame* frame) -{ - m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController")); - m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender")); - m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController")); - m_textInputController->bindToJavascript(frame, WebString::fromUTF8("textInputController")); -} - -void TestInterfaces::resetAll() -{ - m_accessibilityController->reset(); - m_eventSender->reset(); - m_gamepadController->reset(); - // m_textInputController doesn't have any state to reset. -} - -AccessibilityController* TestInterfaces::accessibilityController() -{ - return m_accessibilityController.get(); -} - -EventSender* TestInterfaces::eventSender() -{ - return m_eventSender.get(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h deleted file mode 100644 index a7da43283..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestInterfaces_h -#define TestInterfaces_h - -#include <wtf/OwnPtr.h> - -namespace WebKit { -class WebFrame; -class WebView; -} - -namespace WebTestRunner { - -class AccessibilityController; -class EventSender; -class GamepadController; -class TestDelegate; -class TextInputController; - -class TestInterfaces { -public: - TestInterfaces(); - ~TestInterfaces(); - - void setWebView(WebKit::WebView*); - void setDelegate(TestDelegate*); - void bindTo(WebKit::WebFrame*); - void resetAll(); - - AccessibilityController* accessibilityController(); - EventSender* eventSender(); - -private: - OwnPtr<AccessibilityController> m_accessibilityController; - OwnPtr<EventSender> m_eventSender; - OwnPtr<GamepadController> m_gamepadController; - OwnPtr<TextInputController> m_textInputController; -}; - -} - -#endif // TestInterfaces_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp deleted file mode 100644 index 8aa817a2b..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp +++ /dev/null @@ -1,755 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestRunner.h" - -#include "WebAnimationController.h" -#include "WebBindings.h" -#include "WebDocument.h" -#include "WebElement.h" -#include "WebFindOptions.h" -#include "WebFrame.h" -#include "WebInputElement.h" -#include "WebScriptSource.h" -#include "WebSecurityPolicy.h" -#include "WebSettings.h" -#include "WebSurroundingText.h" -#include "WebTestDelegate.h" -#include "WebView.h" -#include "WebWorkerInfo.h" -#include "platform/WebPoint.h" -#include "v8/include/v8.h" - -#if OS(LINUX) || OS(ANDROID) -#include "linux/WebFontRendering.h" -#endif - -using namespace WebKit; -using namespace std; - -namespace WebTestRunner { - -TestRunner::TestRunner() - : m_delegate(0) - , m_webView(0) -{ - // Methods implemented in terms of chromium's public WebKit API. - bindMethod("setTabKeyCyclesThroughElements", &TestRunner::setTabKeyCyclesThroughElements); - bindMethod("setAsynchronousSpellCheckingEnabled", &TestRunner::setAsynchronousSpellCheckingEnabled); - bindMethod("execCommand", &TestRunner::execCommand); - bindMethod("isCommandEnabled", &TestRunner::isCommandEnabled); - bindMethod("pauseAnimationAtTimeOnElementWithId", &TestRunner::pauseAnimationAtTimeOnElementWithId); - bindMethod("pauseTransitionAtTimeOnElementWithId", &TestRunner::pauseTransitionAtTimeOnElementWithId); - bindMethod("elementDoesAutoCompleteForElementWithId", &TestRunner::elementDoesAutoCompleteForElementWithId); - bindMethod("numberOfActiveAnimations", &TestRunner::numberOfActiveAnimations); - bindMethod("callShouldCloseOnWebView", &TestRunner::callShouldCloseOnWebView); - bindMethod("setDomainRelaxationForbiddenForURLScheme", &TestRunner::setDomainRelaxationForbiddenForURLScheme); - bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &TestRunner::evaluateScriptInIsolatedWorldAndReturnValue); - bindMethod("evaluateScriptInIsolatedWorld", &TestRunner::evaluateScriptInIsolatedWorld); - bindMethod("setIsolatedWorldSecurityOrigin", &TestRunner::setIsolatedWorldSecurityOrigin); - bindMethod("setIsolatedWorldContentSecurityPolicy", &TestRunner::setIsolatedWorldContentSecurityPolicy); - bindMethod("addOriginAccessWhitelistEntry", &TestRunner::addOriginAccessWhitelistEntry); - bindMethod("removeOriginAccessWhitelistEntry", &TestRunner::removeOriginAccessWhitelistEntry); - bindMethod("hasCustomPageSizeStyle", &TestRunner::hasCustomPageSizeStyle); - bindMethod("forceRedSelectionColors", &TestRunner::forceRedSelectionColors); - bindMethod("addUserScript", &TestRunner::addUserScript); - bindMethod("addUserStyleSheet", &TestRunner::addUserStyleSheet); - bindMethod("startSpeechInput", &TestRunner::startSpeechInput); - bindMethod("loseCompositorContext", &TestRunner::loseCompositorContext); - bindMethod("markerTextForListItem", &TestRunner::markerTextForListItem); - bindMethod("findString", &TestRunner::findString); - bindMethod("setMinimumTimerInterval", &TestRunner::setMinimumTimerInterval); - bindMethod("setAutofilled", &TestRunner::setAutofilled); - bindMethod("setValueForUser", &TestRunner::setValueForUser); - bindMethod("enableFixedLayoutMode", &TestRunner::enableFixedLayoutMode); - bindMethod("setFixedLayoutSize", &TestRunner::setFixedLayoutSize); - bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup); - bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositioning); - bindMethod("resetPageVisibility", &TestRunner::resetPageVisibility); - bindMethod("setPageVisibility", &TestRunner::setPageVisibility); - bindMethod("setTextDirection", &TestRunner::setTextDirection); - bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode); - bindMethod("setTouchDragDropEnabled", &TestRunner::setTouchDragDropEnabled); - - // Properties. - bindProperty("workerThreadCount", &TestRunner::workerThreadCount); - bindProperty("globalFlag", &m_globalFlag); - bindProperty("platformName", &m_platformName); - - // The following are stubs. - bindMethod("dumpDatabaseCallbacks", &TestRunner::notImplemented); -#if ENABLE(NOTIFICATIONS) - bindMethod("denyWebNotificationPermission", &TestRunner::notImplemented); - bindMethod("removeAllWebNotificationPermissions", &TestRunner::notImplemented); - bindMethod("simulateWebNotificationClick", &TestRunner::notImplemented); -#endif - bindMethod("setIconDatabaseEnabled", &TestRunner::notImplemented); - bindMethod("setScrollbarPolicy", &TestRunner::notImplemented); - bindMethod("clearAllApplicationCaches", &TestRunner::notImplemented); - bindMethod("clearApplicationCacheForOrigin", &TestRunner::notImplemented); - bindMethod("clearBackForwardList", &TestRunner::notImplemented); - bindMethod("keepWebHistory", &TestRunner::notImplemented); - bindMethod("setApplicationCacheOriginQuota", &TestRunner::notImplemented); - bindMethod("setCallCloseOnWebViews", &TestRunner::notImplemented); - bindMethod("setMainFrameIsFirstResponder", &TestRunner::notImplemented); - bindMethod("setPrivateBrowsingEnabled", &TestRunner::notImplemented); - bindMethod("setUseDashboardCompatibilityMode", &TestRunner::notImplemented); - bindMethod("deleteAllLocalStorage", &TestRunner::notImplemented); - bindMethod("localStorageDiskUsageForOrigin", &TestRunner::notImplemented); - bindMethod("originsWithLocalStorage", &TestRunner::notImplemented); - bindMethod("deleteLocalStorageForOrigin", &TestRunner::notImplemented); - bindMethod("observeStorageTrackerNotifications", &TestRunner::notImplemented); - bindMethod("syncLocalStorage", &TestRunner::notImplemented); - bindMethod("addDisallowedURL", &TestRunner::notImplemented); - bindMethod("applicationCacheDiskUsageForOrigin", &TestRunner::notImplemented); - bindMethod("abortModal", &TestRunner::notImplemented); - - // The fallback method is called when an unknown method is invoked. - bindFallbackMethod(&TestRunner::fallbackMethod); -} - -void TestRunner::reset() -{ - if (m_webView) { - m_webView->setZoomLevel(false, 0); - m_webView->setTabKeyCyclesThroughElements(true); -#if !OS(DARWIN) && !OS(WINDOWS) // Actually, TOOLKIT_GTK - // (Constants copied because we can't depend on the header that defined - // them from this file.) - m_webView->setSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232); -#endif - m_webView->removeAllUserContent(); - m_webView->disableAutoResizeMode(); - } - WebSecurityPolicy::resetOriginAccessWhitelists(); -#if OS(LINUX) || OS(ANDROID) - WebFontRendering::setSubpixelPositioning(false); -#endif - - m_globalFlag.set(false); - m_platformName.set("chromium"); -} - -void TestRunner::setTabKeyCyclesThroughElements(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_webView->setTabKeyCyclesThroughElements(arguments[0].toBoolean()); - result->setNull(); -} - -void TestRunner::setAsynchronousSpellCheckingEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isBool()) - m_webView->settings()->setAsynchronousSpellCheckingEnabled(cppVariantToBool(arguments[0])); - result->setNull(); -} - -void TestRunner::execCommand(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() <= 0 || !arguments[0].isString()) - return; - - std::string command = arguments[0].toString(); - std::string value(""); - // Ignore the second parameter (which is userInterface) - // since this command emulates a manual action. - if (arguments.size() >= 3 && arguments[2].isString()) - value = arguments[2].toString(); - - // Note: webkit's version does not return the boolean, so neither do we. - m_webView->focusedFrame()->executeCommand(WebString::fromUTF8(command), WebString::fromUTF8(value)); -} - -void TestRunner::isCommandEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() <= 0 || !arguments[0].isString()) { - result->setNull(); - return; - } - - std::string command = arguments[0].toString(); - bool rv = m_webView->focusedFrame()->isCommandEnabled(WebString::fromUTF8(command)); - result->set(rv); -} - -bool TestRunner::pauseAnimationAtTimeOnElementWithId(const WebString& animationName, double time, const WebString& elementId) -{ - WebFrame* webFrame = m_webView->mainFrame(); - if (!webFrame) - return false; - - WebAnimationController* controller = webFrame->animationController(); - if (!controller) - return false; - - WebElement element = webFrame->document().getElementById(elementId); - if (element.isNull()) - return false; - return controller->pauseAnimationAtTime(element, animationName, time); -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(const WebString& propertyName, double time, const WebString& elementId) -{ - WebFrame* webFrame = m_webView->mainFrame(); - if (!webFrame) - return false; - - WebAnimationController* controller = webFrame->animationController(); - if (!controller) - return false; - - WebElement element = webFrame->document().getElementById(elementId); - if (element.isNull()) - return false; - return controller->pauseTransitionAtTime(element, propertyName, time); -} - -bool TestRunner::elementDoesAutoCompleteForElementWithId(const WebString& elementId) -{ - WebFrame* webFrame = m_webView->mainFrame(); - if (!webFrame) - return false; - - WebElement element = webFrame->document().getElementById(elementId); - if (element.isNull() || !element.hasTagName("input")) - return false; - - WebInputElement inputElement = element.to<WebInputElement>(); - return inputElement.autoComplete(); -} - -int TestRunner::numberOfActiveAnimations() -{ - WebFrame* webFrame = m_webView->mainFrame(); - if (!webFrame) - return -1; - - WebAnimationController* controller = webFrame->animationController(); - if (!controller) - return -1; - - return controller->numberOfActiveAnimations(); -} - -void TestRunner::pauseAnimationAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result) -{ - result->set(false); - if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) { - WebString animationName = cppVariantToWebString(arguments[0]); - double time = arguments[1].toDouble(); - WebString elementId = cppVariantToWebString(arguments[2]); - result->set(pauseAnimationAtTimeOnElementWithId(animationName, time, elementId)); - } -} - -void TestRunner::pauseTransitionAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result) -{ - result->set(false); - if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) { - WebString propertyName = cppVariantToWebString(arguments[0]); - double time = arguments[1].toDouble(); - WebString elementId = cppVariantToWebString(arguments[2]); - result->set(pauseTransitionAtTimeOnElementWithId(propertyName, time, elementId)); - } -} - -void TestRunner::elementDoesAutoCompleteForElementWithId(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 1 || !arguments[0].isString()) { - result->set(false); - return; - } - WebString elementId = cppVariantToWebString(arguments[0]); - result->set(elementDoesAutoCompleteForElementWithId(elementId)); -} - -void TestRunner::numberOfActiveAnimations(const CppArgumentList&, CppVariant* result) -{ - result->set(numberOfActiveAnimations()); -} - -void TestRunner::callShouldCloseOnWebView(const CppArgumentList&, CppVariant* result) -{ - result->set(m_webView->dispatchBeforeUnloadEvent()); -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() != 2 || !arguments[0].isBool() || !arguments[1].isString()) - return; - m_webView->setDomainRelaxationForbidden(cppVariantToBool(arguments[0]), cppVariantToWebString(arguments[1])); -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList& arguments, CppVariant* result) -{ - v8::HandleScope scope; - WebVector<v8::Local<v8::Value> > values; - if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) { - WebScriptSource source(cppVariantToWebString(arguments[1])); - // This relies on the iframe focusing itself when it loads. This is a bit - // sketchy, but it seems to be what other tests do. - m_webView->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1, &values); - } - result->setNull(); - // Since only one script was added, only one result is expected - if (values.size() == 1 && !values[0].IsEmpty()) { - v8::Local<v8::Value> scriptValue = values[0]; - // FIXME: There are many more types that can be handled. - if (scriptValue->IsString()) { - v8::String::AsciiValue asciiV8(scriptValue); - result->set(std::string(*asciiV8)); - } else if (scriptValue->IsBoolean()) - result->set(scriptValue->ToBoolean()->Value()); - else if (scriptValue->IsNumber()) { - if (scriptValue->IsInt32()) - result->set(scriptValue->ToInt32()->Value()); - else - result->set(scriptValue->ToNumber()->Value()); - } else if (scriptValue->IsNull()) - result->setNull(); - } -} - -void TestRunner::evaluateScriptInIsolatedWorld(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) { - WebScriptSource source(cppVariantToWebString(arguments[1])); - // This relies on the iframe focusing itself when it loads. This is a bit - // sketchy, but it seems to be what other tests do. - m_webView->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1); - } - result->setNull(); -} - -void TestRunner::setIsolatedWorldSecurityOrigin(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 2 || !arguments[0].isNumber() || !(arguments[1].isString() || arguments[1].isNull())) - return; - - WebSecurityOrigin origin; - if (arguments[1].isString()) - origin = WebSecurityOrigin::createFromString(cppVariantToWebString(arguments[1])); - m_webView->focusedFrame()->setIsolatedWorldSecurityOrigin(arguments[0].toInt32(), origin); -} - -void TestRunner::setIsolatedWorldContentSecurityPolicy(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isString()) - return; - - m_webView->focusedFrame()->setIsolatedWorldContentSecurityPolicy(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); -} - -void TestRunner::addOriginAccessWhitelistEntry(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isString() - || !arguments[2].isString() || !arguments[3].isBool()) - return; - - WebKit::WebURL url(GURL(arguments[0].toString())); - if (!url.isValid()) - return; - - WebSecurityPolicy::addOriginAccessWhitelistEntry( - url, - cppVariantToWebString(arguments[1]), - cppVariantToWebString(arguments[2]), - arguments[3].toBoolean()); -} - -void TestRunner::removeOriginAccessWhitelistEntry(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isString() - || !arguments[2].isString() || !arguments[3].isBool()) - return; - - WebKit::WebURL url(GURL(arguments[0].toString())); - if (!url.isValid()) - return; - - WebSecurityPolicy::removeOriginAccessWhitelistEntry( - url, - cppVariantToWebString(arguments[1]), - cppVariantToWebString(arguments[2]), - arguments[3].toBoolean()); -} - -void TestRunner::hasCustomPageSizeStyle(const CppArgumentList& arguments, CppVariant* result) -{ - result->set(false); - int pageIndex = 0; - if (arguments.size() > 1) - return; - if (arguments.size() == 1) - pageIndex = cppVariantToInt32(arguments[0]); - WebFrame* frame = m_webView->mainFrame(); - if (!frame) - return; - result->set(frame->hasCustomPageSizeStyle(pageIndex)); -} - -void TestRunner::forceRedSelectionColors(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - m_webView->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0); -} - -void TestRunner::addUserScript(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isBool() || !arguments[2].isBool()) - return; - WebView::addUserScript( - cppVariantToWebString(arguments[0]), WebVector<WebString>(), - arguments[1].toBoolean() ? WebView::UserScriptInjectAtDocumentStart : WebView::UserScriptInjectAtDocumentEnd, - arguments[2].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly); -} - -void TestRunner::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool()) - return; - WebView::addUserStyleSheet( - cppVariantToWebString(arguments[0]), WebVector<WebString>(), - arguments[1].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly, - // Chromium defaults to InjectInSubsequentDocuments, but for compatibility - // with the other ports' DRTs, we use UserStyleInjectInExistingDocuments. - WebView::UserStyleInjectInExistingDocuments); -} - -void TestRunner::startSpeechInput(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 1) - return; - - WebElement element; - if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) - return; - - WebInputElement* input = toWebInputElement(&element); - if (!input) - return; - - if (!input->isSpeechInputEnabled()) - return; - - input->startSpeechInput(); -} - -void TestRunner::loseCompositorContext(const CppArgumentList& args, CppVariant*) -{ - int numTimes; - if (args.size() == 1 || !args[0].isNumber()) - numTimes = 1; - else - numTimes = args[0].toInt32(); - m_webView->loseCompositorContext(numTimes); -} - -void TestRunner::markerTextForListItem(const CppArgumentList& args, CppVariant* result) -{ - WebElement element; - if (!WebBindings::getElement(args[0].value.objectValue, &element)) - result->setNull(); - else - result->set(element.document().frame()->markerTextForListItem(element).utf8()); -} - -void TestRunner::findString(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 1 || !arguments[0].isString()) - return; - - WebFindOptions findOptions; - bool wrapAround = false; - if (arguments.size() >= 2) { - Vector<std::string> optionsArray = arguments[1].toStringVector(); - findOptions.matchCase = true; - - for (size_t i = 0; i < optionsArray.size(); ++i) { - const std::string& option = optionsArray[i]; - // FIXME: Support all the options, so we can run findString.html too. - if (option == "CaseInsensitive") - findOptions.matchCase = false; - else if (option == "Backwards") - findOptions.forward = false; - else if (option == "WrapAround") - wrapAround = true; - } - } - - WebFrame* frame = m_webView->mainFrame(); - const bool findResult = frame->find(0, cppVariantToWebString(arguments[0]), findOptions, wrapAround, 0); - result->set(findResult); -} - -void TestRunner::setMinimumTimerInterval(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isNumber()) - return; - m_webView->settings()->setMinimumTimerInterval(arguments[0].toDouble()); -} - -void TestRunner::setAutofilled(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 2 || !arguments[1].isBool()) - return; - - WebElement element; - if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) - return; - - WebInputElement* input = toWebInputElement(&element); - if (!input) - return; - - input->setAutofilled(arguments[1].value.boolValue); -} - -void TestRunner::setValueForUser(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 2) - return; - - WebElement element; - if (!WebBindings::getElement(arguments[0].value.objectValue, &element)) - return; - - WebInputElement* input = toWebInputElement(&element); - if (!input) - return; - - input->setValue(cppVariantToWebString(arguments[1]), true); -} - -void TestRunner::enableFixedLayoutMode(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 1 || !arguments[0].isBool()) - return; - bool enableFixedLayout = arguments[0].toBoolean(); - m_webView->enableFixedLayoutMode(enableFixedLayout); -} - -void TestRunner::setFixedLayoutSize(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - int width = arguments[0].toInt32(); - int height = arguments[1].toInt32(); - m_webView->setFixedLayoutSize(WebSize(width, height)); -} - -void TestRunner::selectionAsMarkup(const CppArgumentList& arguments, CppVariant* result) -{ - result->set(m_webView->mainFrame()->selectionAsMarkup().utf8()); -} - -void TestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result) -{ -#if OS(LINUX) || OS(ANDROID) - // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back - // to setting it globally for all fonts. - if (arguments.size() > 0 && arguments[0].isBool()) - WebFontRendering::setSubpixelPositioning(arguments[0].value.boolValue); -#endif - result->setNull(); -} - -void TestRunner::resetPageVisibility(const CppArgumentList& arguments, CppVariant* result) -{ - m_webView->setVisibilityState(WebPageVisibilityStateVisible, true); -} - -void TestRunner::setPageVisibility(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() > 0 && arguments[0].isString()) { - string newVisibility = arguments[0].toString(); - if (newVisibility == "visible") - m_webView->setVisibilityState(WebPageVisibilityStateVisible, false); - else if (newVisibility == "hidden") - m_webView->setVisibilityState(WebPageVisibilityStateHidden, false); - else if (newVisibility == "prerender") - m_webView->setVisibilityState(WebPageVisibilityStatePrerender, false); - else if (newVisibility == "preview") - m_webView->setVisibilityState(WebPageVisibilityStatePreview, false); - } -} - -void TestRunner::setTextDirection(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 1 || !arguments[0].isString()) - return; - - // Map a direction name to a WebTextDirection value. - std::string directionName = arguments[0].toString(); - WebKit::WebTextDirection direction; - if (directionName == "auto") - direction = WebKit::WebTextDirectionDefault; - else if (directionName == "rtl") - direction = WebKit::WebTextDirectionRightToLeft; - else if (directionName == "ltr") - direction = WebKit::WebTextDirectionLeftToRight; - else - return; - - m_webView->setTextDirection(direction); -} - -void TestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() < 4 || !arguments[0].isObject() || !arguments[1].isNumber() || !arguments[2].isNumber() || !arguments[3].isNumber()) - return; - - WebNode node; - if (!WebBindings::getNode(arguments[0].value.objectValue, &node)) - return; - - if (node.isNull() || !node.isTextNode()) - return; - - WebPoint point(arguments[1].toInt32(), arguments[2].toInt32()); - unsigned maxLength = arguments[3].toInt32(); - - WebSurroundingText surroundingText; - surroundingText.initialize(node, point, maxLength); - if (surroundingText.isNull()) - return; - - result->set(surroundingText.textContent().utf8()); -} - -void TestRunner::setTouchDragDropEnabled(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - if (arguments.size() != 1 || !arguments[0].isBool()) - return; - - m_webView->settings()->setTouchDragDropEnabled(arguments[0].toBoolean()); -} - -void TestRunner::workerThreadCount(CppVariant* result) -{ - result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount())); -} - -// Need these conversions because the format of the value for booleans -// may vary - for example, on mac "1" and "0" are used for boolean. -bool TestRunner::cppVariantToBool(const CppVariant& value) -{ - if (value.isBool()) - return value.toBoolean(); - if (value.isNumber()) - return value.toInt32(); - if (value.isString()) { - string valueString = value.toString(); - if (valueString == "true" || valueString == "1") - return true; - if (valueString == "false" || valueString == "0") - return false; - } - printErrorMessage("Invalid value. Expected boolean value."); - return false; -} - -int32_t TestRunner::cppVariantToInt32(const CppVariant& value) -{ - if (value.isNumber()) - return value.toInt32(); - if (value.isString()) { - string stringSource = value.toString(); - const char* source = stringSource.data(); - char* end; - long number = strtol(source, &end, 10); - if (end == source + stringSource.length() && number >= numeric_limits<int32_t>::min() && number <= numeric_limits<int32_t>::max()) - return static_cast<int32_t>(number); - } - printErrorMessage("Invalid value for preference. Expected integer value."); - return 0; -} - -WebString TestRunner::cppVariantToWebString(const CppVariant& value) -{ - if (!value.isString()) { - printErrorMessage("Invalid value for preference. Expected string value."); - return WebString(); - } - return WebString::fromUTF8(value.toString()); -} - -Vector<WebString> TestRunner::cppVariantToWebStringArray(const CppVariant& value) -{ - if (!value.isObject()) { - printErrorMessage("Invalid value for preference. Expected object value."); - return Vector<WebString>(); - } - Vector<WebString> resultVector; - Vector<string> stringVector = value.toStringVector(); - for (size_t i = 0; i < stringVector.size(); ++i) - resultVector.append(WebString::fromUTF8(stringVector[i].c_str())); - return resultVector; -} - -void TestRunner::printErrorMessage(const string& text) -{ - m_delegate->printMessage(string("CONSOLE MESSAGE: ") + text + "\n"); -} - -void TestRunner::fallbackMethod(const CppArgumentList&, CppVariant* result) -{ - printErrorMessage("JavaScript ERROR: unknown method called on TestRunner"); - result->setNull(); -} - -void TestRunner::notImplemented(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h deleted file mode 100644 index 4691e5579..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestRunner_h -#define TestRunner_h - -#include "CppBoundClass.h" - -namespace WebKit { -class WebView; -} - -namespace WebTestRunner { - -class WebTestDelegate; - -class TestRunner : public CppBoundClass { -public: - TestRunner(); - - // FIXME: once DRTTestRunner is moved entirely to this class, change this - // method to take a TestDelegate* instead. - void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; } - void setWebView(WebKit::WebView* webView) { m_webView = webView; } - - void reset(); - -protected: - // FIXME: make these private once the move from DRTTestRunner to TestRunner - // is complete. - bool cppVariantToBool(const CppVariant&); - int32_t cppVariantToInt32(const CppVariant&); - WebKit::WebString cppVariantToWebString(const CppVariant&); - Vector<WebKit::WebString> cppVariantToWebStringArray(const CppVariant&); - - void printErrorMessage(const std::string&); - -private: - /////////////////////////////////////////////////////////////////////////// - // Methods implemented entirely in terms of chromium's public WebKit API - - // Method that controls whether pressing Tab key cycles through page elements - // or inserts a '\t' char in text area - void setTabKeyCyclesThroughElements(const CppArgumentList&, CppVariant*); - - // Changes asynchronous spellchecking flag on the settings. - void setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*); - - // Executes an internal command (superset of document.execCommand() commands). - void execCommand(const CppArgumentList&, CppVariant*); - - // Checks if an internal command is currently available. - void isCommandEnabled(const CppArgumentList&, CppVariant*); - - void pauseAnimationAtTimeOnElementWithId(const CppArgumentList&, CppVariant*); - void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*); - void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*); - void numberOfActiveAnimations(const CppArgumentList&, CppVariant*); - void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*); - void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*); - void evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList&, CppVariant*); - void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*); - void setIsolatedWorldSecurityOrigin(const CppArgumentList&, CppVariant*); - void setIsolatedWorldContentSecurityPolicy(const CppArgumentList&, CppVariant*); - - // Allows layout tests to manage origins' whitelisting. - void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*); - void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*); - - // Returns true if the current page box has custom page size style for - // printing. - void hasCustomPageSizeStyle(const CppArgumentList&, CppVariant*); - - // Forces the selection colors for testing under Linux. - void forceRedSelectionColors(const CppArgumentList&, CppVariant*); - - // Adds a user script or user style sheet to be injected into new documents. - void addUserScript(const CppArgumentList&, CppVariant*); - void addUserStyleSheet(const CppArgumentList&, CppVariant*); - - void startSpeechInput(const CppArgumentList&, CppVariant*); - - void loseCompositorContext(const CppArgumentList& args, CppVariant* result); - - void markerTextForListItem(const CppArgumentList&, CppVariant*); - void findString(const CppArgumentList&, CppVariant*); - - void setMinimumTimerInterval(const CppArgumentList&, CppVariant*); - - // Expects the first argument to be an input element and the second argument to be a boolean. - // Forwards the setAutofilled() call to the element. - void setAutofilled(const CppArgumentList&, CppVariant*); - - // Expects the first argument to be an input element and the second argument to be a string value. - // Forwards the setValueForUser() call to the element. - void setValueForUser(const CppArgumentList&, CppVariant*); - - void enableFixedLayoutMode(const CppArgumentList&, CppVariant*); - void setFixedLayoutSize(const CppArgumentList&, CppVariant*); - - void selectionAsMarkup(const CppArgumentList&, CppVariant*); - - // Enables or disables subpixel positioning (i.e. fractional X positions for - // glyphs) in text rendering on Linux. Since this method changes global - // settings, tests that call it must use their own custom font family for - // all text that they render. If not, an already-cached style will be used, - // resulting in the changed setting being ignored. - void setTextSubpixelPositioning(const CppArgumentList&, CppVariant*); - - // Switch the visibility of the page. - void setPageVisibility(const CppArgumentList&, CppVariant*); - void resetPageVisibility(const CppArgumentList&, CppVariant*); - - // Changes the direction of the focused element. - void setTextDirection(const CppArgumentList&, CppVariant*); - - // Retrieves the text surrounding a position in a text node. - // Expects the first argument to be a text node, the second and third to be - // point coordinates relative to the node and the fourth the maximum text - // length to retrieve. - void textSurroundingNode(const CppArgumentList&, CppVariant*); - void setTouchDragDropEnabled(const CppArgumentList&, CppVariant*); - - /////////////////////////////////////////////////////////////////////////// - // Properties - void workerThreadCount(CppVariant*); - - /////////////////////////////////////////////////////////////////////////// - // Fallback and stub methods - - // The fallback method is called when a nonexistent method is called on - // the layout test controller object. - // It is usefull to catch typos in the JavaScript code (a few layout tests - // do have typos in them) and it allows the script to continue running in - // that case (as the Mac does). - void fallbackMethod(const CppArgumentList&, CppVariant*); - - // Stub for not implemented methods. - void notImplemented(const CppArgumentList&, CppVariant*); - - /////////////////////////////////////////////////////////////////////////// - // Internal helpers - bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId); - bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId); - bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&); - int numberOfActiveAnimations(); - - // globalFlag is used by a number of layout tests in http/tests/security/dataURL. - CppVariant m_globalFlag; - - // Bound variable to return the name of this platform (chromium). - CppVariant m_platformName; - - WebTestDelegate* m_delegate; - WebKit::WebView* m_webView; -}; - -} - -#endif // TestRunner_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp deleted file mode 100644 index e929c71fb..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TextInputController.h" - -#include "WebBindings.h" -#include "WebCompositionUnderline.h" -#include "WebFrame.h" -#include "WebInputEvent.h" -#include "WebRange.h" -#include "WebView.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" -#include <string> -#include <wtf/StringExtras.h> - -using namespace WebKit; - -namespace WebTestRunner { - -TextInputController::TextInputController() -{ - bindMethod("attributedSubstringFromRange", &TextInputController::attributedSubstringFromRange); - bindMethod("characterIndexForPoint", &TextInputController::characterIndexForPoint); - bindMethod("conversationIdentifier", &TextInputController::conversationIdentifier); - bindMethod("doCommand", &TextInputController::doCommand); - bindMethod("firstRectForCharacterRange", &TextInputController::firstRectForCharacterRange); - bindMethod("hasMarkedText", &TextInputController::hasMarkedText); - bindMethod("insertText", &TextInputController::insertText); - bindMethod("makeAttributedString", &TextInputController::makeAttributedString); - bindMethod("markedRange", &TextInputController::markedRange); - bindMethod("selectedRange", &TextInputController::selectedRange); - bindMethod("setMarkedText", &TextInputController::setMarkedText); - bindMethod("substringFromRange", &TextInputController::substringFromRange); - bindMethod("unmarkText", &TextInputController::unmarkText); - bindMethod("validAttributesForMarkedText", &TextInputController::validAttributesForMarkedText); - bindMethod("setComposition", &TextInputController::setComposition); -} - -void TextInputController::insertText(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1 || !arguments[0].isString()) - return; - - m_webView->confirmComposition(WebString::fromUTF8(arguments[0].toString())); -} - -void TextInputController::doCommand(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - WebFrame* mainFrame = m_webView->mainFrame(); - if (!mainFrame) - return; - - if (arguments.size() >= 1 && arguments[0].isString()) - mainFrame->executeCommand(WebString::fromUTF8(arguments[0].toString())); -} - -void TextInputController::setMarkedText(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() >= 3 && arguments[0].isString() - && arguments[1].isNumber() && arguments[2].isNumber()) { - WebVector<WebCompositionUnderline> underlines; - m_webView->setComposition(WebString::fromUTF8(arguments[0].toString()), - underlines, - arguments[1].toInt32(), - arguments[1].toInt32() + arguments[2].toInt32()); - } -} - -void TextInputController::unmarkText(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - - m_webView->confirmComposition(); -} - -void TextInputController::hasMarkedText(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - - WebFrame* mainFrame = m_webView->mainFrame(); - if (!mainFrame) - return; - - result->set(mainFrame->hasMarkedText()); -} - -void TextInputController::conversationIdentifier(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void TextInputController::substringFromRange(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void TextInputController::attributedSubstringFromRange(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void TextInputController::markedRange(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - - WebFrame* mainFrame = m_webView->mainFrame(); - if (!mainFrame) - return; - - WebRange range = mainFrame->markedRange(); - Vector<int> intArray(2); - intArray[0] = range.startOffset(); - intArray[1] = range.endOffset(); - result->set(WebBindings::makeIntArray(intArray)); -} - -void TextInputController::selectedRange(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - - WebFrame* mainFrame = m_webView->mainFrame(); - if (!mainFrame) - return; - - WebRange range = mainFrame->selectionRange(); - Vector<int> intArray(2); - intArray[0] = range.startOffset(); - intArray[1] = range.endOffset(); - result->set(WebBindings::makeIntArray(intArray)); -} - -void TextInputController::firstRectForCharacterRange(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - WebFrame* frame = m_webView->focusedFrame(); - if (!frame) - return; - - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - - WebRect rect; - if (!frame->firstRectForCharacterRange(arguments[0].toInt32(), arguments[1].toInt32(), rect)) - return; - - Vector<int> intArray(4); - intArray[0] = rect.x; - intArray[1] = rect.y; - intArray[2] = rect.width; - intArray[3] = rect.height; - result->set(WebBindings::makeIntArray(intArray)); -} - -void TextInputController::characterIndexForPoint(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void TextInputController::validAttributesForMarkedText(const CppArgumentList&, CppVariant* result) -{ - result->setNull(); - - WebFrame* mainFrame = m_webView->mainFrame(); - if (!mainFrame) - return; - - result->set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment," - "NSTextInputReplacementRangeAttributeName"); -} - -void TextInputController::makeAttributedString(const CppArgumentList&, CppVariant* result) -{ - // FIXME: Implement this. - result->setNull(); -} - -void TextInputController::setComposition(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1) - return; - - // Sends a keydown event with key code = 0xE5 to emulate input method behavior. - WebKeyboardEvent keyDown; - keyDown.type = WebInputEvent::RawKeyDown; - keyDown.modifiers = 0; - keyDown.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY - keyDown.setKeyIdentifierFromWindowsKeyCode(); - m_webView->handleInputEvent(keyDown); - - WebVector<WebCompositionUnderline> underlines; - WebString text(WebString::fromUTF8(arguments[0].toString())); - m_webView->setComposition(text, underlines, 0, text.length()); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h deleted file mode 100644 index 286d83356..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// TextInputController is bound to window.textInputController in Javascript -// when DRT is running. Layout tests use it to exercise various corners of -// text input. - -#ifndef TextInputController_h -#define TextInputController_h - -#include "CppBoundClass.h" - -namespace WebKit { -class WebView; -} - -namespace WebTestRunner { - -class TextInputController : public CppBoundClass { -public: - TextInputController(); - - void setWebView(WebKit::WebView* webView) { m_webView = webView; } - - void insertText(const CppArgumentList&, CppVariant*); - void doCommand(const CppArgumentList&, CppVariant*); - void setMarkedText(const CppArgumentList&, CppVariant*); - void unmarkText(const CppArgumentList&, CppVariant*); - void hasMarkedText(const CppArgumentList&, CppVariant*); - void conversationIdentifier(const CppArgumentList&, CppVariant*); - void substringFromRange(const CppArgumentList&, CppVariant*); - void attributedSubstringFromRange(const CppArgumentList&, CppVariant*); - void markedRange(const CppArgumentList&, CppVariant*); - void selectedRange(const CppArgumentList&, CppVariant*); - void firstRectForCharacterRange(const CppArgumentList&, CppVariant*); - void characterIndexForPoint(const CppArgumentList&, CppVariant*); - void validAttributesForMarkedText(const CppArgumentList&, CppVariant*); - void makeAttributedString(const CppArgumentList&, CppVariant*); - void setComposition(const CppArgumentList&, CppVariant*); - -private: - WebKit::WebView* m_webView; -}; - -} - -#endif // TextInputController_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp deleted file mode 100644 index 3fbe30945..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebAccessibilityController.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebAccessibilityController.h" - -#include "AccessibilityControllerChromium.h" - -using WebKit::WebAccessibilityObject; - -namespace WebTestRunner { - -WebAccessibilityController::WebAccessibilityController(AccessibilityController* controller) - : m_private(controller) -{ -} - -void WebAccessibilityController::setFocusedElement(const WebAccessibilityObject& object) -{ - m_private->setFocusedElement(object); -} - -void WebAccessibilityController::notificationReceived(const WebAccessibilityObject& target, const char* notificationName) -{ - m_private->notificationReceived(target, notificationName); -} - -bool WebAccessibilityController::shouldLogAccessibilityEvents() -{ - return m_private->shouldLogAccessibilityEvents(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp deleted file mode 100644 index 93c0bba49..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebEventSender.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebEventSender.h" - -#include "EventSender.h" - -using WebKit::WebDragData; -using WebKit::WebDragOperationsMask; - -namespace WebTestRunner { - -WebEventSender::WebEventSender(EventSender* eventSender) - : m_private(eventSender) -{ -} - -void WebEventSender::doDragDrop(const WebDragData& data, WebDragOperationsMask mask) -{ - m_private->doDragDrop(data, mask); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp deleted file mode 100644 index 97531c80d..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebTask.h" - -#include "WebKit.h" -#include <wtf/Vector.h> - -namespace WebTestRunner { - -WebTask::WebTask(WebTaskList* list) - : m_taskList(list) -{ - m_taskList->registerTask(this); -} - -WebTask::~WebTask() -{ - if (m_taskList) - m_taskList->unregisterTask(this); -} - -class WebTaskList::Private : public Vector<WebTask*> { -}; - -WebTaskList::WebTaskList() - : m_private(new Private) -{ -} - -WebTaskList::~WebTaskList() -{ - revokeAll(); - delete m_private; -} - -void WebTaskList::registerTask(WebTask* task) -{ - m_private->append(task); -} - -void WebTaskList::unregisterTask(WebTask* task) -{ - size_t index = m_private->find(task); - if (index != notFound) - m_private->remove(index); -} - -void WebTaskList::revokeAll() -{ - while (!m_private->isEmpty()) - (*m_private)[0]->cancel(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp deleted file mode 100644 index 9a86953c3..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebTestInterfaces.h" - -#include "TestDelegate.h" -#include "TestInterfaces.h" -#include "WebAccessibilityController.h" -#include "WebEventSender.h" -#include "WebTestDelegate.h" - -using WebKit::WebContextMenuData; -using WebKit::WebFrame; -using WebKit::WebGamepads; -using WebKit::WebString; -using WebKit::WebVector; -using WebKit::WebView; - -namespace WebTestRunner { - -class WebTestInterfaces::Internal : public TestDelegate { -public: - Internal(); - virtual ~Internal(); - - TestInterfaces* testInterfaces() { return &m_interfaces; } - void setDelegate(WebTestDelegate*); - WebAccessibilityController* accessibilityController() { return &m_accessibilityController; } - WebEventSender* eventSender() { return &m_eventSender; } - - // TestDelegate implementation. - virtual void clearContextMenuData(); - virtual void clearEditCommand(); - virtual void fillSpellingSuggestionList(const WebString& word, WebVector<WebString>* suggestions); - virtual void setEditCommand(const std::string& name, const std::string& value); - virtual WebContextMenuData* lastContextMenuData() const; - virtual void setGamepadData(const WebGamepads&); - virtual void printMessage(const std::string& message); - virtual void postTask(WebTask*); - virtual void postDelayedTask(WebTask*, long long ms); - virtual WebString registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames); - virtual long long getCurrentTimeInMillisecond(); - virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path); - -private: - TestInterfaces m_interfaces; - WebAccessibilityController m_accessibilityController; - WebEventSender m_eventSender; - WebTestDelegate* m_delegate; -}; - -WebTestInterfaces::Internal::Internal() - : m_accessibilityController(m_interfaces.accessibilityController()) - , m_eventSender(m_interfaces.eventSender()) - , m_delegate(0) -{ -} - -WebTestInterfaces::Internal::~Internal() -{ -} - -void WebTestInterfaces::Internal::setDelegate(WebTestDelegate* delegate) -{ - if (delegate) { - m_delegate = delegate; - m_interfaces.setDelegate(this); - } else { - m_delegate = 0; - m_interfaces.setDelegate(0); - } -} - -void WebTestInterfaces::Internal::clearContextMenuData() -{ - m_delegate->clearContextMenuData(); -} - -void WebTestInterfaces::Internal::clearEditCommand() -{ - m_delegate->clearEditCommand(); -} - -void WebTestInterfaces::Internal::fillSpellingSuggestionList(const WebString& word, WebVector<WebString>* suggestions) -{ - m_delegate->fillSpellingSuggestionList(word, suggestions); -} - -void WebTestInterfaces::Internal::setEditCommand(const std::string& name, const std::string& value) -{ - m_delegate->setEditCommand(name, value); -} - -WebContextMenuData* WebTestInterfaces::Internal::lastContextMenuData() const -{ - return m_delegate->lastContextMenuData(); -} - -void WebTestInterfaces::Internal::setGamepadData(const WebGamepads& pads) -{ - m_delegate->setGamepadData(pads); -} - -void WebTestInterfaces::Internal::printMessage(const std::string& message) -{ - m_delegate->printMessage(message); -} - -void WebTestInterfaces::Internal::postTask(WebTask* task) -{ - m_delegate->postTask(task); -} - -void WebTestInterfaces::Internal::postDelayedTask(WebTask* task, long long ms) -{ - m_delegate->postDelayedTask(task, ms); -} - -WebString WebTestInterfaces::Internal::registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames) -{ - return m_delegate->registerIsolatedFileSystem(absoluteFilenames); -} - -long long WebTestInterfaces::Internal::getCurrentTimeInMillisecond() -{ - return m_delegate->getCurrentTimeInMillisecond(); -} - -WebKit::WebString WebTestInterfaces::Internal::getAbsoluteWebStringFromUTF8Path(const std::string& path) -{ - return m_delegate->getAbsoluteWebStringFromUTF8Path(path); -} - -WebTestInterfaces::WebTestInterfaces() -{ - m_internal = new Internal; -} - -WebTestInterfaces::~WebTestInterfaces() -{ - delete m_internal; -} - -void WebTestInterfaces::setWebView(WebView* webView) -{ - m_internal->testInterfaces()->setWebView(webView); -} - -void WebTestInterfaces::setDelegate(WebTestDelegate* delegate) -{ - m_internal->setDelegate(delegate); -} - -void WebTestInterfaces::bindTo(WebFrame* frame) -{ - m_internal->testInterfaces()->bindTo(frame); -} - -void WebTestInterfaces::resetAll() -{ - m_internal->testInterfaces()->resetAll(); -} - -WebAccessibilityController* WebTestInterfaces::accessibilityController() -{ - return m_internal->accessibilityController(); -} - -WebEventSender* WebTestInterfaces::eventSender() -{ - return m_internal->eventSender(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp deleted file mode 100644 index 942f0bb88..000000000 --- a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebTestProxy.h" - -#include "WebAccessibilityController.h" -#include "WebAccessibilityNotification.h" -#include "WebAccessibilityObject.h" -#include "WebElement.h" -#include "WebEventSender.h" -#include "WebNode.h" -#include "WebTestDelegate.h" -#include "WebTestInterfaces.h" -#include "platform/WebCString.h" - -using namespace WebKit; -using namespace std; - -namespace WebTestRunner { - -WebTestProxyBase::WebTestProxyBase() - : m_testInterfaces(0) - , m_delegate(0) -{ -} - -WebTestProxyBase::~WebTestProxyBase() -{ -} - -void WebTestProxyBase::setInterfaces(WebTestInterfaces* interfaces) -{ - m_testInterfaces = interfaces; -} - -void WebTestProxyBase::setDelegate(WebTestDelegate* delegate) -{ - m_delegate = delegate; -} - -void WebTestProxyBase::setPaintRect(const WebRect& rect) -{ - m_paintRect = rect; -} - -WebRect WebTestProxyBase::paintRect() const -{ - return m_paintRect; -} - -void WebTestProxyBase::didInvalidateRect(const WebRect& rect) -{ - // m_paintRect = m_paintRect U rect - if (rect.isEmpty()) - return; - if (m_paintRect.isEmpty()) { - m_paintRect = rect; - return; - } - int left = min(m_paintRect.x, rect.x); - int top = min(m_paintRect.y, rect.y); - int right = max(m_paintRect.x + m_paintRect.width, rect.x + rect.width); - int bottom = max(m_paintRect.y + m_paintRect.height, rect.y + rect.height); - m_paintRect = WebRect(left, top, right - left, bottom - top); -} - -void WebTestProxyBase::didScrollRect(int, int, const WebRect& clipRect) -{ - didInvalidateRect(clipRect); -} - -void WebTestProxyBase::scheduleComposite() -{ - m_paintRect = WebRect(0, 0, INT_MAX, INT_MAX); -} - -void WebTestProxyBase::scheduleAnimation() -{ - scheduleComposite(); -} - -void WebTestProxyBase::show(WebNavigationPolicy) -{ - scheduleComposite(); -} - -void WebTestProxyBase::setWindowRect(const WebRect& rect) -{ - scheduleComposite(); -} - -void WebTestProxyBase::didAutoResize(const WebSize&) -{ - scheduleComposite(); -} - -void WebTestProxyBase::postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification) -{ - if (notification == WebKit::WebAccessibilityNotificationFocusedUIElementChanged) - m_testInterfaces->accessibilityController()->setFocusedElement(obj); - - const char* notificationName; - switch (notification) { - case WebKit::WebAccessibilityNotificationActiveDescendantChanged: - notificationName = "ActiveDescendantChanged"; - break; - case WebKit::WebAccessibilityNotificationAutocorrectionOccured: - notificationName = "AutocorrectionOccured"; - break; - case WebKit::WebAccessibilityNotificationCheckedStateChanged: - notificationName = "CheckedStateChanged"; - break; - case WebKit::WebAccessibilityNotificationChildrenChanged: - notificationName = "ChildrenChanged"; - break; - case WebKit::WebAccessibilityNotificationFocusedUIElementChanged: - notificationName = "FocusedUIElementChanged"; - break; - case WebKit::WebAccessibilityNotificationLayoutComplete: - notificationName = "LayoutComplete"; - break; - case WebKit::WebAccessibilityNotificationLoadComplete: - notificationName = "LoadComplete"; - break; - case WebKit::WebAccessibilityNotificationSelectedChildrenChanged: - notificationName = "SelectedChildrenChanged"; - break; - case WebKit::WebAccessibilityNotificationSelectedTextChanged: - notificationName = "SelectedTextChanged"; - break; - case WebKit::WebAccessibilityNotificationValueChanged: - notificationName = "ValueChanged"; - break; - case WebKit::WebAccessibilityNotificationScrolledToAnchor: - notificationName = "ScrolledToAnchor"; - break; - case WebKit::WebAccessibilityNotificationLiveRegionChanged: - notificationName = "LiveRegionChanged"; - break; - case WebKit::WebAccessibilityNotificationMenuListItemSelected: - notificationName = "MenuListItemSelected"; - break; - case WebKit::WebAccessibilityNotificationMenuListValueChanged: - notificationName = "MenuListValueChanged"; - break; - case WebKit::WebAccessibilityNotificationRowCountChanged: - notificationName = "RowCountChanged"; - break; - case WebKit::WebAccessibilityNotificationRowCollapsed: - notificationName = "RowCollapsed"; - break; - case WebKit::WebAccessibilityNotificationRowExpanded: - notificationName = "RowExpanded"; - break; - case WebKit::WebAccessibilityNotificationInvalidStatusChanged: - notificationName = "InvalidStatusChanged"; - break; - case WebKit::WebAccessibilityNotificationTextChanged: - notificationName = "TextChanged"; - break; - case WebKit::WebAccessibilityNotificationAriaAttributeChanged: - notificationName = "AriaAttributeChanged"; - break; - default: - notificationName = "UnknownNotification"; - break; - } - - m_testInterfaces->accessibilityController()->notificationReceived(obj, notificationName); - - if (m_testInterfaces->accessibilityController()->shouldLogAccessibilityEvents()) { - std::string message("AccessibilityNotification - "); - message += notificationName; - - WebKit::WebNode node = obj.node(); - if (!node.isNull() && node.isElementNode()) { - WebKit::WebElement element = node.to<WebKit::WebElement>(); - if (element.hasAttribute("id")) { - message += " - id:"; - message += element.getAttribute("id").utf8().data(); - } - } - - m_delegate->printMessage(message + "\n"); - } -} - -void WebTestProxyBase::startDragging(WebFrame*, const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&) -{ - // When running a test, we need to fake a drag drop operation otherwise - // Windows waits for real mouse events to know when the drag is over. - m_testInterfaces->eventSender()->doDragDrop(data, mask); -} - -} diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp deleted file mode 100644 index 75fec130a..000000000 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ /dev/null @@ -1,818 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestShell.h" - -#include "DRTDevToolsAgent.h" -#include "DRTDevToolsClient.h" -#include "DRTTestRunner.h" -#include "MockWebPrerenderingSupport.h" -#include "WebCache.h" -#include "WebDataSource.h" -#include "WebDocument.h" -#include "WebElement.h" -#include "WebFrame.h" -#include "WebHistoryItem.h" -#include "WebIDBFactory.h" -#include "WebTestingSupport.h" -#include "WebPermissions.h" -#include "WebRuntimeFeatures.h" -#include "WebScriptController.h" -#include "WebSettings.h" -#include "WebTestProxy.h" -#include "WebView.h" -#include "WebViewHost.h" -#include "platform/WebArrayBufferView.h" -#include "skia/ext/platform_canvas.h" -#include "webkit/support/webkit_support.h" -#include "webkit/support/webkit_support_gfx.h" -#include <public/Platform.h> -#include <public/WebCompositorSupport.h> -#include <public/WebPoint.h> -#include <public/WebSize.h> -#include <public/WebString.h> -#include <public/WebThread.h> -#include <public/WebURLRequest.h> -#include <public/WebURLResponse.h> -#include <algorithm> -#include <cctype> -#include <vector> -#include <wtf/MD5.h> -#include <wtf/OwnArrayPtr.h> - - -using namespace WebKit; -using namespace WebTestRunner; -using namespace std; - -// Content area size for newly created windows. -static const int testWindowWidth = 800; -static const int testWindowHeight = 600; - -// The W3C SVG layout tests use a different size than the other layout tests. -static const int SVGTestWindowWidth = 480; -static const int SVGTestWindowHeight = 360; - -static const char layoutTestsPattern[] = "/LayoutTests/"; -static const string::size_type layoutTestsPatternSize = sizeof(layoutTestsPattern) - 1; -static const char fileUrlPattern[] = "file:/"; -static const char fileTestPrefix[] = "(file test):"; -static const char dataUrlPattern[] = "data:"; -static const string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1; - -// FIXME: Move this to a common place so that it can be shared with -// WebCore::TransparencyWin::makeLayerOpaque(). -static void makeCanvasOpaque(SkCanvas* canvas) -{ - const SkBitmap& bitmap = canvas->getTopDevice()->accessBitmap(true); - ASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); - - SkAutoLockPixels lock(bitmap); - for (int y = 0; y < bitmap.height(); y++) { - uint32_t* row = bitmap.getAddr32(0, y); - for (int x = 0; x < bitmap.width(); x++) - row[x] |= 0xFF000000; // Set alpha bits to 1. - } -} - -TestShell::TestShell() - : m_testIsPending(false) - , m_testIsPreparing(false) - , m_focusedWidget(0) - , m_devTools(0) - , m_dumpPixelsForCurrentTest(false) - , m_allowExternalPages(false) - , m_acceleratedCompositingForVideoEnabled(false) - , m_acceleratedCompositingForFixedPositionEnabled(false) - , m_softwareCompositingEnabled(false) - , m_threadedCompositingEnabled(false) - , m_forceCompositingMode(false) - , m_accelerated2dCanvasEnabled(false) - , m_deferred2dCanvasEnabled(false) - , m_acceleratedPaintingEnabled(false) - , m_perTilePaintingEnabled(false) - , m_acceleratedAnimationEnabled(false) - , m_deferredImageDecodingEnabled(false) - , m_stressOpt(false) - , m_stressDeopt(false) - , m_dumpWhenFinished(true) - , m_isDisplayingModalDialog(false) -{ - WebRuntimeFeatures::enableDataTransferItems(true); - WebRuntimeFeatures::enableDeviceMotion(false); - WebRuntimeFeatures::enableGeolocation(true); - WebRuntimeFeatures::enableIndexedDatabase(true); - WebRuntimeFeatures::enableInputTypeDateTime(true); - WebRuntimeFeatures::enableInputTypeDateTimeLocal(true); - WebRuntimeFeatures::enableInputTypeMonth(true); - WebRuntimeFeatures::enableInputTypeTime(true); - WebRuntimeFeatures::enableInputTypeWeek(true); - WebRuntimeFeatures::enableFileSystem(true); - WebRuntimeFeatures::enableJavaScriptI18NAPI(true); - WebRuntimeFeatures::enableMediaSource(true); - WebRuntimeFeatures::enableEncryptedMedia(true); - WebRuntimeFeatures::enableMediaStream(true); - WebRuntimeFeatures::enablePeerConnection(true); - WebRuntimeFeatures::enableWebAudio(true); - WebRuntimeFeatures::enableVideoTrack(true); - WebRuntimeFeatures::enableGamepad(true); - WebRuntimeFeatures::enableShadowDOM(true); - WebRuntimeFeatures::enableStyleScoped(true); - WebRuntimeFeatures::enableScriptedSpeech(true); - WebRuntimeFeatures::enableRequestAutocomplete(true); - - // 30 second is the same as the value in Mac DRT. - // If we use a value smaller than the timeout value of - // (new-)run-webkit-tests, (new-)run-webkit-tests misunderstands that a - // timed-out DRT process was crashed. - m_timeout = 30 * 1000; -} - -void TestShell::initialize() -{ - m_webPermissions = adoptPtr(new WebPermissions(this)); - m_testInterfaces = adoptPtr(new WebTestInterfaces()); - m_testRunner = adoptPtr(new DRTTestRunner(this)); -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); -#endif -#if ENABLE(LINK_PRERENDER) - m_prerenderingSupport = adoptPtr(new MockWebPrerenderingSupport()); -#endif - - WTF::initializeThreading(); - - if (m_threadedCompositingEnabled) - m_webCompositorThread = adoptPtr(WebKit::Platform::current()->createThread("Compositor")); - WebKit::Platform::current()->compositorSupport()->initialize(m_webCompositorThread.get()); - - createMainWindow(); -} - -void TestShell::createMainWindow() -{ - m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent); - m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get())); - m_webView = m_webViewHost->webView(); - m_testInterfaces->setDelegate(m_webViewHost.get()); - m_testInterfaces->setWebView(m_webView); - m_testRunner->setDelegate(m_webViewHost.get()); - m_testRunner->setWebView(m_webView); - m_drtDevToolsAgent->setWebView(m_webView); -} - -TestShell::~TestShell() -{ - m_testInterfaces->setDelegate(0); - m_testInterfaces->setWebView(0); - m_testRunner->setDelegate(0); - m_testRunner->setWebView(0); - m_drtDevToolsAgent->setWebView(0); -} - -void TestShell::createDRTDevToolsClient(DRTDevToolsAgent* agent) -{ - m_drtDevToolsClient = adoptPtr(new DRTDevToolsClient(agent, m_devTools->webView())); -} - -void TestShell::showDevTools() -{ - if (!m_devTools) { - WebURL url = webkit_support::GetDevToolsPathAsURL(); - if (!url.isValid()) { - ASSERT(false); - return; - } - m_devTools = createNewWindow(url); - m_devTools->webView()->settings()->setMemoryInfoEnabled(true); - m_devTools->setLogConsoleOutput(false); - ASSERT(m_devTools); - createDRTDevToolsClient(m_drtDevToolsAgent.get()); - } - m_devTools->show(WebKit::WebNavigationPolicyNewWindow); -} - -void TestShell::closeDevTools() -{ - if (m_devTools) { - m_devTools->webView()->settings()->setMemoryInfoEnabled(false); - m_drtDevToolsAgent->reset(); - m_drtDevToolsClient.clear(); - closeWindow(m_devTools); - m_devTools = 0; - } -} - -void TestShell::resetWebSettings(WebView& webView) -{ - m_prefs.reset(); - m_prefs.acceleratedCompositingEnabled = true; - m_prefs.acceleratedCompositingForVideoEnabled = m_acceleratedCompositingForVideoEnabled; - m_prefs.acceleratedCompositingForFixedPositionEnabled = m_acceleratedCompositingForFixedPositionEnabled; - m_prefs.forceCompositingMode = m_forceCompositingMode; - m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled; - m_prefs.deferred2dCanvasEnabled = m_deferred2dCanvasEnabled; - m_prefs.acceleratedPaintingEnabled = m_acceleratedPaintingEnabled; - m_prefs.perTilePaintingEnabled = m_perTilePaintingEnabled; - m_prefs.acceleratedAnimationEnabled = m_acceleratedAnimationEnabled; - m_prefs.deferredImageDecodingEnabled = m_deferredImageDecodingEnabled; - m_prefs.applyTo(&webView); -} - -void TestShell::runFileTest(const TestParams& params, bool shouldDumpPixels) -{ - ASSERT(params.testUrl.isValid()); - m_dumpPixelsForCurrentTest = shouldDumpPixels; - m_testIsPreparing = true; - m_params = params; - string testUrl = m_params.testUrl.spec(); - - m_testRunner->setShouldGeneratePixelResults(shouldDumpPixels); - - if (testUrl.find("loading/") != string::npos - || testUrl.find("loading\\") != string::npos) - m_testRunner->setShouldDumpFrameLoadCallbacks(true); - - if (testUrl.find("compositing/") != string::npos || testUrl.find("compositing\\") != string::npos) { - if (!m_softwareCompositingEnabled) - m_prefs.accelerated2dCanvasEnabled = true; - m_prefs.acceleratedCompositingForVideoEnabled = true; - m_prefs.deferred2dCanvasEnabled = true; - m_prefs.mockScrollbarsEnabled = true; - m_prefs.applyTo(m_webView); - } - - if (testUrl.find("/dumpAsText/") != string::npos - || testUrl.find("\\dumpAsText\\") != string::npos) { - m_testRunner->setShouldDumpAsText(true); - m_testRunner->setShouldGeneratePixelResults(false); - } - - if (testUrl.find("/inspector/") != string::npos - || testUrl.find("\\inspector\\") != string::npos) - showDevTools(); - - if (m_params.debugLayerTree) - m_testRunner->setShowDebugLayerTree(true); - - if (m_dumpWhenFinished) - m_printer.handleTestHeader(testUrl.c_str()); - loadURL(m_params.testUrl); - - m_testIsPreparing = false; - waitTestFinished(); -} - -static inline bool isSVGTestURL(const WebURL& url) -{ - return url.isValid() && string(url.spec()).find("W3C-SVG-1.1") != string::npos; -} - -void TestShell::resizeWindowForTest(WebViewHost* window, const WebURL& url) -{ - int width, height; - if (isSVGTestURL(url)) { - width = SVGTestWindowWidth; - height = SVGTestWindowHeight; - } else { - width = testWindowWidth; - height = testWindowHeight; - } - window->setWindowRect(WebRect(0, 0, width + virtualWindowBorder * 2, height + virtualWindowBorder * 2)); -} - -void TestShell::resetTestController() -{ - resetWebSettings(*webView()); - m_webPermissions->reset(); - m_testInterfaces->resetAll(); - m_testRunner->reset(); - m_webViewHost->reset(); -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - m_notificationPresenter->reset(); -#endif -#if OS(ANDROID) - webkit_support::ReleaseMediaResources(); -#endif - m_drtDevToolsAgent->reset(); - if (m_drtDevToolsClient) - m_drtDevToolsClient->reset(); - webView()->setPageScaleFactor(1, WebPoint(0, 0)); - webView()->enableFixedLayoutMode(false); - webView()->setFixedLayoutSize(WebSize(0, 0)); - webView()->mainFrame()->clearOpener(); - WebTestingSupport::resetInternalsObject(webView()->mainFrame()); - WebCache::clear(); -} - -void TestShell::loadURL(const WebURL& url) -{ - m_webViewHost->loadURLForFrame(url, WebString()); -} - -void TestShell::reload() -{ - m_webViewHost->navigationController()->reload(); -} - -void TestShell::goToOffset(int offset) -{ - m_webViewHost->navigationController()->goToOffset(offset); -} - -int TestShell::navigationEntryCount() const -{ - return m_webViewHost->navigationController()->entryCount(); -} - -void TestShell::callJSGC() -{ - m_webView->mainFrame()->collectGarbage(); -} - -void TestShell::setFocus(WebWidget* widget, bool enable) -{ - // Simulate the effects of InteractiveSetFocus(), which includes calling - // both setFocus() and setIsActive(). - if (enable) { - if (m_focusedWidget != widget) { - if (m_focusedWidget) - m_focusedWidget->setFocus(false); - webView()->setIsActive(enable); - widget->setFocus(enable); - m_focusedWidget = widget; - } - } else { - if (m_focusedWidget == widget) { - widget->setFocus(enable); - webView()->setIsActive(enable); - m_focusedWidget = 0; - } - } -} - -void TestShell::testFinished() -{ - if (!m_testIsPending) - return; - m_testIsPending = false; - if (m_dumpWhenFinished) - dump(); - webkit_support::QuitMessageLoop(); -} - -void TestShell::testTimedOut() -{ - m_printer.handleTimedOut(); - testFinished(); -} - -static string dumpDocumentText(WebFrame* frame) -{ - // We use the document element's text instead of the body text here because - // not all documents have a body, such as XML documents. - WebElement documentElement = frame->document().documentElement(); - if (documentElement.isNull()) - return string(); - return documentElement.innerText().utf8(); -} - -static string dumpFramesAsText(WebFrame* frame, bool recursive) -{ - string result; - - // Add header for all but the main frame. Skip empty frames. - if (frame->parent() && !frame->document().documentElement().isNull()) { - result.append("\n--------\nFrame: '"); - result.append(frame->uniqueName().utf8().data()); - result.append("'\n--------\n"); - } - - result.append(dumpDocumentText(frame)); - result.append("\n"); - - if (recursive) { - for (WebFrame* child = frame->firstChild(); child; child = child->nextSibling()) - result.append(dumpFramesAsText(child, recursive)); - } - - return result; -} - -static string dumpFramesAsPrintedText(WebFrame* frame, bool recursive) -{ - string result; - - // Cannot do printed format for anything other than HTML - if (!frame->document().isHTMLDocument()) - return string(); - - // Add header for all but the main frame. Skip empty frames. - if (frame->parent() && !frame->document().documentElement().isNull()) { - result.append("\n--------\nFrame: '"); - result.append(frame->uniqueName().utf8().data()); - result.append("'\n--------\n"); - } - - result.append(frame->renderTreeAsText(WebFrame::RenderAsTextPrinting).utf8()); - result.append("\n"); - - if (recursive) { - for (WebFrame* child = frame->firstChild(); child; child = child->nextSibling()) - result.append(dumpFramesAsPrintedText(child, recursive)); - } - - return result; -} - -static void dumpFrameScrollPosition(WebFrame* frame, bool recursive) -{ - WebSize offset = frame->scrollOffset(); - if (offset.width > 0 || offset.height > 0) { - if (frame->parent()) - printf("frame '%s' ", frame->uniqueName().utf8().data()); - printf("scrolled to %d,%d\n", offset.width, offset.height); - } - - if (!recursive) - return; - for (WebFrame* child = frame->firstChild(); child; child = child->nextSibling()) - dumpFrameScrollPosition(child, recursive); -} - -struct ToLower { - char16 operator()(char16 c) { return tolower(c); } -}; - -// FIXME: Eliminate std::transform(), std::vector, and std::sort(). - -// Returns True if item1 < item2. -static bool HistoryItemCompareLess(const WebHistoryItem& item1, const WebHistoryItem& item2) -{ - string16 target1 = item1.target(); - string16 target2 = item2.target(); - std::transform(target1.begin(), target1.end(), target1.begin(), ToLower()); - std::transform(target2.begin(), target2.end(), target2.begin(), ToLower()); - return target1 < target2; -} - -static string normalizeLayoutTestURLInternal(const string& url) -{ - string result = url; - size_t pos; - if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) { - // adjust file URLs to match upstream results. - result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix); - } else if (!url.find(dataUrlPattern)) { - // URL-escape data URLs to match results upstream. - string path = url.substr(dataUrlPatternSize); - result.replace(dataUrlPatternSize, url.length(), path); - } - return result; -} - -static string dumpHistoryItem(const WebHistoryItem& item, int indent, bool isCurrent) -{ - string result; - - if (isCurrent) { - result.append("curr->"); - result.append(indent - 6, ' '); // 6 == "curr->".length() - } else - result.append(indent, ' '); - - string url = normalizeLayoutTestURLInternal(item.urlString().utf8()); - result.append(url); - if (!item.target().isEmpty()) { - result.append(" (in frame \""); - result.append(item.target().utf8()); - result.append("\")"); - } - if (item.isTargetItem()) - result.append(" **nav target**"); - result.append("\n"); - - const WebVector<WebHistoryItem>& children = item.children(); - if (!children.isEmpty()) { - // Must sort to eliminate arbitrary result ordering which defeats - // reproducible testing. - // FIXME: WebVector should probably just be a std::vector!! - std::vector<WebHistoryItem> sortedChildren; - for (size_t i = 0; i < children.size(); ++i) - sortedChildren.push_back(children[i]); - std::sort(sortedChildren.begin(), sortedChildren.end(), HistoryItemCompareLess); - for (size_t i = 0; i < sortedChildren.size(); ++i) - result += dumpHistoryItem(sortedChildren[i], indent + 4, false); - } - - return result; -} - -static void dumpBackForwardList(const TestNavigationController& navigationController, string& result) -{ - result.append("\n============== Back Forward List ==============\n"); - for (int index = 0; index < navigationController.entryCount(); ++index) { - int currentIndex = navigationController.lastCommittedEntryIndex(); - WebHistoryItem historyItem = navigationController.entryAtIndex(index)->contentState(); - if (historyItem.isNull()) { - historyItem.initialize(); - historyItem.setURLString(navigationController.entryAtIndex(index)->URL().spec().utf16()); - } - result.append(dumpHistoryItem(historyItem, 8, index == currentIndex)); - } - result.append("===============================================\n"); -} - -string TestShell::dumpAllBackForwardLists() -{ - string result; - for (unsigned i = 0; i < m_windowList.size(); ++i) - dumpBackForwardList(*m_windowList[i]->navigationController(), result); - return result; -} - -void TestShell::dump() -{ - WebScriptController::flushConsoleMessages(); - - // Dump the requested representation. - WebFrame* frame = m_webView->mainFrame(); - if (!frame) - return; - bool shouldDumpAsText = m_testRunner->shouldDumpAsText(); - bool shouldDumpAsAudio = m_testRunner->shouldDumpAsAudio(); - bool shouldGeneratePixelResults = m_testRunner->shouldGeneratePixelResults(); - bool shouldDumpAsPrinted = m_testRunner->isPrinting(); - bool dumpedAnything = false; - - if (shouldDumpAsAudio) { - const WebKit::WebArrayBufferView& webArrayBufferView = m_testRunner->audioData(); - m_printer.handleAudio(webArrayBufferView.baseAddress(), webArrayBufferView.byteLength()); - m_printer.handleAudioFooter(); - m_printer.handleTestFooter(true); - - fflush(stdout); - fflush(stderr); - return; - } - - if (m_params.dumpTree) { - dumpedAnything = true; - m_printer.handleTextHeader(); - // Text output: the test page can request different types of output - // which we handle here. - if (!shouldDumpAsText) { - // Plain text pages should be dumped as text - string mimeType = frame->dataSource()->response().mimeType().utf8(); - if (mimeType == "text/plain") { - shouldDumpAsText = true; - shouldGeneratePixelResults = false; - } - } - if (shouldDumpAsText) { - bool recursive = m_testRunner->shouldDumpChildFramesAsText(); - string dataUtf8 = shouldDumpAsPrinted ? dumpFramesAsPrintedText(frame, recursive) : dumpFramesAsText(frame, recursive); - if (fwrite(dataUtf8.c_str(), 1, dataUtf8.size(), stdout) != dataUtf8.size()) - FATAL("Short write to stdout, disk full?\n"); - } else { - WebFrame::RenderAsTextControls renderTextBehavior = WebFrame::RenderAsTextNormal; - if (shouldDumpAsPrinted) - renderTextBehavior |= WebFrame::RenderAsTextPrinting; - if (m_params.debugRenderTree) - renderTextBehavior |= WebFrame::RenderAsTextDebug; - printf("%s", frame->renderTreeAsText(renderTextBehavior).utf8().data()); - bool recursive = m_testRunner->shouldDumpChildFrameScrollPositions(); - dumpFrameScrollPosition(frame, recursive); - } - if (m_testRunner->shouldDumpBackForwardList()) - printf("%s", dumpAllBackForwardLists().c_str()); - } - if (dumpedAnything && m_params.printSeparators) - m_printer.handleTextFooter(); - - if (m_dumpPixelsForCurrentTest && shouldGeneratePixelResults) { - // Image output: we write the image data to the file given on the - // command line (for the dump pixels argument), and the MD5 sum to - // stdout. - dumpedAnything = true; - m_webView->layout(); - if (m_testRunner->testRepaint()) { - WebSize viewSize = m_webView->size(); - int width = viewSize.width; - int height = viewSize.height; - if (m_testRunner->sweepHorizontally()) { - for (WebRect column(0, 0, 1, height); column.x < width; column.x++) - m_webViewHost->paintRect(column); - } else { - for (WebRect line(0, 0, width, 1); line.y < height; line.y++) - m_webViewHost->paintRect(line); - } - } else if (m_testRunner->isPrinting()) - m_webViewHost->paintPagesWithBoundaries(); - else - m_webViewHost->paintInvalidatedRegion(); - - // See if we need to draw the selection bounds rect. Selection bounds - // rect is the rect enclosing the (possibly transformed) selection. - // The rect should be drawn after everything is laid out and painted. - if (m_testRunner->shouldDumpSelectionRect()) { - // If there is a selection rect - draw a red 1px border enclosing rect - WebRect wr = frame->selectionBoundsRect(); - if (!wr.isEmpty()) { - // Render a red rectangle bounding selection rect - SkPaint paint; - paint.setColor(0xFFFF0000); // Fully opaque red - paint.setStyle(SkPaint::kStroke_Style); - paint.setFlags(SkPaint::kAntiAlias_Flag); - paint.setStrokeWidth(1.0f); - SkIRect rect; // Bounding rect - rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height); - m_webViewHost->canvas()->drawIRect(rect, paint); - } - } - - dumpImage(m_webViewHost->canvas()); - } - m_printer.handleTestFooter(dumpedAnything); - fflush(stdout); - fflush(stderr); -} - -void TestShell::dumpImage(SkCanvas* canvas) const -{ - // Fix the alpha. The expected PNGs on Mac have an alpha channel, so we want - // to keep it. On Windows, the alpha channel is wrong since text/form control - // drawing may have erased it in a few places. So on Windows we force it to - // opaque and also don't write the alpha channel for the reference. Linux - // doesn't have the wrong alpha like Windows, but we match Windows. -#if OS(MAC_OS_X) - bool discardTransparency = false; -#else - bool discardTransparency = true; - makeCanvasOpaque(canvas); -#endif - - const SkBitmap& sourceBitmap = canvas->getTopDevice()->accessBitmap(false); - SkAutoLockPixels sourceBitmapLock(sourceBitmap); - - // Compute MD5 sum. - MD5 digester; - Vector<uint8_t, 16> digestValue; -#if OS(ANDROID) - // On Android, pixel layout is RGBA (see third_party/skia/include/core/SkColorPriv.h); - // however, other Chrome platforms use BGRA (see skia/config/SkUserConfig.h). - // To match the checksum of other Chrome platforms, we need to reorder the layout of pixels. - // NOTE: The following code assumes we use SkBitmap::kARGB_8888_Config, - // which has been checked in device.makeOpaque() (see above). - const uint8_t* rawPixels = reinterpret_cast<const uint8_t*>(sourceBitmap.getPixels()); - size_t bitmapSize = sourceBitmap.getSize(); - OwnArrayPtr<uint8_t> reorderedPixels = adoptArrayPtr(new uint8_t[bitmapSize]); - for (size_t i = 0; i < bitmapSize; i += 4) { - reorderedPixels[i] = rawPixels[i + 2]; // R - reorderedPixels[i + 1] = rawPixels[i + 1]; // G - reorderedPixels[i + 2] = rawPixels[i]; // B - reorderedPixels[i + 3] = rawPixels[i + 3]; // A - } - digester.addBytes(reorderedPixels.get(), bitmapSize); - reorderedPixels.clear(); -#else - digester.addBytes(reinterpret_cast<const uint8_t*>(sourceBitmap.getPixels()), sourceBitmap.getSize()); -#endif - digester.checksum(digestValue); - string md5hash; - md5hash.reserve(16 * 2); - for (unsigned i = 0; i < 16; ++i) { - char hex[3]; - // Use "x", not "X". The string must be lowercased. - sprintf(hex, "%02x", digestValue[i]); - md5hash.append(hex); - } - - // Only encode and dump the png if the hashes don't match. Encoding the - // image is really expensive. - if (md5hash.compare(m_params.pixelHash)) { - std::vector<unsigned char> png; -#if OS(ANDROID) - webkit_support::EncodeRGBAPNGWithChecksum(reinterpret_cast<const unsigned char*>(sourceBitmap.getPixels()), sourceBitmap.width(), - sourceBitmap.height(), static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, md5hash, &png); -#else - webkit_support::EncodeBGRAPNGWithChecksum(reinterpret_cast<const unsigned char*>(sourceBitmap.getPixels()), sourceBitmap.width(), - sourceBitmap.height(), static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, md5hash, &png); -#endif - - m_printer.handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size()); - } else - m_printer.handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), 0, 0); -} - -void TestShell::bindJSObjectsToWindow(WebFrame* frame) -{ - WebTestingSupport::injectInternalsObject(frame); - m_testInterfaces->bindTo(frame); - m_testRunner->bindToJavascript(frame, WebString::fromUTF8("testRunner")); - m_testRunner->bindToJavascript(frame, WebString::fromUTF8("layoutTestController")); -} - -WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url) -{ - return createNewWindow(url, 0); -} - -WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent) -{ - WebTestRunner::WebTestProxy<WebViewHost, TestShell*>* host = new WebTestRunner::WebTestProxy<WebViewHost, TestShell*>(this); - host->setInterfaces(m_testInterfaces.get()); - if (m_webViewHost) - host->setDelegate(m_webViewHost.get()); - else - host->setDelegate(host); - host->setProxy(host); - WebView* view = WebView::create(host); - view->setPermissionClient(webPermissions()); - view->setDevToolsAgentClient(devToolsAgent); - host->setWebWidget(view); - m_prefs.applyTo(view); - view->initializeMainFrame(host); - m_windowList.append(host); - host->loadURLForFrame(url, WebString()); - return host; -} - -void TestShell::closeWindow(WebViewHost* window) -{ - size_t i = m_windowList.find(window); - if (i == notFound) { - ASSERT_NOT_REACHED(); - return; - } - m_windowList.remove(i); - WebWidget* focusedWidget = m_focusedWidget; - if (window->webWidget() == m_focusedWidget) - focusedWidget = 0; - - delete window; - // We set the focused widget after deleting the web view host because it - // can change the focus. - m_focusedWidget = focusedWidget; - if (m_focusedWidget) { - webView()->setIsActive(true); - m_focusedWidget->setFocus(true); - } -} - -void TestShell::closeRemainingWindows() -{ - // Just close devTools window manually because we have custom deinitialization code for it. - closeDevTools(); - - // Iterate through the window list and close everything except the main - // window. We don't want to delete elements as we're iterating, so we copy - // to a temp vector first. - Vector<WebViewHost*> windowsToDelete; - for (unsigned i = 0; i < m_windowList.size(); ++i) { - if (m_windowList[i] != webViewHost()) - windowsToDelete.append(m_windowList[i]); - } - ASSERT(windowsToDelete.size() + 1 == m_windowList.size()); - for (unsigned i = 0; i < windowsToDelete.size(); ++i) - closeWindow(windowsToDelete[i]); - ASSERT(m_windowList.size() == 1); -} - -int TestShell::windowCount() -{ - return m_windowList.size(); -} - -string TestShell::normalizeLayoutTestURL(const string& url) -{ - return normalizeLayoutTestURLInternal(url); -} diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h deleted file mode 100644 index 306f35cd1..000000000 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestShell_h -#define TestShell_h - -#include "DRTTestRunner.h" -#include "NotificationPresenter.h" -#include "TestEventPrinter.h" -#include "WebPreferences.h" -#include "WebTestInterfaces.h" -#include "WebViewHost.h" -#include <string> -#include <wtf/OwnPtr.h> -#include <wtf/Vector.h> - -// TestShell is a container of global variables and has bridge functions between -// various objects. Only one instance is created in one DRT process. - -namespace WebKit { -class WebDevToolsAgentClient; -class WebFrame; -class WebNotificationPresenter; -class WebThread; -class WebView; -class WebURL; -} - -class DRTDevToolsAgent; -class DRTDevToolsCallArgs; -class DRTDevToolsClient; -class MockWebPrerenderingSupport; -class WebPermissions; - -struct TestParams { - bool dumpTree; - bool debugRenderTree; - bool debugLayerTree; - bool printSeparators; - WebKit::WebURL testUrl; - std::string pixelHash; - - TestParams() - : dumpTree(true) - , debugRenderTree(false) - , debugLayerTree(false) - , printSeparators(false) { } -}; - -class TestShell { -public: - TestShell(); - ~TestShell(); - - void initialize(); - - // The main WebView. - WebKit::WebView* webView() const { return m_webView; } - // Returns the host for the main WebView. - WebViewHost* webViewHost() const { return m_webViewHost.get(); } - DRTTestRunner* testRunner() const { return m_testRunner.get(); } - WebTestRunner::WebEventSender* eventSender() const { return m_testInterfaces->eventSender(); } - WebTestRunner::WebAccessibilityController* accessibilityController() const { return m_testInterfaces->accessibilityController(); } -#if ENABLE(NOTIFICATIONS) - NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); } -#endif - const TestEventPrinter* printer() const { return &m_printer; } - - WebPreferences* preferences() { return &m_prefs; } - void applyPreferences() { m_prefs.applyTo(m_webView); } - - WebPermissions* webPermissions() { return m_webPermissions.get(); } - - void bindJSObjectsToWindow(WebKit::WebFrame*); - void runFileTest(const TestParams&, bool shouldDumpPixelTests); - void callJSGC(); - void resetTestController(); - void waitTestFinished(); - - // Operations to the main window. - void loadURL(const WebKit::WebURL&); - void reload(); - void goToOffset(int offset); - int navigationEntryCount() const; - - void setFocus(WebKit::WebWidget*, bool enable); - bool shouldDumpFrameLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpFrameLoadCallbacks(); } - bool shouldDumpResourceRequestCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceRequestCallbacks(); } - bool shouldDumpUserGestureInFrameLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpUserGestureInFrameLoadCallbacks(); } - bool shouldDumpResourceLoadCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceLoadCallbacks(); } - bool shouldDumpResourceResponseMIMETypes() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceResponseMIMETypes(); } - void setIsLoading(bool flag) { m_isLoading = flag; } - - // Called by the DRTTestRunner to signal test completion. - void testFinished(); - // Called by DRTTestRunner when a test hits the timeout, but does not - // cause a hang. We can avoid killing TestShell in this case and still dump - // the test results. - void testTimedOut(); - - bool allowExternalPages() const { return m_allowExternalPages; } - void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; } - - void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; } - void setAcceleratedCompositingForFixedPositionEnabled(bool enabled) { m_acceleratedCompositingForFixedPositionEnabled = enabled; } - bool softwareCompositingEnabled() { return m_softwareCompositingEnabled; } - void setSoftwareCompositingEnabled(bool enabled) { m_softwareCompositingEnabled = enabled; } - void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; } - void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; } - void setAccelerated2dCanvasEnabled(bool enabled) { m_accelerated2dCanvasEnabled = enabled; } - void setDeferred2dCanvasEnabled(bool enabled) { m_deferred2dCanvasEnabled = enabled; } - void setAcceleratedPaintingEnabled(bool enabled) { m_acceleratedPaintingEnabled = enabled; } - void setPerTilePaintingEnabled(bool enabled) { m_perTilePaintingEnabled = enabled; } - void setAcceleratedAnimationEnabled(bool enabled) { m_acceleratedAnimationEnabled = enabled; } - void setDeferredImageDecodingEnabled(bool enabled) { m_deferredImageDecodingEnabled = enabled; } -#if defined(OS_WIN) - // Access to the finished event. Used by the static WatchDog thread. - HANDLE finishedEvent() { return m_finishedEvent; } -#endif - - // Get the timeout for running a test in milliseconds. - int layoutTestTimeout() { return m_timeout; } - int layoutTestTimeoutForWatchDog() { return layoutTestTimeout() + 1000; } - void setLayoutTestTimeout(int timeout) { m_timeout = timeout; } - - // V8 JavaScript stress test options. - int stressOpt() { return m_stressOpt; } - void setStressOpt(bool stressOpt) { m_stressOpt = stressOpt; } - int stressDeopt() { return m_stressDeopt; } - void setStressDeopt(int stressDeopt) { m_stressDeopt = stressDeopt; } - - // The JavaScript flags specified as a strings. - std::string javaScriptFlags() { return m_javaScriptFlags; } - void setJavaScriptFlags(std::string javaScriptFlags) { m_javaScriptFlags = javaScriptFlags; } - - // Set whether to dump when the loaded page has finished processing. This is used with multiple load - // 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; } - - // Set whether the binary data output should be encoded in base64 text. - void setEncodeBinary(bool encodeBinary) { m_printer.setEncodeBinary(encodeBinary); } - - WebViewHost* createNewWindow(const WebKit::WebURL&); - void closeWindow(WebViewHost*); - void closeRemainingWindows(); - int windowCount(); - static void resizeWindowForTest(WebViewHost*, const WebKit::WebURL&); - - void showDevTools(); - void closeDevTools(); - - DRTDevToolsAgent* drtDevToolsAgent() { return m_drtDevToolsAgent.get(); } - DRTDevToolsClient* drtDevToolsClient() { return m_drtDevToolsClient.get(); } - WebViewHost* devToolsWebView() { return m_devTools; } - - static const int virtualWindowBorder = 3; - - typedef Vector<WebViewHost*> WindowList; - WindowList windowList() const { return m_windowList; } - - // Returns a string representation of an URL's spec that does not depend on - // the location of the layout test in the file system. - std::string normalizeLayoutTestURL(const std::string&); - -private: - WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*); - void createMainWindow(); - void createDRTDevToolsClient(DRTDevToolsAgent*); - - void resetWebSettings(WebKit::WebView&); - void dump(); - std::string dumpAllBackForwardLists(); - void dumpImage(SkCanvas*) const; - - bool m_testIsPending; - bool m_testIsPreparing; - bool m_isLoading; - WebKit::WebView* m_webView; - WebKit::WebWidget* m_focusedWidget; - WebViewHost* m_devTools; - - // Be careful of the destruction order of the following objects. - TestEventPrinter m_printer; - OwnPtr<WebPermissions> m_webPermissions; - OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent; - OwnPtr<DRTDevToolsClient> m_drtDevToolsClient; - OwnPtr<WebTestRunner::WebTestInterfaces> m_testInterfaces; - OwnPtr<DRTTestRunner> m_testRunner; -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - OwnPtr<NotificationPresenter> m_notificationPresenter; -#endif - // It's important that this thread is destroyed after the WebViewHost. - OwnPtr<WebKit::WebThread> m_webCompositorThread; - OwnPtr<WebViewHost> m_webViewHost; -#if ENABLE(LINK_PRERENDER) - OwnPtr<MockWebPrerenderingSupport> m_prerenderingSupport; -#endif - - TestParams m_params; - bool m_dumpPixelsForCurrentTest; - int m_timeout; // timeout value in millisecond - bool m_allowExternalPages; - bool m_acceleratedCompositingForVideoEnabled; - bool m_acceleratedCompositingForFixedPositionEnabled; - bool m_softwareCompositingEnabled; - bool m_threadedCompositingEnabled; - bool m_forceCompositingMode; - bool m_accelerated2dCanvasEnabled; - bool m_deferred2dCanvasEnabled; - bool m_acceleratedPaintingEnabled; - bool m_perTilePaintingEnabled; - bool m_acceleratedAnimationEnabled; - bool m_deferredImageDecodingEnabled; - WebPreferences m_prefs; - bool m_stressOpt; - bool m_stressDeopt; - std::string m_javaScriptFlags; - bool m_dumpWhenFinished; - bool m_isDisplayingModalDialog; - - - // List of all windows in this process. - // The main window should be put into windowList[0]. - WindowList m_windowList; - -#if defined(OS_WIN) - // Used by the watchdog to know when it's finished. - HANDLE m_finishedEvent; -#endif -}; - -void platformInit(int*, char***); -void openStartupDialog(); -bool checkLayoutTestSystemDependencies(); - -#endif // TestShell_h diff --git a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp deleted file mode 100644 index 1a327bb85..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestShell.h" - -#include "linux/WebFontRendering.h" -#include "third_party/skia/include/ports/SkTypeface_android.h" - -namespace { - -// Must be same as DEVICE_DRT_DIR in Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. -#define DEVICE_DRT_DIR "/data/local/tmp/drt/" - -const char fontMainConfigFile[] = DEVICE_DRT_DIR "android_main_fonts.xml"; -const char fontFallbackConfigFile[] = DEVICE_DRT_DIR "android_fallback_fonts.xml"; -const char fontsDir[] = DEVICE_DRT_DIR "fonts/"; - -} // namespace - -void platformInit(int* argc, char*** argv) -{ - // Initialize skia with customized font config files. - SkUseTestFontConfigFile(fontMainConfigFile, fontFallbackConfigFile, fontsDir); - - // Disable auto hint and use normal hinting in layout test mode to produce the same font metrics as chromium-linux. - WebKit::WebFontRendering::setAutoHint(false); - WebKit::WebFontRendering::setHinting(SkPaint::kNormal_Hinting); -} diff --git a/Tools/DumpRenderTree/chromium/TestShellMac.mm b/Tools/DumpRenderTree/chromium/TestShellMac.mm deleted file mode 100644 index d79a8c835..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellMac.mm +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "TestShell.h" -#include "WebThemeEngineDRTMac.h" -#include "webkit/support/webkit_support.h" -#import <AppKit/AppKit.h> - -static WebThemeEngineDRTMac themeEngine; - -// A class to be the target/selector of the "watchdog" thread that ensures -// pages timeout if they take too long and tells the test harness via stdout. -@interface WatchDogTarget : NSObject { -@private - NSTimeInterval _timeout; -} -// |timeout| is in seconds -- (id)initWithTimeout:(NSTimeInterval)timeout; -// serves as the "run" method of a NSThread. -- (void)run:(id)sender; -@end - -@implementation WatchDogTarget - -- (id)initWithTimeout:(NSTimeInterval)timeout -{ - if ((self = [super init])) - _timeout = timeout; - return self; -} - -- (void)run:(id)ignore -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - // check for debugger, just bail if so. We don't want the timeouts hitting - // when we're trying to track down an issue. - if (webkit_support::BeingDebugged()) - return; - - NSThread* currentThread = [NSThread currentThread]; - - // Wait to be cancelled. If we are that means the test finished. If it hasn't, - // then we need to tell the layout script we timed out and start again. - NSDate* limitDate = [NSDate dateWithTimeIntervalSinceNow:_timeout]; - while ([(NSDate*)[NSDate date] compare:limitDate] == NSOrderedAscending && - ![currentThread isCancelled]) { - // sleep for a small increment then check again - NSDate* incrementDate = [NSDate dateWithTimeIntervalSinceNow:1.0]; - [NSThread sleepUntilDate:incrementDate]; - } - if (![currentThread isCancelled]) { - // Print a warning to be caught by the layout-test script. - // Note: the layout test driver may or may not recognize - // this as a timeout. - puts("#TEST_TIMED_OUT\n"); - puts("#EOF\n"); - fflush(stdout); - exit(0); - } - - [pool release]; -} - -@end - -void TestShell::waitTestFinished() -{ - ASSERT(!m_testIsPending); - - m_testIsPending = true; - - // Create a watchdog thread which just sets a timer and - // kills the process if it times out. This catches really - // bad hangs where the shell isn't coming back to the - // message loop. If the watchdog is what catches a - // timeout, it can't do anything except terminate the test - // shell, which is unfortunate. - // Windows multiplies by 2.5, but that causes us to run for far, far too - // long. We use the passed value and let the scripts flag override - // the value as needed. - NSTimeInterval timeoutSeconds = layoutTestTimeoutForWatchDog() / 1000; - WatchDogTarget* watchdog = [[[WatchDogTarget alloc] - initWithTimeout:timeoutSeconds] autorelease]; - NSThread* thread = [[NSThread alloc] initWithTarget:watchdog - selector:@selector(run:) - object:nil]; - [thread start]; - - // TestFinished() will post a quit message to break this loop when the page - // finishes loading. - while (m_testIsPending) - webkit_support::RunMessageLoop(); - - // Tell the watchdog that we're finished. No point waiting to re-join, it'll - // die on its own. - [thread cancel]; - [thread release]; -} - -void platformInit(int*, char***) -{ - webkit_support::SetThemeEngine(&themeEngine); -} - -void openStartupDialog() -{ - // FIXME: This code doesn't work. Need NSApplication event loop? - NSAlert* alert = [[[NSAlert alloc] init] autorelease]; - alert.messageText = @"Attach to me?"; - alert.informativeText = @"This would probably be a good time to attach your debugger."; - [alert addButtonWithTitle:@"OK"]; - [alert runModal]; -} - -bool checkLayoutTestSystemDependencies() -{ - return true; -} - diff --git a/Tools/DumpRenderTree/chromium/TestShellPosix.cpp b/Tools/DumpRenderTree/chromium/TestShellPosix.cpp deleted file mode 100644 index a6d8a541c..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellPosix.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestShell.h" - -#include "webkit/support/webkit_support.h" - -#include <signal.h> -#include <unistd.h> - -static void AlarmHandler(int) -{ - // If the alarm alarmed, kill the process since we have a really bad hang. - puts("\n#TEST_TIMED_OUT\n"); - puts("#EOF\n"); - fflush(stdout); - exit(0); -} - -void TestShell::waitTestFinished() -{ - ASSERT(!m_testIsPending); - m_testIsPending = true; - - // Install an alarm signal handler that will kill us if we time out. - struct sigaction alarmAction; - alarmAction.sa_handler = AlarmHandler; - sigemptyset(&alarmAction.sa_mask); - alarmAction.sa_flags = 0; - - struct sigaction oldAction; - sigaction(SIGALRM, &alarmAction, &oldAction); - alarm(layoutTestTimeoutForWatchDog() / 1000); - - // TestFinished() will post a quit message to break this loop when the page - // finishes loading. - while (m_testIsPending) - webkit_support::RunMessageLoop(); - - // Remove the alarm. - alarm(0); - sigaction(SIGALRM, &oldAction, 0); -} diff --git a/Tools/DumpRenderTree/chromium/TestShellStub.cpp b/Tools/DumpRenderTree/chromium/TestShellStub.cpp deleted file mode 100644 index 6c34f84b3..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellStub.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "config.h" - -#include "TestShell.h" - -bool checkLayoutTestSystemDependencies() -{ - return true; -} - -void openStartupDialog() -{ - // FIXME: Not implemented. -} - diff --git a/Tools/DumpRenderTree/chromium/TestShellWin.cpp b/Tools/DumpRenderTree/chromium/TestShellWin.cpp deleted file mode 100644 index 083d54a1b..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellWin.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestShell.h" - -#include "WebThemeEngineDRTWin.h" -#include "webkit/support/webkit_support.h" -#include <fcntl.h> -#include <io.h> -#include <list> -#include <process.h> -#include <shlwapi.h> -#include <string> -#include <sys/stat.h> -#include <windows.h> - -#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \ - offsetof(structName, member) + \ - (sizeof static_cast<structName*>(0)->member) -#define NONCLIENTMETRICS_SIZE_PRE_VISTA \ - SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont) - -// Theme engine -static WebThemeEngineDRTWin themeEngine; - -// Thread main to run for the thread which just tests for timeout. -unsigned int __stdcall watchDogThread(void* arg) -{ - // If we're debugging a layout test, don't timeout. - if (::IsDebuggerPresent()) - return 0; - - TestShell* shell = static_cast<TestShell*>(arg); - // FIXME: Do we need user-specified time settings as with the original - // Chromium implementation? - DWORD timeout = static_cast<DWORD>(shell->layoutTestTimeoutForWatchDog()); - DWORD rv = WaitForSingleObject(shell->finishedEvent(), timeout); - if (rv == WAIT_TIMEOUT) { - // Print a warning to be caught by the layout-test script. - // Note: the layout test driver may or may not recognize - // this as a timeout. - puts("\n#TEST_TIMED_OUT\n"); - puts("#EOF\n"); - fflush(stdout); - TerminateProcess(GetCurrentProcess(), 0); - } - // Finished normally. - return 0; -} - -void TestShell::waitTestFinished() -{ - ASSERT(!m_testIsPending); - - m_testIsPending = true; - - // Create a watchdog thread which just sets a timer and - // kills the process if it times out. This catches really - // bad hangs where the shell isn't coming back to the - // message loop. If the watchdog is what catches a - // timeout, it can't do anything except terminate the test - // shell, which is unfortunate. - m_finishedEvent = CreateEvent(0, TRUE, FALSE, 0); - ASSERT(m_finishedEvent); - - HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex( - 0, - 0, - &watchDogThread, - this, - 0, - 0)); - ASSERT(threadHandle); - - // TestFinished() will post a quit message to break this loop when the page - // finishes loading. - while (m_testIsPending) - webkit_support::RunMessageLoop(); - - // Tell the watchdog that we are finished. - SetEvent(m_finishedEvent); - - // Wait to join the watchdog thread. (up to 1s, then quit) - WaitForSingleObject(threadHandle, 1000); -} - -void platformInit(int*, char***) -{ - // Set stdout/stderr binary mode. - _setmode(_fileno(stdout), _O_BINARY); - _setmode(_fileno(stderr), _O_BINARY); - - // Set theme engine. - webkit_support::SetThemeEngine(&themeEngine); - - // Load Ahem font. - // AHEM____.TTF is copied to the directory of DumpRenderTree.exe by WebKit.gyp. - WCHAR path[_MAX_PATH]; - if (!::GetModuleFileName(0, path, _MAX_PATH)) { - fprintf(stderr, "Can't get the module path.\n"); - exit(1); - } - ::PathRemoveFileSpec(path); - wcscat_s(path, _MAX_PATH, L"/AHEM____.TTF"); - struct _stat ahemStat; - if (_wstat(path, &ahemStat) == -1) { - fprintf(stderr, "Can't access: '%S'\n", path); - exit(1); - } - - FILE* fp = _wfopen(path, L"rb"); - if (!fp) { - _wperror(path); - exit(1); - } - size_t size = ahemStat.st_size; - char* fontBuffer = new char[size]; - if (fread(fontBuffer, 1, size, fp) != size) { - fprintf(stderr, "Can't read the font: '%S'\n", path); - fclose(fp); - exit(1); - } - fclose(fp); - DWORD numFonts = 1; - HANDLE fontHandle = ::AddFontMemResourceEx(fontBuffer, size, 0, &numFonts); - delete[] fontBuffer; // OS owns a copy of the buffer. - if (!fontHandle) { - fprintf(stderr, "Failed to register Ahem font: '%S'\n", path); - exit(1); - } - // We don't need to release the font explicitly. -} - -void openStartupDialog() -{ - ::MessageBox(0, L"Attach to me?", L"DumpRenderTree", MB_OK); -} - -bool checkLayoutTestSystemDependencies() -{ - // This metric will be 17 when font size is "Normal". - // The size of drop-down menus depends on it. - int verticalScrollSize = ::GetSystemMetrics(SM_CXVSCROLL); - int requiredVScrollSize = 17; - std::list<std::string> errors; - if (verticalScrollSize != requiredVScrollSize) - errors.push_back("Must use normal size fonts (96 dpi)."); - - // ClearType must be disabled, because the rendering is unpredictable. - BOOL fontSmoothingEnabled; - ::SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothingEnabled, 0); - int fontSmoothingType; - ::SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &fontSmoothingType, 0); - if (fontSmoothingEnabled && (fontSmoothingType == FE_FONTSMOOTHINGCLEARTYPE)) - errors.push_back("ClearType must be disabled."); - - // Check that we're using the default system fonts. - OSVERSIONINFO versionInfo = {0}; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - ::GetVersionEx(&versionInfo); - const bool isVistaOrLater = (versionInfo.dwMajorVersion >= 6); - NONCLIENTMETRICS metrics = {0}; - metrics.cbSize = isVistaOrLater ? (sizeof NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA; - const bool success = !!::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0); - ASSERT(success); - LOGFONTW* systemFonts[] = - {&metrics.lfStatusFont, &metrics.lfMenuFont, &metrics.lfSmCaptionFont}; - const wchar_t* const requiredFont = isVistaOrLater ? L"Segoe UI" : L"Tahoma"; - const int requiredFontSize = isVistaOrLater ? -12 : -11; - for (size_t i = 0; i < arraysize(systemFonts); ++i) { - if (systemFonts[i]->lfHeight != requiredFontSize || wcscmp(requiredFont, systemFonts[i]->lfFaceName)) { - errors.push_back(isVistaOrLater ? "Must use either the Aero or Basic theme." : "Must use the default XP theme (Luna)."); - break; - } - } - - if (!errors.empty()) { - fprintf(stderr, "%s", - "##################################################################\n" - "## Layout test system dependencies check failed.\n" - "##\n"); - for (std::list<std::string>::iterator it = errors.begin(); it != errors.end(); ++it) - fprintf(stderr, "## %s\n", it->c_str()); - fprintf(stderr, "%s", - "##\n" - "##################################################################\n"); - } - return errors.empty(); -} diff --git a/Tools/DumpRenderTree/chromium/TestShellX11.cpp b/Tools/DumpRenderTree/chromium/TestShellX11.cpp deleted file mode 100644 index 4b25aa34b..000000000 --- a/Tools/DumpRenderTree/chromium/TestShellX11.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestShell.h" - -#include <fontconfig/fontconfig.h> - -#if USE(GTK) -#include <gtk/gtk.h> - -void openStartupDialog() -{ - GtkWidget* dialog = gtk_message_dialog_new( - 0, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Attach to me?"); - gtk_window_set_title(GTK_WINDOW(dialog), "DumpRenderTree"); - gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. - gtk_widget_destroy(dialog); -} - -bool checkLayoutTestSystemDependencies() -{ - return true; -} -#endif // USE(GTK) - -static bool checkAndLoadFontFile(FcConfig* fontcfg, const char* path1, const char* path2) -{ - const char* font = path1; - if (access(font, R_OK) < 0) { - font = path2; - if (access(font, R_OK) < 0) { - fprintf(stderr, "You are missing %s or %s. Without this, some layout tests may fail. " - "See http://code.google.com/p/chromium/wiki/LayoutTestsLinux " - "for more.\n", path1, path2); - return false; - } - } - if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) { - fprintf(stderr, "Failed to load font %s\n", font); - return false; - } - return true; -} - -static void setupFontconfig() -{ - // We wish to make the layout tests reproducable with respect to fonts. Skia - // uses fontconfig to resolve font family names from WebKit into actual font - // files found on the current system. This means that fonts vary based on the - // system and also on the fontconfig configuration. - // - // To avoid this we initialise fontconfig here and install a configuration - // which only knows about a few, select, fonts. - - // We have fontconfig parse a config file from our resources file. This - // sets a number of aliases ("sans"->"Arial" etc), but doesn't include any - // font directories. - FcInit(); - - char drtPath[PATH_MAX + 1]; - int drtPathSize = readlink("/proc/self/exe", drtPath, PATH_MAX); - if (drtPathSize < 0 || drtPathSize > PATH_MAX) { - fputs("Unable to resolve /proc/self/exe.", stderr); - exit(1); - } - drtPath[drtPathSize] = 0; - std::string drtDirPath(drtPath); - size_t lastPathPos = drtDirPath.rfind("/"); - ASSERT(lastPathPos != std::string::npos); - drtDirPath.erase(lastPathPos + 1); - - FcConfig* fontcfg = FcConfigCreate(); - std::string fontconfigPath = drtDirPath + "fonts.conf"; - if (!FcConfigParseAndLoad(fontcfg, reinterpret_cast<const FcChar8*>(fontconfigPath.c_str()), true)) { - fputs("Failed to parse fontconfig config file\n", stderr); - exit(1); - } - - // This is the list of fonts that fontconfig will know about. It - // will try its best to match based only on the fonts here in. The - // paths are where these fonts are found on our Ubuntu boxes. - static const char *const fonts[] = { - "/usr/share/fonts/truetype/kochi/kochi-gothic.ttf", - "/usr/share/fonts/truetype/kochi/kochi-mincho.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf", - "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf", - // The DejaVuSans font is used by the css2.1 tests. - "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", - "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf", - "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf", - "/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf", - }; - for (size_t i = 0; i < arraysize(fonts); ++i) { - if (access(fonts[i], R_OK)) { - fprintf(stderr, "You are missing %s. Try re-running build/install-build-deps.sh. Also see " - "http://code.google.com/p/chromium/wiki/LayoutTestsLinux", - fonts[i]); - exit(1); - } - if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) { - fprintf(stderr, "Failed to load font %s\n", fonts[i]); - exit(1); - } - } - - if (!checkAndLoadFontFile(fontcfg, "/usr/share/fonts/truetype/thai/Garuda.ttf", - "/usr/share/fonts/truetype/tlwg/Garuda.ttf")) - exit(1); - - // We special case these fonts because they're only needed in a - // few layout tests. - checkAndLoadFontFile(fontcfg, "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf", - "/usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf"); - - // Also load the layout-test-specific "Ahem" font. - std::string ahemPath = drtDirPath + "AHEM____.TTF"; - if (!FcConfigAppFontAddFile(fontcfg, reinterpret_cast<const FcChar8*>(ahemPath.c_str()))) { - fprintf(stderr, "Failed to load font %s\n", ahemPath.c_str()); - exit(1); - } - - if (!FcConfigSetCurrent(fontcfg)) { - fputs("Failed to set the default font configuration\n", stderr); - exit(1); - } -} - -void platformInit(int* argc, char*** argv) -{ - // FIXME: It's better call gtk_init() only when we run plugin tests. - // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca# -#if USE(GTK) - gtk_init(argc, argv); -#endif - - setupFontconfig(); -} diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp deleted file mode 100644 index ea2fded18..000000000 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestWebPlugin.h" - -#include "WebFrame.h" -#include "WebInputEvent.h" -#include "platform/WebGraphicsContext3D.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "WebPluginContainer.h" -#include "WebPluginParams.h" -#include "WebTouchPoint.h" -#include <wtf/Assertions.h> -#include <wtf/text/CString.h> - -using namespace WebKit; - -// GLenum values copied from gl2.h. -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_ONE 1 -#define GL_TRIANGLES 0x0004 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DEPTH_TEST 0x0B71 -#define GL_BLEND 0x0BE2 -#define GL_SCISSOR_TEST 0x0B90 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_FLOAT 0x1406 -#define GL_RGBA 0x1908 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_NEAREST 0x2600 -#define GL_COLOR_BUFFER_BIT 0x4000 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_ARRAY_BUFFER 0x8892 -#define GL_STATIC_DRAW 0x88E4 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER 0x8D40 - -static void premultiplyAlpha(const unsigned colorIn[3], float alpha, float colorOut[4]) -{ - for (int i = 0; i < 3; ++i) - colorOut[i] = (colorIn[i] / 255.0f) * alpha; - - colorOut[3] = alpha; -} - -static const char* pointState(WebKit::WebTouchPoint::State state) -{ - switch (state) { - case WebKit::WebTouchPoint::StateReleased: - return "Released"; - case WebKit::WebTouchPoint::StatePressed: - return "Pressed"; - case WebKit::WebTouchPoint::StateMoved: - return "Moved"; - case WebKit::WebTouchPoint::StateCancelled: - return "Cancelled"; - default: - return "Unknown"; - } - - ASSERT_NOT_REACHED(); - return 0; -} - -static void printTouchList(const WebKit::WebTouchPoint* points, int length) -{ - for (int i = 0; i < length; ++i) - printf("* %d, %d: %s\n", points[i].position.x, points[i].position.y, pointState(points[i].state)); -} - -static void printEventDetails(const WebKit::WebInputEvent& event) -{ - if (WebKit::WebInputEvent::isTouchEventType(event.type)) { - const WebKit::WebTouchEvent& touch = static_cast<const WebKit::WebTouchEvent&>(event); - printTouchList(touch.touches, touch.touchesLength); - printTouchList(touch.changedTouches, touch.changedTouchesLength); - printTouchList(touch.targetTouches, touch.targetTouchesLength); - } else if (WebKit::WebInputEvent::isMouseEventType(event.type) || event.type == WebKit::WebInputEvent::MouseWheel) { - const WebKit::WebMouseEvent& mouse = static_cast<const WebKit::WebMouseEvent&>(event); - printf("* %d, %d\n", mouse.x, mouse.y); - } else if (WebKit::WebInputEvent::isGestureEventType(event.type)) { - const WebKit::WebGestureEvent& gesture = static_cast<const WebKit::WebGestureEvent&>(event); - printf("* %d, %d\n", gesture.x, gesture.y); - } -} - -static WebKit::WebPluginContainer::TouchEventRequestType parseTouchEventRequestType(const WebString& string) -{ - DEFINE_STATIC_LOCAL(const WebString, kPrimitiveRaw, (WebString::fromUTF8("raw"))); - DEFINE_STATIC_LOCAL(const WebString, kPrimitiveSynthetic, (WebString::fromUTF8("synthetic"))); - - if (string == kPrimitiveRaw) - return WebKit::WebPluginContainer::TouchEventRequestTypeRaw; - if (string == kPrimitiveSynthetic) - return WebKit::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse; - return WebKit::WebPluginContainer::TouchEventRequestTypeNone; -} - -TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame, - const WebKit::WebPluginParams& params) - : m_frame(frame) - , m_container(0) - , m_context(0) - , m_touchEventRequest(WebKit::WebPluginContainer::TouchEventRequestTypeNone) - , m_printEventDetails(false) - , m_canProcessDrag(false) -{ - static const WebString kAttributePrimitive = WebString::fromUTF8("primitive"); - static const WebString kAttributeBackgroundColor = WebString::fromUTF8("background-color"); - static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primitive-color"); - static const WebString kAttributeOpacity = WebString::fromUTF8("opacity"); - static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts-touch"); - static const WebString kAttributePrintEventDetails = WebString::fromUTF8("print-event-details"); - static const WebString kAttributeCanProcessDrag = WebString::fromUTF8("can-process-drag"); - - ASSERT(params.attributeNames.size() == params.attributeValues.size()); - size_t size = params.attributeNames.size(); - for (size_t i = 0; i < size; ++i) { - const WebString& attributeName = params.attributeNames[i]; - const WebString& attributeValue = params.attributeValues[i]; - - if (attributeName == kAttributePrimitive) - m_scene.primitive = parsePrimitive(attributeValue); - else if (attributeName == kAttributeBackgroundColor) - parseColor(attributeValue, m_scene.backgroundColor); - else if (attributeName == kAttributePrimitiveColor) - parseColor(attributeValue, m_scene.primitiveColor); - else if (attributeName == kAttributeOpacity) - m_scene.opacity = parseOpacity(attributeValue); - else if (attributeName == kAttributeAcceptsTouch) - m_touchEventRequest = parseTouchEventRequestType(attributeValue); - else if (attributeName == kAttributePrintEventDetails) - m_printEventDetails = parseBoolean(attributeValue); - else if (attributeName == kAttributeCanProcessDrag) - m_canProcessDrag = parseBoolean(attributeValue); - } -} - -TestWebPlugin::~TestWebPlugin() -{ -} - -const WebString& TestWebPlugin::mimeType() -{ - static const WebString kMimeType = WebString::fromUTF8("application/x-webkit-test-webplugin"); - return kMimeType; -} - -bool TestWebPlugin::initialize(WebPluginContainer* container) -{ - WebGraphicsContext3D::Attributes attrs; - m_context = webKitPlatformSupport()->createOffscreenGraphicsContext3D(attrs); - if (!m_context) - return false; - - if (!m_context->makeContextCurrent()) - return false; - - if (!initScene()) - return false; - - m_container = container; - m_container->setBackingTextureId(m_colorTexture); - m_container->requestTouchEventType(m_touchEventRequest); - m_container->setWantsWheelEvents(true); - return true; -} - -void TestWebPlugin::destroy() -{ - destroyScene(); - - delete m_context; - m_context = 0; - - m_container = 0; - m_frame = 0; -} - -void TestWebPlugin::updateGeometry(const WebRect& frameRect, - const WebRect& clipRect, - const WebVector<WebRect>& cutOutsRects, - bool isVisible) -{ - if (clipRect == m_rect) - return; - m_rect = clipRect; - if (m_rect.isEmpty()) - return; - - m_context->reshape(m_rect.width, m_rect.height); - m_context->viewport(0, 0, m_rect.width, m_rect.height); - - m_context->bindTexture(GL_TEXTURE_2D, m_colorTexture); - m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - m_context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rect.width, m_rect.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); - m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorTexture, 0); - - drawScene(); - - m_context->flush(); - m_container->commitBackingTexture(); -} - -TestWebPlugin::Primitive TestWebPlugin::parsePrimitive(const WebString& string) -{ - static const WebString kPrimitiveNone = WebString::fromUTF8("none"); - static const WebString kPrimitiveTriangle = WebString::fromUTF8("triangle"); - - Primitive primitive = PrimitiveNone; - if (string == kPrimitiveNone) - primitive = PrimitiveNone; - else if (string == kPrimitiveTriangle) - primitive = PrimitiveTriangle; - else - ASSERT_NOT_REACHED(); - return primitive; -} - -// FIXME: This method should already exist. Use it. -// For now just parse primary colors. -void TestWebPlugin::parseColor(const WebString& string, unsigned color[3]) -{ - color[0] = color[1] = color[2] = 0; - if (string == "black") - return; - - if (string == "red") - color[0] = 255; - else if (string == "green") - color[1] = 255; - else if (string == "blue") - color[2] = 255; - else - ASSERT_NOT_REACHED(); -} - -float TestWebPlugin::parseOpacity(const WebString& string) -{ - return static_cast<float>(atof(string.utf8().data())); -} - -bool TestWebPlugin::parseBoolean(const WebString& string) -{ - static const WebString kPrimitiveTrue = WebString::fromUTF8("true"); - return string == kPrimitiveTrue; -} - -bool TestWebPlugin::initScene() -{ - float color[4]; - premultiplyAlpha(m_scene.backgroundColor, m_scene.opacity, color); - - m_colorTexture = m_context->createTexture(); - m_framebuffer = m_context->createFramebuffer(); - - m_context->viewport(0, 0, m_rect.width, m_rect.height); - m_context->disable(GL_DEPTH_TEST); - m_context->disable(GL_SCISSOR_TEST); - - m_context->clearColor(color[0], color[1], color[2], color[3]); - - m_context->enable(GL_BLEND); - m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - return m_scene.primitive != PrimitiveNone ? initProgram() && initPrimitive() : true; -} - -void TestWebPlugin::drawScene() -{ - m_context->viewport(0, 0, m_rect.width, m_rect.height); - m_context->clear(GL_COLOR_BUFFER_BIT); - - if (m_scene.primitive != PrimitiveNone) - drawPrimitive(); -} - -void TestWebPlugin::destroyScene() -{ - if (m_scene.program) { - m_context->deleteProgram(m_scene.program); - m_scene.program = 0; - } - if (m_scene.vbo) { - m_context->deleteBuffer(m_scene.vbo); - m_scene.vbo = 0; - } - - if (m_framebuffer) { - m_context->deleteFramebuffer(m_framebuffer); - m_framebuffer = 0; - } - - if (m_colorTexture) { - m_context->deleteTexture(m_colorTexture); - m_colorTexture = 0; - } -} - -bool TestWebPlugin::initProgram() -{ - const CString vertexSource( - "attribute vec4 position; \n" - "void main() { \n" - " gl_Position = position; \n" - "} \n" - ); - - const CString fragmentSource( - "precision mediump float; \n" - "uniform vec4 color; \n" - "void main() { \n" - " gl_FragColor = color; \n" - "} \n" - ); - - m_scene.program = loadProgram(vertexSource, fragmentSource); - if (!m_scene.program) - return false; - - m_scene.colorLocation = m_context->getUniformLocation(m_scene.program, "color"); - m_scene.positionLocation = m_context->getAttribLocation(m_scene.program, "position"); - return true; -} - -bool TestWebPlugin::initPrimitive() -{ - ASSERT(m_scene.primitive == PrimitiveTriangle); - - m_scene.vbo = m_context->createBuffer(); - if (!m_scene.vbo) - return false; - - const float vertices[] = { 0.0f, 0.8f, 0.0f, - -0.8f, -0.8f, 0.0f, - 0.8f, -0.8f, 0.0f }; - m_context->bindBuffer(GL_ARRAY_BUFFER, m_scene.vbo); - m_context->bufferData(GL_ARRAY_BUFFER, sizeof(vertices), 0, GL_STATIC_DRAW); - m_context->bufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); - return true; -} - -void TestWebPlugin::drawPrimitive() -{ - ASSERT(m_scene.primitive == PrimitiveTriangle); - ASSERT(m_scene.vbo); - ASSERT(m_scene.program); - - m_context->useProgram(m_scene.program); - - // Bind primitive color. - float color[4]; - premultiplyAlpha(m_scene.primitiveColor, m_scene.opacity, color); - m_context->uniform4f(m_scene.colorLocation, color[0], color[1], color[2], color[3]); - - // Bind primitive vertices. - m_context->bindBuffer(GL_ARRAY_BUFFER, m_scene.vbo); - m_context->enableVertexAttribArray(m_scene.positionLocation); - m_context->vertexAttribPointer(m_scene.positionLocation, 3, GL_FLOAT, GL_FALSE, 0, 0); - m_context->drawArrays(GL_TRIANGLES, 0, 3); -} - -unsigned TestWebPlugin::loadShader(unsigned type, const CString& source) -{ - unsigned shader = m_context->createShader(type); - if (shader) { - m_context->shaderSource(shader, source.data()); - m_context->compileShader(shader); - - int compiled = 0; - m_context->getShaderiv(shader, GL_COMPILE_STATUS, &compiled); - if (!compiled) { - m_context->deleteShader(shader); - shader = 0; - } - } - return shader; -} - -unsigned TestWebPlugin::loadProgram(const CString& vertexSource, - const CString& fragmentSource) -{ - unsigned vertexShader = loadShader(GL_VERTEX_SHADER, vertexSource); - unsigned fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentSource); - unsigned program = m_context->createProgram(); - if (vertexShader && fragmentShader && program) { - m_context->attachShader(program, vertexShader); - m_context->attachShader(program, fragmentShader); - m_context->linkProgram(program); - - int linked = 0; - m_context->getProgramiv(program, GL_LINK_STATUS, &linked); - if (!linked) { - m_context->deleteProgram(program); - program = 0; - } - } - if (vertexShader) - m_context->deleteShader(vertexShader); - if (fragmentShader) - m_context->deleteShader(fragmentShader); - - return program; -} - -bool TestWebPlugin::handleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo& info) -{ - const char* eventName = 0; - switch (event.type) { - case WebKit::WebInputEvent::Undefined: eventName = "unknown"; break; - - case WebKit::WebInputEvent::MouseDown: eventName = "MouseDown"; break; - case WebKit::WebInputEvent::MouseUp: eventName = "MouseUp"; break; - case WebKit::WebInputEvent::MouseMove: eventName = "MouseMove"; break; - case WebKit::WebInputEvent::MouseEnter: eventName = "MouseEnter"; break; - case WebKit::WebInputEvent::MouseLeave: eventName = "MouseLeave"; break; - case WebKit::WebInputEvent::ContextMenu: eventName = "ContextMenu"; break; - - case WebKit::WebInputEvent::MouseWheel: eventName = "MouseWheel"; break; - - case WebKit::WebInputEvent::RawKeyDown: eventName = "RawKeyDown"; break; - case WebKit::WebInputEvent::KeyDown: eventName = "KeyDown"; break; - case WebKit::WebInputEvent::KeyUp: eventName = "KeyUp"; break; - case WebKit::WebInputEvent::Char: eventName = "Char"; break; - - case WebKit::WebInputEvent::GestureScrollBegin: eventName = "GestureScrollBegin"; break; - case WebKit::WebInputEvent::GestureScrollEnd: eventName = "GestureScrollEnd"; break; - case WebKit::WebInputEvent::GestureScrollUpdate: eventName = "GestureScrollUpdate"; break; - case WebKit::WebInputEvent::GestureFlingStart: eventName = "GestureFlingStart"; break; - case WebKit::WebInputEvent::GestureFlingCancel: eventName = "GestureFlingCancel"; break; - case WebKit::WebInputEvent::GestureTap: eventName = "GestureTap"; break; - case WebKit::WebInputEvent::GestureTapDown: eventName = "GestureTapDown"; break; - case WebKit::WebInputEvent::GestureTapCancel: eventName = "GestureTapCancel"; break; - case WebKit::WebInputEvent::GestureDoubleTap: eventName = "GestureDoubleTap"; break; - case WebKit::WebInputEvent::GestureTwoFingerTap: eventName = "GestureTwoFingerTap"; break; - case WebKit::WebInputEvent::GestureLongPress: eventName = "GestureLongPress"; break; - case WebKit::WebInputEvent::GestureLongTap: eventName = "GestureLongTap"; break; - case WebKit::WebInputEvent::GesturePinchBegin: eventName = "GesturePinchBegin"; break; - case WebKit::WebInputEvent::GesturePinchEnd: eventName = "GesturePinchEnd"; break; - case WebKit::WebInputEvent::GesturePinchUpdate: eventName = "GesturePinchUpdate"; break; - - case WebKit::WebInputEvent::TouchStart: eventName = "TouchStart"; break; - case WebKit::WebInputEvent::TouchMove: eventName = "TouchMove"; break; - case WebKit::WebInputEvent::TouchEnd: eventName = "TouchEnd"; break; - case WebKit::WebInputEvent::TouchCancel: eventName = "TouchCancel"; break; - } - - printf("Plugin received event: %s\n", eventName ? eventName : "unknown"); - if (m_printEventDetails) - printEventDetails(event); - return false; -} - -bool TestWebPlugin::handleDragStatusUpdate(WebKit::WebDragStatus dragStatus, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebPoint& position, const WebKit::WebPoint& screenPosition) -{ - const char* dragStatusName = 0; - switch (dragStatus) { - case WebKit::WebDragStatusEnter: - dragStatusName = "DragEnter"; - break; - case WebKit::WebDragStatusOver: - dragStatusName = "DragOver"; - break; - case WebKit::WebDragStatusLeave: - dragStatusName = "DragLeave"; - break; - case WebKit::WebDragStatusDrop: - dragStatusName = "DragDrop"; - break; - case WebKit::WebDragStatusUnknown: - ASSERT_NOT_REACHED(); - } - printf("Plugin received event: %s\n", dragStatusName); - return false; -} - diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.h b/Tools/DumpRenderTree/chromium/TestWebPlugin.h deleted file mode 100644 index e6f5b47a4..000000000 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TestWebPlugin_h -#define TestWebPlugin_h - -#include "WebPlugin.h" -#include "WebPluginContainer.h" -#include "platform/WebRect.h" - -namespace WebKit { -class WebGraphicsContext3D; -} - -// A fake implemention of WebKit::WebPlugin for testing purposes. -// -// It uses WebGraphicsContext3D to paint a scene consisiting of a primitive -// over a background. The primitive and background can be customized using -// the following plugin parameters: -// primitive: none (default), triangle. -// background-color: black (default), red, green, blue. -// primitive-color: black (default), red, green, blue. -// opacity: [0.0 - 1.0]. Default is 1.0. -// -// Whether the plugin accepts touch events or not can be customized using the -// 'accepts-touch' plugin parameter (defaults to false). -class TestWebPlugin : public WebKit::WebPlugin { -public: - TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&); - virtual ~TestWebPlugin(); - - static const WebKit::WebString& mimeType(); - - // WebPlugin methods: - virtual bool initialize(WebKit::WebPluginContainer*); - virtual void destroy(); - virtual NPObject* scriptableObject() { return 0; } - virtual bool canProcessDrag() const { return m_canProcessDrag; } - virtual void paint(WebKit::WebCanvas*, const WebKit::WebRect&) { } - virtual void updateGeometry(const WebKit::WebRect& frameRect, - const WebKit::WebRect& clipRect, - const WebKit::WebVector<WebKit::WebRect>& cutOutsRects, - bool isVisible); - virtual void updateFocus(bool) { } - virtual void updateVisibility(bool) { } - virtual bool acceptsInputEvents() { return true; } - virtual bool handleInputEvent(const WebKit::WebInputEvent&, WebKit::WebCursorInfo&); - virtual bool handleDragStatusUpdate(WebKit::WebDragStatus, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebPoint& position, const WebKit::WebPoint& screenPosition); - virtual void didReceiveResponse(const WebKit::WebURLResponse&) { } - virtual void didReceiveData(const char* data, int dataLength) { } - virtual void didFinishLoading() { } - virtual void didFailLoading(const WebKit::WebURLError&) { } - virtual void didFinishLoadingFrameRequest(const WebKit::WebURL&, void* notifyData) { } - virtual void didFailLoadingFrameRequest(const WebKit::WebURL&, void* notifyData, const WebKit::WebURLError&) { } - virtual bool isPlaceholder() { return false; } - -private: - enum Primitive { - PrimitiveNone, - PrimitiveTriangle - }; - - struct Scene { - Primitive primitive; - unsigned backgroundColor[3]; - unsigned primitiveColor[3]; - float opacity; - - unsigned vbo; - unsigned program; - int colorLocation; - int positionLocation; - - Scene() - : primitive(PrimitiveNone) - , opacity(1.0f) // Fully opaque. - , vbo(0) - , program(0) - , colorLocation(-1) - , positionLocation(-1) - { - backgroundColor[0] = backgroundColor[1] = backgroundColor[2] = 0; - primitiveColor[0] = primitiveColor[1] = primitiveColor[2] = 0; - } - }; - - // Functions for parsing plugin parameters. - Primitive parsePrimitive(const WebKit::WebString&); - void parseColor(const WebKit::WebString&, unsigned color[3]); - float parseOpacity(const WebKit::WebString&); - bool parseBoolean(const WebKit::WebString&); - - // Functions for loading and drawing scene. - bool initScene(); - void drawScene(); - void destroyScene(); - bool initProgram(); - bool initPrimitive(); - void drawPrimitive(); - unsigned loadShader(unsigned type, const WTF::CString& source); - unsigned loadProgram(const WTF::CString& vertexSource, - const WTF::CString& fragmentSource); - - WebKit::WebFrame* m_frame; - WebKit::WebPluginContainer* m_container; - - WebKit::WebRect m_rect; - WebKit::WebGraphicsContext3D* m_context; - unsigned m_colorTexture; - unsigned m_framebuffer; - Scene m_scene; - - WebKit::WebPluginContainer::TouchEventRequestType m_touchEventRequest; - bool m_printEventDetails; - bool m_canProcessDrag; -}; - -#endif // TestPepperPlugin_h diff --git a/Tools/DumpRenderTree/chromium/WebPermissions.cpp b/Tools/DumpRenderTree/chromium/WebPermissions.cpp deleted file mode 100644 index 2c7c9eee8..000000000 --- a/Tools/DumpRenderTree/chromium/WebPermissions.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebPermissions.h" - -#include "DRTTestRunner.h" -#include "TestShell.h" -#include "platform/WebCString.h" -#include "platform/WebURL.h" - -WebPermissions::WebPermissions(TestShell* shell) - : m_shell(shell) -{ - reset(); -} - -WebPermissions::~WebPermissions() -{ -} - -bool WebPermissions::allowImage(WebKit::WebFrame*, bool enabledPerSettings, const WebKit::WebURL& imageURL) -{ - bool allowed = enabledPerSettings && m_imagesAllowed; - if (testRunner()->shouldDumpPermissionClientCallbacks()) - fprintf(stdout, "PERMISSION CLIENT: allowImage(%s): %s\n", m_shell->normalizeLayoutTestURL(imageURL.spec()).c_str(), allowed ? "true" : "false"); - return allowed; -} - -bool WebPermissions::allowScriptFromSource(WebKit::WebFrame*, bool enabledPerSettings, const WebKit::WebURL& scriptURL) -{ - bool allowed = enabledPerSettings && m_scriptsAllowed; - if (testRunner()->shouldDumpPermissionClientCallbacks()) - fprintf(stdout, "PERMISSION CLIENT: allowScriptFromSource(%s): %s\n", m_shell->normalizeLayoutTestURL(scriptURL.spec()).c_str(), allowed ? "true" : "false"); - return allowed; -} - -bool WebPermissions::allowStorage(WebKit::WebFrame*, bool) -{ - return m_storageAllowed; -} - -bool WebPermissions::allowPlugins(WebKit::WebFrame*, bool enabledPerSettings) -{ - return enabledPerSettings && m_pluginsAllowed; -} - -bool WebPermissions::allowDisplayingInsecureContent(WebKit::WebFrame*, bool enabledPerSettings, - const WebKit::WebSecurityOrigin&, const WebKit::WebURL&) -{ - return enabledPerSettings || m_displayingInsecureContentAllowed; -} - -bool WebPermissions::allowRunningInsecureContent(WebKit::WebFrame*, bool enabledPerSettings, - const WebKit::WebSecurityOrigin&, const WebKit::WebURL&) -{ - return enabledPerSettings || m_runningInsecureContentAllowed; -} - -void WebPermissions::setImagesAllowed(bool imagesAllowed) -{ - m_imagesAllowed = imagesAllowed; -} - -void WebPermissions::setScriptsAllowed(bool scriptsAllowed) -{ - m_scriptsAllowed = scriptsAllowed; -} - -void WebPermissions::setStorageAllowed(bool storageAllowed) -{ - m_storageAllowed = storageAllowed; -} - -void WebPermissions::setPluginsAllowed(bool pluginsAllowed) -{ - m_pluginsAllowed = pluginsAllowed; -} - -void WebPermissions::setDisplayingInsecureContentAllowed(bool allowed) -{ - m_displayingInsecureContentAllowed = allowed; -} - -void WebPermissions::setRunningInsecureContentAllowed(bool allowed) -{ - m_runningInsecureContentAllowed = allowed; -} - -void WebPermissions::reset() -{ - m_imagesAllowed = true; - m_scriptsAllowed = true; - m_storageAllowed = true; - m_pluginsAllowed = true; - m_displayingInsecureContentAllowed = false; - m_runningInsecureContentAllowed = false; -} - -// Private functions ---------------------------------------------------------- - -DRTTestRunner* WebPermissions::testRunner() const -{ - return m_shell->testRunner(); -} diff --git a/Tools/DumpRenderTree/chromium/WebPermissions.h b/Tools/DumpRenderTree/chromium/WebPermissions.h deleted file mode 100644 index c625077e8..000000000 --- a/Tools/DumpRenderTree/chromium/WebPermissions.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebPermissions_h -#define WebPermissions_h - -#include "WebPermissionClient.h" - -class DRTTestRunner; -class TestShell; - -class WebPermissions : public WebKit::WebPermissionClient { -public: - WebPermissions(TestShell*); - virtual ~WebPermissions(); - - // Override WebPermissionClient methods. - virtual bool allowImage(WebKit::WebFrame*, bool enabledPerSettings, const WebKit::WebURL& imageURL); - virtual bool allowScriptFromSource(WebKit::WebFrame*, bool enabledPerSettings, const WebKit::WebURL& scriptURL); - virtual bool allowStorage(WebKit::WebFrame*, bool local); - virtual bool allowPlugins(WebKit::WebFrame*, bool enabledPerSettings); - virtual bool allowDisplayingInsecureContent(WebKit::WebFrame*, bool enabledPerSettings, - const WebKit::WebSecurityOrigin&, const WebKit::WebURL&); - virtual bool allowRunningInsecureContent(WebKit::WebFrame*, bool enabledPerSettings, - const WebKit::WebSecurityOrigin&, const WebKit::WebURL&); - - // Hooks to set the different policies. - void setImagesAllowed(bool); - void setScriptsAllowed(bool); - void setStorageAllowed(bool); - void setPluginsAllowed(bool); - void setDisplayingInsecureContentAllowed(bool); - void setRunningInsecureContentAllowed(bool); - - // Resets the policy to allow everything, except for running insecure content. - void reset(); - -private: - DRTTestRunner* testRunner() const; - - // Non-owning pointer. The WebPermissions instance is owned by this TestShell instance. - TestShell* m_shell; - - bool m_imagesAllowed; - bool m_scriptsAllowed; - bool m_storageAllowed; - bool m_pluginsAllowed; - bool m_displayingInsecureContentAllowed; - bool m_runningInsecureContentAllowed; -}; - -#endif diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp deleted file mode 100644 index f64a7b156..000000000 --- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebPreferences.h" -#include "WebRuntimeFeatures.h" - -#include "WebView.h" - -using namespace WebKit; - -void WebPreferences::reset() -{ -#if OS(MAC_OS_X) - cursiveFontFamily = WebString::fromUTF8("Apple Chancery"); - fantasyFontFamily = WebString::fromUTF8("Papyrus"); - WebString serif = WebString::fromUTF8("Times"); -#else - // These two fonts are picked from the intersection of - // Win XP font list and Vista font list : - // http://www.microsoft.com/typography/fonts/winxp.htm - // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx - // Some of them are installed only with CJK and complex script - // support enabled on Windows XP and are out of consideration here. - // (although we enabled both on our buildbots.) - // They (especially Impact for fantasy) are not typical cursive - // and fantasy fonts, but it should not matter for layout tests - // as long as they're available. - cursiveFontFamily = WebString::fromUTF8("Comic Sans MS"); - fantasyFontFamily = WebString::fromUTF8("Impact"); - // NOTE: case matters here, this must be 'times new roman', else - // some layout tests fail. - WebString serif = WebString::fromUTF8("times new roman"); -#endif - serifFontFamily = serif; - standardFontFamily = serif; - fixedFontFamily = WebString::fromUTF8("Courier"); - sansSerifFontFamily = WebString::fromUTF8("Helvetica"); - - defaultFontSize = 16; - defaultFixedFontSize = 13; - minimumFontSize = 0; - minimumLogicalFontSize = 9; - // Do not disable acceleration for 2d canvas based on size. - // This makes having test expectations consistent. - minimumAccelerated2dCanvasSize = 0; - - DOMPasteAllowed = true; - XSSAuditorEnabled = false; - allowDisplayOfInsecureContent = true; - allowFileAccessFromFileURLs = true; - allowRunningOfInsecureContent = true; - authorAndUserStylesEnabled = true; - defaultTextEncodingName = WebString::fromUTF8("ISO-8859-1"); - developerExtrasEnabled = true; - experimentalWebGLEnabled = false; - experimentalCSSRegionsEnabled = true; - experimentalCSSGridLayoutEnabled = false; - javaEnabled = false; - javaScriptCanAccessClipboard = true; - javaScriptCanOpenWindowsAutomatically = true; - supportsMultipleWindows = true; - javaScriptEnabled = true; - loadsImagesAutomatically = true; - localStorageEnabled = true; - offlineWebApplicationCacheEnabled = true; - pluginsEnabled = true; - shrinksStandaloneImagesToFit = false; - textAreasAreResizable = false; - userStyleSheetLocation = WebURL(); - usesPageCache = false; - pageCacheSupportsPlugins = false; - webSecurityEnabled = true; - caretBrowsingEnabled = false; - - // Allow those layout tests running as local files, i.e. under - // LayoutTests/http/tests/local, to access http server. - allowUniversalAccessFromFileURLs = true; - -#if OS(DARWIN) - editingBehavior = WebSettings::EditingBehaviorMac; -#else - editingBehavior = WebSettings::EditingBehaviorWin; -#endif - - tabsToLinks = false; - hyperlinkAuditingEnabled = false; - acceleratedCompositingForVideoEnabled = false; - acceleratedCompositingForFixedPositionEnabled = false; - acceleratedCompositingEnabled = false; - accelerated2dCanvasEnabled = false; - deferred2dCanvasEnabled = false; - acceleratedPaintingEnabled = false; - forceCompositingMode = false; - perTilePaintingEnabled = false; - acceleratedAnimationEnabled = false; - deferredImageDecodingEnabled = false; - mediaPlaybackRequiresUserGesture = false; - mockScrollbarsEnabled = false; - cssCustomFilterEnabled = false; - shouldRespectImageOrientation = false; -} - -static void setStandardFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setStandardFontFamily(font, script); -} - -static void setFixedFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setFixedFontFamily(font, script); -} - -static void setSerifFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setSerifFontFamily(font, script); -} - -static void setSansSerifFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setSansSerifFontFamily(font, script); -} - -static void setCursiveFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setCursiveFontFamily(font, script); -} - -static void setFantasyFontFamilyWrapper(WebSettings* settings, const WebKit::WebString& font, UScriptCode script) -{ - settings->setFantasyFontFamily(font, script); -} - -typedef void (*SetFontFamilyWrapper)(WebSettings*, const WebString&, UScriptCode); - -static void applyFontMap(WebSettings* settings, const WebPreferences::ScriptFontFamilyMap& map, SetFontFamilyWrapper setter) -{ - for (WebPreferences::ScriptFontFamilyMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { - const WebString& font = iter->value; - if (!font.isNull() && !font.isEmpty()) - (*setter)(settings, font, static_cast<UScriptCode>(iter->key)); - } -} - -void WebPreferences::applyTo(WebView* webView) -{ - WebSettings* settings = webView->settings(); - settings->setStandardFontFamily(standardFontFamily); - settings->setFixedFontFamily(fixedFontFamily); - settings->setSerifFontFamily(serifFontFamily); - settings->setSansSerifFontFamily(sansSerifFontFamily); - settings->setCursiveFontFamily(cursiveFontFamily); - settings->setFantasyFontFamily(fantasyFontFamily); - - applyFontMap(settings, standardFontMap, setStandardFontFamilyWrapper); - applyFontMap(settings, fixedFontMap, setFixedFontFamilyWrapper); - applyFontMap(settings, serifFontMap, setSerifFontFamilyWrapper); - applyFontMap(settings, sansSerifFontMap, setSansSerifFontFamilyWrapper); - applyFontMap(settings, cursiveFontMap, setCursiveFontFamilyWrapper); - applyFontMap(settings, fantasyFontMap, setFantasyFontFamilyWrapper); - - settings->setDefaultFontSize(defaultFontSize); - settings->setDefaultFixedFontSize(defaultFixedFontSize); - settings->setMinimumFontSize(minimumFontSize); - settings->setMinimumLogicalFontSize(minimumLogicalFontSize); - settings->setMinimumAccelerated2dCanvasSize(minimumAccelerated2dCanvasSize); - - settings->setDOMPasteAllowed(DOMPasteAllowed); - settings->setXSSAuditorEnabled(XSSAuditorEnabled); - settings->setAllowDisplayOfInsecureContent(allowDisplayOfInsecureContent); - settings->setAllowFileAccessFromFileURLs(allowFileAccessFromFileURLs); - settings->setAllowRunningOfInsecureContent(allowRunningOfInsecureContent); - settings->setAuthorAndUserStylesEnabled(authorAndUserStylesEnabled); - settings->setDefaultTextEncodingName(defaultTextEncodingName); - settings->setDeveloperExtrasEnabled(developerExtrasEnabled); - settings->setExperimentalWebGLEnabled(experimentalWebGLEnabled); - WebRuntimeFeatures::enableCSSRegions(experimentalCSSRegionsEnabled); - settings->setExperimentalCSSGridLayoutEnabled(experimentalCSSGridLayoutEnabled); - settings->setExperimentalCSSCustomFilterEnabled(cssCustomFilterEnabled); - settings->setJavaEnabled(javaEnabled); - settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); - settings->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); - settings->setSupportsMultipleWindows(supportsMultipleWindows); - settings->setJavaScriptEnabled(javaScriptEnabled); - settings->setLoadsImagesAutomatically(loadsImagesAutomatically); - settings->setLocalStorageEnabled(localStorageEnabled); - settings->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled); - settings->setPluginsEnabled(pluginsEnabled); - settings->setShrinksStandaloneImagesToFit(shrinksStandaloneImagesToFit); - settings->setTextAreasAreResizable(textAreasAreResizable); - settings->setUserStyleSheetLocation(userStyleSheetLocation); - settings->setUsesPageCache(usesPageCache); - settings->setPageCacheSupportsPlugins(pageCacheSupportsPlugins); - settings->setWebSecurityEnabled(webSecurityEnabled); - settings->setAllowUniversalAccessFromFileURLs(allowUniversalAccessFromFileURLs); - settings->setEditingBehavior(editingBehavior); - settings->setHyperlinkAuditingEnabled(hyperlinkAuditingEnabled); - // LayoutTests were written with Safari Mac in mind which does not allow - // tabbing to links by default. - webView->setTabsToLinks(tabsToLinks); - settings->setCaretBrowsingEnabled(caretBrowsingEnabled); - settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); - settings->setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled); - settings->setAcceleratedCompositingForFixedPositionEnabled(acceleratedCompositingForFixedPositionEnabled); - settings->setFixedPositionCreatesStackingContext(acceleratedCompositingForFixedPositionEnabled); - settings->setForceCompositingMode(forceCompositingMode); - settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled); - settings->setDeferred2dCanvasEnabled(deferred2dCanvasEnabled); - settings->setAcceleratedPaintingEnabled(acceleratedPaintingEnabled); - settings->setPerTilePaintingEnabled(perTilePaintingEnabled); - settings->setAcceleratedAnimationEnabled(acceleratedAnimationEnabled); - settings->setDeferredImageDecodingEnabled(deferredImageDecodingEnabled); - settings->setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture); - settings->setMockScrollbarsEnabled(mockScrollbarsEnabled); - settings->setShouldRespectImageOrientation(shouldRespectImageOrientation); - - // Fixed values. - settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); - settings->setDownloadableBinaryFontsEnabled(true); - settings->setAllowScriptsToCloseWindows(false); - settings->setNeedsSiteSpecificQuirks(true); - settings->setEditableLinkBehaviorNeverLive(); - settings->setEnableScrollAnimator(false); - settings->setFontRenderingModeNormal(); - settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); - settings->setUsesEncodingDetector(false); - settings->setImagesEnabled(true); - settings->setInteractiveFormValidationEnabled(true); - // Enable fullscreen so the fullscreen layout tests can run. - settings->setFullScreenEnabled(true); - settings->setValidationMessageTimerMagnification(-1); - settings->setVisualWordMovementEnabled(false); - settings->setPasswordEchoEnabled(false); - settings->setApplyDeviceScaleFactorInCompositor(true); -} diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h deleted file mode 100644 index a17a3cbd2..000000000 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebPreferences_h -#define WebPreferences_h - -#include "WebSettings.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include <wtf/HashMap.h> - -namespace WebKit { -class WebView; -} - -struct WebPreferences { - WebKit::WebString standardFontFamily; - WebKit::WebString fixedFontFamily; - WebKit::WebString serifFontFamily; - WebKit::WebString sansSerifFontFamily; - WebKit::WebString cursiveFontFamily; - WebKit::WebString fantasyFontFamily; - - // UScriptCode uses -1 and 0 for UScriptInvalidCode and UScriptCommon. - // We need to use -2 and -3 for empty value and deleted value. - // (See WebCore::ScriptFontFamilyMap) - struct UScriptCodeHashTraits : WTF::GenericHashTraits<int> { - static const bool emptyValueIsZero = false; - static int emptyValue() { return -2; } - static void constructDeletedValue(int& slot) { slot = -3; } - static bool isDeletedValue(int value) { return value == -3; } - }; - - // Map of UScriptCode to font such as USCRIPT_ARABIC to "My Arabic Font". - typedef HashMap<int, WebKit::WebString, DefaultHash<int>::Hash, UScriptCodeHashTraits> ScriptFontFamilyMap; - ScriptFontFamilyMap standardFontMap; - ScriptFontFamilyMap fixedFontMap; - ScriptFontFamilyMap serifFontMap; - ScriptFontFamilyMap sansSerifFontMap; - ScriptFontFamilyMap cursiveFontMap; - ScriptFontFamilyMap fantasyFontMap; - - int defaultFontSize; - int defaultFixedFontSize; - int minimumFontSize; - int minimumLogicalFontSize; - int minimumAccelerated2dCanvasSize; - - bool DOMPasteAllowed; - bool XSSAuditorEnabled; - bool allowDisplayOfInsecureContent; - bool allowFileAccessFromFileURLs; - bool allowRunningOfInsecureContent; - bool authorAndUserStylesEnabled; - WebKit::WebString defaultTextEncodingName; - bool developerExtrasEnabled; - bool experimentalWebGLEnabled; - bool experimentalCSSRegionsEnabled; - bool experimentalCSSGridLayoutEnabled; - bool javaEnabled; - bool javaScriptCanAccessClipboard; - bool javaScriptCanOpenWindowsAutomatically; - bool supportsMultipleWindows; - bool javaScriptEnabled; - bool loadsImagesAutomatically; - bool localStorageEnabled; - bool offlineWebApplicationCacheEnabled; - bool pluginsEnabled; - bool shrinksStandaloneImagesToFit; - bool textAreasAreResizable; - WebKit::WebURL userStyleSheetLocation; - bool usesPageCache; - bool pageCacheSupportsPlugins; - bool webSecurityEnabled; - bool allowUniversalAccessFromFileURLs; - WebKit::WebSettings::EditingBehavior editingBehavior; - bool tabsToLinks; - bool hyperlinkAuditingEnabled; - bool caretBrowsingEnabled; - bool acceleratedCompositingForVideoEnabled; - bool acceleratedCompositingForFixedPositionEnabled; - bool acceleratedCompositingEnabled; - bool forceCompositingMode; - bool accelerated2dCanvasEnabled; - bool deferred2dCanvasEnabled; - bool acceleratedPaintingEnabled; - bool perTilePaintingEnabled; - bool acceleratedAnimationEnabled; - bool deferredImageDecodingEnabled; - bool mediaPlaybackRequiresUserGesture; - bool mockScrollbarsEnabled; - bool cssCustomFilterEnabled; - bool shouldRespectImageOrientation; - - WebPreferences() { reset(); } - void reset(); - void applyTo(WebKit::WebView*); -}; - -#endif // WebPreferences_h diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp deleted file mode 100755 index 065df4f52..000000000 --- a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This file implements a simple generic version of the WebThemeEngine, -// which is used to draw all the native controls on a web page. We use this -// file when running in layout test mode in order to remove any -// platform-specific rendering differences due to themes, colors, etc. -// - -#include "config.h" -#include "WebThemeControlDRTWin.h" - -#include "skia/ext/skia_utils_win.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkPaint.h" -#include "third_party/skia/include/core/SkPath.h" -#include "third_party/skia/include/core/SkRect.h" - -#include <algorithm> -#include <wtf/Assertions.h> - -using namespace std; - -static const SkColor edgeColor = SK_ColorBLACK; -static const SkColor readOnlyColor = SkColorSetRGB(0xe9, 0xc2, 0xa6); -static const SkColor fgColor = SK_ColorBLACK; -static const SkColor bgColors[] = { - SK_ColorBLACK, // Unknown - SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled - SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly - SkColorSetRGB(0x89, 0xc4, 0xff), // Normal - SkColorSetRGB(0x43, 0xf9, 0xff), // Hot - SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused - SkColorSetRGB(0x00, 0xf3, 0xac), // Hover - SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed - SkColorSetRGB(0xcc, 0xcc, 0xcc) // Indeterminate -}; - -static SkIRect validate(const SkIRect& rect, WebThemeControlDRTWin::Type ctype) -{ - switch (ctype) { - case WebThemeControlDRTWin::UncheckedBoxType: - case WebThemeControlDRTWin::CheckedBoxType: - case WebThemeControlDRTWin::UncheckedRadioType: - case WebThemeControlDRTWin::CheckedRadioType: { - SkIRect retval = rect; - - // The maximum width and height is 13. - // Center the square in the passed rectangle. - const int maxControlSize = 13; - int controlSize = std::min(rect.width(), rect.height()); - controlSize = std::min(controlSize, maxControlSize); - - retval.fLeft = rect.fLeft + (rect.width() / 2) - (controlSize / 2); - retval.fRight = retval.fLeft + controlSize - 1; - retval.fTop = rect.fTop + (rect.height() / 2) - (controlSize / 2); - retval.fBottom = retval.fTop + controlSize - 1; - - return retval; - } - - default: - return rect; - } -} - -// WebThemeControlDRTWin - -WebThemeControlDRTWin::WebThemeControlDRTWin(SkCanvas* canvas, - const SkIRect& irect, - Type ctype, - State cstate) - : m_canvas(canvas) - , m_irect(validate(irect, ctype)) - , m_type(ctype) - , m_state(cstate) - , m_left(m_irect.fLeft) - , m_right(m_irect.fRight) - , m_top(m_irect.fTop) - , m_bottom(m_irect.fBottom) - , m_height(m_irect.height()) - , m_width(m_irect.width()) - , m_edgeColor(edgeColor) - , m_bgColor(bgColors[cstate]) - , m_fgColor(fgColor) -{ -} - -WebThemeControlDRTWin::~WebThemeControlDRTWin() -{ -} - -void WebThemeControlDRTWin::box(const SkIRect& rect, SkColor fillColor) -{ - SkPaint paint; - - paint.setStyle(SkPaint::kFill_Style); - paint.setColor(fillColor); - m_canvas->drawIRect(rect, paint); - - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawIRect(rect, paint); -} - -void WebThemeControlDRTWin::line(int x0, int y0, int x1, int y1, SkColor color) -{ - SkPaint paint; - paint.setColor(color); - m_canvas->drawLine(SkIntToScalar(x0), SkIntToScalar(y0), - SkIntToScalar(x1), SkIntToScalar(y1), - paint); -} - -void WebThemeControlDRTWin::triangle(int x0, int y0, - int x1, int y1, - int x2, int y2, - SkColor color) -{ - SkPath path; - SkPaint paint; - - paint.setColor(color); - paint.setStyle(SkPaint::kFill_Style); - path.incReserve(4); - path.moveTo(SkIntToScalar(x0), SkIntToScalar(y0)); - path.lineTo(SkIntToScalar(x1), SkIntToScalar(y1)); - path.lineTo(SkIntToScalar(x2), SkIntToScalar(y2)); - path.close(); - m_canvas->drawPath(path, paint); - - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawPath(path, paint); -} - -void WebThemeControlDRTWin::roundRect(SkColor color) -{ - SkRect rect; - SkScalar radius = SkIntToScalar(5); - SkPaint paint; - - rect.set(m_irect); - paint.setColor(color); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawRoundRect(rect, radius, radius, paint); - - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawRoundRect(rect, radius, radius, paint); -} - -void WebThemeControlDRTWin::oval(SkColor color) -{ - SkRect rect; - SkPaint paint; - - rect.set(m_irect); - paint.setColor(color); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawOval(rect, paint); - - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawOval(rect, paint); -} - -void WebThemeControlDRTWin::circle(SkScalar radius, SkColor color) -{ - SkScalar cy = SkIntToScalar(m_top + m_height / 2); - SkScalar cx = SkIntToScalar(m_left + m_width / 2); - SkPaint paint; - - paint.setColor(color); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawCircle(cx, cy, radius, paint); - - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawCircle(cx, cy, radius, paint); -} - -void WebThemeControlDRTWin::nestedBoxes(int indentLeft, - int indentTop, - int indentRight, - int indentBottom, - SkColor outerColor, - SkColor innerColor) -{ - SkIRect lirect; - box(m_irect, outerColor); - lirect.set(m_irect.fLeft + indentLeft, - m_irect.fTop + indentTop, - m_irect.fRight - indentRight, - m_irect.fBottom - indentBottom); - box(lirect, innerColor); -} - -void WebThemeControlDRTWin::markState() -{ - // The horizontal lines in a read only control are spaced by this amount. - const int readOnlyLineOffset = 5; - - // The length of a triangle side for the corner marks. - const int triangleSize = 5; - - switch (m_state) { - case UnknownState: - case DisabledState: - case NormalState: - // Don't visually mark these states (color is enough). - break; - case ReadOnlyState: - // Drawing lines across the control. - for (int i = m_top + readOnlyLineOffset; i < m_bottom; i += readOnlyLineOffset) - line(m_left + 1, i, m_right - 1, i, readOnlyColor); - break; - - case HotState: - // Draw a triangle in the upper left corner of the control. - triangle(m_left, m_top, - m_left + triangleSize, m_top, - m_left, m_top + triangleSize, m_edgeColor); - break; - - case HoverState: - // Draw a triangle in the upper right corner of the control. - triangle(m_right, m_top, - m_right, m_top + triangleSize, - m_right - triangleSize, m_top, m_edgeColor); - break; - - case FocusedState: - // Draw a triangle in the bottom right corner of the control. - triangle(m_right, m_bottom, - m_right - triangleSize, m_bottom, - m_right, m_bottom - triangleSize, m_edgeColor); - break; - - case PressedState: - // Draw a triangle in the bottom left corner of the control. - triangle(m_left, m_bottom, - m_left, m_bottom - triangleSize, - m_left + triangleSize, m_bottom, m_edgeColor); - break; - - default: - ASSERT_NOT_REACHED(); - CRASH(); - break; - } -} - -void WebThemeControlDRTWin::draw() -{ - int halfWidth = m_width / 2; - int halfHeight = m_height / 2; - int quarterWidth = m_width / 4; - int quarterHeight = m_height / 4; - - // Indent amounts for the check in a checkbox or radio button. - const int checkIndent = 3; - - // Indent amounts for short and long sides of the scrollbar notches. - const int notchLongOffset = 1; - const int notchShortOffset = 4; - const int noOffset = 0; - - // Indent amounts for the short and long sides of a scroll thumb box. - const int thumbLongIndent = 0; - const int thumbShortIndent = 2; - - // Indents for the crosshatch on a scroll grip. - const int gripLongIndent = 3; - const int gripShortIndent = 5; - - // Indents for the the slider track. - const int sliderIndent = 2; - - switch (m_type) { - case UnknownType: - ASSERT_NOT_REACHED(); - CRASH(); - break; - - case TextFieldType: - // We render this by hand outside of this function. - ASSERT_NOT_REACHED(); - CRASH(); - break; - - case PushButtonType: - // push buttons render as a rounded rectangle - roundRect(m_bgColor); - break; - - case UncheckedBoxType: - // Unchecked boxes are simply plain boxes. - box(m_irect, m_bgColor); - break; - - case CheckedBoxType: - nestedBoxes(checkIndent, checkIndent, checkIndent, checkIndent, m_bgColor, m_fgColor); - break; - - case IndeterminateCheckboxType: - // Indeterminate checkbox is a box containing '-'. - nestedBoxes(checkIndent, halfHeight, checkIndent, halfHeight, m_bgColor, m_fgColor); - break; - - case UncheckedRadioType: - circle(SkIntToScalar(halfHeight), m_bgColor); - break; - - case CheckedRadioType: - circle(SkIntToScalar(halfHeight), m_bgColor); - circle(SkIntToScalar(halfHeight - checkIndent), m_fgColor); - break; - - case HorizontalScrollTrackBackType: { - // Draw a box with a notch at the left. - int longOffset = halfHeight - notchLongOffset; - int shortOffset = m_width - notchShortOffset; - nestedBoxes(noOffset, longOffset, shortOffset, longOffset, m_bgColor, m_edgeColor); - break; - } - - case HorizontalScrollTrackForwardType: { - // Draw a box with a notch at the right. - int longOffset = halfHeight - notchLongOffset; - int shortOffset = m_width - notchShortOffset; - nestedBoxes(shortOffset, longOffset, noOffset, longOffset, m_bgColor, m_fgColor); - break; - } - - case VerticalScrollTrackBackType: { - // Draw a box with a notch at the top. - int longOffset = halfWidth - notchLongOffset; - int shortOffset = m_height - notchShortOffset; - nestedBoxes(longOffset, noOffset, longOffset, shortOffset, m_bgColor, m_fgColor); - break; - } - - case VerticalScrollTrackForwardType: { - // Draw a box with a notch at the bottom. - int longOffset = halfWidth - notchLongOffset; - int shortOffset = m_height - notchShortOffset; - nestedBoxes(longOffset, shortOffset, longOffset, noOffset, m_bgColor, m_fgColor); - break; - } - - case HorizontalScrollThumbType: - // Draw a narrower box on top of the outside box. - nestedBoxes(thumbLongIndent, thumbShortIndent, thumbLongIndent, thumbShortIndent, m_bgColor, m_bgColor); - break; - - case VerticalScrollThumbType: - // Draw a shorter box on top of the outside box. - nestedBoxes(thumbShortIndent, thumbLongIndent, thumbShortIndent, thumbLongIndent, m_bgColor, m_bgColor); - break; - - case HorizontalSliderThumbType: - case VerticalSliderThumbType: - // Slider thumbs are ovals. - oval(m_bgColor); - break; - - case HorizontalScrollGripType: { - // Draw a horizontal crosshatch for the grip. - int longOffset = halfWidth - gripLongIndent; - line(m_left + gripLongIndent, m_top + halfHeight, - m_right - gripLongIndent, m_top + halfHeight, m_fgColor); - line(m_left + longOffset, m_top + gripShortIndent, - m_left + longOffset, m_bottom - gripShortIndent, m_fgColor); - line(m_right - longOffset, m_top + gripShortIndent, - m_right - longOffset, m_bottom - gripShortIndent, m_fgColor); - break; - } - - case VerticalScrollGripType: { - // Draw a vertical crosshatch for the grip. - int longOffset = halfHeight - gripLongIndent; - line(m_left + halfWidth, m_top + gripLongIndent, - m_left + halfWidth, m_bottom - gripLongIndent, m_fgColor); - line(m_left + gripShortIndent, m_top + longOffset, - m_right - gripShortIndent, m_top + longOffset, m_fgColor); - line(m_left + gripShortIndent, m_bottom - longOffset, - m_right - gripShortIndent, m_bottom - longOffset, m_fgColor); - break; - } - - case LeftArrowType: - // Draw a left arrow inside a box. - box(m_irect, m_bgColor); - triangle(m_right - quarterWidth, m_top + quarterHeight, - m_right - quarterWidth, m_bottom - quarterHeight, - m_left + quarterWidth, m_top + halfHeight, m_fgColor); - break; - - case RightArrowType: - // Draw a left arrow inside a box. - box(m_irect, m_bgColor); - triangle(m_left + quarterWidth, m_top + quarterHeight, - m_right - quarterWidth, m_top + halfHeight, - m_left + quarterWidth, m_bottom - quarterHeight, m_fgColor); - break; - - case UpArrowType: - // Draw an up arrow inside a box. - box(m_irect, m_bgColor); - triangle(m_left + quarterWidth, m_bottom - quarterHeight, - m_left + halfWidth, m_top + quarterHeight, - m_right - quarterWidth, m_bottom - quarterHeight, m_fgColor); - break; - - case DownArrowType: - // Draw a down arrow inside a box. - box(m_irect, m_bgColor); - triangle(m_left + quarterWidth, m_top + quarterHeight, - m_right - quarterWidth, m_top + quarterHeight, - m_left + halfWidth, m_bottom - quarterHeight, m_fgColor); - break; - - case HorizontalSliderTrackType: { - // Draw a narrow rect for the track plus box hatches on the ends. - SkIRect lirect; - lirect = m_irect; - lirect.inset(noOffset, halfHeight - sliderIndent); - box(lirect, m_bgColor); - line(m_left, m_top, m_left, m_bottom, m_edgeColor); - line(m_right, m_top, m_right, m_bottom, m_edgeColor); - break; - } - - case VerticalSliderTrackType: { - // Draw a narrow rect for the track plus box hatches on the ends. - SkIRect lirect; - lirect = m_irect; - lirect.inset(halfWidth - sliderIndent, noOffset); - box(lirect, m_bgColor); - line(m_left, m_top, m_right, m_top, m_edgeColor); - line(m_left, m_bottom, m_right, m_bottom, m_edgeColor); - break; - } - - case DropDownButtonType: - // Draw a box with a big down arrow on top. - box(m_irect, m_bgColor); - triangle(m_left + quarterWidth, m_top, - m_right - quarterWidth, m_top, - m_left + halfWidth, m_bottom, m_fgColor); - break; - - default: - ASSERT_NOT_REACHED(); - CRASH(); - break; - } - - markState(); -} - -// Because rendering a text field is dependent on input -// parameters the other controls don't have, we render it directly -// rather than trying to overcomplicate draw() further. -void WebThemeControlDRTWin::drawTextField(bool drawEdges, bool fillContentArea, SkColor color) -{ - SkPaint paint; - - if (fillContentArea) { - paint.setColor(color); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawIRect(m_irect, paint); - } - if (drawEdges) { - paint.setColor(m_edgeColor); - paint.setStyle(SkPaint::kStroke_Style); - m_canvas->drawIRect(m_irect, paint); - } - - markState(); -} - -void WebThemeControlDRTWin::drawProgressBar(const SkIRect& fillRect) -{ - SkPaint paint; - - paint.setColor(m_bgColor); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawIRect(m_irect, paint); - - // Emulate clipping - SkIRect tofill; - tofill.intersect(m_irect, fillRect); - paint.setColor(m_fgColor); - paint.setStyle(SkPaint::kFill_Style); - m_canvas->drawIRect(tofill, paint); - - markState(); -} - diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h deleted file mode 100644 index ef731ab39..000000000 --- a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// WebThemeControlDRTWin implements the generic rendering of controls -// needed by WebThemeEngineDRTWin. See the comments in that class -// header file for why this class is needed and used. -// -// This class implements a generic set of widgets using Skia. The widgets -// are optimized for testability, not a pleasing appearance. -// - -#ifndef WebThemeControlDRTWin_h -#define WebThemeControlDRTWin_h - -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkRect.h" -#include <wtf/Noncopyable.h> - -// Skia forward declarations -class SkCanvas; - -class WebThemeControlDRTWin { - WTF_MAKE_NONCOPYABLE(WebThemeControlDRTWin); -public: - // This list of states mostly mirrors the list in WebCore/platform/ThemeTypes.h - // but is maintained separately since that isn't public and also to minimize - // dependencies. - // Note that the WebKit ThemeTypes seem to imply that a control can be - // in multiple states simultaneously but WebThemeEngine only allows for - // a single state at a time. - // - // Some definitions for the various states: - // Disabled - indicates that a control can't be modified or selected - // (corresponds to HTML 'disabled' attribute) - // ReadOnly - indicates that a control can't be modified but can be - // selected - // Normal - the normal state of control on the page when it isn't - // focused or otherwise active - // Hot - when the mouse is hovering over a part of the control, - // all the other parts are considered "hot" - // Hover - when the mouse is directly over a control (the CSS - // :hover pseudo-class) - // Focused - when the control has the keyboard focus - // Pressed - when the control is being triggered (by a mousedown or - // a key event). - // Indeterminate - when set to indeterminate (only for progress bar) - enum State { - UnknownState = 0, - DisabledState, - ReadOnlyState, - NormalState, - HotState, - HoverState, - FocusedState, - PressedState, - IndeterminateState - }; - - // This list of types mostly mirrors the list in - // WebCore/platform/ThemeTypes.h but is maintained - // separately since that isn't public and also to minimize dependencies. - // - // Note that what the user might think of as a single control can be - // made up of multiple parts. For example, a single scroll bar contains - // six clickable parts - two arrows, the "thumb" indicating the current - // position on the bar, the other two parts of the bar (before and after - // the thumb) and the "gripper" on the thumb itself. - // - enum Type { - UnknownType = 0, - TextFieldType, - PushButtonType, - UncheckedBoxType, - CheckedBoxType, - IndeterminateCheckboxType, - UncheckedRadioType, - CheckedRadioType, - HorizontalScrollTrackBackType, - HorizontalScrollTrackForwardType, - HorizontalScrollThumbType, - HorizontalScrollGripType, - VerticalScrollTrackBackType, - VerticalScrollTrackForwardType, - VerticalScrollThumbType, - VerticalScrollGripType, - LeftArrowType, - RightArrowType, - UpArrowType, - DownArrowType, - HorizontalSliderTrackType, - HorizontalSliderThumbType, - VerticalSliderTrackType, - VerticalSliderThumbType, - DropDownButtonType, - ProgressBarType - }; - - // Constructs a control of the given size, type and state to draw - // on to the given canvas. - WebThemeControlDRTWin(SkCanvas*, const SkIRect&, Type, State); - ~WebThemeControlDRTWin(); - - // Draws the control. - void draw(); - - // Use this for TextField controls instead, because the logic - // for drawing them is dependent on what WebKit tells us to do. - // If drawEdges is true, draw an edge around the control. If - // fillContentArea is true, fill the content area with the given color. - void drawTextField(bool drawEdges, bool fillContentArea, SkColor); - - // Use this for drawing ProgressBar controls instead, since we - // need to know the rect to fill inside the bar. - void drawProgressBar(const SkIRect& fillRect); - -private: - // Draws a box of size specified by irect, filled with the given color. - // The box will have a border drawn in the default edge color. - void box(const SkIRect& irect, SkColor); - - - // Draws a triangle of size specified by the three pairs of coordinates, - // filled with the given color. The box will have an edge drawn in the - // default edge color. - void triangle(int x0, int y0, int x1, int y1, int x2, int y2, SkColor); - - // Draws a rectangle the size of the control with rounded corners, filled - // with the specified color (and with a border in the default edge color). - void roundRect(SkColor); - - // Draws an oval the size of the control, filled with the specified color - // and with a border in the default edge color. - void oval(SkColor); - - // Draws a circle centered in the control with the specified radius, - // filled with the specified color, and with a border draw in the - // default edge color. - void circle(SkScalar radius, SkColor); - - // Draws a box the size of the control, filled with the outerColor and - // with a border in the default edge color, and then draws another box - // indented on all four sides by the specified amounts, filled with the - // inner color and with a border in the default edge color. - void nestedBoxes(int indentLeft, - int indentTop, - int indentRight, - int indentBottom, - SkColor outerColor, - SkColor innerColor); - - // Draws a line between the two points in the given color. - void line(int x0, int y0, int x1, int y1, SkColor); - - // Draws a distinctive mark on the control for each state, so that the - // state of the control can be determined without needing to know which - // color is which. - void markState(); - - SkCanvas* m_canvas; - const SkIRect m_irect; - const Type m_type; - const State m_state; - const SkColor m_edgeColor; - const SkColor m_bgColor; - const SkColor m_fgColor; - - // The following are convenience accessors for m_irect. - const int m_left; - const int m_right; - const int m_top; - const int m_bottom; - const int m_width; - const int m_height; -}; - -#endif // WebThemeControlDRTWin_h diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm deleted file mode 100644 index 6f9c4b66d..000000000 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "WebThemeEngineDRTMac.h" - -#include "skia/ext/skia_utils_mac.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" -#import <AppKit/NSAffineTransform.h> -#import <AppKit/NSGraphicsContext.h> -#import <AppKit/NSScroller.h> -#import <AppKit/NSWindow.h> -#include <Carbon/Carbon.h> - -using WebKit::WebCanvas; -using WebKit::WebRect; -using WebKit::WebThemeEngine; - -// We can't directly tell the NSScroller to draw itself as active or inactive, -// instead we have to make it a child of an (in)active window. This class lets -// us fake that parent window. -@interface FakeActiveWindow : NSWindow { -@private - BOOL hasActiveControls; -} -+ (NSWindow*)alwaysActiveWindow; -+ (NSWindow*)alwaysInactiveWindow; -- (id)initWithActiveControls:(BOOL)_hasActiveControls; -- (BOOL)_hasActiveControls; -@end - -@implementation FakeActiveWindow - -static NSWindow* alwaysActiveWindow = nil; -static NSWindow* alwaysInactiveWindow = nil; - -+ (NSWindow*)alwaysActiveWindow -{ - if (alwaysActiveWindow == nil) - alwaysActiveWindow = [[self alloc] initWithActiveControls:YES]; - return alwaysActiveWindow; -} - -+ (NSWindow*)alwaysInactiveWindow -{ - if (alwaysInactiveWindow == nil) - alwaysInactiveWindow = [[self alloc] initWithActiveControls:NO]; - return alwaysInactiveWindow; -} - -- (id)initWithActiveControls:(BOOL)_hasActiveControls -{ - self = [super init]; - hasActiveControls = _hasActiveControls; - return self; -} - -- (BOOL)_hasActiveControls -{ - return hasActiveControls; -} - -@end - -void WebThemeEngineDRTMac::paintScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) -{ - // To match the Mac port, we still use HITheme for inner scrollbars. - if (scrollbarInfo.parent == WebThemeEngine::ScrollbarParentRenderLayer) - paintHIThemeScrollbarThumb(canvas, state, size, rect, scrollbarInfo); - else - paintNSScrollerScrollbarThumb(canvas, state, size, rect, scrollbarInfo); -} - -static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) -{ - switch (state) { - case WebThemeEngine::StateDisabled: - return kThemeTrackDisabled; - case WebThemeEngine::StateInactive: - return kThemeTrackInactive; - default: - return kThemeTrackActive; - } -} - -// Duplicated from webkit/glue/webthemeengine_impl_mac.cc in the downstream -// Chromium WebThemeEngine implementation. -void WebThemeEngineDRTMac::paintHIThemeScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) -{ - HIThemeTrackDrawInfo trackInfo; - trackInfo.version = 0; - trackInfo.kind = size == WebThemeEngine::SizeRegular ? kThemeMediumScrollBar : kThemeSmallScrollBar; - trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height); - trackInfo.min = 0; - trackInfo.max = scrollbarInfo.maxValue; - trackInfo.value = scrollbarInfo.currentValue; - trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize; - trackInfo.attributes = 0; - if (scrollbarInfo.orientation == WebThemeEngine::ScrollbarOrientationHorizontal) - trackInfo.attributes |= kThemeTrackHorizontal; - - trackInfo.enableState = stateToHIEnableState(state); - - trackInfo.trackInfo.scrollbar.pressState = - state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; - trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); -} - -void WebThemeEngineDRTMac::paintNSScrollerScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) -{ - [NSGraphicsContext saveGraphicsState]; - NSScroller* scroller = [[NSScroller alloc] initWithFrame:NSMakeRect(rect.x, rect.y, rect.width, rect.height)]; - [scroller setEnabled:state != WebThemeEngine::StateDisabled]; - if (state == WebThemeEngine::StateInactive) - [[[FakeActiveWindow alwaysInactiveWindow] contentView] addSubview:scroller]; - else - [[[FakeActiveWindow alwaysActiveWindow] contentView] addSubview:scroller]; - - [scroller setControlSize:size == WebThemeEngine::SizeRegular ? NSRegularControlSize : NSSmallControlSize]; - - double value = double(scrollbarInfo.currentValue) / double(scrollbarInfo.maxValue); - [scroller setDoubleValue: value]; - - float knobProportion = float(scrollbarInfo.visibleSize) / float(scrollbarInfo.totalSize); - [scroller setKnobProportion: knobProportion]; - - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - NSGraphicsContext* nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]; - [NSGraphicsContext setCurrentContext:nsGraphicsContext]; - - // Despite passing in frameRect() to the scroller, it always draws at (0, 0). - // Force it to draw in the right location by translating the whole graphics - // context. - CGContextSaveGState(cgContext); - NSAffineTransform *transform = [NSAffineTransform transform]; - [transform translateXBy:rect.x yBy:rect.y]; - [transform concat]; - - [scroller drawKnob]; - CGContextRestoreGState(cgContext); - - [scroller release]; - - [NSGraphicsContext restoreGraphicsState]; -} diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp deleted file mode 100755 index db8c38b7b..000000000 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp +++ /dev/null @@ -1,793 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebThemeEngineDRTWin.h" - -#include "platform/WebRect.h" -#include "WebThemeControlDRTWin.h" -#include "third_party/skia/include/core/SkRect.h" - -// Although all this code is generic, we include these headers -// to pull in the Windows #defines for the parts and states of -// the controls. -#include <vsstyle.h> -#include <windows.h> - -#include <wtf/Assertions.h> - -using namespace WebKit; - -// We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h. -static const int dfcsNormal = 0x0000; - -static SkIRect webRectToSkIRect(const WebRect& webRect) -{ - SkIRect irect; - irect.set(webRect.x, webRect.y, webRect.x + webRect.width - 1, webRect.y + webRect.height - 1); - return irect; -} - -static void drawControl(WebCanvas* canvas, - const WebRect& rect, - WebThemeControlDRTWin::Type ctype, - WebThemeControlDRTWin::State cstate) -{ - WebThemeControlDRTWin control(canvas, webRectToSkIRect(rect), ctype, cstate); - control.draw(); -} - -static void drawTextField(WebCanvas* canvas, - const WebRect& rect, - WebThemeControlDRTWin::Type ctype, - WebThemeControlDRTWin::State cstate, - bool drawEdges, - bool fillContentArea, - WebColor color) -{ - WebThemeControlDRTWin control(canvas, webRectToSkIRect(rect), ctype, cstate); - control.drawTextField(drawEdges, fillContentArea, color); -} - -static void drawProgressBar(WebCanvas* canvas, - WebThemeControlDRTWin::Type ctype, - WebThemeControlDRTWin::State cstate, - const WebRect& barRect, - const WebRect& fillRect) -{ - WebThemeControlDRTWin control(canvas, webRectToSkIRect(barRect), ctype, cstate); - control.drawProgressBar(webRectToSkIRect(fillRect)); -} - -// WebThemeEngineDRTWin - -void WebThemeEngineDRTWin::paintButton(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - if (part == BP_CHECKBOX) { - switch (state) { - case CBS_UNCHECKEDNORMAL: - ASSERT(classicState == dfcsNormal); - ctype = WebThemeControlDRTWin::UncheckedBoxType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case CBS_UNCHECKEDHOT: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT)); - ctype = WebThemeControlDRTWin::UncheckedBoxType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case CBS_UNCHECKEDPRESSED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::UncheckedBoxType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case CBS_UNCHECKEDDISABLED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::UncheckedBoxType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case CBS_CHECKEDNORMAL: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED)); - ctype = WebThemeControlDRTWin::CheckedBoxType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case CBS_CHECKEDHOT: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT)); - ctype = WebThemeControlDRTWin::CheckedBoxType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case CBS_CHECKEDPRESSED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::CheckedBoxType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case CBS_CHECKEDDISABLED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::CheckedBoxType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case CBS_MIXEDNORMAL: - // Classic theme can't represent mixed state checkbox. We assume - // it's equivalent to unchecked. - ASSERT(classicState == DFCS_BUTTONCHECK); - ctype = WebThemeControlDRTWin::IndeterminateCheckboxType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case CBS_MIXEDHOT: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT)); - ctype = WebThemeControlDRTWin::IndeterminateCheckboxType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case CBS_MIXEDPRESSED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::IndeterminateCheckboxType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case CBS_MIXEDDISABLED: - ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::IndeterminateCheckboxType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - } else if (BP_RADIOBUTTON == part) { - switch (state) { - case RBS_UNCHECKEDNORMAL: - ASSERT(classicState == DFCS_BUTTONRADIO); - ctype = WebThemeControlDRTWin::UncheckedRadioType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case RBS_UNCHECKEDHOT: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT)); - ctype = WebThemeControlDRTWin::UncheckedRadioType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case RBS_UNCHECKEDPRESSED: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::UncheckedRadioType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case RBS_UNCHECKEDDISABLED: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::UncheckedRadioType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case RBS_CHECKEDNORMAL: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED)); - ctype = WebThemeControlDRTWin::CheckedRadioType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case RBS_CHECKEDHOT: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_HOT)); - ctype = WebThemeControlDRTWin::CheckedRadioType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case RBS_CHECKEDPRESSED: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::CheckedRadioType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case RBS_CHECKEDDISABLED: - ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::CheckedRadioType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - } else if (BP_PUSHBUTTON == part) { - switch (state) { - case PBS_NORMAL: - ASSERT(classicState == DFCS_BUTTONPUSH); - ctype = WebThemeControlDRTWin::PushButtonType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case PBS_HOT: - ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT)); - ctype = WebThemeControlDRTWin::PushButtonType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case PBS_PRESSED: - ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED)); - ctype = WebThemeControlDRTWin::PushButtonType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case PBS_DISABLED: - ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::PushButtonType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case PBS_DEFAULTED: - ASSERT(classicState == DFCS_BUTTONPUSH); - ctype = WebThemeControlDRTWin::PushButtonType; - cstate = WebThemeControlDRTWin::FocusedState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - } else - ASSERT_NOT_REACHED(); - - drawControl(canvas, rect, ctype, cstate); -} - - -void WebThemeEngineDRTWin::paintMenuList(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - if (CP_DROPDOWNBUTTON == part) { - ctype = WebThemeControlDRTWin::DropDownButtonType; - switch (state) { - case CBXS_NORMAL: - ASSERT(classicState == DFCS_MENUARROW); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case CBXS_HOT: - ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT)); - cstate = WebThemeControlDRTWin::HoverState; - break; - - case CBXS_PRESSED: - ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED)); - cstate = WebThemeControlDRTWin::PressedState; - break; - - case CBXS_DISABLED: - ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE)); - cstate = WebThemeControlDRTWin::DisabledState; - break; - - default: - CRASH(); - break; - } - } else - CRASH(); - - drawControl(canvas, rect, ctype, cstate); -} - -void WebThemeEngineDRTWin::paintScrollbarArrow(WebCanvas* canvas, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - switch (state) { - case ABS_UPNORMAL: - ASSERT(classicState == DFCS_SCROLLUP); - ctype = WebThemeControlDRTWin::UpArrowType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case ABS_DOWNNORMAL: - ASSERT(classicState == DFCS_SCROLLDOWN); - ctype = WebThemeControlDRTWin::DownArrowType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case ABS_LEFTNORMAL: - ASSERT(classicState == DFCS_SCROLLLEFT); - ctype = WebThemeControlDRTWin::LeftArrowType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case ABS_RIGHTNORMAL: - ASSERT(classicState == DFCS_SCROLLRIGHT); - ctype = WebThemeControlDRTWin::RightArrowType; - cstate = WebThemeControlDRTWin::NormalState; - break; - - case ABS_UPHOT: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT)); - ctype = WebThemeControlDRTWin::UpArrowType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case ABS_DOWNHOT: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT)); - ctype = WebThemeControlDRTWin::DownArrowType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case ABS_LEFTHOT: - ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT)); - ctype = WebThemeControlDRTWin::LeftArrowType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case ABS_RIGHTHOT: - ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT)); - ctype = WebThemeControlDRTWin::RightArrowType; - cstate = WebThemeControlDRTWin::HotState; - break; - - case ABS_UPHOVER: - ASSERT(classicState == DFCS_SCROLLUP); - ctype = WebThemeControlDRTWin::UpArrowType; - cstate = WebThemeControlDRTWin::HoverState; - break; - - case ABS_DOWNHOVER: - ASSERT(classicState == DFCS_SCROLLDOWN); - ctype = WebThemeControlDRTWin::DownArrowType; - cstate = WebThemeControlDRTWin::HoverState; - break; - - case ABS_LEFTHOVER: - ASSERT(classicState == DFCS_SCROLLLEFT); - ctype = WebThemeControlDRTWin::LeftArrowType; - cstate = WebThemeControlDRTWin::HoverState; - break; - - case ABS_RIGHTHOVER: - ASSERT(classicState == DFCS_SCROLLRIGHT); - ctype = WebThemeControlDRTWin::RightArrowType; - cstate = WebThemeControlDRTWin::HoverState; - break; - - case ABS_UPPRESSED: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT)); - ctype = WebThemeControlDRTWin::UpArrowType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case ABS_DOWNPRESSED: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT)); - ctype = WebThemeControlDRTWin::DownArrowType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case ABS_LEFTPRESSED: - ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT)); - ctype = WebThemeControlDRTWin::LeftArrowType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case ABS_RIGHTPRESSED: - ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT)); - ctype = WebThemeControlDRTWin::RightArrowType; - cstate = WebThemeControlDRTWin::PressedState; - break; - - case ABS_UPDISABLED: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::UpArrowType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case ABS_DOWNDISABLED: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::DownArrowType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case ABS_LEFTDISABLED: - ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::LeftArrowType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case ABS_RIGHTDISABLED: - ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE)); - ctype = WebThemeControlDRTWin::RightArrowType; - cstate = WebThemeControlDRTWin::DisabledState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - - drawControl(canvas, rect, ctype, cstate); -} - -void WebThemeEngineDRTWin::paintScrollbarThumb(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - switch (part) { - case SBP_THUMBBTNHORZ: - ctype = WebThemeControlDRTWin::HorizontalScrollThumbType; - break; - - case SBP_THUMBBTNVERT: - ctype = WebThemeControlDRTWin::VerticalScrollThumbType; - break; - - case SBP_GRIPPERHORZ: - ctype = WebThemeControlDRTWin::HorizontalScrollGripType; - break; - - case SBP_GRIPPERVERT: - ctype = WebThemeControlDRTWin::VerticalScrollGripType; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - - switch (state) { - case SCRBS_NORMAL: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case SCRBS_HOT: - ASSERT(classicState == DFCS_HOT); - cstate = WebThemeControlDRTWin::HotState; - break; - - case SCRBS_HOVER: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::HoverState; - break; - - case SCRBS_PRESSED: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::PressedState; - break; - - case SCRBS_DISABLED: - ASSERT_NOT_REACHED(); // This should never happen in practice. - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - - drawControl(canvas, rect, ctype, cstate); -} - -void WebThemeEngineDRTWin::paintScrollbarTrack(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect, - const WebRect& alignRect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - switch (part) { - case SBP_UPPERTRACKHORZ: - ctype = WebThemeControlDRTWin::HorizontalScrollTrackBackType; - break; - - case SBP_LOWERTRACKHORZ: - ctype = WebThemeControlDRTWin::HorizontalScrollTrackForwardType; - break; - - case SBP_UPPERTRACKVERT: - ctype = WebThemeControlDRTWin::VerticalScrollTrackBackType; - break; - - case SBP_LOWERTRACKVERT: - ctype = WebThemeControlDRTWin::VerticalScrollTrackForwardType; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - - switch (state) { - case SCRBS_NORMAL: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case SCRBS_HOT: - ASSERT_NOT_REACHED(); // This should never happen in practice. - break; - - case SCRBS_HOVER: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::HoverState; - break; - - case SCRBS_PRESSED: - ASSERT_NOT_REACHED(); // This should never happen in practice. - break; - - case SCRBS_DISABLED: - ASSERT(classicState == DFCS_INACTIVE); - cstate = WebThemeControlDRTWin::DisabledState; - break; - - default: - CRASH(); - break; - } - - drawControl(canvas, rect, ctype, cstate); -} - -void WebThemeEngineDRTWin::paintSpinButton(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - if (part == SPNP_UP) { - ctype = WebThemeControlDRTWin::UpArrowType; - switch (state) { - case UPS_NORMAL: - ASSERT(classicState == DFCS_SCROLLUP); - cstate = WebThemeControlDRTWin::NormalState; - break; - case UPS_DISABLED: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE)); - cstate = WebThemeControlDRTWin::DisabledState; - break; - case UPS_PRESSED: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED)); - cstate = WebThemeControlDRTWin::PressedState; - break; - case UPS_HOT: - ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT)); - cstate = WebThemeControlDRTWin::HoverState; - break; - default: - ASSERT_NOT_REACHED(); - } - } else if (part == SPNP_DOWN) { - ctype = WebThemeControlDRTWin::DownArrowType; - switch (state) { - case DNS_NORMAL: - ASSERT(classicState == DFCS_SCROLLDOWN); - cstate = WebThemeControlDRTWin::NormalState; - break; - case DNS_DISABLED: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE)); - cstate = WebThemeControlDRTWin::DisabledState; - break; - case DNS_PRESSED: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED)); - cstate = WebThemeControlDRTWin::PressedState; - break; - case DNS_HOT: - ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT)); - cstate = WebThemeControlDRTWin::HoverState; - break; - default: - ASSERT_NOT_REACHED(); - } - } else - ASSERT_NOT_REACHED(); - drawControl(canvas, rect, ctype, cstate); -} - -void WebThemeEngineDRTWin::paintTextField(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect, - WebColor color, - bool fillContentArea, - bool drawEdges) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - ASSERT(EP_EDITTEXT == part); - ctype = WebThemeControlDRTWin::TextFieldType; - - switch (state) { - case ETS_NORMAL: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case ETS_HOT: - ASSERT(classicState == DFCS_HOT); - cstate = WebThemeControlDRTWin::HotState; - break; - - case ETS_DISABLED: - ASSERT(classicState == DFCS_INACTIVE); - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case ETS_SELECTED: - ASSERT(classicState == DFCS_PUSHED); - cstate = WebThemeControlDRTWin::PressedState; - break; - - case ETS_FOCUSED: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::FocusedState; - break; - - case ETS_READONLY: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::ReadOnlyState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - - drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color); -} - -void WebThemeEngineDRTWin::paintTrackbar(WebCanvas* canvas, - int part, - int state, - int classicState, - const WebRect& rect) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType; - WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState; - - if (TKP_THUMBBOTTOM == part) { - ctype = WebThemeControlDRTWin::HorizontalSliderThumbType; - switch (state) { - case TUS_NORMAL: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case TUS_HOT: - ASSERT(classicState == DFCS_HOT); - cstate = WebThemeControlDRTWin::HotState; - break; - - case TUS_DISABLED: - ASSERT(classicState == DFCS_INACTIVE); - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case TUS_PRESSED: - ASSERT(classicState == DFCS_PUSHED); - cstate = WebThemeControlDRTWin::PressedState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - } else if (TKP_THUMBVERT == part) { - ctype = WebThemeControlDRTWin::VerticalSliderThumbType; - switch (state) { - case TUS_NORMAL: - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - break; - - case TUS_HOT: - ASSERT(classicState == DFCS_HOT); - cstate = WebThemeControlDRTWin::HotState; - break; - - case TUS_DISABLED: - ASSERT(classicState == DFCS_INACTIVE); - cstate = WebThemeControlDRTWin::DisabledState; - break; - - case TUS_PRESSED: - ASSERT(classicState == DFCS_PUSHED); - cstate = WebThemeControlDRTWin::PressedState; - break; - - default: - ASSERT_NOT_REACHED(); - break; - } - } else if (TKP_TRACK == part) { - ctype = WebThemeControlDRTWin::HorizontalSliderTrackType; - ASSERT(state == TRS_NORMAL); - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - } else if (TKP_TRACKVERT == part) { - ctype = WebThemeControlDRTWin::VerticalSliderTrackType; - ASSERT(state == TRVS_NORMAL); - ASSERT(classicState == dfcsNormal); - cstate = WebThemeControlDRTWin::NormalState; - } else - ASSERT_NOT_REACHED(); - - drawControl(canvas, rect, ctype, cstate); -} - - -void WebThemeEngineDRTWin::paintProgressBar(WebKit::WebCanvas* canvas, - const WebKit::WebRect& barRect, - const WebKit::WebRect& valueRect, - bool determinate, - double) -{ - WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::ProgressBarType; - WebThemeControlDRTWin::State cstate = determinate ? WebThemeControlDRTWin::NormalState - : WebThemeControlDRTWin::IndeterminateState; - drawProgressBar(canvas, ctype, cstate, barRect, valueRect); -} - - -WebKit::WebSize WebThemeEngineDRTWin::getSize(int part) -{ - return WebKit::WebSize(); -} - diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h deleted file mode 100644 index 33fd6126a..000000000 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This implements the WebThemeEngine API used by the Windows version of -// Chromium to render native form controls like checkboxes, radio buttons, -// and scroll bars. -// The normal implementation (native_theme) renders the controls using either -// the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic" -// theme used if that theme is selected in the Desktop settings. -// Unfortunately, both of these themes render controls differently on the -// different versions of Windows. -// -// In order to ensure maximum consistency of baselines across the different -// Windows versions, we provide a simple implementation for DRT here -// instead. These controls are actually platform-independent (they're rendered -// using Skia) and could be used on Linux and the Mac as well, should we -// choose to do so at some point. -// - -#ifndef WebThemeEngineDRTWin_h -#define WebThemeEngineDRTWin_h - -#include "platform/win/WebThemeEngine.h" -#include <wtf/Noncopyable.h> - -class WebThemeEngineDRTWin : public WebKit::WebThemeEngine { - WTF_MAKE_NONCOPYABLE(WebThemeEngineDRTWin); -public: - WebThemeEngineDRTWin() { } - - // WebThemeEngine methods: - virtual void paintButton( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintMenuList( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintScrollbarArrow( - WebKit::WebCanvas*, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintScrollbarThumb( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintScrollbarTrack( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&, const WebKit::WebRect& alignRect); - - virtual void paintSpinButton( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintTextField( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&, WebKit::WebColor, bool fillContentArea, - bool drawEdges); - - virtual void paintTrackbar( - WebKit::WebCanvas*, int part, int state, int classicState, - const WebKit::WebRect&); - - virtual void paintProgressBar( - WebKit::WebCanvas*, const WebKit::WebRect& barRect, - const WebKit::WebRect& valueRect, - bool determinate, double time); - - virtual WebKit::WebSize getSize(int part); -}; - -#endif // WebThemeEngineDRTWin_h diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp deleted file mode 100644 index 3878ff167..000000000 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#if ENABLE(MEDIA_STREAM) - -#include "WebUserMediaClientMock.h" - -#include "MockConstraints.h" -#include "Task.h" -#include "WebDocument.h" -#include "WebMediaStreamRegistry.h" -#include "WebUserMediaRequest.h" -#include <public/WebMediaConstraints.h> -#include <public/WebMediaStreamDescriptor.h> -#include <public/WebMediaStreamSource.h> -#include <public/WebVector.h> -#include <wtf/Assertions.h> - -using namespace WebKit; -using namespace WebTestRunner; - -class UserMediaRequestTask : public WebMethodTask<WebUserMediaClientMock> { -public: - UserMediaRequestTask(WebUserMediaClientMock* object, const WebUserMediaRequest& request, const WebMediaStreamDescriptor result) - : WebMethodTask<WebUserMediaClientMock>(object) - , m_request(request) - , m_result(result) - { - } - - virtual void runIfValid() OVERRIDE - { - if (m_result.isNull()) - m_request.requestFailed(); - else - m_request.requestSucceeded(m_result); - } - -private: - WebUserMediaRequest m_request; - WebMediaStreamDescriptor m_result; -}; - -//////////////////////////////// - -class MockExtraData : public WebMediaStreamDescriptor::ExtraData { -public: - int foo; -}; - -PassOwnPtr<WebUserMediaClientMock> WebUserMediaClientMock::create() -{ - return adoptPtr(new WebUserMediaClientMock()); -} - -void WebUserMediaClientMock::requestUserMedia(const WebUserMediaRequest& streamRequest, const WebVector<WebMediaStreamSource>& audioSourcesVector, const WebVector<WebMediaStreamSource>& videoSourcesVector) -{ - ASSERT(!streamRequest.isNull()); - WebUserMediaRequest request = streamRequest; - - if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) { - postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); - return; - } - - WebMediaConstraints constraints = request.audioConstraints(); - if (!constraints.isNull() && !MockConstraints::verifyConstraints(constraints)) { - postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); - return; - } - constraints = request.videoConstraints(); - if (!constraints.isNull() && !MockConstraints::verifyConstraints(constraints)) { - postTask(new UserMediaRequestTask(this, request, WebMediaStreamDescriptor())); - return; - } - - const size_t zero = 0; - const size_t one = 1; - WebVector<WebMediaStreamSource> audioSources(request.audio() ? one : zero); - WebVector<WebMediaStreamSource> videoSources(request.video() ? one : zero); - - if (request.audio()) - audioSources[0].initialize("MockAudioDevice#1", WebMediaStreamSource::TypeAudio, "Mock audio device"); - - if (request.video()) - videoSources[0].initialize("MockVideoDevice#1", WebMediaStreamSource::TypeVideo, "Mock video device"); - - WebMediaStreamDescriptor stream; - stream.initialize("foobar", audioSources, videoSources); - - stream.setExtraData(new MockExtraData()); - - postTask(new UserMediaRequestTask(this, request, stream)); -} - -void WebUserMediaClientMock::cancelUserMediaRequest(const WebUserMediaRequest&) -{ -} - -#endif // ENABLE(MEDIA_STREAM) diff --git a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h b/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h deleted file mode 100644 index ef4cb51d1..000000000 --- a/Tools/DumpRenderTree/chromium/WebUserMediaClientMock.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebUserMediaClientMock_h -#define WebUserMediaClientMock_h - -#if ENABLE(MEDIA_STREAM) - -#include "WebTask.h" -#include "WebUserMediaClient.h" -#include "webkit/support/test_media_stream_client.h" -#include <public/WebCommon.h> -#include <public/WebString.h> -#include <public/WebURL.h> -#include <wtf/PassOwnPtr.h> - -class WebUserMediaClientMock : public WebKit::WebUserMediaClient { -public: - static PassOwnPtr<WebUserMediaClientMock> create(); - ~WebUserMediaClientMock() { } - - virtual void requestUserMedia(const WebKit::WebUserMediaRequest&, const WebKit::WebVector<WebKit::WebMediaStreamSource>&, const WebKit::WebVector<WebKit::WebMediaStreamSource>&) OVERRIDE; - virtual void cancelUserMediaRequest(const WebKit::WebUserMediaRequest&); - - // Task related methods - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - -private: - WebUserMediaClientMock() { } - - WebTestRunner::WebTaskList m_taskList; -}; - -#endif // ENABLE(MEDIA_STREAM) - -#endif // WebUserMediaClientMock_h diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp deleted file mode 100644 index bc5f9942b..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ /dev/null @@ -1,1874 +0,0 @@ -/* - * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebViewHost.h" - -#include "DRTTestRunner.h" -#include "MockGrammarCheck.h" -#include "MockWebSpeechInputController.h" -#include "MockWebSpeechRecognizer.h" -#include "Task.h" -#include "TestNavigationController.h" -#include "TestShell.h" -#include "TestWebPlugin.h" -#include "WebCachedURLRequest.h" -#include "WebConsoleMessage.h" -#include "WebContextMenuData.h" -#include "WebDOMMessageEvent.h" -#include "WebDataSource.h" -#include "WebDeviceOrientationClientMock.h" -#include "WebDocument.h" -#include "WebElement.h" -#include "WebEventSender.h" -#include "WebFrame.h" -#include "WebGeolocationClientMock.h" -#include "WebHistoryItem.h" -#include "WebIntent.h" -#include "WebIntentServiceInfo.h" -#include "WebKit.h" -#include "WebNode.h" -#include "WebPluginParams.h" -#include "WebPopupMenu.h" -#include "WebPopupType.h" -#include "WebPrintParams.h" -#include "WebRange.h" -#include "WebScreenInfo.h" -#include "WebStorageNamespace.h" -#include "WebTextCheckingCompletion.h" -#include "WebTextCheckingResult.h" -#include "WebUserMediaClientMock.h" -#include "WebView.h" -#include "WebViewHostOutputSurface.h" -#include "WebViewHostSoftwareOutputDevice.h" -#include "WebWindowFeatures.h" -#include "platform/WebSerializedScriptValue.h" -#include "skia/ext/platform_canvas.h" -#include "webkit/support/test_media_stream_client.h" -#include "webkit/support/webkit_support.h" -#include <public/WebCString.h> -#include <public/WebCompositorOutputSurface.h> -#include <public/WebDragData.h> -#include <public/WebRect.h> -#include <public/WebSize.h> -#include <public/WebThread.h> -#include <public/WebURLRequest.h> -#include <public/WebURLResponse.h> - -#include <wtf/Assertions.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -using namespace WebCore; -using namespace WebKit; -using namespace WebTestRunner; -using namespace std; - -static const int screenWidth = 1920; -static const int screenHeight = 1080; -static const int screenUnavailableBorder = 8; - -// WebNavigationType debugging strings taken from PolicyDelegate.mm. -static const char* linkClickedString = "link clicked"; -static const char* formSubmittedString = "form submitted"; -static const char* backForwardString = "back/forward"; -static const char* reloadString = "reload"; -static const char* formResubmittedString = "form resubmitted"; -static const char* otherString = "other"; -static const char* illegalString = "illegal value"; - -static int nextPageID = 1; - -// Used to write a platform neutral file:/// URL by only taking the filename -// (e.g., converts "file:///tmp/foo.txt" to just "foo.txt"). -static string urlSuitableForTestResult(const string& url) -{ - if (url.empty() || string::npos == url.find("file://")) - return url; - - size_t pos = url.rfind('/'); - if (pos == string::npos) { -#if OS(WINDOWS) - pos = url.rfind('\\'); - if (pos == string::npos) - pos = 0; -#else - pos = 0; -#endif - } - string filename = url.substr(pos + 1); - if (filename.empty()) - return "file:"; // A WebKit test has this in its expected output. - return filename; -} - -// Used to write a platform neutral file:/// URL by taking the -// filename and its directory. (e.g., converts -// "file:///tmp/foo/bar.txt" to just "bar.txt"). -static string descriptionSuitableForTestResult(const string& url) -{ - if (url.empty() || string::npos == url.find("file://")) - return url; - - size_t pos = url.rfind('/'); - if (pos == string::npos || !pos) - return "ERROR:" + url; - pos = url.rfind('/', pos - 1); - if (pos == string::npos) - return "ERROR:" + url; - - return url.substr(pos + 1); -} - -// Get a debugging string from a WebNavigationType. -static const char* webNavigationTypeToString(WebNavigationType type) -{ - switch (type) { - case WebKit::WebNavigationTypeLinkClicked: - return linkClickedString; - case WebKit::WebNavigationTypeFormSubmitted: - return formSubmittedString; - case WebKit::WebNavigationTypeBackForward: - return backForwardString; - case WebKit::WebNavigationTypeReload: - return reloadString; - case WebKit::WebNavigationTypeFormResubmitted: - return formResubmittedString; - case WebKit::WebNavigationTypeOther: - return otherString; - } - return illegalString; -} - -static string URLDescription(const GURL& url) -{ - if (url.SchemeIs("file")) - return url.ExtractFileName(); - return url.possibly_invalid_spec(); -} - -static void printResponseDescription(const WebURLResponse& response) -{ - if (response.isNull()) { - fputs("(null)", stdout); - return; - } - string url = response.url().spec(); - printf("<NSURLResponse %s, http status code %d>", - descriptionSuitableForTestResult(url).c_str(), - response.httpStatusCode()); -} - -static void printNodeDescription(const WebNode& node, int exception) -{ - if (exception) { - fputs("ERROR", stdout); - return; - } - if (node.isNull()) { - fputs("(null)", stdout); - return; - } - fputs(node.nodeName().utf8().data(), stdout); - const WebNode& parent = node.parentNode(); - if (!parent.isNull()) { - fputs(" > ", stdout); - printNodeDescription(parent, 0); - } -} - -static void printRangeDescription(const WebRange& range) -{ - if (range.isNull()) { - fputs("(null)", stdout); - return; - } - printf("range from %d of ", range.startOffset()); - int exception = 0; - WebNode startNode = range.startContainer(exception); - printNodeDescription(startNode, exception); - printf(" to %d of ", range.endOffset()); - WebNode endNode = range.endContainer(exception); - printNodeDescription(endNode, exception); -} - -static string editingActionDescription(WebEditingAction action) -{ - switch (action) { - case WebKit::WebEditingActionTyped: - return "WebViewInsertActionTyped"; - case WebKit::WebEditingActionPasted: - return "WebViewInsertActionPasted"; - case WebKit::WebEditingActionDropped: - return "WebViewInsertActionDropped"; - } - return "(UNKNOWN ACTION)"; -} - -static string textAffinityDescription(WebTextAffinity affinity) -{ - switch (affinity) { - case WebKit::WebTextAffinityUpstream: - return "NSSelectionAffinityUpstream"; - case WebKit::WebTextAffinityDownstream: - return "NSSelectionAffinityDownstream"; - } - return "(UNKNOWN AFFINITY)"; -} - -// WebViewClient ------------------------------------------------------------- - -WebView* WebViewHost::createView(WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy) -{ - if (!testRunner()->canOpenWindows()) - return 0; - if (testRunner()->shouldDumpCreateView()) - fprintf(stdout, "createView(%s)\n", URLDescription(request.url()).c_str()); - creator->consumeUserGesture(); - return m_shell->createNewWindow(WebURL())->webView(); -} - -WebWidget* WebViewHost::createPopupMenu(WebPopupType type) -{ - switch (type) { - case WebKit::WebPopupTypeNone: - case WebKit::WebPopupTypePage: - case WebKit::WebPopupTypeHelperPlugin: - break; - case WebKit::WebPopupTypeSelect: - case WebKit::WebPopupTypeSuggestion: - m_popupmenus.append(WebPopupMenu::create(0)); - return m_popupmenus.last(); - } - return 0; -} - -WebWidget* WebViewHost::createPopupMenu(const WebPopupMenuInfo&) -{ - // Do not use this method. It's been replaced by createExternalPopupMenu. - ASSERT_NOT_REACHED(); - return 0; -} - -WebStorageNamespace* WebViewHost::createSessionStorageNamespace(unsigned quota) -{ - return webkit_support::CreateSessionStorageNamespace(quota); -} - -WebCompositorOutputSurface* WebViewHost::createOutputSurface() -{ - if (!webView()) - return 0; - - if (m_shell->softwareCompositingEnabled()) - return WebViewHostOutputSurface::createSoftware(adoptPtr(new WebViewHostSoftwareOutputDevice)).leakPtr(); - return WebViewHostOutputSurface::create3d(adoptPtr(webkit_support::CreateGraphicsContext3D(WebGraphicsContext3D::Attributes(), webView()))).leakPtr(); -} - -void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine) -{ - // This matches win DumpRenderTree's UIDelegate.cpp. - if (!m_logConsoleOutput) - return; - string newMessage; - if (!message.text.isEmpty()) { - newMessage = message.text.utf8(); - size_t fileProtocol = newMessage.find("file://"); - if (fileProtocol != string::npos) { - newMessage = newMessage.substr(0, fileProtocol) - + urlSuitableForTestResult(newMessage.substr(fileProtocol)); - } - } - printf("CONSOLE MESSAGE: "); - if (sourceLine) - printf("line %d: ", sourceLine); - printf("%s\n", newMessage.data()); -} - -void WebViewHost::didStartLoading() -{ - m_shell->setIsLoading(true); -} - -void WebViewHost::didStopLoading() -{ - if (testRunner()->shouldDumpProgressFinishedCallback()) - fputs("postProgressFinishedNotification\n", stdout); - m_shell->setIsLoading(false); -} - -// The output from these methods in layout test mode should match that -// expected by the layout tests. See EditingDelegate.m in DumpRenderTree. - -bool WebViewHost::shouldBeginEditing(const WebRange& range) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - fputs("EDITING DELEGATE: shouldBeginEditingInDOMRange:", stdout); - printRangeDescription(range); - fputs("\n", stdout); - } - return true; -} - -bool WebViewHost::shouldEndEditing(const WebRange& range) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - fputs("EDITING DELEGATE: shouldEndEditingInDOMRange:", stdout); - printRangeDescription(range); - fputs("\n", stdout); - } - return true; -} - -bool WebViewHost::shouldInsertNode(const WebNode& node, const WebRange& range, WebEditingAction action) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - fputs("EDITING DELEGATE: shouldInsertNode:", stdout); - printNodeDescription(node, 0); - fputs(" replacingDOMRange:", stdout); - printRangeDescription(range); - printf(" givenAction:%s\n", editingActionDescription(action).c_str()); - } - return true; -} - -bool WebViewHost::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:", text.utf8().data()); - printRangeDescription(range); - printf(" givenAction:%s\n", editingActionDescription(action).c_str()); - } - return true; -} - -bool WebViewHost::shouldChangeSelectedRange( - const WebRange& fromRange, const WebRange& toRange, WebTextAffinity affinity, bool stillSelecting) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - fputs("EDITING DELEGATE: shouldChangeSelectedDOMRange:", stdout); - printRangeDescription(fromRange); - fputs(" toDOMRange:", stdout); - printRangeDescription(toRange); - printf(" affinity:%s stillSelecting:%s\n", - textAffinityDescription(affinity).c_str(), - (stillSelecting ? "TRUE" : "FALSE")); - } - return true; -} - -bool WebViewHost::shouldDeleteRange(const WebRange& range) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - fputs("EDITING DELEGATE: shouldDeleteDOMRange:", stdout); - printRangeDescription(range); - fputs("\n", stdout); - } - return true; -} - -bool WebViewHost::shouldApplyStyle(const WebString& style, const WebRange& range) -{ - if (testRunner()->shouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:", style.utf8().data()); - printRangeDescription(range); - fputs("\n", stdout); - } - return true; -} - -bool WebViewHost::isSmartInsertDeleteEnabled() -{ - return m_smartInsertDeleteEnabled; -} - -bool WebViewHost::isSelectTrailingWhitespaceEnabled() -{ - return m_selectTrailingWhitespaceEnabled; -} - -void WebViewHost::didBeginEditing() -{ - if (!testRunner()->shouldDumpEditingCallbacks()) - return; - fputs("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n", stdout); -} - -void WebViewHost::didChangeSelection(bool isEmptySelection) -{ - if (testRunner()->shouldDumpEditingCallbacks()) - fputs("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n", stdout); - // No need to update clipboard with the selected text in DRT. -} - -void WebViewHost::didChangeContents() -{ - if (!testRunner()->shouldDumpEditingCallbacks()) - return; - fputs("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n", stdout); -} - -void WebViewHost::didEndEditing() -{ - if (!testRunner()->shouldDumpEditingCallbacks()) - return; - fputs("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n", stdout); -} - -bool WebViewHost::handleCurrentKeyboardEvent() -{ - if (m_editCommandName.empty()) - return false; - WebFrame* frame = webView()->focusedFrame(); - if (!frame) - return false; - - return frame->executeCommand(WebString::fromUTF8(m_editCommandName), WebString::fromUTF8(m_editCommandValue)); -} - -// WebKit::WebPrerendererClient - -void WebViewHost::willAddPrerender(WebKit::WebPrerender*) -{ -} - - -// WebKit::WebSpellCheckClient - -void WebViewHost::spellCheck(const WebString& text, int& misspelledOffset, int& misspelledLength, WebVector<WebString>* optionalSuggestions) -{ - // Check the spelling of the given text. - m_spellcheck.spellCheckWord(text, &misspelledOffset, &misspelledLength); -} - -void WebViewHost::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults) -{ - Vector<WebTextCheckingResult> results; - if (mask & WebTextCheckingTypeSpelling) { - size_t offset = 0; - size_t length = text.length(); - const WebUChar* data = text.data(); - while (offset < length) { - int misspelledPosition = 0; - int misspelledLength = 0; - m_spellcheck.spellCheckWord(WebString(&data[offset], length - offset), &misspelledPosition, &misspelledLength); - if (!misspelledLength) - break; - WebTextCheckingResult result; - result.type = WebTextCheckingTypeSpelling; - result.location = offset + misspelledPosition; - result.length = misspelledLength; - results.append(result); - offset += misspelledPosition + misspelledLength; - } - } - if (mask & WebTextCheckingTypeGrammar) - MockGrammarCheck::checkGrammarOfString(text, &results); - webResults->assign(results); -} - -void WebViewHost::requestCheckingOfText(const WebString& text, WebTextCheckingCompletion* completion) -{ - if (text.isEmpty()) { - if (completion) - completion->didCancelCheckingText(); - return; - } - - m_lastRequestedTextCheckingCompletion = completion; - m_lastRequestedTextCheckString = text; - postDelayedTask(new HostMethodTask(this, &WebViewHost::finishLastTextCheck), 0); -} - -void WebViewHost::finishLastTextCheck() -{ - Vector<WebTextCheckingResult> results; - int offset = 0; - String text(m_lastRequestedTextCheckString.data(), m_lastRequestedTextCheckString.length()); - while (text.length()) { - int misspelledPosition = 0; - int misspelledLength = 0; - m_spellcheck.spellCheckWord(WebString(text.characters(), text.length()), &misspelledPosition, &misspelledLength); - if (!misspelledLength) - break; - WebVector<WebString> suggestions; - m_spellcheck.fillSuggestionList(WebString(text.characters() + misspelledPosition, misspelledLength), &suggestions); - results.append(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength, - suggestions.isEmpty() ? WebString() : suggestions[0])); - text = text.substring(misspelledPosition + misspelledLength); - offset += misspelledPosition + misspelledLength; - } - MockGrammarCheck::checkGrammarOfString(m_lastRequestedTextCheckString, &results); - m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results); - m_lastRequestedTextCheckingCompletion = 0; -} - - -WebString WebViewHost::autoCorrectWord(const WebString&) -{ - // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm') - // does. (If this function returns a non-empty string, WebKit replaces the - // given misspelled string with the result one. This process executes some - // editor commands and causes layout-test failures.) - return WebString(); -} - -void WebViewHost::runModalAlertDialog(WebFrame*, const WebString& message) -{ - printf("ALERT: %s\n", message.utf8().data()); - fflush(stdout); -} - -bool WebViewHost::runModalConfirmDialog(WebFrame*, const WebString& message) -{ - printf("CONFIRM: %s\n", message.utf8().data()); - return true; -} - -bool WebViewHost::runModalPromptDialog(WebFrame* frame, const WebString& message, - const WebString& defaultValue, WebString*) -{ - printf("PROMPT: %s, default text: %s\n", message.utf8().data(), defaultValue.utf8().data()); - return true; -} - -bool WebViewHost::runModalBeforeUnloadDialog(WebFrame*, const WebString& message) -{ - printf("CONFIRM NAVIGATION: %s\n", message.utf8().data()); - return !testRunner()->shouldStayOnPageAfterHandlingBeforeUnload(); -} - -void WebViewHost::showContextMenu(WebFrame*, const WebContextMenuData& contextMenuData) -{ - m_lastContextMenuData = adoptPtr(new WebContextMenuData(contextMenuData)); -} - -void WebViewHost::setStatusText(const WebString& text) -{ - if (!testRunner()->shouldDumpStatusCallbacks()) - return; - // When running tests, write to stdout. - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text.utf8().data()); -} - -void WebViewHost::didUpdateLayout() -{ -#if OS(MAC_OS_X) - static bool queryingPreferredSize = false; - if (queryingPreferredSize) - return; - - queryingPreferredSize = true; - // Query preferred width to emulate the same functionality in Chromium: - // see RenderView::CheckPreferredSize (src/content/renderer/render_view.cc) - // and TabContentsViewMac::RenderViewCreated (src/chrome/browser/tab_contents/tab_contents_view_mac.mm) - webView()->mainFrame()->contentsPreferredWidth(); - webView()->mainFrame()->documentElementScrollHeight(); - queryingPreferredSize = false; -#endif -} - -void WebViewHost::navigateBackForwardSoon(int offset) -{ - navigationController()->goToOffset(offset); -} - -int WebViewHost::historyBackListCount() -{ - return navigationController()->lastCommittedEntryIndex(); -} - -int WebViewHost::historyForwardListCount() -{ - int currentIndex =navigationController()->lastCommittedEntryIndex(); - return navigationController()->entryCount() - currentIndex - 1; -} - -#if ENABLE(NOTIFICATIONS) -WebNotificationPresenter* WebViewHost::notificationPresenter() -{ - return m_shell->notificationPresenter(); -} -#endif - -WebKit::WebGeolocationClient* WebViewHost::geolocationClient() -{ - return geolocationClientMock(); -} - -WebKit::WebGeolocationClientMock* WebViewHost::geolocationClientMock() -{ - if (!m_geolocationClientMock) - m_geolocationClientMock = adoptPtr(WebGeolocationClientMock::create()); - return m_geolocationClientMock.get(); -} - -#if ENABLE(INPUT_SPEECH) -WebSpeechInputController* WebViewHost::speechInputController(WebKit::WebSpeechInputListener* listener) -{ - if (!m_speechInputControllerMock) - m_speechInputControllerMock = MockWebSpeechInputController::create(listener); - return m_speechInputControllerMock.get(); -} -#endif - -#if ENABLE(SCRIPTED_SPEECH) -WebSpeechRecognizer* WebViewHost::speechRecognizer() -{ - if (!m_mockSpeechRecognizer) - m_mockSpeechRecognizer = MockWebSpeechRecognizer::create(); - return m_mockSpeechRecognizer.get(); -} -#endif - -WebDeviceOrientationClientMock* WebViewHost::deviceOrientationClientMock() -{ - if (!m_deviceOrientationClientMock.get()) - m_deviceOrientationClientMock = adoptPtr(WebDeviceOrientationClientMock::create()); - return m_deviceOrientationClientMock.get(); -} - -MockSpellCheck* WebViewHost::mockSpellCheck() -{ - return &m_spellcheck; -} - -WebDeviceOrientationClient* WebViewHost::deviceOrientationClient() -{ - return deviceOrientationClientMock(); -} - -#if ENABLE(MEDIA_STREAM) -WebUserMediaClient* WebViewHost::userMediaClient() -{ - return userMediaClientMock(); -} - -WebUserMediaClientMock* WebViewHost::userMediaClientMock() -{ - if (!m_userMediaClientMock.get()) - m_userMediaClientMock = WebUserMediaClientMock::create(); - return m_userMediaClientMock.get(); -} -#endif - -// WebWidgetClient ----------------------------------------------------------- - -void WebViewHost::didAutoResize(const WebSize& newSize) -{ - // Purposely don't include the virtualWindowBorder in this case so that - // window.inner[Width|Height] is the same as window.outer[Width|Height] - setWindowRect(WebRect(0, 0, newSize.width, newSize.height)); -} - -void WebViewHost::scheduleAnimation() -{ - if (webView()->settings()->scrollAnimatorEnabled()) - webView()->animate(0.0); -} - -void WebViewHost::didFocus() -{ - m_shell->setFocus(webWidget(), true); -} - -void WebViewHost::didBlur() -{ - m_shell->setFocus(webWidget(), false); -} - -WebScreenInfo WebViewHost::screenInfo() -{ - // We don't need to set actual values. - WebScreenInfo info; - info.depth = 24; - info.depthPerComponent = 8; - info.isMonochrome = false; - info.rect = WebRect(0, 0, screenWidth, screenHeight); - // Use values different from info.rect for testing. - info.availableRect = WebRect(screenUnavailableBorder, screenUnavailableBorder, - screenWidth - screenUnavailableBorder * 2, - screenHeight - screenUnavailableBorder * 2); - return info; -} - -#if ENABLE(POINTER_LOCK) -bool WebViewHost::requestPointerLock() -{ - switch (m_pointerLockPlannedResult) { - case PointerLockWillSucceed: - postDelayedTask(new HostMethodTask(this, &WebViewHost::didAcquirePointerLock), 0); - return true; - case PointerLockWillRespondAsync: - ASSERT(!m_pointerLocked); - return true; - case PointerLockWillFailSync: - ASSERT(!m_pointerLocked); - return false; - default: - ASSERT_NOT_REACHED(); - return false; - } -} - -void WebViewHost::requestPointerUnlock() -{ - postDelayedTask(new HostMethodTask(this, &WebViewHost::didLosePointerLock), 0); -} - -bool WebViewHost::isPointerLocked() -{ - return m_pointerLocked; -} - -void WebViewHost::didAcquirePointerLock() -{ - m_pointerLocked = true; - webWidget()->didAcquirePointerLock(); - - // Reset planned result to default. - m_pointerLockPlannedResult = PointerLockWillSucceed; -} - -void WebViewHost::didNotAcquirePointerLock() -{ - ASSERT(!m_pointerLocked); - m_pointerLocked = false; - webWidget()->didNotAcquirePointerLock(); - - // Reset planned result to default. - m_pointerLockPlannedResult = PointerLockWillSucceed; -} - -void WebViewHost::didLosePointerLock() -{ - bool wasLocked = m_pointerLocked; - m_pointerLocked = false; - if (wasLocked) - webWidget()->didLosePointerLock(); -} -#endif - -void WebViewHost::show(WebNavigationPolicy) -{ - m_hasWindow = true; -} - - - -void WebViewHost::closeWidget() -{ - m_hasWindow = false; - m_shell->closeWindow(this); - // No more code here, we should be deleted at this point. -} - -void WebViewHost::closeWidgetSoon() -{ - postDelayedTask(new HostMethodTask(this, &WebViewHost::closeWidget), 0); -} - -void WebViewHost::didChangeCursor(const WebCursorInfo& cursorInfo) -{ - if (!hasWindow()) - return; - m_currentCursor = cursorInfo; -} - -WebRect WebViewHost::windowRect() -{ - return m_windowRect; -} - -void WebViewHost::setWindowRect(const WebRect& rect) -{ - m_windowRect = rect; - const int border2 = TestShell::virtualWindowBorder * 2; - if (m_windowRect.width <= border2) - m_windowRect.width = 1 + border2; - if (m_windowRect.height <= border2) - m_windowRect.height = 1 + border2; - int width = m_windowRect.width - border2; - int height = m_windowRect.height - border2; - discardBackingStore(); - webWidget()->resize(WebSize(width, height)); -} - -WebRect WebViewHost::rootWindowRect() -{ - return windowRect(); -} - -WebRect WebViewHost::windowResizerRect() -{ - // Not necessary. - return WebRect(); -} - -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() -{ - postDelayedTask(new HostMethodTask(this, &WebViewHost::enterFullScreenNow), 0); - return true; -} - -void WebViewHost::exitFullScreen() -{ - postDelayedTask(new HostMethodTask(this, &WebViewHost::exitFullScreenNow), 0); -} - -// WebFrameClient ------------------------------------------------------------ - -WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& params) -{ - if (params.mimeType == TestWebPlugin::mimeType()) - return new TestWebPlugin(frame, params); - - return webkit_support::CreateWebPlugin(frame, params); -} - -WebMediaPlayer* WebViewHost::createMediaPlayer(WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) -{ -#if ENABLE(MEDIA_STREAM) - return webkit_support::CreateMediaPlayer(frame, url, client, testMediaStreamClient()); -#else - return webkit_support::CreateMediaPlayer(frame, url, client); -#endif -} - -WebApplicationCacheHost* WebViewHost::createApplicationCacheHost(WebFrame* frame, WebApplicationCacheHostClient* client) -{ - return webkit_support::CreateApplicationCacheHost(frame, client); -} - -void WebViewHost::loadURLExternally(WebFrame* frame, const WebURLRequest& request, WebNavigationPolicy policy) -{ - loadURLExternally(frame, request, policy, WebString()); -} - -void WebViewHost::loadURLExternally(WebFrame*, const WebURLRequest& request, WebNavigationPolicy policy, const WebString& downloadName) -{ - ASSERT(policy != WebKit::WebNavigationPolicyCurrentTab); - WebViewHost* another = m_shell->createNewWindow(request.url()); - if (another) - another->show(policy); -} - -WebNavigationPolicy WebViewHost::decidePolicyForNavigation( - WebFrame*, const WebURLRequest& request, - WebNavigationType type, const WebNode& originatingNode, - WebNavigationPolicy defaultPolicy, bool isRedirect) -{ - WebNavigationPolicy result; - if (!m_policyDelegateEnabled) - return defaultPolicy; - - printf("Policy delegate: attempt to load %s with navigation type '%s'", - URLDescription(request.url()).c_str(), webNavigationTypeToString(type)); - if (!originatingNode.isNull()) { - fputs(" originating from ", stdout); - printNodeDescription(originatingNode, 0); - } - fputs("\n", stdout); - if (m_policyDelegateIsPermissive) - result = WebKit::WebNavigationPolicyCurrentTab; - else - result = WebKit::WebNavigationPolicyIgnore; - - if (m_policyDelegateShouldNotifyDone) - testRunner()->policyDelegateDone(); - return result; -} - -bool WebViewHost::canHandleRequest(WebFrame*, const WebURLRequest& request) -{ - GURL url = request.url(); - // Just reject the scheme used in - // LayoutTests/http/tests/misc/redirect-to-external-url.html - return !url.SchemeIs("spaceballs"); -} - -WebURLError WebViewHost::cannotHandleRequestError(WebFrame*, const WebURLRequest& request) -{ - WebURLError error; - // A WebKit layout test expects the following values. - // unableToImplementPolicyWithError() below prints them. - error.domain = WebString::fromUTF8("WebKitErrorDomain"); - error.reason = 101; - error.unreachableURL = request.url(); - return error; -} - -WebURLError WebViewHost::cancelledError(WebFrame*, const WebURLRequest& request) -{ - return webkit_support::CreateCancelledError(request); -} - -void WebViewHost::unableToImplementPolicyWithError(WebFrame* frame, const WebURLError& error) -{ - printf("Policy delegate: unable to implement policy with error domain '%s', " - "error code %d, in frame '%s'\n", - error.domain.utf8().data(), error.reason, frame->uniqueName().utf8().data()); -} - -void WebViewHost::willPerformClientRedirect(WebFrame* frame, const WebURL& from, const WebURL& to, - double interval, double fire_time) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - printf(" - willPerformClientRedirectToURL: %s \n", to.spec().data()); - } - - if (m_shell->shouldDumpUserGestureInFrameLoadCallbacks()) - printFrameUserGestureStatus(frame, " - in willPerformClientRedirect\n"); -} - -void WebViewHost::didCancelClientRedirect(WebFrame* frame) -{ - if (!m_shell->shouldDumpFrameLoadCallbacks()) - return; - printFrameDescription(frame); - fputs(" - didCancelClientRedirectForFrame\n", stdout); -} - -void WebViewHost::didCreateDataSource(WebFrame*, WebDataSource* ds) -{ - ds->setExtraData(m_pendingExtraData.leakPtr()); - if (!testRunner()->deferMainResourceDataLoad()) - ds->setDeferMainResourceDataLoad(false); -} - -void WebViewHost::didStartProvisionalLoad(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didStartProvisionalLoadForFrame\n", stdout); - } - - if (m_shell->shouldDumpUserGestureInFrameLoadCallbacks()) - printFrameUserGestureStatus(frame, " - in didStartProvisionalLoadForFrame\n"); - - if (!m_topLoadingFrame) - m_topLoadingFrame = frame; - - if (testRunner()->stopProvisionalFrameLoads()) { - printFrameDescription(frame); - fputs(" - stopping load in didStartProvisionalLoadForFrame callback\n", stdout); - frame->stopLoading(); - } - updateAddressBar(frame->view()); -} - -void WebViewHost::didReceiveServerRedirectForProvisionalLoad(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didReceiveServerRedirectForProvisionalLoadForFrame\n", stdout); - } - updateAddressBar(frame->view()); -} - -void WebViewHost::didFailProvisionalLoad(WebFrame* frame, const WebURLError& error) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didFailProvisionalLoadWithError\n", stdout); - } - - locationChangeDone(frame); - - // Don't display an error page if we're running layout tests, because - // DumpRenderTree doesn't. -} - -void WebViewHost::didCommitProvisionalLoad(WebFrame* frame, bool isNewNavigation) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didCommitLoadForFrame\n", stdout); - } - updateForCommittedLoad(frame, isNewNavigation); -} - -void WebViewHost::didClearWindowObject(WebFrame* frame) -{ - m_shell->bindJSObjectsToWindow(frame); -} - -void WebViewHost::didReceiveTitle(WebFrame* frame, const WebString& title, WebTextDirection direction) -{ - WebCString title8 = title.utf8(); - - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - printf(" - didReceiveTitle: %s\n", title8.data()); - } - - if (testRunner()->shouldDumpTitleChanges()) - printf("TITLE CHANGED: '%s'\n", title8.data()); - - setPageTitle(title); - testRunner()->setTitleTextDirection(direction); -} - -void WebViewHost::didFinishDocumentLoad(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didFinishDocumentLoadForFrame\n", stdout); - } else { - unsigned pendingUnloadEvents = frame->unloadListenerCount(); - if (pendingUnloadEvents) { - printFrameDescription(frame); - printf(" - has %u onunload handler(s)\n", pendingUnloadEvents); - } - } -} - -void WebViewHost::didHandleOnloadEvents(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didHandleOnloadEventsForFrame\n", stdout); - } -} - -void WebViewHost::didFailLoad(WebFrame* frame, const WebURLError& error) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didFailLoadWithError\n", stdout); - } - locationChangeDone(frame); -} - -void WebViewHost::didFinishLoad(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didFinishLoadForFrame\n", stdout); - } - updateAddressBar(frame->view()); - locationChangeDone(frame); -} - -void WebViewHost::didNavigateWithinPage(WebFrame* frame, bool isNewNavigation) -{ - frame->dataSource()->setExtraData(m_pendingExtraData.leakPtr()); - - updateForCommittedLoad(frame, isNewNavigation); -} - -void WebViewHost::didChangeLocationWithinPage(WebFrame* frame) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) { - printFrameDescription(frame); - fputs(" - didChangeLocationWithinPageForFrame\n", stdout); - } -} - -void WebViewHost::assignIdentifierToRequest(WebFrame*, unsigned identifier, const WebURLRequest& request) -{ - if (!m_shell->shouldDumpResourceLoadCallbacks()) - return; - ASSERT(!m_resourceIdentifierMap.contains(identifier)); - m_resourceIdentifierMap.set(identifier, descriptionSuitableForTestResult(request.url().spec())); -} - -void WebViewHost::removeIdentifierForRequest(unsigned identifier) -{ - m_resourceIdentifierMap.remove(identifier); -} - -static void blockRequest(WebURLRequest& request) -{ - request.setURL(WebURL()); -} - -static bool isLocalhost(const string& host) -{ - return host == "127.0.0.1" || host == "localhost"; -} - -static bool hostIsUsedBySomeTestsToGenerateError(const string& host) -{ - return host == "255.255.255.255"; -} - -void WebViewHost::willRequestResource(WebKit::WebFrame* frame, const WebKit::WebCachedURLRequest& request) -{ - if (m_shell->shouldDumpResourceRequestCallbacks()) { - printFrameDescription(frame); - WebElement element = request.initiatorElement(); - if (!element.isNull()) { - printf(" - element with "); - if (element.hasAttribute("id")) - printf("id '%s'", element.getAttribute("id").utf8().data()); - else - printf("no id"); - } else - printf(" - %s", request.initiatorName().utf8().data()); - printf(" requested '%s'\n", URLDescription(request.urlRequest().url()).c_str()); - } -} - -void WebViewHost::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRequest& request, const WebURLResponse& redirectResponse) -{ - // Need to use GURL for host() and SchemeIs() - GURL url = request.url(); - string requestURL = url.possibly_invalid_spec(); - - GURL mainDocumentURL = request.firstPartyForCookies(); - if (testRunner()->shouldDumpResourceLoadCallbacks()) { - printResourceDescription(identifier); - printf(" - willSendRequest <NSURLRequest URL %s, main document URL %s," - " http method %s> redirectResponse ", - descriptionSuitableForTestResult(requestURL).c_str(), - URLDescription(mainDocumentURL).c_str(), - request.httpMethod().utf8().data()); - printResponseDescription(redirectResponse); - fputs("\n", stdout); - } - - request.setExtraData(webkit_support::CreateWebURLRequestExtraData(frame->document().referrerPolicy())); - - if (!redirectResponse.isNull() && m_blocksRedirects) { - fputs("Returning null for this redirect\n", stdout); - blockRequest(request); - return; - } - - if (m_requestReturnNull) { - blockRequest(request); - return; - } - - string host = url.host(); - if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))) { - if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) - && ((!mainDocumentURL.SchemeIs("http") && !mainDocumentURL.SchemeIs("https")) || isLocalhost(mainDocumentURL.host())) - && !m_shell->allowExternalPages()) { - printf("Blocked access to external URL %s\n", requestURL.c_str()); - blockRequest(request); - return; - } - } - - HashSet<String>::const_iterator end = m_clearHeaders.end(); - for (HashSet<String>::const_iterator header = m_clearHeaders.begin(); header != end; ++header) - request.clearHTTPHeaderField(WebString(header->characters(), header->length())); - - // Set the new substituted URL. - request.setURL(webkit_support::RewriteLayoutTestsURL(request.url().spec())); -} - -void WebViewHost::didReceiveResponse(WebFrame*, unsigned identifier, const WebURLResponse& response) -{ - if (m_shell->shouldDumpResourceLoadCallbacks()) { - printResourceDescription(identifier); - fputs(" - didReceiveResponse ", stdout); - printResponseDescription(response); - fputs("\n", stdout); - } - if (m_shell->shouldDumpResourceResponseMIMETypes()) { - GURL url = response.url(); - WebString mimeType = response.mimeType(); - printf("%s has MIME type %s\n", - url.ExtractFileName().c_str(), - // Simulate NSURLResponse's mapping of empty/unknown MIME types to application/octet-stream - mimeType.isEmpty() ? "application/octet-stream" : mimeType.utf8().data()); - } -} - -void WebViewHost::didFinishResourceLoad(WebFrame*, unsigned identifier) -{ - if (m_shell->shouldDumpResourceLoadCallbacks()) { - printResourceDescription(identifier); - fputs(" - didFinishLoading\n", stdout); - } - removeIdentifierForRequest(identifier); -} - -void WebViewHost::didFailResourceLoad(WebFrame*, unsigned identifier, const WebURLError& error) -{ - if (m_shell->shouldDumpResourceLoadCallbacks()) { - printResourceDescription(identifier); - fputs(" - didFailLoadingWithError: ", stdout); - fputs(webkit_support::MakeURLErrorDescription(error).c_str(), stdout); - fputs("\n", stdout); - } - removeIdentifierForRequest(identifier); -} - -void WebViewHost::didDisplayInsecureContent(WebFrame*) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) - fputs("didDisplayInsecureContent\n", stdout); -} - -void WebViewHost::didRunInsecureContent(WebFrame*, const WebSecurityOrigin& origin, const WebURL& insecureURL) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) - fputs("didRunInsecureContent\n", stdout); -} - -void WebViewHost::didDetectXSS(WebFrame*, const WebURL&, bool) -{ - if (m_shell->shouldDumpFrameLoadCallbacks()) - fputs("didDetectXSS\n", stdout); -} - -void WebViewHost::openFileSystem(WebFrame* frame, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks) -{ - webkit_support::OpenFileSystem(frame, type, size, create, callbacks); -} - -void WebViewHost::deleteFileSystem(WebKit::WebFrame* frame, WebKit::WebFileSystem::Type type, WebKit::WebFileSystemCallbacks* callbacks) -{ - webkit_support::DeleteFileSystem(frame, type, callbacks); -} - -bool WebViewHost::willCheckAndDispatchMessageEvent(WebFrame* sourceFrame, WebFrame* targetFrame, WebSecurityOrigin target, WebDOMMessageEvent event) -{ - if (m_shell->testRunner()->shouldInterceptPostMessage()) { - fputs("intercepted postMessage\n", stdout); - return true; - } - - return false; -} - -void WebViewHost::registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo& service) -{ - printf("Registered Web Intent Service: action=%s type=%s title=%s url=%s disposition=%s\n", - service.action().utf8().data(), service.type().utf8().data(), service.title().utf8().data(), service.url().spec().data(), service.disposition().utf8().data()); -} - -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()); - WebMessagePortChannelArray* ports = request.intent().messagePortChannelsRelease(); - m_currentRequest = request; - if (ports) { - printf("Have %d ports\n", static_cast<int>(ports->size())); - for (size_t i = 0; i < ports->size(); ++i) - (*ports)[i]->destroy(); - delete ports; - } - - if (!request.intent().service().isEmpty()) - printf("Explicit intent service: %s\n", request.intent().service().spec().data()); - - WebVector<WebString> extras = request.intent().extrasNames(); - for (size_t i = 0; i < extras.size(); ++i) { - printf("Extras[%s] = %s\n", extras[i].utf8().data(), - request.intent().extrasValue(extras[i]).utf8().data()); - } - - WebVector<WebURL> suggestions = request.intent().suggestions(); - for (size_t i = 0; i < suggestions.size(); ++i) - printf("Have suggestion %s\n", suggestions[i].spec().data()); -} - -void WebViewHost::deliveredIntentResult(WebFrame* frame, int id, const WebSerializedScriptValue& data) -{ - printf("Web intent success for id %d\n", id); -} - -void WebViewHost::deliveredIntentFailure(WebFrame* frame, int id, const WebSerializedScriptValue& data) -{ - printf("Web intent failure for id %d\n", id); -} - -// WebTestDelegate ------------------------------------------------------------ - -WebContextMenuData* WebViewHost::lastContextMenuData() const -{ - return m_lastContextMenuData.get(); -} - -void WebViewHost::clearContextMenuData() -{ - m_lastContextMenuData.clear(); -} - -void WebViewHost::setEditCommand(const string& name, const string& value) -{ - m_editCommandName = name; - m_editCommandValue = value; -} - -void WebViewHost::clearEditCommand() -{ - m_editCommandName.clear(); - m_editCommandValue.clear(); -} - -void WebViewHost::fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) -{ - mockSpellCheck()->fillSuggestionList(word, suggestions); -} - -void WebViewHost::setGamepadData(const WebGamepads& pads) -{ - webkit_support::SetGamepadData(pads); -} - -void WebViewHost::printMessage(const std::string& message) -{ - printf("%s", message.c_str()); -} - -void WebViewHost::postTask(WebTask* task) -{ - ::postTask(task); -} - -void WebViewHost::postDelayedTask(WebTask* task, long long ms) -{ - ::postDelayedTask(task, ms); -} - -WebString WebViewHost::registerIsolatedFileSystem(const WebVector<WebString>& absoluteFilenames) -{ - return webkit_support::RegisterIsolatedFileSystem(absoluteFilenames); -} - -long long WebViewHost::getCurrentTimeInMillisecond() -{ - return webkit_support::GetCurrentTimeInMillisecond(); -} - -WebKit::WebString WebViewHost::getAbsoluteWebStringFromUTF8Path(const std::string& path) -{ - return webkit_support::GetAbsoluteWebStringFromUTF8Path(path); -} - -// Public functions ----------------------------------------------------------- - -WebViewHost::WebViewHost(TestShell* shell) - : m_shell(shell) - , m_proxy(0) - , m_webWidget(0) - , m_lastRequestedTextCheckingCompletion(0) -{ - reset(); -} - -WebViewHost::~WebViewHost() -{ - // DevTools frontend page is supposed to be navigated only once and - // loading another URL in that Page is an error. - if (m_shell->devToolsWebView() != this) { - // Navigate to an empty page to fire all the destruction logic for the - // current page. - loadURLForFrame(GURL("about:blank"), WebString()); - } - - for (Vector<WebKit::WebWidget*>::iterator it = m_popupmenus.begin(); - it < m_popupmenus.end(); ++it) - (*it)->close(); - - webWidget()->close(); - if (m_inModalLoop) - webkit_support::QuitMessageLoop(); -} - -void WebViewHost::setWebWidget(WebKit::WebWidget* widget) -{ - m_webWidget = widget; - webView()->setSpellCheckClient(this); - webView()->setPrerendererClient(this); - webView()->setCompositorSurfaceReady(); -} - -WebView* WebViewHost::webView() const -{ - ASSERT(m_webWidget); - // DRT does not support popup widgets. So m_webWidget is always a WebView. - return static_cast<WebView*>(m_webWidget); -} - -WebWidget* WebViewHost::webWidget() const -{ - ASSERT(m_webWidget); - return m_webWidget; -} - -WebTestProxyBase* WebViewHost::proxy() const -{ - ASSERT(m_proxy); - return m_proxy; -} - -void WebViewHost::setProxy(WebTestProxyBase* proxy) -{ - ASSERT(!m_proxy); - ASSERT(proxy); - m_proxy = proxy; -} - -void WebViewHost::reset() -{ - m_policyDelegateEnabled = false; - m_policyDelegateIsPermissive = false; - m_policyDelegateShouldNotifyDone = false; - m_topLoadingFrame = 0; - m_pageId = -1; - m_lastPageIdUpdated = -1; - m_hasWindow = false; - m_inModalLoop = false; - m_smartInsertDeleteEnabled = true; - m_logConsoleOutput = true; -#if OS(WINDOWS) - m_selectTrailingWhitespaceEnabled = true; -#else - m_selectTrailingWhitespaceEnabled = false; -#endif - m_blocksRedirects = false; - m_requestReturnNull = false; - m_isPainting = false; - m_canvas.clear(); -#if ENABLE(POINTER_LOCK) - m_pointerLocked = false; - m_pointerLockPlannedResult = PointerLockWillSucceed; -#endif - - m_navigationController = adoptPtr(new TestNavigationController(this)); - - m_pendingExtraData.clear(); - m_resourceIdentifierMap.clear(); - m_clearHeaders.clear(); - m_editCommandName.clear(); - m_editCommandValue.clear(); - - if (m_geolocationClientMock.get()) - m_geolocationClientMock->resetMock(); - -#if ENABLE(INPUT_SPEECH) - if (m_speechInputControllerMock.get()) - m_speechInputControllerMock->clearResults(); -#endif - - m_currentCursor = WebCursorInfo(); - m_windowRect = WebRect(); - // m_proxy is not set when reset() is invoked from the constructor. - if (m_proxy) - proxy()->setPaintRect(WebRect()); - - if (m_webWidget) { - webView()->mainFrame()->setName(WebString()); - webView()->settings()->setMinimumTimerInterval(webkit_support::GetForegroundTabTimerInterval()); - } -} - -void WebViewHost::setSelectTrailingWhitespaceEnabled(bool enabled) -{ - m_selectTrailingWhitespaceEnabled = enabled; - // In upstream WebKit, smart insert/delete is mutually exclusive with select - // trailing whitespace, however, we allow both because Chromium on Windows - // allows both. -} - -void WebViewHost::setSmartInsertDeleteEnabled(bool enabled) -{ - m_smartInsertDeleteEnabled = enabled; - // In upstream WebKit, smart insert/delete is mutually exclusive with select - // trailing whitespace, however, we allow both because Chromium on Windows - // allows both. -} - -void WebViewHost::setLogConsoleOutput(bool enabled) -{ - m_logConsoleOutput = enabled; -} - -void WebViewHost::setCustomPolicyDelegate(bool isCustom, bool isPermissive) -{ - m_policyDelegateEnabled = isCustom; - m_policyDelegateIsPermissive = isPermissive; -} - -void WebViewHost::waitForPolicyDelegate() -{ - m_policyDelegateEnabled = true; - m_policyDelegateShouldNotifyDone = true; -} - -void WebViewHost::loadURLForFrame(const WebURL& url, const WebString& frameName) -{ - if (!url.isValid()) - return; - TestShell::resizeWindowForTest(this, url); - navigationController()->loadEntry(TestNavigationEntry::create(-1, url, WebString(), frameName).get()); -} - -bool WebViewHost::navigate(const TestNavigationEntry& entry, bool reload) -{ - // Get the right target frame for the entry. - WebFrame* frame = webView()->mainFrame(); - if (!entry.targetFrame().isEmpty()) - frame = webView()->findFrameByName(entry.targetFrame()); - - // TODO(mpcomplete): should we clear the target frame, or should - // back/forward navigations maintain the target frame? - - // A navigation resulting from loading a javascript URL should not be - // treated as a browser initiated event. Instead, we want it to look as if - // the page initiated any load resulting from JS execution. - if (!GURL(entry.URL()).SchemeIs("javascript")) - setPendingExtraData(adoptPtr(new TestShellExtraData(entry.pageID()))); - - // If we are reloading, then WebKit will use the state of the current page. - // Otherwise, we give it the state to navigate to. - if (reload) { - frame->reload(false); - } else if (!entry.contentState().isNull()) { - ASSERT(entry.pageID() != -1); - frame->loadHistoryItem(entry.contentState()); - } else { - ASSERT(entry.pageID() == -1); - frame->loadRequest(WebURLRequest(entry.URL())); - } - - // In case LoadRequest failed before DidCreateDataSource was called. - setPendingExtraData(nullptr); - - // Restore focus to the main frame prior to loading new request. - // This makes sure that we don't have a focused iframe. Otherwise, that - // iframe would keep focus when the SetFocus called immediately after - // LoadRequest, thus making some tests fail (see http://b/issue?id=845337 - // for more details). - webView()->setFocusedFrame(frame); - m_shell->setFocus(webView(), true); - - return true; -} - -// Private functions ---------------------------------------------------------- - -DRTTestRunner* WebViewHost::testRunner() const -{ - return m_shell->testRunner(); -} - -void WebViewHost::updateAddressBar(WebView* webView) -{ - WebFrame* mainFrame = webView->mainFrame(); - WebDataSource* dataSource = mainFrame->dataSource(); - if (!dataSource) - dataSource = mainFrame->provisionalDataSource(); - if (!dataSource) - return; - - setAddressBarURL(dataSource->request().url()); -} - -void WebViewHost::locationChangeDone(WebFrame* frame) -{ - if (frame != m_topLoadingFrame) - return; - m_topLoadingFrame = 0; - testRunner()->locationChangeDone(); -} - -void WebViewHost::updateForCommittedLoad(WebFrame* frame, bool isNewNavigation) -{ - // Code duplicated from RenderView::DidCommitLoadForFrame. - TestShellExtraData* extraData = static_cast<TestShellExtraData*>(frame->dataSource()->extraData()); - const WebURL& url = frame->dataSource()->request().url(); - bool nonBlankPageAfterReset = m_pageId == -1 && !url.isEmpty() && strcmp(url.spec().data(), "about:blank"); - - if (isNewNavigation || nonBlankPageAfterReset) { - // New navigation. - updateSessionHistory(frame); - m_pageId = nextPageID++; - } else if (extraData && extraData->pendingPageID != -1 && !extraData->requestCommitted) { - // This is a successful session history navigation! - updateSessionHistory(frame); - m_pageId = extraData->pendingPageID; - } - - // Don't update session history multiple times. - if (extraData) - extraData->requestCommitted = true; - - updateURL(frame); -} - -void WebViewHost::updateURL(WebFrame* frame) -{ - WebDataSource* ds = frame->dataSource(); - ASSERT(ds); - const WebURLRequest& request = ds->request(); - RefPtr<TestNavigationEntry> entry(TestNavigationEntry::create()); - - // The referrer will be empty on https->http transitions. It - // would be nice if we could get the real referrer from somewhere. - entry->setPageID(m_pageId); - if (ds->hasUnreachableURL()) - entry->setURL(ds->unreachableURL()); - else - entry->setURL(request.url()); - - const WebHistoryItem& historyItem = frame->currentHistoryItem(); - if (!historyItem.isNull()) - entry->setContentState(historyItem); - - navigationController()->didNavigateToEntry(entry.get()); - updateAddressBar(frame->view()); - m_lastPageIdUpdated = max(m_lastPageIdUpdated, m_pageId); -} - -void WebViewHost::updateSessionHistory(WebFrame* frame) -{ - // If we have a valid page ID at this point, then it corresponds to the page - // we are navigating away from. Otherwise, this is the first navigation, so - // there is no past session history to record. - if (m_pageId == -1) - return; - - TestNavigationEntry* entry = navigationController()->entryWithPageID(m_pageId); - if (!entry) - return; - - const WebHistoryItem& historyItem = webView()->mainFrame()->previousHistoryItem(); - if (historyItem.isNull()) - return; - - entry->setContentState(historyItem); -} - -void WebViewHost::printFrameDescription(WebFrame* webframe) -{ - string name8 = webframe->uniqueName().utf8(); - if (webframe == webView()->mainFrame()) { - if (!name8.length()) { - fputs("main frame", stdout); - return; - } - printf("main frame \"%s\"", name8.c_str()); - return; - } - if (!name8.length()) { - fputs("frame (anonymous)", stdout); - return; - } - printf("frame \"%s\"", name8.c_str()); -} - -void WebViewHost::printFrameUserGestureStatus(WebFrame* webframe, const char* msg) -{ - bool isUserGesture = webframe->isProcessingUserGesture(); - printf("Frame with user gesture \"%s\"%s", isUserGesture ? "true" : "false", msg); -} - -void WebViewHost::printResourceDescription(unsigned identifier) -{ - ResourceMap::iterator it = m_resourceIdentifierMap.find(identifier); - printf("%s", it != m_resourceIdentifierMap.end() ? it->value.c_str() : "<unknown>"); -} - -void WebViewHost::setPendingExtraData(PassOwnPtr<TestShellExtraData> extraData) -{ - m_pendingExtraData = extraData; -} - -void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor) -{ - webView()->setDeviceScaleFactor(deviceScaleFactor); - discardBackingStore(); -} - -void WebViewHost::setPageTitle(const WebString&) -{ - // Nothing to do in layout test. -} - -void WebViewHost::setAddressBarURL(const WebURL&) -{ - // Nothing to do in layout test. -} - -void WebViewHost::enterFullScreenNow() -{ - webView()->willEnterFullScreen(); - webView()->didEnterFullScreen(); -} - -void WebViewHost::exitFullScreenNow() -{ - webView()->willExitFullScreen(); - webView()->didExitFullScreen(); -} - -#if ENABLE(MEDIA_STREAM) -webkit_support::TestMediaStreamClient* WebViewHost::testMediaStreamClient() -{ - if (!m_testMediaStreamClient.get()) - m_testMediaStreamClient = adoptPtr(new webkit_support::TestMediaStreamClient()); - return m_testMediaStreamClient.get(); -} -#endif - -// Painting functions --------------------------------------------------------- - -void WebViewHost::paintRect(const WebRect& rect) -{ - ASSERT(!m_isPainting); - ASSERT(canvas()); - m_isPainting = true; - float deviceScaleFactor = webView()->deviceScaleFactor(); - int scaledX = static_cast<int>(static_cast<float>(rect.x) * deviceScaleFactor); - int scaledY = static_cast<int>(static_cast<float>(rect.y) * deviceScaleFactor); - int scaledWidth = static_cast<int>(ceil(static_cast<float>(rect.width) * deviceScaleFactor)); - int scaledHeight = static_cast<int>(ceil(static_cast<float>(rect.height) * deviceScaleFactor)); - WebRect deviceRect(scaledX, scaledY, scaledWidth, scaledHeight); - webWidget()->paint(canvas(), deviceRect); - m_isPainting = false; -} - -void WebViewHost::paintInvalidatedRegion() -{ -#if ENABLE(REQUEST_ANIMATION_FRAME) - webWidget()->animate(0.0); -#endif - webWidget()->layout(); - WebSize widgetSize = webWidget()->size(); - WebRect clientRect(0, 0, widgetSize.width, widgetSize.height); - - // Paint the canvas if necessary. Allow painting to generate extra rects - // for the first two calls. This is necessary because some WebCore rendering - // objects update their layout only when painted. - // Store the total area painted in total_paint. Then tell the gdk window - // to update that area after we're done painting it. - for (int i = 0; i < 3; ++i) { - // rect = intersect(proxy()->paintRect() , clientRect) - WebRect damageRect = proxy()->paintRect(); - int left = max(damageRect.x, clientRect.x); - int top = max(damageRect.y, clientRect.y); - int right = min(damageRect.x + damageRect.width, clientRect.x + clientRect.width); - int bottom = min(damageRect.y + damageRect.height, clientRect.y + clientRect.height); - WebRect rect; - if (left < right && top < bottom) - rect = WebRect(left, top, right - left, bottom - top); - - proxy()->setPaintRect(WebRect()); - if (rect.isEmpty()) - continue; - paintRect(rect); - } - ASSERT(proxy()->paintRect().isEmpty()); -} - -void WebViewHost::paintPagesWithBoundaries() -{ - ASSERT(!m_isPainting); - ASSERT(canvas()); - m_isPainting = true; - - WebSize pageSizeInPixels = webWidget()->size(); - WebFrame* webFrame = webView()->mainFrame(); - - int pageCount = webFrame->printBegin(pageSizeInPixels); - int totalHeight = pageCount * (pageSizeInPixels.height + 1) - 1; - - SkCanvas* testCanvas = skia::TryCreateBitmapCanvas(pageSizeInPixels.width, totalHeight, true); - if (testCanvas) { - discardBackingStore(); - m_canvas = adoptPtr(testCanvas); - } else { - webFrame->printEnd(); - return; - } - - webFrame->printPagesWithBoundaries(canvas(), pageSizeInPixels); - webFrame->printEnd(); - - m_isPainting = false; -} - -SkCanvas* WebViewHost::canvas() -{ - if (m_canvas) - return m_canvas.get(); - WebSize widgetSize = webWidget()->size(); - float deviceScaleFactor = webView()->deviceScaleFactor(); - int scaledWidth = static_cast<int>(ceil(static_cast<float>(widgetSize.width) * deviceScaleFactor)); - int scaledHeight = static_cast<int>(ceil(static_cast<float>(widgetSize.height) * deviceScaleFactor)); - resetScrollRect(); - m_canvas = adoptPtr(skia::CreateBitmapCanvas(scaledWidth, scaledHeight, true)); - return m_canvas.get(); -} - -void WebViewHost::resetScrollRect() -{ -} - -void WebViewHost::discardBackingStore() -{ - m_canvas.clear(); -} - -// Paints the entire canvas a semi-transparent black (grayish). This is used -// by the layout tests in fast/repaint. The alpha value matches upstream. -void WebViewHost::displayRepaintMask() -{ - canvas()->drawARGB(167, 0, 0, 0); -} - -// Simulate a print by going into print mode and then exit straight away. -void WebViewHost::printPage(WebKit::WebFrame* frame) -{ - WebSize pageSizeInPixels = webWidget()->size(); - WebPrintParams printParams(pageSizeInPixels); - frame->printBegin(printParams); - frame->printEnd(); -} diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h deleted file mode 100644 index 97906eb26..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebViewHost_h -#define WebViewHost_h - -#include "MockSpellCheck.h" -#include "TestNavigationController.h" -#include "WebAccessibilityNotification.h" -#include "WebCursorInfo.h" -#include "WebFrameClient.h" -#include "WebIntentRequest.h" -#include "WebPrerendererClient.h" -#include "WebSpellCheckClient.h" -#include "WebTask.h" -#include "WebTestDelegate.h" -#include "WebTestProxy.h" -#include "WebViewClient.h" -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - -class DRTTestRunner; -class MockWebSpeechInputController; -class MockWebSpeechRecognizer; -class SkCanvas; -class TestShell; -class WebUserMediaClientMock; - -namespace WebKit { -class WebFrame; -class WebDeviceOrientationClient; -class WebDeviceOrientationClientMock; -class WebGeolocationClient; -class WebGeolocationClientMock; -class WebGeolocationServiceMock; -class WebIntentServiceInfo; -class WebSerializedScriptValue; -class WebSharedWorkerClient; -class WebSpeechInputController; -class WebSpeechInputListener; -class WebURL; -struct WebRect; -struct WebURLError; -struct WebWindowFeatures; -} - -namespace webkit_support { -class MediaStreamUtil; -class TestMediaStreamClient; -} - -class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, public NavigationHost, - public WebKit::WebPrerendererClient, public WebKit::WebSpellCheckClient, - public WebTestRunner::WebTestDelegate { - public: - WebViewHost(TestShell*); - virtual ~WebViewHost(); - void setWebWidget(WebKit::WebWidget*); - WebKit::WebView* webView() const; - WebKit::WebWidget* webWidget() const; - WebTestRunner::WebTestProxyBase* proxy() const; - void setProxy(WebTestRunner::WebTestProxyBase*); - void reset(); - void setSelectTrailingWhitespaceEnabled(bool); - void setSmartInsertDeleteEnabled(bool); - void setLogConsoleOutput(bool); - void waitForPolicyDelegate(); - void setCustomPolicyDelegate(bool, bool); - WebKit::WebFrame* topLoadingFrame() { return m_topLoadingFrame; } - void setBlockRedirects(bool block) { m_blocksRedirects = block; } - void setRequestReturnNull(bool returnNull) { m_requestReturnNull = returnNull; } - void setPendingExtraData(PassOwnPtr<TestShellExtraData>); - void setDeviceScaleFactor(float); - - void paintRect(const WebKit::WebRect&); - void paintInvalidatedRegion(); - void paintPagesWithBoundaries(); - SkCanvas* canvas(); - void displayRepaintMask(); - - void loadURLForFrame(const WebKit::WebURL&, const WebKit::WebString& frameName); - TestNavigationController* navigationController() { return m_navigationController.get(); } - - void addClearHeader(const WTF::String& header) { m_clearHeaders.add(header); } - const HashSet<WTF::String>& clearHeaders() const { return m_clearHeaders; } - void closeWidget(); - -#if ENABLE(INPUT_SPEECH) - MockWebSpeechInputController* speechInputControllerMock() { return m_speechInputControllerMock.get(); } -#endif - -#if ENABLE(SCRIPTED_SPEECH) - MockWebSpeechRecognizer* mockSpeechRecognizer() { return m_mockSpeechRecognizer.get(); } -#endif - -#if ENABLE(POINTER_LOCK) - void didAcquirePointerLock(); - void didNotAcquirePointerLock(); - void didLosePointerLock(); - void setPointerLockWillRespondAsynchronously() { m_pointerLockPlannedResult = PointerLockWillRespondAsync; } - void setPointerLockWillFailSynchronously() { m_pointerLockPlannedResult = PointerLockWillFailSync; } -#endif - - // WebTestDelegate. - virtual WebKit::WebContextMenuData* lastContextMenuData() const OVERRIDE; - virtual void clearContextMenuData() OVERRIDE; - virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE; - virtual void clearEditCommand() OVERRIDE; - virtual void fillSpellingSuggestionList(const WebKit::WebString& word, WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE; - virtual void setGamepadData(const WebKit::WebGamepads&) OVERRIDE; - virtual void printMessage(const std::string& message) OVERRIDE; - virtual void postTask(WebTestRunner::WebTask*) OVERRIDE; - virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) OVERRIDE; - virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) OVERRIDE; - virtual long long getCurrentTimeInMillisecond() OVERRIDE; - virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) OVERRIDE; - - // NavigationHost - virtual bool navigate(const TestNavigationEntry&, bool reload); - - // WebKit::WebPrerendererClient - virtual void willAddPrerender(WebKit::WebPrerender*) OVERRIDE; - - // WebKit::WebSpellCheckClient - virtual void spellCheck(const WebKit::WebString&, int& offset, int& length, WebKit::WebVector<WebKit::WebString>* optionalSuggestions); - virtual void checkTextOfParagraph(const WebKit::WebString&, WebKit::WebTextCheckingTypeMask, WebKit::WebVector<WebKit::WebTextCheckingResult>*); - virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*); - virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&); - - // WebKit::WebViewClient - virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&, WebKit::WebNavigationPolicy); - virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType); - virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&); - virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota); - virtual WebKit::WebCompositorOutputSurface* createOutputSurface(); - virtual void didAddMessageToConsole(const WebKit::WebConsoleMessage&, const WebKit::WebString& sourceName, unsigned sourceLine); - virtual void didStartLoading(); - virtual void didStopLoading(); - virtual bool shouldBeginEditing(const WebKit::WebRange&); - virtual bool shouldEndEditing(const WebKit::WebRange&); - virtual bool shouldInsertNode(const WebKit::WebNode&, const WebKit::WebRange&, WebKit::WebEditingAction); - virtual bool shouldInsertText(const WebKit::WebString&, const WebKit::WebRange&, WebKit::WebEditingAction); - virtual bool shouldChangeSelectedRange(const WebKit::WebRange& from, const WebKit::WebRange& to, WebKit::WebTextAffinity, bool stillSelecting); - virtual bool shouldDeleteRange(const WebKit::WebRange&); - virtual bool shouldApplyStyle(const WebKit::WebString& style, const WebKit::WebRange&); - virtual bool isSmartInsertDeleteEnabled(); - virtual bool isSelectTrailingWhitespaceEnabled(); - virtual void didBeginEditing(); - virtual void didChangeSelection(bool isSelectionEmpty); - virtual void didChangeContents(); - virtual void didEndEditing(); - virtual bool handleCurrentKeyboardEvent(); - virtual void runModalAlertDialog(WebKit::WebFrame*, const WebKit::WebString&); - virtual bool runModalConfirmDialog(WebKit::WebFrame*, const WebKit::WebString&); - virtual bool runModalPromptDialog(WebKit::WebFrame*, const WebKit::WebString& message, const WebKit::WebString& defaultValue, WebKit::WebString* actualValue); - virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame*, const WebKit::WebString&); - virtual void showContextMenu(WebKit::WebFrame*, const WebKit::WebContextMenuData&); - virtual void setStatusText(const WebKit::WebString&); - virtual void didUpdateLayout(); - virtual void navigateBackForwardSoon(int offset); - virtual int historyBackListCount(); - virtual int historyForwardListCount(); -#if ENABLE(NOTIFICATIONS) - virtual WebKit::WebNotificationPresenter* notificationPresenter(); -#endif - virtual WebKit::WebGeolocationClient* geolocationClient(); -#if ENABLE(INPUT_SPEECH) - virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*); -#endif -#if ENABLE(SCRIPTED_SPEECH) - virtual WebKit::WebSpeechRecognizer* speechRecognizer() OVERRIDE; -#endif - virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient() OVERRIDE; -#if ENABLE(MEDIA_STREAM) - virtual WebKit::WebUserMediaClient* userMediaClient(); -#endif - virtual void printPage(WebKit::WebFrame*); - - // WebKit::WebWidgetClient - virtual void didAutoResize(const WebKit::WebSize& newSize); - virtual void scheduleAnimation(); - virtual void didFocus(); - virtual void didBlur(); - virtual void didChangeCursor(const WebKit::WebCursorInfo&); - virtual void closeWidgetSoon(); - virtual void show(WebKit::WebNavigationPolicy); - virtual void runModal(); - virtual bool enterFullScreen(); - virtual void exitFullScreen(); - virtual WebKit::WebRect windowRect(); - virtual void setWindowRect(const WebKit::WebRect&); - virtual WebKit::WebRect rootWindowRect(); - virtual WebKit::WebRect windowResizerRect(); - virtual WebKit::WebScreenInfo screenInfo(); -#if ENABLE(POINTER_LOCK) - virtual bool requestPointerLock(); - virtual void requestPointerUnlock(); - virtual bool isPointerLocked(); -#endif - - // WebKit::WebFrameClient - virtual WebKit::WebPlugin* createPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&); - virtual WebKit::WebMediaPlayer* createMediaPlayer(WebKit::WebFrame*, const WebKit::WebURL&, WebKit::WebMediaPlayerClient*); - virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebFrame*, WebKit::WebApplicationCacheHostClient*); - virtual void loadURLExternally(WebKit::WebFrame*, const WebKit::WebURLRequest&, WebKit::WebNavigationPolicy); - virtual void loadURLExternally(WebKit::WebFrame*, const WebKit::WebURLRequest&, WebKit::WebNavigationPolicy, const WebKit::WebString& downloadName); - virtual WebKit::WebNavigationPolicy decidePolicyForNavigation( - WebKit::WebFrame*, const WebKit::WebURLRequest&, - WebKit::WebNavigationType, const WebKit::WebNode&, - WebKit::WebNavigationPolicy, bool isRedirect); - virtual bool canHandleRequest(WebKit::WebFrame*, const WebKit::WebURLRequest&); - virtual WebKit::WebURLError cannotHandleRequestError(WebKit::WebFrame*, const WebKit::WebURLRequest&); - virtual WebKit::WebURLError cancelledError(WebKit::WebFrame*, const WebKit::WebURLRequest&); - virtual void unableToImplementPolicyWithError(WebKit::WebFrame*, const WebKit::WebURLError&); - virtual void willPerformClientRedirect( - WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to, - double interval, double fireTime); - virtual void didCancelClientRedirect(WebKit::WebFrame*); - virtual void didCreateDataSource(WebKit::WebFrame*, WebKit::WebDataSource*); - virtual void didStartProvisionalLoad(WebKit::WebFrame*); - virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*); - virtual void didFailProvisionalLoad(WebKit::WebFrame*, const WebKit::WebURLError&); - virtual void didCommitProvisionalLoad(WebKit::WebFrame*, bool isNewNavigation); - virtual void didClearWindowObject(WebKit::WebFrame*); - virtual void didReceiveTitle(WebKit::WebFrame*, const WebKit::WebString&, WebKit::WebTextDirection); - virtual void didFinishDocumentLoad(WebKit::WebFrame*); - virtual void didHandleOnloadEvents(WebKit::WebFrame*); - virtual void didFailLoad(WebKit::WebFrame*, const WebKit::WebURLError&); - virtual void didFinishLoad(WebKit::WebFrame*); - virtual void didNavigateWithinPage(WebKit::WebFrame*, bool isNewNavigation); - virtual void didChangeLocationWithinPage(WebKit::WebFrame*); - virtual void assignIdentifierToRequest(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&); - virtual void removeIdentifierForRequest(unsigned identifier); - virtual void willRequestResource(WebKit::WebFrame*, const WebKit::WebCachedURLRequest&); - virtual void willSendRequest(WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, const WebKit::WebURLResponse&); - virtual void didReceiveResponse(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLResponse&); - virtual void didFinishResourceLoad(WebKit::WebFrame*, unsigned identifier); - virtual void didFailResourceLoad(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLError&); - virtual void didDisplayInsecureContent(WebKit::WebFrame*); - virtual void didRunInsecureContent(WebKit::WebFrame*, const WebKit::WebSecurityOrigin&, const WebKit::WebURL&); - virtual void didDetectXSS(WebKit::WebFrame*, const WebKit::WebURL&, bool didBlockEntirePage); - virtual void openFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, long long size, bool create, WebKit::WebFileSystemCallbacks*); - virtual void deleteFileSystem(WebKit::WebFrame*, WebKit::WebFileSystem::Type, WebKit::WebFileSystemCallbacks*); - virtual bool willCheckAndDispatchMessageEvent( - WebKit::WebFrame* sourceFrame, WebKit::WebFrame* targetFrame, - WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent); - virtual void registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo&); - virtual void dispatchIntent(WebKit::WebFrame*, const WebKit::WebIntentRequest&); - virtual void deliveredIntentResult(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&); - virtual void deliveredIntentFailure(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&); - - WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock(); - - // Spellcheck related helper APIs - MockSpellCheck* mockSpellCheck(); - void finishLastTextCheck(); - - // Geolocation client mocks for DRTTestRunner - WebKit::WebGeolocationClientMock* geolocationClientMock(); - - // Pending task list, Note taht the method is referred from WebMethodTask class. - WebTestRunner::WebTaskList* taskList() { return &m_taskList; } - - // The current web intents request. - WebKit::WebIntentRequest* currentIntentRequest() { return &m_currentRequest; } - -private: - - class HostMethodTask : public WebTestRunner::WebMethodTask<WebViewHost> { - public: - typedef void (WebViewHost::*CallbackMethodType)(); - HostMethodTask(WebViewHost* object, CallbackMethodType callback) - : WebTestRunner::WebMethodTask<WebViewHost>(object) - , m_callback(callback) - { } - - virtual void runIfValid() { (m_object->*m_callback)(); } - - private: - CallbackMethodType m_callback; - }; - - DRTTestRunner* testRunner() const; - - // Called the title of the page changes. - // Can be used to update the title of the window. - void setPageTitle(const WebKit::WebString&); - - // Called when the URL of the page changes. - // Extracts the URL and forwards on to SetAddressBarURL(). - void updateAddressBar(WebKit::WebView*); - - // Called when the URL of the page changes. - // Should be used to update the text of the URL bar. - void setAddressBarURL(const WebKit::WebURL&); - - void enterFullScreenNow(); - void exitFullScreenNow(); - - // In the Mac code, this is called to trigger the end of a test after the - // page has finished loading. From here, we can generate the dump for the - // test. - void locationChangeDone(WebKit::WebFrame*); - - void updateForCommittedLoad(WebKit::WebFrame*, bool isNewNavigation); - void updateURL(WebKit::WebFrame*); - void updateSessionHistory(WebKit::WebFrame*); - - // Dumping a frame to the console. - void printFrameDescription(WebKit::WebFrame*); - - // Dumping the user gesture status to the console. - void printFrameUserGestureStatus(WebKit::WebFrame*, const char*); - - bool hasWindow() const { return m_hasWindow; } - void resetScrollRect(); - void discardBackingStore(); - -#if ENABLE(MEDIA_STREAM) - WebUserMediaClientMock* userMediaClientMock(); - 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 - // don't actually want to open the mail program. - bool m_policyDelegateEnabled; - - // Toggles the behavior of the policy delegate. If true, then navigations - // will be allowed. Otherwise, they will be ignored (dropped). - bool m_policyDelegateIsPermissive; - - // If true, the policy delegate will signal layout test completion. - bool m_policyDelegateShouldNotifyDone; - - // Non-owning pointer. The WebViewHost instance is owned by this TestShell instance. - TestShell* m_shell; - - // Non-owning pointer. This class needs to be wrapped in a WebTestProxy. This is the pointer to the WebTestProxyBase. - WebTestRunner::WebTestProxyBase* m_proxy; - - // This delegate works for the following widget. - WebKit::WebWidget* m_webWidget; - - // This is non-0 IFF a load is in progress. - WebKit::WebFrame* m_topLoadingFrame; - - // For tracking session history. See RenderView. - int m_pageId; - int m_lastPageIdUpdated; - - OwnPtr<TestShellExtraData> m_pendingExtraData; - - // Maps resource identifiers to a descriptive string. - typedef HashMap<unsigned, std::string> ResourceMap; - ResourceMap m_resourceIdentifierMap; - void printResourceDescription(unsigned identifier); - - WebKit::WebCursorInfo m_currentCursor; - - bool m_hasWindow; - bool m_inModalLoop; - WebKit::WebRect m_windowRect; - - // true if we want to enable smart insert/delete. - bool m_smartInsertDeleteEnabled; - - // true if we want to enable selection of trailing whitespaces - bool m_selectTrailingWhitespaceEnabled; - - // true if whatever is sent to the console should be logged to stdout. - bool m_logConsoleOutput; - - // Set of headers to clear in willSendRequest. - HashSet<WTF::String> m_clearHeaders; - - // true if we should block any redirects - bool m_blocksRedirects; - - // true if we should block (set an empty request for) any requests - bool m_requestReturnNull; - - // Edit command associated to the current keyboard event. - std::string m_editCommandName; - std::string m_editCommandValue; - - // The mock spellchecker used in spellCheck(). - MockSpellCheck m_spellcheck; - - // Painting. - OwnPtr<SkCanvas> m_canvas; - WebKit::WebRect m_paintRect; - bool m_isPainting; - - OwnPtr<WebKit::WebContextMenuData> m_lastContextMenuData; - - // Geolocation - OwnPtr<WebKit::WebGeolocationClientMock> m_geolocationClientMock; - - OwnPtr<WebKit::WebDeviceOrientationClientMock> m_deviceOrientationClientMock; -#if ENABLE(INPUT_SPEECH) - OwnPtr<MockWebSpeechInputController> m_speechInputControllerMock; -#endif - -#if ENABLE(SCRIPTED_SPEECH) - OwnPtr<MockWebSpeechRecognizer> m_mockSpeechRecognizer; -#endif - -#if ENABLE(MEDIA_STREAM) - OwnPtr<WebUserMediaClientMock> m_userMediaClientMock; - OwnPtr<webkit_support::TestMediaStreamClient> m_testMediaStreamClient; -#endif - - OwnPtr<TestNavigationController> m_navigationController; - - WebKit::WebString m_lastRequestedTextCheckString; - WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion; - - WebTestRunner::WebTaskList m_taskList; - Vector<WebKit::WebWidget*> m_popupmenus; - -#if ENABLE(POINTER_LOCK) - bool m_pointerLocked; - enum { - PointerLockWillSucceed, - PointerLockWillRespondAsync, - 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/chromium/WebViewHostOutputSurface.cpp b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp deleted file mode 100644 index 09a0af501..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "WebViewHostOutputSurface.h" - -#include <public/WebCompositorSoftwareOutputDevice.h> -#include <public/WebGraphicsContext3D.h> -#include <wtf/Assertions.h> - -namespace WebKit { - -PassOwnPtr<WebViewHostOutputSurface> WebViewHostOutputSurface::create3d(PassOwnPtr<WebKit::WebGraphicsContext3D> context3d) -{ - return adoptPtr(new WebViewHostOutputSurface(context3d)); -} - -PassOwnPtr<WebViewHostOutputSurface> WebViewHostOutputSurface::createSoftware(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice> softwareDevice) -{ - return adoptPtr(new WebViewHostOutputSurface(softwareDevice)); -} - -WebViewHostOutputSurface::WebViewHostOutputSurface(PassOwnPtr<WebKit::WebGraphicsContext3D> context) - : m_context(context) -{ -} - -WebViewHostOutputSurface::WebViewHostOutputSurface(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice> softwareDevice) - : m_softwareDevice(softwareDevice) -{ -} - -WebViewHostOutputSurface::~WebViewHostOutputSurface() -{ -} - -bool WebViewHostOutputSurface::bindToClient(WebCompositorOutputSurfaceClient*) -{ - if (!m_context) - return true; - - return m_context->makeContextCurrent(); -} - -const WebKit::WebCompositorOutputSurface::Capabilities& WebViewHostOutputSurface::capabilities() const -{ - return m_capabilities; -} - -WebGraphicsContext3D* WebViewHostOutputSurface::context3D() const -{ - return m_context.get(); -} - -WebCompositorSoftwareOutputDevice* WebViewHostOutputSurface::softwareDevice() const -{ - return m_softwareDevice.get(); -} - -void WebViewHostOutputSurface::sendFrameToParentCompositor(const WebCompositorFrame&) -{ - ASSERT_NOT_REACHED(); -} - -} diff --git a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h b/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h deleted file mode 100644 index bbd61a21a..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHostOutputSurface.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebViewHostOutputSurface_h -#define WebViewHostOutputSurface_h - -#include <public/WebCompositorOutputSurface.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -namespace WebKit { - -class WebCompositorOutputSurfaceClient; -class WebCompositorSoftwareOutputDevice; -class WebGraphicsContext3D; - -class WebViewHostOutputSurface : public WebKit::WebCompositorOutputSurface { -public: - static PassOwnPtr<WebViewHostOutputSurface> create3d(PassOwnPtr<WebKit::WebGraphicsContext3D>); - static PassOwnPtr<WebViewHostOutputSurface> createSoftware(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice>); - virtual ~WebViewHostOutputSurface(); - - virtual bool bindToClient(WebCompositorOutputSurfaceClient*) OVERRIDE; - - virtual const WebKit::WebCompositorOutputSurface::Capabilities& capabilities() const OVERRIDE; - virtual WebGraphicsContext3D* context3D() const OVERRIDE; - virtual WebCompositorSoftwareOutputDevice* softwareDevice() const OVERRIDE; - virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE; - -private: - explicit WebViewHostOutputSurface(PassOwnPtr<WebKit::WebGraphicsContext3D>); - explicit WebViewHostOutputSurface(PassOwnPtr<WebKit::WebCompositorSoftwareOutputDevice>); - - WebKit::WebCompositorOutputSurface::Capabilities m_capabilities; - OwnPtr<WebKit::WebGraphicsContext3D> m_context; - OwnPtr<WebKit::WebCompositorSoftwareOutputDevice> m_softwareDevice; -}; - -} - -#endif // WebViewHostOutputSurface_h diff --git a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp deleted file mode 100644 index ecee9940d..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "WebViewHostSoftwareOutputDevice.h" - -#include "SkBitmap.h" -#include "SkDevice.h" -#include <public/WebSize.h> -#include <wtf/Assertions.h> - -namespace WebKit { - -WebImage* WebViewHostSoftwareOutputDevice::lock(bool forWrite) -{ - ASSERT(m_device); - m_image = m_device->accessBitmap(forWrite); - return &m_image; -} - -void WebViewHostSoftwareOutputDevice::unlock() -{ - m_image.reset(); -} - -void WebViewHostSoftwareOutputDevice::didChangeViewportSize(WebSize size) -{ - if (m_device && size.width == m_device->width() && size.height == m_device->height()) - return; - - m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, size.width, size.height, true)); -} - - -} diff --git a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h b/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h deleted file mode 100644 index 5bd551ff9..000000000 --- a/Tools/DumpRenderTree/chromium/WebViewHostSoftwareOutputDevice.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebViewHostSoftwareOutputDevice_h -#define WebViewHostSoftwareOutputDevice_h - -#include <public/WebCompositorSoftwareOutputDevice.h> -#include <public/WebImage.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -class SkDevice; - -namespace WebKit { - -struct WebSize; - -class WebViewHostSoftwareOutputDevice : public WebKit::WebCompositorSoftwareOutputDevice { -public: - virtual WebImage* lock(bool forWrite) OVERRIDE; - virtual void unlock() OVERRIDE; - - virtual void didChangeViewportSize(WebSize) OVERRIDE; - -private: - OwnPtr<SkDevice> m_device; - WebImage m_image; -}; - -} - -#endif // WebViewHostSoftwareOutputDevice_h diff --git a/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml b/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml deleted file mode 100644 index 79193b7c4..000000000 --- a/Tools/DumpRenderTree/chromium/android_fallback_fonts.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<familyset> - <family> - <fileset> - <file>DejaVuSans.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>kochi-mincho.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>lohit_hi.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>lohit_ta.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>MuktiNarrow.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>Garuda.ttf</file> - </fileset> - </family> - <family> - <fileset> - <file>lohit_pa.ttf</file> - </fileset> - </family> -</familyset> diff --git a/Tools/DumpRenderTree/chromium/android_main_fonts.xml b/Tools/DumpRenderTree/chromium/android_main_fonts.xml deleted file mode 100644 index b6afa7944..000000000 --- a/Tools/DumpRenderTree/chromium/android_main_fonts.xml +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<familyset> - - <family> - <nameset> - <name>sans</name> - <name>sans serif</name> - <name>sans-serif</name> - <name>Arial</name> - <name>Helvetica</name> - </nameset> - <fileset> - <file>Arial.ttf</file> - <file>Arial_Bold.ttf</file> - <file>Arial_Italic.ttf</file> - <file>Arial_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>serif</name> - <name>Times</name> - <name>Times New Roman</name> - <name>Monaco</name> - <!-- Match chromium-linux. See comments of SubpixelPositioning in fonts.conf --> - <name>SubpixelPositioning</name> - </nameset> - <fileset> - <file>Times_New_Roman.ttf</file> - <file>Times_New_Roman_Bold.ttf</file> - <file>Times_New_Roman_Italic.ttf</file> - <file>Times_New_Roman_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>mono</name> - <name>monospace</name> - <name>Courier</name> - <name>Courier New</name> - </nameset> - <fileset> - <file>Courier_New.ttf</file> - <file>Courier_New_Bold.ttf</file> - <file>Courier_New_Italic.ttf</file> - <file>Courier_New_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>cursive</name> - <name>Comic Sans MS</name> - </nameset> - <fileset> - <file>Comic_Sans_MS.ttf</file> - <file>Comic_Sans_MS_Bold.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>fantasy</name> - <name>Impact</name> - </nameset> - <fileset> - <file>Impact.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>Georgia</name> - </nameset> - <fileset> - <file>Georgia.ttf</file> - <file>Georgia_Bold.ttf</file> - <file>Georgia_Italic.ttf</file> - <file>Georgia_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>Trebuchet MS</name> - </nameset> - <fileset> - <file>Trebuchet_MS.ttf</file> - <file>Trebuchet_MS_Bold.ttf</file> - <file>Trebuchet_MS_Italic.ttf</file> - <file>Trebuchet_MS_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>Verdana</name> - </nameset> - <fileset> - <file>Verdana.ttf</file> - <file>Verdana_Bold.ttf</file> - <file>Verdana_Italic.ttf</file> - <file>Verdana_Bold_Italic.ttf</file> - </fileset> - </family> - - <family> - <nameset> - <name>Ahem</name> - <!-- Match chromium-linux. See comments of SubpixelPositioning in fonts.conf --> - <name>SubpixelPositioningAhem</name> - </nameset> - <fileset> - <file>AHEM____.TTF</file> - </fileset> - </family> - -</familyset> diff --git a/Tools/DumpRenderTree/chromium/config.h b/Tools/DumpRenderTree/chromium/config.h deleted file mode 100644 index ef418aec0..000000000 --- a/Tools/DumpRenderTree/chromium/config.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef config_h -#define config_h - -#include <wtf/Platform.h> -#include <wtf/ExportMacros.h> - -#if OS(WINDOWS) && !COMPILER(GCC) -// Allow 'this' to be used in base member initializer list. -#pragma warning(disable : 4355) -#endif - -#endif // config_h diff --git a/Tools/DumpRenderTree/chromium/fonts.conf b/Tools/DumpRenderTree/chromium/fonts.conf deleted file mode 100644 index d337b1243..000000000 --- a/Tools/DumpRenderTree/chromium/fonts.conf +++ /dev/null @@ -1,252 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> -<!-- /etc/fonts/fonts.conf file to configure system font access --> -<fontconfig> - <match target="font"> - <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>Times</string> - </test> - <edit name="family" mode="assign"> - <string>Times New Roman</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>sans</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>sans serif</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - </match> - - <!-- Some layout tests specify Helvetica as a family and we need to make sure - that we don't fallback to Times New Roman for them --> - <match target="pattern"> - <test qual="any" name="family"> - <string>Helvetica</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>sans-serif</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>serif</string> - </test> - <edit name="family" mode="assign"> - <string>Times New Roman</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>mono</string> - </test> - <edit name="family" mode="assign"> - <string>Courier New</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>monospace</string> - </test> - <edit name="family" mode="assign"> - <string>Courier New</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>Courier</string> - </test> - <edit name="family" mode="assign"> - <string>Courier New</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>cursive</string> - </test> - <edit name="family" mode="assign"> - <string>Comic Sans MS</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>fantasy</string> - </test> - <edit name="family" mode="assign"> - <string>Impact</string> - </edit> - </match> - - <match target="pattern"> - <test qual="any" name="family"> - <string>Monaco</string> - </test> - <edit name="family" mode="assign"> - <string>Times New Roman</string> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>NonAntiAliasedSans</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="antialias" mode="assign"> - <bool>false</bool> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>SlightHintedGeorgia</string> - </test> - <edit name="family" mode="assign"> - <string>Georgia</string> - </edit> - <edit name="hintstyle" mode="assign"> - <const>hintslight</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>NonHintedSans</string> - </test> - <edit name="family" mode="assign"> - <string>Verdana</string> - </edit> - <!-- These deliberately contradict each other. The 'hinting' preference - should take priority --> - <edit name="hintstyle" mode="assign"> - <const>hintfull</const> - </edit> - <edit name="hinting" mode="assign"> - <bool>false</bool> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>AutohintedSerif</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="autohint" mode="assign"> - <bool>true</bool> - </edit> - <edit name="hintstyle" mode="assign"> - <const>hintmedium</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>HintedSerif</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="autohint" mode="assign"> - <bool>false</bool> - </edit> - <edit name="hintstyle" mode="assign"> - <const>hintmedium</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>FullAndAutoHintedSerif</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="autohint" mode="assign"> - <bool>true</bool> - </edit> - <edit name="hintstyle" mode="assign"> - <const>hintfull</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>SubpixelEnabledArial</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="rgba" mode="assign"> - <const>rgb</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>SubpixelDisabledArial</string> - </test> - <edit name="family" mode="assign"> - <string>Arial</string> - </edit> - <edit name="rgba" mode="assign"> - <const>none</const> - </edit> - </match> - - <match target="pattern"> - <!-- FontConfig doesn't currently provide a well-defined way to turn on - subpixel positioning. This is just an arbitrary pattern to use after - turning subpixel positioning on globally to ensure that we don't have - issues with our style getting cached for other tests. --> - <test name="family" compare="eq"> - <string>SubpixelPositioning</string> - </test> - <edit name="family" mode="assign"> - <string>Times New Roman</string> - </edit> - </match> - - <match target="pattern"> - <!-- See comments above --> - <test name="family" compare="eq"> - <string>SubpixelPositioningAhem</string> - </test> - <edit name="family" mode="assign"> - <string>ahem</string> - </edit> - </match> - -</fontconfig> diff --git a/Tools/DumpRenderTree/config.h b/Tools/DumpRenderTree/config.h index ccff71c7c..6424465dc 100644 --- a/Tools/DumpRenderTree/config.h +++ b/Tools/DumpRenderTree/config.h @@ -30,16 +30,7 @@ #include <wtf/Platform.h> #include <wtf/ExportMacros.h> -#if USE(JSC) #include <runtime/JSExportMacros.h> -#endif - -// On MSW, wx headers need to be included before windows.h is. -// The only way we can always ensure this is if we include wx here. -#if PLATFORM(WX) -#include <wx/defs.h> -#endif - #ifdef __cplusplus #undef new @@ -85,10 +76,10 @@ #endif #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 +#define _WIN32_WINNT 0x0502 #undef WINVER -#define WINVER 0x0500 +#define WINVER 0x0502 #undef _WINSOCKAPI_ #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h diff --git a/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp b/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp new file mode 100644 index 000000000..8012da637 --- /dev/null +++ b/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AccessibilityController.h" + +#if HAVE(ACCESSIBILITY) + +#include "AccessibilityCallbacks.h" +#include "AccessibilityUIElement.h" +#include "DumpRenderTree.h" +#include "DumpRenderTreeChrome.h" +#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" + +#include <atk/atk.h> +#include <wtf/gobject/GOwnPtr.h> + +AccessibilityUIElement AccessibilityController::focusedElement() +{ + AtkObject* accessible = DumpRenderTreeSupportEfl::focusedAccessibleElement(browser->mainFrame()); + if (!accessible) + return 0; + + return AccessibilityUIElement(accessible); +} + +AccessibilityUIElement AccessibilityController::rootElement() +{ + AtkObject* accessible = DumpRenderTreeSupportEfl::rootAccessibleElement(browser->mainFrame()); + if (!accessible) + return 0; + + return AccessibilityUIElement(accessible); +} + +AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id) +{ + AtkObject* root = DumpRenderTreeSupportEfl::rootAccessibleElement(browser->mainFrame()); + if (!root) + return 0; + + size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id); + GOwnPtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize))); + JSStringGetUTF8CString(id, idBuffer.get(), bufferSize); + + AtkObject* result = childElementById(root, idBuffer.get()); + if (ATK_IS_OBJECT(result)) + return AccessibilityUIElement(result); + + return 0; +} + +#endif diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h b/Tools/DumpRenderTree/efl/AccessibilityUIElementEfl.cpp index 2398be3ae..9e115d9e9 100644 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h +++ b/Tools/DumpRenderTree/efl/AccessibilityUIElementEfl.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2010 Google Inc. All Rights Reserved. + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * Copyright (C) 2013 Samsung Electronics. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,40 +22,33 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// This implements the WebThemeEngine API in such a way that we match the Mac -// port rendering more than usual Chromium path, thus allowing us to share -// more pixel baselines. +#include "config.h" +#include "AccessibilityUIElement.h" -#ifndef WebThemeEngineDRTMac_h -#define WebThemeEngineDRTMac_h +#if HAVE(ACCESSIBILITY) -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h" +#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" +#include <JavaScriptCore/JSStringRef.h> +#include <atk/atk.h> +#include <wtf/Assertions.h> +#include <wtf/gobject/GOwnPtr.h> +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/WTFString.h> +#include <wtf/unicode/CharacterNames.h> -class WebThemeEngineDRTMac : public WebKit::WebThemeEngine { -public: - virtual void paintScrollbarThumb( - WebKit::WebCanvas*, - WebKit::WebThemeEngine::State, - WebKit::WebThemeEngine::Size, - const WebKit::WebRect&, - const WebKit::WebThemeEngine::ScrollbarInfo&); +JSStringRef AccessibilityUIElement::helpText() const +{ + if (!m_element) + return JSStringCreateWithCharacters(0, 0); -private: - virtual void paintHIThemeScrollbarThumb( - WebKit::WebCanvas*, - WebKit::WebThemeEngine::State, - WebKit::WebThemeEngine::Size, - const WebKit::WebRect&, - const WebKit::WebThemeEngine::ScrollbarInfo&); - virtual void paintNSScrollerScrollbarThumb( - WebKit::WebCanvas*, - WebKit::WebThemeEngine::State, - WebKit::WebThemeEngine::Size, - const WebKit::WebRect&, - const WebKit::WebThemeEngine::ScrollbarInfo&); -}; + ASSERT(ATK_IS_OBJECT(m_element)); -#endif // WebThemeEngineDRTMac_h + String helpText = DumpRenderTreeSupportEfl::accessibilityHelpText(ATK_OBJECT(m_element)); + GOwnPtr<gchar> axHelpText(g_strdup_printf("AXHelp: %s", helpText.utf8().data())); + return JSStringCreateWithUTF8CString(axHelpText.get()); +} + +#endif diff --git a/Tools/DumpRenderTree/efl/CMakeLists.txt b/Tools/DumpRenderTree/efl/CMakeLists.txt index 7f3563d90..998019121 100644 --- a/Tools/DumpRenderTree/efl/CMakeLists.txt +++ b/Tools/DumpRenderTree/efl/CMakeLists.txt @@ -1,11 +1,19 @@ -SET(DumpRenderTree_SOURCES +set(DumpRenderTree_SOURCES + ${TOOLS_DIR}/DumpRenderTree/AccessibilityController.cpp + ${TOOLS_DIR}/DumpRenderTree/AccessibilityTextMarker.cpp + ${TOOLS_DIR}/DumpRenderTree/AccessibilityUIElement.cpp ${TOOLS_DIR}/DumpRenderTree/DumpRenderTreeCommon.cpp ${TOOLS_DIR}/DumpRenderTree/CyclicRedundancyCheck.cpp ${TOOLS_DIR}/DumpRenderTree/GCController.cpp ${TOOLS_DIR}/DumpRenderTree/TestRunner.cpp ${TOOLS_DIR}/DumpRenderTree/PixelDumpSupport.cpp ${TOOLS_DIR}/DumpRenderTree/WorkQueue.cpp + ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp + ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityControllerAtk.cpp + ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp ${TOOLS_DIR}/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp + ${TOOLS_DIR}/DumpRenderTree/efl/AccessibilityControllerEfl.cpp + ${TOOLS_DIR}/DumpRenderTree/efl/AccessibilityUIElementEfl.cpp ${TOOLS_DIR}/DumpRenderTree/efl/DumpHistoryItem.cpp ${TOOLS_DIR}/DumpRenderTree/efl/DumpRenderTree.cpp ${TOOLS_DIR}/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -21,16 +29,12 @@ SET(DumpRenderTree_SOURCES ${TOOLS_DIR}/DumpRenderTree/efl/WorkQueueItemEfl.cpp ) -SET(ImageDiff_SOURCES - ${TOOLS_DIR}/DumpRenderTree/efl/ImageDiff.cpp -) - -SET(DumpRenderTree_LIBRARIES - ${JavaScriptCore_LIBRARY_NAME} - ${WebCoreTestSupport_LIBRARY_NAME} - ${WebCore_LIBRARY_NAME} - ${WebKit_LIBRARY_NAME} - ${WTF_LIBRARY_NAME} +set(DumpRenderTree_LIBRARIES + JavaScriptCore + WebCoreTestSupport + WebCore + WebKit + WTF ${CAIRO_LIBRARIES} ${ECORE_LIBRARIES} ${ECORE_EVAS_LIBRARIES} @@ -38,16 +42,17 @@ SET(DumpRenderTree_LIBRARIES ${ECORE_INPUT_LIBRARIES} ${EDJE_LIBRARIES} ${EINA_LIBRARIES} + ${EO_LIBRARIES} ${EVAS_LIBRARIES} ${FONTCONFIG_LIBRARIES} ${LIBXML2_LIBRARIES} - ${LIBXSLT_LIBRARIES} + ${LIBXSLT_LIBRARIES} -lm ${SQLITE_LIBRARIES} ${GLIB_LIBRARIES} ${LIBSOUP_LIBRARIES} ) -SET(DumpRenderTree_INCLUDE_DIRECTORIES +set(DumpRenderTree_INCLUDE_DIRECTORIES "${WEBKIT_DIR}/efl/ewk" ${WEBKIT_DIR}/efl ${WEBKIT_DIR}/efl/WebCoreSupport @@ -72,6 +77,7 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${WEBCORE_DIR}/platform/network/soup ${WEBCORE_DIR}/plugins ${WEBCORE_DIR}/rendering + ${WEBCORE_DIR}/rendering/shapes ${WEBCORE_DIR}/rendering/style ${WEBCORE_DIR}/history ${WEBCORE_DIR}/loader @@ -87,9 +93,11 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${JAVASCRIPTCORE_DIR}/interpreter ${JAVASCRIPTCORE_DIR}/jit ${JAVASCRIPTCORE_DIR}/llint + ${JAVASCRIPTCORE_DIR}/profiler ${JAVASCRIPTCORE_DIR}/runtime ${JAVASCRIPTCORE_DIR}/ForwardingHeaders ${TOOLS_DIR}/DumpRenderTree + ${TOOLS_DIR}/DumpRenderTree/atk ${TOOLS_DIR}/DumpRenderTree/cairo ${TOOLS_DIR}/DumpRenderTree/efl ${WTF_DIR} @@ -106,24 +114,30 @@ SET(DumpRenderTree_INCLUDE_DIRECTORIES ${ECORE_INPUT_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} ${EINA_INCLUDE_DIRS} + ${EO_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} ${FONTCONFIG_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LIBSOUP_INCLUDE_DIRS} ) +if (ENABLE_ACCESSIBILITY) + list(APPEND DumpRenderTree_INCLUDE_DIRECTORIES + ${TOOLS_DIR}/DumpRenderTree/atk + ${ATK_INCLUDE_DIRS} + ) + list(APPEND DumpRenderTree_LIBRARIES + ${ATK_LIBRARIES} + ) +endif () + # FIXME: DOWNLOADED_FONTS_DIR should not hardcode the directory # structure. See <https://bugs.webkit.org/show_bug.cgi?id=81475>. -ADD_DEFINITIONS(-DFONTS_CONF_DIR="${TOOLS_DIR}/DumpRenderTree/gtk/fonts" - -DDOWNLOADED_FONTS_DIR="${CMAKE_SOURCE_DIR}/WebKitBuild/Dependencies/Source/webkitgtk-test-fonts-0.0.3" - -DDATA_DIR="${THEME_BINARY_DIR}") - -INCLUDE_DIRECTORIES(${DumpRenderTree_INCLUDE_DIRECTORIES}) +add_definitions(-DFONTS_CONF_DIR="${TOOLS_DIR}/DumpRenderTree/gtk/fonts" + -DDOWNLOADED_FONTS_DIR="${CMAKE_SOURCE_DIR}/WebKitBuild/Dependencies/Source/webkitgtk-test-fonts-0.0.3") -ADD_EXECUTABLE(DumpRenderTree ${DumpRenderTree_SOURCES}) -TARGET_LINK_LIBRARIES(DumpRenderTree ${DumpRenderTree_LIBRARIES}) -SET_TARGET_PROPERTIES(DumpRenderTree PROPERTIES FOLDER "Tools") +include_directories(${DumpRenderTree_INCLUDE_DIRECTORIES}) -ADD_EXECUTABLE(ImageDiff ${ImageDiff_SOURCES}) -TARGET_LINK_LIBRARIES(ImageDiff ${DumpRenderTree_LIBRARIES}) -SET_TARGET_PROPERTIES(ImageDiff PROPERTIES FOLDER "Tools") +add_executable(DumpRenderTree ${DumpRenderTree_SOURCES}) +target_link_libraries(DumpRenderTree ${DumpRenderTree_LIBRARIES}) +set_target_properties(DumpRenderTree PROPERTIES FOLDER "Tools") diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index ef210e07e..ac85f04ab 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -69,10 +69,18 @@ static bool dumpPixelsForCurrentTest; static int dumpPixelsForAllTests = false; static int dumpTree = true; static int printSeparators = true; +static int useTimeoutWatchdog = true; static String dumpFramesAsText(Evas_Object* frame) { + if (!frame) + return String(); + String result; + const char* frameContents = ewk_frame_plain_text_get(frame); + + if (!frameContents) + return String(); if (browser->mainFrame() != frame) { result.append("\n--------\nFrame: '"); @@ -80,7 +88,6 @@ static String dumpFramesAsText(Evas_Object* frame) result.append("'\n--------\n"); } - const char* frameContents = ewk_frame_plain_text_get(frame); result.append(String::fromUTF8(frameContents)); result.append("\n"); eina_stringshare_del(frameContents); @@ -161,6 +168,11 @@ static void sendPixelResultsEOF() fflush(stderr); } +bool shouldSetWaitToDumpWatchdog() +{ + return !waitToDumpWatchdog && useTimeoutWatchdog; +} + static void invalidateAnyPreviousWaitToDumpWatchdog() { if (waitToDumpWatchdog) { @@ -195,6 +207,7 @@ static bool parseCommandLineOptions(int argc, char** argv) {"notree", no_argument, &dumpTree, false}, {"pixel-tests", no_argument, &dumpPixelsForAllTests, true}, {"tree", no_argument, &dumpTree, true}, + {"no-timeout", no_argument, &useTimeoutWatchdog, false}, {0, 0, 0, 0} }; @@ -274,8 +287,8 @@ static void runTest(const char* inputLine) WorkQueue::shared()->setFrozen(false); const bool isSVGW3CTest = testURL.contains("svg/W3C-SVG-1.1"); - const int width = isSVGW3CTest ? 480 : TestRunner::maxViewWidth; - const int height = isSVGW3CTest ? 360 : TestRunner::maxViewHeight; + const int width = isSVGW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth; + const int height = isSVGW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight; evas_object_resize(browser->mainView(), width, height); if (prevTestBFItem) @@ -422,11 +435,12 @@ void dump() static Ecore_Evas* initEcoreEvas() { - const char* engine = 0; + Ecore_Evas* ecoreEvas = 0; #if defined(WTF_USE_ACCELERATED_COMPOSITING) && defined(HAVE_ECORE_X) - engine = "opengl_x11"; + ecoreEvas = ecore_evas_new("opengl_x11", 0, 0, 800, 600, 0); + if (!ecoreEvas) #endif - Ecore_Evas* ecoreEvas = ecore_evas_new(engine, 0, 0, 800, 600, 0); + ecoreEvas = ecore_evas_new(0, 0, 0, 800, 600, 0); if (!ecoreEvas) { shutdownEfl(); exit(EXIT_FAILURE); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index fb9c717e2..5a63384d8 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -50,11 +50,14 @@ #include <wtf/NotFound.h> #include <wtf/text/StringBuilder.h> +#if HAVE(ACCESSIBILITY) +#include "AccessibilityController.h" +#endif + using namespace WebCore; HashMap<unsigned long, CString> DumpRenderTreeChrome::m_dumpAssignedUrls; Evas_Object* DumpRenderTreeChrome::m_provisionalLoadFailedFrame = 0; -Ewk_Intent_Request* DumpRenderTreeChrome::m_currentIntentRequest = 0; PassOwnPtr<DumpRenderTreeChrome> DumpRenderTreeChrome::create(Evas* evas) { @@ -71,6 +74,9 @@ DumpRenderTreeChrome::DumpRenderTreeChrome(Evas* evas) , m_mainFrame(0) , m_evas(evas) , m_gcController(adoptPtr(new GCController)) +#if HAVE(ACCESSIBILITY) + , m_axController(adoptPtr(new AccessibilityController)) +#endif { } @@ -96,7 +102,7 @@ Evas_Object* DumpRenderTreeChrome::createView() const if (!view) return 0; - ewk_view_theme_set(view, DATA_DIR"/default.edj"); + ewk_view_theme_set(view, TEST_THEME_DIR "/default.edj"); evas_object_smart_callback_add(view, "download,request", onDownloadRequest, 0); evas_object_smart_callback_add(view, "load,resource,failed", onResourceLoadFailed, 0); @@ -123,8 +129,6 @@ Evas_Object* DumpRenderTreeChrome::createView() const Evas_Object* mainFrame = ewk_view_frame_main_get(view); evas_object_smart_callback_add(mainFrame, "icon,changed", onFrameIconChanged, 0); - evas_object_smart_callback_add(mainFrame, "intent,new", onFrameIntentNew, 0); - evas_object_smart_callback_add(mainFrame, "intent,service,register", onFrameIntentServiceRegistration, 0); evas_object_smart_callback_add(mainFrame, "load,provisional", onFrameProvisionalLoad, 0); evas_object_smart_callback_add(mainFrame, "load,provisional,failed", onFrameProvisionalLoadFailed, 0); evas_object_smart_callback_add(mainFrame, "load,committed", onFrameLoadCommitted, 0); @@ -149,12 +153,12 @@ Evas_Object* DumpRenderTreeChrome::createInspectorView() const bool ignoreMessages = true; evas_object_data_set(inspectorView, "ignore-console-messages", &ignoreMessages); - ewk_view_theme_set(inspectorView, DATA_DIR"/default.edj"); + ewk_view_theme_set(inspectorView, TEST_THEME_DIR "/default.edj"); Evas_Object* mainFrame = ewk_view_frame_main_get(inspectorView); evas_object_smart_callback_add(mainFrame, "load,finished", onInspectorFrameLoadFinished, 0); - evas_object_resize(inspectorView, TestRunner::maxViewWidth, TestRunner::maxViewHeight); + evas_object_resize(inspectorView, TestRunner::viewWidth, TestRunner::viewHeight); evas_object_show(inspectorView); evas_object_focus_set(inspectorView, true); @@ -204,11 +208,11 @@ bool DumpRenderTreeChrome::initialize() if (!m_mainView) return false; - ewk_view_theme_set(m_mainView, DATA_DIR"/default.edj"); + ewk_view_theme_set(m_mainView, TEST_THEME_DIR "/default.edj"); evas_object_name_set(m_mainView, "m_mainView"); evas_object_move(m_mainView, 0, 0); - evas_object_resize(m_mainView, 800, 600); + evas_object_resize(m_mainView, TestRunner::viewWidth, TestRunner::viewHeight); evas_object_layer_set(m_mainView, EVAS_LAYER_MAX); evas_object_show(m_mainView); evas_object_focus_set(m_mainView, EINA_TRUE); @@ -241,11 +245,6 @@ Evas_Object* DumpRenderTreeChrome::mainView() const return m_mainView; } -Ewk_Intent_Request* DumpRenderTreeChrome::currentIntentRequest() const -{ - return m_currentIntentRequest; -} - void DumpRenderTreeChrome::resetDefaultsToConsistentValues() { ewk_settings_icon_database_clear(); @@ -281,12 +280,10 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() ewk_view_setting_auto_load_images_set(mainView(), EINA_TRUE); ewk_view_setting_user_stylesheet_set(mainView(), 0); ewk_view_setting_enable_xss_auditor_set(browser->mainView(), EINA_TRUE); - ewk_view_setting_minimum_timer_interval_set(browser->mainView(), 0.010); // 10 milliseconds (DOMTimer::s_minDefaultTimerInterval) ewk_view_setting_enable_webgl_set(mainView(), EINA_TRUE); ewk_view_setting_enable_hyperlink_auditing_set(mainView(), EINA_FALSE); ewk_view_setting_include_links_in_focus_chain_set(mainView(), EINA_FALSE); ewk_view_setting_scripts_can_access_clipboard_set(mainView(), EINA_TRUE); - ewk_view_setting_web_audio_set(mainView(), EINA_FALSE); ewk_view_setting_allow_universal_access_from_file_urls_set(mainView(), EINA_TRUE); ewk_view_setting_allow_file_access_from_file_urls_set(mainView(), EINA_TRUE); ewk_view_setting_resizable_textareas_set(mainView(), EINA_TRUE); @@ -306,6 +303,10 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() ewk_security_policy_whitelist_origin_reset(); +#if HAVE(ACCESSIBILITY) + browser->accessibilityController()->resetToConsistentState(); +#endif + DumpRenderTreeSupportEfl::clearFrameName(mainFrame()); DumpRenderTreeSupportEfl::clearOpener(mainFrame()); DumpRenderTreeSupportEfl::clearUserScripts(mainView()); @@ -315,8 +316,6 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(mainView(), -1); DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(mainView(), true); DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(mainView(), false); - DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(mainView(), false); - DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(mainView(), false); DumpRenderTreeSupportEfl::setDefersLoading(mainView(), false); DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(mainView(), false); DumpRenderTreeSupportEfl::setSerializeHTTPLoads(false); @@ -324,6 +323,8 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setCSSRegionsEnabled(mainView(), true); DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(false); DumpRenderTreeSupportEfl::setTracksRepaints(mainFrame(), false); + DumpRenderTreeSupportEfl::setSeamlessIFramesEnabled(true); + DumpRenderTreeSupportEfl::setWebAudioEnabled(mainView(), false); // Reset capacities for the memory cache for dead objects. static const unsigned cacheTotalCapacity = 8192 * 1024; @@ -331,11 +332,6 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues() DumpRenderTreeSupportEfl::setDeadDecodedDataDeletionInterval(0); ewk_settings_page_cache_capacity_set(3); - if (m_currentIntentRequest) { - ewk_intent_request_unref(m_currentIntentRequest); - m_currentIntentRequest = 0; - } - policyDelegateEnabled = false; policyDelegatePermissive = false; } @@ -443,6 +439,11 @@ void DumpRenderTreeChrome::onWindowObjectCleared(void* userData, Evas_Object*, v JSValueRef exception = 0; ASSERT(gTestRunner); +#if HAVE(ACCESSIBILITY) + browser->accessibilityController()->makeWindowObject(objectClearedInfo->context, objectClearedInfo->windowObject, &exception); + ASSERT(!exception); +#endif + GCController* gcController = static_cast<GCController*>(userData); ASSERT(gcController); @@ -615,8 +616,6 @@ void DumpRenderTreeChrome::onFrameCreated(void*, Evas_Object*, void* eventInfo) Evas_Object* frame = static_cast<Evas_Object*>(eventInfo); evas_object_smart_callback_add(frame, "icon,changed", onFrameIconChanged, 0); - evas_object_smart_callback_add(frame, "intent,new", onFrameIntentNew, 0); - evas_object_smart_callback_add(frame, "intent,service,register", onFrameIntentServiceRegistration, 0); evas_object_smart_callback_add(frame, "load,provisional", onFrameProvisionalLoad, 0); evas_object_smart_callback_add(frame, "load,provisional,failed", onFrameProvisionalLoadFailed, 0); evas_object_smart_callback_add(frame, "load,committed", onFrameLoadCommitted, 0); @@ -850,61 +849,6 @@ void DumpRenderTreeChrome::onNewResourceRequest(void*, Evas_Object*, void* event m_dumpAssignedUrls.add(request->identifier, pathSuitableForTestResult(request->url)); } -void DumpRenderTreeChrome::onFrameIntentNew(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Intent_Request* request = static_cast<Ewk_Intent_Request*>(eventInfo); - Ewk_Intent* intent = ewk_intent_request_intent_get(request); - if (!intent) - return; - - ewk_intent_request_ref(request); - if (m_currentIntentRequest) - ewk_intent_request_unref(m_currentIntentRequest); - m_currentIntentRequest = request; - - printf("Received Web Intent: action=%s type=%s\n", - ewk_intent_action_get(intent), - ewk_intent_type_get(intent)); - - const MessagePortChannelArray* messagePorts = DumpRenderTreeSupportEfl::intentMessagePorts(intent); - if (messagePorts) - printf("Have %d ports\n", static_cast<int>(messagePorts->size())); - - const char* service = ewk_intent_service_get(intent); - if (service && strcmp(service, "")) - printf("Explicit intent service: %s\n", service); - - void* data = 0; - Eina_List* extraNames = ewk_intent_extra_names_get(intent); - EINA_LIST_FREE(extraNames, data) { - const char* name = static_cast<char*>(data); - const char* value = ewk_intent_extra_get(intent, name); - if (value) { - printf("Extras[%s] = %s\n", name, value); - eina_stringshare_del(value); - } - eina_stringshare_del(name); - } - - Eina_List* suggestions = ewk_intent_suggestions_get(intent); - EINA_LIST_FREE(suggestions, data) { - const char* suggestion = static_cast<char*>(data); - printf("Have suggestion %s\n", suggestion); - eina_stringshare_del(suggestion); - } -} - -void DumpRenderTreeChrome::onFrameIntentServiceRegistration(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Intent_Service_Info* serviceInfo = static_cast<Ewk_Intent_Service_Info*>(eventInfo); - printf("Registered Web Intent Service: action=%s type=%s title=%s url=%s disposition=%s\n", - serviceInfo->action, - serviceInfo->type, - serviceInfo->title, - serviceInfo->href, - serviceInfo->disposition); -} - void DumpRenderTreeChrome::onDownloadRequest(void*, Evas_Object*, void* eventInfo) { // In case of "download,request", the URL need to be downloaded, not opened on the current view. @@ -915,8 +859,15 @@ void DumpRenderTreeChrome::onDownloadRequest(void*, Evas_Object*, void* eventInf return; Ewk_Download* download = static_cast<Ewk_Download*>(eventInfo); - ewk_view_theme_set(newView, DATA_DIR"/default.edj"); + ewk_view_theme_set(newView, TEST_THEME_DIR "/default.edj"); ewk_view_uri_set(newView, download->url); browser->m_extraViews.append(newView); } + +#if HAVE(ACCESSIBILITY) +AccessibilityController* DumpRenderTreeChrome::accessibilityController() const +{ + return m_axController.get(); +} +#endif diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h index 32a365490..836596561 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h @@ -32,13 +32,16 @@ #include <Eina.h> #include <Evas.h> -#include <ewk_intent_request.h> #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> #include <wtf/text/CString.h> +#if HAVE(ACCESSIBILITY) +#include "AccessibilityController.h" +#endif + class DumpRenderTreeChrome { public: ~DumpRenderTreeChrome(); @@ -58,8 +61,6 @@ public: Evas_Object* mainFrame() const; Evas_Object* mainView() const; - Ewk_Intent_Request* currentIntentRequest() const; - void resetDefaultsToConsistentValues(); private: @@ -67,7 +68,10 @@ private: Evas_Object* createView() const; bool initialize(); - +#if HAVE(ACCESSIBILITY) + AccessibilityController* accessibilityController() const; + OwnPtr<AccessibilityController> m_axController; +#endif Evas_Object* m_mainFrame; Evas_Object* m_mainView; Evas* m_evas; @@ -75,7 +79,6 @@ private: Vector<Evas_Object*> m_extraViews; static HashMap<unsigned long, CString> m_dumpAssignedUrls; static Evas_Object* m_provisionalLoadFailedFrame; - static Ewk_Intent_Request* m_currentIntentRequest; // Smart callbacks static void onWindowObjectCleared(void*, Evas_Object*, void*); @@ -139,9 +142,6 @@ private: static void onNewResourceRequest(void*, Evas_Object*, void*); - static void onFrameIntentNew(void*, Evas_Object*, void*); - static void onFrameIntentServiceRegistration(void*, Evas_Object*, void*); - static void onDownloadRequest(void*, Evas_Object*, void*); }; diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h b/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h index f474c89e2..ebc5cd35a 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h @@ -40,4 +40,6 @@ extern bool policyDelegateEnabled; extern bool policyDelegatePermissive; extern Ecore_Timer* waitToDumpWatchdog; +bool shouldSetWaitToDumpWatchdog(); + #endif /* DumpRenderTreeEfl_h */ diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp index d24bf3606..f7b425c6e 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp @@ -91,6 +91,12 @@ static Eina_Bool onJavaScriptConfirm(Ewk_View_Smart_Data*, Evas_Object*, const c return EINA_TRUE; } +static Eina_Bool onBeforeUnloadConfirm(Ewk_View_Smart_Data*, Evas_Object*, const char* message) +{ + printf("CONFIRM NAVIGATION: %s\n", message); + return !gTestRunner->shouldStayOnPageAfterHandlingBeforeUnload(); +} + static Eina_Bool onJavaScriptPrompt(Ewk_View_Smart_Data*, Evas_Object*, const char* message, const char* defaultValue, const char** value) { printf("PROMPT: %s, default text: %s\n", message, defaultValue); @@ -217,6 +223,7 @@ Evas_Object* drtViewAdd(Evas* evas) api.add_console_message = onConsoleMessage; api.run_javascript_alert = onJavaScriptAlert; api.run_javascript_confirm = onJavaScriptConfirm; + api.run_before_unload_confirm = onBeforeUnloadConfirm; api.run_javascript_prompt = onJavaScriptPrompt; api.window_create = onWindowCreate; api.window_close = onWindowClose; diff --git a/Tools/DumpRenderTree/efl/FontManagement.cpp b/Tools/DumpRenderTree/efl/FontManagement.cpp index df8a150d5..eee26d141 100644 --- a/Tools/DumpRenderTree/efl/FontManagement.cpp +++ b/Tools/DumpRenderTree/efl/FontManagement.cpp @@ -89,10 +89,10 @@ static void addFontFiles(const Vector<CString>& fontFiles, FcConfig* config) static CString getCustomBuildDir() { - if (const char* userChosenBuildDir = getenv("WEBKITOUTPUTDIR")) { + if (const char* userChosenBuildDir = getenv("WEBKIT_OUTPUTDIR")) { if (ecore_file_is_dir(userChosenBuildDir)) return userChosenBuildDir; - fprintf(stderr, "WEBKITOUTPUTDIR set to '%s', but path doesn't exist.\n", userChosenBuildDir); + fprintf(stderr, "WEBKIT_OUTPUTDIR set to '%s', but path doesn't exist.\n", userChosenBuildDir); } return CString(); @@ -104,7 +104,7 @@ static CString getPlatformFontsPath() if (!customBuildDir.isNull()) { CString fontsPath = buildPath(customBuildDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", 0); if (!ecore_file_exists(fontsPath.data())) - fprintf(stderr, "WEBKITOUTPUTDIR set to '%s', but could not local test fonts.\n", customBuildDir.data()); + fprintf(stderr, "WEBKIT_OUTPUTDIR set to '%s', but could not local test fonts.\n", customBuildDir.data()); return fontsPath; } @@ -112,7 +112,7 @@ static CString getPlatformFontsPath() if (ecore_file_exists(fontsPath.data())) return fontsPath; - fprintf(stderr, "Could not locate tests fonts, try setting WEBKITOUTPUTDIR.\n"); + fprintf(stderr, "Could not locate tests fonts, try setting WEBKIT_OUTPUTDIR.\n"); return CString(); } diff --git a/Tools/DumpRenderTree/efl/ImageDiff.cpp b/Tools/DumpRenderTree/efl/ImageDiff.cpp deleted file mode 100644 index 129b6ca57..000000000 --- a/Tools/DumpRenderTree/efl/ImageDiff.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> - * Copyright (C) 2010 Igalia S.L. - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include <Ecore.h> -#include <Ecore_Evas.h> -#include <Evas.h> -#include <algorithm> -#include <cmath> -#include <cstdio> -#include <cstdlib> -#include <getopt.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/PassRefPtr.h> -#include <wtf/efl/RefPtrEfl.h> - -enum PixelComponent { - Red, - Green, - Blue, - Alpha -}; - -static OwnPtr<Ecore_Evas> gEcoreEvas; -static double gTolerance = 0; - -static void abortWithErrorMessage(const char* errorMessage); - -static unsigned char* pixelFromImageData(unsigned char* imageData, int rowStride, int x, int y) -{ - return imageData + (y * rowStride) + (x << 2); -} - -static Evas_Object* differenceImageFromDifferenceBuffer(Evas* evas, unsigned char* buffer, int width, int height) -{ - Evas_Object* image = evas_object_image_filled_add(evas); - if (!image) - abortWithErrorMessage("could not create difference image"); - - evas_object_image_size_set(image, width, height); - evas_object_image_colorspace_set(image, EVAS_COLORSPACE_ARGB8888); - - unsigned char* diffPixels = static_cast<unsigned char*>(evas_object_image_data_get(image, EINA_TRUE)); - const int rowStride = evas_object_image_stride_get(image); - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - unsigned char* diffPixel = pixelFromImageData(diffPixels, rowStride, x, y); - diffPixel[Red] = diffPixel[Green] = diffPixel[Blue] = *buffer++; - diffPixel[Alpha] = 0xff; - } - } - - evas_object_image_data_set(image, diffPixels); - - return image; -} - -static float computeDistanceBetweenPixelComponents(unsigned char actualComponent, unsigned char baseComponent) -{ - return (actualComponent - baseComponent) / std::max<float>(255 - baseComponent, baseComponent); -} - -static float computeDistanceBetweenPixelComponents(unsigned char* actualPixel, unsigned char* basePixel, PixelComponent component) -{ - return computeDistanceBetweenPixelComponents(actualPixel[component], basePixel[component]); -} - -static float calculatePixelDifference(unsigned char* basePixel, unsigned char* actualPixel) -{ - const float red = computeDistanceBetweenPixelComponents(actualPixel, basePixel, Red); - const float green = computeDistanceBetweenPixelComponents(actualPixel, basePixel, Green); - const float blue = computeDistanceBetweenPixelComponents(actualPixel, basePixel, Blue); - const float alpha = computeDistanceBetweenPixelComponents(actualPixel, basePixel, Alpha); - return sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0f; -} - -static float calculateDifference(Evas_Object* baselineImage, Evas_Object* actualImage, RefPtr<Evas_Object>& differenceImage) -{ - int width, height, baselineWidth, baselineHeight; - evas_object_image_size_get(actualImage, &width, &height); - evas_object_image_size_get(baselineImage, &baselineWidth, &baselineHeight); - - if (width != baselineWidth || height != baselineHeight) { - printf("Error, test and reference image have different sizes.\n"); - return 100; // Completely different. - } - - OwnArrayPtr<unsigned char> diffBuffer = adoptArrayPtr(new unsigned char[width * height]); - if (!diffBuffer) - abortWithErrorMessage("could not create difference buffer"); - - const int actualRowStride = evas_object_image_stride_get(actualImage); - const int baseRowStride = evas_object_image_stride_get(baselineImage); - unsigned numberOfDifferentPixels = 0; - float totalDistance = 0; - float maxDistance = 0; - unsigned char* actualPixels = static_cast<unsigned char*>(evas_object_image_data_get(actualImage, EINA_FALSE)); - unsigned char* basePixels = static_cast<unsigned char*>(evas_object_image_data_get(baselineImage, EINA_FALSE)); - unsigned char* currentDiffPixel = diffBuffer.get(); - - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - unsigned char* actualPixel = pixelFromImageData(actualPixels, actualRowStride, x, y); - unsigned char* basePixel = pixelFromImageData(basePixels, baseRowStride, x, y); - - const float distance = calculatePixelDifference(basePixel, actualPixel); - *currentDiffPixel++ = static_cast<unsigned char>(distance * 255.0f); - - if (distance >= 1.0f / 255.0f) { - ++numberOfDifferentPixels; - totalDistance += distance; - maxDistance = std::max<float>(maxDistance, distance); - } - } - } - - // When using evas_object_image_data_get(), a complementary evas_object_data_set() must be - // issued to balance the reference count, even if the image hasn't been changed. - evas_object_image_data_set(baselineImage, basePixels); - evas_object_image_data_set(actualImage, actualPixels); - - // Compute the difference as a percentage combining both the number of - // different pixels and their difference amount i.e. the average distance - // over the entire image - float difference = 0; - if (numberOfDifferentPixels) - difference = 100.0f * totalDistance / (height * width); - if (difference <= gTolerance) - difference = 0; - else { - difference = roundf(difference * 100.0f) / 100.0f; - difference = std::max(difference, 0.01f); // round to 2 decimal places - - differenceImage = adoptRef(differenceImageFromDifferenceBuffer(evas_object_evas_get(baselineImage), diffBuffer.get(), width, height)); - } - - return difference; -} - -static int getTemporaryFile(char *fileName, size_t fileNameLength) -{ - char* tempDirectory = getenv("TMPDIR"); - if (!tempDirectory) - tempDirectory = getenv("TEMP"); - - if (tempDirectory) - snprintf(fileName, fileNameLength, "%s/ImageDiffXXXXXX.png", tempDirectory); - else { -#if __linux__ - strcpy(fileName, "/dev/shm/ImageDiffXXXXXX.png"); - const int fileDescriptor = mkstemps(fileName, sizeof(".png") - 1); - if (fileDescriptor >= 0) - return fileDescriptor; -#endif // __linux__ - - strcpy(fileName, "ImageDiffXXXXXX.png"); - } - - return mkstemps(fileName, sizeof(".png") - 1); -} - -static void printImage(Evas_Object* image) -{ - char fileName[PATH_MAX]; - - const int tempImageFd = getTemporaryFile(fileName, PATH_MAX); - if (tempImageFd == -1) - abortWithErrorMessage("could not create temporary file"); - - evas_render(evas_object_evas_get(image)); - - if (evas_object_image_save(image, fileName, 0, 0)) { - struct stat fileInfo; - if (!stat(fileName, &fileInfo)) { - printf("Content-Length: %ld\n", fileInfo.st_size); - fflush(stdout); - - unsigned char buffer[2048]; - ssize_t bytesRead; - while ((bytesRead = read(tempImageFd, buffer, sizeof(buffer))) > 0) { - ssize_t bytesWritten = 0; - ssize_t count; - do { - if ((count = write(1, buffer + bytesWritten, bytesRead - bytesWritten)) <= 0) - break; - bytesWritten += count; - } while (bytesWritten < bytesRead); - } - } - } - close(tempImageFd); - unlink(fileName); -} - -static void printImageDifferences(Evas_Object* baselineImage, Evas_Object* actualImage) -{ - RefPtr<Evas_Object> differenceImage; - const float difference = calculateDifference(baselineImage, actualImage, differenceImage); - - if (difference > 0.0f) { - if (differenceImage) - printImage(differenceImage.get()); - - printf("diff: %01.2f%% failed\n", difference); - } else - printf("diff: %01.2f%% passed\n", difference); -} - -static void resizeEcoreEvasIfNeeded(Evas_Object* image) -{ - int newWidth, newHeight; - evas_object_image_size_get(image, &newWidth, &newHeight); - - int currentWidth, currentHeight; - ecore_evas_screen_geometry_get(gEcoreEvas.get(), 0, 0, ¤tWidth, ¤tHeight); - - if (newWidth > currentWidth) - currentWidth = newWidth; - if (newHeight > currentHeight) - currentHeight = newHeight; - - ecore_evas_resize(gEcoreEvas.get(), currentWidth, currentHeight); -} - -static PassRefPtr<Evas_Object> readImageFromStdin(Evas* evas, long imageSize) -{ - OwnArrayPtr<unsigned char> imageBuffer = adoptArrayPtr(new unsigned char[imageSize]); - if (!imageBuffer) - abortWithErrorMessage("cannot allocate image"); - - const size_t bytesRead = fread(imageBuffer.get(), 1, imageSize, stdin); - if (!bytesRead) - return PassRefPtr<Evas_Object>(); - - Evas_Object* image = evas_object_image_filled_add(evas); - evas_object_image_colorspace_set(image, EVAS_COLORSPACE_ARGB8888); - evas_object_image_memfile_set(image, imageBuffer.get(), bytesRead, 0, 0); - - resizeEcoreEvasIfNeeded(image); - - return adoptRef(image); -} - -static bool parseCommandLineOptions(int argc, char** argv) -{ - static const option options[] = { - { "tolerance", required_argument, 0, 't' }, - { 0, 0, 0, 0 } - }; - int option; - - while ((option = getopt_long(argc, (char* const*)argv, "t:", options, 0)) != -1) { - switch (option) { - case 't': - gTolerance = atof(optarg); - break; - case '?': - case ':': - return false; - } - } - - return true; -} - -static void shutdownEfl() -{ - ecore_evas_shutdown(); - ecore_shutdown(); - evas_shutdown(); -} - -static void abortWithErrorMessage(const char* errorMessage) -{ - shutdownEfl(); - - printf("Error, %s.\n", errorMessage); - exit(EXIT_FAILURE); -} - -static Evas* initEfl() -{ - evas_init(); - ecore_init(); - ecore_evas_init(); - - gEcoreEvas = adoptPtr(ecore_evas_buffer_new(1, 1)); - Evas* evas = ecore_evas_get(gEcoreEvas.get()); - if (!evas) - abortWithErrorMessage("could not create Ecore_Evas buffer"); - - return evas; -} - -int main(int argc, char* argv[]) -{ - if (!parseCommandLineOptions(argc, argv)) - return EXIT_FAILURE; - - Evas* evas = initEfl(); - - RefPtr<Evas_Object> actualImage; - RefPtr<Evas_Object> baselineImage; - - char buffer[2048]; - while (fgets(buffer, sizeof(buffer), stdin)) { - char* contentLengthStart = strstr(buffer, "Content-Length: "); - if (!contentLengthStart) - continue; - long imageSize; - if (sscanf(contentLengthStart, "Content-Length: %ld", &imageSize) == 1) { - if (imageSize <= 0) - abortWithErrorMessage("image size must be specified"); - - if (!actualImage) - actualImage = readImageFromStdin(evas, imageSize); - else if (!baselineImage) { - baselineImage = readImageFromStdin(evas, imageSize); - - printImageDifferences(baselineImage.get(), actualImage.get()); - - actualImage.clear(); - baselineImage.clear(); - } - } - - fflush(stdout); - } - - gEcoreEvas.clear(); // Make sure ecore_evas_free is called before the EFL are shut down - - shutdownEfl(); - return EXIT_SUCCESS; -} diff --git a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp index cd78b10aa..9f66e95e9 100644 --- a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp +++ b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp @@ -112,11 +112,6 @@ void TestRunner::keepWebHistory() DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(true); } -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - return DumpRenderTreeSupportEfl::computedStyleIncludingVisitedInfo(context, value); -} - size_t TestRunner::webHistoryItemCount() { const Ewk_History* history = ewk_view_history_get(browser->mainView()); @@ -126,11 +121,6 @@ size_t TestRunner::webHistoryItemCount() return ewk_history_back_list_length(history) + ewk_history_forward_list_length(history); } -unsigned TestRunner::workerThreadCount() const -{ - return DumpRenderTreeSupportEfl::workerThreadCount(); -} - void TestRunner::notifyDone() { if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) @@ -261,6 +251,7 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JS void TestRunner::setViewModeMediaFeature(JSStringRef mode) { +#if ENABLE(VIEW_MODE_CSS_MEDIA) Evas_Object* view = browser->mainView(); if (!view) return; @@ -275,6 +266,9 @@ void TestRunner::setViewModeMediaFeature(JSStringRef mode) ewk_view_mode_set(view, EWK_VIEW_MODE_MAXIMIZED); else if (equals(mode, "minimized")) ewk_view_mode_set(view, EWK_VIEW_MODE_MINIMIZED); +#else + UNUSED_PARAM(mode); +#endif } void TestRunner::setWindowIsKey(bool) @@ -282,11 +276,6 @@ void TestRunner::setWindowIsKey(bool) notImplemented(); } -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(browser->mainView(), flag); -} - static Eina_Bool waitToDumpWatchdogFired(void*) { waitToDumpWatchdog = 0; @@ -299,7 +288,7 @@ void TestRunner::setWaitToDump(bool waitUntilDone) static const double timeoutSeconds = 30; m_waitToDump = waitUntilDone; - if (m_waitToDump && !waitToDumpWatchdog) + if (m_waitToDump && shouldSetWaitToDumpWatchdog()) waitToDumpWatchdog = ecore_timer_add(timeoutSeconds, waitToDumpWatchdogFired, 0); } @@ -323,11 +312,6 @@ void TestRunner::setXSSAuditorEnabled(bool flag) ewk_view_setting_enable_xss_auditor_set(browser->mainView(), flag); } -void TestRunner::setFrameFlatteningEnabled(bool flag) -{ - ewk_view_setting_enable_frame_flattening_set(browser->mainView(), flag); -} - void TestRunner::setSpatialNavigationEnabled(bool flag) { ewk_view_setting_spatial_navigation_set(browser->mainView(), flag); @@ -348,16 +332,6 @@ void TestRunner::setAuthorAndUserStylesEnabled(bool flag) DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(browser->mainView(), flag); } -void TestRunner::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) -{ - DumpRenderTreeSupportEfl::setAutofilled(context, nodeObject, autofilled); -} - -void TestRunner::disableImageLoading() -{ - ewk_view_setting_auto_load_images_set(browser->mainView(), EINA_FALSE); -} - void TestRunner::setMockDeviceOrientation(bool, double, bool, double, bool, double) { // FIXME: Implement for DeviceOrientation layout tests. @@ -446,11 +420,6 @@ void TestRunner::setIconDatabaseEnabled(bool enabled) ewk_settings_icon_database_path_set(databasePath.utf8().data()); } -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(browser->mainView(), flag); -} - void TestRunner::setPopupBlockingEnabled(bool flag) { ewk_view_setting_scripts_can_open_windows_set(browser->mainView(), !flag); @@ -461,13 +430,6 @@ void TestRunner::setPluginsEnabled(bool flag) ewk_view_setting_enable_plugins_set(browser->mainView(), flag); } -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - const String elementId(id->string()); - const Evas_Object* mainFrame = browser->mainFrame(); - return DumpRenderTreeSupportEfl::elementDoesAutoCompleteForElementWithId(mainFrame, elementId); -} - void TestRunner::execCommand(JSStringRef name, JSStringRef value) { DumpRenderTreeSupportEfl::executeCoreCommandByName(browser->mainView(), name->string().utf8().data(), value->string().utf8().data()); @@ -660,21 +622,6 @@ void TestRunner::setAppCacheMaximumSize(unsigned long long size) ewk_settings_application_cache_max_quota_set(size); } -bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - return DumpRenderTreeSupportEfl::pauseAnimation(browser->mainFrame(), animationName->string().utf8().data(), elementId->string().utf8().data(), time); -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - return DumpRenderTreeSupportEfl::pauseTransition(browser->mainFrame(), propertyName->string().utf8().data(), elementId->string().utf8().data(), time); -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - return DumpRenderTreeSupportEfl::activeAnimationsCount(browser->mainFrame()); -} - static inline bool toBool(JSStringRef value) { return equals(value, "true") || equals(value, "1"); @@ -714,7 +661,7 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) else if (equals(key, "WebKitCSSRegionsEnabled")) DumpRenderTreeSupportEfl::setCSSRegionsEnabled(browser->mainView(), toBool(value)); else if (equals(key, "WebKitWebAudioEnabled")) - ewk_view_setting_web_audio_set(browser->mainView(), toBool(value)); + DumpRenderTreeSupportEfl::setWebAudioEnabled(browser->mainView(), toBool(value)); else if (equals(key, "WebKitDisplayImagesKey")) ewk_view_setting_auto_load_images_set(browser->mainView(), toBool(value)); else @@ -736,11 +683,6 @@ void TestRunner::setDeveloperExtrasEnabled(bool enabled) ewk_view_setting_enable_developer_extras_set(browser->mainView(), enabled); } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - notImplemented(); -} - void TestRunner::showWebInspector() { ewk_view_inspector_show(browser->mainView()); @@ -796,16 +738,6 @@ void TestRunner::setWebViewEditable(bool) ewk_frame_editable_set(browser->mainFrame(), EINA_TRUE); } -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - String markerTextChar = DumpRenderTreeSupportEfl::markerTextForListItem(context, nodeObject); - if (markerTextChar.isEmpty()) - return 0; - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextChar.utf8().data())); - return markerText; -} - void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) { notImplemented(); @@ -821,11 +753,6 @@ void TestRunner::setSerializeHTTPLoads(bool serialize) DumpRenderTreeSupportEfl::setSerializeHTTPLoads(serialize); } -void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) -{ - ewk_view_setting_minimum_timer_interval_set(browser->mainView(), minimumTimerInterval); -} - void TestRunner::setTextDirection(JSStringRef direction) { Ewk_Text_Direction ewkDirection; @@ -897,8 +824,8 @@ void TestRunner::setPageVisibility(const char* visibility) ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false); else if (newVisibility == "prerender") ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_PRERENDER, false); - else if (newVisibility == "preview") - ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_PREVIEW, false); + else if (newVisibility == "unloaded") + ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_UNLOADED, false); } void TestRunner::setAutomaticLinkDetectionEnabled(bool) @@ -906,21 +833,18 @@ void TestRunner::setAutomaticLinkDetectionEnabled(bool) notImplemented(); } -void TestRunner::sendWebIntentResponse(JSStringRef response) +void TestRunner::setStorageDatabaseIdleInterval(double) { - Ewk_Intent_Request* request = browser->currentIntentRequest(); - if (!request) - return; - - DumpRenderTreeSupportEfl::sendWebIntentResponse(request, response); + notImplemented(); } -void TestRunner::deliverWebIntent(JSStringRef action, JSStringRef type, JSStringRef data) +void TestRunner::closeIdleLocalStorageDatabases() { - DumpRenderTreeSupportEfl::deliverWebIntent(browser->mainFrame(), action, type, data); + notImplemented(); } -void TestRunner::setStorageDatabaseIdleInterval(double) +JSRetainPtr<JSStringRef> TestRunner::platformName() const { - notImplemented(); + JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("efl")); + return platformName; } diff --git a/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp index 466182bb3..d89a8d2f6 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp @@ -35,22 +35,7 @@ #include <atk/atk.h> #include <gtk/gtk.h> #include <webkit/webkit.h> - -static bool loggingAccessibilityEvents = false; - -AccessibilityController::AccessibilityController() -{ -} - -AccessibilityController::~AccessibilityController() -{ -} - -AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) -{ - // FIXME: implement - return 0; -} +#include <wtf/gobject/GOwnPtr.h> AccessibilityUIElement AccessibilityController::focusedElement() { @@ -72,42 +57,18 @@ AccessibilityUIElement AccessibilityController::rootElement() AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id) { - // FIXME: implement - return 0; -} - -void AccessibilityController::setLogFocusEvents(bool) -{ -} - -void AccessibilityController::setLogScrollingStartEvents(bool) -{ -} - -void AccessibilityController::setLogValueChangeEvents(bool) -{ -} - -void AccessibilityController::setLogAccessibilityEvents(bool logAccessibilityEvents) -{ - if (logAccessibilityEvents == loggingAccessibilityEvents) - return; + AtkObject* root = DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame); + if (!root) + return 0; - if (!logAccessibilityEvents) { - disconnectAccessibilityCallbacks(); - loggingAccessibilityEvents = false; - return; - } + size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id); + GOwnPtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize))); + JSStringGetUTF8CString(id, idBuffer.get(), bufferSize); - connectAccessibilityCallbacks(); - loggingAccessibilityEvents = true; -} + AtkObject* result = childElementById(root, idBuffer.get()); + if (ATK_IS_OBJECT(result)) + return AccessibilityUIElement(result); -bool AccessibilityController::addNotificationListener(JSObjectRef) -{ - return false; -} + return 0; -void AccessibilityController::removeNotificationListener() -{ } diff --git a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index b00c583f0..30f7b6436 100644 --- a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -37,382 +37,6 @@ #include <wtf/text/WTFString.h> #include <wtf/unicode/CharacterNames.h> -static inline String roleToString(AtkRole role) -{ - switch (role) { - case ATK_ROLE_ALERT: - return "AXRole: AXAlert"; - case ATK_ROLE_CANVAS: - return "AXRole: AXCanvas"; - case ATK_ROLE_CHECK_BOX: - return "AXRole: AXCheckBox"; - case ATK_ROLE_COLUMN_HEADER: - return "AXRole: AXColumnHeader"; - case ATK_ROLE_COMBO_BOX: - return "AXRole: AXComboBox"; - case ATK_ROLE_DOCUMENT_FRAME: - return "AXRole: AXWebArea"; - case ATK_ROLE_ENTRY: - return "AXRole: AXTextField"; - case ATK_ROLE_FOOTER: - return "AXRole: AXFooter"; - case ATK_ROLE_FORM: - return "AXRole: AXForm"; - case ATK_ROLE_GROUPING: - return "AXRole: AXGroup"; - case ATK_ROLE_HEADING: - return "AXRole: AXHeading"; - case ATK_ROLE_IMAGE: - return "AXRole: AXImage"; - case ATK_ROLE_IMAGE_MAP: - return "AXRole: AXImageMap"; - case ATK_ROLE_LABEL: - return "AXRole: AXLabel"; - case ATK_ROLE_LINK: - return "AXRole: AXLink"; - case ATK_ROLE_LIST: - return "AXRole: AXList"; - case ATK_ROLE_LIST_BOX: - return "AXRole: AXListBox"; - case ATK_ROLE_LIST_ITEM: - return "AXRole: AXListItem"; - case ATK_ROLE_MENU: - return "AXRole: AXMenu"; - case ATK_ROLE_MENU_BAR: - return "AXRole: AXMenuBar"; - case ATK_ROLE_MENU_ITEM: - return "AXRole: AXMenuItem"; - case ATK_ROLE_PAGE_TAB: - return "AXRole: AXTab"; - case ATK_ROLE_PAGE_TAB_LIST: - return "AXRole: AXTabGroup"; - case ATK_ROLE_PANEL: - return "AXRole: AXGroup"; - case ATK_ROLE_PARAGRAPH: - return "AXRole: AXParagraph"; - case ATK_ROLE_PASSWORD_TEXT: - return "AXRole: AXPasswordField"; - case ATK_ROLE_PUSH_BUTTON: - return "AXRole: AXButton"; - case ATK_ROLE_RADIO_BUTTON: - return "AXRole: AXRadioButton"; - case ATK_ROLE_ROW_HEADER: - return "AXRole: AXRowHeader"; - case ATK_ROLE_RULER: - return "AXRole: AXRuler"; - case ATK_ROLE_SCROLL_BAR: - return "AXRole: AXScrollBar"; - case ATK_ROLE_SCROLL_PANE: - return "AXRole: AXScrollArea"; - case ATK_ROLE_SECTION: - return "AXRole: AXDiv"; - case ATK_ROLE_SEPARATOR: - return "AXRole: AXHorizontalRule"; - case ATK_ROLE_SLIDER: - return "AXRole: AXSlider"; - case ATK_ROLE_SPIN_BUTTON: - return "AXRole: AXSpinButton"; - case ATK_ROLE_TABLE: - return "AXRole: AXTable"; - case ATK_ROLE_TABLE_CELL: - return "AXRole: AXCell"; - case ATK_ROLE_TABLE_COLUMN_HEADER: - return "AXRole: AXColumnHeader"; - case ATK_ROLE_TABLE_ROW: - return "AXRole: AXRow"; - case ATK_ROLE_TABLE_ROW_HEADER: - return "AXRole: AXRowHeader"; - case ATK_ROLE_TOGGLE_BUTTON: - return "AXRole: AXToggleButton"; - case ATK_ROLE_TOOL_BAR: - return "AXRole: AXToolbar"; - case ATK_ROLE_TOOL_TIP: - return "AXRole: AXUserInterfaceTooltip"; - case ATK_ROLE_TREE: - return "AXRole: AXTree"; - case ATK_ROLE_TREE_TABLE: - return "AXRole: AXTreeGrid"; - case ATK_ROLE_TREE_ITEM: - return "AXRole: AXTreeItem"; - case ATK_ROLE_WINDOW: - return "AXRole: AXWindow"; - case ATK_ROLE_UNKNOWN: - return "AXRole: AXUnknown"; - default: - // We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which - // our DRT isn't properly handling. - return "AXRole: FIXME not identified"; - } -} - -static inline gchar* replaceCharactersForResults(gchar* str) -{ - String uString = String::fromUTF8(str); - - // The object replacement character is passed along to ATs so we need to be - // able to test for their presence and do so without causing test failures. - uString.replace(objectReplacementCharacter, "<obj>"); - - // The presence of newline characters in accessible text of a single object - // is appropriate, but it makes test results (especially the accessible tree) - // harder to read. - uString.replace("\n", "<\\n>"); - - return g_strdup(uString.utf8().data()); -} - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) -{ - if (m_element) - g_object_ref(m_element); -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) -{ - if (m_element) - g_object_ref(m_element); -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ - if (m_element) - g_object_unref(m_element); -} - -void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements) -{ - // FIXME: implement -} - -void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&) -{ - // FIXME: implement -} - -void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children) -{ - int count = childrenCount(); - for (int i = 0; i < count; i++) { - AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i); - children.append(AccessibilityUIElement(child)); - } -} - -void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end) -{ - for (unsigned i = start; i < end; i++) { - AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i); - elementVector.append(AccessibilityUIElement(child)); - } -} - -int AccessibilityUIElement::rowCount() -{ - if (!m_element) - return 0; - - ASSERT(ATK_IS_TABLE(m_element)); - - return atk_table_get_n_rows(ATK_TABLE(m_element)); -} - -int AccessibilityUIElement::columnCount() -{ - if (!m_element) - return 0; - - ASSERT(ATK_IS_TABLE(m_element)); - - return atk_table_get_n_columns(ATK_TABLE(m_element)); -} - -int AccessibilityUIElement::childrenCount() -{ - if (!m_element) - return 0; - - ASSERT(ATK_IS_OBJECT(m_element)); - - return atk_object_get_n_accessible_children(ATK_OBJECT(m_element)); -} - -AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) -{ - Vector<AccessibilityUIElement> children; - getChildrenWithRange(children, index, index + 1); - - if (children.size() == 1) - return children.at(0); - - return 0; -} - -unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) -{ - // FIXME: implement - return 0; -} - -gchar* attributeSetToString(AtkAttributeSet* attributeSet) -{ - GString* str = g_string_new(0); - for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) { - AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); - GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); - g_string_append(str, attributeData.get()); - if (attributes->next) - g_string_append(str, ", "); - } - - return g_string_free(str, FALSE); -} - -JSStringRef AccessibilityUIElement::allAttributes() -{ - if (!m_element) - return JSStringCreateWithCharacters(0, 0); - - ASSERT(ATK_IS_OBJECT(m_element)); - GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element)))); - return JSStringCreateWithUTF8CString(attributeData.get()); -} - -JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -AccessibilityUIElement AccessibilityUIElement::titleUIElement() -{ - - if (!m_element) - return 0; - - AtkRelationSet* set = atk_object_ref_relation_set(ATK_OBJECT(m_element)); - if (!set) - return 0; - - AtkObject* target = 0; - int count = atk_relation_set_get_n_relations(set); - for (int i = 0; i < count; i++) { - AtkRelation* relation = atk_relation_set_get_relation(set, i); - if (atk_relation_get_relation_type(relation) == ATK_RELATION_LABELLED_BY) { - GPtrArray* targetList = atk_relation_get_target(relation); - if (targetList->len) - target = static_cast<AtkObject*>(g_ptr_array_index(targetList, 0)); - } - g_object_unref(set); - } - - return target ? AccessibilityUIElement(target) : 0; -} - -AccessibilityUIElement AccessibilityUIElement::parentElement() -{ - if (!m_element) - return 0; - - ASSERT(ATK_IS_OBJECT(m_element)); - - AtkObject* parent = atk_object_get_parent(ATK_OBJECT(m_element)); - return parent ? AccessibilityUIElement(parent) : 0; -} - -JSStringRef AccessibilityUIElement::attributesOfChildren() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::parameterizedAttributeNames() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::role() -{ - AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); - if (!role) - return JSStringCreateWithCharacters(0, 0); - - String roleString = roleToString(role); - return JSStringCreateWithUTF8CString(roleString.utf8().data()); -} - -JSStringRef AccessibilityUIElement::subrole() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::roleDescription() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::title() -{ - const gchar* name = atk_object_get_name(ATK_OBJECT(m_element)); - - if (!name) - return JSStringCreateWithCharacters(0, 0); - - GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name)); - - return JSStringCreateWithUTF8CString(axTitle.get()); -} - -JSStringRef AccessibilityUIElement::description() -{ - const gchar* description = atk_object_get_description(ATK_OBJECT(m_element)); - - if (!description) - return JSStringCreateWithCharacters(0, 0); - - GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description)); - - return JSStringCreateWithUTF8CString(axDesc.get()); -} - -JSStringRef AccessibilityUIElement::stringValue() -{ - if (!m_element || !ATK_IS_TEXT(m_element)) - return JSStringCreateWithCharacters(0, 0); - - gchar* text = atk_text_get_text(ATK_TEXT(m_element), 0, -1); - GOwnPtr<gchar> axValue(g_strdup_printf("AXValue: %s", replaceCharactersForResults(text))); - g_free(text); - - return JSStringCreateWithUTF8CString(axValue.get()); -} - -JSStringRef AccessibilityUIElement::language() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - JSStringRef AccessibilityUIElement::helpText() const { if (!m_element) @@ -424,585 +48,3 @@ JSStringRef AccessibilityUIElement::helpText() const GOwnPtr<gchar> axHelpText(g_strdup_printf("AXHelp: %s", helpText.data())); return JSStringCreateWithUTF8CString(axHelpText.get()); } - -double AccessibilityUIElement::x() -{ - int x, y; - - atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN); - - return x; -} - -double AccessibilityUIElement::y() -{ - int x, y; - - atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN); - - return y; -} - -double AccessibilityUIElement::width() -{ - int width, height; - - atk_component_get_size(ATK_COMPONENT(m_element), &width, &height); - - return width; -} - -double AccessibilityUIElement::height() -{ - int width, height; - - atk_component_get_size(ATK_COMPONENT(m_element), &width, &height); - - return height; -} - -double AccessibilityUIElement::clickPointX() -{ - return 0.f; -} - -double AccessibilityUIElement::clickPointY() -{ - return 0.f; -} - -JSStringRef AccessibilityUIElement::orientation() const -{ - return 0; -} - -double AccessibilityUIElement::intValue() const -{ - GValue value = { 0, { { 0 } } }; - - if (!ATK_IS_VALUE(m_element)) - return 0.0f; - - atk_value_get_current_value(ATK_VALUE(m_element), &value); - if (!G_VALUE_HOLDS_FLOAT(&value)) - return 0.0f; - return g_value_get_float(&value); -} - -double AccessibilityUIElement::minValue() -{ - GValue value = { 0, { { 0 } } }; - - if (!ATK_IS_VALUE(m_element)) - return 0.0f; - - atk_value_get_minimum_value(ATK_VALUE(m_element), &value); - if (!G_VALUE_HOLDS_FLOAT(&value)) - return 0.0f; - return g_value_get_float(&value); -} - -double AccessibilityUIElement::maxValue() -{ - GValue value = { 0, { { 0 } } }; - - if (!ATK_IS_VALUE(m_element)) - return 0.0f; - - atk_value_get_maximum_value(ATK_VALUE(m_element), &value); - if (!G_VALUE_HOLDS_FLOAT(&value)) - return 0.0f; - return g_value_get_float(&value); -} - -JSStringRef AccessibilityUIElement::valueDescription() -{ - // FIXME: implement after it has been implemented in ATK. - // See: https://bugzilla.gnome.org/show_bug.cgi?id=684576 - return JSStringCreateWithCharacters(0, 0); -} - -static bool checkElementState(PlatformUIElement element, AtkStateType stateType) -{ - if (!ATK_IS_OBJECT(element)) - return false; - - GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element))); - return atk_state_set_contains_state(stateSet.get(), stateType); -} - -bool AccessibilityUIElement::isEnabled() -{ - return checkElementState(m_element, ATK_STATE_ENABLED); -} - -int AccessibilityUIElement::insertionPointLineNumber() -{ - // FIXME: implement - return 0; -} - -bool AccessibilityUIElement::isActionSupported(JSStringRef action) -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isRequired() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isFocused() const -{ - if (!ATK_IS_OBJECT(m_element)) - return false; - - GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); - gboolean isFocused = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSED); - - return isFocused; -} - -bool AccessibilityUIElement::isSelected() const -{ - return checkElementState(m_element, ATK_STATE_SELECTED); -} - -int AccessibilityUIElement::hierarchicalLevel() const -{ - // FIXME: implement - return 0; -} - -bool AccessibilityUIElement::ariaIsGrabbed() const -{ - return false; -} - -JSStringRef AccessibilityUIElement::ariaDropEffects() const -{ - return 0; -} - -bool AccessibilityUIElement::isExpanded() const -{ - if (!ATK_IS_OBJECT(m_element)) - return false; - - GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); - gboolean isExpanded = atk_state_set_contains_state(stateSet.get(), ATK_STATE_EXPANDED); - - return isExpanded; -} - -bool AccessibilityUIElement::isChecked() const -{ - if (!ATK_IS_OBJECT(m_element)) - return false; - - GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); - gboolean isChecked = atk_state_set_contains_state(stateSet.get(), ATK_STATE_CHECKED); - - return isChecked; -} - -JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfRowHeaders() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfColumns() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfRows() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfVisibleCells() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfHeader() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -int AccessibilityUIElement::indexInTable() -{ - // FIXME: implement - return 0; -} - -static JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange) -{ - GOwnPtr<gchar> rangeString(g_strdup("{0, 0}")); - - if (!element) - return JSStringCreateWithUTF8CString(rangeString.get()); - - ASSERT(ATK_IS_OBJECT(element)); - - AtkObject* axTable = atk_object_get_parent(ATK_OBJECT(element)); - if (!axTable || !ATK_IS_TABLE(axTable)) - return JSStringCreateWithUTF8CString(rangeString.get()); - - // Look for the cell in the table. - gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element)); - if (indexInParent == -1) - return JSStringCreateWithUTF8CString(rangeString.get()); - - int row = -1; - int column = -1; - row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent); - column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent); - - // Get the actual values, if row and columns are valid values. - if (row != -1 && column != -1) { - int base = 0; - int length = 0; - if (isRowRange) { - base = row; - length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column); - } else { - base = column; - length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column); - } - rangeString.set(g_strdup_printf("{%d, %d}", base, length)); - } - - return JSStringCreateWithUTF8CString(rangeString.get()); -} - -JSStringRef AccessibilityUIElement::rowIndexRange() -{ - // Range in table for rows. - return indexRangeInTable(m_element, true); -} - -JSStringRef AccessibilityUIElement::columnIndexRange() -{ - // Range in table for columns. - return indexRangeInTable(m_element, false); -} - -int AccessibilityUIElement::lineForIndex(int) -{ - // FIXME: implement - return 0; -} - -JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) -{ - // FIXME: implement - return false; -} - -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText) -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) -{ - if (!m_element) - return 0; - - ASSERT(ATK_IS_TABLE(m_element)); - - AtkObject* foundCell = atk_table_ref_at(ATK_TABLE(m_element), row, column); - return foundCell ? AccessibilityUIElement(foundCell) : 0; -} - -JSStringRef AccessibilityUIElement::selectedTextRange() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) -{ - // FIXME: implement -} - -JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return 0.0f; -} - -bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) -{ - return false; -} - -static void alterCurrentValue(PlatformUIElement element, int factor) -{ - if (!element) - return; - - ASSERT(ATK_IS_VALUE(element)); - - GValue currentValue = G_VALUE_INIT; - atk_value_get_current_value(ATK_VALUE(element), ¤tValue); - - GValue increment = G_VALUE_INIT; - atk_value_get_minimum_increment(ATK_VALUE(element), &increment); - - GValue newValue = G_VALUE_INIT; - g_value_init(&newValue, G_TYPE_FLOAT); - - g_value_set_float(&newValue, g_value_get_float(¤tValue) + factor * g_value_get_float(&increment)); - atk_value_set_current_value(ATK_VALUE(element), &newValue); - - g_value_unset(&newValue); - g_value_unset(&increment); - g_value_unset(¤tValue); -} - -void AccessibilityUIElement::increment() -{ - alterCurrentValue(m_element, 1); -} - -void AccessibilityUIElement::decrement() -{ - alterCurrentValue(m_element, -1); -} - -void AccessibilityUIElement::press() -{ - if (!m_element) - return; - - ASSERT(ATK_IS_OBJECT(m_element)); - - if (!ATK_IS_ACTION(m_element)) - return; - - // Only one action per object is supported so far. - atk_action_do_action(ATK_ACTION(m_element), 0); -} - -void AccessibilityUIElement::showMenu() -{ - // FIXME: implement -} - -AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::disclosedByRow() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::accessibilityValue() const -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::documentEncoding() -{ - AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); - if (role != ATK_ROLE_DOCUMENT_FRAME) - return JSStringCreateWithCharacters(0, 0); - - return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding")); -} - -JSStringRef AccessibilityUIElement::documentURI() -{ - AtkRole role = atk_object_get_role(ATK_OBJECT(m_element)); - if (role != ATK_ROLE_DOCUMENT_FRAME) - return JSStringCreateWithCharacters(0, 0); - - return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI")); -} - -JSStringRef AccessibilityUIElement::url() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) -{ - // FIXME: implement - return false; -} - -void AccessibilityUIElement::removeNotificationListener() -{ - // FIXME: implement -} - -bool AccessibilityUIElement::isFocusable() const -{ - if (!ATK_IS_OBJECT(m_element)) - return false; - - GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element))); - gboolean isFocusable = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSABLE); - - return isFocusable; -} - -bool AccessibilityUIElement::isSelectable() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isMultiSelectable() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isSelectedOptionActive() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isVisible() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isOffScreen() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isCollapsed() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isIgnored() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::hasPopup() const -{ - // FIXME: implement - return false; -} - -void AccessibilityUIElement::takeFocus() -{ - // FIXME: implement -} - -void AccessibilityUIElement::takeSelection() -{ - // FIXME: implement -} - -void AccessibilityUIElement::addSelection() -{ - // FIXME: implement -} - -void AccessibilityUIElement::removeSelection() -{ - // FIXME: implement -} - -void AccessibilityUIElement::scrollToMakeVisible() -{ - // FIXME: implement -} - -void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) -{ - // FIXME: implement -} - -void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) -{ - // FIXME: implement -} diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index bf687b2d3..83212e65d 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -50,6 +50,7 @@ #include <cstring> #include <getopt.h> #include <gtk/gtk.h> +#include <locale.h> #include <webkit/webkit.h> #include <wtf/Assertions.h> #include <wtf/gobject/GOwnPtr.h> @@ -173,6 +174,7 @@ static void initializeGtkFontSettings(const char* testURL) "gtk-xft-antialias", 1, "gtk-xft-hinting", 0, "gtk-font-name", "Liberation Sans 12", + "gtk-icon-theme-name", "gnome", NULL); gdk_screen_set_resolution(gdk_screen_get_default(), 96.0); @@ -194,7 +196,7 @@ CString getTopLevelPath() CString getOutputDir() { - const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); + const char* webkitOutputDir = g_getenv("WEBKIT_OUTPUTDIR"); if (webkitOutputDir) return webkitOutputDir; @@ -243,8 +245,7 @@ static void initializeFonts(const char* testURL = 0) if (fontsPath.isNull()) g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.data()); - GOwnPtr<GError> error; - GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.data(), 0, &error.outPtr())); + GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.data(), 0, 0)); while (const char* directoryEntry = g_dir_read_name(fontsDirectory.get())) { if (!g_str_has_suffix(directoryEntry, ".ttf") && !g_str_has_suffix(directoryEntry, ".otf")) continue; @@ -438,41 +439,41 @@ static void resetDefaultsToConsistentValues() WebKitWebSettings* settings = webkit_web_view_get_settings(webView); GOwnPtr<gchar> localStoragePath(g_build_filename(g_get_user_data_dir(), "DumpRenderTreeGtk", "databases", NULL)); g_object_set(G_OBJECT(settings), - "enable-private-browsing", FALSE, - "enable-developer-extras", FALSE, - "enable-spell-checking", TRUE, - "enable-html5-database", TRUE, - "enable-html5-local-storage", TRUE, - "html5-local-storage-database-path", localStoragePath.get(), - "enable-xss-auditor", FALSE, - "enable-spatial-navigation", FALSE, - "enable-frame-flattening", FALSE, - "javascript-can-access-clipboard", TRUE, - "javascript-can-open-windows-automatically", TRUE, - "enable-offline-web-application-cache", TRUE, - "enable-universal-access-from-file-uris", TRUE, - "enable-file-access-from-file-uris", TRUE, - "enable-scripts", TRUE, - "enable-dom-paste", TRUE, - "default-font-family", "Times", - "monospace-font-family", "Courier", - "serif-font-family", "Times", - "sans-serif-font-family", "Helvetica", - "cursive-font-family", "cursive", - "fantasy-font-family", "fantasy", - "default-font-size", 12, - "default-monospace-font-size", 10, - "minimum-font-size", 0, - "enable-caret-browsing", FALSE, - "enable-page-cache", FALSE, - "auto-resize-window", TRUE, - "auto-load-images", TRUE, - "enable-java-applet", FALSE, - "enable-plugins", TRUE, - "enable-hyperlink-auditing", FALSE, - "editing-behavior", WEBKIT_EDITING_BEHAVIOR_UNIX, - "enable-fullscreen", TRUE, - NULL); + "enable-accelerated-compositing", FALSE, + "enable-private-browsing", FALSE, + "enable-developer-extras", FALSE, + "enable-spell-checking", TRUE, + "enable-html5-database", TRUE, + "enable-html5-local-storage", TRUE, + "html5-local-storage-database-path", localStoragePath.get(), + "enable-xss-auditor", FALSE, + "enable-spatial-navigation", FALSE, + "javascript-can-access-clipboard", TRUE, + "javascript-can-open-windows-automatically", TRUE, + "enable-offline-web-application-cache", TRUE, + "enable-universal-access-from-file-uris", TRUE, + "enable-file-access-from-file-uris", TRUE, + "enable-scripts", TRUE, + "enable-dom-paste", TRUE, + "default-font-family", "Times", + "monospace-font-family", "Courier", + "serif-font-family", "Times", + "sans-serif-font-family", "Helvetica", + "cursive-font-family", "cursive", + "fantasy-font-family", "fantasy", + "default-font-size", 12, + "default-monospace-font-size", 10, + "minimum-font-size", 0, + "enable-caret-browsing", FALSE, + "enable-page-cache", FALSE, + "auto-resize-window", TRUE, + "auto-load-images", TRUE, + "enable-java-applet", FALSE, + "enable-plugins", TRUE, + "enable-hyperlink-auditing", FALSE, + "editing-behavior", WEBKIT_EDITING_BEHAVIOR_UNIX, + "enable-fullscreen", TRUE, + NULL); webkit_web_view_set_settings(webView, settings); webkit_set_cache_model(WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER); @@ -483,7 +484,6 @@ static void resetDefaultsToConsistentValues() g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL); webkit_web_view_set_zoom_level(webView, 1.0); - DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, DumpRenderTreeSupportGtk::defaultMinimumTimerInterval()); DumpRenderTreeSupportGtk::resetOriginAccessWhiteLists(); @@ -502,8 +502,6 @@ static void resetDefaultsToConsistentValues() DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true); webkit_icon_database_set_path(webkit_get_icon_database(), 0); - DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(false); - DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled(webView, true); DumpRenderTreeSupportGtk::setDefersLoading(webView, false); DumpRenderTreeSupportGtk::setSerializeHTTPLoads(false); @@ -518,8 +516,18 @@ static void resetDefaultsToConsistentValues() DumpRenderTreeSupportGtk::setCSSGridLayoutEnabled(webView, false); DumpRenderTreeSupportGtk::setCSSRegionsEnabled(webView, true); DumpRenderTreeSupportGtk::setCSSCustomFilterEnabled(webView, false); + DumpRenderTreeSupportGtk::setExperimentalContentSecurityPolicyFeaturesEnabled(true); + DumpRenderTreeSupportGtk::setSeamlessIFramesEnabled(true); DumpRenderTreeSupportGtk::setShadowDOMEnabled(true); DumpRenderTreeSupportGtk::setStyleScopedEnabled(true); + + if (gTestRunner) { + gTestRunner->setAuthenticationPassword(""); + gTestRunner->setAuthenticationUsername(""); + gTestRunner->setHandlesAuthenticationChallenges(false); + } + + gtk_widget_set_direction(GTK_WIDGET(webView), GTK_TEXT_DIR_NONE); } static bool useLongRunningServerMode(int argc, char *argv[]) @@ -643,6 +651,15 @@ void dump() gtk_main_quit(); } +static CString temporaryDatabaseDirectory() +{ + const char* directoryFromEnvironment = g_getenv("DUMPRENDERTREE_TEMP"); + if (directoryFromEnvironment) + return directoryFromEnvironment; + GOwnPtr<char> fallback(g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL)); + return fallback.get(); +} + static void setDefaultsToConsistentStateValuesForTesting() { resetDefaultsToConsistentValues(); @@ -651,9 +668,7 @@ static void setDefaultsToConsistentStateValuesForTesting() webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR); #endif - gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL); - webkit_set_web_database_directory_path(databaseDirectory); - g_free(databaseDirectory); + webkit_set_web_database_directory_path(temporaryDatabaseDirectory().data()); #if defined(GTK_API_VERSION_2) gtk_rc_parse_string("style \"nix_scrollbar_spacing\" " @@ -733,8 +748,8 @@ static void runTest(const string& inputLine) bool isSVGW3CTest = (testURL.find("svg/W3C-SVG-1.1") != string::npos); GtkAllocation size; size.x = size.y = 0; - size.width = isSVGW3CTest ? 480 : TestRunner::maxViewWidth; - size.height = isSVGW3CTest ? 360 : TestRunner::maxViewHeight; + size.width = isSVGW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth; + size.height = isSVGW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight; gtk_window_resize(GTK_WINDOW(window), size.width, size.height); gtk_widget_size_allocate(container, &size); @@ -1053,7 +1068,7 @@ static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*); static gboolean webInspectorShowWindow(WebKitWebInspector*, gpointer data) { - gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), 800, 600); + gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), TestRunner::viewWidth, TestRunner::viewHeight); gtk_widget_show_all(webInspectorWindow); return TRUE; } @@ -1231,8 +1246,7 @@ static CString descriptionSuitableForTestResult(WebKitNetworkRequest* request) CString mainDocumentURIString(descriptionSuitableForTestResult(mainDocumentURI)); CString path(convertNetworkRequestToURLPath(request)); GOwnPtr<char> description(g_strdup_printf("<NSURLRequest URL %s, main document URL %s, http method %s>", - path.data(), mainDocumentURIString.data(), - soupMessage ? soupMessage->method : "(none)")); + path.data(), mainDocumentURIString.data(), soupMessage->method)); return CString(description.get()); } @@ -1275,15 +1289,23 @@ static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame* webF SoupMessage* soupMessage = webkit_network_request_get_message(request); SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request)); - if (SOUP_URI_VALID_FOR_HTTP(uri) && g_strcmp0(uri->host, "127.0.0.1") - && g_strcmp0(uri->host, "255.255.255.255") - && g_ascii_strncasecmp(uri->host, "localhost", 9)) { - printf("Blocked access to external URL %s\n", soup_uri_to_string(uri, FALSE)); - // Cancel load of blocked resource to avoid potential - // network-related timeouts in tests. - webkit_network_request_set_uri(request, "about:blank"); - soup_uri_free(uri); - return; + if (SOUP_URI_IS_VALID(uri)) { + GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE)); + + if (SOUP_URI_VALID_FOR_HTTP(uri) && g_strcmp0(uri->host, "127.0.0.1") + && g_strcmp0(uri->host, "255.255.255.255") + && g_ascii_strncasecmp(uri->host, "localhost", 9)) { + printf("Blocked access to external URL %s\n", uriString.get()); + // Cancel load of blocked resource to avoid potential + // network-related timeouts in tests. + webkit_network_request_set_uri(request, "about:blank"); + soup_uri_free(uri); + return; + } + + const string& destination = gTestRunner->redirectionDestinationForURL(uriString.get()); + if (!destination.empty()) + webkit_network_request_set_uri(request, destination.c_str()); } if (uri) @@ -1337,12 +1359,56 @@ static gboolean webViewRunFileChooser(WebKitWebView*, WebKitFileChooserRequest*) return TRUE; } +static void frameLoadEventCallback(WebKitWebFrame* frame, DumpRenderTreeSupportGtk::FrameLoadEvent event, const char* url) +{ + if (done || !gTestRunner->dumpFrameLoadCallbacks()) + return; + + GOwnPtr<char> frameName(getFrameNameSuitableForTestResult(webkit_web_frame_get_web_view(frame), frame)); + switch (event) { + case DumpRenderTreeSupportGtk::WillPerformClientRedirectToURL: + ASSERT(url); + printf("%s - willPerformClientRedirectToURL: %s \n", frameName.get(), url); + break; + case DumpRenderTreeSupportGtk::DidCancelClientRedirect: + printf("%s - didCancelClientRedirectForFrame\n", frameName.get()); + break; + case DumpRenderTreeSupportGtk::DidReceiveServerRedirectForProvisionalLoad: + printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", frameName.get()); + break; + case DumpRenderTreeSupportGtk::DidDisplayInsecureContent: + printf ("didDisplayInsecureContent\n"); + break; + case DumpRenderTreeSupportGtk::DidDetectXSS: + printf ("didDetectXSS\n"); + break; + default: + ASSERT_NOT_REACHED(); + } +} + +static bool authenticationCallback(CString& username, CString& password) +{ + if (!gTestRunner->handlesAuthenticationChallenges()) { + printf("<unknown> - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n"); + return false; + } + + username = gTestRunner->authenticationUsername().c_str(); + password = gTestRunner->authenticationPassword().c_str(); + printf("<unknown> - didReceiveAuthenticationChallenge - Responding with %s:%s\n", username.data(), password.data()); + return true; +} + static WebKitWebView* createWebView() { // It is important to declare DRT is running early so when creating // web view mock clients are used instead of proper ones. DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled(true); + DumpRenderTreeSupportGtk::setFrameLoadEventCallback(frameLoadEventCallback); + DumpRenderTreeSupportGtk::setAuthenticationCallback(authenticationCallback); + WebKitWebView* view = WEBKIT_WEB_VIEW(self_scrolling_webkit_web_view_new()); g_object_connect(G_OBJECT(view), @@ -1427,7 +1493,7 @@ int main(int argc, char* argv[]) initializeGlobalsFromCommandLineOptions(argc, argv); initializeFonts(); - window = gtk_window_new(GTK_WINDOW_POPUP); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); #ifdef GTK_API_VERSION_2 container = gtk_hbox_new(TRUE, 0); #else diff --git a/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp b/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp index 4c968d9f4..ef5a969ae 100644 --- a/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp +++ b/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp @@ -59,15 +59,12 @@ static CString dumpRange(WebKitDOMRange* range) if (!range) return "(null)"; - GOwnPtr<GError> error1; - GOwnPtr<GError> error2; - GOwnPtr<GError> error3; - GOwnPtr<GError> error4; GOwnPtr<gchar> dump(g_strdup_printf("range from %li of %s to %li of %s", - webkit_dom_range_get_start_offset(range, &error1.outPtr()), - dumpNodePath(webkit_dom_range_get_start_container(range, &error2.outPtr())).data(), - webkit_dom_range_get_end_offset(range, &error3.outPtr()), - dumpNodePath(webkit_dom_range_get_end_container(range, &error4.outPtr())).data())); + webkit_dom_range_get_start_offset(range, 0), + dumpNodePath(webkit_dom_range_get_start_container(range, 0)).data(), + webkit_dom_range_get_end_offset(range, 0), + dumpNodePath(webkit_dom_range_get_end_container(range, 0)).data())); + return dump.get(); } @@ -138,8 +135,7 @@ gboolean shouldDeleteRange(WebKitWebView* webView, WebKitDOMRange* range) gboolean shouldShowDeleteInterfaceForElement(WebKitWebView* webView, WebKitDOMHTMLElement* element) { - GOwnPtr<gchar> elementClassName(webkit_dom_element_get_class_name(WEBKIT_DOM_ELEMENT(element))); - return g_str_equal(elementClassName.get(), "needsDeletionUI"); + return FALSE; } gboolean shouldChangeSelectedRange(WebKitWebView* webView, WebKitDOMRange* fromRange, WebKitDOMRange* toRange, WebKitSelectionAffinity affinity, gboolean stillSelecting) diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp index 8f281b239..8fd693564 100644 --- a/Tools/DumpRenderTree/gtk/EventSender.cpp +++ b/Tools/DumpRenderTree/gtk/EventSender.cpp @@ -437,6 +437,10 @@ static JSValueRef mouseScrollByCallback(JSContextRef context, JSObjectRef functi int vertical = (int)JSValueToNumber(context, arguments[1], exception); g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); + // Copy behaviour of Qt and EFL - just return in case of (0,0) mouse scroll + if (!horizontal && !vertical) + return JSValueMakeUndefined(context); + GdkEvent* event = gdk_event_new(GDK_SCROLL); event->scroll.x = lastMousePositionX; event->scroll.y = lastMousePositionY; @@ -489,8 +493,10 @@ static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObject int vertical = JSValueToNumber(context, arguments[1], exception); g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - g_return_val_if_fail(argumentCount < 3 || !JSValueToBoolean(context, arguments[2]), JSValueMakeUndefined(context)); - + // We do not yet support continuous scrolling by page. + if (argumentCount >= 3 && JSValueToBoolean(context, arguments[2])) + return JSValueMakeUndefined(context); + GdkEvent* event = gdk_event_new(GDK_SCROLL); event->scroll.x = lastMousePositionX; event->scroll.y = lastMousePositionY; @@ -539,7 +545,7 @@ static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef f GOwnPtr<gchar> scheme(g_file_get_uri_scheme(parentDirectory.get())); if (g_str_equal(scheme.get(), "http") || g_str_equal(scheme.get(), "https")) { GOwnPtr<gchar> currentDirectory(g_get_current_dir()); - parentDirectory = g_file_new_for_path(currentDirectory.get()); + parentDirectory = adoptGRef(g_file_new_for_path(currentDirectory.get())); } JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); diff --git a/Tools/DumpRenderTree/gtk/GNUmakefile.ImageDiff.am b/Tools/DumpRenderTree/gtk/GNUmakefile.ImageDiff.am deleted file mode 100644 index e7c3aefc0..000000000 --- a/Tools/DumpRenderTree/gtk/GNUmakefile.ImageDiff.am +++ /dev/null @@ -1,28 +0,0 @@ -noinst_PROGRAMS += \ - Programs/ImageDiff - -Programs_ImageDiff_CPPFLAGS = $(global_cppflags) - -Programs_ImageDiff_SOURCES = \ - Tools/DumpRenderTree/gtk/ImageDiff.cpp - -Programs_ImageDiff_CXXFLAGS = \ - $(global_cxxflags) \ - $(global_cppflags) \ - $(Programs_ImageDiff_CFLAGS) - -Programs_ImageDiff_CFLAGS = \ - -fno-strict-aliasing \ - $(global_cflags) \ - $(GLOBALDEPS_CFLAGS) \ - $(GTK_CFLAGS) - -Programs_ImageDiff_LDADD = \ - $(GTK_LIBS) - -Programs_ImageDiff_LDFLAGS = \ - -no-fast-install \ - -no-install - -CLEANFILES += \ - Programs/ImageDiff diff --git a/Tools/DumpRenderTree/gtk/ImageDiff.cpp b/Tools/DumpRenderTree/gtk/ImageDiff.cpp deleted file mode 100644 index e40c33acf..000000000 --- a/Tools/DumpRenderTree/gtk/ImageDiff.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> - * Copyright (C) 2010 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include <cmath> -#include <cstdio> -#include <cstring> -#include <gdk/gdk.h> - -using namespace std; - -static double tolerance = 0; -static GOptionEntry commandLineOptionEntries[] = -{ - { "tolerance", 0, 0, G_OPTION_ARG_DOUBLE, &tolerance, "Percentage difference between images before considering them different", "T" }, - { 0, 0, 0, G_OPTION_ARG_NONE, 0, 0, 0 }, -}; - -GdkPixbuf* readPixbufFromStdin(long imageSize) -{ - unsigned char imageBuffer[2048]; - GdkPixbufLoader* loader = gdk_pixbuf_loader_new_with_type("png", 0); - GError* error = 0; - - while (imageSize > 0) { - size_t bytesToRead = min<int>(imageSize, 2048); - size_t bytesRead = fread(imageBuffer, 1, bytesToRead, stdin); - - if (!gdk_pixbuf_loader_write(loader, reinterpret_cast<const guchar*>(imageBuffer), bytesRead, &error)) { - g_error_free(error); - gdk_pixbuf_loader_close(loader, 0); - g_object_unref(loader); - return 0; - } - - imageSize -= static_cast<int>(bytesRead); - } - - gdk_pixbuf_loader_close(loader, 0); - GdkPixbuf* decodedImage = gdk_pixbuf_loader_get_pixbuf(loader); - g_object_ref(decodedImage); - return decodedImage; -} - -GdkPixbuf* differenceImageFromDifferenceBuffer(unsigned char* buffer, int width, int height) -{ - GdkPixbuf* image = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height); - if (!image) - return image; - - int rowStride = gdk_pixbuf_get_rowstride(image); - unsigned char* diffPixels = gdk_pixbuf_get_pixels(image); - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - unsigned char* diffPixel = diffPixels + (y * rowStride) + (x * 3); - diffPixel[0] = diffPixel[1] = diffPixel[2] = *buffer++; - } - } - - return image; -} - -float calculateDifference(GdkPixbuf* baselineImage, GdkPixbuf* actualImage, GdkPixbuf** differenceImage) -{ - int width = gdk_pixbuf_get_width(actualImage); - int height = gdk_pixbuf_get_height(actualImage); - int numberOfChannels = gdk_pixbuf_get_n_channels(actualImage); - if ((width != gdk_pixbuf_get_width(baselineImage)) - || (height != gdk_pixbuf_get_height(baselineImage)) - || (numberOfChannels != gdk_pixbuf_get_n_channels(baselineImage)) - || (gdk_pixbuf_get_has_alpha(actualImage) != gdk_pixbuf_get_has_alpha(baselineImage))) { - fprintf(stderr, "Error, test and reference image have different properties.\n"); - return 100; // Completely different. - } - - unsigned char* diffBuffer = static_cast<unsigned char*>(malloc(width * height)); - float count = 0; - float sum = 0; - float maxDistance = 0; - int actualRowStride = gdk_pixbuf_get_rowstride(actualImage); - int baseRowStride = gdk_pixbuf_get_rowstride(baselineImage); - unsigned char* actualPixels = gdk_pixbuf_get_pixels(actualImage); - unsigned char* basePixels = gdk_pixbuf_get_pixels(baselineImage); - unsigned char* currentDiffPixel = diffBuffer; - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - unsigned char* actualPixel = actualPixels + (y * actualRowStride) + (x * numberOfChannels); - unsigned char* basePixel = basePixels + (y * baseRowStride) + (x * numberOfChannels); - - float red = (actualPixel[0] - basePixel[0]) / max<float>(255 - basePixel[0], basePixel[0]); - float green = (actualPixel[1] - basePixel[1]) / max<float>(255 - basePixel[1], basePixel[1]); - float blue = (actualPixel[2] - basePixel[2]) / max<float>(255 - basePixel[2], basePixel[2]); - float alpha = (actualPixel[3] - basePixel[3]) / max<float>(255 - basePixel[3], basePixel[3]); - float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0f; - - *currentDiffPixel++ = (unsigned char)(distance * 255.0f); - - if (distance >= 1.0f / 255.0f) { - count += 1.0f; - sum += distance; - maxDistance = max<float>(maxDistance, distance); - } - } - } - - // Compute the difference as a percentage combining both the number of - // different pixels and their difference amount i.e. the average distance - // over the entire image - float difference = 0; - if (count > 0.0f) - difference = 100.0f * sum / (height * width); - if (difference <= tolerance) - difference = 0; - else { - difference = roundf(difference * 100.0f) / 100.0f; - difference = max(difference, 0.01f); // round to 2 decimal places - *differenceImage = differenceImageFromDifferenceBuffer(diffBuffer, width, height); - } - - free(diffBuffer); - return difference; -} - -void printImage(GdkPixbuf* image) -{ - char* buffer; - gsize bufferSize; - GError* error = 0; - if (!gdk_pixbuf_save_to_buffer(image, &buffer, &bufferSize, "png", &error, NULL)) { - g_error_free(error); - return; // Don't bail out, as we can still use the percentage output. - } - - printf("Content-Length: %"G_GSIZE_FORMAT"\n", bufferSize); - fwrite(buffer, 1, bufferSize, stdout); -} - -void printImageDifferences(GdkPixbuf* baselineImage, GdkPixbuf* actualImage) -{ - GdkPixbuf* differenceImage = 0; - float difference = calculateDifference(baselineImage, actualImage, &differenceImage); - if (difference > 0.0f) { - if (differenceImage) { - printImage(differenceImage); - g_object_unref(differenceImage); - } - printf("diff: %01.2f%% failed\n", difference); - } else { - printf("diff: %01.2f%% passed\n", difference); - } -} - -int main(int argc, char* argv[]) -{ - g_type_init(); - - GError* error = 0; - GOptionContext* context = g_option_context_new("- compare two image files, printing their percentage difference and the difference image to stdout"); - g_option_context_add_main_entries(context, commandLineOptionEntries, 0); - if (!g_option_context_parse(context, &argc, &argv, &error)) { - printf("Option parsing failed: %s\n", error->message); - g_error_free(error); - return 1; - } - - GdkPixbuf* actualImage = 0; - GdkPixbuf* baselineImage = 0; - char buffer[2048]; - while (fgets(buffer, sizeof(buffer), stdin)) { - // Convert the first newline into a NUL character so that strtok doesn't produce it. - char* newLineCharacter = strchr(buffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (!strncmp("Content-Length: ", buffer, 16)) { - gchar** tokens = g_strsplit(buffer, " ", 0); - if (!tokens[1]) { - g_strfreev(tokens); - printf("Error, image size must be specified..\n"); - return 1; - } - - long imageSize = strtol(tokens[1], 0, 10); - g_strfreev(tokens); - if (imageSize > 0 && !actualImage) { - if (!(actualImage = readPixbufFromStdin(imageSize))) { - printf("Error, could not read actual image.\n"); - return 1; - } - } else if (imageSize > 0 && !baselineImage) { - if (!(baselineImage = readPixbufFromStdin(imageSize))) { - printf("Error, could not read baseline image.\n"); - return 1; - } - } else { - printf("Error, image size must be specified..\n"); - return 1; - } - } - - if (actualImage && baselineImage) { - printImageDifferences(baselineImage, actualImage); - g_object_unref(actualImage); - g_object_unref(baselineImage); - actualImage = 0; - baselineImage = 0; - } - - fflush(stdout); - } - - return 0; -} diff --git a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp index 32d3dd5cb..7669a0133 100644 --- a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp +++ b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp @@ -48,6 +48,7 @@ #include <libsoup/soup.h> #include <webkit/webkit.h> #include <wtf/gobject/GOwnPtr.h> +#include <wtf/text/WTFString.h> extern "C" { void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script); @@ -107,11 +108,6 @@ void TestRunner::keepWebHistory() // FIXME: implement } -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - return DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo(context, value); -} - size_t TestRunner::webHistoryItemCount() { WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); @@ -126,11 +122,6 @@ size_t TestRunner::webHistoryItemCount() webkit_web_back_forward_list_get_forward_length(list); } -unsigned TestRunner::workerThreadCount() const -{ - return DumpRenderTreeSupportGtk::workerThreadCount(); -} - JSRetainPtr<JSStringRef> TestRunner::platformName() const { JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("gtk")); @@ -157,26 +148,43 @@ JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef ur return JSStringCreateWithUTF8CString(testURI.get()); } +static CString soupURIToStringPreservingPassword(SoupURI* soupURI) +{ + if (!soupURI->password) { + GOwnPtr<char> uriString(soup_uri_to_string(soupURI, FALSE)); + return uriString.get(); + } + + // soup_uri_to_string does not insert the password into the string, so we need to create the + // URI string and then reinsert any credentials that were present in the SoupURI. All tests that + // use URL-embedded credentials use HTTP, so it's safe here. + GOwnPtr<char> password(soupURI->password); + GOwnPtr<char> user(soupURI->user); + soupURI->password = 0; + soupURI->user = 0; + + GOwnPtr<char> uriString(soup_uri_to_string(soupURI, FALSE)); + String absoluteURIWithoutCredentialString = String::fromUTF8(uriString.get()); + String protocolAndCredential = String::format("http://%s:%s@", user ? user.get() : "", password.get()); + return absoluteURIWithoutCredentialString.replace("http://", protocolAndCredential).utf8(); +} + void TestRunner::queueLoad(JSStringRef url, JSStringRef target) { - gchar* relativeURL = JSStringCopyUTF8CString(url); + GOwnPtr<gchar> relativeURL(JSStringCopyUTF8CString(url)); SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame)); - - SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL); + SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL.get()); soup_uri_free(baseURI); - g_free(relativeURL); - gchar* absoluteCString; - if (absoluteURI) { - absoluteCString = soup_uri_to_string(absoluteURI, FALSE); - soup_uri_free(absoluteURI); - } else - absoluteCString = JSStringCopyUTF8CString(url); - - JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteCString)); - g_free(absoluteCString); + if (!absoluteURI) { + WorkQueue::shared()->queue(new LoadItem(url, target)); + return; + } + CString absoluteURIString = soupURIToStringPreservingPassword(absoluteURI); + JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteURIString.data())); WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target)); + soup_uri_free(absoluteURI); } void TestRunner::setAcceptsEditing(bool acceptsEditing) @@ -315,11 +323,6 @@ void TestRunner::setWindowIsKey(bool windowIsKey) // FIXME: implement } -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - DumpRenderTreeSupportGtk::setSmartInsertDeleteEnabled(webkit_web_frame_get_web_view(mainFrame), flag); -} - static gboolean waitToDumpWatchdogFired(void*) { setWaitToDumpWatchdog(0); @@ -369,15 +372,6 @@ void TestRunner::setXSSAuditorEnabled(bool flag) g_object_set(G_OBJECT(settings), "enable-xss-auditor", flag, NULL); } -void TestRunner::setFrameFlatteningEnabled(bool flag) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - WebKitWebSettings* settings = webkit_web_view_get_settings(view); - g_object_set(G_OBJECT(settings), "enable-frame-flattening", flag, NULL); -} - void TestRunner::setSpatialNavigationEnabled(bool flag) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); @@ -410,20 +404,6 @@ void TestRunner::setAuthorAndUserStylesEnabled(bool flag) // FIXME: implement } -void TestRunner::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool isAutofilled) -{ - DumpRenderTreeSupportGtk::setAutofilled(context, nodeObject, isAutofilled); -} - -void TestRunner::disableImageLoading() -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - WebKitWebSettings* settings = webkit_web_view_get_settings(view); - g_object_set(G_OBJECT(settings), "auto-load-images", FALSE, NULL); -} - void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) { // FIXME: Implement for DeviceOrientation layout tests. @@ -500,11 +480,6 @@ void TestRunner::setIconDatabaseEnabled(bool enabled) webkit_icon_database_set_path(database, 0); } -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(flag); -} - void TestRunner::setPopupBlockingEnabled(bool flag) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); @@ -524,11 +499,6 @@ void TestRunner::setPluginsEnabled(bool flag) g_object_set(G_OBJECT(settings), "enable-plugins", flag, NULL); } -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - return DumpRenderTreeSupportGtk::elementDoesAutoCompleteForElementWithId(mainFrame, id); -} - void TestRunner::execCommand(JSStringRef name, JSStringRef value) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); @@ -711,31 +681,6 @@ void TestRunner::setAppCacheMaximumSize(unsigned long long size) webkit_application_cache_set_maximum_size(size); } -bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - gchar* name = JSStringCopyUTF8CString(animationName); - gchar* element = JSStringCopyUTF8CString(elementId); - bool returnValue = DumpRenderTreeSupportGtk::pauseAnimation(mainFrame, name, time, element); - g_free(name); - g_free(element); - return returnValue; -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - gchar* name = JSStringCopyUTF8CString(propertyName); - gchar* element = JSStringCopyUTF8CString(elementId); - bool returnValue = DumpRenderTreeSupportGtk::pauseTransition(mainFrame, name, time, element); - g_free(name); - g_free(element); - return returnValue; -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - return DumpRenderTreeSupportGtk::numberOfActiveAnimations(mainFrame); -} - static gboolean booleanFromValue(gchar* value) { return !g_ascii_strcasecmp(value, "true") || !g_ascii_strcasecmp(value, "1"); @@ -814,7 +759,8 @@ void TestRunner::overridePreference(JSStringRef key, JSStringRef value) void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) { - printf("TestRunner::addUserScript not implemented.\n"); + GOwnPtr<gchar> sourceCode(JSStringCopyUTF8CString(source)); + DumpRenderTreeSupportGtk::addUserScript(mainFrame, sourceCode.get(), runAtStart, allFrames); } void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) @@ -833,11 +779,6 @@ void TestRunner::setDeveloperExtrasEnabled(bool enabled) g_object_set(webSettings, "enable-developer-extras", enabled, NULL); } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - // FIXME: Implement this. -} - void TestRunner::showWebInspector() { WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); @@ -898,16 +839,6 @@ void TestRunner::setWebViewEditable(bool) { } -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - CString markerTextGChar = DumpRenderTreeSupportGtk::markerTextForListItem(mainFrame, context, nodeObject); - if (markerTextGChar.isNull()) - return 0; - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextGChar.data())); - return markerText; -} - void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) { } @@ -921,15 +852,21 @@ void TestRunner::setSerializeHTTPLoads(bool serialize) DumpRenderTreeSupportGtk::setSerializeHTTPLoads(serialize); } -void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, minimumTimerInterval); -} - void TestRunner::setTextDirection(JSStringRef direction) { - // FIXME: Implement. + GOwnPtr<gchar> writingDirection(JSStringCopyUTF8CString(direction)); + + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + if (g_str_equal(writingDirection.get(), "auto")) + gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_NONE); + else if (g_str_equal(writingDirection.get(), "ltr")) + gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_LTR); + else if (g_str_equal(writingDirection.get(), "rtl")) + gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_RTL); + else + fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", writingDirection.get()); } void TestRunner::addChromeInputField() @@ -970,30 +907,36 @@ void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) void TestRunner::resetPageVisibility() { - // FIXME: Implement this. + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + DumpRenderTreeSupportGtk::setPageVisibility(webView, WebCore::PageVisibilityStateVisible, true); } -void TestRunner::setPageVisibility(const char*) +void TestRunner::setPageVisibility(const char* visibility) { - // FIXME: Implement this. -} + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + String visibilityString(visibility); + WebCore::PageVisibilityState visibilityState = WebCore::PageVisibilityStateVisible; -void TestRunner::setAutomaticLinkDetectionEnabled(bool) -{ - // FIXME: Implement this. + if (visibilityString == "visible") + visibilityState = WebCore::PageVisibilityStateVisible; + else if (visibilityString == "hidden") + visibilityState = WebCore::PageVisibilityStateHidden; + else + return; + + DumpRenderTreeSupportGtk::setPageVisibility(webView, visibilityState, false); } -void TestRunner::sendWebIntentResponse(JSStringRef) +void TestRunner::setAutomaticLinkDetectionEnabled(bool) { // FIXME: Implement this. } -void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) +void TestRunner::setStorageDatabaseIdleInterval(double) { // FIXME: Implement this. } -void TestRunner::setStorageDatabaseIdleInterval(double) +void TestRunner::closeIdleLocalStorageDatabases() { - // FIXME: Implement this. } diff --git a/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm b/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm new file mode 100644 index 000000000..ac57ecc8c --- /dev/null +++ b/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DumpRenderTree.h" +#import "AccessibilityController.h" + +#if PLATFORM(IOS) + +#import "AccessibilityCommonMac.h" +#import "AccessibilityUIElement.h" +#import <Foundation/Foundation.h> +#import <WebKit/WebFramePrivate.h> +#import <WebKit/WebHTMLViewPrivate.h> + +@interface WebHTMLView (Private) +- (id)accessibilityFocusedUIElement; +@end + +AccessibilityController::AccessibilityController() +{ +} + +AccessibilityController::~AccessibilityController() +{ +} + +AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) +{ + return rootElement().elementAtPoint(x, y); +} + +AccessibilityUIElement AccessibilityController::focusedElement() +{ + id webDocumentView = [[mainFrame frameView] documentView]; + if ([webDocumentView isKindOfClass:[WebHTMLView class]]) + return AccessibilityUIElement([(WebHTMLView *)webDocumentView accessibilityFocusedUIElement]); + return 0; +} + +AccessibilityUIElement AccessibilityController::rootElement() +{ + // FIXME: we could do some caching here. + id webDocumentView = [[mainFrame frameView] documentView]; + if ([webDocumentView isKindOfClass:[WebHTMLView class]]) + return AccessibilityUIElement([(WebHTMLView *)webDocumentView accessibilityRootElement]); + return 0; +} + +static id findAccessibleObjectById(id obj, NSString *idAttribute) +{ + id objIdAttribute = [obj accessibilityIdentifier]; + if ([objIdAttribute isKindOfClass:[NSString class]] && [objIdAttribute isEqualToString:idAttribute]) + return obj; + + NSUInteger childrenCount = [obj accessibilityElementCount]; + for (NSUInteger i = 0; i < childrenCount; ++i) { + id result = findAccessibleObjectById([obj accessibilityElementAtIndex:i], idAttribute); + if (result) + return result; + } + + return 0; +} + +AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef idAttributeRef) +{ + id webDocumentView = [[mainFrame frameView] documentView]; + if (![webDocumentView isKindOfClass:[WebHTMLView class]]) + return 0; + + id root = [(WebHTMLView *)webDocumentView accessibilityRootElement]; + NSString *idAttribute = [NSString stringWithJSStringRef:idAttributeRef]; + id result = findAccessibleObjectById(root, idAttribute); + if (result) + return AccessibilityUIElement(result); + + return 0; +} + +void AccessibilityController::setLogFocusEvents(bool) +{ +} + +void AccessibilityController::setLogScrollingStartEvents(bool) +{ +} + +void AccessibilityController::setLogValueChangeEvents(bool) +{ +} + +void AccessibilityController::setLogAccessibilityEvents(bool) +{ +} + +bool AccessibilityController::addNotificationListener(JSObjectRef functionCallback) +{ + return false; +} + +void AccessibilityController::removeNotificationListener() +{ +} + +#endif // PLATFORM(IOS) diff --git a/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm b/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm new file mode 100644 index 000000000..e66aa32a6 --- /dev/null +++ b/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm @@ -0,0 +1,811 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DumpRenderTree.h" +#import "AccessibilityUIElement.h" + +#import "AccessibilityCommonMac.h" +#import <Foundation/Foundation.h> +#import <JavaScriptCore/JSRetainPtr.h> +#import <JavaScriptCore/JSStringRef.h> +#import <JavaScriptCore/JSStringRefCF.h> +#import <WebCore/TextGranularity.h> +#import <WebKit/WebFrame.h> +#import <WebKit/WebHTMLView.h> +#import <WebKit/WebTypesInternal.h> +#import <wtf/RetainPtr.h> +#import <wtf/Vector.h> + +#if PLATFORM(IOS) + +#import <UIKit/UIKit.h> + +typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context); + +AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) + : m_element(element) +{ + [m_element retain]; +} + +AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) + : m_element(other.m_element) +{ + [m_element retain]; +} + +AccessibilityUIElement::~AccessibilityUIElement() +{ + [m_element release]; +} + +@interface NSObject (UIAccessibilityHidden) +- (id)accessibilityHitTest:(CGPoint)point; +- (id)accessibilityLinkedElement; +- (NSRange)accessibilityColumnRange; +- (NSRange)accessibilityRowRange; +- (id)accessibilityElementForRow:(NSInteger)row andColumn:(NSInteger)column; +- (NSURL *)accessibilityURL; +- (NSArray *)accessibilityHeaderElements; +- (NSString *)accessibilityPlaceholderValue; +- (NSString *)stringForRange:(NSRange)range; +- (NSArray *)elementsForRange:(NSRange)range; +- (NSString *)selectionRangeString; +- (CGPoint)accessibilityClickPoint; +- (void)accessibilityModifySelection:(WebCore::TextGranularity)granularity increase:(BOOL)increase; +- (void)accessibilitySetPostedNotificationCallback:(AXPostedNotificationCallback)function withContext:(void*)context; +- (CGFloat)_accessibilityMinValue; +- (CGFloat)_accessibilityMaxValue; +@end + +@interface NSObject (WebAccessibilityObjectWrapperPrivate) +- (CGPathRef)_accessibilityPath; +@end + +static JSStringRef concatenateAttributeAndValue(NSString* attribute, NSString* value) +{ + Vector<UniChar> buffer([attribute length]); + [attribute getCharacters:buffer.data()]; + buffer.append(':'); + buffer.append(' '); + + Vector<UniChar> valueBuffer([value length]); + [value getCharacters:valueBuffer.data()]; + buffer.appendVector(valueBuffer); + + return JSStringCreateWithCharacters(buffer.data(), buffer.size()); +} + +#pragma mark iPhone Attributes + +JSStringRef AccessibilityUIElement::iphoneLabel() +{ + return concatenateAttributeAndValue(@"AXLabel", [m_element accessibilityLabel]); +} + +JSStringRef AccessibilityUIElement::iphoneHint() +{ + return concatenateAttributeAndValue(@"AXHint", [m_element accessibilityHint]); +} + +JSStringRef AccessibilityUIElement::iphoneValue() +{ + return concatenateAttributeAndValue(@"AXValue", [m_element accessibilityValue]); +} + +JSStringRef AccessibilityUIElement::iphoneIdentifier() +{ + return concatenateAttributeAndValue(@"AXIdentifier", [m_element accessibilityIdentifier]); +} + +JSStringRef AccessibilityUIElement::iphoneTraits() +{ + return concatenateAttributeAndValue(@"AXTraits", [NSString stringWithFormat:@"%qu", [m_element accessibilityTraits]]); +} + +bool AccessibilityUIElement::iphoneIsElement() +{ + return [m_element isAccessibilityElement]; +} + +int AccessibilityUIElement::iphoneElementTextPosition() +{ + NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue]; + return range.location; +} + +int AccessibilityUIElement::iphoneElementTextLength() +{ + NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue]; + return range.length; +} + +JSStringRef AccessibilityUIElement::url() +{ + NSURL *url = [m_element accessibilityURL]; + return [[url absoluteString] createJSStringRef]; +} + +double AccessibilityUIElement::x() +{ + CGRect frame = [m_element accessibilityFrame]; + return frame.origin.x; +} + +double AccessibilityUIElement::y() +{ + CGRect frame = [m_element accessibilityFrame]; + return frame.origin.y; +} + +double AccessibilityUIElement::width() +{ + CGRect frame = [m_element accessibilityFrame]; + return frame.size.width; +} + +double AccessibilityUIElement::height() +{ + CGRect frame = [m_element accessibilityFrame]; + return frame.size.height; +} + +double AccessibilityUIElement::clickPointX() +{ + CGPoint centerPoint = [m_element accessibilityClickPoint]; + return centerPoint.x; +} + +double AccessibilityUIElement::clickPointY() +{ + CGPoint centerPoint = [m_element accessibilityClickPoint]; + return centerPoint.y; +} + +void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& elementVector) +{ + NSInteger childCount = [m_element accessibilityElementCount]; + for (NSInteger k = 0; k < childCount; ++k) + elementVector.append(AccessibilityUIElement([m_element accessibilityElementAtIndex:k])); +} + +void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length) +{ + NSUInteger childCount = [m_element accessibilityElementCount]; + for (NSUInteger k = location; k < childCount && k < (location+length); ++k) + elementVector.append(AccessibilityUIElement([m_element accessibilityElementAtIndex:k])); +} + +int AccessibilityUIElement::childrenCount() +{ + Vector<AccessibilityUIElement> children; + getChildren(children); + + return children.size(); +} + +AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) +{ + id element = [m_element accessibilityHitTest:NSMakePoint(x, y)]; + if (!element) + return nil; + + return AccessibilityUIElement(element); +} + +unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) +{ + Vector<AccessibilityUIElement> children; + getChildrenWithRange(children, index, 1); + + if (children.size() == 1) + return children[0]; + return nil; +} + +AccessibilityUIElement AccessibilityUIElement::headerElementAtIndex(unsigned index) +{ + NSArray *headers = [m_element accessibilityHeaderElements]; + if (index < [headers count]) + return [headers objectAtIndex:index]; + + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::linkedElement() +{ + id linkedElement = [m_element accessibilityLinkedElement]; + if (linkedElement) + return AccessibilityUIElement(linkedElement); + + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) +{ + // FIXME: implement + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index) +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::titleUIElement() +{ + return 0; +} + +AccessibilityUIElement AccessibilityUIElement::parentElement() +{ + id accessibilityObject = [m_element accessibilityContainer]; + if (accessibilityObject) + return AccessibilityUIElement(accessibilityObject); + + return nil; +} + +AccessibilityUIElement AccessibilityUIElement::disclosedByRow() +{ + return 0; +} + +void AccessibilityUIElement::increaseTextSelection() +{ + [m_element accessibilityModifySelection:WebCore::CharacterGranularity increase:YES]; +} + +void AccessibilityUIElement::decreaseTextSelection() +{ + [m_element accessibilityModifySelection:WebCore::CharacterGranularity increase:NO]; +} + +JSStringRef AccessibilityUIElement::stringForSelection() +{ + NSString *stringForRange = [m_element selectionRangeString]; + if (!stringForRange) + return 0; + + return [stringForRange createJSStringRef]; +} + +JSStringRef AccessibilityUIElement::stringForRange(unsigned location, unsigned length) +{ + NSString *stringForRange = [m_element stringForRange:NSMakeRange(location, length)]; + if (!stringForRange) + return 0; + + return [stringForRange createJSStringRef]; +} + +JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) +{ + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) +{ + return false; +} + + +void AccessibilityUIElement::elementsForRange(unsigned location, unsigned length, Vector<AccessibilityUIElement>& elements) +{ + NSArray *elementsForRange = [m_element elementsForRange:NSMakeRange(location, length)]; + for (id object in elementsForRange) { + AccessibilityUIElement element = AccessibilityUIElement(object); + elements.append(element); + } +} + +static void _CGPathEnumerationIteration(void *info, const CGPathElement *element) +{ + NSMutableString *result = (NSMutableString *)info; + switch (element->type) { + case kCGPathElementMoveToPoint: + [result appendString:@"\tMove to point\n"]; + break; + + case kCGPathElementAddLineToPoint: + [result appendString:@"\tLine to\n"]; + break; + + case kCGPathElementAddQuadCurveToPoint: + [result appendString:@"\tQuad curve to\n"]; + break; + + case kCGPathElementAddCurveToPoint: + [result appendString:@"\tCurve to\n"]; + break; + + case kCGPathElementCloseSubpath: + [result appendString:@"\tClose\n"]; + break; + } +} + +JSStringRef AccessibilityUIElement::pathDescription() const +{ + NSMutableString *result = [NSMutableString stringWithString:@"\nStart Path\n"]; + CGPathRef pathRef = [m_element _accessibilityPath]; + + CGPathApply(pathRef, result, _CGPathEnumerationIteration); + + return [result createJSStringRef]; +} + +#pragma mark Unused + +void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elementVector) +{ +} + +void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>& elementVector) +{ +} + +JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfChildren() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::allAttributes() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) +{ + if (JSStringIsEqualToUTF8CString(attribute, "AXPlaceholderValue")) + return [[m_element accessibilityPlaceholderValue] createJSStringRef]; + + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::isPressActionSupported() +{ + return false; +} + +bool AccessibilityUIElement::isIncrementActionSupported() +{ + return false; +} + +bool AccessibilityUIElement::isDecrementActionSupported() +{ + return false; +} + +bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) +{ + return false; +} + +bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) +{ + return false; +} + +bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) +{ + return false; +} + +JSStringRef AccessibilityUIElement::parameterizedAttributeNames() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::role() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::subrole() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::roleDescription() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::title() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::description() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::orientation() const +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::stringValue() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::language() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::helpText() const +{ + return JSStringCreateWithCharacters(0, 0); +} + +double AccessibilityUIElement::intValue() const +{ + return 0.0f; +} + +double AccessibilityUIElement::minValue() +{ + return [m_element _accessibilityMinValue]; +} + +double AccessibilityUIElement::maxValue() +{ + return [m_element _accessibilityMaxValue]; +} + +JSStringRef AccessibilityUIElement::valueDescription() +{ + return JSStringCreateWithCharacters(0, 0); +} + +int AccessibilityUIElement::insertionPointLineNumber() +{ + return -1; +} + +bool AccessibilityUIElement::isEnabled() +{ + return false; +} + +bool AccessibilityUIElement::isRequired() const +{ + return false; +} + +bool AccessibilityUIElement::isFocused() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isSelected() const +{ + UIAccessibilityTraits traits = [m_element accessibilityTraits]; + return (traits & UIAccessibilityTraitSelected); +} + +bool AccessibilityUIElement::isExpanded() const +{ + return false; +} + +bool AccessibilityUIElement::isChecked() const +{ + return false; +} + +int AccessibilityUIElement::hierarchicalLevel() const +{ + return 0; +} + +bool AccessibilityUIElement::ariaIsGrabbed() const +{ + return false; +} + +JSStringRef AccessibilityUIElement::ariaDropEffects() const +{ + return JSStringCreateWithCharacters(0, 0); +} + +int AccessibilityUIElement::lineForIndex(int index) +{ + return -1; +} + +JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfRowHeaders() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfColumns() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfRows() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfVisibleCells() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::attributesOfHeader() +{ + return JSStringCreateWithCharacters(0, 0); +} + +int AccessibilityUIElement::rowCount() +{ + return -1; +} + +int AccessibilityUIElement::columnCount() +{ + return -1; +} + +int AccessibilityUIElement::indexInTable() +{ + return -1; +} + +JSStringRef AccessibilityUIElement::rowIndexRange() +{ + NSRange range = [m_element accessibilityRowRange]; + NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", (unsigned long)range.location, (unsigned long)range.length]; + return [rangeDescription createJSStringRef]; +} + +JSStringRef AccessibilityUIElement::columnIndexRange() +{ + NSRange range = [m_element accessibilityColumnRange]; + NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", (unsigned long)range.location, (unsigned long)range.length]; + return [rangeDescription createJSStringRef]; +} + +AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned col, unsigned row) +{ + return AccessibilityUIElement([m_element accessibilityElementForRow:row andColumn:col]); +} + +JSStringRef AccessibilityUIElement::selectedTextRange() +{ + return JSStringCreateWithCharacters(0, 0); +} + +void AccessibilityUIElement::assistiveTechnologySimulatedFocus() +{ + [m_element accessibilityElementDidBecomeFocused]; +} + +void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) +{ +} + +void AccessibilityUIElement::increment() +{ + [m_element accessibilityIncrement]; +} + +void AccessibilityUIElement::decrement() +{ + [m_element accessibilityDecrement]; +} + +void AccessibilityUIElement::showMenu() +{ +} + +void AccessibilityUIElement::press() +{ +} + +JSStringRef AccessibilityUIElement::accessibilityValue() const +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::documentEncoding() +{ + return JSStringCreateWithCharacters(0, 0); +} + +JSStringRef AccessibilityUIElement::documentURI() +{ + return JSStringCreateWithCharacters(0, 0); +} + +static void _accessibilityNotificationCallback(id element, NSString* notification, void* context) +{ + if (!context) + return; + + JSObjectRef functionCallback = static_cast<JSObjectRef>(context); + + JSRetainPtr<JSStringRef> jsNotification(Adopt, [notification createJSStringRef]); + JSValueRef argument = JSValueMakeString([mainFrame globalContext], jsNotification.get()); + JSObjectCallAsFunction([mainFrame globalContext], functionCallback, NULL, 1, &argument, NULL); +} + +bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) +{ + if (!functionCallback) + return false; + + m_notificationFunctionCallback = functionCallback; + [platformUIElement() accessibilitySetPostedNotificationCallback:_accessibilityNotificationCallback withContext:reinterpret_cast<void*>(m_notificationFunctionCallback)]; + return true; +} + +void AccessibilityUIElement::removeNotificationListener() +{ + m_notificationFunctionCallback = 0; + [platformUIElement() accessibilitySetPostedNotificationCallback:nil withContext:nil]; +} + +bool AccessibilityUIElement::isFocusable() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isSelectable() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isMultiSelectable() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isSelectedOptionActive() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isVisible() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isOffScreen() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isCollapsed() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::isIgnored() const +{ + // FIXME: implement + return false; +} + +bool AccessibilityUIElement::hasPopup() const +{ + // FIXME: implement + return false; +} + +void AccessibilityUIElement::takeFocus() +{ + // FIXME: implement +} + +void AccessibilityUIElement::takeSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::addSelection() +{ + // FIXME: implement +} + +void AccessibilityUIElement::removeSelection() +{ + // FIXME: implement +} + +AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly) +{ + // FIXME: implement + return 0; +} + +double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) +{ + // FIXME: implement + return 0; +} +#endif // PLATFORM(IOS) diff --git a/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm index cd1c92d12..f775006fc 100644 --- a/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm +++ b/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm @@ -52,6 +52,10 @@ #define NSAccessibilityDropEffectsAttribute @"AXDropEffects" #endif +#ifndef NSAccessibilityPathAttribute +#define NSAccessibilityPathAttribute @"AXPath" +#endif + typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context); @interface NSObject (WebKitAccessibilityAdditions) @@ -158,7 +162,7 @@ static JSStringRef concatenateAttributeAndValue(NSString* attribute, NSString* v Vector<UniChar> valueBuffer([value length]); [value getCharacters:valueBuffer.data()]; - buffer.append(valueBuffer); + buffer.appendVector(valueBuffer); return JSStringCreateWithCharacters(buffer.data(), buffer.size()); } @@ -671,11 +675,31 @@ int AccessibilityUIElement::insertionPointLineNumber() return -1; } -bool AccessibilityUIElement::isActionSupported(JSStringRef action) +bool AccessibilityUIElement::isPressActionSupported() { BEGIN_AX_OBJC_EXCEPTIONS NSArray* actions = [m_element accessibilityActionNames]; - return [actions containsObject:[NSString stringWithJSStringRef:action]]; + return [actions containsObject:NSAccessibilityPressAction]; + END_AX_OBJC_EXCEPTIONS + + return false; +} + +bool AccessibilityUIElement::isIncrementActionSupported() +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray* actions = [m_element accessibilityActionNames]; + return [actions containsObject:NSAccessibilityIncrementAction]; + END_AX_OBJC_EXCEPTIONS + + return false; +} + +bool AccessibilityUIElement::isDecrementActionSupported() +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray* actions = [m_element accessibilityActionNames]; + return [actions containsObject:NSAccessibilityDecrementAction]; END_AX_OBJC_EXCEPTIONS return false; @@ -881,24 +905,67 @@ bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location return false; NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil]; - if([[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue]) - return true; + BOOL misspelled = [[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue]; +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + if (misspelled) + misspelled = [[attrs objectForKey:NSAccessibilityMarkedMisspelledTextAttribute] boolValue]; +#endif + return misspelled; END_AX_OBJC_EXCEPTIONS return false; } -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText) +AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly) { BEGIN_AX_OBJC_EXCEPTIONS NSMutableDictionary* parameter = [NSMutableDictionary dictionary]; [parameter setObject:(isDirectionNext) ? @"AXDirectionNext" : @"AXDirectionPrevious" forKey:@"AXDirection"]; + if (visibleOnly) + [parameter setObject:[NSNumber numberWithBool:YES] forKey:@"AXVisibleOnly"]; [parameter setObject:[NSNumber numberWithInt:1] forKey:@"AXResultsLimit"]; if (startElement && startElement->platformUIElement()) [parameter setObject:(id)startElement->platformUIElement() forKey:@"AXStartElement"]; - if (searchKey) - [parameter setObject:[NSString stringWithJSStringRef:searchKey] forKey:@"AXSearchKey"]; - if (searchText) + if (searchKey) { + if (JSValueIsString(context, searchKey)) { + NSString *searchKeyParameter = nil; + JSStringRef singleSearchKey = JSValueToStringCopy(context, searchKey, 0); + if (singleSearchKey) { + searchKeyParameter = [NSString stringWithJSStringRef:singleSearchKey]; + JSStringRelease(singleSearchKey); + if (searchKeyParameter) + [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"]; + } + } + else if (JSValueIsObject(context, searchKey)) { + NSMutableArray *searchKeyParameter = nil; + JSObjectRef array = const_cast<JSObjectRef>(searchKey); + unsigned arrayLength = 0; + JSRetainPtr<JSStringRef> arrayLengthString(Adopt, JSStringCreateWithUTF8CString("length")); + JSValueRef arrayLengthValue = JSObjectGetProperty(context, array, arrayLengthString.get(), 0); + if (arrayLengthValue && JSValueIsNumber(context, arrayLengthValue)) + arrayLength = static_cast<unsigned>(JSValueToNumber(context, arrayLengthValue, 0)); + + for (unsigned i = 0; i < arrayLength; ++i) { + JSValueRef exception = 0; + JSValueRef value = JSObjectGetPropertyAtIndex(context, array, i, &exception); + if (exception) + break; + JSStringRef singleSearchKey = JSValueToStringCopy(context, value, &exception); + if (exception) + break; + if (singleSearchKey) { + if (!searchKeyParameter) + searchKeyParameter = [NSMutableArray array]; + [searchKeyParameter addObject:[NSString stringWithJSStringRef:singleSearchKey]]; + JSStringRelease(singleSearchKey); + } + } + if (searchKeyParameter) + [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"]; + } + } + if (searchText && JSStringGetLength(searchText)) [parameter setObject:[NSString stringWithJSStringRef:searchText] forKey:@"AXSearchText"]; id uiElement = [[m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameter] lastObject]; @@ -1069,6 +1136,39 @@ AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const return 0; } +JSStringRef AccessibilityUIElement::pathDescription() const +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSMutableString *result = [NSMutableString stringWithString:@"\nStart Path\n"]; + NSBezierPath *bezierPath = [m_element accessibilityAttributeValue:NSAccessibilityPathAttribute]; + + NSUInteger elementCount = [bezierPath elementCount]; + for (NSUInteger i = 0; i < elementCount; i++) { + switch ([bezierPath elementAtIndex:i]) { + case NSMoveToBezierPathElement: + [result appendString:@"\tMove to point\n"]; + break; + + case NSLineToBezierPathElement: + [result appendString:@"\tLine to\n"]; + break; + + case NSCurveToBezierPathElement: + [result appendString:@"\tCurve to\n"]; + break; + + case NSClosePathBezierPathElement: + [result appendString:@"\tClose\n"]; + break; + } + } + + return [result createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + JSStringRef AccessibilityUIElement::selectedTextRange() { NSRange range = NSMakeRange(NSNotFound, 0); @@ -1417,9 +1517,53 @@ AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker #endif // SUPPORTS_AX_TEXTMARKERS +JSStringRef AccessibilityUIElement::supportedActions() +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray *names = [m_element accessibilityActionNames]; + return [[names componentsJoinedByString:@","] createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + +static NSString *convertMathMultiscriptPairsToString(NSArray *pairs) +{ + __block NSMutableString *result = [NSMutableString string]; + [pairs enumerateObjectsUsingBlock:^(id pair, NSUInteger index, BOOL *stop) { + for (NSString *key in pair) + [result appendFormat:@"\t%lu. %@ = %@\n", (unsigned long)index, key, [[pair objectForKey:key] accessibilityAttributeValue:NSAccessibilitySubroleAttribute]]; + }]; + + return result; +} + +JSStringRef AccessibilityUIElement::mathPostscriptsDescription() const +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray *pairs = [m_element accessibilityAttributeValue:@"AXMathPostscripts"]; + return [convertMathMultiscriptPairsToString(pairs) createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + +JSStringRef AccessibilityUIElement::mathPrescriptsDescription() const +{ + BEGIN_AX_OBJC_EXCEPTIONS + NSArray *pairs = [m_element accessibilityAttributeValue:@"AXMathPrescripts"]; + return [convertMathMultiscriptPairsToString(pairs) createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + + void AccessibilityUIElement::scrollToMakeVisible() { - // FIXME: implement + BEGIN_AX_OBJC_EXCEPTIONS + [m_element accessibilityPerformAction:@"AXScrollToVisible"]; + END_AX_OBJC_EXCEPTIONS } void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) diff --git a/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig b/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig index 8235bdb8f..cf0d22d0c 100644 --- a/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig +++ b/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig @@ -21,7 +21,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -OTHER_LDFLAGS = -sectcreate __DATA Ahem qt/fonts/AHEM____.TTF -sectcreate __DATA WeightWatcher100 fonts/WebKitWeightWatcher100.ttf -sectcreate __DATA WeightWatcher200 fonts/WebKitWeightWatcher200.ttf -sectcreate __DATA WeightWatcher300 fonts/WebKitWeightWatcher300.ttf -sectcreate __DATA WeightWatcher400 fonts/WebKitWeightWatcher400.ttf -sectcreate __DATA WeightWatcher500 fonts/WebKitWeightWatcher500.ttf -sectcreate __DATA WeightWatcher600 fonts/WebKitWeightWatcher600.ttf -sectcreate __DATA WeightWatcher700 fonts/WebKitWeightWatcher700.ttf -sectcreate __DATA WeightWatcher800 fonts/WebKitWeightWatcher800.ttf -sectcreate __DATA WeightWatcher900 fonts/WebKitWeightWatcher900.ttf -sectcreate __DATA HiraMaruMono-W4 fonts/SampleFont.sfont -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) +OTHER_LDFLAGS = -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) LD_RUNPATH_SEARCH_PATHS = "@loader_path/."; PRODUCT_NAME = DumpRenderTree GCC_ENABLE_OBJC_EXCEPTIONS = YES diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm index cbcc09562..2f301c8a2 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm @@ -32,6 +32,7 @@ #import "AccessibilityController.h" #import "CheckedMalloc.h" +#import "DefaultPolicyDelegate.h" #import "DumpRenderTreeDraggingInfo.h" #import "DumpRenderTreePasteboard.h" #import "DumpRenderTreeWindow.h" @@ -110,6 +111,12 @@ using namespace std; +(void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host; @end +#if USE(APPKIT) +@interface NSSound (Details) ++ (void)_setAlertType:(NSUInteger)alertType; +@end +#endif + static void runTest(const string& testPathOrURL); // Deciding when it's OK to dump out the state is a bit tricky. All these must be true: @@ -142,10 +149,11 @@ static EditingDelegate *editingDelegate; static ResourceLoadDelegate *resourceLoadDelegate; static HistoryDelegate *historyDelegate; PolicyDelegate *policyDelegate; +DefaultPolicyDelegate *defaultPolicyDelegate; StorageTrackerDelegate *storageDelegate; static int dumpPixelsForAllTests = NO; -static bool dumpPixelsForCurrentTest; +static bool dumpPixelsForCurrentTest = false; static int threaded; static int dumpTree = YES; static int useTimeoutWatchdog = YES; @@ -230,7 +238,7 @@ static bool shouldIgnoreWebCoreNodeLeaks(const string& URLString) static NSSet *allowedFontFamilySet() { - static NSSet *fontFamiliySet = [[NSSet setWithObjects: + static NSSet *fontFamilySet = [[NSSet setWithObjects: @"Ahem", @"Al Bayan", @"American Typewriter", @@ -325,6 +333,8 @@ static NSSet *allowedFontFamilySet() @"Sathu", @"Silom", @"Skia", + @"Songti SC", + @"Songti TC", @"STFangsong", @"STHeiti", @"STIXGeneral", @@ -347,7 +357,16 @@ static NSSet *allowedFontFamilySet() @"Zapfino", nil] retain]; - return fontFamiliySet; + return fontFamilySet; +} + +static NSSet *systemHiddenFontFamilySet() +{ + static NSSet *fontFamilySet = [[NSSet setWithObjects: + @".LucidaGrandeUI", + nil] retain]; + + return fontFamilySet; } static IMP appKitAvailableFontFamiliesIMP; @@ -383,7 +402,11 @@ static NSArray *drt_NSFontManager_availableFonts(id self, SEL _cmd) [availableFontList addObject:[fontInfo objectAtIndex:0]]; } } - + + for (NSString *hiddenFontFamily in systemHiddenFontFamilySet()) { + [availableFontList addObject:hiddenFontFamily]; + } + availableFonts = availableFontList; return availableFonts; } @@ -411,9 +434,6 @@ static void swizzleNSFontManagerMethods() static void activateTestingFonts() { - // Work around <rdar://problem/6698023> by activating fonts from disk - // FIXME: This code can be removed once <rdar://problem/6698023> is addressed. - static const char* fontFileNames[] = { "AHEM____.TTF", "WebKitWeightWatcher100.ttf", @@ -516,7 +536,7 @@ static void registerMockScrollbars() WebView *createWebViewAndOffscreenWindow() { - NSRect rect = NSMakeRect(0, 0, TestRunner::maxViewWidth, TestRunner::maxViewHeight); + NSRect rect = NSMakeRect(0, 0, TestRunner::viewWidth, TestRunner::viewHeight); WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil groupName:@"org.webkit.DumpRenderTree"]; [webView setUIDelegate:uiDelegate]; @@ -533,8 +553,14 @@ WebView *createWebViewAndOffscreenWindow() [WebView registerURLSchemeAsLocal:@"feedsearch"]; [webView setContinuousSpellCheckingEnabled:YES]; - [webView setDefersCallbacks:NO]; + [webView setAutomaticQuoteSubstitutionEnabled:NO]; + [webView setAutomaticLinkDetectionEnabled:NO]; + [webView setAutomaticDashSubstitutionEnabled:NO]; + [webView setAutomaticTextReplacementEnabled:NO]; + [webView setAutomaticSpellingCorrectionEnabled:YES]; [webView setGrammarCheckingEnabled:YES]; + + [webView setDefersCallbacks:NO]; [webView setInteractiveFormValidationEnabled:YES]; [webView setValidationMessageTimerMagnification:-1]; @@ -544,9 +570,11 @@ WebView *createWebViewAndOffscreenWindow() DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]; [window setColorSpace:[[NSScreen mainScreen] colorSpace]]; + [window setCollectionBehavior:NSWindowCollectionBehaviorStationary]; [[window contentView] addSubview:webView]; [window orderBack:nil]; [window setAutodisplay:NO]; + [window _setWindowResolution:1 displayIfChanged:YES]; [window startListeningForAcceleratedCompositingChanges]; @@ -587,6 +615,16 @@ static void resetDefaultsToConsistentValues() [defaults setBool:YES forKey:WebKitFullScreenEnabledPreferenceKey]; [defaults setBool:YES forKey:@"UseWebKitWebInspector"]; +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + [defaults setObject:[NSDictionary dictionaryWithObjectsAndKeys: + @"notational", @"notationl", + @"message", @"mesage", + @"would", @"wouldn", + @"welcome", @"wellcome", + @"hello\nworld", @"hellolfworld", + nil] forKey:@"NSTestCorrectionDictionary"]; +#endif + // Scrollbars are drawn either using AppKit (which uses NSUserDefaults) or using HIToolbox (which uses CFPreferences / kCFPreferencesAnyApplication / kCFPreferencesCurrentUser / kCFPreferencesAnyHost) [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"]; RetainPtr<CFTypeRef> initialValue = CFPreferencesCopyValue(CFSTR("AppleScrollBarVariant"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); @@ -598,7 +636,7 @@ static void resetDefaultsToConsistentValues() #endif -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 [defaults setBool:NO forKey:@"NSScrollAnimationEnabled"]; #else [defaults setBool:NO forKey:@"AppleScrollAnimationEnabled"]; @@ -675,6 +713,7 @@ static void resetDefaultsToConsistentValues() [preferences setUsePreHTML5ParserQuirks:NO]; [preferences setAsynchronousSpellCheckingEnabled:NO]; [preferences setMockScrollbarsEnabled:YES]; + [preferences setSeamlessIFramesEnabled:YES]; #if ENABLE(WEB_AUDIO) [preferences setWebAudioEnabled:YES]; @@ -736,28 +775,6 @@ static void testThreadIdentifierMap() createThread(runThread, 0, "DumpRenderTree: test"); } -static void crashHandler(int sig) -{ - char *signalName = strsignal(sig); - write(STDERR_FILENO, signalName, strlen(signalName)); - write(STDERR_FILENO, "\n", 1); - exit(128 + sig); -} - -static void installSignalHandlers() -{ - signal(SIGILL, crashHandler); /* 4: illegal instruction (not reset when caught) */ - signal(SIGTRAP, crashHandler); /* 5: trace trap (not reset when caught) */ - signal(SIGEMT, crashHandler); /* 7: EMT instruction */ - signal(SIGFPE, crashHandler); /* 8: floating point exception */ - signal(SIGBUS, crashHandler); /* 10: bus error */ - signal(SIGSEGV, crashHandler); /* 11: segmentation violation */ - signal(SIGSYS, crashHandler); /* 12: bad argument to system call */ - signal(SIGPIPE, crashHandler); /* 13: write on a pipe with no reader */ - signal(SIGXCPU, crashHandler); /* 24: exceeded CPU time limit */ - signal(SIGXFSZ, crashHandler); /* 25: exceeded file size limit */ -} - static void allocateGlobalControllers() { // FIXME: We should remove these and move to the ObjC standard [Foo sharedInstance] model @@ -769,6 +786,7 @@ static void allocateGlobalControllers() policyDelegate = [[PolicyDelegate alloc] init]; historyDelegate = [[HistoryDelegate alloc] init]; storageDelegate = [[StorageTrackerDelegate alloc] init]; + defaultPolicyDelegate = [[DefaultPolicyDelegate alloc] init]; } // ObjC++ doens't seem to let me pass NSObject*& sadly. @@ -855,6 +873,12 @@ static void prepareConsistentTestingEnvironment() allocateGlobalControllers(); makeLargeMallocFailSilently(); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + NSActivityOptions options = (NSActivityUserInitiatedAllowingIdleSystemSleep | NSActivityLatencyCritical) & ~(NSActivitySuddenTerminationDisabled | NSActivityAutomaticTerminationDisabled); + static id assertion = [[[NSProcessInfo processInfo] beginActivityWithOptions:options reason:@"DumpRenderTree should not be subject to process suppression"] retain]; + ASSERT_UNUSED(assertion, assertion); +#endif } void dumpRenderTree(int argc, const char *argv[]) @@ -862,12 +886,14 @@ void dumpRenderTree(int argc, const char *argv[]) initializeGlobalsFromCommandLineOptions(argc, argv); prepareConsistentTestingEnvironment(); addTestPluginsToPluginSearchPath(argv[0]); - if (dumpPixelsForCurrentTest) - installSignalHandlers(); if (forceComplexText) [WebView _setAlwaysUsesComplexTextCodePath:YES]; +#if USE(APPKIT) + [NSSound _setAlertType:0]; +#endif + WebView *webView = createWebViewAndOffscreenWindow(); mainFrame = [webView mainFrame]; @@ -887,7 +913,7 @@ void dumpRenderTree(int argc, const char *argv[]) printSeparators = YES; runTestingServerLoop(); } else { - printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); + printSeparators = optind < argc - 1; for (int i = optind; i != argc; ++i) runTest(argv[i]); } @@ -1095,9 +1121,9 @@ static void sizeWebViewForCurrentTest() // W3C SVG tests expect to be 480x360 bool isSVGW3CTest = (gTestRunner->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos); if (isSVGW3CTest) - [[mainFrame webView] setFrameSize:NSMakeSize(480, 360)]; + [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::w3cSVGViewWidth, TestRunner::w3cSVGViewHeight)]; else - [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::maxViewWidth, TestRunner::maxViewHeight)]; + [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::viewWidth, TestRunner::viewHeight)]; } static const char *methodNameStringForFailedTest() @@ -1261,7 +1287,7 @@ static void resetWebViewToConsistentStateBeforeTesting() [webView _scaleWebView:1.0 atOrigin:NSZeroPoint]; [webView _setCustomBackingScaleFactor:0]; [webView setTabKeyCyclesThroughElements:YES]; - [webView setPolicyDelegate:nil]; + [webView setPolicyDelegate:defaultPolicyDelegate]; [policyDelegate setPermissive:NO]; [policyDelegate setControllerToNotifyDone:0]; [frameLoadDelegate resetToConsistentState]; @@ -1270,7 +1296,6 @@ static void resetWebViewToConsistentStateBeforeTesting() [[webView undoManager] removeAllActions]; [WebView _removeAllUserContentFromGroup:[webView groupName]]; [[webView window] setAutodisplay:NO]; - [webView _setMinimumTimerInterval:[WebView _defaultMinimumTimerInterval]]; [webView setTracksRepaints:NO]; resetDefaultsToConsistentValues(); @@ -1281,7 +1306,13 @@ static void resetWebViewToConsistentStateBeforeTesting() gTestRunner->removeChromeInputField(); } - [[mainFrame webView] setSmartInsertDeleteEnabled:YES]; + [webView setContinuousSpellCheckingEnabled:YES]; + [webView setAutomaticQuoteSubstitutionEnabled:NO]; + [webView setAutomaticLinkDetectionEnabled:NO]; + [webView setAutomaticDashSubstitutionEnabled:NO]; + [webView setAutomaticTextReplacementEnabled:NO]; + [webView setAutomaticSpellingCorrectionEnabled:YES]; + [webView setGrammarCheckingEnabled:YES]; [WebView _setUsesTestModeFocusRingColor:YES]; [WebView _resetOriginAccessWhitelists]; diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h b/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h index e6898a9b9..6c7331171 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h +++ b/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h @@ -32,6 +32,7 @@ #include <CoreFoundation/CoreFoundation.h> #ifdef __OBJC__ +@class DefaultPolicyDelegate; @class DumpRenderTreeDraggingInfo; @class NavigationController; @class PolicyDelegate; @@ -40,6 +41,7 @@ @class WebScriptWorld; @class WebView; #else +class DefaultPolicyDelegate; class DumpRenderTreeDraggingInfo; class NavigationController; class PolicyDelegate; @@ -57,9 +59,7 @@ extern DumpRenderTreeDraggingInfo *draggingInfo; extern NavigationController* gNavigationController; extern PolicyDelegate* policyDelegate; extern StorageTrackerDelegate* storageDelegate; - -extern const unsigned maxViewHeight; -extern const unsigned maxViewWidth; +extern DefaultPolicyDelegate *defaultPolicyDelegate; void setWaitToDumpWatchdog(CFRunLoopTimerRef); bool shouldSetWaitToDumpWatchdog(); diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h index a229d20e6..3b1d77eb3 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h +++ b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h @@ -32,6 +32,12 @@ @class WebView; +@interface NSWindow (Details) + +- (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged; + +@end + @interface DumpRenderTreeWindow : NSWindow { } diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm index 17a114ba0..4a6fd6bbc 100644 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm +++ b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm @@ -120,4 +120,9 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = { [self setAutodisplay:YES]; } +- (CGFloat)backingScaleFactor +{ + return 1; +} + @end diff --git a/Tools/DumpRenderTree/mac/EventSendingController.mm b/Tools/DumpRenderTree/mac/EventSendingController.mm index 6f328a566..05bfd3679 100644 --- a/Tools/DumpRenderTree/mac/EventSendingController.mm +++ b/Tools/DumpRenderTree/mac/EventSendingController.mm @@ -586,7 +586,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) savedMouseEvents = nil; } -- (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)keyLocation +- (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location { NSString *eventCharacter = character; unsigned short keyCode = 0; @@ -738,7 +738,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) for (unsigned i = 0; i < WTF_ARRAY_LENGTH(table); ++i) { NSString* currentCharacterString = [NSString stringWithCharacters:&table[i].character length:1]; if ([character isEqualToString:currentCharacterString] || [character isEqualToString:table[i].characterName]) { - if (keyLocation == DOM_KEY_LOCATION_NUMPAD) + if (location == DOM_KEY_LOCATION_NUMPAD) keyCode = table[i].macNumpadKeyCode; else keyCode = table[i].macKeyCode; @@ -758,7 +758,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) modifierFlags |= buildModifierFlags(modifiers); - if (keyLocation == DOM_KEY_LOCATION_NUMPAD) + if (location == DOM_KEY_LOCATION_NUMPAD) modifierFlags |= NSNumericPadKeyMask; [[[mainFrame frameView] documentView] layout]; @@ -790,12 +790,12 @@ static int buildModifierFlags(const WebScriptObject* modifiers) [[[[mainFrame webView] window] firstResponder] keyUp:event]; } -- (void)keyDownWrapper:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)keyLocation +- (void)keyDownWrapper:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location { - [self keyDown:character withModifiers:modifiers withLocation:keyLocation]; + [self keyDown:character withModifiers:modifiers withLocation:location]; } -- (void)scheduleAsynchronousKeyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)keyLocation +- (void)scheduleAsynchronousKeyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(keyDownWrapper:withModifiers:withLocation:)]]; [invocation retainArguments]; @@ -803,7 +803,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) [invocation setSelector:@selector(keyDownWrapper:withModifiers:withLocation:)]; [invocation setArgument:&character atIndex:2]; [invocation setArgument:&modifiers atIndex:3]; - [invocation setArgument:&keyLocation atIndex:4]; + [invocation setArgument:&location atIndex:4]; [invocation performSelector:@selector(invoke) withObject:nil afterDelay:0]; } @@ -843,7 +843,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) if ([event isKindOfClass:[DOMKeyboardEvent class]]) { printf(" keyIdentifier: %s\n", [[(DOMKeyboardEvent*)event keyIdentifier] UTF8String]); - printf(" keyLocation: %d\n", [(DOMKeyboardEvent*)event keyLocation]); + printf(" keyLocation: %d\n", [(DOMKeyboardEvent*)event location]); printf(" modifier keys: c:%d s:%d a:%d m:%d\n", [(DOMKeyboardEvent*)event ctrlKey] ? 1 : 0, [(DOMKeyboardEvent*)event shiftKey] ? 1 : 0, @@ -920,7 +920,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) cancelable:YES view:[document defaultView] keyIdentifier:@"U+000041" - keyLocation:0 + location:0 ctrlKey:YES altKey:NO shiftKey:NO @@ -935,7 +935,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) cancelable:YES view:[document defaultView] keyIdentifier:@"U+000045" - keyLocation:1 + location:1 ctrlKey:NO altKey:YES shiftKey:NO @@ -950,7 +950,7 @@ static int buildModifierFlags(const WebScriptObject* modifiers) cancelable:YES view:[document defaultView] keyIdentifier:@"U+000056" - keyLocation:0 + location:0 ctrlKey:NO altKey:NO shiftKey:NO diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm index d80f6ba4e..adf5d9e31 100644 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm +++ b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm @@ -43,7 +43,7 @@ { if (!(self = [super init])) return nil; - _permissions.adoptNS([[NSMutableDictionary alloc] init]); + _permissions = adoptNS([[NSMutableDictionary alloc] init]); return self; } diff --git a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm index 0cf9c4a19..c2d43dabf 100644 --- a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm +++ b/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm @@ -53,7 +53,7 @@ static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t p return 0; // Creating this bitmap in the device color space prevents any color conversion when the image of the web view is drawn into it. - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB()); CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); // Use ARGB8 on PPC or BGRA8 on X86 to improve CG performance if (!context) { free(buffer); @@ -184,8 +184,8 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc PassRefPtr<BitmapContext> createPagedBitmapContext() { - int pageWidthInPixels = TestRunner::maxViewWidth; - int pageHeightInPixels = TestRunner::maxViewHeight; + int pageWidthInPixels = TestRunner::viewWidth; + int pageHeightInPixels = TestRunner::viewHeight; int numberOfPages = [mainFrame numberOfPagesWithPageWidth:pageWidthInPixels pageHeight:pageHeightInPixels]; size_t rowBytes = 0; void* buffer = 0; diff --git a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm index c5b26442c..5632aa285 100644 --- a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm +++ b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm @@ -121,7 +121,7 @@ using namespace std; { ASSERT([[dataSource webFrame] dataSource] || [[dataSource webFrame] provisionalDataSource]); - if (!done && gTestRunner->dumpResourceLoadCallbacks()) + if (!done) return [[request URL] _drt_descriptionSuitableForTestResult]; return @"<unknown>"; diff --git a/Tools/DumpRenderTree/mac/TestRunnerMac.mm b/Tools/DumpRenderTree/mac/TestRunnerMac.mm index 22f5c2898..a7d07de46 100644 --- a/Tools/DumpRenderTree/mac/TestRunnerMac.mm +++ b/Tools/DumpRenderTree/mac/TestRunnerMac.mm @@ -30,6 +30,7 @@ #import "DumpRenderTree.h" #import "TestRunner.h" +#import "DefaultPolicyDelegate.h" #import "EditingDelegate.h" #import "MockGeolocationProvider.h" #import "MockWebNotificationProvider.h" @@ -45,6 +46,7 @@ #import <WebCore/GeolocationPosition.h> #import <WebKit/DOMDocument.h> #import <WebKit/DOMElement.h> +#import <WebKit/DOMHTMLInputElementPrivate.h> #import <WebKit/WebApplicationCache.h> #import <WebKit/WebBackForwardList.h> #import <WebKit/WebCoreStatistics.h> @@ -73,7 +75,6 @@ #import <WebKit/WebTypesInternal.h> #import <WebKit/WebView.h> #import <WebKit/WebViewPrivate.h> -#import <WebKit/WebWorkersPrivate.h> #import <wtf/CurrentTime.h> #import <wtf/HashMap.h> #import <wtf/RetainPtr.h> @@ -119,7 +120,7 @@ TestRunner::~TestRunner() void TestRunner::addDisallowedURL(JSStringRef url) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); if (!disallowedURLs) disallowedURLs = CFSetCreateMutable(kCFAllocatorDefault, 0, NULL); @@ -143,7 +144,7 @@ void TestRunner::clearAllApplicationCaches() long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef url) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; long long usage = [WebApplicationCache diskUsageForOrigin:origin]; [origin release]; @@ -157,7 +158,7 @@ void TestRunner::syncLocalStorage() long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef url) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; long long usage = [[WebStorageManager sharedWebStorageManager] diskUsageForOrigin:origin]; [origin release]; @@ -171,7 +172,7 @@ void TestRunner::observeStorageTrackerNotifications(unsigned number) void TestRunner::clearApplicationCacheForOrigin(JSStringRef url) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; [WebApplicationCache deleteCacheForOrigin:origin]; @@ -212,6 +213,11 @@ void TestRunner::setStorageDatabaseIdleInterval(double interval) [WebStorageManager setStorageDatabaseIdleInterval:interval]; } +void TestRunner::closeIdleLocalStorageDatabases() +{ + [WebStorageManager closeIdleLocalStorageDatabases]; +} + JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) { return originsArrayToJS(context, [[WebStorageManager sharedWebStorageManager] origins]); @@ -219,7 +225,7 @@ JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, URL)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, URL)); WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; [[WebStorageManager sharedWebStorageManager] deleteOrigin:origin]; @@ -243,14 +249,14 @@ void TestRunner::clearBackForwardList() JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) { - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name)); + RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)); NSString *nameNS = (NSString *)nameCF.get(); return JSStringCreateWithCFString((CFStringRef)[nameNS _web_decodeHostName]); } JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) { - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name)); + RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)); NSString *nameNS = (NSString *)nameCF.get(); return JSStringCreateWithCFString((CFStringRef)[nameNS _web_encodeHostName]); } @@ -269,21 +275,6 @@ void TestRunner::keepWebHistory() } } -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - return [[mainFrame webView] _computedStyleIncludingVisitedInfo:context forElement:value]; -} - -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; - if (!element) - return JSRetainPtr<JSStringRef>(); - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithCFString((CFStringRef)[element _markerTextForListItem])); - return markerText; -} - int TestRunner::numberOfPendingGeolocationPermissionRequests() { return [[[mainFrame webView] UIDelegate] numberOfPendingGeolocationPermissionRequests]; @@ -294,11 +285,6 @@ size_t TestRunner::webHistoryItemCount() return [[[WebHistory optionalSharedHistory] allItems] count]; } -unsigned TestRunner::workerThreadCount() const -{ - return [WebWorkersPrivate workerThreadCount]; -} - JSRetainPtr<JSStringRef> TestRunner::platformName() const { JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("mac")); @@ -378,7 +364,7 @@ JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef lo void TestRunner::queueLoad(JSStringRef url, JSStringRef target) { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); NSString *urlNS = (NSString *)urlCF.get(); NSURL *nsurl = [NSURL URLWithString:urlNS relativeToURL:[[[mainFrame dataSource] response] URL]]; @@ -420,22 +406,15 @@ void TestRunner::setAuthorAndUserStylesEnabled(bool flag) [[[mainFrame webView] preferences] setAuthorAndUserStylesEnabled:flag]; } -void TestRunner::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) +void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) { - DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; - if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]]) + if (!setDelegate) { + [[mainFrame webView] setPolicyDelegate:defaultPolicyDelegate]; return; + } - [(DOMHTMLInputElement *)element _setAutofilled:autofilled]; -} - -void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - if (setDelegate) { - [policyDelegate setPermissive:permissive]; - [[mainFrame webView] setPolicyDelegate:policyDelegate]; - } else - [[mainFrame webView] setPolicyDelegate:nil]; + [policyDelegate setPermissive:permissive]; + [[mainFrame webView] setPolicyDelegate:policyDelegate]; } void TestRunner::setDatabaseQuota(unsigned long long quota) @@ -457,7 +436,7 @@ void TestRunner::setDefersLoading(bool defers) void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) { - RetainPtr<CFStringRef> schemeCFString(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, scheme)); + RetainPtr<CFStringRef> schemeCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, scheme)); [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()]; } @@ -487,7 +466,7 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) { - RetainPtr<CFStringRef> messageCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, message)); + RetainPtr<CFStringRef> messageCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, message)); NSString *messageNS = (NSString *)messageCF.get(); [[MockGeolocationProvider shared] setPositionUnavailableErrorWithMessage:messageNS]; } @@ -548,11 +527,6 @@ void TestRunner::setXSSAuditorEnabled(bool enabled) [[[mainFrame webView] preferences] setXSSAuditorEnabled:enabled]; } -void TestRunner::setFrameFlatteningEnabled(bool enabled) -{ - [[[mainFrame webView] preferences] setFrameFlatteningEnabled:enabled]; -} - void TestRunner::setSpatialNavigationEnabled(bool enabled) { [[[mainFrame webView] preferences] setSpatialNavigationEnabled:enabled]; @@ -605,7 +579,7 @@ void TestRunner::setUserStyleSheetEnabled(bool flag) void TestRunner::setUserStyleSheetLocation(JSStringRef path) { - RetainPtr<CFStringRef> pathCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, path)); + RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path)); NSURL *url = [NSURL URLWithString:(NSString *)pathCF.get()]; [[WebPreferences standardPreferences] setUserStyleSheetLocation:url]; } @@ -616,8 +590,8 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JS if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]]) return; - RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value)); - [(DOMHTMLInputElement *)element _setValueForUser:(NSString *)valueCF.get()]; + RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); + [(DOMHTMLInputElement *)element setValueForUser:(NSString *)valueCF.get()]; } void TestRunner::setViewModeMediaFeature(JSStringRef mode) @@ -625,11 +599,6 @@ void TestRunner::setViewModeMediaFeature(JSStringRef mode) // FIXME: implement } -void TestRunner::disableImageLoading() -{ - [[WebPreferences standardPreferences] setLoadsImagesAutomatically:NO]; -} - void TestRunner::dispatchPendingLoadRequests() { [[mainFrame webView] _dispatchPendingLoadRequests]; @@ -637,10 +606,10 @@ void TestRunner::dispatchPendingLoadRequests() void TestRunner::overridePreference(JSStringRef key, JSStringRef value) { - RetainPtr<CFStringRef> keyCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, key)); + RetainPtr<CFStringRef> keyCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, key)); NSString *keyNS = (NSString *)keyCF.get(); - RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value)); + RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); NSString *valueNS = (NSString *)valueCF.get(); [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS]; @@ -653,7 +622,7 @@ void TestRunner::removeAllVisitedLinks() void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) { - RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); + RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); ::setPersistentUserStyleSheetLocation(urlString.get()); } @@ -668,16 +637,6 @@ void TestRunner::setWindowIsKey(bool windowIsKey) [[mainFrame webView] _updateActiveState]; } -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - [[mainFrame webView] setSmartInsertDeleteEnabled:flag]; -} - -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - [[mainFrame webView] setSelectTrailingWhitespaceEnabled:flag]; -} - static const CFTimeInterval waitToDumpWatchdogInterval = 30.0; static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info) @@ -697,26 +656,12 @@ int TestRunner::windowCount() return CFArrayGetCount(openWindowsRef); } -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef jsString) -{ - RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsString)); - NSString *idNS = (NSString *)idCF.get(); - - DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS]; - id rep = [[mainFrame dataSource] representation]; - - if ([rep class] == [WebHTMLRepresentation class]) - return [(WebHTMLRepresentation *)rep elementDoesAutoComplete:element]; - - return false; -} - void TestRunner::execCommand(JSStringRef name, JSStringRef value) { - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name)); + RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)); NSString *nameNS = (NSString *)nameCF.get(); - RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value)); + RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); NSString *valueNS = (NSString *)valueCF.get(); [[mainFrame webView] _executeCoreCommandByName:nameNS value:valueNS]; @@ -731,7 +676,7 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe if (!JSValueIsNumber(context, lengthValue)) return false; - RetainPtr<CFStringRef> targetCFString(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, target)); + RetainPtr<CFStringRef> targetCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, target)); size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); for (size_t i = 0; i < length; ++i) { @@ -765,7 +710,7 @@ void TestRunner::setCacheModel(int cacheModel) bool TestRunner::isCommandEnabled(JSStringRef name) { - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name)); + RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)); NSString *nameNS = (NSString *)nameCF.get(); // Accept command strings with capital letters for first letter without trailing colon. @@ -776,7 +721,7 @@ bool TestRunner::isCommandEnabled(JSStringRef name) } SEL selector = NSSelectorFromString(nameNS); - RetainPtr<CommandValidationTarget> target(AdoptNS, [[CommandValidationTarget alloc] initWithAction:selector]); + RetainPtr<CommandValidationTarget> target = adoptNS([[CommandValidationTarget alloc] initWithAction:selector]); id validator = [NSApp targetForAction:selector to:[mainFrame webView] from:target.get()]; if (!validator) return false; @@ -787,31 +732,6 @@ bool TestRunner::isCommandEnabled(JSStringRef name) return [validator validateUserInterfaceItem:target.get()]; } -bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId)); - NSString *idNS = (NSString *)idCF.get(); - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, animationName)); - NSString *nameNS = (NSString *)nameCF.get(); - - return [mainFrame _pauseAnimation:nameNS onNode:[[mainFrame DOMDocument] getElementById:idNS] atTime:time]; -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId)); - NSString *idNS = (NSString *)idCF.get(); - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, propertyName)); - NSString *nameNS = (NSString *)nameCF.get(); - - return [mainFrame _pauseTransitionOfProperty:nameNS onNode:[[mainFrame DOMDocument] getElementById:idNS] atTime:time]; -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - return [mainFrame _numberOfActiveAnimations]; -} - void TestRunner::waitForPolicyDelegate() { setWaitToDump(true); @@ -821,22 +741,22 @@ void TestRunner::waitForPolicyDelegate() void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { - RetainPtr<CFStringRef> sourceOriginCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin)); + RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin)); NSString *sourceOriginNS = (NSString *)sourceOriginCF.get(); - RetainPtr<CFStringRef> protocolCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); + RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); NSString *destinationProtocolNS = (NSString *)protocolCF.get(); - RetainPtr<CFStringRef> hostCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationHost)); + RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost)); NSString *destinationHostNS = (NSString *)hostCF.get(); [WebView _addOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains]; } void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { - RetainPtr<CFStringRef> sourceOriginCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin)); + RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin)); NSString *sourceOriginNS = (NSString *)sourceOriginCF.get(); - RetainPtr<CFStringRef> protocolCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); + RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); NSString *destinationProtocolNS = (NSString *)protocolCF.get(); - RetainPtr<CFStringRef> hostCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationHost)); + RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost)); NSString *destinationHostNS = (NSString *)hostCF.get(); [WebView _removeOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains]; } @@ -848,14 +768,14 @@ void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) { - RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source)); + RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source)); NSString *sourceNS = (NSString *)sourceCF.get(); [WebView _addUserScriptToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectionTime:(runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd) injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)]; } void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) { - RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source)); + RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source)); NSString *sourceNS = (NSString *)sourceCF.get(); [WebView _addUserStyleSheetToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)]; } @@ -865,11 +785,6 @@ void TestRunner::setDeveloperExtrasEnabled(bool enabled) [[[mainFrame webView] preferences] setDeveloperExtrasEnabled:enabled]; } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool enabled) -{ - [[[mainFrame webView] preferences] setAsynchronousSpellCheckingEnabled:enabled]; -} - void TestRunner::showWebInspector() { [[[mainFrame webView] inspector] show:nil]; @@ -882,7 +797,7 @@ void TestRunner::closeWebInspector() void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) { - RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script)); + RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script)); NSString *scriptNS = (NSString *)scriptCF.get(); [[[mainFrame webView] inspector] evaluateInFrontend:nil callId:callId script:scriptNS]; } @@ -912,7 +827,7 @@ void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, J void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) { - RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script)); + RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script)); NSString *scriptNS = (NSString *)scriptCF.get(); // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world @@ -923,7 +838,7 @@ void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef glo else { RetainPtr<WebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value; if (!worldSlot) - worldSlot.adoptNS([[WebScriptWorld alloc] init]); + worldSlot = adoptNS([[WebScriptWorld alloc] init]); world = worldSlot.get(); } @@ -971,8 +886,8 @@ void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringR { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - RetainPtr<CFStringRef> utf8DataCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, utf8Data)); - RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, baseURL)); + RetainPtr<CFStringRef> utf8DataCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, utf8Data)); + RetainPtr<CFStringRef> baseURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, baseURL)); WebView *webView = [[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""]; @@ -1008,7 +923,7 @@ void TestRunner::setWebViewEditable(bool editable) static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoaderRunLoopMode"; -#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 @protocol NSURLConnectionDelegate <NSObject> @end #endif @@ -1039,7 +954,7 @@ static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoade - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge previousFailureCount] == 0) { - RetainPtr<NSURLCredential> credential(AdoptNS, [[NSURLCredential alloc] initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]); + RetainPtr<NSURLCredential> credential = adoptNS([[NSURLCredential alloc] initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]); [[challenge sender] useCredential:credential.get() forAuthenticationChallenge:challenge]; return; } @@ -1084,15 +999,13 @@ static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoade void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) { // See <rdar://problem/7880699>. -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - RetainPtr<CFStringRef> urlStringCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url)); - RetainPtr<CFStringRef> usernameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, username)); - RetainPtr<CFStringRef> passwordCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, password)); + RetainPtr<CFStringRef> urlStringCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); + RetainPtr<CFStringRef> usernameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, username)); + RetainPtr<CFStringRef> passwordCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, password)); - RetainPtr<NSURLRequest> request(AdoptNS, [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]); + RetainPtr<NSURLRequest> request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]); [SynchronousLoader makeRequest:request.get() withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()]; -#endif } void TestRunner::abortModal() @@ -1105,21 +1018,14 @@ void TestRunner::setSerializeHTTPLoads(bool serialize) [WebView _setLoadResourcesSerially:serialize]; } -void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) -{ - [[mainFrame webView] _setMinimumTimerInterval:minimumTimerInterval]; -} - void TestRunner::setTextDirection(JSStringRef directionName) { -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (JSStringIsEqualToUTF8CString(directionName, "ltr")) [[mainFrame webView] makeBaseWritingDirectionLeftToRight:0]; else if (JSStringIsEqualToUTF8CString(directionName, "rtl")) [[mainFrame webView] makeBaseWritingDirectionRightToLeft:0]; else ASSERT_NOT_REACHED(); -#endif } void TestRunner::addChromeInputField() @@ -1175,26 +1081,16 @@ void TestRunner::setPageVisibility(const char* newVisibility) [webView _setVisibilityState:WebPageVisibilityStateUnloaded isInitialState:NO]; } -void TestRunner::sendWebIntentResponse(JSStringRef) -{ - // FIXME: Implement. -} - -void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) -{ - // FIXME: Implement. -} - void TestRunner::grantWebNotificationPermission(JSStringRef jsOrigin) { - RetainPtr<CFStringRef> cfOrigin(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsOrigin)); + RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin)); ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]); [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:TRUE]; } void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) { - RetainPtr<CFStringRef> cfOrigin(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsOrigin)); + RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin)); ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]); [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:FALSE]; } diff --git a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm b/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm index 9f94ecbc4..e06e79750 100644 --- a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm +++ b/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm @@ -52,7 +52,7 @@ void CFURLResponseSetMIMEType(CFURLResponseRef response, CFStringRef mimeType); CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData) { // Decode NSURLResponse - RetainPtr<NSKeyedUnarchiver> unarchiver(AdoptNS, [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]); + RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]); NSURLResponse *response = [unarchiver.get() decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m [unarchiver.get() finishDecoding]; @@ -62,7 +62,7 @@ CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData) NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; // NSURLResponse is not toll-free bridged to CFURLResponse. - RetainPtr<CFHTTPMessageRef> httpMessage(AdoptCF, CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1)); + RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1)); NSDictionary *headerFields = [httpResponse allHeaderFields]; for (NSString *headerField in [headerFields keyEnumerator]) diff --git a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm b/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm index c28e991e2..f0b6c33dc 100644 --- a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm +++ b/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm @@ -40,9 +40,9 @@ bool LoadItem::invoke() const { - RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_url.get())); + RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_url.get())); NSString *urlNS = (NSString *)urlCF.get(); - RetainPtr<CFStringRef> targetCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_target.get())); + RetainPtr<CFStringRef> targetCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_target.get())); NSString *targetNS = (NSString *)targetCF.get(); WebFrame *targetFrame; @@ -56,11 +56,11 @@ bool LoadItem::invoke() const bool LoadHTMLStringItem::invoke() const { - RetainPtr<CFStringRef> contentCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_content.get())); - RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get())); + RetainPtr<CFStringRef> contentCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_content.get())); + RetainPtr<CFStringRef> baseURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get())); if (m_unreachableURL) { - RetainPtr<CFStringRef> unreachableURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_unreachableURL.get())); + RetainPtr<CFStringRef> unreachableURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_unreachableURL.get())); [mainFrame loadAlternateHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()] forUnreachableURL:[NSURL URLWithString:(NSString *)unreachableURLCF.get()]]; return true; } @@ -77,7 +77,7 @@ bool ReloadItem::invoke() const bool ScriptItem::invoke() const { - RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_script.get())); + RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_script.get())); NSString *scriptNS = (NSString *)scriptCF.get(); [[mainFrame webView] stringByEvaluatingJavaScriptFromString:scriptNS]; return true; diff --git a/Tools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp b/Tools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp deleted file mode 100644 index 1266c020e..000000000 --- a/Tools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. - * (C) 2007 Graham Dennis (graham.dennis@gmail.com) - * (C) 2007 Eric Seidel <eric@webkit.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JavaScriptThreading.h" - -#include <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <pthread.h> -#include <wtf/Assertions.h> -#include <wtf/HashSet.h> - -static JSContextGroupRef javaScriptThreadsGroup; - -static pthread_mutex_t javaScriptThreadsMutex = PTHREAD_MUTEX_INITIALIZER; -static bool javaScriptThreadsShouldTerminate; - -static const int javaScriptThreadsCount = 4; - -typedef HashSet<pthread_t> ThreadSet; - -static ThreadSet* javaScriptThreads() -{ - ASSERT(pthread_mutex_trylock(&javaScriptThreadsMutex) == EBUSY); - static ThreadSet staticJavaScriptThreads; - return &staticJavaScriptThreads; -} - -// This function exercises JSC in a loop until javaScriptThreadsShouldTerminate -// becomes true or it probabilistically decides to spawn a replacement thread and exit. -void* runJavaScriptThread(void* arg) -{ - static const char* const script = - "var array = [];" - "for (var i = 0; i < 1024; i++) {" - " array.push(String(i));" - "}"; - - pthread_mutex_lock(&javaScriptThreadsMutex); - JSGlobalContextRef ctx = JSGlobalContextCreateInGroup(javaScriptThreadsGroup, 0); - pthread_mutex_unlock(&javaScriptThreadsMutex); - - pthread_mutex_lock(&javaScriptThreadsMutex); - JSStringRef scriptRef = JSStringCreateWithUTF8CString(script); - pthread_mutex_unlock(&javaScriptThreadsMutex); - - while (1) { - pthread_mutex_lock(&javaScriptThreadsMutex); - JSValueRef exception = 0; - JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); - ASSERT(!exception); - pthread_mutex_unlock(&javaScriptThreadsMutex); - - pthread_mutex_lock(&javaScriptThreadsMutex); - size_t valuesCount = 1024; - JSValueRef values[valuesCount]; - for (size_t i = 0; i < valuesCount; ++i) - values[i] = JSObjectMake(ctx, 0, 0); - pthread_mutex_unlock(&javaScriptThreadsMutex); - - // Check for cancellation. - if (javaScriptThreadsShouldTerminate) - goto done; - - // Respawn probabilistically. - if (random() % 5 == 0) { - pthread_mutex_lock(&javaScriptThreadsMutex); - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - javaScriptThreads()->add(pthread); - pthread_mutex_unlock(&javaScriptThreadsMutex); - goto done; - } - } - -done: - pthread_mutex_lock(&javaScriptThreadsMutex); - JSStringRelease(scriptRef); - JSGarbageCollect(ctx); - JSGlobalContextRelease(ctx); - javaScriptThreads()->remove(pthread_self()); - pthread_mutex_unlock(&javaScriptThreadsMutex); - return 0; -} - -void startJavaScriptThreads() -{ - javaScriptThreadsGroup = JSContextGroupCreate(); - - pthread_mutex_lock(&javaScriptThreadsMutex); - - for (int i = 0; i < javaScriptThreadsCount; i++) { - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - javaScriptThreads()->add(pthread); - } - - pthread_mutex_unlock(&javaScriptThreadsMutex); -} - -void stopJavaScriptThreads() -{ - pthread_mutex_lock(&javaScriptThreadsMutex); - - javaScriptThreadsShouldTerminate = true; - - pthread_mutex_unlock(&javaScriptThreadsMutex); - - while (true) { - pthread_mutex_lock(&javaScriptThreadsMutex); - int threadCount = javaScriptThreads()->size(); - pthread_mutex_unlock(&javaScriptThreadsMutex); - - if (!threadCount) - break; - - usleep(1000); - } -} diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro index 2671ab664..2d6cfca22 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro @@ -26,17 +26,20 @@ macx: QT += xml HEADERS += \ $$PWD/../WorkQueue.h \ $$PWD/../DumpRenderTree.h \ + $$PWD/../GCController.h \ + $$PWD/../TestRunner.h \ DumpRenderTreeQt.h \ EventSenderQt.h \ TextInputControllerQt.h \ WorkQueueItemQt.h \ TestRunnerQt.h \ - GCControllerQt.h \ testplugin.h SOURCES += \ $$PWD/../WorkQueue.cpp \ $$PWD/../DumpRenderTreeCommon.cpp \ + $$PWD/../GCController.cpp \ + $$PWD/../TestRunner.cpp \ DumpRenderTreeQt.cpp \ EventSenderQt.cpp \ TextInputControllerQt.cpp \ diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp index 5026d3ca4..264947497 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp @@ -40,10 +40,6 @@ #include <qurl.h> #include <qwebdatabase.h> - -#include <wtf/AlwaysInline.h> -#include <wtf/ExportMacros.h> - #ifdef Q_WS_X11 #include <qx11info_x11.h> #endif @@ -136,7 +132,7 @@ int main(int argc, char* argv[]) // Remove the first arguments, it is application name itself args.removeAt(0); - WebCore::DumpRenderTree dumper; + DumpRenderTree dumper; int index = args.indexOf(QLatin1String("--stdout")); if (index != -1) { diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index dea0edbc0..c0c285353 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -35,10 +35,12 @@ #include "DumpRenderTreeQt.h" #include "DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" -#include "GCControllerQt.h" +#include "GCController.h" #include "InitWebCoreQt.h" #include "InitWebKitQt.h" +#include "JSStringRefQt.h" #include "QtTestSupport.h" +#include "TestRunner.h" #include "TestRunnerQt.h" #include "TextInputControllerQt.h" #include "testplugin.h" @@ -72,7 +74,7 @@ #include <unistd.h> #endif -namespace WebCore { +using namespace WebCore; const int databaseDefaultQuota = 5 * 1024 * 1024; @@ -192,10 +194,7 @@ void WebPage::resetSettings() m_drt->testRunner()->setCaretBrowsingEnabled(false); m_drt->testRunner()->setAuthorAndUserStylesEnabled(true); - m_drt->testRunner()->setFrameFlatteningEnabled(false); - m_drt->testRunner()->setSmartInsertDeleteEnabled(true); - m_drt->testRunner()->setSelectTrailingWhitespaceEnabled(false); - m_drt->testRunner()->setDefersLoading(false); + m_drt->jscTestRunner()->setDefersLoading(false); // globalSettings must be reset explicitly. m_drt->testRunner()->setXSSAuditorEnabled(false); @@ -203,7 +202,7 @@ void WebPage::resetSettings() QWebSettings::setMaximumPagesInCache(0); // reset to default settings()->setUserStyleSheetUrl(QUrl()); // reset to default - DumpRenderTreeSupportQt::setMinimumTimerInterval(handle(), DumpRenderTreeSupportQt::defaultMinimumTimerInterval()); + DumpRenderTreeSupportQt::setSeamlessIFramesEnabled(true); DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()->handle()); @@ -384,6 +383,8 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) scene()->addItem(m_item); } +static DumpRenderTree *s_instance = 0; + DumpRenderTree::DumpRenderTree() : m_dumpPixelsForAllTests(false) , m_stdin(0) @@ -392,6 +393,9 @@ DumpRenderTree::DumpRenderTree() , m_graphicsBased(false) , m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP"))) { + ASSERT(!s_instance); + s_instance = this; + QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE"); if (viewMode == "graphics") setGraphicsBased(true); @@ -423,7 +427,7 @@ DumpRenderTree::DumpRenderTree() DumpRenderTreeSupportQt::webPageSetGroupName(pageAdapter(), "org.webkit.qt.DumpRenderTree"); m_mainView->setContextMenuPolicy(Qt::NoContextMenu); - m_mainView->resize(QSize(TestRunner::maxViewWidth, TestRunner::maxViewHeight)); + m_mainView->resize(QSize(TestRunner::viewWidth, TestRunner::viewHeight)); // clean up cache by resetting quota. qint64 quota = webPage()->settings()->offlineWebApplicationCacheQuota(); @@ -431,7 +435,7 @@ DumpRenderTree::DumpRenderTree() // create our controllers. This has to be done before connectFrame, // as it exports there to the JavaScript DOM window. - m_controller = new TestRunner(this); + m_controller = new TestRunnerQt(this); connect(m_controller, SIGNAL(showPage()), this, SLOT(showPage())); connect(m_controller, SIGNAL(hidePage()), this, SLOT(hidePage())); @@ -441,7 +445,7 @@ DumpRenderTree::DumpRenderTree() connect(m_controller, SIGNAL(done()), this, SLOT(dump())); m_eventSender = new EventSender(m_page); m_textInputController = new TextInputController(m_page); - m_gcController = new GCController(m_page); + m_gcController.reset(new GCController()); // now connect our different signals connect(m_page, SIGNAL(frameCreated(QWebFrame *)), @@ -484,6 +488,12 @@ DumpRenderTree::~DumpRenderTree() fclose(stderr); delete m_mainView; delete m_stdin; + s_instance = 0; +} + +DumpRenderTree* DumpRenderTree::instance() +{ + return s_instance; } static void clearHistory(QWebPage* page) @@ -525,6 +535,8 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) // of the DRT. m_controller->reset(); + m_jscController = TestRunner::create(url.toString().toStdString(), m_expectedHash.toStdString()); + // reset mouse clicks counter m_eventSender->resetClickCount(); @@ -606,15 +618,15 @@ void DumpRenderTree::open(const QUrl& url) testRunner()->showWebInspector(); if (isDumpAsTextTest(url)) - testRunner()->dumpAsText(); + m_jscController->setDumpAsText(true); if (isGlobalHistoryTest(url)) testRunner()->dumpHistoryCallbacks(); // W3C SVG tests expect to be 480x360 bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1"); - int width = isW3CTest ? 480 : TestRunner::maxViewWidth; - int height = isW3CTest ? 360 : TestRunner::maxViewHeight; + int width = isW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth; + int height = isW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight; m_mainView->resize(QSize(width, height)); m_page->setPreferredContentsSize(QSize()); m_page->setViewportSize(QSize(width, height)); @@ -720,6 +732,8 @@ void DumpRenderTree::processLine(const QString &input) open(QUrl::fromLocalFile(fi.absoluteFilePath())); } + if (command.timeout > 0) + setTimeout(command.timeout); fflush(stdout); } @@ -734,10 +748,51 @@ void DumpRenderTree::initJSObjects() { QWebFrame *frame = qobject_cast<QWebFrame*>(sender()); Q_ASSERT(frame); + + JSContextRef context = 0; + JSObjectRef window = 0; + + DumpRenderTreeSupportQt::getJSWindowObject(frame->handle(), &context, &window); + frame->addToJavaScriptWindowObject(QLatin1String("testRunner"), m_controller); frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); - frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController); + m_gcController->makeWindowObject(context, window, 0); + + if (m_jscController) { + JSObjectRef dummyWindow = JSObjectMake(context, 0, 0); + m_jscController->makeWindowObject(context, dummyWindow, 0); + JSRetainPtr<JSStringRef> testRunnerName(Adopt, JSStringCreateWithUTF8CString("testRunner")); + JSValueRef wrappedTestRunner = JSObjectGetProperty(context, dummyWindow, testRunnerName.get(), 0); + JSRetainPtr<JSStringRef> helperScript(Adopt, JSStringCreateWithUTF8CString("(function() {\n" + " function bind(fun, thisArg) {\n" + " return function() {\n" + " return fun.apply(thisArg, Array.prototype.slice.call(arguments));\n" + " }\n" + " }\n" + "for (var prop in this.jscBasedTestRunner) {\n" + " var pd = Object.getOwnPropertyDescriptor(this.qtBasedTestRunner, prop);\n" + " if (pd !== undefined) continue;\n" + " pd = Object.getOwnPropertyDescriptor(this.jscBasedTestRunner, prop);\n" + " this.qtBasedTestRunner[prop] = bind(this.jscBasedTestRunner[prop], this.jscBasedTestRunner);\n" + "}\n" + "}).apply(this)\n")); + + JSRetainPtr<JSStringRef> qtBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("qtBasedTestRunner")); + JSRetainPtr<JSStringRef> jscBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("jscBasedTestRunner")); + + JSObjectRef args = JSObjectMake(context, 0, 0); + JSObjectSetProperty(context, args, qtBasedTestRunnerName.get(), JSObjectGetProperty(context, window, testRunnerName.get(), 0), 0, 0); + JSObjectSetProperty(context, args, jscBasedTestRunnerName.get(), wrappedTestRunner, 0, 0); + + JSValueRef ex = 0; + JSEvaluateScript(context, helperScript.get(), args, 0, 0, &ex); + if (ex) { + JSRetainPtr<JSStringRef> msg(Adopt, JSValueToStringCopy(context, ex, 0)); + fprintf(stderr, "Error evaluating TestRunner setup-script: %s\n", qPrintable(JSStringCopyQString(msg.get()))); + } + } + DumpRenderTreeSupportQt::injectInternalsObject(frame->handle()); } @@ -768,7 +823,7 @@ QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) result.append(QString("scrolled to %1,%2\n").arg(pos.x()).arg(pos.y())); } - if (m_controller->shouldDumpChildFrameScrollPositions()) { + if (m_jscController->dumpChildFrameScrollPositions()) { QList<QWebFrame*> children = frame->childFrames(); for (int i = 0; i < children.size(); ++i) result += dumpFrameScrollPosition(children.at(i)); @@ -793,7 +848,7 @@ QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame) result.append(innerText); result.append(QLatin1String("\n")); - if (m_controller->shouldDumpChildrenAsText()) { + if (m_jscController->dumpChildFramesAsText()) { QList<QWebFrame *> children = frame->childFrames(); for (int i = 0; i < children.size(); ++i) result += dumpFramesAsText(children.at(i)); @@ -880,7 +935,7 @@ QString DumpRenderTree::dumpBackForwardList(QWebPage* page) static const char *methodNameStringForFailedTest(TestRunner *controller) { const char *errorMessage; - if (controller->shouldDumpAsText()) + if (controller->dumpAsText()) errorMessage = "[documentElement innerText]"; // FIXME: Add when we have support //else if (controller->dumpDOMAsWebArchive()) @@ -908,38 +963,46 @@ void DumpRenderTree::dump() QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame->handle()); if (mimeType == "text/plain") - m_controller->dumpAsText(); + m_jscController->setDumpAsText(true); // Dump render text... QString resultString; - if (m_controller->shouldDumpAsText()) + QString resultContentType = "text/plain"; + QByteArray resultData; + if (m_controller->shouldDumpAsAudio()) { + resultContentType = "audio/wav"; + resultData = m_controller->audioData(); + } else if (m_jscController->dumpAsText()) resultString = dumpFramesAsText(mainFrame); else { resultString = DumpRenderTreeSupportQt::frameRenderTreeDump(mainFrame->handle()); resultString += dumpFrameScrollPosition(mainFrame); } if (!resultString.isEmpty()) { - fprintf(stdout, "Content-Type: text/plain\n"); + fprintf(stdout, "Content-Type: %s\n", resultContentType.toUtf8().constData()); fprintf(stdout, "%s", resultString.toUtf8().constData()); - if (m_controller->shouldDumpBackForwardList()) { + if (m_jscController->dumpBackForwardList()) { fprintf(stdout, "%s", dumpBackForwardList(webPage()).toUtf8().constData()); foreach (QObject* widget, windows) { QWebPage* page = qobject_cast<QWebPage*>(widget->findChild<QWebPage*>()); fprintf(stdout, "%s", dumpBackForwardList(page).toUtf8().constData()); } } - + } else if (!resultData.isEmpty()) { + fprintf(stdout, "Content-Type: %s\n", resultContentType.toUtf8().constData()); + fprintf(stdout, "Content-Transfer-Encoding: base64\n"); + fprintf(stdout, "%s", resultData.toBase64().constData()); } else - printf("ERROR: nil result from %s", methodNameStringForFailedTest(m_controller)); + printf("ERROR: nil result from %s", methodNameStringForFailedTest(m_jscController.get())); // signal end of text block fputs("#EOF\n", stdout); fputs("#EOF\n", stderr); - if (m_dumpPixelsForCurrentTest && m_controller->shouldDumpPixels()) { + if (m_dumpPixelsForCurrentTest && m_jscController->generatePixelResults()) { QImage image; - if (!m_controller->isPrinting()) { + if (!m_jscController->isPrinting()) { image = QImage(m_page->viewportSize(), QImage::Format_ARGB32); image.fill(Qt::white); QPainter painter(&image); @@ -1020,7 +1083,7 @@ void DumpRenderTree::dump() void DumpRenderTree::titleChanged(const QString &s) { - if (m_controller->shouldDumpTitleChanges()) + if (m_jscController->dumpTitleChanges()) printf("TITLE CHANGED: '%s'\n", s.toUtf8().data()); } @@ -1033,7 +1096,7 @@ void DumpRenderTree::connectFrame(QWebFrame *frame) void DumpRenderTree::dumpDatabaseQuota(QWebFrame* frame, const QString& dbName) { - if (!m_controller->shouldDumpDatabaseCallbacks()) + if (!m_jscController->dumpDatabaseCallbacks()) return; QWebSecurityOrigin origin = frame->securityOrigin(); printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", @@ -1046,7 +1109,7 @@ void DumpRenderTree::dumpDatabaseQuota(QWebFrame* frame, const QString& dbName) void DumpRenderTree::dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) { - if (m_controller->shouldDumpApplicationCacheDelegateCallbacks()) { + if (m_jscController->dumpApplicationCacheDelegateCallbacks()) { // For example, numbers from 30000 - 39999 will output as 30000. // Rounding up or down not really matter for these tests. It's // sufficient to just get a range of 10000 to determine if we were @@ -1060,7 +1123,7 @@ void DumpRenderTree::dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint ); } - if (m_controller->shouldDisallowIncreaseForApplicationCacheQuota()) + if (m_jscController->disallowIncreaseForApplicationCacheQuota()) return; origin->setApplicationCacheQuota(defaultOriginQuota); @@ -1068,7 +1131,7 @@ void DumpRenderTree::dumpApplicationCacheQuota(QWebSecurityOrigin* origin, quint void DumpRenderTree::statusBarMessage(const QString& message) { - if (!m_controller->shouldDumpStatusCallbacks()) + if (!m_jscController->dumpStatusCallbacks()) return; printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", message.toUtf8().constData()); @@ -1076,7 +1139,7 @@ void DumpRenderTree::statusBarMessage(const QString& message) QWebPage *DumpRenderTree::createWindow() { - if (!m_controller->canOpenWindows()) + if (!m_jscController->canOpenWindows()) return 0; // Create a dummy container object to track the page in DRT. @@ -1163,5 +1226,3 @@ void DumpRenderTree::setShouldTimeout(bool flag) { m_controller->setShouldTimeout(flag); } - -} diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index 7a6f76fb0..be1559d33 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -41,12 +41,14 @@ #endif #include "DumpRenderTreeSupportQt.h" +#include "TestRunner.h" #include <qgraphicsview.h> #include <qgraphicswebview.h> #include <qwebframe.h> #include <qwebinspector.h> #include <qwebpage.h> #include <qwebview.h> +#include <wtf/RefPtr.h> QT_BEGIN_NAMESPACE class QUrl; @@ -56,14 +58,12 @@ QT_END_NAMESPACE class QWebFrameAdapter; class QWebPageAdapter; -class TestRunner; +class TestRunnerQt; class DumpRenderTreeSupportQt; class EventSender; class TextInputController; class GCController; -namespace WebCore { - class WebPage; class NetworkAccessManager; @@ -74,6 +74,8 @@ public: DumpRenderTree(); virtual ~DumpRenderTree(); + static DumpRenderTree* instance(); + // Initialize in single-file mode. void open(const QUrl& url); @@ -86,7 +88,8 @@ public: void closeRemainingWindows(); void resetToConsistentStateBeforeTesting(const QUrl&); - TestRunner *testRunner() const { return m_controller; } + TestRunnerQt *testRunner() const { return m_controller; } + TestRunner *jscTestRunner() const { return m_jscController.get(); } EventSender *eventSender() const { return m_eventSender; } TextInputController *textInputController() const { return m_textInputController; } QString persistentStoragePath() const { return m_persistentStoragePath; } @@ -143,7 +146,8 @@ private: QString dumpFramesAsText(QWebFrame* frame); QString dumpBackForwardList(QWebPage* page); QString dumpFrameScrollPosition(QWebFrame* frame); - TestRunner *m_controller; + TestRunnerQt *m_controller; + RefPtr<TestRunner> m_jscController; bool m_dumpPixelsForCurrentTest; bool m_dumpPixelsForAllTests; @@ -155,7 +159,7 @@ private: EventSender *m_eventSender; TextInputController *m_textInputController; - GCController* m_gcController; + QScopedPointer<GCController> m_gcController; NetworkAccessManager* m_networkAccessManager; QFile *m_stdin; @@ -235,6 +239,4 @@ private: QGraphicsWebView* m_item; }; -} - #endif diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index 80be13178..352f1de98 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -424,7 +424,7 @@ QStringList EventSender::contextClick() QGraphicsSceneContextMenuEvent ctxEvent(QEvent::GraphicsSceneContextMenu); ctxEvent.setReason(QGraphicsSceneContextMenuEvent::Mouse); ctxEvent.setPos(m_mousePos); - WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view()); + WebViewGraphicsBased* view = qobject_cast<WebViewGraphicsBased*>(m_page->view()); if (view) sendEvent(view->graphicsView(), &ctxEvent); } else { @@ -745,7 +745,7 @@ QGraphicsSceneWheelEvent* EventSender::createGraphicsSceneWheelEvent(QEvent::Typ void EventSender::sendEvent(QObject* receiver, QEvent* event) { - if (WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(receiver)) + if (WebViewGraphicsBased* view = qobject_cast<WebViewGraphicsBased*>(receiver)) view->scene()->sendEvent(view->graphicsView(), event); else QApplication::sendEvent(receiver, event); @@ -755,9 +755,11 @@ void EventSender::postEvent(QObject* receiver, QEvent* event) { // QGraphicsScene does not have a postEvent method, so send the event in this case // and delete it after that. - if (WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(receiver)) { + if (WebViewGraphicsBased* view = qobject_cast<WebViewGraphicsBased*>(receiver)) { view->scene()->sendEvent(view->graphicsView(), event); delete event; } else QApplication::postEvent(receiver, event); // event deleted by the system } + +#include "moc_EventSenderQt.cpp" diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index 7e4c60a97..ad13cadb6 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -96,7 +96,7 @@ protected: void timerEvent(QTimerEvent*); private: - bool isGraphicsBased() const { return qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view()); } + bool isGraphicsBased() const { return qobject_cast<WebViewGraphicsBased*>(m_page->view()); } QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton, Qt::MouseButtons, Qt::KeyboardModifiers); QGraphicsSceneWheelEvent* createGraphicsSceneWheelEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, int delta, Qt::KeyboardModifiers, Qt::Orientation); void sendEvent(QObject* receiver, QEvent* event); diff --git a/Tools/DumpRenderTree/qt/GCControllerQt.cpp b/Tools/DumpRenderTree/qt/GCControllerQt.cpp index a2e5e0c85..9f93698d7 100644 --- a/Tools/DumpRenderTree/qt/GCControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/GCControllerQt.cpp @@ -28,15 +28,9 @@ */ #include "config.h" -#include "GCControllerQt.h" -#include "DumpRenderTreeSupportQt.h" - -#include <qwebpage.h> +#include "GCController.h" -GCController::GCController(QWebPage* parent) - : QObject(parent) -{ -} +#include "DumpRenderTreeSupportQt.h" void GCController::collect() const { @@ -48,7 +42,7 @@ void GCController::collectOnAlternateThread(bool waitUntilDone) const DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone); } -unsigned int GCController::getJSObjectCount() const +size_t GCController::getJSObjectCount() const { return DumpRenderTreeSupportQt::javaScriptObjectsCount(); } diff --git a/Tools/DumpRenderTree/qt/GCControllerQt.h b/Tools/DumpRenderTree/qt/GCControllerQt.h deleted file mode 100644 index bcc9f2347..000000000 --- a/Tools/DumpRenderTree/qt/GCControllerQt.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef GCControllerQt_h -#define GCControllerQt_h - -#include <QObject> - -class QWebPage; -class DumpRenderTreeSupportQt; - -class GCController : public QObject -{ - Q_OBJECT -public: - GCController(QWebPage* parent); - -public Q_SLOTS: - void collect() const; - void collectOnAlternateThread(bool waitUntilDone) const; - unsigned int getJSObjectCount() const; - -}; - -#endif diff --git a/Tools/DumpRenderTree/qt/ImageDiff.cpp b/Tools/DumpRenderTree/qt/ImageDiff.cpp deleted file mode 100644 index 537b63d70..000000000 --- a/Tools/DumpRenderTree/qt/ImageDiff.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <QtCore/qmath.h> - -#include <QApplication> -#include <QBuffer> -#include <QByteArray> -#include <QImage> -#include <QStringList> - -#include <stdio.h> - -int main(int argc, char* argv[]) -{ - QCoreApplication app(argc, argv); - - qreal tolerance = 0; - - QStringList args = app.arguments(); - for (int i = 0; i < argc; ++i) - if (args[i] == "-t" || args[i] == "--tolerance") - tolerance = args[i + 1].toDouble(); - - char buffer[2048]; - QImage actualImage; - QImage baselineImage; - - while (fgets(buffer, sizeof(buffer), stdin)) { - // remove the CR - char* newLineCharacter = strchr(buffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (!strncmp("Content-Length: ", buffer, 16)) { - strtok(buffer, " "); - int imageSize = strtol(strtok(0, " "), 0, 10); - - if (imageSize <= 0) { - fputs("error, image size must be specified.\n", stdout); - } else { - unsigned char buffer[2048]; - QBuffer data; - - // Read all the incoming chunks - data.open(QBuffer::WriteOnly); - while (imageSize > 0) { - size_t bytesToRead = qMin(imageSize, 2048); - size_t bytesRead = fread(buffer, 1, bytesToRead, stdin); - data.write(reinterpret_cast<const char*>(buffer), bytesRead); - imageSize -= static_cast<int>(bytesRead); - } - - // Convert into QImage - QImage decodedImage; - decodedImage.loadFromData(data.data(), "PNG"); - decodedImage.convertToFormat(QImage::Format_ARGB32); - - // Place it in the right place - if (actualImage.isNull()) - actualImage = decodedImage; - else - baselineImage = decodedImage; - } - } - - if (!actualImage.isNull() && !baselineImage.isNull()) { - - if (actualImage.size() != baselineImage.size()) { - fprintf(stdout, "diff: 100%% failed\n"); - fprintf(stderr, "error, test and reference image have different properties.\n"); - fflush(stderr); - fflush(stdout); - } else { - - int w = actualImage.width(); - int h = actualImage.height(); - QImage diffImage(w, h, QImage::Format_ARGB32); - - int count = 0; - qreal sum = 0; - qreal maxDistance = 0; - - for (int x = 0; x < w; ++x) - for (int y = 0; y < h; ++y) { - QRgb pixel = actualImage.pixel(x, y); - QRgb basePixel = baselineImage.pixel(x, y); - qreal red = (qRed(pixel) - qRed(basePixel)) / static_cast<float>(qMax(255 - qRed(basePixel), qRed(basePixel))); - qreal green = (qGreen(pixel) - qGreen(basePixel)) / static_cast<float>(qMax(255 - qGreen(basePixel), qGreen(basePixel))); - qreal blue = (qBlue(pixel) - qBlue(basePixel)) / static_cast<float>(qMax(255 - qBlue(basePixel), qBlue(basePixel))); - qreal alpha = (qAlpha(pixel) - qAlpha(basePixel)) / static_cast<float>(qMax(255 - qAlpha(basePixel), qAlpha(basePixel))); - qreal distance = qSqrt(red * red + green * green + blue * blue + alpha * alpha) / 2.0f; - int gray = distance * qreal(255); - diffImage.setPixel(x, y, qRgb(gray, gray, gray)); - if (distance >= 1 / qreal(255)) { - count++; - sum += distance; - maxDistance = qMax(maxDistance, distance); - } - } - - qreal difference = 0; - if (count) - difference = 100 * sum / static_cast<qreal>(w * h); - if (difference <= tolerance) { - difference = 0; - } else { - difference = qRound(difference * 100) / 100.0f; - difference = qMax(difference, qreal(0.01)); - } - - if (!difference) - fprintf(stdout, "diff: %01.2f%% passed\n", difference); - else { - QBuffer buffer; - buffer.open(QBuffer::WriteOnly); - diffImage.save(&buffer, "PNG"); - buffer.close(); - const QByteArray &data = buffer.data(); - printf("Content-Length: %lu\n", static_cast<unsigned long>(data.length())); - - // We have to use the return value of fwrite to avoid "ignoring return value" gcc warning - // See https://bugs.webkit.org/show_bug.cgi?id=45384 for details. - if (fwrite(data.constData(), 1, data.length(), stdout)) {} - - fprintf(stdout, "diff: %01.2f%% failed\n", difference); - } - - fflush(stdout); - } - actualImage = QImage(); - baselineImage = QImage(); - } - } - - return 0; -} diff --git a/Tools/DumpRenderTree/qt/ImageDiff.pro b/Tools/DumpRenderTree/qt/ImageDiff.pro deleted file mode 100644 index 40bcdfb3c..000000000 --- a/Tools/DumpRenderTree/qt/ImageDiff.pro +++ /dev/null @@ -1,14 +0,0 @@ -# ------------------------------------------------------------------- -# Project file for the ImageDiff binary -# -# See 'Tools/qmake/README' for an overview of the build system -# ------------------------------------------------------------------- - -TEMPLATE = app - -TARGET = ImageDiff -DESTDIR = $$ROOT_BUILD_DIR/bin - -QT = core gui widgets - -SOURCES = ImageDiff.cpp diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index ae45c0331..3b6ddfc61 100644 --- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -31,7 +31,8 @@ SOURCES += \ Tests/PassDifferentNPPStruct.cpp \ Tests/PluginScriptableNPObjectInvokeDefault.cpp \ Tests/PluginScriptableObjectOverridesAllProperties.cpp \ - Tests/PrivateBrowsing.cpp + Tests/PrivateBrowsing.cpp \ + Tests/ToStringAndValueOfObject.cpp WEBKIT += webcore # For NPAPI headers @@ -55,7 +56,7 @@ mac { LIBS += -framework Carbon -framework Cocoa -framework QuartzCore } -!win32:!mac { +!win32:!embedded:!mac { LIBS += -lX11 DEFINES += XP_UNIX } diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 37b5bb330..794c00ff1 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -31,39 +31,34 @@ #include "DumpRenderTreeQt.h" #include "DumpRenderTreeSupportQt.h" +#include "NotificationPresenterClientQt.h" #include "WorkQueue.h" #include "WorkQueueItemQt.h" +#include <JSStringRefQt.h> #include <QCoreApplication> #include <QDir> #include <QLocale> #include <qwebsettings.h> -TestRunner::TestRunner(WebCore::DumpRenderTree* drt) +TestRunnerQt::TestRunnerQt(DumpRenderTree* drt) : QObject() , m_drt(drt) , m_shouldTimeout(true) , m_timeout(30000) { reset(); - DumpRenderTreeSupportQt::dumpNotification(true); } -void TestRunner::reset() +TestRunner::~TestRunner() +{ +} + +void TestRunnerQt::reset() { m_hasDumped = false; m_loadFinished = false; - m_textDump = false; - m_shouldDumpPixels = true; - m_dumpBackForwardList = false; - m_dumpChildrenAsText = false; - m_dumpChildFrameScrollPositions = false; - m_canOpenWindows = false; + m_audioDump = false; m_waitForDone = false; - m_disallowIncreaseForApplicationCacheQuota = false; - m_dumpTitleChanges = false; - m_dumpDatabaseCallbacks = false; - m_dumpApplicationCacheDelegateCallbacks = false; - m_dumpStatusCallbacks = false; m_timeoutTimer.stop(); m_topLoadingFrame = 0; m_waitForPolicy = false; @@ -71,11 +66,10 @@ void TestRunner::reset() m_webHistory = 0; m_globalFlag = false; m_userStyleSheetEnabled = false; - m_desktopNotificationAllowedOrigins.clear(); m_ignoreDesktopNotification = false; m_isGeolocationPermissionSet = false; - m_isPrinting = false; m_geolocationPermission = false; + m_audioData.clear(); DumpRenderTreeSupportQt::dumpEditingCallbacks(false); DumpRenderTreeSupportQt::dumpFrameLoader(false); @@ -93,16 +87,23 @@ void TestRunner::reset() DumpRenderTreeSupportQt::dumpHistoryCallbacks(false); DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false); DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter()); + DumpRenderTreeSupportQt::dumpNotification(false); DumpRenderTreeSupportQt::setShouldUseFontSmoothing(false); DumpRenderTreeSupportQt::disableDefaultTypesettingFeatures(); setIconDatabaseEnabled(false); clearAllDatabases(); + removeAllWebNotificationPermissions(); // The default state for DRT is to block third-party cookies, mimicing the Mac port setAlwaysAcceptCookies(false); emit hidePage(); } -void TestRunner::processWork() +void TestRunnerQt::dumpNotifications() +{ + DumpRenderTreeSupportQt::dumpNotification(true); +} + +void TestRunnerQt::processWork() { // qDebug() << ">>>processWork"; @@ -114,7 +115,7 @@ void TestRunner::processWork() } // Called on loadFinished on WebPage -void TestRunner::maybeDump(bool /*success*/) +void TestRunnerQt::maybeDump(bool /*success*/) { // This can happen on any of the http/tests/security/window-events-*.html tests, where the test opens @@ -145,13 +146,7 @@ void TestRunner::maybeDump(bool /*success*/) } } -void TestRunner::dumpAsText(bool shouldDumpPixels) -{ - m_textDump = true; - m_shouldDumpPixels = shouldDumpPixels; -} - -void TestRunner::waitUntilDone() +void TestRunnerQt::waitUntilDone() { //qDebug() << ">>>>waitForDone"; m_waitForDone = true; @@ -162,12 +157,12 @@ void TestRunner::waitUntilDone() m_timeoutTimer.start(m_timeout, this); } -void TestRunner::setViewModeMediaFeature(const QString& mode) +void TestRunnerQt::setViewModeMediaFeature(const QString& mode) { m_drt->webPage()->setProperty("_q_viewMode", mode); } -int TestRunner::webHistoryItemCount() +int TestRunnerQt::webHistoryItemCount() { if (!m_webHistory) return -1; @@ -177,12 +172,12 @@ int TestRunner::webHistoryItemCount() return m_webHistory->count() - 1; } -void TestRunner::keepWebHistory() +void TestRunnerQt::keepWebHistory() { m_webHistory = m_drt->webPage()->history(); } -void TestRunner::notifyDone() +void TestRunnerQt::notifyDone() { qDebug() << ">>>>notifyDone"; @@ -206,60 +201,55 @@ void TestRunner::notifyDone() m_waitForPolicy = false; } -int TestRunner::windowCount() +int TestRunnerQt::windowCount() { return m_drt->windowCount(); } -void TestRunner::grantWebNotificationPermission(const QString& origin) +void TestRunnerQt::grantWebNotificationPermission(const QString& origin) { QWebFrame* frame = m_drt->webPage()->mainFrame(); m_drt->webPage()->setFeaturePermission(frame, QWebPage::Notifications, QWebPage::PermissionGrantedByUser); - m_desktopNotificationAllowedOrigins.append(origin); } -void TestRunner::ignoreLegacyWebNotificationPermissionRequests() +void TestRunnerQt::ignoreLegacyWebNotificationPermissionRequests() { m_ignoreDesktopNotification = true; } -void TestRunner::denyWebNotificationPermission(const QString& origin) +void TestRunnerQt::denyWebNotificationPermission(const QString& origin) { - // FIXME: implement. -} - -void TestRunner::removeAllWebNotificationPermissions() -{ - // FIXME: implement. + QWebFrame* frame = m_drt->webPage()->mainFrame(); + m_drt->webPage()->setFeaturePermission(frame, QWebPage::Notifications, QWebPage::PermissionDeniedByUser); } -void TestRunner::simulateWebNotificationClick(const QWebElement& notification) +void TestRunnerQt::removeAllWebNotificationPermissions() { - // FIXME: implement. + DumpRenderTreeSupportQt::clearNotificationPermissions(); } -void TestRunner::simulateLegacyWebNotificationClick(const QString& title) +void TestRunnerQt::simulateLegacyWebNotificationClick(const QString& title) { DumpRenderTreeSupportQt::simulateDesktopNotificationClick(title); } -void TestRunner::display() +void TestRunnerQt::display() { DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame->handle(), true); emit showPage(); } -void TestRunner::displayInvalidatedRegion() +void TestRunnerQt::displayInvalidatedRegion() { display(); } -void TestRunner::clearBackForwardList() +void TestRunnerQt::clearBackForwardList() { m_drt->webPage()->history()->clear(); } -QString TestRunner::pathToLocalResource(const QString& url) +QString TestRunnerQt::pathToLocalResource(const QString& url) { QString localTmpUrl(QLatin1String("file:///tmp/LayoutTests")); @@ -276,123 +266,115 @@ QString TestRunner::pathToLocalResource(const QString& url) return url; } -void TestRunner::dumpEditingCallbacks() +void TestRunnerQt::dumpEditingCallbacks() { qDebug() << ">>>dumpEditingCallbacks"; DumpRenderTreeSupportQt::dumpEditingCallbacks(true); } -void TestRunner::dumpFrameLoadCallbacks() +void TestRunnerQt::dumpFrameLoadCallbacks() { DumpRenderTreeSupportQt::dumpFrameLoader(true); } -void TestRunner::dumpProgressFinishedCallback() +void TestRunnerQt::dumpProgressFinishedCallback() { DumpRenderTreeSupportQt::dumpProgressFinishedCallback(true); } -void TestRunner::dumpUserGestureInFrameLoadCallbacks() +void TestRunnerQt::dumpUserGestureInFrameLoadCallbacks() { DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(true); } -void TestRunner::dumpResourceLoadCallbacks() +void TestRunnerQt::dumpResourceLoadCallbacks() { DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(true); } -void TestRunner::dumpResourceResponseMIMETypes() +void TestRunnerQt::dumpResourceResponseMIMETypes() { DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(true); } -void TestRunner::dumpWillCacheResponse() +void TestRunnerQt::dumpWillCacheResponse() { DumpRenderTreeSupportQt::dumpWillCacheResponseCallbacks(true); } -void TestRunner::dumpHistoryCallbacks() +void TestRunnerQt::dumpHistoryCallbacks() { DumpRenderTreeSupportQt::dumpHistoryCallbacks(true); } -void TestRunner::setWillSendRequestReturnsNullOnRedirect(bool enabled) +void TestRunnerQt::setWillSendRequestReturnsNullOnRedirect(bool enabled) { DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(enabled); } -void TestRunner::setWillSendRequestReturnsNull(bool enabled) +void TestRunnerQt::setWillSendRequestReturnsNull(bool enabled) { DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(enabled); } -void TestRunner::setWillSendRequestClearHeader(const QStringList& headers) +void TestRunnerQt::setWillSendRequestClearHeader(const QStringList& headers) { DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(headers); } -void TestRunner::setDeferMainResourceDataLoad(bool defer) +void TestRunnerQt::setDeferMainResourceDataLoad(bool defer) { DumpRenderTreeSupportQt::setDeferMainResourceDataLoad(defer); } -void TestRunner::queueBackNavigation(int howFarBackward) +void TestRunnerQt::queueBackNavigation(int howFarBackward) { //qDebug() << ">>>queueBackNavigation" << howFarBackward; for (int i = 0; i != howFarBackward; ++i) - WorkQueue::shared()->queue(new BackItem(1, m_drt->webPage())); + WorkQueue::shared()->queue(new BackItem(1)); } -void TestRunner::queueForwardNavigation(int howFarForward) +void TestRunnerQt::queueForwardNavigation(int howFarForward) { //qDebug() << ">>>queueForwardNavigation" << howFarForward; for (int i = 0; i != howFarForward; ++i) - WorkQueue::shared()->queue(new ForwardItem(1, m_drt->webPage())); + WorkQueue::shared()->queue(new ForwardItem(1)); } -void TestRunner::queueLoad(const QString& url, const QString& target) -{ - //qDebug() << ">>>queueLoad" << url << target; - QUrl mainResourceUrl = m_drt->webPage()->mainFrame()->url(); - QString absoluteUrl = mainResourceUrl.resolved(QUrl(url)).toEncoded(); - WorkQueue::shared()->queue(new LoadItem(absoluteUrl, target, m_drt->webPage())); -} - -void TestRunner::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL) +void TestRunnerQt::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL) { if (failingURL.isEmpty()) - WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, m_drt->webPage())); + WorkQueue::shared()->queue(new LoadHTMLStringItem(JSStringCreateWithQString(content).get(), JSStringCreateWithQString(baseURL).get())); else - WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(content, baseURL, failingURL, m_drt->webPage())); + WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(JSStringCreateWithQString(content), JSStringCreateWithQString(baseURL), JSStringCreateWithQString(failingURL))); } -void TestRunner::queueReload() +void TestRunnerQt::queueReload() { //qDebug() << ">>>queueReload"; - WorkQueue::shared()->queue(new ReloadItem(m_drt->webPage())); + WorkQueue::shared()->queue(new ReloadItem()); } -void TestRunner::queueLoadingScript(const QString& script) +void TestRunnerQt::queueLoadingScript(const QString& script) { //qDebug() << ">>>queueLoadingScript" << script; - WorkQueue::shared()->queue(new LoadingScriptItem(script, m_drt->webPage())); + WorkQueue::shared()->queue(new LoadingScriptItem(JSStringCreateWithQString(script).get())); } -void TestRunner::queueNonLoadingScript(const QString& script) +void TestRunnerQt::queueNonLoadingScript(const QString& script) { //qDebug() << ">>>queueNonLoadingScript" << script; - WorkQueue::shared()->queue(new NonLoadingScriptItem(script, m_drt->webPage())); + WorkQueue::shared()->queue(new NonLoadingScriptItem(JSStringCreateWithQString(script).get())); } -void TestRunner::provisionalLoad() +void TestRunnerQt::provisionalLoad() { QWebFrame* frame = qobject_cast<QWebFrame*>(sender()); if (!m_topLoadingFrame && !m_hasDumped) m_topLoadingFrame = frame; } -void TestRunner::timerEvent(QTimerEvent *ev) +void TestRunnerQt::timerEvent(QTimerEvent *ev) { if (ev->timerId() == m_timeoutTimer.timerId()) { const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; @@ -403,134 +385,99 @@ void TestRunner::timerEvent(QTimerEvent *ev) QObject::timerEvent(ev); } -QString TestRunner::encodeHostName(const QString& host) +QString TestRunnerQt::encodeHostName(const QString& host) { QString encoded = QString::fromLatin1(QUrl::toAce(host + QLatin1String(".no"))); encoded.truncate(encoded.length() - 3); // strip .no return encoded; } -QString TestRunner::decodeHostName(const QString& host) +QString TestRunnerQt::decodeHostName(const QString& host) { QString decoded = QUrl::fromAce(host.toLatin1() + QByteArray(".no")); decoded.truncate(decoded.length() - 3); return decoded; } -void TestRunner::closeWebInspector() +void TestRunnerQt::closeWebInspector() { DumpRenderTreeSupportQt::webInspectorClose(m_drt->pageAdapter()); m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); } -void TestRunner::setDeveloperExtrasEnabled(bool enabled) +void TestRunnerQt::setDeveloperExtrasEnabled(bool enabled) { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enabled); } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - // FIXME: Implement this. -} - -void TestRunner::showWebInspector() +void TestRunnerQt::showWebInspector() { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); DumpRenderTreeSupportQt::webInspectorShow(m_drt->pageAdapter()); } -void TestRunner::evaluateInWebInspector(long callId, const QString& script) +void TestRunnerQt::evaluateInWebInspector(long callId, const QString& script) { DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->pageAdapter(), callId, script); } -void TestRunner::setFrameFlatteningEnabled(bool enabled) -{ - DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->pageAdapter(), enabled); -} - -void TestRunner::goBack() -{ - DumpRenderTreeSupportQt::goBack(m_drt->pageAdapter()); -} - -void TestRunner::setDefersLoading(bool flag) -{ - DumpRenderTreeSupportQt::setDefersLoading(m_drt->pageAdapter(), flag); -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) +void TestRunnerQt::setAllowUniversalAccessFromFileURLs(bool enabled) { m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled); } -void TestRunner::setAllowFileAccessFromFileURLs(bool enabled) +void TestRunnerQt::setAllowFileAccessFromFileURLs(bool enabled) { m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, enabled); } -void TestRunner::setAppCacheMaximumSize(unsigned long long quota) +void TestRunnerQt::setAppCacheMaximumSize(unsigned long long quota) { m_drt->webPage()->settings()->setOfflineWebApplicationCacheQuota(quota); } -void TestRunner::setAutofilled(const QWebElement& element, bool isAutofilled) -{ - return DumpRenderTreeSupportQt::setAutofilled(element, isAutofilled); -} - -void TestRunner::setValueForUser(const QWebElement& element, const QString& value) +void TestRunnerQt::setValueForUser(const QWebElement& element, const QString& value) { DumpRenderTreeSupportQt::setValueForUser(element, value); } -void TestRunner::setFixedContentsSize(int width, int height) +void TestRunnerQt::setFixedContentsSize(int width, int height) { m_topLoadingFrame->page()->setPreferredContentsSize(QSize(width, height)); } -void TestRunner::setPrivateBrowsingEnabled(bool enable) +void TestRunnerQt::setPrivateBrowsingEnabled(bool enable) { m_drt->webPage()->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, enable); } -void TestRunner::setSpatialNavigationEnabled(bool enable) +void TestRunnerQt::setSpatialNavigationEnabled(bool enable) { m_drt->webPage()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, enable); } -void TestRunner::setPopupBlockingEnabled(bool enable) +void TestRunnerQt::setPopupBlockingEnabled(bool enable) { m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !enable); } -void TestRunner::setPluginsEnabled(bool flag) -{ - // FIXME: Implement -} - -void TestRunner::setPOSIXLocale(const QString& locale) +void TestRunnerQt::setPOSIXLocale(const QString& locale) { QLocale qlocale(locale); QLocale::setDefault(qlocale); } -void TestRunner::setWindowIsKey(bool isKey) +void TestRunnerQt::setWindowIsKey(bool isKey) { m_drt->switchFocus(isKey); } -void TestRunner::setMainFrameIsFirstResponder(bool isFirst) -{ - //FIXME: only need this for the moment: https://bugs.webkit.org/show_bug.cgi?id=32990 -} - -void TestRunner::setJavaScriptCanAccessClipboard(bool enable) +void TestRunnerQt::setJavaScriptCanAccessClipboard(bool enable) { m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, enable); } -void TestRunner::setXSSAuditorEnabled(bool enable) +void TestRunnerQt::setXSSAuditorEnabled(bool enable) { // Set XSSAuditingEnabled globally so that windows created by the test inherit it too. // resetSettings() will call this to reset the page and global setting to false again. @@ -540,121 +487,59 @@ void TestRunner::setXSSAuditorEnabled(bool enable) m_drt->webPage()->settings()->setAttribute(QWebSettings::XSSAuditingEnabled, enable); } -bool TestRunner::pauseAnimationAtTimeOnElementWithId(const QString& animationName, - double time, - const QString& elementId) -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseAnimation(frame->handle(), animationName, time, elementId); -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(const QString& propertyName, - double time, - const QString& elementId) -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame->handle(), propertyName, time, elementId); -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - QWebFrame* frame = m_drt->webPage()->mainFrame(); - Q_ASSERT(frame); - return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame->handle()); -} - -void TestRunner::disableImageLoading() -{ - m_drt->webPage()->settings()->setAttribute(QWebSettings::AutoLoadImages, false); -} - -void TestRunner::dispatchPendingLoadRequests() -{ - // FIXME: Implement for testing fix for 6727495 -} - -void TestRunner::clearAllApplicationCaches() +void TestRunnerQt::clearAllApplicationCaches() { DumpRenderTreeSupportQt::clearAllApplicationCaches(); } -void TestRunner::clearApplicationCacheForOrigin(const QString& url) -{ - // FIXME: Implement to support deleting all application caches for an origin. -} - -long long TestRunner::localStorageDiskUsageForOrigin(const QString& originIdentifier) -{ - // FIXME: Implement to support getting disk usage in bytes for an origin. - return 0; -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) +void TestRunnerQt::setApplicationCacheOriginQuota(unsigned long long quota) { if (!m_topLoadingFrame) return; m_topLoadingFrame->securityOrigin().setApplicationCacheQuota(quota); } -long long TestRunner::applicationCacheDiskUsageForOrigin(const QString& origin) -{ - // FIXME: Implement to support getting disk usage by all application caches for an origin. - return 0; -} - -QStringList TestRunner::originsWithApplicationCache() +QStringList TestRunnerQt::originsWithApplicationCache() { // FIXME: Implement to get origins that have application caches. return QStringList(); } -void TestRunner::setCacheModel(int model) -{ - // qwebsetting doesn't have matched setting yet : - // WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER - // WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER - // WEBKIT_CACHE_MODEL_WEB_BROWSER - - // FIXME: Implement. -} - -void TestRunner::setDatabaseQuota(int size) +void TestRunnerQt::setDatabaseQuota(int size) { if (!m_topLoadingFrame) return; m_topLoadingFrame->securityOrigin().setDatabaseQuota(size); } -void TestRunner::clearAllDatabases() +void TestRunnerQt::clearAllDatabases() { QWebDatabase::removeAllDatabases(); } -void TestRunner::addOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +void TestRunnerQt::addOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); } -void TestRunner::removeOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +void TestRunnerQt::removeOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { DumpRenderTreeSupportQt::removeWhiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); } -void TestRunner::setCustomPolicyDelegate(bool enabled, bool permissive) +void TestRunnerQt::setCustomPolicyDelegate(bool enabled, bool permissive) { DumpRenderTreeSupportQt::setCustomPolicyDelegate(enabled, permissive); } -void TestRunner::waitForPolicyDelegate() +void TestRunnerQt::waitForPolicyDelegate() { setCustomPolicyDelegate(true); m_waitForPolicy = true; waitUntilDone(); } -void TestRunner::overridePreference(const QString& name, const QVariant& value) +void TestRunnerQt::overridePreference(const QString& name, const QVariant& value) { QWebSettings* settings = m_topLoadingFrame->page()->settings(); @@ -684,12 +569,14 @@ void TestRunner::overridePreference(const QString& name, const QVariant& value) settings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, value.toBool()); else if (name == "WebKitDisplayImagesKey") settings->setAttribute(QWebSettings::AutoLoadImages, value.toBool()); + else if (name == "WebKitWebAudioEnabled") + settings->setAttribute(QWebSettings::WebAudioEnabled, value.toBool()); else printf("ERROR: TestRunner::overridePreference() does not support the '%s' preference\n", name.toLatin1().data()); } -void TestRunner::setUserStyleSheetLocation(const QString& url) +void TestRunnerQt::setUserStyleSheetLocation(const QString& url) { QByteArray urlData = pathToLocalResource(url).toLatin1(); m_userStyleSheetLocation = QUrl::fromEncoded(urlData, QUrl::StrictMode); @@ -698,17 +585,17 @@ void TestRunner::setUserStyleSheetLocation(const QString& url) setUserStyleSheetEnabled(true); } -void TestRunner::setCaretBrowsingEnabled(bool value) +void TestRunnerQt::setCaretBrowsingEnabled(bool value) { DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->pageAdapter(), value); } -void TestRunner::setAuthorAndUserStylesEnabled(bool value) +void TestRunnerQt::setAuthorAndUserStylesEnabled(bool value) { DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(m_drt->pageAdapter(), value); } -void TestRunner::setUserStyleSheetEnabled(bool enabled) +void TestRunnerQt::setUserStyleSheetEnabled(bool enabled) { m_userStyleSheetEnabled = enabled; @@ -718,22 +605,17 @@ void TestRunner::setUserStyleSheetEnabled(bool enabled) m_drt->webPage()->settings()->setUserStyleSheetUrl(QUrl()); } -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme) +void TestRunnerQt::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme) { DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); } -int TestRunner::workerThreadCount() -{ - return DumpRenderTreeSupportQt::workerThreadCount(); -} - -bool TestRunner::callShouldCloseOnWebView() +bool TestRunnerQt::callShouldCloseOnWebView() { return DumpRenderTreeSupportQt::shouldClose(m_drt->mainFrameAdapter()); } -void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& policy) +void TestRunnerQt::setScrollbarPolicy(const QString& orientation, const QString& policy) { Qt::Orientation o; Qt::ScrollBarPolicy p; @@ -757,223 +639,569 @@ void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& p m_drt->webPage()->mainFrame()->setScrollBarPolicy(o, p); } -void TestRunner::setSmartInsertDeleteEnabled(bool enable) +void TestRunnerQt::execCommand(const QString& name, const QString& value) { - DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->pageAdapter(), enable); + DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->pageAdapter(), name, value); } -void TestRunner::setSelectTrailingWhitespaceEnabled(bool enable) +bool TestRunnerQt::isCommandEnabled(const QString& name) const { - DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->pageAdapter(), enable); + return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->pageAdapter(), name); } -void TestRunner::execCommand(const QString& name, const QString& value) +bool TestRunner::findString(JSContextRef context, JSStringRef string, JSObjectRef optionsArray) +{ + JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); + JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); + if (!JSValueIsNumber(context, lengthValue)) + return false; + + QWebPage::FindFlags findFlags = QWebPage::FindCaseSensitively; + + int length = static_cast<int>(JSValueToNumber(context, lengthValue, 0)); + for (int 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")) + findFlags &= ~QWebPage::FindCaseSensitively; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) + findFlags |= QWebPage::FindAtWordBeginningsOnly; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) + findFlags |= QWebPage::TreatMedialCapitalAsWordBeginning; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) + findFlags |= QWebPage::FindBackward; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) + findFlags |= QWebPage::FindWrapsAroundDocument; + else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) + findFlags |= QWebPage::FindBeginsInSelection; + } + + DumpRenderTree* drt = DumpRenderTree::instance(); + return drt->webPage()->findText(JSStringCopyQString(string), findFlags); +} + +void TestRunnerQt::setIconDatabaseEnabled(bool enable) { - DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->pageAdapter(), name, value); + if (enable && !m_drt->persistentStoragePath().isEmpty()) + QWebSettings::setIconDatabasePath(m_drt->persistentStoragePath()); + else + QWebSettings::setIconDatabasePath(QString()); } -bool TestRunner::isCommandEnabled(const QString& name) const +void TestRunnerQt::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) { - return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->pageAdapter(), name); + QList<WebPage*> pages = m_drt->getAllPages(); + foreach (WebPage* page, pages) + DumpRenderTreeSupportQt::setMockDeviceOrientation(page->handle(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } -bool TestRunner::findString(const QString& string, const QStringList& optionArray) +void TestRunnerQt::setGeolocationPermission(bool allow) { - return DumpRenderTreeSupportQt::findString(m_drt->pageAdapter(), string, optionArray); + setGeolocationPermissionCommon(allow); + QList<WebPage*> pages = m_drt->getAllPages(); + foreach (WebPage* page, pages) + DumpRenderTreeSupportQt::setMockGeolocationPermission(page->handle(), allow); } -QString TestRunner::markerTextForListItem(const QWebElement& listItem) +int TestRunnerQt::numberOfPendingGeolocationPermissionRequests() { - return DumpRenderTreeSupportQt::markerTextForListItem(listItem); + int pendingPermissionCount = 0; + QList<WebPage*> pages = m_drt->getAllPages(); + foreach (WebPage* page, pages) + pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page->handle()); + + return pendingPermissionCount; } -QVariantMap TestRunner::computedStyleIncludingVisitedInfo(const QWebElement& element) const +void TestRunnerQt::setGeolocationPermissionCommon(bool allow) { - return DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(element); + m_isGeolocationPermissionSet = true; + m_geolocationPermission = allow; } -bool TestRunner::elementDoesAutoCompleteForElementWithId(const QString& elementId) +void TestRunnerQt::setMockGeolocationPositionUnavailableError(const QString& message) { - return DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(m_drt->mainFrameAdapter(), elementId); + QList<WebPage*> pages = m_drt->getAllPages(); + foreach (WebPage* page, pages) + DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page->handle(), message); } -void TestRunner::authenticateSession(const QString&, const QString&, const QString&) +void TestRunnerQt::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { - // FIXME: If there is a concept per-session (per-process) credential storage, the credentials should be added to it for later use. + QList<WebPage*> pages = m_drt->getAllPages(); + foreach (WebPage* page, pages) + DumpRenderTreeSupportQt::setMockGeolocationPosition(page->handle(), latitude, longitude, accuracy); } -void TestRunner::setIconDatabaseEnabled(bool enable) +void TestRunnerQt::removeAllVisitedLinks() { - if (enable && !m_drt->persistentStoragePath().isEmpty()) - QWebSettings::setIconDatabasePath(m_drt->persistentStoragePath()); + QWebHistory* history = m_drt->webPage()->history(); + history->clear(); + DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true); +} + +void TestRunnerQt::addURLToRedirect(const QString& origin, const QString& destination) +{ + DumpRenderTreeSupportQt::addURLToRedirect(origin, destination); +} + +void TestRunnerQt::setAlwaysAcceptCookies(bool accept) +{ + QWebSettings* globalSettings = QWebSettings::globalSettings(); + if (accept) + globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysAllowThirdPartyCookies); + else { + // This matches the Safari third-party cookie blocking policy tested in third-party-cookie-relaxing.html + globalSettings->setThirdPartyCookiePolicy(QWebSettings::AllowThirdPartyWithExistingCookies); + } +} + +void TestRunnerQt::setAlwaysBlockCookies(bool block) +{ + QWebSettings* globalSettings = QWebSettings::globalSettings(); + if (block) + globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysBlockThirdPartyCookies); else - QWebSettings::setIconDatabasePath(QString()); + globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysAllowThirdPartyCookies); } -void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +void TestRunnerQt::setAudioResult(const QByteArray& audioData) { - QList<WebCore::WebPage*> pages = m_drt->getAllPages(); - foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockDeviceOrientation(page->handle(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); + m_audioData = audioData; + m_audioDump = true; } -void TestRunner::setGeolocationPermission(bool allow) +// --- JSC C API stubs + +void TestRunner::addDisallowedURL(JSStringRef url) { - setGeolocationPermissionCommon(allow); - QList<WebCore::WebPage*> pages = m_drt->getAllPages(); - foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPermission(page->handle(), allow); } -int TestRunner::numberOfPendingGeolocationPermissionRequests() +void TestRunner::queueLoad(JSStringRef url, JSStringRef target) { - int pendingPermissionCount = 0; - QList<WebCore::WebPage*> pages = m_drt->getAllPages(); - foreach (WebCore::WebPage* page, pages) - pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page->handle()); + DumpRenderTree* drt = DumpRenderTree::instance(); + QUrl mainResourceUrl = drt->webPage()->mainFrame()->url(); + QString absoluteUrl = mainResourceUrl.resolved(QUrl(JSStringCopyQString(url))).toEncoded(); + WorkQueue::shared()->queue(new LoadItem(JSStringCreateWithQString(absoluteUrl).get(), target)); +} - return pendingPermissionCount; +void TestRunner::removeAllVisitedLinks() +{ } -void TestRunner::setGeolocationPermissionCommon(bool allow) +void TestRunner::setAcceptsEditing(bool) { - m_isGeolocationPermissionSet = true; - m_geolocationPermission = allow; } -void TestRunner::setMockGeolocationPositionUnavailableError(const QString& message) +void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) { - QList<WebCore::WebPage*> pages = m_drt->getAllPages(); - foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page->handle(), message); } -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +void TestRunner::setWindowIsKey(bool) { - QList<WebCore::WebPage*> pages = m_drt->getAllPages(); - foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPosition(page->handle(), latitude, longitude, accuracy); } -void TestRunner::addMockSpeechInputResult(const QString& result, double confidence, const QString& language) +void TestRunner::setAlwaysAcceptCookies(bool) { - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. } -void TestRunner::setMockSpeechInputDumpRect(bool flag) +void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. } -void TestRunner::startSpeechInput(const QString& inputElement) +void TestRunner::setWebViewEditable(bool) { - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. } -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const QString& script) +void TestRunner::clearAllApplicationCaches() { - // FIXME: Implement. } -void TestRunner::evaluateScriptInIsolatedWorld(int worldID, const QString& script) +void TestRunner::setTextDirection(JSStringRef directionName) { - DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->mainFrameAdapter(), worldID, script); + QWebPage* webPage = DumpRenderTree::instance()->webPage(); + if (JSStringIsEqualToUTF8CString(directionName, "auto")) + webPage->triggerAction(QWebPage::SetTextDirectionDefault); + else if (JSStringIsEqualToUTF8CString(directionName, "rtl")) + webPage->triggerAction(QWebPage::SetTextDirectionRightToLeft); + else if (JSStringIsEqualToUTF8CString(directionName, "ltr")) + webPage->triggerAction(QWebPage::SetTextDirectionLeftToRight); } -void TestRunner::addUserStyleSheet(const QString& sourceCode) +void TestRunner::notifyDone() { - DumpRenderTreeSupportQt::addUserStyleSheet(m_drt->pageAdapter(), sourceCode); } -void TestRunner::removeAllVisitedLinks() +int TestRunner::numberOfPendingGeolocationPermissionRequests() { - QWebHistory* history = m_drt->webPage()->history(); - history->clear(); - DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true); + return 0; } -void TestRunner::addURLToRedirect(const QString& origin, const QString& destination) +void TestRunner::overridePreference(JSStringRef key, JSStringRef value) +{ +} + +JSStringRef TestRunner::pathToLocalResource(JSContextRef, JSStringRef url) +{ + return JSStringCreateWithUTF8CString(0); // ### Take impl from WTR +} + +void TestRunner::removeAllWebNotificationPermissions() +{ +} + +void TestRunner::simulateWebNotificationClick(JSValueRef notification) +{ +} + +void TestRunner::closeIdleLocalStorageDatabases() +{ +} + +void TestRunner::focusWebView() +{ +} + +void TestRunner::setBackingScaleFactor(double) +{ +} + +void TestRunner::removeChromeInputField() { - DumpRenderTreeSupportQt::addURLToRedirect(origin, destination); } -void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) +void TestRunner::addChromeInputField() { - DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->pageAdapter(), minimumTimerInterval); } -void TestRunner::originsWithLocalStorage() +JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) { - // FIXME: Implement. + return JSValueMakeNull(context); } void TestRunner::deleteAllLocalStorage() { - // FIXME: Implement. } -void TestRunner::deleteLocalStorageForOrigin(const QString& originIdentifier) +void TestRunner::deleteLocalStorageForOrigin(JSStringRef originIdentifier) { - // FIXME: Implement. } void TestRunner::observeStorageTrackerNotifications(unsigned number) { - // FIXME: Implement. } void TestRunner::syncLocalStorage() { - // FIXME: Implement. +} + +int TestRunner::windowCount() +{ + return 0; +} + +void TestRunner::setWaitToDump(bool) +{ +} + +void TestRunner::waitForPolicyDelegate() +{ +} + +size_t TestRunner::webHistoryItemCount() +{ + return 0; +} + +void TestRunner::showWebInspector() +{ +} + +void TestRunner::closeWebInspector() +{ +} + +void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) +{ +} + +void TestRunner::setSerializeHTTPLoads(bool) +{ +} + +void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ +} + +void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) +{ +} + +void TestRunner::setDatabaseQuota(unsigned long long quota) +{ +} + +void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) +{ } void TestRunner::resetPageVisibility() { - // FIXME: Implement this. + DumpRenderTreeSupportQt::resetPageVisibility(DumpRenderTree::instance()->pageAdapter()); } -void TestRunner::setPageVisibility(const char*) +void TestRunner::setPageVisibility(const char* visibility) { - // FIXME: Implement this. + QLatin1String newVisibility = QLatin1String(visibility); + if (newVisibility == QStringLiteral("visible")) + DumpRenderTree::instance()->webPage()->setVisibilityState(QWebPage::VisibilityStateVisible); + else if (newVisibility == QStringLiteral("hidden")) + DumpRenderTree::instance()->webPage()->setVisibilityState(QWebPage::VisibilityStateHidden); + else if (newVisibility == QStringLiteral("prerender")) + DumpRenderTree::instance()->webPage()->setVisibilityState(QWebPage::VisibilityStatePrerender); + else if (newVisibility == QStringLiteral("unloaded")) + DumpRenderTree::instance()->webPage()->setVisibilityState(QWebPage::VisibilityStateUnloaded); } -void TestRunner::setAutomaticLinkDetectionEnabled(bool) +void TestRunner::keepWebHistory() { - // FIXME: Implement this. } -void TestRunner::setTextDirection(const QString& directionName) +void TestRunner::goBack() { - if (directionName == "auto") - m_drt->webPage()->triggerAction(QWebPage::SetTextDirectionDefault); - else if (directionName == "rtl") - m_drt->webPage()->triggerAction(QWebPage::SetTextDirectionRightToLeft); - else if (directionName == "ltr") - m_drt->webPage()->triggerAction(QWebPage::SetTextDirectionLeftToRight); + DumpRenderTreeSupportQt::goBack(DumpRenderTree::instance()->pageAdapter()); } -void TestRunner::setAlwaysAcceptCookies(bool accept) +JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) { - QWebSettings* globalSettings = QWebSettings::globalSettings(); - if (accept) - globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysAllowThirdPartyCookies); - else { - // This matches the Safari third-party cookie blocking policy tested in third-party-cookie-relaxing.html - globalSettings->setThirdPartyCookiePolicy(QWebSettings::AllowThirdPartyWithExistingCookies); - } + return JSValueMakeNull(context); } -void TestRunner::setAlwaysBlockCookies(bool block) +long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef name) { - QWebSettings* globalSettings = QWebSettings::globalSettings(); - if (block) - globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysBlockThirdPartyCookies); - else - globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysAllowThirdPartyCookies); + return 0; +} + +void TestRunner::display() +{ +} + +void TestRunner::dispatchPendingLoadRequests() +{ +} + +void TestRunner::clearPersistentUserStyleSheet() +{ +} + +bool TestRunner::callShouldCloseOnWebView() +{ + return false; +} + +JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) +{ + return JSStringCreateWithUTF8CString(0); +} + +void TestRunner::clearBackForwardList() +{ +} + +void TestRunner::clearAllDatabases() +{ +} + +void TestRunner::clearApplicationCacheForOrigin(JSStringRef name) +{ +} + +void TestRunner::apiTestGoToCurrentBackForwardItem() +{ +} + +void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) +{ +} + +void TestRunner::abortModal() +{ +} + +void TestRunner::setStorageDatabaseIdleInterval(double) +{ +} + +void TestRunner::setXSSAuditorEnabled(bool flag) +{ +} + +void TestRunner::setSpatialNavigationEnabled(bool) +{ +} + +void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) +{ +} + +void TestRunner::setJavaScriptCanAccessClipboard(bool flag) +{ +} + +void TestRunner::setAutomaticLinkDetectionEnabled(bool flag) +{ +} + +void TestRunner::setUserStyleSheetEnabled(bool flag) +{ +} + +void TestRunner::setUserStyleSheetLocation(JSStringRef path) +{ +} + +void TestRunner::setUseDashboardCompatibilityMode(bool flag) +{ +} + +void TestRunner::setTabKeyCyclesThroughElements(bool) +{ +} + +void TestRunner::setPrivateBrowsingEnabled(bool) +{ +} + +void TestRunner::setPluginsEnabled(bool) +{ +} + +void TestRunner::setPopupBlockingEnabled(bool) +{ +} + +void TestRunner::setMockSpeechInputDumpRect(bool flag) +{ +} + +void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path) +{ +} + +void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) +{ +} + +void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) +{ +} + +void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ +} + +void TestRunner::setMainFrameIsFirstResponder(bool flag) +{ +} + +void TestRunner::setIconDatabaseEnabled(bool) +{ +} + +void TestRunner::setGeolocationPermission(bool allow) +{ +} + +void TestRunner::setDefersLoading(bool flag) +{ + DumpRenderTreeSupportQt::setDefersLoading(DumpRenderTree::instance()->pageAdapter(), flag); +} + +void TestRunner::setCacheModel(int) +{ +} + +void TestRunner::setAuthorAndUserStylesEnabled(bool) +{ +} + +void TestRunner::setAllowFileAccessFromFileURLs(bool) +{ +} + +void TestRunner::setAppCacheMaximumSize(unsigned long long quota) +{ +} + +void TestRunner::setAllowUniversalAccessFromFileURLs(bool) +{ +} + +void TestRunner::setApplicationCacheOriginQuota(unsigned long long) +{ +} + +void TestRunner::denyWebNotificationPermission(JSStringRef origin) +{ +} + +void TestRunner::grantWebNotificationPermission(JSStringRef origin) +{ +} + +void TestRunner::setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value) +{ +} + +void TestRunner::setViewModeMediaFeature(JSStringRef) +{ +} + +void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) +{ +} + +void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) +{ +} + +void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) +{ +} + +bool TestRunner::isCommandEnabled(JSStringRef name) +{ + return false; +} + +void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) +{ + DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(DumpRenderTree::instance()->mainFrameAdapter(), worldID, JSStringCopyQString(script)); +} + +void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) +{ +} + +JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) +{ + return JSStringCreateWithUTF8CString(0); +} + +void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) +{ + DumpRenderTreeSupportQt::addUserStyleSheet(DumpRenderTree::instance()->pageAdapter(), JSStringCopyQString(source)); +} + +void TestRunner::execCommand(JSStringRef name, JSStringRef value) +{ +} + +long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) +{ + return 0; } -const unsigned TestRunner::maxViewWidth = 800; -const unsigned TestRunner::maxViewHeight = 600; diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.h b/Tools/DumpRenderTree/qt/TestRunnerQt.h index a1c1a481f..42026e141 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.h +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.h @@ -49,39 +49,24 @@ class QWebFrame; class DumpRenderTreeSupportQt; -namespace WebCore { class DumpRenderTree; -} -class TestRunner : public QObject { +class TestRunnerQt : public QObject { Q_OBJECT Q_PROPERTY(int webHistoryItemCount READ webHistoryItemCount) - Q_PROPERTY(int workerThreadCount READ workerThreadCount) Q_PROPERTY(bool globalFlag READ globalFlag WRITE setGlobalFlag) public: - TestRunner(WebCore::DumpRenderTree*); + TestRunnerQt(DumpRenderTree*); - bool shouldDisallowIncreaseForApplicationCacheQuota() const { return m_disallowIncreaseForApplicationCacheQuota; } - bool shouldDumpAsText() const { return m_textDump; } - bool shouldDumpPixels() const { return m_shouldDumpPixels; } - bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; } - bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; } - bool shouldDumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; } - bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; } - bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; } - bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } + bool shouldDumpAsAudio() const { return m_audioDump; } bool shouldWaitUntilDone() const { return m_waitForDone; } bool shouldHandleErrorPages() const { return m_handleErrorPages; } - bool canOpenWindows() const { return m_canOpenWindows; } - bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } bool waitForPolicy() const { return m_waitForPolicy; } bool ignoreReqestForPermission() const { return m_ignoreDesktopNotification; } - bool isPrinting() { return m_isPrinting; } - void reset(); + const QByteArray& audioData() const { return m_audioData; } - static const unsigned int maxViewWidth; - static const unsigned int maxViewHeight; + void reset(); void setTimeout(int timeout) { m_timeout = timeout; } void setShouldTimeout(bool flag) { m_shouldTimeout = flag; } @@ -98,20 +83,11 @@ Q_SIGNALS: public Q_SLOTS: void maybeDump(bool ok); - void disallowIncreaseForApplicationCacheQuota() { m_disallowIncreaseForApplicationCacheQuota = true; } - void dumpAsText(bool shouldDumpPixels = false); - void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } - void dumpChildFrameScrollPositions() { m_dumpChildFrameScrollPositions = true; } - void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; } - void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; } - void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; } - void setCanOpenWindows() { m_canOpenWindows = true; } - void setPrinting() { m_isPrinting = true; } + void dumpNotifications(); void waitUntilDone(); int webHistoryItemCount(); void keepWebHistory(); void notifyDone(); - void dumpBackForwardList() { m_dumpBackForwardList = true; } bool globalFlag() const { return m_globalFlag; } void setGlobalFlag(bool flag) { m_globalFlag = flag; } void handleErrorPages() { m_handleErrorPages = true; } @@ -128,79 +104,55 @@ public Q_SLOTS: void setWillSendRequestClearHeader(const QStringList& headers); void queueBackNavigation(int howFarBackward); void queueForwardNavigation(int howFarForward); - void queueLoad(const QString& url, const QString& target = QString()); void queueLoadHTMLString(const QString& content, const QString& baseURL = QString(), const QString& failingURL = QString()); void queueReload(); void queueLoadingScript(const QString& script); void queueNonLoadingScript(const QString& script); void provisionalLoad(); - void setCloseRemainingWindowsWhenComplete(bool = false) { } int windowCount(); void ignoreLegacyWebNotificationPermissionRequests(); void simulateLegacyWebNotificationClick(const QString& title); void grantWebNotificationPermission(const QString& origin); void denyWebNotificationPermission(const QString& origin); void removeAllWebNotificationPermissions(); - void simulateWebNotificationClick(const QWebElement&); void display(); void displayInvalidatedRegion(); void clearBackForwardList(); QString pathToLocalResource(const QString& url); - void dumpTitleChanges() { m_dumpTitleChanges = true; } QString encodeHostName(const QString& host); QString decodeHostName(const QString& host); void dumpSelectionRect() const { } void setDeveloperExtrasEnabled(bool); - void setAsynchronousSpellCheckingEnabled(bool); void showWebInspector(); void closeWebInspector(); void evaluateInWebInspector(long callId, const QString& script); void removeAllVisitedLinks(); - void setFrameFlatteningEnabled(bool); void setAllowUniversalAccessFromFileURLs(bool enable); void setAllowFileAccessFromFileURLs(bool enable); void setAppCacheMaximumSize(unsigned long long quota); - void setAutofilled(const QWebElement&, bool enable); void setValueForUser(const QWebElement&, const QString& value); void setFixedContentsSize(int width, int height); void setPrivateBrowsingEnabled(bool); void setSpatialNavigationEnabled(bool); - void setPluginsEnabled(bool flag); void setPopupBlockingEnabled(bool); void setPOSIXLocale(const QString& locale); void resetLoadFinished() { m_loadFinished = false; } void setWindowIsKey(bool); - void setMainFrameIsFirstResponder(bool); void setDeferMainResourceDataLoad(bool); void setJavaScriptCanAccessClipboard(bool enable); void setXSSAuditorEnabled(bool); void setCaretBrowsingEnabled(bool); void setAuthorAndUserStylesEnabled(bool); void setViewModeMediaFeature(const QString& mode); - void setSmartInsertDeleteEnabled(bool); - void setSelectTrailingWhitespaceEnabled(bool); void execCommand(const QString& name, const QString& value = QString()); bool isCommandEnabled(const QString& name) const; - bool findString(const QString&, const QStringList& optionArray); - - bool pauseAnimationAtTimeOnElementWithId(const QString& animationName, double time, const QString& elementId); - bool pauseTransitionAtTimeOnElementWithId(const QString& propertyName, double time, const QString& elementId); - bool elementDoesAutoCompleteForElementWithId(const QString& elementId); - - unsigned numberOfActiveAnimations() const; void addOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); void removeOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); - void dispatchPendingLoadRequests(); - void disableImageLoading(); - void clearAllApplicationCaches(); - void clearApplicationCacheForOrigin(const QString& url); void setApplicationCacheOriginQuota(unsigned long long); QStringList originsWithApplicationCache(); - long long applicationCacheDiskUsageForOrigin(const QString&); - void setCacheModel(int); void setDatabaseQuota(int size); void clearAllDatabases(); @@ -213,15 +165,7 @@ public Q_SLOTS: void setUserStyleSheetLocation(const QString& url); void setUserStyleSheetEnabled(bool); void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); - int workerThreadCount(); bool callShouldCloseOnWebView(); - // For now, this is a no-op. This may change depending on outcome of - // https://bugs.webkit.org/show_bug.cgi?id=33333 - void setCallCloseOnWebViews() { } - // This is a no-op - it allows us to pass - // plugins/get-url-that-the-resource-load-delegate-will-disallow.html - // which is a Mac-specific test. - void addDisallowedURL(const QString&) { } void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); @@ -232,18 +176,6 @@ public Q_SLOTS: bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; } bool geolocationPermission() const { return m_geolocationPermission; } - void addMockSpeechInputResult(const QString& result, double confidence, const QString& language); - void setMockSpeechInputDumpRect(bool flag); - void startSpeechInput(const QString& inputElement); - - void setPageVisibility(const char*); - void resetPageVisibility(); - - void setAutomaticLinkDetectionEnabled(bool); - - // Empty stub method to keep parity with object model exposed by global TestRunner. - void abortModal() { } - void addURLToRedirect(const QString& origin, const QString& destination); /* @@ -252,30 +184,11 @@ public Q_SLOTS: */ void setScrollbarPolicy(const QString& orientation, const QString& policy); - QString markerTextForListItem(const QWebElement& listItem); - QVariantMap computedStyleIncludingVisitedInfo(const QWebElement&) const; - - // Simulate a request an embedding application could make, populating per-session credential storage. - void authenticateSession(const QString& url, const QString& username, const QString& password); - - void evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const QString& script); - void evaluateScriptInIsolatedWorld(int worldID, const QString& script); - void addUserStyleSheet(const QString& sourceCode); - - void setMinimumTimerInterval(double); - - void originsWithLocalStorage(); - void deleteAllLocalStorage(); - void deleteLocalStorageForOrigin(const QString& originIdentifier); - long long localStorageDiskUsageForOrigin(const QString& originIdentifier); - void observeStorageTrackerNotifications(unsigned number); - void syncLocalStorage(); - void setTextDirection(const QString& directionName); - void goBack(); - void setDefersLoading(bool); void setAlwaysAcceptCookies(bool); void setAlwaysBlockCookies(bool); + void setAudioResult(const QByteArray&); + private Q_SLOTS: void processWork(); @@ -284,35 +197,27 @@ private: private: bool m_hasDumped; - bool m_textDump; - bool m_shouldDumpPixels; + bool m_audioDump; bool m_disallowIncreaseForApplicationCacheQuota; - bool m_dumpBackForwardList; - bool m_dumpChildrenAsText; - bool m_dumpChildFrameScrollPositions; bool m_canOpenWindows; bool m_waitForDone; - bool m_dumpTitleChanges; - bool m_dumpDatabaseCallbacks; - bool m_dumpApplicationCacheDelegateCallbacks; - bool m_dumpStatusCallbacks; bool m_waitForPolicy; bool m_handleErrorPages; bool m_loadFinished; bool m_globalFlag; bool m_userStyleSheetEnabled; bool m_isGeolocationPermissionSet; - bool m_isPrinting; bool m_geolocationPermission; QUrl m_userStyleSheetLocation; QBasicTimer m_timeoutTimer; QWebFrame* m_topLoadingFrame; - WebCore::DumpRenderTree* m_drt; + DumpRenderTree* m_drt; QWebHistory* m_webHistory; - QStringList m_desktopNotificationAllowedOrigins; bool m_ignoreDesktopNotification; + QByteArray m_audioData; + bool m_shouldTimeout; int m_timeout; }; diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp index 7cf9fcaf1..2423a3b48 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp @@ -28,7 +28,10 @@ */ #include "config.h" #include "WorkQueueItemQt.h" + +#include "DumpRenderTreeQt.h" #include "DumpRenderTreeSupportQt.h" +#include "JSStringRefQt.h" QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame) { @@ -45,75 +48,80 @@ QWebFrame* findFrameNamed(const QString& frameName, QWebFrame* frame) bool LoadItem::invoke() const { //qDebug() << ">>>LoadItem::invoke"; - Q_ASSERT(m_webPage); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); QWebFrame* frame = 0; - const QString t = target(); - if (t.isEmpty()) - frame = m_webPage->mainFrame(); + if (JSStringGetLength(m_target.get())) + frame = findFrameNamed(JSStringCopyQString(m_target.get()), webPage->mainFrame()); else - frame = findFrameNamed(t, m_webPage->mainFrame()); + frame = webPage->mainFrame(); if (!frame) return false; - frame->load(url()); + frame->load(QUrl(JSStringCopyQString(m_url.get()))); return true; } bool LoadHTMLStringItem::invoke() const { - Q_ASSERT(m_webPage); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); - QWebFrame* frame = m_webPage->mainFrame(); + QWebFrame* frame = webPage->mainFrame(); if (!frame) return false; - frame->setHtml(m_content, QUrl(m_baseURL)); + frame->setHtml(JSStringCopyQString(m_content.get()), QUrl(JSStringCopyQString(m_baseURL.get()))); return true; } bool LoadAlternateHTMLStringItem::invoke() const { - Q_ASSERT(m_webPage); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); - QWebFrame* frame = m_webPage->mainFrame(); + QWebFrame* frame = webPage->mainFrame(); if (!frame) return false; - DumpRenderTreeSupportQt::setAlternateHtml(frame->handle(), m_content, QUrl(m_baseURL), QUrl(m_failingURL)); + DumpRenderTreeSupportQt::setAlternateHtml(frame->handle(), JSStringCopyQString(m_content.get()), QUrl(JSStringCopyQString(m_baseURL.get())), QUrl(JSStringCopyQString(m_failingURL.get()))); return true; } bool ReloadItem::invoke() const { //qDebug() << ">>>ReloadItem::invoke"; - Q_ASSERT(m_webPage); - m_webPage->triggerAction(QWebPage::Reload); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); + webPage->triggerAction(QWebPage::Reload); return true; } bool ScriptItem::invoke() const { //qDebug() << ">>>ScriptItem::invoke"; - Q_ASSERT(m_webPage); - m_webPage->mainFrame()->evaluateJavaScript(script()); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); + webPage->mainFrame()->evaluateJavaScript(JSStringCopyQString(m_script.get())); return true; } bool BackForwardItem::invoke() const { //qDebug() << ">>>BackForwardItem::invoke"; - Q_ASSERT(m_webPage); + WebPage* webPage = DumpRenderTree::instance()->webPage(); + Q_ASSERT(webPage); if (!m_howFar) return false; if (m_howFar > 0) { for (int i = 0; i != m_howFar; ++i) - m_webPage->triggerAction(QWebPage::Forward); + webPage->triggerAction(QWebPage::Forward); } else { for (int i = 0; i != m_howFar; --i) - m_webPage->triggerAction(QWebPage::Back); + webPage->triggerAction(QWebPage::Back); } return true; } diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h index ac7d1b37a..f57abb0e2 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.h +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.h @@ -30,61 +30,14 @@ #ifndef WorkQueueItemQt_h #define WorkQueueItemQt_h -#include <QPointer> -#include <QString> +#include "WorkQueueItem.h" #include <qwebframe.h> #include <qwebpage.h> -class WorkQueueItem { -public: - WorkQueueItem(QWebPage *page) : m_webPage(page) {} - virtual ~WorkQueueItem() { } - virtual bool invoke() const = 0; - -protected: - QPointer<QWebPage> m_webPage; -}; - -class LoadItem : public WorkQueueItem { -public: - LoadItem(const QString &url, const QString &target, QWebPage *page) - : WorkQueueItem(page) - , m_url(url) - , m_target(target) - { - } - - QString url() const { return m_url; } - QString target() const { return m_target; } - - virtual bool invoke() const; - -private: - QString m_url; - QString m_target; -}; - -class LoadHTMLStringItem : public WorkQueueItem { -public: - LoadHTMLStringItem(const QString& content, const QString &baseURL, QWebPage *page) - : WorkQueueItem(page) - , m_content(content) - , m_baseURL(baseURL) - { - } - -private: - virtual bool invoke() const; - - QString m_content; - QString m_baseURL; -}; - class LoadAlternateHTMLStringItem : public WorkQueueItem { public: - LoadAlternateHTMLStringItem(const QString& content, const QString& baseURL, const QString &failingURL, QWebPage *page) - : WorkQueueItem(page) - , m_content(content) + LoadAlternateHTMLStringItem(const JSRetainPtr<JSStringRef>& content, const JSRetainPtr<JSStringRef>& baseURL, const JSRetainPtr<JSStringRef>& failingURL) + : m_content(content) , m_baseURL(baseURL) , m_failingURL(failingURL) { @@ -93,85 +46,9 @@ public: private: virtual bool invoke() const; - QString m_content; - QString m_baseURL; - QString m_failingURL; -}; - -class ReloadItem : public WorkQueueItem { -public: - ReloadItem(QWebPage *page) - : WorkQueueItem(page) - { - } - virtual bool invoke() const; -}; - -class ScriptItem : public WorkQueueItem { -public: - ScriptItem(const QString &script, QWebPage *page) - : WorkQueueItem(page) - , m_script(script) - { - } - - QString script() const { return m_script; } - - virtual bool invoke() const; - -private: - QString m_script; -}; - -class LoadingScriptItem : public ScriptItem { -public: - LoadingScriptItem(const QString& script, QWebPage* page) - : ScriptItem(script, page) - { - } - - virtual bool invoke() const { return ScriptItem::invoke(); } -}; - -class NonLoadingScriptItem : public ScriptItem { -public: - NonLoadingScriptItem(const QString& script, QWebPage* page) - : ScriptItem(script, page) - { - } - - virtual bool invoke() const { ScriptItem::invoke(); return false; } -}; - - -class BackForwardItem : public WorkQueueItem { -public: - virtual bool invoke() const; - -protected: - BackForwardItem(int howFar, QWebPage *page) - : WorkQueueItem(page) - , m_howFar(howFar) - { - } - - int m_howFar; -}; - -class BackItem : public BackForwardItem { -public: - BackItem(unsigned howFar, QWebPage *page) - : BackForwardItem(-howFar, page) - { - } -}; - -class ForwardItem : public BackForwardItem { -public: - ForwardItem(unsigned howFar, QWebPage *page) - : BackForwardItem(howFar, page) - { - } + JSRetainPtr<JSStringRef> m_content; + JSRetainPtr<JSStringRef> m_baseURL; + JSRetainPtr<JSStringRef> m_failingURL; }; #endif // !defined(WorkQueueItemQt_h) diff --git a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp index 995c5f115..d8c89b3c6 100644 --- a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ b/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010, 2013 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,11 +31,15 @@ #include "FrameLoadDelegate.h" #include <JavaScriptCore/JSRetainPtr.h> #include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSStringRefBSTR.h> +#include <WebCore/AccessibilityObjectWrapperWin.h> #include <WebCore/COMPtr.h> #include <WebKit/WebKit.h> +#include <comutil.h> #include <oleacc.h> #include <string> #include <wtf/Assertions.h> +#include <wtf/text/AtomicString.h> using namespace std; @@ -67,9 +71,67 @@ AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) return 0; } +static COMPtr<IAccessibleComparable> comparableObject(const COMPtr<IServiceProvider>& serviceProvider) +{ + COMPtr<IAccessibleComparable> comparable; + serviceProvider->QueryService(SID_AccessibleComparable, __uuidof(IAccessibleComparable), reinterpret_cast<void**>(&comparable)); + return comparable; +} + +static COMPtr<IAccessible> findAccessibleObjectById(AccessibilityUIElement parentObject, BSTR idAttribute) +{ + COMPtr<IAccessible> parentIAccessible = parentObject.platformUIElement(); + + COMPtr<IServiceProvider> serviceProvider(Query, parentIAccessible); + if (!serviceProvider) + return 0; + + COMPtr<IAccessibleComparable> comparable = comparableObject(serviceProvider); + if (!comparable) + return 0; + + VARIANT value; + ::VariantInit(&value); + + _bstr_t elementIdAttributeKey(L"AXDRTElementIdAttribute"); + if (SUCCEEDED(comparable->get_attribute(elementIdAttributeKey, &value))) { + ASSERT(V_VT(&value) == VT_BSTR); + if (VARCMP_EQ == ::VarBstrCmp(value.bstrVal, idAttribute, LOCALE_USER_DEFAULT, 0)) { + ::VariantClear(&value); + return parentIAccessible; + } + } + ::VariantClear(&value); + + long childCount = parentObject.childrenCount(); + if (!childCount) + return 0; + + COMPtr<IAccessible> result; + for (long i = 0; i < childCount; ++i) { + AccessibilityUIElement childAtIndex = parentObject.getChildAtIndex(i); + + result = findAccessibleObjectById(childAtIndex, idAttribute); + if (result) + return result; + } + + return 0; +} + AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id) { - // FIXME: implement + AccessibilityUIElement rootAccessibilityUIElement = rootElement(); + + BSTR idAttribute = JSStringCopyBSTR(id); + + COMPtr<IAccessible> result = findAccessibleObjectById(rootAccessibilityUIElement, idAttribute); + + ::SysFreeString(idAttribute); + + if (result) + return AccessibilityUIElement(result); + return 0; } @@ -280,13 +342,6 @@ static void CALLBACK notificationListenerProc(HWINEVENTHOOK, DWORD event, HWND h VariantClear(&vChild); } -static COMPtr<IAccessibleComparable> comparableObject(const COMPtr<IServiceProvider>& serviceProvider) -{ - COMPtr<IAccessibleComparable> comparable; - serviceProvider->QueryService(SID_AccessibleComparable, __uuidof(IAccessibleComparable), reinterpret_cast<void**>(&comparable)); - return comparable; -} - bool AccessibilityController::addNotificationListener(JSObjectRef functionCallback) { return false; diff --git a/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp index 07c28ac7f..71d9f8b25 100644 --- a/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ b/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,8 @@ #include "DumpRenderTree.h" #include "FrameLoadDelegate.h" #include <JavaScriptCore/JSStringRef.h> +#include <wtf/text/WTFString.h> +#include <comutil.h> #include <tchar.h> #include <string> @@ -81,6 +83,9 @@ void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&) void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children) { + if (!m_element) + return; + long childCount; if (FAILED(m_element->get_accChildCount(&childCount))) return; @@ -90,6 +95,9 @@ void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& childre void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length) { + if (!m_element) + return; + long childCount; unsigned appendedCount = 0; if (FAILED(m_element->get_accChildCount(&childCount))) @@ -100,6 +108,9 @@ void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement> int AccessibilityUIElement::childrenCount() { + if (!m_element) + return 0; + long childCount; m_element->get_accChildCount(&childCount); return childCount; @@ -130,6 +141,9 @@ AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned i AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) { + if (!m_element) + return 0; + COMPtr<IDispatch> child; VARIANT vChild; ::VariantInit(&vChild); @@ -164,11 +178,46 @@ JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() AccessibilityUIElement AccessibilityUIElement::titleUIElement() { - return 0; + COMPtr<IAccessible> platformElement = platformUIElement(); + + COMPtr<IAccessibleComparable> comparable = comparableObject(platformElement.get()); + if (!comparable) + return 0; + + VARIANT value; + ::VariantInit(&value); + + _bstr_t titleUIElementAttributeKey(L"AXTitleUIElementAttribute"); + if (FAILED(comparable->get_attribute(titleUIElementAttributeKey, &value))) { + ::VariantClear(&value); + return 0; + } + + if (V_VT(&value) == VT_EMPTY) { + ::VariantClear(&value); + return 0; + } + + ASSERT(V_VT(&value) == VT_UNKNOWN); + + if (V_VT(&value) != VT_UNKNOWN) { + ::VariantClear(&value); + return 0; + } + + COMPtr<IAccessible> titleElement(Query, value.punkVal); + if (value.punkVal) + value.punkVal->Release(); + ::VariantClear(&value); + + return titleElement; } AccessibilityUIElement AccessibilityUIElement::parentElement() { + if (!m_element) + return 0; + COMPtr<IDispatch> parent; m_element->get_accParent(&parent); @@ -201,6 +250,9 @@ static VARIANT& self() JSStringRef AccessibilityUIElement::role() { + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + VARIANT vRole; if (FAILED(m_element->get_accRole(self(), &vRole))) return JSStringCreateWithCharacters(0, 0); @@ -236,6 +288,9 @@ JSStringRef AccessibilityUIElement::roleDescription() JSStringRef AccessibilityUIElement::title() { + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + BSTR titleBSTR; if (FAILED(m_element->get_accName(self(), &titleBSTR)) || !titleBSTR) return JSStringCreateWithCharacters(0, 0); @@ -246,6 +301,9 @@ JSStringRef AccessibilityUIElement::title() JSStringRef AccessibilityUIElement::description() { + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + BSTR descriptionBSTR; if (FAILED(m_element->get_accDescription(self(), &descriptionBSTR)) || !descriptionBSTR) return JSStringCreateWithCharacters(0, 0); @@ -271,6 +329,9 @@ JSStringRef AccessibilityUIElement::helpText() const double AccessibilityUIElement::x() { + if (!m_element) + return 0; + long x, y, width, height; if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) return 0; @@ -279,6 +340,9 @@ double AccessibilityUIElement::x() double AccessibilityUIElement::y() { + if (!m_element) + return 0; + long x, y, width, height; if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) return 0; @@ -287,6 +351,9 @@ double AccessibilityUIElement::y() double AccessibilityUIElement::width() { + if (!m_element) + return 0; + long x, y, width, height; if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) return 0; @@ -295,6 +362,9 @@ double AccessibilityUIElement::width() double AccessibilityUIElement::height() { + if (!m_element) + return 0; + long x, y, width, height; if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) return 0; @@ -363,6 +433,9 @@ bool AccessibilityUIElement::isExpanded() const bool AccessibilityUIElement::isChecked() const { + if (!m_element) + return false; + VARIANT vState; if (FAILED(m_element->get_accState(self(), &vState))) return false; @@ -377,6 +450,9 @@ JSStringRef AccessibilityUIElement::orientation() const double AccessibilityUIElement::intValue() const { + if (!m_element) + return 0; + BSTR valueBSTR; if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) return 0; @@ -396,7 +472,27 @@ double AccessibilityUIElement::maxValue() return 0; } -bool AccessibilityUIElement::isActionSupported(JSStringRef action) +bool AccessibilityUIElement::isPressActionSupported() +{ + if (!m_element) + return 0; + + BSTR valueBSTR; + if (FAILED(m_element->get_accDefaultAction(self(), &valueBSTR) || !valueBSTR)) + return false; + + if (!::SysStringLen(valueBSTR)) + return false; + + return true; +} + +bool AccessibilityUIElement::isIncrementActionSupported() +{ + return false; +} + +bool AccessibilityUIElement::isDecrementActionSupported() { return false; } @@ -488,7 +584,7 @@ bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigne return false; } -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText) +AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly) { return 0; } @@ -545,13 +641,19 @@ void AccessibilityUIElement::decrement() void AccessibilityUIElement::showMenu() { + if (!m_element) + return; + ASSERT(hasPopup()); m_element->accDoDefaultAction(self()); } void AccessibilityUIElement::press() { - // FIXME: implement + if (!m_element) + return; + + m_element->accDoDefaultAction(self()); } AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) @@ -586,6 +688,9 @@ AccessibilityUIElement AccessibilityUIElement::disclosedByRow() JSStringRef AccessibilityUIElement::accessibilityValue() const { + if (!m_element) + return JSStringCreateWithCharacters(0, 0); + BSTR valueBSTR; if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) return JSStringCreateWithCharacters(0, 0); @@ -684,21 +789,33 @@ bool AccessibilityUIElement::hasPopup() const void AccessibilityUIElement::takeFocus() { + if (!m_element) + return; + m_element->accSelect(SELFLAG_TAKEFOCUS, self()); } void AccessibilityUIElement::takeSelection() { + if (!m_element) + return; + m_element->accSelect(SELFLAG_TAKESELECTION, self()); } void AccessibilityUIElement::addSelection() { + if (!m_element) + return; + m_element->accSelect(SELFLAG_ADDSELECTION, self()); } void AccessibilityUIElement::removeSelection() { + if (!m_element) + return; + m_element->accSelect(SELFLAG_REMOVESELECTION, self()); } diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp index 173f34574..46c528a6d 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp @@ -32,6 +32,7 @@ #include "EditingDelegate.h" #include "FrameLoadDelegate.h" #include "HistoryDelegate.h" +#include "JavaScriptThreading.h" #include "PixelDumpSupport.h" #include "PolicyDelegate.h" #include "ResourceLoadDelegate.h" @@ -45,7 +46,6 @@ #include <fcntl.h> #include <io.h> #include <math.h> -#include <pthread.h> #include <shlwapi.h> #include <stdio.h> #include <string.h> @@ -54,16 +54,13 @@ #include <wtf/Vector.h> #include <windows.h> #include <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/JavaScriptCore.h> +#include <WebCore/FileSystem.h> #include <WebKit/WebKit.h> #include <WebKit/WebKitCOMAPI.h> #if USE(CFNETWORK) -#include <CFNetwork/CFURLCachePriv.h> -#endif - -#if USE(CFNETWORK) #include <CFNetwork/CFHTTPCookiesPriv.h> +#include <CFNetwork/CFURLCachePriv.h> #endif using namespace std; @@ -75,8 +72,13 @@ const LPWSTR TestPluginDir = L"TestNetscapePlugin"; #endif static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS"; +static LPCWSTR dumpRenderTreeTemp = L"DUMPRENDERTREE_TEMP"; #define USE_MAC_FONTS +static CFStringRef WebDatabaseDirectoryDefaultsKey = CFSTR("WebDatabaseDirectory"); +static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache"); +static CFStringRef WebStorageDirectoryDefaultsKey = CFSTR("WebKitLocalStorageDatabasePathPreferenceKey"); + const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow"; static bool dumpTree = true; @@ -136,14 +138,14 @@ bool setAlwaysAcceptCookies(bool alwaysAcceptCookies) static RetainPtr<CFStringRef> substringFromIndex(CFStringRef string, CFIndex index) { - return RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index))); + return adoptCF(CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index))); } wstring urlSuitableForTestResult(const wstring& urlString) { - RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); + RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); - RetainPtr<CFStringRef> scheme(AdoptCF, CFURLCopyScheme(url.get())); + RetainPtr<CFStringRef> scheme = adoptCF(CFURLCopyScheme(url.get())); if (scheme && CFStringCompare(scheme.get(), CFSTR("file"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) return urlString; @@ -161,11 +163,11 @@ wstring urlSuitableForTestResult(const wstring& urlString) if (FAILED(request->URL(requestURLString.GetAddress()))) return urlString; - RetainPtr<CFURLRef> requestURL(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0)); - RetainPtr<CFURLRef> baseURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get())); + RetainPtr<CFURLRef> requestURL = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0)); + RetainPtr<CFURLRef> baseURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get())); - RetainPtr<CFStringRef> basePath(AdoptCF, CFURLCopyPath(baseURL.get())); - RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyPath(url.get())); + RetainPtr<CFStringRef> basePath = adoptCF(CFURLCopyPath(baseURL.get())); + RetainPtr<CFStringRef> path = adoptCF(CFURLCopyPath(url.get())); return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get()); } @@ -175,8 +177,8 @@ wstring lastPathComponent(const wstring& urlString) if (urlString.empty()) return urlString; - RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); - RetainPtr<CFStringRef> lastPathComponent(CFURLCopyLastPathComponent(url.get())); + RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); + RetainPtr<CFStringRef> lastPathComponent = adoptCF(CFURLCopyLastPathComponent(url.get())); return cfStringRefToWString(lastPathComponent.get()); } @@ -192,6 +194,22 @@ static string toUTF8(const wchar_t* wideString, size_t length) return string(utf8Vector.data(), utf8Vector.size() - 1); } +#if USE(CF) +static String libraryPathForDumpRenderTree() +{ + DWORD size = ::GetEnvironmentVariable(dumpRenderTreeTemp, 0, 0); + Vector<TCHAR> buffer(size); + if (::GetEnvironmentVariable(dumpRenderTreeTemp, buffer.data(), buffer.size())) { + wstring path = buffer.data(); + if (!path.empty() && (path[path.length() - 1] != L'\\')) + path.append(L"\\"); + return String (path.data(), path.length()); + } + + return WebCore::localUserSpecificStorageDirectory(); +} +#endif + string toUTF8(BSTR bstr) { return toUTF8(bstr, SysStringLen(bstr)); @@ -528,7 +546,7 @@ static int compareHistoryItems(const void* item1, const void* item2) static void dumpHistoryItem(IWebHistoryItem* item, int indent, bool current) { - assert(item); + ASSERT(item); int start = 0; if (current) { @@ -645,17 +663,17 @@ static void dumpBackForwardList(IWebView* webView) if (FAILED(bfList->itemAtIndex(i, &item))) return; // something is wrong if the item from the last test is in the forward part of the b/f list - assert(item != prevTestBFItem); + ASSERT(item != prevTestBFItem); COMPtr<IUnknown> itemUnknown; item->QueryInterface(&itemUnknown); itemsToPrint.append(itemUnknown); } - + COMPtr<IWebHistoryItem> currentItem; if (FAILED(bfList->currentItem(¤tItem))) return; - assert(currentItem != prevTestBFItem); + ASSERT(currentItem != prevTestBFItem); COMPtr<IUnknown> currentItemUnknown; currentItem->QueryInterface(¤tItemUnknown); itemsToPrint.append(currentItemUnknown); @@ -843,6 +861,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) preferences->setTabsToLinks(FALSE); preferences->setShouldPrintBackgrounds(TRUE); preferences->setLoadsImagesAutomatically(TRUE); + preferences->setSeamlessIFramesEnabled(TRUE); if (persistentUserStyleSheetLocation) { Vector<wchar_t> urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get())); @@ -864,7 +883,6 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> prefsPrivate->setJavaScriptCanAccessClipboard(TRUE); prefsPrivate->setXSSAuditorEnabled(FALSE); - prefsPrivate->setFrameFlatteningEnabled(FALSE); prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); prefsPrivate->setLoadsSiteIconsIgnoringImageLoadingPreference(FALSE); } @@ -899,18 +917,10 @@ static void resetWebViewToConsistentStateBeforeTesting() WebCoreTestSupport::resetInternalsObject(context); } - COMPtr<IWebViewEditing> viewEditing; - if (SUCCEEDED(webView->QueryInterface(&viewEditing))) - viewEditing->setSmartInsertDeleteEnabled(TRUE); - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); if (!webViewPrivate) return; - double minimumInterval = 0; - if (SUCCEEDED(webViewPrivate->defaultMinimumTimerInterval(&minimumInterval))) - webViewPrivate->setMinimumTimerInterval(minimumInterval); - HWND viewWindow; if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) SetFocus(viewWindow); @@ -939,16 +949,85 @@ static void sizeWebViewForCurrentTest() unsigned width; unsigned height; if (isSVGW3CTest) { - width = 480; - height = 360; + width = TestRunner::w3cSVGViewWidth; + height = TestRunner::w3cSVGViewHeight; } else { - width = TestRunner::maxViewWidth; - height = TestRunner::maxViewHeight; + width = TestRunner::viewWidth; + height = TestRunner::viewHeight; } ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); } +static String findFontFallback(const char* pathOrUrl) +{ + String pathToFontFallback = WebCore::directoryName(pathOrUrl); + + wchar_t fullPath[_MAX_PATH]; + if (!_wfullpath(fullPath, pathToFontFallback.charactersWithNullTermination().data(), _MAX_PATH)) + return emptyString(); + + if (!::PathIsDirectoryW(fullPath)) + return emptyString(); + + String pathToCheck = fullPath; + + static const String layoutTests = "LayoutTests"; + + // Find the layout test root on the current path: + size_t location = pathToCheck.find(layoutTests); + if (WTF::notFound == location) + return emptyString(); + + String pathToTest = pathToCheck.substring(location + layoutTests.length() + 1); + String possiblePathToLogue = WebCore::pathByAppendingComponent(pathToCheck.substring(0, location + layoutTests.length() + 1), "platform\\win"); + + Vector<String> possiblePaths; + possiblePaths.append(WebCore::pathByAppendingComponent(possiblePathToLogue, pathToTest)); + + size_t nextCandidateEnd = pathToTest.reverseFind('\\'); + while (nextCandidateEnd && nextCandidateEnd != WTF::notFound) { + pathToTest = pathToTest.substring(0, nextCandidateEnd); + possiblePaths.append(WebCore::pathByAppendingComponent(possiblePathToLogue, pathToTest)); + nextCandidateEnd = pathToTest.reverseFind('\\'); + } + + for (Vector<String>::iterator pos = possiblePaths.begin(); pos != possiblePaths.end(); ++pos) { + pathToFontFallback = WebCore::pathByAppendingComponent(*pos, "resources\\"); + + if (::PathIsDirectoryW(pathToFontFallback.charactersWithNullTermination().data())) + return pathToFontFallback; + } + + return emptyString(); +} + +static void addFontFallbackIfPresent(const String& fontFallbackPath) +{ + if (fontFallbackPath.isEmpty()) + return; + + String fontFallback = WebCore::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); + + if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data())) + return; + + ::setPersistentUserStyleSheetLocation(fontFallback.createCFString().get()); +} + +static void removeFontFallbackIfPresent(const String& fontFallbackPath) +{ + if (fontFallbackPath.isEmpty()) + return; + + String fontFallback = WebCore::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); + + if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data())) + return; + + ::setPersistentUserStyleSheetLocation(0); +} + static void runTest(const string& inputLine) { TestCommand command = parseInputLine(inputLine); @@ -967,6 +1046,8 @@ static void runTest(const string& inputLine) CFRelease(str); + String fallbackPath = findFontFallback(pathOrURL.c_str()); + str = CFURLGetString(url); CFIndex length = CFStringGetLength(str); @@ -982,6 +1063,8 @@ static void runTest(const string& inputLine) done = false; topLoadingFrame = 0; + addFontFallbackIfPresent(fallbackPath); + sizeWebViewForCurrentTest(); gTestRunner->setIconDatabaseEnabled(false); @@ -1073,117 +1156,13 @@ static void runTest(const string& inputLine) } exit: + removeFontFallbackIfPresent(fallbackPath); SysFreeString(urlBStr); ::gTestRunner.clear(); return; } -static Boolean pthreadEqualCallback(const void* value1, const void* value2) -{ - return (Boolean)pthread_equal(*(pthread_t*)value1, *(pthread_t*)value2); -} - -static CFDictionaryKeyCallBacks pthreadKeyCallbacks = { 0, 0, 0, 0, pthreadEqualCallback, 0 }; - -static pthread_mutex_t javaScriptThreadsMutex = PTHREAD_MUTEX_INITIALIZER; -static bool javaScriptThreadsShouldTerminate; - -static const int javaScriptThreadsCount = 4; -static CFMutableDictionaryRef javaScriptThreads() -{ - assert(pthread_mutex_trylock(&javaScriptThreadsMutex) == EBUSY); - static CFMutableDictionaryRef staticJavaScriptThreads; - if (!staticJavaScriptThreads) - staticJavaScriptThreads = CFDictionaryCreateMutable(0, 0, &pthreadKeyCallbacks, 0); - return staticJavaScriptThreads; -} - -// Loops forever, running a script and randomly respawning, until -// javaScriptThreadsShouldTerminate becomes true. -void* runJavaScriptThread(void* arg) -{ - const char* const script = - " \ - var array = []; \ - for (var i = 0; i < 10; i++) { \ - array.push(String(i)); \ - } \ - "; - - while (true) { - JSGlobalContextRef ctx = JSGlobalContextCreate(0); - JSStringRef scriptRef = JSStringCreateWithUTF8CString(script); - - JSValueRef exception = 0; - JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); - assert(!exception); - - JSGlobalContextRelease(ctx); - JSStringRelease(scriptRef); - - JSGarbageCollect(ctx); - - pthread_mutex_lock(&javaScriptThreadsMutex); - - // Check for cancellation. - if (javaScriptThreadsShouldTerminate) { - pthread_mutex_unlock(&javaScriptThreadsMutex); - return 0; - } - - // Respawn probabilistically. - if (rand() % 5 == 0) { - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - - pthread_t self = pthread_self(); - CFDictionaryRemoveValue(javaScriptThreads(), self.p); - CFDictionaryAddValue(javaScriptThreads(), pthread.p, 0); - - pthread_mutex_unlock(&javaScriptThreadsMutex); - return 0; - } - - pthread_mutex_unlock(&javaScriptThreadsMutex); - } -} - -static void startJavaScriptThreads(void) -{ - pthread_mutex_lock(&javaScriptThreadsMutex); - - for (int i = 0; i < javaScriptThreadsCount; i++) { - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - CFDictionaryAddValue(javaScriptThreads(), pthread.p, 0); - } - - pthread_mutex_unlock(&javaScriptThreadsMutex); -} - -static void stopJavaScriptThreads(void) -{ - pthread_mutex_lock(&javaScriptThreadsMutex); - - javaScriptThreadsShouldTerminate = true; - - pthread_t* pthreads[javaScriptThreadsCount] = {0}; - int threadDictCount = CFDictionaryGetCount(javaScriptThreads()); - assert(threadDictCount == javaScriptThreadsCount); - CFDictionaryGetKeysAndValues(javaScriptThreads(), (const void**)pthreads, 0); - - pthread_mutex_unlock(&javaScriptThreadsMutex); - - for (int i = 0; i < javaScriptThreadsCount; i++) { - pthread_t* pthread = pthreads[i]; - pthread_join(*pthread, 0); - free(pthread); - } -} - Vector<HWND>& openWindows() { static Vector<HWND> vector; @@ -1198,8 +1177,8 @@ WindowToWebViewMap& windowToWebViewMap() IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) { - unsigned maxViewWidth = TestRunner::maxViewWidth; - unsigned maxViewHeight = TestRunner::maxViewHeight; + unsigned maxViewWidth = TestRunner::viewWidth; + unsigned maxViewHeight = TestRunner::viewHeight; HWND hostWindow = CreateWindowEx(WS_EX_TOOLWINDOW, kDumpRenderTreeClassName, TEXT("DumpRenderTree"), WS_POPUP, -maxViewWidth, -maxViewHeight, maxViewWidth, maxViewHeight, 0, 0, GetModuleHandle(0), 0); @@ -1286,7 +1265,7 @@ RetainPtr<CFURLCacheRef> sharedCFURLCache() typedef CFURLCacheRef (*CFURLCacheCopySharedURLCacheProcPtr)(void); if (CFURLCacheCopySharedURLCacheProcPtr copyCache = reinterpret_cast<CFURLCacheCopySharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheCopySharedURLCache"))) - return RetainPtr<CFURLCacheRef>(AdoptCF, copyCache()); + return adoptCF(copyCache()); typedef CFURLCacheRef (*CFURLCacheSharedURLCacheProcPtr)(void); if (CFURLCacheSharedURLCacheProcPtr sharedCache = reinterpret_cast<CFURLCacheSharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheSharedURLCache"))) @@ -1370,6 +1349,7 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, cons standardPreferences->setJavaScriptEnabled(TRUE); standardPreferences->setDefaultFontSize(16); standardPreferences->setAcceleratedCompositingEnabled(true); + standardPreferences->setAVFoundationEnabled(TRUE); standardPreferences->setContinuousSpellCheckingEnabled(TRUE); if (printSupportedFeatures) { @@ -1389,6 +1369,14 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, cons return 0; } +#if USE(CF) + // Set up these values before creating the WebView so that the various initializations will see these preferred values. + String path = libraryPathForDumpRenderTree(); + CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "Databases").createCFString().get(), kCFPreferencesCurrentApplication); + CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalStorage").createCFString().get(), kCFPreferencesCurrentApplication); + CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalCache").createCFString().get(), kCFPreferencesCurrentApplication); +#endif + COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow)); if (!webView) return -1; diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj deleted file mode 100644 index dc815e990..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj +++ /dev/null @@ -1,760 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTree"
- ProjectGUID="{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
- RootNamespace="DumpRenderTree"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeDebug.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeRelease.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeDebugCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeReleaseCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeDebugAll.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Production|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\DumpRenderTreeProduction.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Controllers"
- >
- <File
- RelativePath="..\AccessibilityController.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityController.h"
- >
- </File>
- <File
- RelativePath=".\AccessibilityControllerWin.cpp"
- >
- </File>
- <File
- RelativePath=".\DRTDataObject.cpp"
- >
- </File>
- <File
- RelativePath=".\DRTDataObject.h"
- >
- </File>
- <File
- RelativePath=".\DRTDropSource.cpp"
- >
- </File>
- <File
- RelativePath=".\DRTDropSource.h"
- >
- </File>
- <File
- RelativePath=".\EventSender.cpp"
- >
- </File>
- <File
- RelativePath=".\EventSender.h"
- >
- </File>
- <File
- RelativePath="..\GCController.cpp"
- >
- </File>
- <File
- RelativePath="..\GCController.h"
- >
- </File>
- <File
- RelativePath=".\GCControllerWin.cpp"
- >
- </File>
- <File
- RelativePath="..\TestRunner.cpp"
- >
- </File>
- <File
- RelativePath="..\TestRunner.h"
- >
- </File>
- <File
- RelativePath=".\TestRunnerWin.cpp"
- >
- </File>
- <File
- RelativePath=".\TextInputController.cpp"
- >
- </File>
- <File
- RelativePath=".\TextInputController.h"
- >
- </File>
- <File
- RelativePath=".\TextInputControllerWin.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Delegates"
- >
- <File
- RelativePath=".\DRTDesktopNotificationPresenter.cpp"
- >
- </File>
- <File
- RelativePath=".\DRTDesktopNotificationPresenter.h"
- >
- </File>
- <File
- RelativePath=".\EditingDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\EditingDelegate.h"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.h"
- >
- </File>
- <File
- RelativePath=".\HistoryDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\HistoryDelegate.h"
- >
- </File>
- <File
- RelativePath=".\PolicyDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\PolicyDelegate.h"
- >
- </File>
- <File
- RelativePath=".\ResourceLoadDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\ResourceLoadDelegate.h"
- >
- </File>
- <File
- RelativePath=".\UIDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\UIDelegate.h"
- >
- </File>
- </Filter>
- <File
- RelativePath="..\AccessibilityTextMarker.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityTextMarker.h"
- >
- </File>
- <File
- RelativePath="..\AccessibilityUIElement.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityUIElement.h"
- >
- </File>
- <File
- RelativePath=".\AccessibilityUIElementWin.cpp"
- >
- </File>
- <File
- RelativePath="..\CyclicRedundancyCheck.cpp"
- >
- </File>
- <File
- RelativePath="..\CyclicRedundancyCheck.h"
- >
- </File>
- <File
- RelativePath=".\DraggingInfo.h"
- >
- </File>
- <File
- RelativePath=".\DumpRenderTree.cpp"
- >
- </File>
- <File
- RelativePath="..\DumpRenderTree.h"
- >
- </File>
- <File
- RelativePath="..\DumpRenderTreeCommon.cpp"
- >
- </File>
- <File
- RelativePath="..\DumpRenderTreePrefix.h"
- >
- </File>
- <File
- RelativePath=".\DumpRenderTreeWin.h"
- >
- </File>
- <File
- RelativePath=".\MD5.cpp"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\MD5.h"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\PixelDumpSupport.cpp"
- >
- </File>
- <File
- RelativePath="..\PixelDumpSupport.h"
- >
- </File>
- <File
- RelativePath="..\cairo\PixelDumpSupportCairo.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Production|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cairo\PixelDumpSupportCairo.h"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Production|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.cpp"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.h"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\PixelDumpSupportWin.cpp"
- >
- </File>
- <File
- RelativePath="..\WorkQueue.cpp"
- >
- </File>
- <File
- RelativePath="..\WorkQueue.h"
- >
- </File>
- <File
- RelativePath="..\WorkQueueItem.h"
- >
- </File>
- <File
- RelativePath=".\WorkQueueItemWin.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeApple.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeApple.vsprops deleted file mode 100644 index a6db765d2..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeApple.vsprops +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeApple"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..\cg";"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops deleted file mode 100644 index 7e47f38b2..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCFLite"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CFLite$(LibraryConfigSuffix).lib"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops deleted file mode 100644 index 6a6c284f8..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCairo"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..\cairo";"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="cairo.lib"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops deleted file mode 100644 index 3ecfef70d..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ConfigurationBuildDir)\Include";"$(ConfigurationBuildDir)\Include\private";"$(ConfigurationBuildDir)\Include\DumpRenderTree\ForwardingHeaders";"$(ConfigurationBuildDir)\Include\JavaScriptCore";"$(ConfigurationBuildDir)\Include\private\JavaScriptCore";"$(ConfigurationBuildDir)\Include\WebCoreTestSupport";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\include\pthreads";"$(ConfigurationBuildDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore""
- PreprocessorDefinitions="_CONSOLE"
- DisableSpecificWarnings="4146"
- ForcedIncludeFiles="DumpRenderTreePrefix.h"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WebCoreTestSupport$(WebKitConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib comsuppw.lib"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).dll"
- SubSystem="1"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops deleted file mode 100644 index a5b3fb743..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeDebug.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeDebug"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops deleted file mode 100644 index e09177ceb..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeDebugAll.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeDebugAll"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops deleted file mode 100644 index b4db6ad14..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeDebugCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeDebugCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncher.vcproj b/Tools/DumpRenderTree/win/DumpRenderTreeLauncher.vcproj deleted file mode 100644 index f4d0c0f16..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncher.vcproj +++ /dev/null @@ -1,402 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncher"
- ProjectGUID="{2974EA02-840B-4995-8719-8920A61006F1}"
- RootNamespace="DumpRenderTreeLauncher"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherDebug.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherRelease.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherDebugCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherDebugAll.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Production|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherProduction.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\DumpRenderTreeLauncherReleaseCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/SAFESEH"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\win\DLLLauncher\DLLLauncherMain.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherCommon.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherCommon.vsprops deleted file mode 100644 index f1789164b..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherCommon.vsprops +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="USE_CONSOLE_ENTRY_POINT"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="shlwapi.lib"
- OutputFile="$(OutDir)\DumpRenderTree$(WebKitConfigSuffix).exe"
- ProgramDatabaseFile="$(TargetDir)$(TargetName)Launcher.pdb"
- SubSystem="1"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebug.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebug.vsprops deleted file mode 100644 index 4ea157893..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebug.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherDebug"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugAll.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugAll.vsprops deleted file mode 100644 index 4605d79d2..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugAll.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherDebugAll"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugCairoCFLite.vsprops deleted file mode 100644 index 0e8487f0e..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherDebugCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeDebugCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherProduction.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherProduction.vsprops deleted file mode 100644 index 7dd6266a8..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherProduction.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherProduction"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherRelease.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherRelease.vsprops deleted file mode 100644 index 6e2c85c56..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherRelease.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherRelease"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeLauncherReleaseCairoCFLite.vsprops deleted file mode 100644 index 615fd560c..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeLauncherReleaseCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeLauncherReleaseCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreePostBuild.cmd b/Tools/DumpRenderTree/win/DumpRenderTreePostBuild.cmd deleted file mode 100644 index 464502c21..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreePostBuild.cmd +++ /dev/null @@ -1,62 +0,0 @@ -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" - -if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b) - -mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\bin" - -if not exist "%WEBKITLIBRARIESDIR%\bin\CoreFoundation%LIBRARYCONFIGSUFFIX%.dll" GOTO:CFLITE - -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreFoundation%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreFoundation%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreVideo%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreVideo%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CFNetwork%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CFNetwork%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d /e /i "%WEBKITLIBRARIESDIR%\bin\CFNetwork.resources" "%CONFIGURATIONBUILDDIR%\bin\CFNetwork.resources" -xcopy /y /d /e /i "%WEBKITLIBRARIESDIR%\bin\CoreFoundation.resources" "%CONFIGURATIONBUILDDIR%\bin\CoreFoundation.resources" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreGraphics%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreGraphics%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icudt40.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt40.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icudt40%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.pdb"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.pdb"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icudt42.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt42.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icudt42%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.pdb"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.dll"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.pdb"xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libxml2%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libxslt%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\SQLite3%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\SQLite3%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\zlib1%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\zlib1%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -exit /b - -:CFLITE -if not exist "%WEBKITLIBRARIESDIR%\bin\CFLite%LIBRARYCONFIGSUFFIX%.dll" exit /b - -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CFLite%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CFLite%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d /e /i "%WEBKITLIBRARIESDIR%\bin\CFLite.resources" "%CONFIGURATIONBUILDDIR%\bin\CFLite.resources" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libcurl.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libeay32.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\ssleay32.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\cairo.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt46.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libicuuc.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libicuin.dll" "%CONFIGURATIONBUILDDIR%\bin" - -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libxml2%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libxslt%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.pdb" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\SQLite3%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\SQLite3%LIBRARYCONFIGSUFFIX%.pdb" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\SQLite3%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" -xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\zlib1%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin" -if exist "%WEBKITLIBRARIESDIR%\bin\zlib1%LIBRARYCONFIGSUFFIX%.pdb" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\zlib1%LIBRARYCONFIGSUFFIX%.pdb" "%CONFIGURATIONBUILDDIR%\bin" diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops deleted file mode 100644 index 70d039e52..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeProduction.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeProduction"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops deleted file mode 100644 index 4182d56a4..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeRelease.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeRelease"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops deleted file mode 100644 index 113ce4620..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeReleaseCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeReleaseCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiff.vcproj b/Tools/DumpRenderTree/win/ImageDiff.vcproj deleted file mode 100644 index 997453841..000000000 --- a/Tools/DumpRenderTree/win/ImageDiff.vcproj +++ /dev/null @@ -1,452 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiff"
- ProjectGUID="{59CC0547-70AC-499C-9B19-EC01C6F61137}"
- RootNamespace="ImageDiff"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffDebug.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffRelease.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffDebugAll.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffDebugCairoCFLite.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Production|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffProduction.vsprops"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="2"
- InheritedPropertySheets=".\ImageDiffReleaseCairoCFLite.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\win\ImageDiffCairo.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Production|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cg\ImageDiffCG.cpp"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\ImageDiffWin.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp index d10cc14c6..d5a81b495 100644 --- a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp +++ b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp @@ -73,7 +73,7 @@ static cairo_status_t readFromData(void* closure, unsigned char* data, unsigned static cairo_surface_t* createImageFromStdin(int bytesRemaining) { unsigned char buffer[s_bufferSize]; - RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, bytesRemaining)); + RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining)); while (bytesRemaining > 0) { size_t bytesToRead = min(bytesRemaining, s_bufferSize); @@ -235,7 +235,7 @@ int main(int argc, const char* argv[]) if (difference > 0.0) { if (diffImage) { - RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0)); + RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0)); cairo_surface_write_to_png_stream(diffImage, (cairo_write_func_t)writeToData, imageData.get()); printf("Content-Length: %lu\n", CFDataGetLength(imageData.get())); fwrite(CFDataGetBytePtr(imageData.get()), 1, CFDataGetLength(imageData.get()), stdout); diff --git a/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops b/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops deleted file mode 100644 index 58af6193c..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private""
- PreprocessorDefinitions="NOMINMAX"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).dll"
- SubSystem="1"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops deleted file mode 100644 index acc0d148b..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffDebug.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffDebug"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\ImageDiffCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops deleted file mode 100644 index ffe75acd8..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffDebugAll.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffDebugAll"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\ImageDiffCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops deleted file mode 100644 index cd813ef06..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffDebugCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffDebugCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\ImageDiffWinCairoCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncher.vcproj b/Tools/DumpRenderTree/win/ImageDiffLauncher.vcproj deleted file mode 100644 index 46fce5b70..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncher.vcproj +++ /dev/null @@ -1,396 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncher"
- ProjectGUID="{DD7949B6-F2B4-47C2-9C42-E21E84CB1017}"
- RootNamespace="ImageDiffLauncher"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherDebug.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherRelease.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherDebugCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherDebugAll.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Production|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherProduction.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\ImageDiffLauncherReleaseCairoCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\win\DLLLauncher\DLLLauncherMain.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherCommon.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherCommon.vsprops deleted file mode 100644 index 2b9b1613a..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherCommon.vsprops +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="USE_CONSOLE_ENTRY_POINT"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="shlwapi.lib"
- OutputFile="$(OutDir)\ImageDiff$(WebKitConfigSuffix).exe"
- ProgramDatabaseFile="$(TargetDir)$(TargetName)Launcher.pdb"
- SubSystem="1"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherDebug.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherDebug.vsprops deleted file mode 100644 index 3bfcbd72a..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherDebug.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherDebug"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherDebugAll.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherDebugAll.vsprops deleted file mode 100644 index 7a96c06ec..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherDebugAll.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherDebugAll"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherDebugCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherDebugCairoCFLite.vsprops deleted file mode 100644 index 6de4e2af8..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherDebugCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffDebugCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherProduction.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherProduction.vsprops deleted file mode 100644 index 0a02fb22d..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherProduction.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherProduction"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherRelease.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherRelease.vsprops deleted file mode 100644 index eba5d5e41..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherRelease.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherRelease"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffLauncherReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffLauncherReleaseCairoCFLite.vsprops deleted file mode 100644 index 16b95fe95..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffLauncherReleaseCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffLauncherReleaseCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffLauncherCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops b/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops deleted file mode 100644 index 89173896a..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffProduction.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffProduction"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\ImageDiffCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops b/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops deleted file mode 100644 index 0300592a8..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffRelease.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffRelease"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops b/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops deleted file mode 100644 index 1b7215416..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffReleaseCairoCFLite.vsprops +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffReleaseCairoCFLite"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\ImageDiffWinCairoCommon.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops b/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops deleted file mode 100644 index 1e2a7d4da..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffWinCairoCommon.vsprops +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\private\JavaScriptCore";"$(ConfigurationBuildDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private""
- PreprocessorDefinitions="NOMINMAX"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib cairo$(LibraryConfigSuffix).lib libjpeg.lib libpng$(LibraryConfigSuffix).lib zdll.lib Msimg32.lib CFLite$(LibraryConfigSuffix).lib"
- SubSystem="1"
- />
-</VisualStudioPropertySheet>
diff --git a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp index 10ca5163f..f2025c66b 100644 --- a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ b/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp @@ -85,7 +85,7 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc makeAlphaChannelOpaque(info.bmBits, info.bmWidth, info.bmHeight); #if USE(CG) - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB()); CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); #elif USE(CAIRO) diff --git a/Tools/DumpRenderTree/win/TestRunnerWin.cpp b/Tools/DumpRenderTree/win/TestRunnerWin.cpp index 3e48ade65..f1a2b2b03 100644 --- a/Tools/DumpRenderTree/win/TestRunnerWin.cpp +++ b/Tools/DumpRenderTree/win/TestRunnerWin.cpp @@ -137,19 +137,6 @@ JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) return 0; } -void TestRunner::disableImageLoading() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setLoadsImagesAutomatically(FALSE); -} - void TestRunner::dispatchPendingLoadRequests() { // FIXME: Implement for testing fix for 6727495 @@ -173,39 +160,6 @@ void TestRunner::keepWebHistory() history->setOptionalSharedHistory(sharedHistory.get()); } -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - // FIXME: Implement this. - return JSValueMakeUndefined(context); -} - -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return 0; - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return 0; - - COMPtr<IDOMElement> element; - if (FAILED(webViewPrivate->elementFromJS(context, nodeObject, &element))) - return 0; - - COMPtr<IDOMElementPrivate> elementPrivate(Query, element); - if (!elementPrivate) - return 0; - - BSTR textBSTR = 0; - if (FAILED(elementPrivate->markerTextForListItem(&textBSTR))) - return 0; - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithBSTR(textBSTR)); - SysFreeString(textBSTR); - return markerText; -} - void TestRunner::waitForPolicyDelegate() { COMPtr<IWebView> webView; @@ -238,17 +192,6 @@ size_t TestRunner::webHistoryItemCount() return count; } -unsigned TestRunner::workerThreadCount() const -{ - COMPtr<IWebWorkersPrivate> workers; - if (FAILED(WebKitCreateInstance(CLSID_WebWorkersPrivate, 0, __uuidof(workers), reinterpret_cast<void**>(&workers)))) - return 0; - unsigned count; - if (FAILED(workers->workerThreadCount(&count))) - return 0; - return count; -} - JSRetainPtr<JSStringRef> TestRunner::platformName() const { JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("win")); @@ -359,27 +302,6 @@ void TestRunner::setAuthorAndUserStylesEnabled(bool flag) prefsPrivate->setAuthorAndUserStylesEnabled(flag); } -void TestRunner::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return; - - COMPtr<IDOMElement> element; - if (FAILED(webViewPrivate->elementFromJS(context, nodeObject, &element))) - return; - - COMPtr<IFormsAutoFillTransition> autofillElement(Query, element); - if (!autofillElement) - return; - - autofillElement->setAutofilled(autofilled); -} - void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) { COMPtr<IWebView> webView; @@ -489,23 +411,6 @@ void TestRunner::setXSSAuditorEnabled(bool enabled) prefsPrivate->setXSSAuditorEnabled(enabled); } -void TestRunner::setFrameFlatteningEnabled(bool enabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); - if (!prefsPrivate) - return; - - prefsPrivate->setFrameFlatteningEnabled(enabled); -} - void TestRunner::setSpatialNavigationEnabled(bool enabled) { // FIXME: Implement for SpatialNavigation layout tests. @@ -728,13 +633,13 @@ void TestRunner::setUserStyleSheetLocation(JSStringRef jsURL) if (FAILED(webView->preferences(&preferences))) return; - RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); - RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, urlString.get(), 0)); + RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); + RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(0, urlString.get(), 0)); if (!url) return; // Now copy the file system path, POSIX style. - RetainPtr<CFStringRef> pathCF(AdoptCF, CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle)); + RetainPtr<CFStringRef> pathCF = adoptCF(CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle)); if (!pathCF) return; @@ -792,7 +697,7 @@ void TestRunner::setViewModeMediaFeature(JSStringRef mode) void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) { - RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); + RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); ::setPersistentUserStyleSheetLocation(urlString.get()); } @@ -818,32 +723,6 @@ void TestRunner::setWindowIsKey(bool flag) ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0); } -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - viewEditing->setSmartInsertDeleteEnabled(flag ? TRUE : FALSE); -} - -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - viewEditing->setSelectTrailingWhitespaceEnabled(flag ? TRUE : FALSE); -} - static const CFTimeInterval waitToDumpWatchdogInterval = 30.0; static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD) @@ -863,32 +742,6 @@ int TestRunner::windowCount() return openWindows().size(); } -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - wstring idWstring = jsStringRefToWString(id); - BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); - COMPtr<IDOMElement> element; - HRESULT result = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - - if (FAILED(result)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BOOL autoCompletes; - if (FAILED(framePrivate->elementDoesAutoComplete(element.get(), &autoCompletes))) - return false; - - return autoCompletes; -} - void TestRunner::execCommand(JSStringRef name, JSStringRef value) { wstring wName = jsStringRefToWString(name); @@ -1026,69 +879,6 @@ void TestRunner::setAppCacheMaximumSize(unsigned long long size) printf("ERROR: TestRunner::setAppCacheMaximumSize() not implemented\n"); } -bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(elementId); - 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 nameBSTR = JSStringCopyBSTR(animationName); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseAnimation(nameBSTR, element.get(), time, &wasRunning); - SysFreeString(nameBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(elementId); - 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 nameBSTR = JSStringCopyBSTR(propertyName); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseTransition(nameBSTR, element.get(), time, &wasRunning); - SysFreeString(nameBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return 0; - - UINT number = 0; - if (FAILED(framePrivate->numberOfActiveAnimations(&number))) - return 0; - - return number; -} - static _bstr_t bstrT(JSStringRef jsString) { // The false parameter tells the _bstr_t constructor to adopt the BSTR we pass it. @@ -1162,11 +952,6 @@ void TestRunner::setDeveloperExtrasEnabled(bool enabled) prefsPrivate->setDeveloperExtrasEnabled(enabled); } -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - // FIXME: Implement this. -} - void TestRunner::showWebInspector() { COMPtr<IWebView> webView; @@ -1357,19 +1142,6 @@ void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) // FIXME: Implement. } -void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - viewPrivate->setMinimumTimerInterval(minimumTimerInterval); -} - void TestRunner::setTextDirection(JSStringRef direction) { COMPtr<IWebFramePrivate> framePrivate(Query, frame); @@ -1431,17 +1203,12 @@ void TestRunner::setAutomaticLinkDetectionEnabled(bool) // FIXME: Implement this. } -void TestRunner::sendWebIntentResponse(JSStringRef) -{ - // FIXME: Implement this. -} - -void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) +void TestRunner::setStorageDatabaseIdleInterval(double) { // FIXME: Implement this. } -void TestRunner::setStorageDatabaseIdleInterval(double) +void TestRunner::closeIdleLocalStorageDatabases() { // FIXME: Implement this. } diff --git a/Tools/DumpRenderTree/wscript b/Tools/DumpRenderTree/wscript deleted file mode 100644 index b1a0356fa..000000000 --- a/Tools/DumpRenderTree/wscript +++ /dev/null @@ -1,67 +0,0 @@ -#! /usr/bin/env python - -# Copyright (C) 2009 Kevin Ollivier All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# wxBrowser sample app build script for the waf build system - -import sys - -from settings import * - -include_paths = [ - os.path.join(output_dir), - os.path.join(wk_root, 'Source', 'JavaScriptCore'), - os.path.join(wk_root, 'Source', 'WTF'), - os.path.join(wk_root, 'Source', 'WebCore'), - os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'wx'), - os.path.join(wk_root, 'Source', 'WebKit', 'wx'), - '.', - 'wx' - ] -sources = [ - 'DumpRenderTreeCommon.cpp', - 'TestRunner.cpp', - 'WorkQueue.cpp', - 'wx/DumpRenderTreeWx.cpp', - 'wx/TestRunnerWx.cpp', - 'wx/WorkQueueItemWx.cpp' - ] - -def set_options(opt): - common_set_options(opt) - -def configure(conf): - common_configure(conf) - -def build(bld): - obj = bld.new_task_gen( - features = 'cxx cprogram', - includes = ' '.join(include_paths), - source = sources, - target = 'DumpRenderTree', - uselib = 'ICU WX ' + get_config(), - libpath = [output_dir], - uselib_local = 'jscore wxwebkit', - install_path = output_dir) - diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp deleted file mode 100644 index cadecaf8f..000000000 --- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "DumpRenderTree.h" - -#include "TestRunner.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" - -#include <JavaScriptCore/JavaScript.h> - -#include <wx/wx.h> -#include "WebView.h" -#include "WebFrame.h" -#include "WebBrowserShell.h" - -#include <wtf/Assertions.h> - -#include <cassert> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -volatile bool done = true; -volatile bool notified = false; -static bool printSeparators = true; -static int dumpPixelsForAllTests = false; -static int dumpPixelsForCurrentTest; -static int dumpTree = 1; -time_t startTime; // to detect timeouts / failed tests - -using namespace std; -using namespace WebKit; - -FILE* logOutput; - -RefPtr<TestRunner> gTestRunner; -static WebView* webView; -static wxTimer* idleTimer; - -const unsigned timeOut = 10; -const unsigned maxViewHeight = 600; -const unsigned maxViewWidth = 800; - -class LayoutWebViewEventHandler : public wxEvtHandler { - -public: - LayoutWebViewEventHandler(WebView* webView) - : m_webView(webView) - { - } - - void bindEvents() - { - m_webView->Connect(wxEVT_WEBVIEW_LOAD, WebViewLoadEventHandler(LayoutWebViewEventHandler::OnLoadEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_JS_ALERT, WebViewAlertEventHandler(LayoutWebViewEventHandler::OnAlertEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_JS_CONFIRM, WebViewConfirmEventHandler(LayoutWebViewEventHandler::OnConfirmEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_JS_PROMPT, WebViewPromptEventHandler(LayoutWebViewEventHandler::OnPromptEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_CONSOLE_MESSAGE, WebViewConsoleMessageEventHandler(LayoutWebViewEventHandler::OnConsoleMessageEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_RECEIVED_TITLE, WebViewReceivedTitleEventHandler(LayoutWebViewEventHandler::OnReceivedTitleEvent), 0, this); - m_webView->Connect(wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, WebViewWindowObjectClearedEventHandler(LayoutWebViewEventHandler::OnWindowObjectClearedEvent), 0, this); - } - - void OnLoadEvent(WebViewLoadEvent& event) - { - - if (event.GetState() == WEBVIEW_LOAD_FAILED || event.GetState() == WEBVIEW_LOAD_STOPPED) - done = true; - - if (event.GetState() == WEBVIEW_LOAD_ONLOAD_HANDLED) { - done = true; - - if (!gTestRunner->waitToDump() || notified) { - dump(); - } - } - } - - void OnAlertEvent(WebViewAlertEvent& event) - { - wxFprintf(stdout, "ALERT: %S\n", event.GetMessage()); - } - - void OnConfirmEvent(WebViewConfirmEvent& event) - { - wxFprintf(stdout, "CONFIRM: %S\n", event.GetMessage()); - event.SetReturnCode(1); - } - - void OnPromptEvent(WebViewPromptEvent& event) - { - wxFprintf(stdout, "PROMPT: %S, default text: %S\n", event.GetMessage(), event.GetResponse()); - event.SetReturnCode(1); - } - - void OnConsoleMessageEvent(WebViewConsoleMessageEvent& event) - { - fprintf(stdout, "CONSOLE MESSAGE: "); - if (event.GetLineNumber()) - fprintf(stdout, "line %d: ", event.GetLineNumber()); - wxFprintf(stdout, "%S\n", event.GetMessage()); - } - - void OnReceivedTitleEvent(WebViewReceivedTitleEvent& event) - { - if (gTestRunner->dumpTitleChanges() && !done) - wxFprintf(stdout, "TITLE CHANGED: '%S'\n", event.GetTitle()); - } - - void OnWindowObjectClearedEvent(WebViewWindowObjectClearedEvent& event) - { - JSValueRef exception = 0; - gTestRunner->makeWindowObject(event.GetJSContext(), event.GetWindowObject(), &exception); - } - -private: - WebView* m_webView; - -}; - -void notifyDoneFired() -{ - notified = true; - if (done) - dump(); -} - -LayoutWebViewEventHandler* eventHandler = 0; - -static wxString dumpFramesAsText(WebFrame* frame) -{ - // TODO: implement this. leaving this here so we don't forget this case. - if (gTestRunner->dumpChildFramesAsText()) { - } - - return frame->GetInnerText(); -} - -void dump() -{ - if (!done) - return; - - if (gTestRunner->waitToDump() && !notified) - return; - - if (dumpTree) { - const char* result = 0; - - bool dumpAsText = gTestRunner->dumpAsText(); - wxString str; - if (gTestRunner->dumpAsText()) - str = dumpFramesAsText(webView->GetMainFrame()); - else - str = webView->GetMainFrame()->GetExternalRepresentation(); - - result = str.ToUTF8(); - if (!result) { - const char* errorMessage; - if (gTestRunner->dumpAsText()) - errorMessage = "WebFrame::GetInnerText"; - else - errorMessage = "WebFrame::GetExternalRepresentation"; - printf("ERROR: 0 result from %s", errorMessage); - } else { - printf("%s\n", result); - } - - if (gTestRunner->dumpBackForwardList()) { - // FIXME: not implemented - } - - if (printSeparators) { - puts("#EOF"); - fputs("#EOF\n", stderr); - fflush(stdout); - fflush(stderr); - } - } - - if (dumpPixelsForCurrentTest - && gTestRunner->generatePixelResults() - && !gTestRunner->dumpDOMAsWebArchive() - && !gTestRunner->dumpSourceAsWebArchive()) { - // FIXME: Add support for dumping pixels - fflush(stdout); - } - - puts("#EOF"); - fflush(stdout); - fflush(stderr); - - gTestRunner.clear(); -} - -static void runTest(const wxString inputLine) -{ - done = false; - time(&startTime); - - TestCommand command = parseInputLine(std::string(inputLine.ToAscii())); - string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; - - // CURL isn't happy if we don't have a protocol. - size_t http = pathOrURL.find("http://"); - if (http == string::npos) - pathOrURL.insert(0, "file://"); - - gTestRunner = TestRunner::create(pathOrURL, command.expectedPixelHash); - if (!gTestRunner) { - wxTheApp->ExitMainLoop(); - } - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - webView->LoadURL(wxString(pathOrURL.c_str(), wxConvUTF8)); - - // wait until load completes and the results are dumped - while (!done) - wxSafeYield(); -} - -class MyApp : public wxApp -{ -public: - - virtual bool OnInit(); - -private: - wxLog* logger; -}; - - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit() -{ - logOutput = fopen("output.txt", "ab"); - if (logOutput) { - logger = new wxLogStderr(logOutput); - wxLog::SetActiveTarget(logger); - } - - wxLogMessage(wxT("Starting DumpRenderTool, %d args.\n"), argc); - - for (int i = 1; i < argc; ++i) { - wxString option = wxString(argv[i]); - if (!option.CmpNoCase(_T("--notree"))) { - dumpTree = false; - continue; - } - - if (!option.CmpNoCase(_T("--tree"))) { - dumpTree = true; - continue; - } - - if (!option.CmpNoCase(_T("--pixel-tests"))) { - dumpPixelsForAllTests = true; - continue; - } - } - wxInitAllImageHandlers(); - - // create the main application window - WebBrowserShell* webFrame = new WebBrowserShell(_T("wxWebKit DumpRenderTree App"), "about:blank"); - SetTopWindow(webFrame); - webView = webFrame->webview; - webView->SetSize(wxSize(maxViewWidth, maxViewHeight)); - - if (!eventHandler) { - eventHandler = new LayoutWebViewEventHandler(webView); - eventHandler->bindEvents(); - } - - int optind = 1; - time(&startTime); - wxString option_str = wxString(argv[optind]); - if (argc == optind+1 && option_str.Find(_T("-")) == 0) { - char filenameBuffer[2048]; - while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { - wxString filename = wxString::FromUTF8(filenameBuffer); - char* newLineCharacter = strchr(filenameBuffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (strlen(filenameBuffer) == 0) - return 0; - wxLogMessage(wxT("Running test %S.\n"), filenameBuffer); - runTest(filename); - } - - } else { - printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); - for (int i = optind; i != argc; ++i) { - runTest(wxTheApp->argv[1]); - } - } - - webFrame->Close(); - delete eventHandler; - - wxLog::SetActiveTarget(0); - delete logger; - fclose(logOutput); - - // returning false shuts the app down - return false; -} diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.h b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.h deleted file mode 100644 index 99092b845..000000000 --- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DumpRenderTreeWx_h -#define DumpRenderTreeWx_h - -extern void notifyDoneFired(); - -#endif // DumpRenderTreeWx_h diff --git a/Tools/DumpRenderTree/wx/GCControllerWx.cpp b/Tools/DumpRenderTree/wx/GCControllerWx.cpp deleted file mode 100644 index bddf62ffb..000000000 --- a/Tools/DumpRenderTree/wx/GCControllerWx.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "GCController.h" - -void GCController::collect() const -{ -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ -} - -size_t GCController::getJSObjectCount() const -{ - return 0; -} diff --git a/Tools/DumpRenderTree/wx/TestRunnerWx.cpp b/Tools/DumpRenderTree/wx/TestRunnerWx.cpp deleted file mode 100644 index 35a9137e7..000000000 --- a/Tools/DumpRenderTree/wx/TestRunnerWx.cpp +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> - * Copyright (C) 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TestRunner.h" - -#include "DumpRenderTree.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> - -#include <stdio.h> - - - -TestRunner::~TestRunner() -{ - // FIXME: implement -} - -void TestRunner::addDisallowedURL(JSStringRef url) -{ - // FIXME: implement -} - -void TestRunner::clearBackForwardList() -{ -} - -JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) -{ - // FIXME: implement - return 0; -} - -JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) -{ - // FIXME: implement - return 0; -} - -void TestRunner::dispatchPendingLoadRequests() -{ - // FIXME: Implement for testing fix for 6727495 -} - -void TestRunner::display() -{ -} - -void TestRunner::keepWebHistory() -{ - // FIXME: implement -} - -void TestRunner::notifyDone() -{ - if (m_waitToDump && !WorkQueue::shared()->count()) - notifyDoneFired(); - m_waitToDump = false; -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url) -{ - // Function introduced in r28690. This may need special-casing on Windows. - return JSStringRetain(url); // Do nothing on Unix. -} - -void TestRunner::queueLoad(JSStringRef url, JSStringRef target) -{ - // FIXME: We need to resolve relative URLs here - WorkQueue::shared()->queue(new LoadItem(url, target)); -} - -void TestRunner::setAcceptsEditing(bool acceptsEditing) -{ -} - -void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - // FIXME: Implement this (and restore the default value before running each test in DumpRenderTree.cpp). -} - -void TestRunner::setCustomPolicyDelegate(bool, bool) -{ - // FIXME: implement -} - -void TestRunner::setMainFrameIsFirstResponder(bool flag) -{ - // FIXME: implement -} - -void TestRunner::setTabKeyCyclesThroughElements(bool cycles) -{ - // FIXME: implement -} - -void TestRunner::setUseDashboardCompatibilityMode(bool flag) -{ - // FIXME: implement -} - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef path) -{ -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) -{ - // FIXME: implement -} - -void TestRunner::setViewModeMediaFeature(JSStringRef mode) -{ - // FIXME: implement -} - -void TestRunner::setWindowIsKey(bool windowIsKey) -{ - // FIXME: implement -} - -void TestRunner::setSmartInsertDeleteEnabled(bool flag) -{ - // FIXME: implement -} - -void TestRunner::setWaitToDump(bool waitUntilDone) -{ - static const int timeoutSeconds = 10; - - m_waitToDump = waitUntilDone; -} - -int TestRunner::windowCount() -{ - // FIXME: implement - return 1; -} - -void TestRunner::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) -{ - // FIXME: implement -} - -void TestRunner::setJavaScriptCanAccessClipboard(bool enabled) -{ - // FIXME: implement -} - -void TestRunner::setXSSAuditorEnabled(bool enabled) -{ - // FIXME: implement -} - -void TestRunner::setFrameFlatteningEnabled(bool enabled) -{ - // FIXME: implement -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) -{ - // FIXME: implement -} - -void TestRunner::setAllowFileAccessFromFileURLs(bool enabled) -{ - // FIXME: implement -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool flag) -{ - // FIXME: implement -} - -void TestRunner::setAutofilled(JSContextRef, JSValueRef element, bool isAutofilled) -{ - // FIXME: implement -} - -void TestRunner::setPopupBlockingEnabled(bool popupBlockingEnabled) -{ - // FIXME: implement -} - -void TestRunner::setPluginsEnabled(bool flag) -{ - // FIXME: Implement -} - -bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - // FIXME: implement - return false; -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - // FIXME: implement -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) -{ - // FIXME: implement -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - // FIXME: implement -} - -void TestRunner::clearAllApplicationCaches() -{ - // FIXME: Implement to support application cache quotas. -} - -void TestRunner::clearApplicationCacheForOrigin(JSStringRef url) -{ - // FIXME: Implement to support deleting all application cache for an origin. -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) -{ - // FIXME: Implement to support getting disk usage in bytes for an origin. - return 0; -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) -{ - // FIXME: Implement to support application cache quotas. -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef origin) -{ - // FIXME: Implement to support getting disk usage by all application caches for an origin. - return 0; -} - - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - // FIXME: Implement to get origins that have application caches. - return 0; -} - -void TestRunner::clearAllDatabases() -{ - // FIXME: implement -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - // FIXME: implement -} - -void TestRunner::goBack() -{ - // FIXME: implement to enable loader/navigation-while-deferring-loads.html -} - -void TestRunner::setDefersLoading(bool) -{ - // FIXME: implement to enable loader/navigation-while-deferring-loads.html -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef) -{ - // FIXME: implement -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long size) -{ - // FIXME: implement -} - -unsigned TestRunner::numberOfActiveAnimations() const -{ - // FIXME: implement - return 0; -} - -unsigned TestRunner::workerThreadCount() const -{ - // FIXME: implement - return 0; -} - -void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag) -{ - // FIXME: implement -} - -bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - // FIXME: implement - return false; -} - -void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) -{ - // FIXME: Implement for DeviceOrientation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=30335. -} - -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) -{ - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. -} - -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef) -{ - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. -} - -void TestRunner::setGeolocationPermission(bool allow) -{ - // FIXME: Implement for Geolocation layout tests. - setGeolocationPermissionCommon(allow); -} - -int TestRunner::numberOfPendingGeolocationPermissionRequests() -{ - // FIXME: Implement for Geolocation layout tests. - return -1; -} - -void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. -} - -void TestRunner::setMockSpeechInputDumpRect(bool flag) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. -} - -void TestRunner::startSpeechInput(JSContextRef inputElement) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. -} - -void TestRunner::setIconDatabaseEnabled(bool iconDatabaseEnabled) -{ - // FIXME: implement -} - -bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - // FIXME: implement - return false; -} - -void TestRunner::setCacheModel(int) -{ - // FIXME: implement -} - -bool TestRunner::isCommandEnabled(JSStringRef /*name*/) -{ - // FIXME: implement - return false; -} - -size_t TestRunner::webHistoryItemCount() -{ - // FIXME: implement - return 0; -} - -void TestRunner::waitForPolicyDelegate() -{ - // FIXME: Implement this. -} - -void TestRunner::overridePreference(JSStringRef /* key */, JSStringRef /* value */) -{ - // FIXME: implement -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - printf("TestRunner::addUserScript not implemented.\n"); -} - -void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) -{ - printf("TestRunner::addUserStyleSheet not implemented.\n"); -} - -void TestRunner::showWebInspector() -{ - // FIXME: Implement this. -} - -void TestRunner::closeWebInspector() -{ - // FIXME: Implement this. -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - // FIXME: Implement this. -} - -void TestRunner::removeAllVisitedLinks() -{ - // FIXME: Implement this. -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - -} - -void TestRunner::disableImageLoading() -{ - -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - // FIXME: implement -} - -void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - // FIXME: implement -} - -void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) -{ - // FIXME: implement -} - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) -{ - -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - -} - -void TestRunner::setSpatialNavigationEnabled(bool) -{ - -} - -void TestRunner::setWebViewEditable(bool) -{ -} - -bool TestRunner::callShouldCloseOnWebView() -{ - return false; -} - -JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - return 0; -} - -JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef) -{ - return 0; -} - -void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ -} - -void TestRunner::abortModal() -{ -} - -void TestRunner::setAsynchronousSpellCheckingEnabled(bool) -{ - // FIXME: Implement this. -} - -bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) -{ - // FIXME: Implement - return false; -} - -void TestRunner::setSerializeHTTPLoads(bool) -{ - // FIXME: Implement. -} - -void TestRunner::setMinimumTimerInterval(double interval) -{ - -} - -void TestRunner::syncLocalStorage() -{ - // FIXME: Implement. -} - -void TestRunner::observeStorageTrackerNotifications(unsigned number) -{ - // FIXME: Implement. -} - -void TestRunner::deleteAllLocalStorage() -{ - // FIXME: Implement. -} - -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - // FIXME: Implement. - return 0; -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) -{ - // FIXME: Implement. -} - -void TestRunner::setTextDirection(JSStringRef direction) -{ - // FIXME: Implement. -} - -void TestRunner::addChromeInputField() -{ -} - -void TestRunner::removeChromeInputField() -{ -} - -void TestRunner::focusWebView() -{ -} - -void TestRunner::setBackingScaleFactor(double) -{ -} - -void TestRunner::simulateDesktopNotificationClick(JSStringRef title) -{ - // FIXME: Implement. -} - -void TestRunner::resetPageVisibility() -{ - // FIXME: Implement this. -} - -void TestRunner::setPageVisibility(const char*) -{ - // FIXME: Implement this. -} - -void TestRunner::setAutomaticLinkDetectionEnabled(bool) -{ - // FIXME: Implement this. -} - -void TestRunner::sendWebIntentResponse(JSStringRef) -{ - // FIXME: Implement this. -} - -void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef) -{ - // FIXME: Implement this. -} - -void TestRunner::setStorageDatabaseIdleInterval(double) -{ - // FIXME: Implement this. -} diff --git a/Tools/DumpRenderTree/wx/WorkQueueItemWx.cpp b/Tools/DumpRenderTree/wx/WorkQueueItemWx.cpp deleted file mode 100644 index e6ecb752b..000000000 --- a/Tools/DumpRenderTree/wx/WorkQueueItemWx.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WorkQueueItem.h" - -#include "DumpRenderTree.h" - -bool LoadItem::invoke() const -{ - return false; -} - -bool LoadHTMLStringItem::invoke() const -{ - return false; -} - -bool ReloadItem::invoke() const -{ - return false; -} - -bool ScriptItem::invoke() const -{ - return false; -} - -bool BackForwardItem::invoke() const -{ - return false; -} |