diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Tools/DumpRenderTree | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Tools/DumpRenderTree')
296 files changed, 1466 insertions, 45163 deletions
diff --git a/Tools/DumpRenderTree/AccessibilityController.cpp b/Tools/DumpRenderTree/AccessibilityController.cpp index 80c689c68..d035dea99 100644 --- a/Tools/DumpRenderTree/AccessibilityController.cpp +++ b/Tools/DumpRenderTree/AccessibilityController.cpp @@ -130,6 +130,29 @@ static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObj return JSValueMakeUndefined(context); } +static JSValueRef enableEnhancedAccessibilityCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject)); + if (argumentCount == 1) + controller->enableEnhancedAccessibility(JSValueToBoolean(context, arguments[0])); + return JSValueMakeUndefined(context); +} + +static JSValueRef getEnhancedAccessibilityEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject)); + return JSValueMakeBoolean(context, controller->enhancedAccessibilityEnabled()); +} + +static JSValueRef getPlatformNameCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject)); + JSRetainPtr<JSStringRef> platformName(controller->platformName()); + if (!platformName.get()) + return JSValueMakeUndefined(context); + return JSValueMakeString(context, platformName.get()); +} + JSClassRef AccessibilityController::getJSClass() { static JSStaticFunction staticFunctions[] = { @@ -141,12 +164,15 @@ JSClassRef AccessibilityController::getJSClass() { "accessibleElementById", getAccessibleElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "enableEnhancedAccessibility", enableEnhancedAccessibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; static JSStaticValue staticValues[] = { { "focusedElement", getFocusedElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "rootElement", getRootElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "enhancedAccessibilityEnabled", getEnhancedAccessibilityEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "platformName", getPlatformNameCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0, 0 } }; @@ -164,5 +190,6 @@ void AccessibilityController::resetToConsistentState() setLogValueChangeEvents(false); setLogScrollingStartEvents(false); setLogAccessibilityEvents(false); + platformResetToConsistentState(); } #endif // HAVE(ACCESSIBILITY) diff --git a/Tools/DumpRenderTree/AccessibilityController.h b/Tools/DumpRenderTree/AccessibilityController.h index 1bb066fa0..9f66dd6ee 100644 --- a/Tools/DumpRenderTree/AccessibilityController.h +++ b/Tools/DumpRenderTree/AccessibilityController.h @@ -28,6 +28,7 @@ #include "AccessibilityUIElement.h" #include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSRetainPtr.h> #include <string> #include <wtf/HashMap.h> #include <wtf/Platform.h> @@ -35,6 +36,7 @@ #include <windows.h> #endif #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) +#include "AccessibilityNotificationHandlerAtk.h" #include <atk/atk.h> #endif @@ -62,6 +64,12 @@ public: bool addNotificationListener(JSObjectRef functionCallback); void removeNotificationListener(); + // Enhanced accessibility. + void enableEnhancedAccessibility(bool); + bool enhancedAccessibilityEnabled(); + + JSRetainPtr<JSStringRef> platformName() const; + #if PLATFORM(WIN) // Helper methods so this class can add the listeners on behalf of AccessibilityUIElement. void winAddNotificationListener(PlatformUIElement, JSObjectRef functionCallback); @@ -85,9 +93,15 @@ private: HashMap<PlatformUIElement, JSObjectRef> m_notificationListeners; #endif -#if PLATFORM(MAC) +#if PLATFORM(COCOA) || PLATFORM(IOS) RetainPtr<NotificationHandler> m_globalNotificationHandler; #endif + +#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) + RefPtr<AccessibilityNotificationHandler> m_globalNotificationHandler; +#endif + + void platformResetToConsistentState(); }; #endif // AccessibilityController_h diff --git a/Tools/DumpRenderTree/AccessibilityTextMarker.h b/Tools/DumpRenderTree/AccessibilityTextMarker.h index aeb078d78..7809ea459 100644 --- a/Tools/DumpRenderTree/AccessibilityTextMarker.h +++ b/Tools/DumpRenderTree/AccessibilityTextMarker.h @@ -28,13 +28,13 @@ #include <JavaScriptCore/JSObjectRef.h> -#if PLATFORM(MAC) +#if PLATFORM(MAC) || PLATFORM(IOS) #define SUPPORTS_AX_TEXTMARKERS 1 #else #define SUPPORTS_AX_TEXTMARKERS 0 #endif -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #include <wtf/RetainPtr.h> typedef CFTypeRef PlatformTextMarker; typedef CFTypeRef PlatformTextMarkerRange; @@ -58,7 +58,7 @@ public: private: static JSClassRef getJSClass(); -#if PLATFORM(MAC) +#if SUPPORTS_AX_TEXTMARKERS && PLATFORM(MAC) RetainPtr<PlatformTextMarker> m_textMarker; #else PlatformTextMarker m_textMarker; @@ -78,7 +78,7 @@ public: private: static JSClassRef getJSClass(); -#if PLATFORM(MAC) +#if SUPPORTS_AX_TEXTMARKERS && PLATFORM(MAC) RetainPtr<PlatformTextMarkerRange> m_textMarkerRange; #else PlatformTextMarkerRange m_textMarkerRange; diff --git a/Tools/DumpRenderTree/AccessibilityUIElement.cpp b/Tools/DumpRenderTree/AccessibilityUIElement.cpp index 77d11a221..1d77d7717 100644 --- a/Tools/DumpRenderTree/AccessibilityUIElement.cpp +++ b/Tools/DumpRenderTree/AccessibilityUIElement.cpp @@ -202,32 +202,82 @@ static JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length)); } +static JSValueRef uiElementCountForSearchPredicateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityUIElement* startElement = nullptr; + bool isDirectionNext = true; + JSValueRef searchKey = nullptr; + JSRetainPtr<JSStringRef> searchText = nullptr; + bool visibleOnly = false; + bool immediateDescendantsOnly = false; + if (argumentCount >= 5 && argumentCount <= 6) { + if (JSValueIsObject(context, arguments[0])) + startElement = toAXElement(JSValueToObject(context, arguments[0], exception)); + + isDirectionNext = JSValueToBoolean(context, arguments[1]); + + searchKey = arguments[2]; + + if (JSValueIsString(context, arguments[3])) + searchText.adopt(JSValueToStringCopy(context, arguments[3], exception)); + + visibleOnly = JSValueToBoolean(context, arguments[4]); + + if (argumentCount == 6) + immediateDescendantsOnly = JSValueToBoolean(context, arguments[5]); + } + + return JSValueMakeNumber(context, toAXElement(thisObject)->uiElementCountForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText.get(), visibleOnly, immediateDescendantsOnly)); +} + static JSValueRef uiElementForSearchPredicateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - AccessibilityUIElement* startElement = 0; + AccessibilityUIElement* startElement = nullptr; bool isDirectionNext = true; + JSValueRef searchKey = nullptr; + JSRetainPtr<JSStringRef> searchText = nullptr; bool visibleOnly = false; - JSValueRef searchKey = 0; - JSStringRef searchText = 0; - if (argumentCount == 5) { - JSObjectRef startElementObject = JSValueToObject(context, arguments[0], exception); - if (startElementObject) - startElement = toAXElement(startElementObject); - isDirectionNext = JSValueToBoolean(context, arguments[1]); + bool immediateDescendantsOnly = false; + if (argumentCount >= 5 && argumentCount <= 6) { + if (JSValueIsObject(context, arguments[0])) + startElement = toAXElement(JSValueToObject(context, arguments[0], exception)); + + isDirectionNext = JSValueToBoolean(context, arguments[1]); searchKey = arguments[2]; if (JSValueIsString(context, arguments[3])) - searchText = JSValueToStringCopy(context, arguments[3], exception); + searchText.adopt(JSValueToStringCopy(context, arguments[3], exception)); visibleOnly = JSValueToBoolean(context, arguments[4]); + + if (argumentCount == 6) + immediateDescendantsOnly = JSValueToBoolean(context, arguments[5]); } - JSObjectRef resultObject = AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText, visibleOnly)); + + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText.get(), visibleOnly, immediateDescendantsOnly)); +} - if (searchText) - JSStringRelease(searchText); +static JSValueRef selectTextWithCriteriaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 2 || argumentCount > 4) + return JSValueMakeUndefined(context); - return resultObject; + JSRetainPtr<JSStringRef> ambiguityResolution(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + JSValueRef searchStrings = arguments[1]; + JSStringRef replacementString = nullptr; + if (argumentCount == 3) + replacementString = JSValueToStringCopy(context, arguments[2], exception); + JSStringRef activityString = nullptr; + if (argumentCount == 4) + activityString = JSValueToStringCopy(context, arguments[3], exception); + + JSRetainPtr<JSStringRef> result(Adopt, toAXElement(thisObject)->selectTextWithCriteria(context, ambiguityResolution.get(), searchStrings, replacementString, activityString)); + if (replacementString) + JSStringRelease(replacementString); + if (activityString) + JSStringRelease(activityString); + return JSValueMakeString(context, result.get()); } static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -267,12 +317,13 @@ static JSValueRef elementsForRangeCallback(JSContextRef context, JSObjectRef fun Vector<AccessibilityUIElement> elements; toAXElement(thisObject)->elementsForRange(location, length, elements); + JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0); + JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0); unsigned elementsSize = elements.size(); - JSValueRef valueElements[elementsSize]; for (unsigned k = 0; k < elementsSize; ++k) - valueElements[k] = AccessibilityUIElement::makeJSAccessibilityUIElement(context, elements[k]); + JSObjectSetPropertyAtIndex(context, arrayObj, k, AccessibilityUIElement::makeJSAccessibilityUIElement(context, elements[k]), 0); - return JSObjectMakeArray(context, elementsSize, valueElements, 0); + return arrayResult; } static JSValueRef increaseTextSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -281,6 +332,26 @@ static JSValueRef increaseTextSelectionCallback(JSContextRef context, JSObjectRe return JSValueMakeUndefined(context); } +static JSValueRef scrollPageUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->scrollPageUp()); +} + +static JSValueRef scrollPageDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->scrollPageDown()); +} + +static JSValueRef scrollPageLeftCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->scrollPageLeft()); +} + +static JSValueRef scrollPageRightCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->scrollPageRight()); +} + static JSValueRef decreaseTextSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { toAXElement(thisObject)->decreaseTextSelection(); @@ -293,6 +364,11 @@ static JSValueRef assistiveTechnologySimulatedFocusCallback(JSContextRef context return JSValueMakeUndefined(context); } +static JSValueRef fieldsetAncestorElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->fieldsetAncestorElement()); +} + #endif static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -349,6 +425,15 @@ static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjec return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber)); } +static JSValueRef ariaControlsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int indexNumber = 0; + if (argumentCount == 1) + indexNumber = JSValueToNumber(context, arguments[0], exception); + + return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaControlsElementAtIndex(indexNumber)); +} + static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int indexNumber = 0; @@ -378,6 +463,19 @@ static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JS return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement))); } +static JSValueRef setValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueText = 0; + if (argumentCount == 1) { + if (JSValueIsString(context, arguments[0])) + valueText.adopt(JSValueToStringCopy(context, arguments[0], exception)); + } + + toAXElement(thisObject)->setValue(valueText.get()); + + return JSValueMakeUndefined(context); +} + static JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { JSObjectRef element = 0; @@ -389,6 +487,24 @@ static JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef fun return JSValueMakeUndefined(context); } +static JSValueRef setSelectedChildAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount == 1) { + unsigned indexNumber = JSValueToNumber(context, arguments[0], exception); + toAXElement(thisObject)->setSelectedChildAtIndex(indexNumber); + } + return JSValueMakeUndefined(context); +} + +static JSValueRef removeSelectionAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount == 1) { + unsigned indexNumber = JSValueToNumber(context, arguments[0], exception); + toAXElement(thisObject)->removeSelectionAtIndex(indexNumber); + } + return JSValueMakeUndefined(context); +} + static JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int x = 0; @@ -450,6 +566,20 @@ static JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef f return result; } +static JSValueRef setBoolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + JSStringRef attribute = nullptr; + bool value = false; + if (argumentCount == 2) { + attribute = JSValueToStringCopy(context, arguments[0], exception); + value = JSValueToBoolean(context, arguments[1]); + } + toAXElement(thisObject)->setBoolAttributeValue(attribute, value); + if (attribute) + JSStringRelease(attribute); + return JSValueMakeUndefined(context); +} + static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { JSStringRef attribute = 0; @@ -462,6 +592,44 @@ static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef return result; } +static JSValueRef convertElementsToObjectArray(JSContextRef context, Vector<AccessibilityUIElement>& elements, JSValueRef* exception) +{ + JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0); + JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0); + + size_t elementCount = elements.size(); + for (size_t i = 0; i < elementCount; ++i) + JSObjectSetPropertyAtIndex(context, arrayObj, i, AccessibilityUIElement::makeJSAccessibilityUIElement(context, elements[i]), 0); + + return arrayResult; +} + +static JSValueRef columnHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + Vector<AccessibilityUIElement> elements; + toAXElement(thisObject)->columnHeaders(elements); + return convertElementsToObjectArray(context, elements, exception); +} + +static JSValueRef rowHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + Vector<AccessibilityUIElement> elements; + toAXElement(thisObject)->rowHeaders(elements); + return convertElementsToObjectArray(context, elements, exception); +} + +static JSValueRef uiElementArrayAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 1) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> attribute(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + + Vector<AccessibilityUIElement> elements; + toAXElement(thisObject)->uiElementArrayAttributeValue(attribute.get(), elements); + return convertElementsToObjectArray(context, elements, exception); +} + static JSValueRef uiElementAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { JSRetainPtr<JSStringRef> attribute; @@ -545,6 +713,36 @@ static JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSOb return JSValueMakeUndefined(context); } +static JSValueRef scrollToMakeVisibleWithSubFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + unsigned x = 0; + unsigned y = 0; + unsigned width = 0; + unsigned height = 0; + if (argumentCount == 4) { + x = JSValueToNumber(context, arguments[0], exception); + y = JSValueToNumber(context, arguments[1], exception); + width = JSValueToNumber(context, arguments[2], exception); + height = JSValueToNumber(context, arguments[3], exception); + } + + toAXElement(thisObject)->scrollToMakeVisibleWithSubFocus(x, y, width, height); + return JSValueMakeUndefined(context); +} + +static JSValueRef scrollToGlobalPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + unsigned x = 0; + unsigned y = 0; + if (argumentCount == 2) { + x = JSValueToNumber(context, arguments[0], exception); + y = JSValueToNumber(context, arguments[1], exception); + } + + toAXElement(thisObject)->scrollToGlobalPoint(x, y); + return JSValueMakeUndefined(context); +} + static JSValueRef scrollToMakeVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { toAXElement(thisObject)->scrollToMakeVisible(); @@ -575,6 +773,14 @@ static JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef func return JSValueMakeUndefined(context); } +static JSValueRef lineTextMarkerRangeForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* textMarker = nullptr; + if (argumentCount == 1) + textMarker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->lineTextMarkerRangeForTextMarker(textMarker)); +} + static JSValueRef textMarkerRangeForElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { AccessibilityUIElement* uiElement = 0; @@ -584,6 +790,17 @@ static JSValueRef textMarkerRangeForElementCallback(JSContextRef context, JSObje return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement)); } +static JSValueRef selectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->selectedTextMarkerRange()); +} + +static JSValueRef resetSelectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + toAXElement(thisObject)->resetSelectedTextMarkerRange(); + return JSValueMakeUndefined(context); +} + static JSValueRef attributedStringForTextMarkerRangeContainsAttributeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { AccessibilityTextMarkerRange* markerRange = 0; @@ -664,6 +881,38 @@ static JSValueRef stringForTextMarkerRangeCallback(JSContextRef context, JSObjec return JSValueMakeString(context, markerRangeString.get()); } +static JSValueRef endTextMarkerForBoundsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int x = 0; + int y = 0; + int width = 0; + int height = 0; + if (argumentCount == 4) { + x = JSValueToNumber(context, arguments[0], exception); + y = JSValueToNumber(context, arguments[1], exception); + width = JSValueToNumber(context, arguments[2], exception); + height = JSValueToNumber(context, arguments[3], exception); + } + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarkerForBounds(x, y, width, height)); +} + +static JSValueRef startTextMarkerForBoundsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int x = 0; + int y = 0; + int width = 0; + int height = 0; + if (argumentCount == 4) { + x = JSValueToNumber(context, arguments[0], exception); + y = JSValueToNumber(context, arguments[1], exception); + width = JSValueToNumber(context, arguments[2], exception); + height = JSValueToNumber(context, arguments[3], exception); + } + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->startTextMarkerForBounds(x, y, width, height)); +} + static JSValueRef textMarkerForPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int x = 0; @@ -715,6 +964,119 @@ static JSValueRef accessibilityElementForTextMarkerCallback(JSContextRef context return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->accessibilityElementForTextMarker(marker)); } +static JSValueRef startTextMarkerCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) +{ + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->startTextMarker()); +} + +static JSValueRef endTextMarkerCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) +{ + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarker()); +} + +static JSValueRef leftWordTextMarkerRangeForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->leftWordTextMarkerRangeForTextMarker(marker)); +} + +static JSValueRef rightWordTextMarkerRangeForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->rightWordTextMarkerRangeForTextMarker(marker)); +} + +static JSValueRef previousWordStartTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->previousWordStartTextMarkerForTextMarker(marker)); +} + +static JSValueRef nextWordEndTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->nextWordEndTextMarkerForTextMarker(marker)); +} + +static JSValueRef paragraphTextMarkerRangeForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->paragraphTextMarkerRangeForTextMarker(marker)); +} + +static JSValueRef previousParagraphStartTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->previousParagraphStartTextMarkerForTextMarker(marker)); +} + +static JSValueRef nextParagraphEndTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->nextParagraphEndTextMarkerForTextMarker(marker)); +} + +static JSValueRef sentenceTextMarkerRangeForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->sentenceTextMarkerRangeForTextMarker(marker)); +} + +static JSValueRef previousSentenceStartTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->previousSentenceStartTextMarkerForTextMarker(marker)); +} + +static JSValueRef nextSentenceEndTextMarkerForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityTextMarker* marker = nullptr; + if (argumentCount == 1) + marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); + + return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->nextSentenceEndTextMarkerForTextMarker(marker)); +} + +static JSValueRef setSelectedVisibleTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + AccessibilityUIElement* uiElement = toAXElement(thisObject); + AccessibilityTextMarkerRange* textMarkerRange = nullptr; + if (argumentCount == 1) + textMarkerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception)); + + if (uiElement) + return JSValueMakeBoolean(context, uiElement->setSelectedVisibleTextRange(textMarkerRange)); + + return JSValueMakeBoolean(context, false); +} + // Static Value Getters static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) @@ -723,6 +1085,12 @@ static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef t return JSValueMakeString(context, dropEffects.get()); } +static JSValueRef getClassListCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> classList(Adopt, toAXElement(thisObject)->classList()); + return JSValueMakeString(context, classList.get()); +} + static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed()); @@ -757,6 +1125,12 @@ static JSValueRef getRoleDescriptionCallback(JSContextRef context, JSObjectRef t return JSValueMakeString(context, roleDesc.get()); } +static JSValueRef getComputedRoleStringCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> compRole(Adopt, toAXElement(thisObject)->computedRoleString()); + return JSValueMakeString(context, compRole.get()); +} + static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title()); @@ -920,6 +1294,11 @@ static JSValueRef getIsCheckedCallback(JSContextRef context, JSObjectRef thisObj return JSValueMakeBoolean(context, toAXElement(thisObject)->isChecked()); } +static JSValueRef getIsIndeterminate(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->isIndeterminate()); +} + static JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) { return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible()); @@ -1017,58 +1396,91 @@ static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObj return JSValueMakeUndefined(context); } -#if PLATFORM(IOS) +#if PLATFORM(GTK) || PLATFORM(EFL) +static JSValueRef characterAtOffsetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int offset = -1; + if (argumentCount == 1) + offset = JSValueToNumber(context, arguments[0], exception); -static JSValueRef stringForSelectionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) + JSRetainPtr<JSStringRef> characterAtOffset(Adopt, toAXElement(thisObject)->characterAtOffset(offset)); + return JSValueMakeString(context, characterAtOffset.get()); +} + +static JSValueRef wordAtOffsetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->stringForSelection()); - return JSValueMakeString(context, labelString.get()); + int offset = -1; + if (argumentCount == 1) + offset = JSValueToNumber(context, arguments[0], exception); + + JSRetainPtr<JSStringRef> wordAtOffset(Adopt, toAXElement(thisObject)->wordAtOffset(offset)); + return JSValueMakeString(context, wordAtOffset.get()); } -static JSValueRef getIPhoneLabelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef lineAtOffsetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->iphoneLabel()); - return JSValueMakeString(context, labelString.get()); + int offset = -1; + if (argumentCount == 1) + offset = JSValueToNumber(context, arguments[0], exception); + + JSRetainPtr<JSStringRef> lineAtOffset(Adopt, toAXElement(thisObject)->lineAtOffset(offset)); + return JSValueMakeString(context, lineAtOffset.get()); } -static JSValueRef getIPhoneHintCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef sentenceAtOffsetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - JSRetainPtr<JSStringRef> hintString(Adopt, toAXElement(thisObject)->iphoneHint()); - return JSValueMakeString(context, hintString.get()); + int offset = -1; + if (argumentCount == 1) + offset = JSValueToNumber(context, arguments[0], exception); + + JSRetainPtr<JSStringRef> sentenceAtOffset(Adopt, toAXElement(thisObject)->sentenceAtOffset(offset)); + return JSValueMakeString(context, sentenceAtOffset.get()); } -static JSValueRef getIPhoneValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +#elif PLATFORM(IOS) + +static JSValueRef getIsSearchFieldCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneValue()); - return JSValueMakeString(context, valueString.get()); + return JSValueMakeBoolean(context, toAXElement(thisObject)->isSearchField()); +} + +static JSValueRef getIsTextAreaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + return JSValueMakeBoolean(context, toAXElement(thisObject)->isTextArea()); } -static JSValueRef getIPhoneIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef stringForSelectionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneIdentifier()); + JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->stringForSelection()); + return JSValueMakeString(context, labelString.get()); +} + +static JSValueRef getIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->identifier()); return JSValueMakeString(context, valueString.get()); } -static JSValueRef getIPhoneTraitsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getTraitsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneTraits()); + JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->traits()); return JSValueMakeString(context, valueString.get()); } -static JSValueRef getIPhoneIsElementCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getElementTextPositionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - return JSValueMakeBoolean(context, toAXElement(thisObject)->iphoneIsElement()); + return JSValueMakeNumber(context, toAXElement(thisObject)->elementTextPosition()); } -static JSValueRef getIPhoneElementTextPositionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getElementTextLengthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextPosition()); + return JSValueMakeNumber(context, toAXElement(thisObject)->elementTextLength()); } -static JSValueRef getIPhoneElementTextLengthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef hasContainedByFieldsetTraitCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) { - return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextLength()); + return JSValueMakeBoolean(context, toAXElement(thisObject)->hasContainedByFieldsetTrait()); } #endif // PLATFORM(IOS) @@ -1102,8 +1514,8 @@ JSStringRef AccessibilityUIElement::speak() { return 0; } JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; } JSStringRef AccessibilityUIElement::rangeForPosition(int, int) { return 0; } void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { } -unsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; } -AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; } +void AccessibilityUIElement::setSelectedChildAtIndex(unsigned) const { } +void AccessibilityUIElement::removeSelectionAtIndex(unsigned) const { } AccessibilityUIElement AccessibilityUIElement::horizontalScrollbar() const { return 0; } AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const { return 0; } AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef) const { return 0; } @@ -1111,6 +1523,11 @@ AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringR #if !PLATFORM(MAC) && !PLATFORM(IOS) JSStringRef AccessibilityUIElement::pathDescription() const { return 0; } +void AccessibilityUIElement::setValue(JSStringRef) { } +#endif + +#if !PLATFORM(COCOA) +void AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef, Vector<AccessibilityUIElement>&) const { } #endif #if !PLATFORM(WIN) @@ -1122,13 +1539,31 @@ bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement) } #endif +#if !PLATFORM(MAC) +void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { } +#endif + #if !SUPPORTS_AX_TEXTMARKERS +AccessibilityTextMarkerRange AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*) { return 0; } +AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange() +{ + return nullptr; +} + +void AccessibilityUIElement::resetSelectedTextMarkerRange() +{ +} + int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*) { return 0; @@ -1154,6 +1589,16 @@ AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker return 0; } +AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForBounds(int x, int y, int width, int height) +{ + return 0; +} + +AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForBounds(int x, int y, int width, int height) +{ + return 0; +} + AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y) { return 0; @@ -1194,6 +1639,71 @@ AccessibilityTextMarker AccessibilityUIElement::textMarkerForIndex(int) return 0; } +AccessibilityTextMarker AccessibilityUIElement::startTextMarker() +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::endTextMarker() +{ + return nullptr; +} + +bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*) +{ + return false; +} + +AccessibilityTextMarkerRange AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarkerRange AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarkerRange AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarkerRange AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + +AccessibilityTextMarker AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*) +{ + return nullptr; +} + #endif // Destruction @@ -1207,6 +1717,9 @@ static void finalize(JSObjectRef thisObject) JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element) { + if (!element.platformUIElement()) + return nullptr; + return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element)); } @@ -1217,6 +1730,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "computedRoleString", getComputedRoleStringCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1247,6 +1761,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "isSelectedOptionActive", getIsSelectedOptionActiveCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isIndeterminate", getIsIndeterminate, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1260,21 +1775,23 @@ JSClassRef AccessibilityUIElement::getJSClass() { "orientation", getOrientationCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "classList", getClassListCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "horizontalScrollbar", horizontalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "verticalScrollbar", verticalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "startTextMarker", startTextMarkerCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "endTextMarker", endTextMarkerCallback, 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 }, + { "identifier", getIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "traits", getTraitsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "elementTextPosition", getElementTextPositionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "elementTextLength", getElementTextLengthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringForSelection", stringForSelectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "hasContainedByFieldsetTrait", hasContainedByFieldsetTraitCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isSearchField", getIsSearchFieldCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isTextArea", getIsTextAreaCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, #endif // PLATFORM(IOS) #if PLATFORM(MAC) && !PLATFORM(IOS) { "supportedActions", supportedActionsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1297,7 +1814,9 @@ JSClassRef AccessibilityUIElement::getJSClass() { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "uiElementCountForSearchPredicate", uiElementCountForSearchPredicateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "uiElementForSearchPredicate", uiElementForSearchPredicateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "selectTextWithCriteria", selectTextWithCriteriaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1315,9 +1834,13 @@ JSClassRef AccessibilityUIElement::getJSClass() { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "uiElementArrayAttributeValue", uiElementArrayAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "rowHeaders", rowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "columnHeaders", columnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "uiElementAttributeValue", uiElementAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setBoolAttributeValue", setBoolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isPressActionSupported", isPressActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1332,6 +1855,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "ariaControlsElementAtIndex", ariaControlsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "rowAtIndex", rowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1341,7 +1865,10 @@ JSClassRef AccessibilityUIElement::getJSClass() { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "lineTextMarkerRangeForTextMarker", lineTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "selectedTextMarkerRange", selectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "resetSelectedTextMarkerRange", resetSelectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "attributedStringForTextMarkerRangeContainsAttribute", attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "indexForTextMarker", indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isTextMarkerValid", isTextMarkerValidCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1351,21 +1878,48 @@ JSClassRef AccessibilityUIElement::getJSClass() { "endTextMarkerForTextMarkerRange", endTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "accessibilityElementForTextMarker", accessibilityElementForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "textMarkerRangeLength", textMarkerRangeLengthCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "endTextMarkerForBounds", endTextMarkerForBoundsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "startTextMarkerForBounds", startTextMarkerForBoundsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "textMarkerForPoint", textMarkerForPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "nextTextMarker", nextTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "previousTextMarker", previousTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "leftWordTextMarkerRangeForTextMarker", leftWordTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "rightWordTextMarkerRangeForTextMarker", rightWordTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "previousWordStartTextMarkerForTextMarker", previousWordStartTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "nextWordEndTextMarkerForTextMarker", nextWordEndTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "paragraphTextMarkerRangeForTextMarker", paragraphTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "previousParagraphStartTextMarkerForTextMarker", previousParagraphStartTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "nextParagraphEndTextMarkerForTextMarker", nextParagraphEndTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "sentenceTextMarkerRangeForTextMarker", sentenceTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "previousSentenceStartTextMarkerForTextMarker", previousSentenceStartTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "nextSentenceEndTextMarkerForTextMarker", nextSentenceEndTextMarkerForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setSelectedChildAtIndex", setSelectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "removeSelectionAtIndex", removeSelectionAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setValue", setValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setSelectedVisibleTextRange", setSelectedVisibleTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "scrollToMakeVisible", scrollToMakeVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -#if PLATFORM(IOS) + { "scrollToGlobalPoint", scrollToGlobalPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollToMakeVisibleWithSubFocus", scrollToMakeVisibleWithSubFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#if PLATFORM(GTK) || PLATFORM(EFL) + { "characterAtOffset", characterAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "wordAtOffset", wordAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "lineAtOffset", lineAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "sentenceAtOffset", sentenceAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#elif PLATFORM(IOS) { "linkedElement", linkedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "headerElementAtIndex", headerElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "elementsForRange", elementsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "increaseTextSelection", increaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "decreaseTextSelection", decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollPageUp", scrollPageUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollPageDown", scrollPageDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollPageLeft", scrollPageLeftCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "scrollPageRight", scrollPageRightCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - + { "fieldsetAncestorElement", fieldsetAncestorElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, #endif { 0, 0, 0 } }; diff --git a/Tools/DumpRenderTree/AccessibilityUIElement.h b/Tools/DumpRenderTree/AccessibilityUIElement.h index ebbf7f3d4..4abf9e9aa 100644 --- a/Tools/DumpRenderTree/AccessibilityUIElement.h +++ b/Tools/DumpRenderTree/AccessibilityUIElement.h @@ -31,7 +31,7 @@ #include <wtf/Platform.h> #include <wtf/Vector.h> -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #ifdef __OBJC__ typedef id PlatformUIElement; #else @@ -46,13 +46,14 @@ typedef struct objc_object* PlatformUIElement; typedef COMPtr<IAccessible> PlatformUIElement; #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) +#include "AccessibilityNotificationHandlerAtk.h" #include <atk/atk.h> typedef AtkObject* PlatformUIElement; #else typedef void* PlatformUIElement; #endif -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #ifdef __OBJC__ typedef id NotificationHandler; #else @@ -66,7 +67,7 @@ public: AccessibilityUIElement(const AccessibilityUIElement&); ~AccessibilityUIElement(); - PlatformUIElement platformUIElement() { return m_element; } + PlatformUIElement platformUIElement() const { return m_element; } static JSObjectRef makeJSAccessibilityUIElement(JSContextRef, const AccessibilityUIElement&); @@ -105,8 +106,10 @@ public: // Attributes - platform-independent implementations JSStringRef stringAttributeValue(JSStringRef attribute); double numberAttributeValue(JSStringRef attribute); + void uiElementArrayAttributeValue(JSStringRef attribute, Vector<AccessibilityUIElement>& elements) const; AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const; bool boolAttributeValue(JSStringRef attribute); + void setBoolAttributeValue(JSStringRef attribute, bool value); bool isAttributeSupported(JSStringRef attribute); bool isAttributeSettable(JSStringRef attribute); bool isPressActionSupported(); @@ -115,11 +118,13 @@ public: JSStringRef role(); JSStringRef subrole(); JSStringRef roleDescription(); + JSStringRef computedRoleString(); JSStringRef title(); JSStringRef description(); JSStringRef language(); JSStringRef stringValue(); JSStringRef accessibilityValue() const; + void setValue(JSStringRef); JSStringRef helpText() const; JSStringRef orientation() const; double x(); @@ -145,6 +150,8 @@ public: void setSelectedChild(AccessibilityUIElement*) const; unsigned selectedChildrenCount() const; AccessibilityUIElement selectedChildAtIndex(unsigned) const; + void setSelectedChildAtIndex(unsigned) const; + void removeSelectionAtIndex(unsigned) const; bool isExpanded() const; bool isChecked() const; @@ -152,6 +159,7 @@ public: bool isOffScreen() const; bool isCollapsed() const; bool isIgnored() const; + bool isIndeterminate() const; bool hasPopup() const; int hierarchicalLevel() const; double clickPointX(); @@ -159,6 +167,7 @@ public: JSStringRef documentEncoding(); JSStringRef documentURI(); JSStringRef url(); + JSStringRef classList() const; // CSS3-speech properties. JSStringRef speak(); @@ -175,6 +184,8 @@ public: JSStringRef columnIndexRange(); int rowCount(); int columnCount(); + void rowHeaders(Vector<AccessibilityUIElement>& elements) const; + void columnHeaders(Vector<AccessibilityUIElement>& elements) const; // Tree/Outline specific attributes AccessibilityUIElement selectedRowAtIndex(unsigned); @@ -185,6 +196,7 @@ public: // ARIA specific AccessibilityUIElement ariaOwnsElementAtIndex(unsigned); AccessibilityUIElement ariaFlowToElementAtIndex(unsigned); + AccessibilityUIElement ariaControlsElementAtIndex(unsigned); // ARIA Drag and Drop bool ariaIsGrabbed() const; @@ -200,13 +212,31 @@ public: JSStringRef stringForRange(unsigned location, unsigned length); JSStringRef attributedStringForRange(unsigned location, unsigned length); bool attributedStringRangeIsMisspelled(unsigned location, unsigned length); - AccessibilityUIElement uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly); + unsigned uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly); + AccessibilityUIElement uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly); + JSStringRef selectTextWithCriteria(JSContextRef, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity); #if PLATFORM(IOS) void elementsForRange(unsigned location, unsigned length, Vector<AccessibilityUIElement>& elements); JSStringRef stringForSelection(); void increaseTextSelection(); void decreaseTextSelection(); AccessibilityUIElement linkedElement(); + + bool scrollPageUp(); + bool scrollPageDown(); + bool scrollPageLeft(); + bool scrollPageRight(); + + bool hasContainedByFieldsetTrait(); + AccessibilityUIElement fieldsetAncestorElement(); +#endif + +#if PLATFORM(GTK) || PLATFORM(EFL) + // Text-specific + JSStringRef characterAtOffset(int offset); + JSStringRef wordAtOffset(int offset); + JSStringRef lineAtOffset(int offset); + JSStringRef sentenceAtOffset(int offset); #endif // Table-specific @@ -217,14 +247,33 @@ public: AccessibilityUIElement verticalScrollbar() const; // Text markers. + AccessibilityTextMarkerRange lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*); AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement*); AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker); AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*); AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*); + AccessibilityTextMarker endTextMarkerForBounds(int x, int y, int width, int height); + AccessibilityTextMarker startTextMarkerForBounds(int x, int y, int width, int height); AccessibilityTextMarker textMarkerForPoint(int x, int y); AccessibilityTextMarker previousTextMarker(AccessibilityTextMarker*); AccessibilityTextMarker nextTextMarker(AccessibilityTextMarker*); AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker startTextMarker(); + AccessibilityTextMarker endTextMarker(); + AccessibilityTextMarkerRange leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarkerRange rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarkerRange paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarkerRange sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarker nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*); + AccessibilityTextMarkerRange selectedTextMarkerRange(); + void resetSelectedTextMarkerRange(); + bool setSelectedVisibleTextRange(AccessibilityTextMarkerRange*); + JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*); int textMarkerRangeLength(AccessibilityTextMarkerRange*); bool attributedStringForTextMarkerRangeContainsAttribute(JSStringRef, AccessibilityTextMarkerRange*); @@ -243,17 +292,17 @@ public: void removeNotificationListener(); #if PLATFORM(IOS) - JSStringRef iphoneLabel(); - JSStringRef iphoneValue(); - JSStringRef iphoneTraits(); - JSStringRef iphoneHint(); - JSStringRef iphoneIdentifier(); - bool iphoneIsElement(); - int iphoneElementTextPosition(); - int iphoneElementTextLength(); + JSStringRef traits(); + JSStringRef identifier(); + int elementTextPosition(); + int elementTextLength(); AccessibilityUIElement headerElementAtIndex(unsigned); // This will simulate the accessibilityDidBecomeFocused API in UIKit. void assistiveTechnologySimulatedFocus(); + + bool isTextArea() const; + bool isSearchField() const; + #endif // PLATFORM(IOS) #if PLATFORM(MAC) && !PLATFORM(IOS) @@ -269,10 +318,14 @@ private: static JSClassRef getJSClass(); PlatformUIElement m_element; +#if PLATFORM(COCOA) // A retained, platform specific object used to help manage notifications for this object. -#if PLATFORM(MAC) NotificationHandler m_notificationHandler; #endif + +#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) + RefPtr<AccessibilityNotificationHandler> m_notificationHandler; +#endif }; #endif // AccessibilityUIElement_h diff --git a/Tools/DumpRenderTree/CMakeLists.txt b/Tools/DumpRenderTree/CMakeLists.txt new file mode 100644 index 000000000..eb7c1f4ff --- /dev/null +++ b/Tools/DumpRenderTree/CMakeLists.txt @@ -0,0 +1,129 @@ +set(DumpRenderTree_SOURCES + AccessibilityController.cpp + AccessibilityTextMarker.cpp + AccessibilityUIElement.cpp + CyclicRedundancyCheck.cpp + DumpRenderTreeCommon.cpp + GCController.cpp + JavaScriptThreading.cpp + PixelDumpSupport.cpp + TestRunner.cpp + WorkQueue.cpp +) + +set(DumpRenderTree_LIBRARIES + JavaScriptCore + WTF + WebCoreTestSupport + WebKit +) + +set(DumpRenderTree_INCLUDE_DIRECTORIES + ${WEBCORE_DIR} + ${WEBCORE_DIR}/bindings + ${WEBCORE_DIR}/bridge + ${WEBCORE_DIR}/bridge/jsc + ${WEBCORE_DIR}/css + ${WEBCORE_DIR}/dom + ${WEBCORE_DIR}/editing + ${WEBCORE_DIR}/history + ${WEBCORE_DIR}/html + ${WEBCORE_DIR}/inspector + ${WEBCORE_DIR}/loader + ${WEBCORE_DIR}/loader/cache + ${WEBCORE_DIR}/loader/icon + ${WEBCORE_DIR}/page + ${WEBCORE_DIR}/page/animation + ${WEBCORE_DIR}/platform + ${WEBCORE_DIR}/platform/animation + ${WEBCORE_DIR}/platform/graphics + ${WEBCORE_DIR}/platform/graphics/transforms + ${WEBCORE_DIR}/platform/network + ${WEBCORE_DIR}/platform/text + ${WEBCORE_DIR}/plugins + ${WEBCORE_DIR}/rendering + ${WEBCORE_DIR}/rendering/shapes + ${WEBCORE_DIR}/rendering/style + ${JAVASCRIPTCORE_DIR} + ${JAVASCRIPTCORE_DIR}/API + ${JAVASCRIPTCORE_DIR}/assembler + ${JAVASCRIPTCORE_DIR}/bytecode + ${JAVASCRIPTCORE_DIR}/dfg + ${JAVASCRIPTCORE_DIR}/disassembler + ${JAVASCRIPTCORE_DIR}/heap + ${JAVASCRIPTCORE_DIR}/interpreter + ${JAVASCRIPTCORE_DIR}/jit + ${JAVASCRIPTCORE_DIR}/llint + ${JAVASCRIPTCORE_DIR}/parser + ${JAVASCRIPTCORE_DIR}/profiler + ${JAVASCRIPTCORE_DIR}/runtime + ${JAVASCRIPTCORE_DIR}/ForwardingHeaders + ${DERIVED_SOURCES_DIR}/ForwardingHeaders + ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} + ${TOOLS_DIR}/DumpRenderTree + ${WTF_DIR} + ${CMAKE_SOURCE_DIR}/Source + ${CMAKE_BINARY_DIR} + ${DERIVED_SOURCES_DIR} + ${DERIVED_SOURCES_WEBCORE_DIR} + ${WEBCORE_DIR}/bindings/js + ${WEBCORE_DIR}/testing/js +) + +set(TestNetscapePlugin_SOURCES + TestNetscapePlugIn/PluginObject.cpp + TestNetscapePlugIn/PluginTest.cpp + TestNetscapePlugIn/TestObject.cpp + TestNetscapePlugIn/main.cpp + + 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/LogNPPSetWindow.cpp + TestNetscapePlugIn/Tests/NPDeallocateCalledBeforeNPShutdown.cpp + TestNetscapePlugIn/Tests/NPPNewFails.cpp + TestNetscapePlugIn/Tests/NPPSetWindowCalledDuringDestruction.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/Tests/ToStringAndValueOfObject.cpp + TestNetscapePlugIn/Tests/URLRedirect.cpp +) + +set(TestNetscapePlugin_LIBRARIES + JavaScriptCore + WTF + WebCoreTestSupport + WebKit +) + +list(APPEND TestNetscapePlugin_LIBRARIES + WebKit +) + +WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() + +include_directories(${DumpRenderTree_INCLUDE_DIRECTORIES}) +include_directories(SYSTEM ${DumpRenderTree_SYSTEM_INCLUDE_DIRECTORIES}) + +add_executable(DumpRenderTree ${DumpRenderTree_SOURCES}) +target_link_libraries(DumpRenderTree ${DumpRenderTree_LIBRARIES}) +set_target_properties(DumpRenderTree PROPERTIES FOLDER "Tools") + +if (ENABLE_NETSCAPE_PLUGIN_API) + add_library(TestNetscapePlugin SHARED ${TestNetscapePlugin_SOURCES}) + target_link_libraries(TestNetscapePlugin ${TestNetscapePlugin_LIBRARIES}) +endif () + +if (WIN32) + add_dependencies(DumpRenderTree DumpRenderTreeLib) +endif () diff --git a/Tools/DumpRenderTree/DefaultPolicyDelegate.m b/Tools/DumpRenderTree/DefaultPolicyDelegate.m deleted file mode 100644 index 4515bfb0e..000000000 --- a/Tools/DumpRenderTree/DefaultPolicyDelegate.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// 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.h b/Tools/DumpRenderTree/DumpRenderTree.h index 47f88e58f..2a2ea1467 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.h +++ b/Tools/DumpRenderTree/DumpRenderTree.h @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -34,7 +34,7 @@ #include <wtf/Platform.h> #endif -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #include "DumpRenderTreeMac.h" #elif PLATFORM(WIN) #include "DumpRenderTreeWin.h" @@ -42,8 +42,6 @@ #include "DumpRenderTreeGtk.h" #elif PLATFORM(EFL) #include "DumpRenderTreeEfl.h" -#elif PLATFORM(BLACKBERRY) -#include "DumpRenderTreeBlackBerry.h" #endif #include <string> diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln deleted file mode 100644 index 285e25259..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree.sln +++ /dev/null @@ -1,56 +0,0 @@ - -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 deleted file mode 100644 index 06dafbb07..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj +++ /dev/null @@ -1,282 +0,0 @@ -<?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 deleted file mode 100644 index 17161e70e..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTree.vcxproj.filters +++ /dev/null @@ -1,197 +0,0 @@ -<?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 deleted file mode 100644 index b5045231e..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeApple.props +++ /dev/null @@ -1,11 +0,0 @@ -<?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 deleted file mode 100644 index fe840d2f6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeCommon.props +++ /dev/null @@ -1,16 +0,0 @@ -<?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 deleted file mode 100644 index 9c75bc73f..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebug.props +++ /dev/null @@ -1,10 +0,0 @@ -<?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 deleted file mode 100644 index 77fc5cc88..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeDebugWinCairo.props +++ /dev/null @@ -1,17 +0,0 @@ -<?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 deleted file mode 100644 index 620391b42..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncher.vcxproj +++ /dev/null @@ -1,230 +0,0 @@ -<?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 deleted file mode 100644 index 7a96a94db..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherCommon.props +++ /dev/null @@ -1,17 +0,0 @@ -<?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 deleted file mode 100644 index d71530a4b..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherDebug.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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 deleted file mode 100644 index bbac39e8e..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherProduction.props +++ /dev/null @@ -1,12 +0,0 @@ -<?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 deleted file mode 100644 index e0b4f3e74..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeLauncherRelease.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePostBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePostBuild.cmd deleted file mode 100644 index 26707cac6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePostBuild.cmd +++ /dev/null @@ -1 +0,0 @@ -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePreBuild.cmd deleted file mode 100644 index 43c41c896..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreePreBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -%SystemDrive%\cygwin\bin\which.exe bash -if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% -cmd /c -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed" -if errorlevel 1 exit 1 -echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed" - -mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\include\DumpRenderTree" -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" - -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 "%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 deleted file mode 100644 index d019339ad..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeProduction.props +++ /dev/null @@ -1,14 +0,0 @@ -<?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 deleted file mode 100644 index 8bcd226d6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeRelease.props +++ /dev/null @@ -1,10 +0,0 @@ -<?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 deleted file mode 100644 index d2e6434d8..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/DumpRenderTree/DumpRenderTreeReleaseWinCairo.props +++ /dev/null @@ -1,17 +0,0 @@ -<?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 deleted file mode 100644 index fefaa7214..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiff.vcxproj +++ /dev/null @@ -1,191 +0,0 @@ -<?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 deleted file mode 100644 index 481dd6611..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommon.props +++ /dev/null @@ -1,14 +0,0 @@ -<?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 deleted file mode 100644 index 4a7b11db6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffCommonWinCairo.props +++ /dev/null @@ -1,14 +0,0 @@ -<?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 deleted file mode 100644 index e1a01da8e..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebug.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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 deleted file mode 100644 index 1ede8e67f..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffDebugWinCairo.props +++ /dev/null @@ -1,9 +0,0 @@ -<?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 deleted file mode 100644 index 3c6d90c3c..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncher.vcxproj +++ /dev/null @@ -1,172 +0,0 @@ -<?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 deleted file mode 100644 index d2518ea56..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherCommon.props +++ /dev/null @@ -1,17 +0,0 @@ -<?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 deleted file mode 100644 index caeb2c270..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherDebug.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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 deleted file mode 100644 index c927a95f3..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherProduction.props +++ /dev/null @@ -1,12 +0,0 @@ -<?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 deleted file mode 100644 index a9b230b60..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffLauncherRelease.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPostBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPostBuild.cmd deleted file mode 100644 index 26707cac6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPostBuild.cmd +++ /dev/null @@ -1 +0,0 @@ -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPreBuild.cmd deleted file mode 100644 index a77077674..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffPreBuild.cmd +++ /dev/null @@ -1,6 +0,0 @@ -%SystemDrive%\cygwin\bin\which.exe bash -if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% -cmd /c -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed" -if errorlevel 1 exit 1 -echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props deleted file mode 100644 index 731805d77..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffProduction.props +++ /dev/null @@ -1,12 +0,0 @@ -<?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 deleted file mode 100644 index 274a760b7..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffRelease.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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 deleted file mode 100644 index d3a08b48d..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/ImageDiff/ImageDiffReleaseWinCairo.props +++ /dev/null @@ -1,9 +0,0 @@ -<?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/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.def b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.def deleted file mode 100644 index a0ea7a984..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.rc b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.rc deleted file mode 100644 index a9446c9f7..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.rc +++ /dev/null @@ -1,102 +0,0 @@ -// 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 deleted file mode 100644 index cbba93b14..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj +++ /dev/null @@ -1,225 +0,0 @@ -<?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 deleted file mode 100644 index da42a5708..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePlugin.vcxproj.filters +++ /dev/null @@ -1,139 +0,0 @@ -<?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 deleted file mode 100644 index ff33e6f28..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginCommon.props +++ /dev/null @@ -1,16 +0,0 @@ -<?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 deleted file mode 100644 index d56c0e6b4..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginDebug.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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 deleted file mode 100644 index 26707cac6..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPostBuild.cmd +++ /dev/null @@ -1 +0,0 @@ -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPreBuild.cmd b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPreBuild.cmd deleted file mode 100644 index a77077674..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginPreBuild.cmd +++ /dev/null @@ -1,6 +0,0 @@ -%SystemDrive%\cygwin\bin\which.exe bash -if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% -cmd /c -if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed" -if errorlevel 1 exit 1 -echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props deleted file mode 100644 index d367b0c63..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginProduction.props +++ /dev/null @@ -1,12 +0,0 @@ -<?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 deleted file mode 100644 index 478ed3a84..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/TestNetscapePluginRelease.props +++ /dev/null @@ -1,8 +0,0 @@ -<?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/DumpRenderTree.vcxproj/TestNetscapePlugin/resource.h b/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/resource.h deleted file mode 100644 index b0ce34048..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.vcxproj/TestNetscapePlugin/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by TestNetscapePlugin.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj deleted file mode 100644 index 97672ab9f..000000000 --- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1327 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXAggregateTarget section */ - A84F608D08B1370600E9745F /* All */ = { - isa = PBXAggregateTarget; - buildConfigurationList = A84F609208B1371400E9745F /* Build configuration list for PBXAggregateTarget "All" */; - buildPhases = ( - ); - dependencies = ( - 2D403F211508736C005358D2 /* PBXTargetDependency */, - A84F609108B1370E00E9745F /* PBXTargetDependency */, - A84F608F08B1370E00E9745F /* PBXTargetDependency */, - 141BF238096A451E00E0753C /* PBXTargetDependency */, - 5DC82A701023C93D00FD1D3B /* PBXTargetDependency */, - ); - name = All; - productName = All; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */; }; - 0F37A4AA11E6629100275F54 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A752A108AF5D1F00138E45 /* QuartzCore.framework */; }; - 141BF435096A455900E0753C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; }; - 141BF436096A455900E0753C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; - 141BF438096A455900E0753C /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; }; - 141BF439096A455900E0753C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; }; - 141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; }; - 14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; }; - 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */; }; - 1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E4296141141C400388758 /* PrivateBrowsing.cpp */; }; - 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */; }; - 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 */; }; - 1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; }; - 1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; }; - 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; }; - 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; }; - 1ACF898D132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */; }; - 1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */; }; - 1AD8683F163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */; }; - 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; }; - 1AFF66BC137DEFD200791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFF66BB137DEA8300791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp */; }; - 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; }; - 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 */; }; - 2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D403EA215087142005358D2 /* LayoutTestHelper.m */; }; - 31117B3C15D9A56A00163BC8 /* MockWebNotificationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */; }; - 31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */; }; - 3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */; }; - 3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */; }; - 417DAA1D137B3E24007C57FB /* WebCoreTestSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 417DAA1C137B3E24007C57FB /* WebCoreTestSupport.h */; }; - 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */; }; - 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */; }; - 4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */; }; - 4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD6A11313C8124000EA9737 /* FormValue.cpp */; }; - 5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */; }; - 51134C9916014FDC001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51134C9816014FDB001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp */; }; - 5113DE6715F6CBE5005EC8B3 /* NPPNewFails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5113DE6615F6CBE5005EC8B3 /* NPPNewFails.cpp */; }; - 515C0CD015EE785700F5A613 /* LogNPPSetWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */; }; - 515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */; }; - 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; }; - 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F69E10714A57007AA393 /* HistoryDelegate.h */; }; - 51CACBD815D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CACBD715D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp */; }; - 53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */; }; - 53CBB833134E42F3001CE6A4 /* CyclicRedundancyCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */; }; - 5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */ = {isa = PBXBuildFile; fileRef = AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */; }; - 5DB9AC980F722C3600684641 /* WebKitWeightWatcher100.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */; }; - 5DB9AC990F722C3600684641 /* WebKitWeightWatcher200.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */; }; - 5DB9AC9A0F722C3600684641 /* WebKitWeightWatcher300.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09730DAC3CB600C8B4E5 /* WebKitWeightWatcher300.ttf */; }; - 5DB9AC9B0F722C3600684641 /* WebKitWeightWatcher400.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09740DAC3CB600C8B4E5 /* WebKitWeightWatcher400.ttf */; }; - 5DB9AC9C0F722C3600684641 /* WebKitWeightWatcher500.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09750DAC3CB600C8B4E5 /* WebKitWeightWatcher500.ttf */; }; - 5DB9AC9D0F722C3600684641 /* WebKitWeightWatcher600.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09760DAC3CB600C8B4E5 /* WebKitWeightWatcher600.ttf */; }; - 5DB9AC9E0F722C3600684641 /* WebKitWeightWatcher700.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */; }; - 5DB9AC9F0F722C3600684641 /* WebKitWeightWatcher800.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */; }; - 5DB9ACA00F722C3600684641 /* WebKitWeightWatcher900.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */; }; - 5DE8AE4413A2C15900D6A37D /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */; }; - 80045AED147718E7008290A8 /* AccessibilityNotificationHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 80045AEB147718E7008290A8 /* AccessibilityNotificationHandler.h */; }; - 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 80045AEC147718E7008290A8 /* AccessibilityNotificationHandler.mm */; }; - 8465E2C70FFA8DF2003B8342 /* PixelDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */; }; - 8CCDA82A151A72D10003F937 /* SampleFont.sfont in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 8CCDA81F151A56550003F937 /* SampleFont.sfont */; }; - 9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */; }; - 9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; }; - 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */; }; - A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; - A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; }; - A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; }; - A8B91ADA0CF3B32F008F91FF /* DumpRenderTreePasteboard.m in Sources */ = {isa = PBXBuildFile; fileRef = A8B91AD70CF3B32F008F91FF /* DumpRenderTreePasteboard.m */; }; - A8B91ADC0CF3B32F008F91FF /* DumpRenderTreeWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8B91AD90CF3B32F008F91FF /* DumpRenderTreeWindow.mm */; }; - A8B91AE00CF3B372008F91FF /* DumpRenderTreeWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A8B91ADD0CF3B372008F91FF /* DumpRenderTreeWindow.h */; }; - A8B91AE20CF3B372008F91FF /* DumpRenderTreePasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A8B91ADF0CF3B372008F91FF /* DumpRenderTreePasteboard.h */; }; - A8B91BFD0CF522B4008F91FF /* CheckedMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8B91BF70CF522B4008F91FF /* CheckedMalloc.cpp */; }; - 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 */; }; - BC0131DA0C9772010087317D /* TestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0131D80C9772010087317D /* TestRunner.cpp */; }; - BC0131DB0C9772010087317D /* TestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0131D90C9772010087317D /* TestRunner.h */; }; - BC0E24E00E2D9451001B6BC2 /* AccessibilityUIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */; }; - BC0E24E10E2D9451001B6BC2 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */; }; - 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 */; }; - 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 */; }; - BCA18B230C9B014B00114369 /* GCControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B210C9B014B00114369 /* GCControllerMac.mm */; }; - BCA18B240C9B014B00114369 /* TestRunnerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B220C9B014B00114369 /* TestRunnerMac.mm */; }; - BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B250C9B015C00114369 /* WorkQueueItemMac.mm */; }; - BCA18B310C9B01B400114369 /* ObjCController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B2F0C9B01B400114369 /* ObjCController.h */; }; - BCA18B320C9B01B400114369 /* ObjCController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B300C9B01B400114369 /* ObjCController.m */; }; - BCA18B380C9B021900114369 /* AppleScriptController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B360C9B021900114369 /* AppleScriptController.h */; }; - BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B370C9B021900114369 /* AppleScriptController.m */; }; - BCA18B3C0C9B024900114369 /* TextInputController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B3A0C9B024900114369 /* TextInputController.h */; }; - BCA18B490C9B02C400114369 /* TextInputController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B480C9B02C400114369 /* TextInputController.m */; }; - BCA18B610C9B08C200114369 /* EditingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B570C9B08C200114369 /* EditingDelegate.h */; }; - BCA18B620C9B08C200114369 /* EditingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B580C9B08C200114369 /* EditingDelegate.mm */; }; - BCA18B630C9B08C200114369 /* FrameLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B590C9B08C200114369 /* FrameLoadDelegate.h */; }; - BCA18B640C9B08C200114369 /* FrameLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B5A0C9B08C200114369 /* FrameLoadDelegate.mm */; }; - BCA18B650C9B08C200114369 /* PolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B5B0C9B08C200114369 /* PolicyDelegate.h */; }; - BCA18B660C9B08C200114369 /* PolicyDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B5C0C9B08C200114369 /* PolicyDelegate.mm */; }; - BCA18B670C9B08C200114369 /* ResourceLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B5D0C9B08C200114369 /* ResourceLoadDelegate.h */; }; - BCA18B680C9B08C200114369 /* ResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B5E0C9B08C200114369 /* ResourceLoadDelegate.mm */; }; - BCA18B690C9B08C200114369 /* UIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B5F0C9B08C200114369 /* UIDelegate.h */; }; - BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B600C9B08C200114369 /* UIDelegate.mm */; }; - BCA18B6F0C9B08DB00114369 /* EventSendingController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B6B0C9B08DB00114369 /* EventSendingController.h */; }; - BCA18B700C9B08DB00114369 /* EventSendingController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B6C0C9B08DB00114369 /* EventSendingController.mm */; }; - BCA18B710C9B08DB00114369 /* NavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B6D0C9B08DB00114369 /* NavigationController.h */; }; - BCA18B720C9B08DB00114369 /* NavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B6E0C9B08DB00114369 /* NavigationController.m */; }; - BCA18B7A0C9B08F100114369 /* DumpRenderTreeDraggingInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B730C9B08F100114369 /* DumpRenderTreeDraggingInfo.h */; }; - BCA18B7B0C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B740C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm */; }; - BCA18B7D0C9B08F100114369 /* ObjCPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B760C9B08F100114369 /* ObjCPlugin.h */; }; - BCA18B7E0C9B08F100114369 /* ObjCPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B770C9B08F100114369 /* ObjCPlugin.m */; }; - BCA18B7F0C9B08F100114369 /* ObjCPluginFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18B780C9B08F100114369 /* ObjCPluginFunction.h */; }; - BCA18B800C9B08F100114369 /* ObjCPluginFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA18B790C9B08F100114369 /* ObjCPluginFunction.m */; }; - BCA18C0B0C9B59EF00114369 /* DumpRenderTreeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA18C0A0C9B59EF00114369 /* DumpRenderTreeMac.h */; }; - BCA18C470C9B5B9400114369 /* DumpRenderTree.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCA18C460C9B5B9400114369 /* DumpRenderTree.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; - BCB284C70CFA83C4007E533E /* PixelDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB2848A0CFA820F007E533E /* PixelDumpSupport.h */; }; - BCB284CD0CFA83C8007E533E /* PixelDumpSupportCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB284880CFA8202007E533E /* PixelDumpSupportCG.cpp */; }; - BCB284D00CFA83CC007E533E /* PixelDumpSupportCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB284890CFA8202007E533E /* PixelDumpSupportCG.h */; }; - BCB284D60CFA83D1007E533E /* PixelDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */; }; - BCB284F60CFA84F8007E533E /* ImageDiffCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */; }; - BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */; }; - BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */; }; - BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF6C64F0C98E9C000AC063E /* GCController.cpp */; }; - C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */; }; - C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */; }; - C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */; }; - C0EC3C9C12787F0500939164 /* NullNPPGetValuePointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */; }; - E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; }; - E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 141BF237096A451E00E0753C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 141BF21E096A441D00E0753C; - remoteInfo = TestNetscapePlugIn; - }; - 2D403F201508736C005358D2 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 2D403EB2150871F9005358D2; - remoteInfo = LayoutTestHelper; - }; - 378C802315AB589B00746821 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9340994A08540CAE007F3BC8; - remoteInfo = DumpRenderTree; - }; - 5DC82A6F1023C93D00FD1D3B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5DC82A661023C8DE00FD1D3B; - remoteInfo = "DumpRenderTree Perl Support"; - }; - A84F608E08B1370E00E9745F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = B5A7525A08AF4A4A00138E45; - remoteInfo = ImageDiff; - }; - A84F609008B1370E00E9745F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9340994A08540CAE007F3BC8; - remoteInfo = DumpRenderTree; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 5DB9ACAA0F722C4400684641 /* Copy Font Files */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = DumpRenderTree.resources; - dstSubfolderSpec = 7; - 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 */, - 5DB9AC9B0F722C3600684641 /* WebKitWeightWatcher400.ttf in Copy Font Files */, - 5DB9AC9C0F722C3600684641 /* WebKitWeightWatcher500.ttf in Copy Font Files */, - 5DB9AC9D0F722C3600684641 /* WebKitWeightWatcher600.ttf in Copy Font Files */, - 5DB9AC9E0F722C3600684641 /* WebKitWeightWatcher700.ttf in Copy Font Files */, - 5DB9AC9F0F722C3600684641 /* WebKitWeightWatcher800.ttf in Copy Font Files */, - 5DB9ACA00F722C3600684641 /* WebKitWeightWatcher900.ttf in Copy Font Files */, - ); - name = "Copy Font Files"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginObjectMac.mm; sourceTree = "<group>"; }; - 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestNetscapePlugIn.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; - 141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; }; - 141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; }; - 14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; }; - 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SupportsCarbonEventModel.cpp; sourceTree = "<group>"; }; - 1A1E4296141141C400388758 /* PrivateBrowsing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateBrowsing.cpp; sourceTree = "<group>"; }; - 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOpenInDestroyStream.cpp; sourceTree = "<group>"; }; - 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>"; }; - 1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; }; - 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; }; - 1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; }; - 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; }; - 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPDeallocateCalledBeforeNPShutdown.cpp; sourceTree = "<group>"; }; - 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetUserAgentWithNullNPPFromNPPNew.cpp; sourceTree = "<group>"; }; - 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeCallsWithNullNPP.cpp; sourceTree = "<group>"; }; - 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; }; - 1AFF66BB137DEA8300791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLNotifyWithURLThatFailsToLoad.cpp; sourceTree = "<group>"; }; - 23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; - 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>"; }; - 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockWebNotificationProvider.mm; path = mac/MockWebNotificationProvider.mm; sourceTree = "<group>"; }; - 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; }; - 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher100.ttf; path = fonts/WebKitWeightWatcher100.ttf; sourceTree = "<group>"; }; - 375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher200.ttf; path = fonts/WebKitWeightWatcher200.ttf; sourceTree = "<group>"; }; - 375F09730DAC3CB600C8B4E5 /* WebKitWeightWatcher300.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher300.ttf; path = fonts/WebKitWeightWatcher300.ttf; sourceTree = "<group>"; }; - 375F09740DAC3CB600C8B4E5 /* WebKitWeightWatcher400.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher400.ttf; path = fonts/WebKitWeightWatcher400.ttf; sourceTree = "<group>"; }; - 375F09750DAC3CB600C8B4E5 /* WebKitWeightWatcher500.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher500.ttf; path = fonts/WebKitWeightWatcher500.ttf; sourceTree = "<group>"; }; - 375F09760DAC3CB600C8B4E5 /* WebKitWeightWatcher600.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher600.ttf; path = fonts/WebKitWeightWatcher600.ttf; sourceTree = "<group>"; }; - 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; }; - 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; }; - 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; }; - 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageTrackerDelegate.h; sourceTree = "<group>"; }; - 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StorageTrackerDelegate.mm; sourceTree = "<group>"; }; - 417DAA1C137B3E24007C57FB /* WebCoreTestSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebCoreTestSupport.h; path = WebCoreTestSupport/WebCoreTestSupport.h; sourceTree = BUILT_PRODUCTS_DIR; }; - 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupportMac.mm; path = mac/WebArchiveDumpSupportMac.mm; sourceTree = "<group>"; }; - 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = cf/WebArchiveDumpSupport.h; sourceTree = "<group>"; }; - 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebArchiveDumpSupport.cpp; path = cf/WebArchiveDumpSupport.cpp; sourceTree = "<group>"; }; - 4AD6A11313C8124000EA9737 /* FormValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormValue.cpp; sourceTree = "<group>"; }; - 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SlowNPPNew.cpp; path = TestNetscapePlugIn/Tests/SlowNPPNew.cpp; sourceTree = SOURCE_ROOT; }; - 51134C9816014FDB001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InvokeDestroysPluginWithinNPP_New.cpp; sourceTree = "<group>"; }; - 5113DE6615F6CBE5005EC8B3 /* NPPNewFails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPPNewFails.cpp; sourceTree = "<group>"; }; - 515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LogNPPSetWindow.cpp; sourceTree = "<group>"; }; - 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableObjectOverridesAllProperties.cpp; sourceTree = "<group>"; }; - 5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; }; - 5185F69F10714A57007AA393 /* HistoryDelegate.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = HistoryDelegate.mm; path = mac/HistoryDelegate.mm; sourceTree = "<group>"; }; - 51CACBD715D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EvaluateJSWithinNPP_New.cpp; path = TestNetscapePlugIn/Tests/EvaluateJSWithinNPP_New.cpp; sourceTree = SOURCE_ROOT; }; - 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CyclicRedundancyCheck.cpp; sourceTree = "<group>"; }; - 53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CyclicRedundancyCheck.h; sourceTree = "<group>"; }; - 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 80045AEB147718E7008290A8 /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessibilityNotificationHandler.h; path = mac/AccessibilityNotificationHandler.h; sourceTree = "<group>"; }; - 80045AEC147718E7008290A8 /* AccessibilityNotificationHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityNotificationHandler.mm; path = mac/AccessibilityNotificationHandler.mm; sourceTree = "<group>"; }; - 8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PixelDumpSupport.cpp; sourceTree = "<group>"; }; - 8CCDA81F151A56550003F937 /* SampleFont.sfont */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = SampleFont.sfont; path = fonts/SampleFont.sfont; sourceTree = "<group>"; }; - 9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; }; - 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpRenderTreeCommon.cpp; sourceTree = "<group>"; }; - A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; }; - A817090308B164D300CCB9FB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A84F608908B136DA00E9745F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; - A8B91AD70CF3B32F008F91FF /* DumpRenderTreePasteboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DumpRenderTreePasteboard.m; path = mac/DumpRenderTreePasteboard.m; sourceTree = "<group>"; }; - A8B91AD90CF3B32F008F91FF /* DumpRenderTreeWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeWindow.mm; path = mac/DumpRenderTreeWindow.mm; sourceTree = "<group>"; }; - A8B91ADD0CF3B372008F91FF /* DumpRenderTreeWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreeWindow.h; path = mac/DumpRenderTreeWindow.h; sourceTree = "<group>"; }; - A8B91ADF0CF3B372008F91FF /* DumpRenderTreePasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreePasteboard.h; path = mac/DumpRenderTreePasteboard.h; sourceTree = "<group>"; }; - A8B91BF70CF522B4008F91FF /* CheckedMalloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckedMalloc.cpp; path = mac/CheckedMalloc.cpp; sourceTree = "<group>"; }; - 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; }; - B5A752A108AF5D1F00138E45 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; - BC0131D80C9772010087317D /* TestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunner.cpp; sourceTree = "<group>"; }; - BC0131D90C9772010087317D /* TestRunner.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TestRunner.h; sourceTree = "<group>"; }; - BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityUIElement.h; sourceTree = "<group>"; }; - BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityUIElement.cpp; sourceTree = "<group>"; }; - 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>"; }; - 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>"; }; - BCA18B210C9B014B00114369 /* GCControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = GCControllerMac.mm; path = mac/GCControllerMac.mm; sourceTree = "<group>"; }; - BCA18B220C9B014B00114369 /* TestRunnerMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = TestRunnerMac.mm; path = mac/TestRunnerMac.mm; sourceTree = "<group>"; }; - BCA18B250C9B015C00114369 /* WorkQueueItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WorkQueueItemMac.mm; path = mac/WorkQueueItemMac.mm; sourceTree = "<group>"; }; - BCA18B2F0C9B01B400114369 /* ObjCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ObjCController.h; path = mac/ObjCController.h; sourceTree = "<group>"; }; - BCA18B300C9B01B400114369 /* ObjCController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ObjCController.m; path = mac/ObjCController.m; sourceTree = "<group>"; }; - BCA18B360C9B021900114369 /* AppleScriptController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppleScriptController.h; path = mac/AppleScriptController.h; sourceTree = "<group>"; }; - BCA18B370C9B021900114369 /* AppleScriptController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AppleScriptController.m; path = mac/AppleScriptController.m; sourceTree = "<group>"; }; - BCA18B3A0C9B024900114369 /* TextInputController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TextInputController.h; path = mac/TextInputController.h; sourceTree = "<group>"; }; - BCA18B480C9B02C400114369 /* TextInputController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TextInputController.m; path = mac/TextInputController.m; sourceTree = "<group>"; }; - BCA18B570C9B08C200114369 /* EditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = EditingDelegate.h; path = mac/EditingDelegate.h; sourceTree = "<group>"; }; - BCA18B580C9B08C200114369 /* EditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditingDelegate.mm; path = mac/EditingDelegate.mm; sourceTree = "<group>"; }; - BCA18B590C9B08C200114369 /* FrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FrameLoadDelegate.h; path = mac/FrameLoadDelegate.h; sourceTree = "<group>"; }; - BCA18B5A0C9B08C200114369 /* FrameLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = FrameLoadDelegate.mm; path = mac/FrameLoadDelegate.mm; sourceTree = "<group>"; }; - BCA18B5B0C9B08C200114369 /* PolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PolicyDelegate.h; path = mac/PolicyDelegate.h; sourceTree = "<group>"; }; - BCA18B5C0C9B08C200114369 /* PolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = PolicyDelegate.mm; path = mac/PolicyDelegate.mm; sourceTree = "<group>"; }; - BCA18B5D0C9B08C200114369 /* ResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ResourceLoadDelegate.h; path = mac/ResourceLoadDelegate.h; sourceTree = "<group>"; }; - BCA18B5E0C9B08C200114369 /* ResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = ResourceLoadDelegate.mm; path = mac/ResourceLoadDelegate.mm; sourceTree = "<group>"; }; - BCA18B5F0C9B08C200114369 /* UIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UIDelegate.h; path = mac/UIDelegate.h; sourceTree = "<group>"; }; - BCA18B600C9B08C200114369 /* UIDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = UIDelegate.mm; path = mac/UIDelegate.mm; sourceTree = "<group>"; }; - BCA18B6B0C9B08DB00114369 /* EventSendingController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = EventSendingController.h; path = mac/EventSendingController.h; sourceTree = "<group>"; }; - BCA18B6C0C9B08DB00114369 /* EventSendingController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EventSendingController.mm; path = mac/EventSendingController.mm; sourceTree = "<group>"; }; - BCA18B6D0C9B08DB00114369 /* NavigationController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NavigationController.h; path = mac/NavigationController.h; sourceTree = "<group>"; }; - BCA18B6E0C9B08DB00114369 /* NavigationController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NavigationController.m; path = mac/NavigationController.m; sourceTree = "<group>"; }; - BCA18B730C9B08F100114369 /* DumpRenderTreeDraggingInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreeDraggingInfo.h; path = mac/DumpRenderTreeDraggingInfo.h; sourceTree = "<group>"; }; - BCA18B740C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeDraggingInfo.mm; path = mac/DumpRenderTreeDraggingInfo.mm; sourceTree = "<group>"; }; - BCA18B760C9B08F100114369 /* ObjCPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ObjCPlugin.h; path = mac/ObjCPlugin.h; sourceTree = "<group>"; }; - BCA18B770C9B08F100114369 /* ObjCPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ObjCPlugin.m; path = mac/ObjCPlugin.m; sourceTree = "<group>"; }; - BCA18B780C9B08F100114369 /* ObjCPluginFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ObjCPluginFunction.h; path = mac/ObjCPluginFunction.h; sourceTree = "<group>"; }; - BCA18B790C9B08F100114369 /* ObjCPluginFunction.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ObjCPluginFunction.m; path = mac/ObjCPluginFunction.m; sourceTree = "<group>"; }; - BCA18C0A0C9B59EF00114369 /* DumpRenderTreeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreeMac.h; path = mac/DumpRenderTreeMac.h; sourceTree = "<group>"; }; - BCA18C460C9B5B9400114369 /* DumpRenderTree.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTree.mm; path = mac/DumpRenderTree.mm; sourceTree = "<group>"; }; - BCB281EE0CFA713D007E533E /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = Base.xcconfig; path = mac/Configurations/Base.xcconfig; sourceTree = "<group>"; }; - BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = DumpRenderTree.xcconfig; path = mac/Configurations/DumpRenderTree.xcconfig; sourceTree = "<group>"; }; - BCB282F40CFA7450007E533E /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = DebugRelease.xcconfig; path = mac/Configurations/DebugRelease.xcconfig; sourceTree = "<group>"; }; - BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = ImageDiff.xcconfig; path = mac/Configurations/ImageDiff.xcconfig; sourceTree = "<group>"; }; - BCB283DE0CFA7C20007E533E /* TestNetscapePlugIn.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = TestNetscapePlugIn.xcconfig; path = mac/Configurations/TestNetscapePlugIn.xcconfig; sourceTree = "<group>"; }; - BCB284880CFA8202007E533E /* PixelDumpSupportCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PixelDumpSupportCG.cpp; path = cg/PixelDumpSupportCG.cpp; sourceTree = "<group>"; }; - BCB284890CFA8202007E533E /* PixelDumpSupportCG.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PixelDumpSupportCG.h; path = cg/PixelDumpSupportCG.h; sourceTree = "<group>"; }; - BCB2848A0CFA820F007E533E /* PixelDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PixelDumpSupport.h; sourceTree = "<group>"; }; - BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = PixelDumpSupportMac.mm; path = mac/PixelDumpSupportMac.mm; sourceTree = "<group>"; }; - BCB284B20CFA82CB007E533E /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; - BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageDiffCG.cpp; path = cg/ImageDiffCG.cpp; sourceTree = "<group>"; }; - BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityController.h; sourceTree = "<group>"; }; - BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; }; - BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = "<group>"; }; - BCF6C64F0C98E9C000AC063E /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; }; - C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPPSetWindowCalledDuringDestruction.cpp; sourceTree = "<group>"; }; - C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PassDifferentNPPStruct.cpp; sourceTree = "<group>"; }; - C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvaluateJSAfterRemovingPluginElement.cpp; sourceTree = "<group>"; }; - C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NullNPPGetValuePointer.cpp; sourceTree = "<group>"; }; - E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; }; - E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 141BF21D096A441D00E0753C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 141BF439096A455900E0753C /* Carbon.framework in Frameworks */, - 141BF436096A455900E0753C /* Cocoa.framework in Frameworks */, - 141BF438096A455900E0753C /* JavaScriptCore.framework in Frameworks */, - 0F37A4AA11E6629100275F54 /* QuartzCore.framework in Frameworks */, - 141BF435096A455900E0753C /* WebKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D403F03150871F9005358D2 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D403F05150871F9005358D2 /* Carbon.framework in Frameworks */, - 2D403F06150871F9005358D2 /* Cocoa.framework in Frameworks */, - 2D403F08150871F9005358D2 /* OpenGL.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9340994F08540CAE007F3BC8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 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 */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B5A7525F08AF4A4A00138E45 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AE8259F408D22463000507AB /* Carbon.framework in Frameworks */, - A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */, - B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = { - isa = PBXGroup; - children = ( - 1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */, - 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */, - 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */, - 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */, - 1422A2750AF6F4BD00E1A883 /* Delegates */, - 1422A2690AF6F45200E1A883 /* Controllers */, - BCB284870CFA81ED007E533E /* PixelDump */, - A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */, - BCA18C460C9B5B9400114369 /* DumpRenderTree.mm */, - A8B91BF70CF522B4008F91FF /* CheckedMalloc.cpp */, - A8B91BF90CF522B4008F91FF /* CheckedMalloc.h */, - BC4741290D038A4C0072B006 /* JavaScriptThreading.h */, - 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 */, - BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */, - BC9D90220C97472E0099A4A3 /* WorkQueue.h */, - BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */, - A8B91AD20CF3B305008F91FF /* AppKit Overrides */, - A8B91AC40CF3B170008F91FF /* ObjCPlugin */, - 141BF1F5096A439800E0753C /* TestNetscapePlugIn */, - 2D403EA015087135005358D2 /* LayoutTestHelper */, - 9345229B0BD12B2C0086EDA0 /* Resources */, - 417DA9181373674D007C57FB /* WebCoreTestSupport */, - A803FF6409CAACC1009B2A37 /* Frameworks */, - 9340995508540CAF007F3BC8 /* Products */, - BCB281ED0CFA711D007E533E /* Configurations */, - ); - name = DumpRenderTree; - sourceTree = "<group>"; - }; - 141BF1F5096A439800E0753C /* TestNetscapePlugIn */ = { - isa = PBXGroup; - children = ( - 1A215A6E11F25FF1008AD0F5 /* Tests */, - 141BF448096A45C800E0753C /* Info.plist */, - 1AC6C77F0D07589B00CD3161 /* main.cpp */, - 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */, - 141BF447096A45C800E0753C /* PluginObject.h */, - 0F37A4A611E6628700275F54 /* PluginObjectMac.mm */, - 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */, - 1A215A8011F2609C008AD0F5 /* PluginTest.h */, - 1AC6C7810D07589B00CD3161 /* TestObject.cpp */, - 1A8F024C0BB9B056008CFA34 /* TestObject.h */, - ); - path = TestNetscapePlugIn; - sourceTree = "<group>"; - }; - 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 */, - 29CFBA0F122736E600BC30C0 /* AccessibilityTextMarker.cpp */, - 29CFBA0E122736E600BC30C0 /* AccessibilityTextMarker.h */, - 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */, - BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */, - BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */, - AA5A15EE16E15CD000F7C561 /* AccessibilityUIElementIOS.mm */, - BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */, - BCA18B360C9B021900114369 /* AppleScriptController.h */, - BCA18B370C9B021900114369 /* AppleScriptController.m */, - BCA18B6B0C9B08DB00114369 /* EventSendingController.h */, - BCA18B6C0C9B08DB00114369 /* EventSendingController.mm */, - BCF6C64F0C98E9C000AC063E /* GCController.cpp */, - 14770FE00A22ADF7009342EE /* GCController.h */, - BCA18B210C9B014B00114369 /* GCControllerMac.mm */, - E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */, - E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */, - 31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */, - 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */, - BCA18B6D0C9B08DB00114369 /* NavigationController.h */, - BCA18B6E0C9B08DB00114369 /* NavigationController.m */, - BCA18B2F0C9B01B400114369 /* ObjCController.h */, - BCA18B300C9B01B400114369 /* ObjCController.m */, - BC0131D80C9772010087317D /* TestRunner.cpp */, - BC0131D90C9772010087317D /* TestRunner.h */, - BCA18B220C9B014B00114369 /* TestRunnerMac.mm */, - BCA18B3A0C9B024900114369 /* TextInputController.h */, - BCA18B480C9B02C400114369 /* TextInputController.m */, - ); - name = Controllers; - sourceTree = "<group>"; - usesTabs = 0; - }; - 1422A2750AF6F4BD00E1A883 /* Delegates */ = { - isa = PBXGroup; - children = ( - BCA18B570C9B08C200114369 /* EditingDelegate.h */, - BCA18B580C9B08C200114369 /* EditingDelegate.mm */, - BCA18B590C9B08C200114369 /* FrameLoadDelegate.h */, - BCA18B5A0C9B08C200114369 /* FrameLoadDelegate.mm */, - 5185F69E10714A57007AA393 /* HistoryDelegate.h */, - 5185F69F10714A57007AA393 /* HistoryDelegate.mm */, - BCA18B5B0C9B08C200114369 /* PolicyDelegate.h */, - BCA18B5C0C9B08C200114369 /* PolicyDelegate.mm */, - BCA18B5D0C9B08C200114369 /* ResourceLoadDelegate.h */, - BCA18B5E0C9B08C200114369 /* ResourceLoadDelegate.mm */, - 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */, - 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */, - BCA18B5F0C9B08C200114369 /* UIDelegate.h */, - BCA18B600C9B08C200114369 /* UIDelegate.mm */, - ); - name = Delegates; - sourceTree = "<group>"; - }; - 1A215A6E11F25FF1008AD0F5 /* Tests */ = { - isa = PBXGroup; - children = ( - 1A31EB3613466AC100017372 /* mac */, - 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */, - C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */, - 51CACBD715D96FD000EB53A2 /* EvaluateJSWithinNPP_New.cpp */, - 4AD6A11313C8124000EA9737 /* FormValue.cpp */, - 1AFF66BB137DEA8300791696 /* GetURLNotifyWithURLThatFailsToLoad.cpp */, - 1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */, - 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */, - 1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */, - 51134C9816014FDB001AA513 /* InvokeDestroysPluginWithinNPP_New.cpp */, - 515C0CCF15EE785700F5A613 /* LogNPPSetWindow.cpp */, - 1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */, - 5113DE6615F6CBE5005EC8B3 /* NPPNewFails.cpp */, - C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */, - 1AD8683D163B2FD000A28583 /* NPRuntimeCallsWithNullNPP.cpp */, - 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */, - 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */, - C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */, - C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */, - 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */, - 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */, - 1A1E4296141141C400388758 /* PrivateBrowsing.cpp */, - 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */, - 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */, - ); - path = Tests; - sourceTree = "<group>"; - }; - 1A31EB3613466AC100017372 /* mac */ = { - isa = PBXGroup; - children = ( - 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */, - 1A31EB3713466AC100017372 /* ConvertPoint.cpp */, - 1A14C8A31406DE0400B254F7 /* SupportsCarbonEventModel.cpp */, - ); - path = mac; - sourceTree = "<group>"; - }; - 2D403EA015087135005358D2 /* LayoutTestHelper */ = { - isa = PBXGroup; - children = ( - 2D403EA215087142005358D2 /* LayoutTestHelper.m */, - ); - name = LayoutTestHelper; - sourceTree = "<group>"; - }; - 417DA9181373674D007C57FB /* WebCoreTestSupport */ = { - isa = PBXGroup; - children = ( - 417DAA1C137B3E24007C57FB /* WebCoreTestSupport.h */, - ); - name = WebCoreTestSupport; - sourceTree = "<group>"; - }; - 9340995508540CAF007F3BC8 /* Products */ = { - isa = PBXGroup; - children = ( - 9340995408540CAF007F3BC8 /* DumpRenderTree */, - B5A7526708AF4A4A00138E45 /* ImageDiff */, - 2D403F19150871F9005358D2 /* LayoutTestHelper */, - 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */, - ); - name = Products; - sourceTree = "<group>"; - }; - 9345229B0BD12B2C0086EDA0 /* Resources */ = { - isa = PBXGroup; - children = ( - AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */, - 8CCDA81F151A56550003F937 /* SampleFont.sfont */, - 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */, - 375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */, - 375F09730DAC3CB600C8B4E5 /* WebKitWeightWatcher300.ttf */, - 375F09740DAC3CB600C8B4E5 /* WebKitWeightWatcher400.ttf */, - 375F09750DAC3CB600C8B4E5 /* WebKitWeightWatcher500.ttf */, - 375F09760DAC3CB600C8B4E5 /* WebKitWeightWatcher600.ttf */, - 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */, - 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */, - 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */, - ); - name = Resources; - sourceTree = "<group>"; - }; - A803FF6409CAACC1009B2A37 /* Frameworks */ = { - isa = PBXGroup; - children = ( - BCB284B20CFA82CB007E533E /* ApplicationServices.framework */, - AE8257EF08D22389000507AB /* Carbon.framework */, - A84F608908B136DA00E9745F /* Cocoa.framework */, - A817090308B164D300CCB9FB /* JavaScriptCore.framework */, - 5DE8AE4313A2C15800D6A37D /* libWebCoreTestSupport.dylib */, - 23BCB88F0EA57623003C6289 /* OpenGL.framework */, - B5A752A108AF5D1F00138E45 /* QuartzCore.framework */, - 9335435F03D75502008635CE /* WebKit.framework */, - ); - name = Frameworks; - sourceTree = "<group>"; - }; - A8B91AC40CF3B170008F91FF /* ObjCPlugin */ = { - isa = PBXGroup; - children = ( - BCA18B760C9B08F100114369 /* ObjCPlugin.h */, - BCA18B770C9B08F100114369 /* ObjCPlugin.m */, - BCA18B780C9B08F100114369 /* ObjCPluginFunction.h */, - BCA18B790C9B08F100114369 /* ObjCPluginFunction.m */, - BCA18B250C9B015C00114369 /* WorkQueueItemMac.mm */, - ); - name = ObjCPlugin; - sourceTree = "<group>"; - }; - A8B91AD20CF3B305008F91FF /* AppKit Overrides */ = { - isa = PBXGroup; - children = ( - A8B91ADF0CF3B372008F91FF /* DumpRenderTreePasteboard.h */, - A8B91AD70CF3B32F008F91FF /* DumpRenderTreePasteboard.m */, - A8B91ADD0CF3B372008F91FF /* DumpRenderTreeWindow.h */, - A8B91AD90CF3B32F008F91FF /* DumpRenderTreeWindow.mm */, - ); - name = "AppKit Overrides"; - sourceTree = "<group>"; - }; - BCB281ED0CFA711D007E533E /* Configurations */ = { - isa = PBXGroup; - children = ( - BCB281EE0CFA713D007E533E /* Base.xcconfig */, - BCB282F40CFA7450007E533E /* DebugRelease.xcconfig */, - BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */, - BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */, - BCB283DE0CFA7C20007E533E /* TestNetscapePlugIn.xcconfig */, - ); - name = Configurations; - sourceTree = "<group>"; - }; - BCB284870CFA81ED007E533E /* PixelDump */ = { - isa = PBXGroup; - children = ( - 53CBB830134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp */, - 53CBB831134E42F3001CE6A4 /* CyclicRedundancyCheck.h */, - BCB284F30CFA84F2007E533E /* ImageDiffCG.cpp */, - 8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */, - BCB2848A0CFA820F007E533E /* PixelDumpSupport.h */, - BCB284880CFA8202007E533E /* PixelDumpSupportCG.cpp */, - BCB284890CFA8202007E533E /* PixelDumpSupportCG.h */, - BCB2848C0CFA8221007E533E /* PixelDumpSupportMac.mm */, - ); - name = PixelDump; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 141BF44E096A45DD00E0753C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 141BF453096A45EB00E0753C /* PluginObject.h in Headers */, - 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */, - 1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9340994B08540CAE007F3BC8 /* Headers */ = { - 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 */, - 53CBB833134E42F3001CE6A4 /* CyclicRedundancyCheck.h in Headers */, - BCA18B7A0C9B08F100114369 /* DumpRenderTreeDraggingInfo.h in Headers */, - A8D79CEA0FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h in Headers */, - BCA18C0B0C9B59EF00114369 /* DumpRenderTreeMac.h in Headers */, - A8B91AE20CF3B372008F91FF /* DumpRenderTreePasteboard.h in Headers */, - 9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */, - A8B91AE00CF3B372008F91FF /* DumpRenderTreeWindow.h in Headers */, - BCA18B610C9B08C200114369 /* EditingDelegate.h in Headers */, - 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 */, - 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 */, - BCA18B7F0C9B08F100114369 /* ObjCPluginFunction.h in Headers */, - 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 */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B5A7525B08AF4A4A00138E45 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXLegacyTarget section */ - 5DC82A661023C8DE00FD1D3B /* DumpRenderTree Perl Support */ = { - isa = PBXLegacyTarget; - buildArgumentsString = "$(ACTION)"; - buildConfigurationList = 5DC82A6E1023C92A00FD1D3B /* Build configuration list for PBXLegacyTarget "DumpRenderTree Perl Support" */; - buildPhases = ( - ); - buildToolPath = make; - buildWorkingDirectory = "$(SRCROOT)/mac/PerlSupport"; - dependencies = ( - 378C802415AB589B00746821 /* PBXTargetDependency */, - ); - name = "DumpRenderTree Perl Support"; - passBuildSettingsInEnvironment = 1; - productName = "DumpRenderTree Perl Support"; - }; -/* End PBXLegacyTarget section */ - -/* Begin PBXNativeTarget section */ - 141BF21E096A441D00E0753C /* TestNetscapePlugIn */ = { - isa = PBXNativeTarget; - buildConfigurationList = 141BF221096A441E00E0753C /* Build configuration list for PBXNativeTarget "TestNetscapePlugIn" */; - buildPhases = ( - 141BF21B096A441D00E0753C /* Resources */, - 141BF44E096A45DD00E0753C /* Headers */, - 141BF21C096A441D00E0753C /* Sources */, - 141BF21D096A441D00E0753C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = TestNetscapePlugIn; - productName = TestNetscapePlugIn.plugin; - productReference = 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */; - productType = "com.apple.product-type.bundle"; - }; - 2D403EB2150871F9005358D2 /* LayoutTestHelper */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D403F15150871F9005358D2 /* Build configuration list for PBXNativeTarget "LayoutTestHelper" */; - buildPhases = ( - 2D403ED8150871F9005358D2 /* Sources */, - 2D403F03150871F9005358D2 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = LayoutTestHelper; - productInstallPath = "$(HOME)/bin"; - productName = DumpRenderTree; - productReference = 2D403F19150871F9005358D2 /* LayoutTestHelper */; - productType = "com.apple.product-type.tool"; - }; - 9340994A08540CAE007F3BC8 /* DumpRenderTree */ = { - isa = PBXNativeTarget; - buildConfigurationList = 149C29BF08902C6D008A9EFC /* Build configuration list for PBXNativeTarget "DumpRenderTree" */; - buildPhases = ( - 9340994B08540CAE007F3BC8 /* Headers */, - 9340994D08540CAE007F3BC8 /* Sources */, - 9340994F08540CAE007F3BC8 /* Frameworks */, - 5DB9ACAA0F722C4400684641 /* Copy Font Files */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = DumpRenderTree; - productInstallPath = "$(HOME)/bin"; - productName = DumpRenderTree; - productReference = 9340995408540CAF007F3BC8 /* DumpRenderTree */; - productType = "com.apple.product-type.tool"; - }; - B5A7525A08AF4A4A00138E45 /* ImageDiff */ = { - isa = PBXNativeTarget; - buildConfigurationList = B5A7526408AF4A4A00138E45 /* Build configuration list for PBXNativeTarget "ImageDiff" */; - buildPhases = ( - B5A7525B08AF4A4A00138E45 /* Headers */, - B5A7525D08AF4A4A00138E45 /* Sources */, - B5A7525F08AF4A4A00138E45 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ImageDiff; - productInstallPath = "$(HOME)/bin"; - productName = DumpRenderTree; - productReference = B5A7526708AF4A4A00138E45 /* ImageDiff */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - }; - buildConfigurationList = 149C29C308902C6D008A9EFC /* Build configuration list for PBXProject "DumpRenderTree" */; - compatibilityVersion = "Xcode 2.4"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* DumpRenderTree */; - productRefGroup = 9340995508540CAF007F3BC8 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - A84F608D08B1370600E9745F /* All */, - 9340994A08540CAE007F3BC8 /* DumpRenderTree */, - B5A7525A08AF4A4A00138E45 /* ImageDiff */, - 141BF21E096A441D00E0753C /* TestNetscapePlugIn */, - 5DC82A661023C8DE00FD1D3B /* DumpRenderTree Perl Support */, - 2D403EB2150871F9005358D2 /* LayoutTestHelper */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 141BF21B096A441D00E0753C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 141BF21C096A441D00E0753C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1A66C35114576A920099A115 /* ContentsScaleFactor.cpp in Sources */, - 1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */, - 1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */, - 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */, - C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.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 */, - 5113DE6715F6CBE5005EC8B3 /* NPPNewFails.cpp in Sources */, - C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.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 */, - 1A14C8A51406DE0400B254F7 /* SupportsCarbonEventModel.cpp in Sources */, - 1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D403ED8150871F9005358D2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9340994D08540CAE007F3BC8 /* Sources */ = { - 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 */, - 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 */, - A8B91ADC0CF3B32F008F91FF /* DumpRenderTreeWindow.mm in Sources */, - BCA18B620C9B08C200114369 /* EditingDelegate.mm in Sources */, - BCA18B700C9B08DB00114369 /* EventSendingController.mm in Sources */, - BCA18B640C9B08C200114369 /* FrameLoadDelegate.mm in Sources */, - BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */, - BCA18B230C9B014B00114369 /* GCControllerMac.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 */, - BCA18B800C9B08F100114369 /* ObjCPluginFunction.m in Sources */, - 8465E2C70FFA8DF2003B8342 /* PixelDumpSupport.cpp in Sources */, - 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 */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B5A7525D08AF4A4A00138E45 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BCB284F60CFA84F8007E533E /* ImageDiffCG.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 141BF238096A451E00E0753C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 141BF21E096A441D00E0753C /* TestNetscapePlugIn */; - targetProxy = 141BF237096A451E00E0753C /* PBXContainerItemProxy */; - }; - 2D403F211508736C005358D2 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 2D403EB2150871F9005358D2 /* LayoutTestHelper */; - targetProxy = 2D403F201508736C005358D2 /* PBXContainerItemProxy */; - }; - 378C802415AB589B00746821 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9340994A08540CAE007F3BC8 /* DumpRenderTree */; - targetProxy = 378C802315AB589B00746821 /* PBXContainerItemProxy */; - }; - 5DC82A701023C93D00FD1D3B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5DC82A661023C8DE00FD1D3B /* DumpRenderTree Perl Support */; - targetProxy = 5DC82A6F1023C93D00FD1D3B /* PBXContainerItemProxy */; - }; - A84F608F08B1370E00E9745F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = B5A7525A08AF4A4A00138E45 /* ImageDiff */; - targetProxy = A84F608E08B1370E00E9745F /* PBXContainerItemProxy */; - }; - A84F609108B1370E00E9745F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9340994A08540CAE007F3BC8 /* DumpRenderTree */; - targetProxy = A84F609008B1370E00E9745F /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 141BF222096A441E00E0753C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283DE0CFA7C20007E533E /* TestNetscapePlugIn.xcconfig */; - buildSettings = { - INFOPLIST_FILE = TestNetscapePlugIn/mac/Info.plist; - }; - name = Debug; - }; - 141BF223096A441E00E0753C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283DE0CFA7C20007E533E /* TestNetscapePlugIn.xcconfig */; - buildSettings = { - INFOPLIST_FILE = TestNetscapePlugIn/mac/Info.plist; - }; - name = Release; - }; - 149C29C008902C6D008A9EFC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 149C29C108902C6D008A9EFC /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 149C29C408902C6D008A9EFC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB282F40CFA7450007E533E /* DebugRelease.xcconfig */; - buildSettings = { - GCC_OPTIMIZATION_LEVEL = 0; - }; - name = Debug; - }; - 149C29C508902C6D008A9EFC /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB282F40CFA7450007E533E /* DebugRelease.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 2D403F16150871F9005358D2 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - PRODUCT_NAME = LayoutTestHelper; - }; - name = Debug; - }; - 2D403F17150871F9005358D2 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - PRODUCT_NAME = LayoutTestHelper; - }; - name = Release; - }; - 2D403F18150871F9005358D2 /* Production */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)"; - PRODUCT_NAME = LayoutTestHelper; - SKIP_INSTALL = NO; - }; - name = Production; - }; - 5DC82A671023C8DE00FD1D3B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "DumpRenderTree Perl Support"; - }; - name = Debug; - }; - 5DC82A681023C8DE00FD1D3B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "DumpRenderTree Perl Support"; - }; - name = Release; - }; - 5DC82A691023C8DE00FD1D3B /* Production */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "DumpRenderTree Perl Support"; - }; - name = Production; - }; - 90CBC3500F748B1300A712B7 /* Production */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281EE0CFA713D007E533E /* Base.xcconfig */; - buildSettings = { - WEBKIT_FRAMEWORK_RESOURCES_PATH = WebKit.framework/Versions/A/Resources; - }; - name = Production; - }; - 90CBC3510F748B1300A712B7 /* Production */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)"; - PRODUCT_NAME = All; - }; - name = Production; - }; - 90CBC3520F748B1300A712B7 /* Production */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)"; - SKIP_INSTALL = NO; - }; - name = Production; - }; - 90CBC3530F748B1300A712B7 /* Production */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */; - buildSettings = { - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)"; - SKIP_INSTALL = NO; - }; - name = Production; - }; - 90CBC3540F748B1300A712B7 /* Production */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283DE0CFA7C20007E533E /* TestNetscapePlugIn.xcconfig */; - buildSettings = { - INFOPLIST_FILE = TestNetscapePlugIn/mac/Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)"; - SKIP_INSTALL = NO; - }; - name = Production; - }; - A84F609308B1371400E9745F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OTHER_CFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = All; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Debug; - }; - A84F609408B1371400E9745F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_OPTIMIZATION_LEVEL = 0; - OTHER_CFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = All; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Release; - }; - B5A7526508AF4A4A00138E45 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - B5A7526608AF4A4A00138E45 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BCB283D80CFA7AFD007E533E /* ImageDiff.xcconfig */; - buildSettings = { - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 141BF221096A441E00E0753C /* Build configuration list for PBXNativeTarget "TestNetscapePlugIn" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 141BF222096A441E00E0753C /* Debug */, - 141BF223096A441E00E0753C /* Release */, - 90CBC3540F748B1300A712B7 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - 149C29BF08902C6D008A9EFC /* Build configuration list for PBXNativeTarget "DumpRenderTree" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 149C29C008902C6D008A9EFC /* Debug */, - 149C29C108902C6D008A9EFC /* Release */, - 90CBC3520F748B1300A712B7 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - 149C29C308902C6D008A9EFC /* Build configuration list for PBXProject "DumpRenderTree" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 149C29C408902C6D008A9EFC /* Debug */, - 149C29C508902C6D008A9EFC /* Release */, - 90CBC3500F748B1300A712B7 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - 2D403F15150871F9005358D2 /* Build configuration list for PBXNativeTarget "LayoutTestHelper" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D403F16150871F9005358D2 /* Debug */, - 2D403F17150871F9005358D2 /* Release */, - 2D403F18150871F9005358D2 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - 5DC82A6E1023C92A00FD1D3B /* Build configuration list for PBXLegacyTarget "DumpRenderTree Perl Support" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5DC82A671023C8DE00FD1D3B /* Debug */, - 5DC82A681023C8DE00FD1D3B /* Release */, - 5DC82A691023C8DE00FD1D3B /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - A84F609208B1371400E9745F /* Build configuration list for PBXAggregateTarget "All" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A84F609308B1371400E9745F /* Debug */, - A84F609408B1371400E9745F /* Release */, - 90CBC3510F748B1300A712B7 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; - B5A7526408AF4A4A00138E45 /* Build configuration list for PBXNativeTarget "ImageDiff" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B5A7526508AF4A4A00138E45 /* Debug */, - B5A7526608AF4A4A00138E45 /* Release */, - 90CBC3530F748B1300A712B7 /* Production */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Production; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.h b/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.h index e2f45d67c..1d42a474c 100644 --- a/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.h +++ b/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.h @@ -26,6 +26,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#if !PLATFORM(IOS) + #import <Cocoa/Cocoa.h> // An implementation of NSDraggingSource for use with DumpRenderTreeDraggingInfo when dragging files @@ -37,3 +39,5 @@ - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag; @end + +#endif diff --git a/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.m b/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.m deleted file mode 100644 index 449d9185e..000000000 --- a/Tools/DumpRenderTree/DumpRenderTreeFileDraggingSource.m +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2009, 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. - -#import "DumpRenderTreeFileDraggingSource.h" - -@implementation DumpRenderTreeFileDraggingSource - -- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag -{ - return NSDragOperationCopy; -} - -@end diff --git a/Tools/DumpRenderTree/DumpRenderTreePrefix.h b/Tools/DumpRenderTree/DumpRenderTreePrefix.h index 010ca019d..105b54356 100644 --- a/Tools/DumpRenderTree/DumpRenderTreePrefix.h +++ b/Tools/DumpRenderTree/DumpRenderTreePrefix.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -26,17 +26,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef __OBJC__ - -#import <Foundation/Foundation.h> - +#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H && defined(BUILDING_WITH_CMAKE) +#include "cmakeconfig.h" #endif -#if defined(WIN32) || defined(_WIN32) +#include <wtf/Platform.h> -// If we don't define these, they get defined in windef.h. -// We want to use std::min and std::max -#define max max -#define min min +#ifdef __OBJC__ +#import <Foundation/Foundation.h> +#endif +#if OS(WINDOWS) +#undef WEBCORE_EXPORT +#define WEBCORE_EXPORT WTF_IMPORT_DECLARATION #endif diff --git a/Tools/DumpRenderTree/ForwardingHeaders/runtime/ArrayBufferView.h b/Tools/DumpRenderTree/ForwardingHeaders/runtime/ArrayBufferView.h new file mode 100644 index 000000000..7731671c8 --- /dev/null +++ b/Tools/DumpRenderTree/ForwardingHeaders/runtime/ArrayBufferView.h @@ -0,0 +1 @@ +#include <JavaScriptCore/ArrayBufferView.h> diff --git a/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSArrayBufferView.h b/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSArrayBufferView.h new file mode 100644 index 000000000..e38a8040f --- /dev/null +++ b/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSArrayBufferView.h @@ -0,0 +1 @@ +#include <JavaScriptCore/JSArrayBufferView.h> diff --git a/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSExportMacros.h b/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSExportMacros.h index 4c5dcb983..4c5dcb983 100755..100644 --- a/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSExportMacros.h +++ b/Tools/DumpRenderTree/ForwardingHeaders/runtime/JSExportMacros.h diff --git a/Tools/DumpRenderTree/ForwardingHeaders/runtime/TypedArrayInlines.h b/Tools/DumpRenderTree/ForwardingHeaders/runtime/TypedArrayInlines.h new file mode 100644 index 000000000..6a61945ea --- /dev/null +++ b/Tools/DumpRenderTree/ForwardingHeaders/runtime/TypedArrayInlines.h @@ -0,0 +1 @@ +#include <JavaScriptCore/TypedArrayInlines.h> diff --git a/Tools/DumpRenderTree/GCController.cpp b/Tools/DumpRenderTree/GCController.cpp index 06a04fbca..781a828eb 100644 --- a/Tools/DumpRenderTree/GCController.cpp +++ b/Tools/DumpRenderTree/GCController.cpp @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * diff --git a/Tools/DumpRenderTree/GCController.h b/Tools/DumpRenderTree/GCController.h index afc1de087..79ceafc9f 100644 --- a/Tools/DumpRenderTree/GCController.h +++ b/Tools/DumpRenderTree/GCController.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * diff --git a/Tools/DumpRenderTree/JavaScriptThreading.cpp b/Tools/DumpRenderTree/JavaScriptThreading.cpp index 66de156c7..e2f9bade6 100644 --- a/Tools/DumpRenderTree/JavaScriptThreading.cpp +++ b/Tools/DumpRenderTree/JavaScriptThreading.cpp @@ -13,7 +13,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -36,22 +36,25 @@ #include <stdlib.h> #include <wtf/Assertions.h> #include <wtf/HashSet.h> +#include <wtf/Lock.h> +#include <wtf/Threading.h> +#include <wtf/ThreadingPrimitives.h> #include <wtf/Vector.h> static const size_t javaScriptThreadsCount = 4; static bool javaScriptThreadsShouldTerminate; static JSContextGroupRef javaScriptThreadsGroup; -static Mutex& javaScriptThreadsMutex() +static Lock& javaScriptThreadsMutex() { - DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); + DEPRECATED_DEFINE_STATIC_LOCAL(Lock, staticMutex, ()); return staticMutex; } typedef HashSet<ThreadIdentifier> ThreadSet; static ThreadSet& javaScriptThreads() { - DEFINE_STATIC_LOCAL(ThreadSet, staticJavaScriptThreads, ()); + DEPRECATED_DEFINE_STATIC_LOCAL(ThreadSet, staticJavaScriptThreads, ()); ASSERT(!javaScriptThreadsMutex().tryLock()); return staticJavaScriptThreads; } @@ -68,26 +71,26 @@ void runJavaScriptThread(void*) JSGlobalContextRef ctx; { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); ctx = JSGlobalContextCreateInGroup(javaScriptThreadsGroup, 0); } JSStringRef scriptRef; { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); scriptRef = JSStringCreateWithUTF8CString(script); } while (true) { { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); JSValueRef exception = 0; JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); ASSERT(!exception); } { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); const size_t valuesCount = 1024; JSValueRef values[valuesCount]; for (size_t i = 0; i < valuesCount; ++i) @@ -95,7 +98,7 @@ void runJavaScriptThread(void*) } { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); if (javaScriptThreadsShouldTerminate) break; } @@ -104,7 +107,7 @@ void runJavaScriptThread(void*) if (rand() % 5) continue; - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); ThreadIdentifier thread = currentThread(); detachThread(thread); javaScriptThreads().remove(thread); @@ -112,7 +115,7 @@ void runJavaScriptThread(void*) break; } - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); JSStringRelease(scriptRef); JSGarbageCollect(ctx); JSGlobalContextRelease(ctx); @@ -122,7 +125,7 @@ void startJavaScriptThreads() { javaScriptThreadsGroup = JSContextGroupCreate(); - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); for (size_t i = 0; i < javaScriptThreadsCount; ++i) javaScriptThreads().add(createThread(&runJavaScriptThread, 0, 0)); @@ -131,13 +134,13 @@ void startJavaScriptThreads() void stopJavaScriptThreads() { { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); javaScriptThreadsShouldTerminate = true; } Vector<ThreadIdentifier, javaScriptThreadsCount> threads; { - MutexLocker locker(javaScriptThreadsMutex()); + LockHolder locker(javaScriptThreadsMutex()); copyToVector(javaScriptThreads(), threads); ASSERT(threads.size() == javaScriptThreadsCount); } @@ -145,7 +148,10 @@ void stopJavaScriptThreads() for (size_t i = 0; i < javaScriptThreadsCount; ++i) waitForThreadCompletion(threads[i]); - javaScriptThreads().clear(); + { + LockHolder locker(javaScriptThreadsMutex()); + javaScriptThreads().clear(); + } JSContextGroupRelease(javaScriptThreadsGroup); } diff --git a/Tools/DumpRenderTree/JavaScriptThreading.h b/Tools/DumpRenderTree/JavaScriptThreading.h index 43795a1a2..5bbe9cafe 100644 --- a/Tools/DumpRenderTree/JavaScriptThreading.h +++ b/Tools/DumpRenderTree/JavaScriptThreading.h @@ -12,7 +12,7 @@ * 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 + * 3. Neither the name of Apple 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. * diff --git a/Tools/DumpRenderTree/Makefile b/Tools/DumpRenderTree/Makefile deleted file mode 100644 index 344ef480b..000000000 --- a/Tools/DumpRenderTree/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -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/PixelDumpSupport.cpp b/Tools/DumpRenderTree/PixelDumpSupport.cpp index 165291174..aeb902ceb 100644 --- a/Tools/DumpRenderTree/PixelDumpSupport.cpp +++ b/Tools/DumpRenderTree/PixelDumpSupport.cpp @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -41,8 +41,6 @@ #include "PixelDumpSupportCG.h" #elif USE(CAIRO) #include "PixelDumpSupportCairo.h" -#elif PLATFORM(BLACKBERRY) -#include "PixelDumpSupportBlackBerry.h" #endif void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash) diff --git a/Tools/DumpRenderTree/PixelDumpSupport.h b/Tools/DumpRenderTree/PixelDumpSupport.h index 3bd8820c7..a0ec1e1c7 100644 --- a/Tools/DumpRenderTree/PixelDumpSupport.h +++ b/Tools/DumpRenderTree/PixelDumpSupport.h @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * diff --git a/Tools/DumpRenderTree/PlatformQt.cmake b/Tools/DumpRenderTree/PlatformQt.cmake new file mode 100644 index 000000000..a914dfd8d --- /dev/null +++ b/Tools/DumpRenderTree/PlatformQt.cmake @@ -0,0 +1,55 @@ +list(APPEND DumpRenderTree_INCLUDE_DIRECTORIES + "${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKit" + "${DERIVED_SOURCES_DIR}/ForwardingHeaders/QtWebKitWidgets" + "${WEBCORE_DIR}/Modules/notifications" + "${WEBCORE_DIR}/platform/qt" + "${WEBKIT_DIR}/qt/WebCoreSupport" + "${WEBKIT_DIR}/qt/WidgetSupport" + TestNetscapePlugIn + TestNetscapePlugIn/ForwardingHeaders + qt +) + +list(REMOVE_ITEM DumpRenderTree_SOURCES + JavaScriptThreading.cpp + PixelDumpSupport.cpp + WorkQueueItem.cpp +) + +list(APPEND DumpRenderTree_SOURCES + qt/DumpRenderTreeMain.cpp + qt/DumpRenderTreeQt.cpp + qt/EventSenderQt.cpp + qt/GCControllerQt.cpp + qt/TestRunnerQt.cpp + qt/TextInputControllerQt.cpp + qt/WorkQueueItemQt.cpp + qt/testplugin.cpp +) + +qt5_add_resources(DumpRenderTree_SOURCES + qt/DumpRenderTree.qrc +) + +list(APPEND DumpRenderTree_SYSTEM_INCLUDE_DIRECTORIES + ${ICU_INCLUDE_DIRS} + ${Qt5Gui_PRIVATE_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} +) + +list(APPEND DumpRenderTree_LIBRARIES + ${Qt5PrintSupport_LIBRARIES} + ${Qt5Test_LIBRARIES} + ${Qt5Widgets_LIBRARIES} + WebKitWidgets +) + +if (WIN32) + add_definitions(-DWEBCORE_EXPORT=) + add_definitions(-DSTATICALLY_LINKED_WITH_WTF -DSTATICALLY_LINKED_WITH_JavaScriptCore) +endif () + +if (ENABLE_X11_TARGET AND ENABLE_NETSCAPE_PLUGIN_API) + add_definitions(-DXP_UNIX) + link_libraries(${X11_X11_LIB}) +endif () diff --git a/Tools/DumpRenderTree/StorageTrackerDelegate.h b/Tools/DumpRenderTree/StorageTrackerDelegate.h deleted file mode 100644 index 73032ef59..000000000 --- a/Tools/DumpRenderTree/StorageTrackerDelegate.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -class TestRunner; - -@interface StorageTrackerDelegate : NSObject { - unsigned numberOfNotificationsToLog; - TestRunner* controllerToNotifyDone; -} - -- (void)logNotifications:(unsigned)number controller:(TestRunner*)controller; -- (void)originModified:(NSNotification *)notification; -- (void)setControllerToNotifyDone:(TestRunner*)controller; - -@end diff --git a/Tools/DumpRenderTree/StorageTrackerDelegate.mm b/Tools/DumpRenderTree/StorageTrackerDelegate.mm deleted file mode 100644 index 121fa1753..000000000 --- a/Tools/DumpRenderTree/StorageTrackerDelegate.mm +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2011 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 "StorageTrackerDelegate.h" - -#import "TestRunner.h" -#import <WebKit/WebSecurityOriginPrivate.h> -#import <WebKit/WebStorageManagerPrivate.h> - -@implementation StorageTrackerDelegate - -- (id)init -{ - self = [super init]; - if (!self) - return nil; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(originModified:) name:WebStorageDidModifyOriginNotification object:nil]; - - return self; -} - -- (void)logNotifications:(unsigned)number controller:(TestRunner*)controller -{ - controllerToNotifyDone = controller; - - numberOfNotificationsToLog = number; -} - -- (void)originModified:(NSNotification *)notification -{ - if (!numberOfNotificationsToLog) - return; - - numberOfNotificationsToLog--; - - if (numberOfNotificationsToLog == 0 && controllerToNotifyDone) { - NSArray *origins = [[WebStorageManager sharedWebStorageManager] origins]; - for (WebSecurityOrigin *origin in origins) - printf("Origin identifier: '%s'\n", [[origin databaseIdentifier] UTF8String]); - - controllerToNotifyDone->notifyDone(); - } -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self name:WebStorageDidModifyOriginNotification object:nil]; - - [super dealloc]; -} - -- (void)setControllerToNotifyDone:(TestRunner*)controller -{ - controllerToNotifyDone = controller; -} - - -@end diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt index 512032359..c431667b2 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt @@ -26,20 +26,36 @@ set(WebKitTestNetscapePlugin_SOURCES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PluginScriptableObjectOverridesAllProperties.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/PrivateBrowsing.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/ToStringAndValueOfObject.cpp + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/URLRedirect.cpp ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/Tests/x11/CallInvalidateRectWithNullNPPArgument.cpp ) set(WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES ${WEBKIT_TESTNETSCAPEPLUGIN_DIR} - ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/unix/ForwardingHeaders + ${WEBKIT_TESTNETSCAPEPLUGIN_DIR}/ForwardingHeaders ${WEBCORE_DIR} + ${WTF_DIR} +) + +set(WebKitTestNetscapePlugin_SYSTEM_INCLUDE_DIRECTORIES + ${X11_INCLUDE_DIR} ) include_directories(${WebKitTestNetscapePlugin_INCLUDE_DIRECTORIES}) +include_directories(SYSTEM ${WebKitTestNetscapePlugin_SYSTEM_INCLUDE_DIRECTORIES}) set(WebKitTestNetscapePlugin_LIBRARIES ${X11_LIBRARIES} ) +if (WTF_OS_UNIX) + add_definitions(-DXP_UNIX) +endif () + add_library(TestNetscapePlugin SHARED ${WebKitTestNetscapePlugin_SOURCES}) target_link_libraries(TestNetscapePlugin ${WebKitTestNetscapePlugin_LIBRARIES}) +set_target_properties(TestNetscapePlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins) +WEBKIT_SET_EXTRA_COMPILER_FLAGS(TestNetscapePlugin) + +# Suppress unused parameter warnings for sources in WebKit2. +ADD_TARGET_PROPERTIES(TestNetscapePlugin COMPILE_FLAGS "-Wno-unused-parameter") diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h index 627bc97a9..627bc97a9 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npapi.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h index 54a603dbb..54a603dbb 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npfunctions.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h index e435ae2ab..e435ae2ab 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/unix/ForwardingHeaders/WebKit/npruntime.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp index 75631842f..982452b68 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp @@ -30,10 +30,14 @@ #include "PluginTest.h" #include "TestObject.h" #include <assert.h> +#include <memory> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <wtf/Platform.h> +#include <wtf/ExportMacros.h> +#include <wtf/Assertions.h> // Helper function which takes in the plugin window object for logging to the console object. static void pluginLogWithWindowObject(NPObject* windowObject, NPP instance, const char* message) @@ -60,6 +64,7 @@ static void pluginLogWithWindowObject(NPObject* windowObject, NPP instance, cons browser->releaseobject(consoleObject); } +WTF_ATTRIBUTE_PRINTF(2, 0) void pluginLogWithArguments(NPP instance, const char* format, va_list args) { const size_t messageBufferSize = 2048; @@ -80,6 +85,7 @@ void pluginLogWithArguments(NPP instance, const char* format, va_list args) } // Helper function to log to the console object. +WTF_ATTRIBUTE_PRINTF(2, 3) void pluginLog(NPP instance, const char* format, ...) { va_list args; @@ -770,11 +776,15 @@ static bool testGetPropertyReturnValue(PluginObject* obj, const NPVariant* args, return true; } -static char* toCString(const NPString& string) +static std::unique_ptr<char[]> toCString(const NPString& string) { - char* result = static_cast<char*>(malloc(string.UTF8Length + 1)); - memcpy(result, string.UTF8Characters, string.UTF8Length); - result[string.UTF8Length] = '\0'; + size_t length = string.UTF8Length; + std::unique_ptr<char[]> result(new char[length + 1]); + if (!result) + return result; + + memcpy(result.get(), string.UTF8Characters, length); + result[length] = '\0'; return result; } @@ -785,30 +795,27 @@ static bool testPostURLFile(PluginObject* obj, const NPVariant* args, uint32_t a return false; NPString urlString = NPVARIANT_TO_STRING(args[0]); - char* url = toCString(urlString); + auto url = toCString(urlString); NPString targetString = NPVARIANT_TO_STRING(args[1]); - char* target = toCString(targetString); + auto target = toCString(targetString); NPString pathString = NPVARIANT_TO_STRING(args[2]); - char* path = toCString(pathString); + auto path = toCString(pathString); NPString contentsString = NPVARIANT_TO_STRING(args[3]); - FILE* tempFile = fopen(path, "w"); + FILE* tempFile = fopen(path.get(), "w"); if (!tempFile) return false; - if (!fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile)) - return false; - + size_t count = fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile); fclose(tempFile); - NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Length, path, TRUE); + if (!count) + return false; - free(path); - free(target); - free(url); + NPError error = browser->posturl(obj->npp, url.get(), target.get(), pathString.UTF8Length, path.get(), TRUE); BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result); return true; @@ -967,15 +974,14 @@ bool testWindowOpen(NPP npp) static bool testSetStatus(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) { - char* message = 0; + std::unique_ptr<char[]> message; if (argCount && NPVARIANT_IS_STRING(args[0])) { NPString statusString = NPVARIANT_TO_STRING(args[0]); message = toCString(statusString); } - - browser->status(obj->npp, message); - free(message); + browser->status(obj->npp, message.get()); + return true; } diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h index 98f183951..6b9bd07a4 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h @@ -85,4 +85,4 @@ extern bool testWindowOpen(NPP npp); extern void* createCoreAnimationLayer(); #endif -#endif // PluginObject_h +#endif diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm deleted file mode 100644 index e7850e7a9..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2010 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 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. - */ - -#include "PluginObject.h" - - -#include <QuartzCore/QuartzCore.h> - -@interface TestPluginLayer : CALayer -@end - -@implementation TestPluginLayer - -- (void)drawInContext:(CGContextRef)context -{ - CGRect bounds = [self bounds]; - const char* text = "Test Plug-in"; - CGContextSelectFont(context, "Helvetica", 24, kCGEncodingMacRoman); - CGContextShowTextAtPoint(context, bounds.origin.x + 3.0f, bounds.origin.y + bounds.size.height - 30.0f, text, strlen(text)); -} - -@end - -void* createCoreAnimationLayer() -{ - CALayer *caLayer = [[TestPluginLayer alloc] init]; - - NSNull *nullValue = [NSNull null]; - NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: - nullValue, @"anchorPoint", - nullValue, @"bounds", - nullValue, @"contents", - nullValue, @"contentsRect", - nullValue, @"opacity", - nullValue, @"position", - nullValue, @"shadowColor", - nullValue, @"sublayerTransform", - nullValue, @"sublayers", - nullValue, @"transform", - nullValue, @"zPosition", - nil]; - // Turn off default animations. - [caLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]]; - [caLayer setNeedsDisplayOnBoundsChange:YES]; - - [caLayer setBounds:CGRectMake(0, 0, 200, 100)]; - [caLayer setAnchorPoint:CGPointZero]; - - CGColorRef color = CGColorCreateGenericRGB(0.5, 0.5, 1, 1); - [caLayer setBackgroundColor:color]; - CGColorRelease(color); - - [caLayer setLayoutManager:[CAConstraintLayoutManager layoutManager]]; - - CALayer *sublayer = [CALayer layer]; - // Turn off default animations. - [sublayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]]; - - color = CGColorCreateGenericRGB(0, 0, 0, 0.75); - [sublayer setBackgroundColor:color]; - CGColorRelease(color); - [sublayer setBounds:CGRectMake(0, 0, 180, 20)]; - - [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinY - relativeTo:@"superlayer" - attribute:kCAConstraintMinY]]; - [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMinX - relativeTo:@"superlayer" - attribute:kCAConstraintMinX]]; - [sublayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX - relativeTo:@"superlayer" - attribute:kCAConstraintMaxX]]; - - [caLayer addSublayer:sublayer]; - return caLayer; -} - - diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index c2195c5b1..da78148d4 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -28,6 +28,9 @@ #include "PluginObject.h" #include <assert.h> #include <string.h> +#include <wtf/Platform.h> +#include <wtf/ExportMacros.h> +#include <wtf/Assertions.h> #if defined(XP_UNIX) || defined(ANDROID) #include <unistd.h> @@ -133,6 +136,11 @@ bool PluginTest::NPP_URLNotify(const char* url, NPReason, void* notifyData) return false; } +void PluginTest::NPP_URLRedirectNotify(const char*, int32_t, void* notifyData) +{ + NPN_URLRedirectResponse(notifyData, true); +} + NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value) { // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR. @@ -156,6 +164,11 @@ NPError PluginTest::NPN_GetURLNotify(const char *url, const char *target, void * return browser->geturlnotify(m_npp, url, target, notifyData); } +NPError PluginTest::NPN_PostURLNotify(const char *url, const char *target, uint32_t len, const char* buf, NPBool file, void *notifyData) +{ + return browser->posturlnotify(m_npp, url, target, len, buf, file, notifyData); +} + NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value) { return browser->getvalue(m_npp, variable, value); @@ -228,6 +241,11 @@ void PluginTest::NPN_ReleaseVariantValue(NPVariant* variant) browser->releasevariantvalue(variant); } +void PluginTest::NPN_URLRedirectResponse(void* notifyData, NPBool allow) +{ + browser->urlredirectresponse(m_npp, notifyData, allow); +} + #ifdef XP_MACOSX bool PluginTest::NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { @@ -254,6 +272,7 @@ void PluginTest::executeScript(const char* script) browser->releasevariantvalue(&browserResult); } +WTF_ATTRIBUTE_PRINTF(2, 3) void PluginTest::log(const char* format, ...) { va_list args; diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h index f8a9aaee3..d7a5163ff 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -31,6 +31,10 @@ #include <map> #include <string> +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + // Helper classes for implementing has_member typedef char (&no_tag)[1]; typedef char (&yes_tag)[2]; @@ -68,12 +72,14 @@ public: virtual int16_t NPP_HandleEvent(void* event); virtual bool NPP_URLNotify(const char* url, NPReason, void* notifyData); + virtual void NPP_URLRedirectNotify(const char* url, int32_t status, void* notifyData); virtual NPError NPP_GetValue(NPPVariable, void* value); virtual NPError NPP_SetValue(NPNVariable, void *value); // NPN functions. NPError NPN_GetURL(const char* url, const char* target); NPError NPN_GetURLNotify(const char* url, const char* target, void* notifyData); + NPError NPN_PostURLNotify(const char *url, const char *target, uint32_t len, const char* buf, NPBool file, void *notifyData); NPError NPN_GetValue(NPNVariable, void* value); void NPN_InvalidateRect(NPRect* invalidRect); bool NPN_Invoke(NPObject *, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); @@ -91,6 +97,7 @@ public: void NPN_ReleaseObject(NPObject*); bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); void NPN_ReleaseVariantValue(NPVariant*); + void NPN_URLRedirectResponse(void* notifyData, NPBool allow); #ifdef XP_MACOSX bool NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp index 9e65f1118..971f9ead3 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp @@ -24,6 +24,7 @@ */ #include "TestObject.h" + #include "PluginObject.h" #include <string.h> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp index 322d3fec4..887e1521e 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp @@ -25,8 +25,6 @@ #include "PluginTest.h" -#include "PluginTest.h" - #include "PluginObject.h" using namespace std; diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp index 0e238e607..a9a5962dd 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp @@ -85,4 +85,3 @@ private: }; static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin"); - diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp new file mode 100644 index 000000000..b834703da --- /dev/null +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/URLRedirect.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2014 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. 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 URLRedirect : public PluginTest { +public: + URLRedirect(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + { + } + + struct Redirect { + int redirectsRemaining; + bool async; + bool hasFired; + }; + + std::map<void*, Redirect> redirects; + +private: + // This is the test object. + class TestObject : public Object<TestObject> { }; + + // This is the scriptable object. It has a single "testObject" property and an "evaluate" function. + class ScriptableObject : public Object<ScriptableObject> { + public: + bool hasMethod(NPIdentifier methodName) + { + return identifierIs(methodName, "get") || identifierIs(methodName, "getAsync") || identifierIs(methodName, "serviceAsync"); + } + + bool get(const NPVariant* args, uint32_t argCount, NPVariant* result, bool async) + { + if (argCount != 3 || !NPVARIANT_IS_STRING(args[0]) || !(NPVARIANT_IS_BOOLEAN(args[1]) || NPVARIANT_IS_DOUBLE(args[1]) || NPVARIANT_IS_INT32(args[1])) || !NPVARIANT_IS_STRING(args[2])) + return false; + + const NPString* notifyString = &NPVARIANT_TO_STRING(args[2]); + basic_string<NPUTF8> notify(notifyString->UTF8Characters, notifyString->UTF8Length); + NPIdentifier notifyMethod = pluginTest()->NPN_GetStringIdentifier(notify.c_str()); + + Redirect& redirect = static_cast<URLRedirect*>(pluginTest())->redirects[reinterpret_cast<void*>(notifyMethod)]; + if (NPVARIANT_IS_DOUBLE(args[1])) + redirect.redirectsRemaining = NPVARIANT_TO_DOUBLE(args[1]); + else if (NPVARIANT_IS_INT32(args[1])) + redirect.redirectsRemaining = NPVARIANT_TO_INT32(args[1]); + else if (NPVARIANT_IS_BOOLEAN(args[1])) + redirect.redirectsRemaining = NPVARIANT_TO_BOOLEAN(args[1]); + redirect.async = async; + redirect.hasFired = true; + + const NPString* urlString = &NPVARIANT_TO_STRING(args[0]); + basic_string<NPUTF8> url(urlString->UTF8Characters, urlString->UTF8Length); + + pluginTest()->NPN_GetURLNotify(url.c_str(), 0, reinterpret_cast<void*>(notifyMethod)); + + VOID_TO_NPVARIANT(*result); + return true; + } + + bool serviceAsync(const NPVariant* args, uint32_t argCount, NPVariant* result) + { + if (argCount) + return false; + + NPBool seen = 0; + URLRedirect* plugin = static_cast<URLRedirect*>(pluginTest()); + for (auto& redirect : plugin->redirects) { + if (redirect.second.hasFired) + continue; + redirect.second.hasFired = true; + plugin->NPN_URLRedirectResponse(redirect.first, redirect.second.redirectsRemaining); + if (redirect.second.redirectsRemaining) + --redirect.second.redirectsRemaining; + seen = 1; + } + + BOOLEAN_TO_NPVARIANT(seen, *result); + return true; + } + + bool invoke(NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result) + { + if (identifierIs(methodName, "get")) + return get(args, argCount, result, false); + + if (identifierIs(methodName, "getAsync")) + return get(args, argCount, result, true); + + if (identifierIs(methodName, "serviceAsync")) + return serviceAsync(args, argCount, result); + + return false; + } + }; + + virtual NPError NPP_GetValue(NPPVariable variable, void *value) + { + if (variable != NPPVpluginScriptableNPObject) + return NPERR_GENERIC_ERROR; + + *(NPObject**)value = ScriptableObject::create(this); + + return NPERR_NO_ERROR; + } + + virtual bool NPP_URLNotify(const char* url, NPReason reason, void* notifyData) + { + NPVariant args[2]; + + NPObject* windowScriptObject; + NPN_GetValue(NPNVWindowNPObject, &windowScriptObject); + + NPIdentifier callbackIdentifier = notifyData; + + INT32_TO_NPVARIANT(reason, args[0]); + STRINGZ_TO_NPVARIANT(url, args[1]); + + NPVariant browserResult; + if (NPN_Invoke(windowScriptObject, callbackIdentifier, args, 2, &browserResult)) + NPN_ReleaseVariantValue(&browserResult); + + return true; + } + + virtual void NPP_URLRedirectNotify(const char*, int32_t, void* notifyData) + { + Redirect& redirect = redirects[notifyData]; + if (redirect.async) { + redirect.hasFired = false; + return; + } + + NPN_URLRedirectResponse(notifyData, redirect.redirectsRemaining); + if (redirect.redirectsRemaining) + --redirect.redirectsRemaining; + } +}; + +static PluginTest::Register<URLRedirect> urlRedirect("url-redirect"); + diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp deleted file mode 100644 index 5353d8333..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2011 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. 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" - -using namespace std; - -class ContentsScaleFactor : public PluginTest { -public: - ContentsScaleFactor(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_cachedContentsScaleFactor(1.0) - { - } - -private: - double contentsScaleFactor() - { - double contentsScaleFactor = 1.0; - NPN_GetValue(NPNVcontentsScaleFactor, &contentsScaleFactor); - return contentsScaleFactor; - } - - double cachedContentsScaleFactor() - { - return m_cachedContentsScaleFactor; - } - - class ScriptableObject : public Object<ScriptableObject> { - public: - bool hasProperty(NPIdentifier propertyName) - { - return identifierIs(propertyName, "contentsScaleFactor") - || identifierIs(propertyName, "cachedContentsScaleFactor"); - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - if (identifierIs(propertyName, "contentsScaleFactor")) { - DOUBLE_TO_NPVARIANT(pluginTest()->contentsScaleFactor(), *result); - return true; - } - - if (identifierIs(propertyName, "cachedContentsScaleFactor")) { - DOUBLE_TO_NPVARIANT(pluginTest()->cachedContentsScaleFactor(), *result); - return true; - } - return false; - } - - private: - ContentsScaleFactor* pluginTest() const { return static_cast<ContentsScaleFactor*>(Object<ScriptableObject>::pluginTest()); } - - }; - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) - { - m_cachedContentsScaleFactor = contentsScaleFactor(); - return NPERR_NO_ERROR; - } - - virtual NPError NPP_GetValue(NPPVariable variable, void* value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = ScriptableObject::create(this); - - return NPERR_NO_ERROR; - } - - virtual NPError NPP_SetValue(NPNVariable variable, void* value) - { - switch (variable) { - case NPNVcontentsScaleFactor: - m_cachedContentsScaleFactor = *(double*)value; - return NPERR_NO_ERROR; - default: - return NPERR_GENERIC_ERROR; - } - } - double m_cachedContentsScaleFactor; -}; - -static PluginTest::Register<ContentsScaleFactor> contentsScaleFactor("contents-scale-factor"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp deleted file mode 100644 index 1d851ead7..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ConvertPoint.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2010 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. 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" - -using namespace std; - -// Test that NPN_ConvertPoint converts correctly. -class ConvertPoint : public PluginTest { -public: - ConvertPoint(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - - bool testConvert(double x, double y, NPCoordinateSpace sourceSpace, NPCoordinateSpace destSpace) - { - // First convert from src to dest. - double destX, destY; - if (!NPN_ConvertPoint(x, y, sourceSpace, &destX, &destY, destSpace)) - return false; - - // Then convert back to src - double srcX, srcY; - if (!NPN_ConvertPoint(destX, destY, destSpace, &srcX, &srcY, sourceSpace)) - return false; - - - // Then compare. - if (srcX != x || srcY != y) - return false; - - return true; - } - - bool testConvert() - { - static const NPCoordinateSpace spaces[] = { NPCoordinateSpacePlugin, NPCoordinateSpaceWindow, NPCoordinateSpaceFlippedWindow, NPCoordinateSpaceScreen, NPCoordinateSpaceFlippedScreen }; - - static const size_t numSpaces = sizeof(spaces) / sizeof(spaces[0]); - for (size_t i = 0; i < numSpaces; ++i) { - for (size_t j = 0; j < numSpaces; ++j) { - if (!testConvert(1234, 5678, spaces[i], spaces[j])) - return false; - } - } - return true; - } -private: - 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!'"); - - executeScript("setTimeout(function() { testRunner.notifyDone() }, 0)"); - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<ConvertPoint> convertPoint("convert-point"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SupportsCarbonEventModel.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SupportsCarbonEventModel.cpp deleted file mode 100644 index 51cbce2bf..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/SupportsCarbonEventModel.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 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. 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" - -using namespace std; - -// Test that we report that we support the Carbon event model in 32-bit. -class SupportsCarbonEventModel : public PluginTest { -public: - SupportsCarbonEventModel(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - bool runTest() - { -#ifdef NP_NO_CARBON - // There's no support for Carbon, so we can't test anything. - return true; -#else - NPBool supportsCarbonEventModel = false; - if (NPN_GetValue(NPNVsupportsCarbonBool, &supportsCarbonEventModel) != NPERR_NO_ERROR) - return false; - - return supportsCarbonEventModel; -#endif - } - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - if (runTest()) - executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"); - - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<SupportsCarbonEventModel> supportsCarbonEventModel("supports-carbon-event-model"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/CallJSThatDestroysPlugin.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/CallJSThatDestroysPlugin.cpp deleted file mode 100644 index 39c6365a6..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/CallJSThatDestroysPlugin.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2011 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. 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> -#include <vector> - -using namespace std; - -// Test that evaluating JavaScript that removes the plug-in from the page -// destroys the plug-in asynchronously. -class CallJSThatDestroysPlugin : public PluginTest { -public: - CallJSThatDestroysPlugin(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_isDestroyed(false) - , m_window(0) - { - } - ~CallJSThatDestroysPlugin(); - - void runTest(); - -private: - virtual NPError NPP_New(NPMIMEType, uint16_t, int16_t, char*[], char*[], NPSavedData*); - virtual NPError NPP_Destroy(NPSavedData**); - - bool m_isDestroyed; - HWND m_window; -}; - -static PluginTest::Register<CallJSThatDestroysPlugin> registrar("call-javascript-that-destroys-plugin"); - -static const LPCWSTR pluginTestProperty = L"PluginTestProperty"; -static const UINT runTestWindowMessage = WM_USER + 1; -static const LPCWSTR messageWindowClassName = L"CallJSThatDestroysPluginMessageWindow"; - -CallJSThatDestroysPlugin::~CallJSThatDestroysPlugin() -{ - ::RemovePropW(m_window, pluginTestProperty); - ::DestroyWindow(m_window); -} - -void CallJSThatDestroysPlugin::runTest() -{ - executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugin.parentElement.removeChild(plugin);"); - if (!m_isDestroyed) - log("Success: executed script, and plug-in is not yet destroyed."); -} - -static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if (msg != runTestWindowMessage) - return ::DefWindowProcW(hwnd, msg, wParam, lParam); - - CallJSThatDestroysPlugin* pluginTest = reinterpret_cast<CallJSThatDestroysPlugin*>(::GetPropW(hwnd, pluginTestProperty)); - pluginTest->runTest(); - return 0; -} - -NPError CallJSThatDestroysPlugin::NPP_New(NPMIMEType, uint16_t, int16_t, char*[], char*[], NPSavedData*) -{ - assert(!m_window); - - waitUntilDone(); - - WNDCLASSEXW wndClass = {0}; - wndClass.cbSize = sizeof(wndClass); - wndClass.lpfnWndProc = wndProc; - wndClass.hCursor = LoadCursor(0, IDC_ARROW); - wndClass.hInstance = GetModuleHandle(0); - wndClass.lpszClassName = messageWindowClassName; - - ::RegisterClassExW(&wndClass); - m_window = ::CreateWindowExW(0, messageWindowClassName, 0, WS_CHILD, 0, 0, 0, 0, HWND_MESSAGE, 0, GetModuleHandle(0), 0); - - ::SetPropW(m_window, pluginTestProperty, reinterpret_cast<HANDLE>(this)); - ::PostMessageW(m_window, runTestWindowMessage, 0, 0); - - return NPERR_NO_ERROR; -} - -NPError CallJSThatDestroysPlugin::NPP_Destroy(NPSavedData**) -{ - m_isDestroyed = true; - log("Plug-in destroyed."); - notifyDone(); - return NPERR_NO_ERROR; -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp deleted file mode 100644 index 2b0619832..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2010 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. 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 "WindowedPluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Just fills its window with some gradients - -class DrawsGradient : public WindowedPluginTest { -public: - DrawsGradient(NPP, const string& identifier); - -private: - void paint(HDC) const; - - LRESULT onPaint(WPARAM, LPARAM, bool& handled); - LRESULT onPrintClient(WPARAM, LPARAM, bool& handled); - - virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled); -}; - -static PluginTest::Register<DrawsGradient> registrar("draws-gradient"); - -DrawsGradient::DrawsGradient(NPP npp, const string& identifier) - : WindowedPluginTest(npp, identifier) -{ -} - -LRESULT DrawsGradient::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled) -{ - LRESULT result = 0; - - switch (message) { - case WM_PAINT: - result = onPaint(wParam, lParam, handled); - break; - case WM_PRINTCLIENT: - result = onPrintClient(wParam, lParam, handled); - break; - default: - handled = false; - } - - return result; -} - -LRESULT DrawsGradient::onPaint(WPARAM, LPARAM, bool& handled) -{ - PAINTSTRUCT paintStruct; - HDC dc = ::BeginPaint(window(), &paintStruct); - if (!dc) - return 0; - - paint(dc); - ::EndPaint(window(), &paintStruct); - - handled = true; - return 0; -} - -LRESULT DrawsGradient::onPrintClient(WPARAM wParam, LPARAM, bool& handled) -{ - paint(reinterpret_cast<HDC>(wParam)); - - handled = true; - return 0; -} - -void DrawsGradient::paint(HDC dc) const -{ - RECT clientRect; - if (!::GetClientRect(window(), &clientRect)) - return; - - TRIVERTEX vertices[] = { - // Upper-left: green - { clientRect.left, clientRect.top, 0, 0xff00, 0, 0 }, - // Upper-right: blue - { clientRect.right, clientRect.top, 0, 0, 0xff00, 0 }, - // Lower-left: yellow - { clientRect.left, clientRect.bottom, 0xff00, 0xff00, 0, 0 }, - // Lower-right: red - { clientRect.right, clientRect.bottom, 0xff00, 0, 0, 0 }, - }; - - GRADIENT_TRIANGLE mesh[] = { - // Upper-left triangle - { 0, 1, 2 }, - // Lower-right triangle - { 1, 2, 3 }, - }; - - ::GradientFill(dc, vertices, _countof(vertices), mesh, _countof(mesh), GRADIENT_FILL_TRIANGLE); -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DumpWindowRect.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DumpWindowRect.cpp deleted file mode 100644 index fc2fd45a8..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DumpWindowRect.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2011 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. 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 "WindowGeometryTest.h" - -#include "PluginObject.h" - -using namespace std; - -// This plugin dumps its window rect (relative to the test harness window) to the console when it -// is instantiated. - -class DumpWindowRect : public WindowGeometryTest { -public: - DumpWindowRect(NPP, const string& identifier); - -private: - virtual void performWindowGeometryTest(); -}; - -static PluginTest::Register<DumpWindowRect> registrar("dump-window-rect"); - -DumpWindowRect::DumpWindowRect(NPP npp, const string& identifier) - : WindowGeometryTest(npp, identifier) -{ -} - - -void DumpWindowRect::performWindowGeometryTest() -{ - RECT rect; - if (!::GetClientRect(window(), &rect)) { - log("::GetClientRect failed"); - return; - } - - // MSDN says that calling ::MapWindowPoints this way will tell it to treat the points as a rect. - if (!::MapWindowPoints(window(), testHarnessWindow(), reinterpret_cast<LPPOINT>(&rect), 2)) { - log("::MapWindowPoints failed"); - return; - } - - log("Plugin window rect: {left=%d, top=%d, right=%d, bottom=%d}", rect.left, rect.top, rect.right, rect.bottom); -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp deleted file mode 100644 index 32fd99b63..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2010 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. 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 "PluginObject.h" - -using namespace std; - -// NPN_GetValue(NPNVnetscapeWindow) should return a valid HWND. - -class GetValueNetscapeWindow : public PluginTest { -public: - GetValueNetscapeWindow(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didReceiveInitialSetWindowCall(false) - { - } - -private: - virtual NPError NPP_SetWindow(NPP instance, NPWindow* window) - { - if (m_didReceiveInitialSetWindowCall) - return NPERR_NO_ERROR; - m_didReceiveInitialSetWindowCall = true; - - HWND hwnd; - NPError error = NPN_GetValue(NPNVnetscapeWindow, &hwnd); - if (error != NPERR_NO_ERROR) { - pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) failed with error %d", error); - return NPERR_GENERIC_ERROR; - } - - if (!::IsWindow(hwnd)) { - pluginLog(instance, "::IsWindow returned FALSE"); - return NPERR_GENERIC_ERROR; - } - - if (hwnd == window->window) { - pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) returned the same value as NPWindow::window"); - return NPERR_GENERIC_ERROR; - } - - pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) succeeded"); - return NPERR_NO_ERROR; - } - - bool m_didReceiveInitialSetWindowCall; -}; - -static PluginTest::Register<GetValueNetscapeWindow> getValueNetscapeWindow("get-value-netscape-window"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp deleted file mode 100644 index 6d5484b1f..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2010 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. 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 "WindowedPluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// NPN_InvalidateRect should invalidate the plugin's HWND. - -static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.NPNInvalidateRectInvalidatesWindow.InstancePointer"; - -class TemporaryWindowMover { -public: - TemporaryWindowMover(HWND); - ~TemporaryWindowMover(); - - bool moveSucceeded() const { return m_moveSucceeded; } - -private: - static const UINT standardSetWindowPosFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER; - bool m_moveSucceeded; - HWND m_window; - RECT m_savedWindowRect; -}; - -TemporaryWindowMover::TemporaryWindowMover(HWND window) - : m_window(window) -{ - m_moveSucceeded = false; - - if (!::GetWindowRect(m_window, &m_savedWindowRect)) - return; - - if (!::SetWindowPos(m_window, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | standardSetWindowPosFlags)) - return; - - m_moveSucceeded = true; -}; - -TemporaryWindowMover::~TemporaryWindowMover() -{ - if (!m_moveSucceeded) - return; - - ::SetWindowPos(m_window, 0, m_savedWindowRect.left, m_savedWindowRect.top, 0, 0, SWP_HIDEWINDOW | standardSetWindowPosFlags); -} - -class NPNInvalidateRectInvalidatesWindow : public WindowedPluginTest { -public: - NPNInvalidateRectInvalidatesWindow(NPP, const string& identifier); - ~NPNInvalidateRectInvalidatesWindow(); - -private: - virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled); - - void onPaint(); - void testInvalidateRect(); - - virtual NPError NPP_SetWindow(NPP, NPWindow*); - - TemporaryWindowMover* m_windowMover; -}; - -NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow(NPP npp, const string& identifier) - : WindowedPluginTest(npp, identifier) - , m_windowMover(0) -{ -} - -NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow() -{ - delete m_windowMover; -} - -NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* npWindow) -{ - NPError error = WindowedPluginTest::NPP_SetWindow(instance, npWindow); - if (error != NPERR_NO_ERROR) - return error; - - if (!window()) - return NPERR_NO_ERROR; - - // The test harness's window (the one that contains the WebView) is off-screen and hidden. - // We need to move it on-screen and make it visible in order for the plugin's window to - // accumulate an update region when the DWM is disabled. - - HWND testHarnessWindow = this->testHarnessWindow(); - if (!testHarnessWindow) { - pluginLog(instance, "Failed to get test harness window"); - return NPERR_GENERIC_ERROR; - } - - m_windowMover = new TemporaryWindowMover(testHarnessWindow); - if (!m_windowMover->moveSucceeded()) { - pluginLog(instance, "Failed to move test harness window on-screen"); - return NPERR_GENERIC_ERROR; - } - - // Wait until we receive a WM_PAINT message to ensure that the window is on-screen before we do - // the NPN_InvalidateRect test. - waitUntilDone(); - return NPERR_NO_ERROR; -} - -LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled) -{ - if (message == WM_PAINT) - onPaint(); - - handled = false; - return 0; -} - -void NPNInvalidateRectInvalidatesWindow::onPaint() -{ - testInvalidateRect(); - notifyDone(); - delete m_windowMover; - m_windowMover = 0; -} - -void NPNInvalidateRectInvalidatesWindow::testInvalidateRect() -{ - RECT clientRect; - if (!::GetClientRect(window(), &clientRect)) { - pluginLog(m_npp, "::GetClientRect failed"); - return; - } - - if (::IsRectEmpty(&clientRect)) { - pluginLog(m_npp, "Plugin's HWND has not been sized when NPP_SetWindow is called"); - return; - } - - // Clear the invalid region. - if (!::ValidateRect(window(), 0)) { - pluginLog(m_npp, "::ValidateRect failed"); - return; - } - - // Invalidate our lower-right quadrant. - NPRect rectToInvalidate; - rectToInvalidate.left = (clientRect.right - clientRect.left) / 2; - rectToInvalidate.top = (clientRect.bottom - clientRect.top) / 2; - rectToInvalidate.right = clientRect.right; - rectToInvalidate.bottom = clientRect.bottom; - NPN_InvalidateRect(&rectToInvalidate); - - RECT invalidRect; - if (!::GetUpdateRect(window(), &invalidRect, FALSE)) { - pluginLog(m_npp, "::GetUpdateRect failed"); - return; - } - - if (invalidRect.left != rectToInvalidate.left || invalidRect.top != rectToInvalidate.top || invalidRect.right != rectToInvalidate.right || invalidRect.bottom != rectToInvalidate.bottom) { - pluginLog(m_npp, "Expected invalid rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", rectToInvalidate.left, rectToInvalidate.top, rectToInvalidate.right, rectToInvalidate.bottom, invalidRect.left, invalidRect.top, invalidRect.right, invalidRect.bottom); - return; - } - - pluginLog(m_npp, "Plugin's HWND has been invalidated as expected"); -} - -static PluginTest::Register<NPNInvalidateRectInvalidatesWindow> registrar("npn-invalidate-rect-invalidates-window"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp deleted file mode 100644 index 1c75d27a8..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2010 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. 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 "PluginObject.h" - -using namespace std; - -// Plugin's HWND should be sized/positioned before NPP_SetWindow is called. - -class WindowGeometryInitializedBeforeSetWindow : public PluginTest { -public: - WindowGeometryInitializedBeforeSetWindow(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didReceiveInitialSetWindowCall(false) - { - } - -private: - virtual NPError NPP_SetWindow(NPP instance, NPWindow* window) - { - if (m_didReceiveInitialSetWindowCall) - return NPERR_NO_ERROR; - m_didReceiveInitialSetWindowCall = true; - - if (window->type != NPWindowTypeWindow) { - pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type); - return NPERR_GENERIC_ERROR; - } - - HWND hwnd = reinterpret_cast<HWND>(window->window); - RECT rect; - if (!::GetClientRect(hwnd, &rect)) { - pluginLog(instance, "::GetClientRect failed"); - return NPERR_GENERIC_ERROR; - } - - if (::IsRectEmpty(&rect)) { - pluginLog(instance, "Plugin's HWND has not been sized when NPP_SetWindow is called"); - return NPERR_GENERIC_ERROR; - } - - if ((rect.right - rect.left) != window->width || (rect.bottom - rect.top) != window->height) { - pluginLog(instance, "Size of HWND's rect and size of NPWindow's rect are not equal"); - return NPERR_GENERIC_ERROR; - } - - pluginLog(instance, "Plugin's HWND has been sized before NPP_SetWindow was called"); - return NPERR_NO_ERROR; - } - - bool m_didReceiveInitialSetWindowCall; -}; - -static PluginTest::Register<WindowGeometryInitializedBeforeSetWindow> windowGeometryInitializedBeforeSetWindow("window-geometry-initialized-before-set-window"); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp deleted file mode 100644 index 7a0098b84..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2010, 2011 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. 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 "WindowGeometryTest.h" - -#include "PluginObject.h" - -using namespace std; - -// The plugin's window's window region should be set to the plugin's clip rect. - -class WindowRegionIsSetToClipRect : public WindowGeometryTest { -public: - WindowRegionIsSetToClipRect(NPP, const string& identifier); - -private: - virtual void performWindowGeometryTest(); -}; - -static PluginTest::Register<WindowRegionIsSetToClipRect> registrar("window-region-is-set-to-clip-rect"); - -WindowRegionIsSetToClipRect::WindowRegionIsSetToClipRect(NPP npp, const string& identifier) - : WindowGeometryTest(npp, identifier) -{ -} - -void WindowRegionIsSetToClipRect::performWindowGeometryTest() -{ - RECT regionRect; - if (::GetWindowRgnBox(window(), ®ionRect) == ERROR) { - log("::GetWindowRgnBox failed, or window has no window region"); - return; - } - - // This expected rect is based on the layout of window-region-is-set-to-clip-rect.html. - RECT expectedRect = { 50, 50, 100, 100 }; - if (!::EqualRect(®ionRect, &expectedRect)) { - log("Expected region rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, regionRect.left, regionRect.top, regionRect.right, regionRect.bottom); - return; - } - - log("PASS: Plugin's window's window region has been set as expected"); - - // While we're here, check that our window class doesn't have the CS_PARENTDC style, which - // defeats clipping by ignoring the window region and always clipping to the parent window. - // FIXME: It would be nice to have a pixel test that shows that we're - // getting clipped correctly, but unfortunately window regions are ignored - // during WM_PRINT (see <http://webkit.org/b/49034>). - wchar_t className[512]; - if (!::GetClassNameW(window(), className, _countof(className))) { - log("::GetClassName failed with error %u", ::GetLastError()); - return; - } - -#ifdef DEBUG_ALL - const wchar_t webKitDLLName[] = L"WebKit_debug.dll"; -#else - const wchar_t webKitDLLName[] = L"WebKit.dll"; -#endif - HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName); - if (!webKitModule) { - log("::GetModuleHandleW failed with error %u", ::GetLastError()); - return; - } - - WNDCLASSW wndClass; - if (!::GetClassInfoW(webKitModule, className, &wndClass)) { - log("::GetClassInfoW failed with error %u", ::GetLastError()); - return; - } - - if (wndClass.style & CS_PARENTDC) - log("FAIL: Plugin's window's class has the CS_PARENTDC style, which will defeat clipping"); - else - log("PASS: Plugin's window's class does not have the CS_PARENTDC style"); -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp deleted file mode 100644 index ffc92ea2e..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2011 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. 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 "PluginObject.h" - -using namespace std; - -// The rect passed in the WM_PAINT event for a windowless plugin should be relative to the page's -// HWND and clipped to the plugin's bounds. - -class WindowlessPaintRectCoordinates : public PluginTest { -public: - WindowlessPaintRectCoordinates(NPP, const string& identifier); - -private: - virtual NPError NPP_New(NPMIMEType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData*); - virtual int16_t NPP_HandleEvent(void* event); -}; - -static PluginTest::Register<WindowlessPaintRectCoordinates> registrar("windowless-paint-rect-coordinates"); - -WindowlessPaintRectCoordinates::WindowlessPaintRectCoordinates(NPP npp, const string& identifier) - : PluginTest(npp, identifier) -{ -} - -NPError WindowlessPaintRectCoordinates::NPP_New(NPMIMEType, uint16_t, int16_t, char*[], char*[], NPSavedData*) -{ - browser->setvalue(m_npp, NPPVpluginWindowBool, 0); - return NPERR_NO_ERROR; -} - -int16_t WindowlessPaintRectCoordinates::NPP_HandleEvent(void* typelessEvent) -{ - NPEvent* event = static_cast<NPEvent*>(typelessEvent); - if (!event) { - pluginLog(m_npp, "NPP_HandleEvent was passed a null event pointer"); - return 0; - } - - if (event->event != WM_PAINT) - return 0; - - RECT* paintRect = reinterpret_cast<RECT*>(event->lParam); - if (!paintRect) { - pluginLog(m_npp, "A null paint rect was passed in the WM_PAINT event"); - return 1; - } - - // Keep these values in sync with windowless-paint-rect-coordinates.html. - RECT expectedRect = { 100, 100, 200, 200 }; - - if (::EqualRect(paintRect, &expectedRect)) - pluginLog(m_npp, "Success"); - else - pluginLog(m_npp, "Expected paint rect {left=%d, top=%d, right=%d, bottom=%d}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, paintRect->left, paintRect->top, paintRect->right, paintRect->bottom); - - return 1; -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist b/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist deleted file mode 100644 index ef45e66d2..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>TestNetscapePlugIn</string> - <key>CFBundleGetInfoString</key> - <string>420+, Copyright 2006-2009 Apple Inc.</string> - <key>CFBundleIconFile</key> - <string></string> - <key>CFBundleIdentifier</key> - <string>com.apple.testnetscapeplugin</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>BRPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>CFPlugInDynamicRegisterFunction</key> - <string></string> - <key>CFPlugInDynamicRegistration</key> - <string>NO</string> - <key>CFPlugInFactories</key> - <dict> - <key>00000000-0000-0000-0000-000000000000</key> - <string>MyFactoryFunction</string> - </dict> - <key>CFPlugInTypes</key> - <dict> - <key>00000000-0000-0000-0000-000000000000</key> - <array> - <string>00000000-0000-0000-0000-000000000000</string> - </array> - </dict> - <key>CFPlugInUnloadFunction</key> - <string></string> - <key>WebPluginDescription</key> - <string>Simple Netscape plug-in that handles test content for WebKit</string> - <key>WebPluginMIMETypes</key> - <dict> - <key>image/png</key> - <dict> - <key>WebPluginExtensions</key> - <array> - <string>png</string> - </array> - <key>WebPluginTypeDescription</key> - <string>PNG image</string> - </dict> - <key>application/x-webkit-test-netscape</key> - <dict> - <key>WebPluginExtensions</key> - <array> - <string>testnetscape</string> - </array> - <key>WebPluginTypeDescription</key> - <string>test netscape content</string> - </dict> - </dict> - <key>WebPluginName</key> - <string>WebKit Test PlugIn</string> -</dict> -</plist> diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp index 256acc003..6a7303f13 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -41,10 +41,17 @@ extern "C" void GlobalToLocal(Point*); using namespace std; +#if defined(__GNUC__) +#define CRASH() do { \ + *(int *)(uintptr_t)0xbbadbeef = 0; \ + __builtin_trap(); /* More reliable, but doesn't say BBADBEEF. */ \ +} while (false) +#else #define CRASH() do { \ *(int *)(uintptr_t)0xbbadbeef = 0; \ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \ -} while(false) +} while (false) +#endif static bool getEntryPointsWasCalled; static bool initializeWasCalled; @@ -116,6 +123,7 @@ NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) pluginFuncs->print = NPP_Print; pluginFuncs->event = NPP_HandleEvent; pluginFuncs->urlnotify = NPP_URLNotify; + pluginFuncs->urlredirectnotify = NPP_URLRedirectNotify; pluginFuncs->getvalue = NPP_GetValue; pluginFuncs->setvalue = NPP_SetValue; @@ -324,7 +332,10 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save) if (obj->onPaintEvent) free(obj->onPaintEvent); - + + if (obj->evaluateScriptOnMouseDownOrKeyDown) + free(obj->evaluateScriptOnMouseDownOrKeyDown); + if (obj->logDestroy) pluginLog(instance, "NPP_Destroy"); @@ -345,29 +356,30 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window) { PluginObject* obj = static_cast<PluginObject*>(instance->pdata); - if (obj) { - obj->lastWindow = *window; + if (!obj) + return NPERR_GENERIC_ERROR; - if (obj->logSetWindow) { - pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height); - obj->logSetWindow = FALSE; - executeScript(obj, "testRunner.notifyDone();"); - } + obj->lastWindow = *window; - if (obj->onSetWindow) - executeScript(obj, obj->onSetWindow); + if (obj->logSetWindow) { + pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height); + obj->logSetWindow = FALSE; + executeScript(obj, "testRunner.notifyDone();"); + } - if (obj->testWindowOpen) { - testWindowOpen(instance); - obj->testWindowOpen = FALSE; - } + if (obj->onSetWindow) + executeScript(obj, obj->onSetWindow); - if (obj->testKeyboardFocusForPlugins) { - obj->eventLogging = true; - executeScript(obj, "eventSender.keyDown('A');"); - } + if (obj->testWindowOpen) { + testWindowOpen(instance); + obj->testWindowOpen = FALSE; } - + + if (obj->testKeyboardFocusForPlugins) { + obj->eventLogging = true; + executeScript(obj, "eventSender.keyDown('A');"); + } + return obj->pluginTest->NPP_SetWindow(window); } @@ -796,6 +808,12 @@ void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyD handleCallback(obj, url, reason, notifyData); } +void NPP_URLRedirectNotify(NPP instance, const char *url, int32_t status, void *notifyData) +{ + PluginObject* obj = static_cast<PluginObject*>(instance->pdata); + obj->pluginTest->NPP_URLRedirectNotify(url, status, notifyData); +} + NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { #ifdef XP_UNIX diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.cpp deleted file mode 100644 index be7bfb31c..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2010, 2011 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. 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 "WindowGeometryTest.h" - -#include "PluginObject.h" - -using namespace std; - -WindowGeometryTest::WindowGeometryTest(NPP npp, const string& identifier) - : WindowedPluginTest(npp, identifier) - , m_testHarnessWindowWasVisible(false) -{ -} - -void WindowGeometryTest::startTest() -{ - // In WebKit1, our window's window region will be set immediately. In WebKit2, it won't be set - // until the UI process paints. Since the UI process will also show our window when it paints, - // we can detect when the paint occurs (and thus when our window region should be set) by - // starting with our plugin element hidden, then making it visible and waiting for a - // WM_WINDOWPOSCHANGED event to tell us our window has been shown. - - waitUntilDone(); - - // If the test harness window isn't visible, we might not receive a WM_WINDOWPOSCHANGED message - // when our window is made visible. So we temporarily show the test harness window during this test. - showTestHarnessWindowIfNeeded(); - - // Make our window visible. (In WebKit2, this won't take effect immediately.) - executeScript("document.getElementsByTagName('embed')[0].style.visibility = 'visible';"); - - // We trigger a UI process paint after a slight delay to ensure that the UI process has - // received the "make the plugin window visible" message before it paints. - // FIXME: It would be nice to have a way to guarantee that the UI process had received that - // message before we triggered a paint. Hopefully that would let us get rid of this semi- - // arbitrary timeout. - ::SetTimer(window(), triggerPaintTimerID, 250, 0); -} - -void WindowGeometryTest::finishTest() -{ - performWindowGeometryTest(); - hideTestHarnessWindowIfNeeded(); - notifyDone(); -} - -void WindowGeometryTest::showTestHarnessWindowIfNeeded() -{ - HWND testHarnessWindow = this->testHarnessWindow(); - m_testHarnessWindowWasVisible = ::IsWindowVisible(testHarnessWindow); - if (m_testHarnessWindowWasVisible) - return; - ::ShowWindow(testHarnessWindow, SW_SHOWNA); -} - -void WindowGeometryTest::hideTestHarnessWindowIfNeeded() -{ - if (m_testHarnessWindowWasVisible) - return; - ::ShowWindow(testHarnessWindow(), SW_HIDE); -} - -LRESULT WindowGeometryTest::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled) -{ - switch (message) { - case WM_TIMER: - if (wParam != triggerPaintTimerID) - break; - handled = true; - ::KillTimer(window(), wParam); - // Tell the UI process to paint. - ::PostMessageW(::GetParent(window()), WM_PAINT, 0, 0); - break; - case WM_WINDOWPOSCHANGED: { - WINDOWPOS* windowPos = reinterpret_cast<WINDOWPOS*>(lParam); - if (!(windowPos->flags & SWP_SHOWWINDOW)) - break; - finishTest(); - break; - } - - } - - return 0; -} - -NPError WindowGeometryTest::NPP_GetValue(NPPVariable variable, void* value) -{ - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *static_cast<NPObject**>(value) = ScriptObject::create(this); - - return NPERR_NO_ERROR; -} - -bool WindowGeometryTest::ScriptObject::hasMethod(NPIdentifier methodName) -{ - return methodName == pluginTest()->NPN_GetStringIdentifier("startTest"); -} - -bool WindowGeometryTest::ScriptObject::invoke(NPIdentifier identifier, const NPVariant*, uint32_t, NPVariant*) -{ - assert(identifier == pluginTest()->NPN_GetStringIdentifier("startTest")); - static_cast<WindowGeometryTest*>(pluginTest())->startTest(); - return true; -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.h deleted file mode 100644 index 4878a6941..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowGeometryTest.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2010, 2011 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. 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. - */ - -#ifndef WindowGeometryTest_h -#define WindowGeometryTest_h - -#include "WindowedPluginTest.h" - -class WindowGeometryTest : public WindowedPluginTest { -public: - WindowGeometryTest(NPP, const std::string& identifier); - -private: - struct ScriptObject : Object<ScriptObject> { - bool hasMethod(NPIdentifier); - bool invoke(NPIdentifier, const NPVariant*, uint32_t, NPVariant*); - }; - - static const UINT_PTR triggerPaintTimerID = 1; - - void startTest(); - void finishTest(); - - void showTestHarnessWindowIfNeeded(); - void hideTestHarnessWindowIfNeeded(); - - // For subclasses to implement - virtual void performWindowGeometryTest() = 0; - - // WindowedPluginTest - virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled); - - // PluginTest - virtual NPError NPP_GetValue(NPPVariable, void*); - - bool m_testHarnessWindowWasVisible; -}; - -#endif // WindowGeometryTest_h diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp deleted file mode 100644 index 2e75ca162..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2010 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. 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 "WindowedPluginTest.h" - -using namespace std; - -static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.WindowedPluginTest.InstancePointer"; - -WindowedPluginTest::WindowedPluginTest(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_window(0) - , m_originalWndProc(0) -{ -} - -HWND WindowedPluginTest::testHarnessWindow() const -{ - return ::GetAncestor(window(), GA_ROOT); -} - -NPError WindowedPluginTest::NPP_SetWindow(NPP instance, NPWindow* window) -{ - HWND newWindow = reinterpret_cast<HWND>(window->window); - if (newWindow == m_window) - return NPERR_NO_ERROR; - - if (m_window) { - ::RemovePropW(m_window, instancePointerProperty); - ::SetWindowLongPtr(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_originalWndProc)); - m_originalWndProc = 0; - } - - m_window = newWindow; - if (!m_window) - return NPERR_NO_ERROR; - - m_originalWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtrW(m_window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticWndProc))); - ::SetPropW(m_window, instancePointerProperty, this); - - return NPERR_NO_ERROR; -} - -LRESULT WindowedPluginTest::staticWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - WindowedPluginTest* instance = reinterpret_cast<WindowedPluginTest*>(::GetPropW(hwnd, instancePointerProperty)); - - bool handled = false; - LRESULT result = instance->wndProc(message, wParam, lParam, handled); - if (handled) - return result; - - return ::CallWindowProcW(instance->m_originalWndProc, hwnd, message, wParam, lParam); -} diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h deleted file mode 100644 index b50746ae3..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/WindowedPluginTest.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 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. 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. - */ - -#ifndef WindowedPluginTest_h -#define WindowedPluginTest_h - -#include "PluginTest.h" - -class WindowedPluginTest : public PluginTest { -protected: - WindowedPluginTest(NPP, const std::string& identifier); - - HWND window() const { return m_window; } - HWND testHarnessWindow() const; - - // For derived classes to override - virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled) = 0; - - // PluginTest - virtual NPError NPP_SetWindow(NPP, NPWindow*); - -private: - static LRESULT CALLBACK staticWndProc(HWND, UINT message, WPARAM, LPARAM); - - HWND m_window; - WNDPROC m_originalWndProc; -}; - -#endif // WindowedPluginTest_h diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp index fdb3aaaf1..b5270dc46 100644 --- a/Tools/DumpRenderTree/TestRunner.cpp +++ b/Tools/DumpRenderTree/TestRunner.cpp @@ -11,7 +11,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -32,20 +32,24 @@ #include "WorkQueue.h" #include "WorkQueueItem.h" +#include <JavaScriptCore/APICast.h> #include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSCTestRunnerUtils.h> #include <JavaScriptCore/JSObjectRef.h> #include <JavaScriptCore/JSRetainPtr.h> #include <cstring> #include <locale.h> +#include <runtime/ArrayBufferView.h> +#include <runtime/JSArrayBufferView.h> +#include <runtime/TypedArrayInlines.h> #include <stdio.h> #include <wtf/Assertions.h> #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> -#include <wtf/OwnArrayPtr.h> #include <wtf/RefPtr.h> +#include <wtf/StdLibExtras.h> -#if PLATFORM(MAC) +#if PLATFORM(MAC) && !PLATFORM(IOS) #include <Carbon/Carbon.h> #endif @@ -55,7 +59,7 @@ 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) +TestRunner::TestRunner(const std::string& testURL, const std::string& expectedPixelHash) : m_disallowIncreaseForApplicationCacheQuota(false) , m_dumpApplicationCacheDelegateCallbacks(false) , m_dumpAsAudio(false) @@ -106,15 +110,18 @@ TestRunner::TestRunner(const std::string& testPathOrURL, const std::string& expe , m_areLegacyWebNotificationPermissionRequestsIgnored(false) , m_customFullScreenBehavior(false) , m_hasPendingWebNotificationClick(false) - , m_testPathOrURL(testPathOrURL) + , m_databaseDefaultQuota(-1) + , m_databaseMaxQuota(-1) + , m_testURL(testURL) , m_expectedPixelHash(expectedPixelHash) , m_titleTextDirection("ltr") + , m_timeout(0) { } -PassRefPtr<TestRunner> TestRunner::create(const std::string& testPathOrURL, const std::string& expectedPixelHash) +PassRefPtr<TestRunner> TestRunner::create(const std::string& testURL, const std::string& expectedPixelHash) { - return adoptRef(new TestRunner(testPathOrURL, expectedPixelHash)); + return adoptRef(new TestRunner(testURL, expectedPixelHash)); } // Static Functions @@ -328,22 +335,22 @@ static JSValueRef setCloseRemainingWindowsWhenCompleteCallback(JSContextRef cont return JSValueMakeUndefined(context); } -static JSValueRef setEncodedAudioDataCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef setAudioResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) return JSValueMakeUndefined(context); - JSRetainPtr<JSStringRef> encodedAudioData(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - size_t maxLength = JSStringGetMaximumUTF8CStringSize(encodedAudioData.get()); - OwnArrayPtr<char> encodedAudioDataBuffer = adoptArrayPtr(new char[maxLength + 1]); - JSStringGetUTF8CString(encodedAudioData.get(), encodedAudioDataBuffer.get(), maxLength + 1); + // FIXME (123058): Use a JSC API to get buffer contents once such is exposed. + JSC::JSArrayBufferView* jsBufferView = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(toJS(toJS(context), arguments[0])); + ASSERT(jsBufferView); + RefPtr<JSC::ArrayBufferView> bufferView = jsBufferView->impl(); + const char* buffer = static_cast<const char*>(bufferView->baseAddress()); + std::vector<char> audioData(buffer, buffer + bufferView->byteLength()); TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setEncodedAudioData(encodedAudioDataBuffer.get()); + controller->setAudioResult(audioData); controller->setDumpAsAudio(true); - + return JSValueMakeUndefined(context); } @@ -388,11 +395,11 @@ static JSValueRef addURLToRedirectCallback(JSContextRef context, JSObjectRef fun ASSERT(!*exception); size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get()); - OwnArrayPtr<char> originBuffer = adoptArrayPtr(new char[maxLength + 1]); + auto originBuffer = std::make_unique<char[]>(maxLength + 1); JSStringGetUTF8CString(origin.get(), originBuffer.get(), maxLength + 1); maxLength = JSStringGetMaximumUTF8CStringSize(destination.get()); - OwnArrayPtr<char> destinationBuffer = adoptArrayPtr(new char[maxLength + 1]); + auto destinationBuffer = std::make_unique<char[]>(maxLength + 1); JSStringGetUTF8CString(destination.get(), destinationBuffer.get(), maxLength + 1); TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -460,73 +467,6 @@ static JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef fu return JSValueMakeUndefined(context); } -static JSValueRef syncLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - - controller->syncLocalStorage(); - - return JSValueMakeUndefined(context); -} - -static JSValueRef observeStorageTrackerNotificationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - unsigned numNotifications = JSValueToNumber(context, arguments[0], exception); - - ASSERT(!*exception); - - controller->observeStorageTrackerNotifications(numNotifications); - - return JSValueMakeUndefined(context); -} - -static JSValueRef deleteAllLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->deleteAllLocalStorage(); - - return JSValueMakeUndefined(context); -} - -static JSValueRef deleteLocalStorageForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - controller->deleteLocalStorageForOrigin(url.get()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef localStorageDiskUsageForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> originURL(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - return JSValueMakeNumber(context, controller->localStorageDiskUsageForOrigin(originURL.get())); -} - -static JSValueRef originsWithLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return controller->originsWithLocalStorage(context); -} - static JSValueRef clearBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -706,6 +646,12 @@ static JSValueRef numberOfPendingGeolocationPermissionRequestsCallback(JSContext return JSValueMakeNumber(context, controller->numberOfPendingGeolocationPermissionRequests()); } +static JSValueRef isGeolocationProviderActiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + return JSValueMakeBoolean(context, controller->isGeolocationProviderActive()); +} + static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -873,21 +819,6 @@ static JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectR return JSValueMakeUndefined(context); } -static JSValueRef setApplicationCacheOriginQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - // Has mac implementation - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - - double size = JSValueToNumber(context, arguments[0], NULL); - if (!std::isnan(size)) - controller->setApplicationCacheOriginQuota(static_cast<unsigned long long>(size)); - - return JSValueMakeUndefined(context); -} - static JSValueRef setAuthenticationPasswordCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1113,38 +1044,6 @@ static JSValueRef setMockGeolocationPositionUnavailableErrorCallback(JSContextRe return JSValueMakeUndefined(context); } -static JSValueRef addMockSpeechInputResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> result(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - double confidence = JSValueToNumber(context, arguments[1], exception); - - JSRetainPtr<JSStringRef> language(Adopt, JSValueToStringCopy(context, arguments[2], exception)); - ASSERT(!*exception); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->addMockSpeechInputResult(result.get(), confidence, language.get()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef setMockSpeechInputDumpRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - bool dumpRect = JSValueToBoolean(context, arguments[0]); - - TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - controller->setMockSpeechInputDumpRect(dumpRect); - - return JSValueMakeUndefined(context); -} - static JSValueRef setNewWindowsCopyBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac implementation @@ -1325,6 +1224,43 @@ static JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, J return JSValueMakeUndefined(context); } +#if PLATFORM(IOS) +static JSValueRef setTelephoneNumberParsingEnabledCallback(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->setTelephoneNumberParsingEnabled(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} + +static JSValueRef setPagePausedCallback(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->setPagePaused(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} +#endif + +#if ENABLE(IOS_TEXT_AUTOSIZING) +static JSValueRef setTextAutosizingEnabledCallback(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->setTextAutosizingEnabled(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} +#endif + static JSValueRef setUseDashboardCompatibilityModeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac implementation @@ -1404,7 +1340,7 @@ static JSValueRef setWillSendRequestClearHeaderCallback(JSContextRef context, JS ASSERT(!*exception); size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get()); - OwnArrayPtr<char> headerBuffer = adoptArrayPtr(new char[maxLength + 1]); + auto headerBuffer = std::make_unique<char[]>(maxLength + 1); JSStringGetUTF8CString(header.get(), headerBuffer.get(), maxLength + 1); TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1551,12 +1487,10 @@ static JSValueRef closeWebInspectorCallback(JSContextRef context, JSObjectRef fu static JSValueRef evaluateInWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - double callId = JSValueToNumber(context, arguments[0], exception); - ASSERT(!*exception); - JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception)); + JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception)); ASSERT(!*exception); - controller->evaluateInWebInspector(static_cast<long>(callId), script.get()); + controller->evaluateInWebInspector(script.get()); return JSValueMakeUndefined(context); } @@ -1822,26 +1756,27 @@ static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisOb return JSValueMakeBoolean(context, controller->globalFlag()); } -static JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getDatabaseDefaultQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(context, controller->webHistoryItemCount()); + return JSValueMakeNumber(context, controller->databaseDefaultQuota()); } -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(EFL) -static JSValueRef getPlatformNameCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +static JSValueRef getDatabaseMaxQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); - JSRetainPtr<JSStringRef> platformName(controller->platformName()); - if (!platformName.get()) - return JSValueMakeUndefined(context); - return JSValueMakeString(context, platformName.get()); + return JSValueMakeNumber(context, controller->databaseMaxQuota()); +} + +static JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(context, controller->webHistoryItemCount()); } -#endif static JSValueRef getSecureEventInputIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { -#if PLATFORM(MAC) +#if PLATFORM(MAC) && !PLATFORM(IOS) return JSValueMakeBoolean(context, IsSecureEventInputEnabled()); #else return JSValueMakeBoolean(context, false); @@ -1855,6 +1790,13 @@ static JSValueRef getTitleTextDirectionCallback(JSContextRef context, JSObjectRe return JSValueMakeString(context, titleDirection.get()); } +static JSValueRef getInspectorTestStubURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + JSRetainPtr<JSStringRef> url(Adopt, controller->inspectorTestStubURL()); + return JSValueMakeString(context, url.get()); +} + static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1862,6 +1804,22 @@ static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, return true; } +static bool setDatabaseDefaultQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + controller->setDatabaseDefaultQuota(JSValueToNumber(context, value, exception)); + ASSERT(!*exception); + return true; +} + +static bool setDatabaseMaxQuotaCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); + controller->setDatabaseMaxQuota(JSValueToNumber(context, value, exception)); + ASSERT(!*exception); + return true; +} + static JSValueRef ignoreLegacyWebNotificationPermissionRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); @@ -1975,11 +1933,16 @@ 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) +static JSValueRef failNextNewCodeBlock(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) return JSValueMakeUndefined(context); + return JSC::failNextNewCodeBlock(context); +} + +static JSValueRef numberOfDFGCompiles(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ return JSC::numberOfDFGCompiles(context, arguments[0]); } @@ -2028,11 +1991,11 @@ JSStaticValue* TestRunner::staticValues() static JSStaticValue staticValues[] = { { "globalFlag", getGlobalFlagCallback, setGlobalFlagCallback, kJSPropertyAttributeNone }, { "webHistoryItemCount", getWebHistoryItemCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -#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 }, + { "databaseDefaultQuota", getDatabaseDefaultQuotaCallback, setDatabaseDefaultQuotaCallback, kJSPropertyAttributeNone }, + { "databaseMaxQuota", getDatabaseMaxQuotaCallback, setDatabaseMaxQuotaCallback, kJSPropertyAttributeNone }, + { "inspectorTestStubURL", getInspectorTestStubURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0, 0 } }; return staticValues; @@ -2089,6 +2052,7 @@ JSStaticFunction* TestRunner::staticFunctions() { "originsWithApplicationCache", originsWithApplicationCacheCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "goBack", goBackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ignoreLegacyWebNotificationPermissionRequests", ignoreLegacyWebNotificationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "isGeolocationProviderActive", isGeolocationProviderActiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2112,8 +2076,7 @@ JSStaticFunction* TestRunner::staticFunctions() { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setApplicationCacheOriginQuota", setApplicationCacheOriginQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setEncodedAudioData", setEncodedAudioDataCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setAudioResult", setAudioResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2135,8 +2098,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationPositionUnavailableError", setMockGeolocationPositionUnavailableErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setMockSpeechInputDumpRect", setMockSpeechInputDumpRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setPageVisibility", setPageVisibilityCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2149,6 +2110,13 @@ JSStaticFunction* TestRunner::staticFunctions() { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#if PLATFORM(IOS) + { "setTelephoneNumberParsingEnabled", setTelephoneNumberParsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setPagePaused", setPagePausedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#endif +#if ENABLE(IOS_TEXT_AUTOSIZING) + { "setTextAutosizingEnabled", setTextAutosizingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, +#endif { "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2171,12 +2139,6 @@ JSStaticFunction* TestRunner::staticFunctions() { "addOriginAccessWhitelistEntry", addOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setScrollbarPolicy", setScrollbarPolicyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "authenticateSession", authenticateSessionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "deleteAllLocalStorage", deleteAllLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "syncLocalStorage", syncLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "observeStorageTrackerNotifications", observeStorageTrackerNotificationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "deleteLocalStorageForOrigin", deleteLocalStorageForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "localStorageDiskUsageForOrigin", localStorageDiskUsageForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "originsWithLocalStorage", originsWithLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setTextDirection", setTextDirectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setShouldStayOnPageAfterHandlingBeforeUnload", setShouldStayOnPageAfterHandlingBeforeUnloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2192,6 +2154,7 @@ JSStaticFunction* TestRunner::staticFunctions() { "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "failNextNewCodeBlock", failNextNewCodeBlock, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0 } @@ -2202,37 +2165,37 @@ JSStaticFunction* TestRunner::staticFunctions() void TestRunner::queueLoadHTMLString(JSStringRef content, JSStringRef baseURL) { - WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL)); + WorkQueue::singleton().queue(new LoadHTMLStringItem(content, baseURL)); } void TestRunner::queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL) { - WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, unreachableURL)); + WorkQueue::singleton().queue(new LoadHTMLStringItem(content, baseURL, unreachableURL)); } void TestRunner::queueBackNavigation(int howFarBack) { - WorkQueue::shared()->queue(new BackItem(howFarBack)); + WorkQueue::singleton().queue(new BackItem(howFarBack)); } void TestRunner::queueForwardNavigation(int howFarForward) { - WorkQueue::shared()->queue(new ForwardItem(howFarForward)); + WorkQueue::singleton().queue(new ForwardItem(howFarForward)); } void TestRunner::queueLoadingScript(JSStringRef script) { - WorkQueue::shared()->queue(new LoadingScriptItem(script)); + WorkQueue::singleton().queue(new LoadingScriptItem(script)); } void TestRunner::queueNonLoadingScript(JSStringRef script) { - WorkQueue::shared()->queue(new NonLoadingScriptItem(script)); + WorkQueue::singleton().queue(new NonLoadingScriptItem(script)); } void TestRunner::queueReload() { - WorkQueue::shared()->queue(new ReloadItem); + WorkQueue::singleton().queue(new ReloadItem); } void TestRunner::ignoreLegacyWebNotificationPermissionRequests() @@ -2243,7 +2206,6 @@ void TestRunner::ignoreLegacyWebNotificationPermissionRequests() void TestRunner::waitToDumpWatchdogTimerFired() { const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; - fprintf(stderr, "%s", message); fprintf(stdout, "%s", message); notifyDone(); } diff --git a/Tools/DumpRenderTree/TestRunner.h b/Tools/DumpRenderTree/TestRunner.h index f5133922b..d51ac6feb 100644 --- a/Tools/DumpRenderTree/TestRunner.h +++ b/Tools/DumpRenderTree/TestRunner.h @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -30,7 +30,6 @@ #define TestRunner_h #include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSRetainPtr.h> #include <map> #include <set> #include <string> @@ -40,7 +39,7 @@ class TestRunner : public RefCounted<TestRunner> { public: - static PassRefPtr<TestRunner> create(const std::string& testPathOrURL, const std::string& expectedPixelHash); + static PassRefPtr<TestRunner> create(const std::string& testURL, const std::string& expectedPixelHash); static const unsigned viewWidth; static const unsigned viewHeight; @@ -53,6 +52,8 @@ public: void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception); void addDisallowedURL(JSStringRef url); + const std::set<std::string>& allowedHosts() const { return m_allowedHosts; } + void setAllowedHosts(std::set<std::string> hosts) { m_allowedHosts = WTFMove(hosts); } void addURLToRedirect(std::string origin, std::string destination); const std::string& redirectionDestinationForURL(std::string); void clearAllApplicationCaches(); @@ -75,6 +76,7 @@ public: void keepWebHistory(); void notifyDone(); int numberOfPendingGeolocationPermissionRequests(); + bool isGeolocationProviderActive(); void overridePreference(JSStringRef key, JSStringRef value); JSStringRef pathToLocalResource(JSContextRef, JSStringRef url); void queueBackNavigation(int howFarBackward); @@ -90,7 +92,6 @@ public: void setAllowUniversalAccessFromFileURLs(bool); void setAllowFileAccessFromFileURLs(bool); void setAppCacheMaximumSize(unsigned long long quota); - void setApplicationCacheOriginQuota(unsigned long long); void setAuthorAndUserStylesEnabled(bool); void setCacheModel(int); void setCustomPolicyDelegate(bool setDelegate, bool permissive); @@ -104,8 +105,6 @@ public: void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); void setMockGeolocationPositionUnavailableError(JSStringRef message); - void addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language); - void setMockSpeechInputDumpRect(bool flag); void setPersistentUserStyleSheetLocation(JSStringRef path); void setPluginsEnabled(bool); void setPopupBlockingEnabled(bool); @@ -119,16 +118,20 @@ public: void setXSSAuditorEnabled(bool flag); void setSpatialNavigationEnabled(bool); void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy); - void startSpeechInput(JSContextRef inputElement); +#if PLATFORM(IOS) + void setTelephoneNumberParsingEnabled(bool enable); + void setPagePaused(bool paused); +#endif + void setPageVisibility(const char*); void resetPageVisibility(); void waitForPolicyDelegate(); size_t webHistoryItemCount(); int windowCount(); - -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(EFL) - JSRetainPtr<JSStringRef> platformName() const; + +#if ENABLE(IOS_TEXT_AUTOSIZING) + void setTextAutosizingEnabled(bool); #endif // Legacy here refers to the old TestRunner API for handling web notifications, not the legacy web notification API. @@ -273,17 +276,23 @@ public: bool globalFlag() const { return m_globalFlag; } void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; } + double databaseDefaultQuota() const { return m_databaseDefaultQuota; } + void setDatabaseDefaultQuota(double quota) { m_databaseDefaultQuota = quota; } + + double databaseMaxQuota() const { return m_databaseMaxQuota; } + void setDatabaseMaxQuota(double quota) { m_databaseMaxQuota = quota; } + bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; } void setDeferMainResourceDataLoad(bool flag) { m_deferMainResourceDataLoad = flag; } bool useDeferredFrameLoading() const { return m_useDeferredFrameLoading; } void setUseDeferredFrameLoading(bool flag) { m_useDeferredFrameLoading = flag; } - const std::string& testPathOrURL() const { return m_testPathOrURL; } + const std::string& testURL() const { return m_testURL; } const std::string& expectedPixelHash() const { return m_expectedPixelHash; } - const std::string& encodedAudioData() const { return m_encodedAudioData; } - void setEncodedAudioData(const std::string& encodedAudioData) { m_encodedAudioData = encodedAudioData; } + const std::vector<char>& audioResult() const { return m_audioResult; } + void setAudioResult(const std::vector<char>& audioData) { m_audioResult = audioData; } void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains); void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains); @@ -298,7 +307,9 @@ public: void setDeveloperExtrasEnabled(bool); void showWebInspector(); void closeWebInspector(); - void evaluateInWebInspector(long callId, JSStringRef script); + void evaluateInWebInspector(JSStringRef script); + JSStringRef inspectorTestStubURL(); + void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script); void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script); @@ -327,13 +338,6 @@ public: // Simulate a request an embedding application could make, populating per-session credential storage. void authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password); - JSValueRef originsWithLocalStorage(JSContextRef); - void deleteAllLocalStorage(); - void deleteLocalStorageForOrigin(JSStringRef originIdentifier); - long long localStorageDiskUsageForOrigin(JSStringRef originIdentifier); - void observeStorageTrackerNotifications(unsigned number); - void syncLocalStorage(); - void setShouldPaintBrokenImage(bool); bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; } @@ -350,8 +354,10 @@ public: bool hasPendingWebNotificationClick() const { return m_hasPendingWebNotificationClick; } + void setCustomTimeout(int duration) { m_timeout = duration; } + private: - TestRunner(const std::string& testPathOrURL, const std::string& expectedPixelHash); + TestRunner(const std::string& testURL, const std::string& expectedPixelHash); void setGeolocationPermissionCommon(bool allow); @@ -407,22 +413,27 @@ private: bool m_customFullScreenBehavior; bool m_hasPendingWebNotificationClick; + double m_databaseDefaultQuota; + double m_databaseMaxQuota; + std::string m_authenticationUsername; std::string m_authenticationPassword; - std::string m_testPathOrURL; + std::string m_testURL; std::string m_expectedPixelHash; // empty string if no hash std::string m_titleTextDirection; std::set<std::string> m_willSendRequestClearHeaders; - - // base64 encoded WAV audio data is stored here. - std::string m_encodedAudioData; + std::set<std::string> m_allowedHosts; + + std::vector<char> m_audioResult; std::map<std::string, std::string> m_URLsToRedirect; - + static JSClassRef getJSClass(); static JSStaticValue* staticValues(); static JSStaticFunction* staticFunctions(); + + int m_timeout; }; #endif // TestRunner_h diff --git a/Tools/DumpRenderTree/WorkQueue.cpp b/Tools/DumpRenderTree/WorkQueue.cpp index f38d81a34..68f5afffe 100644 --- a/Tools/DumpRenderTree/WorkQueue.cpp +++ b/Tools/DumpRenderTree/WorkQueue.cpp @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -35,6 +35,7 @@ #include "WorkQueueItem.h" #endif #include <wtf/Assertions.h> +#include <wtf/NeverDestroyed.h> static const unsigned queueLength = 1024; @@ -42,9 +43,9 @@ static WorkQueueItem* theQueue[queueLength]; static unsigned startOfQueue; static unsigned endOfQueue; -WorkQueue* WorkQueue::shared() +WorkQueue& WorkQueue::singleton() { - static WorkQueue* sharedInstance = new WorkQueue; + static NeverDestroyed<WorkQueue> sharedInstance; return sharedInstance; } diff --git a/Tools/DumpRenderTree/WorkQueue.h b/Tools/DumpRenderTree/WorkQueue.h index 649c6c1f5..0697e7c3e 100644 --- a/Tools/DumpRenderTree/WorkQueue.h +++ b/Tools/DumpRenderTree/WorkQueue.h @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -29,11 +29,15 @@ #ifndef WorkQueue_h #define WorkQueue_h +#include <wtf/Forward.h> + class WorkQueueItem; class WorkQueue { +friend class WTF::NeverDestroyed<WorkQueue>; + public: - static WorkQueue* shared(); + static WorkQueue& singleton(); void queue(WorkQueueItem*); WorkQueueItem* dequeue(); diff --git a/Tools/DumpRenderTree/WorkQueueItem.h b/Tools/DumpRenderTree/WorkQueueItem.h index a5823c156..6a49f593f 100644 --- a/Tools/DumpRenderTree/WorkQueueItem.h +++ b/Tools/DumpRenderTree/WorkQueueItem.h @@ -10,7 +10,7 @@ * 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 + * 3. Neither the name of Apple 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. * @@ -132,7 +132,7 @@ private: class BackItem : public BackForwardItem { public: - BackItem(unsigned howFar) + BackItem(int howFar) : BackForwardItem(-howFar) { } @@ -140,7 +140,7 @@ public: class ForwardItem : public BackForwardItem { public: - ForwardItem(unsigned howFar) + ForwardItem(int howFar) : BackForwardItem(howFar) { } diff --git a/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h b/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h deleted file mode 100644 index 7225757e6..000000000 --- a/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#ifndef AccessibilityCallbacks_h -#define AccessibilityCallbacks_h - -void connectAccessibilityCallbacks(); -void disconnectAccessibilityCallbacks(); - -#endif diff --git a/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp b/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp deleted file mode 100644 index 1ea4f4aac..000000000 --- a/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2011 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 "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 <webkit/webkit.h> -#endif - -#if PLATFORM(EFL) -#include "DumpRenderTreeChrome.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#endif - -static guint stateChangeListenerId = 0; -static guint focusEventListenerId = 0; -static guint activeDescendantChangedListenerId = 0; -static guint childrenChangedListenerId = 0; -static guint propertyChangedListenerId = 0; -static guint visibleDataChangedListenerId = 0; - -static void printAccessibilityEvent(AtkObject* accessible, const gchar* signalName, const gchar* signalValue) -{ - // Do not handle state-change:defunct signals, as the AtkObject - // associated to them will not be valid at this point already. - if (!signalName || !g_strcmp0(signalName, "state-change:defunct")) - return; - - if (!accessible || !ATK_IS_OBJECT(accessible)) - return; - - const gchar* objectName = atk_object_get_name(accessible); - AtkRole objectRole = atk_object_get_role(accessible); - - // Try to always provide a name to be logged for the object. - if (!objectName || *objectName == '\0') - 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); -} - -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) - return TRUE; - - AtkObject* accessible = ATK_OBJECT(g_value_get_object(¶mValues[0])); - if (!accessible || !ATK_IS_OBJECT(accessible)) - return TRUE; - - GSignalQuery signalQuery; - GOwnPtr<gchar> signalName; - GOwnPtr<gchar> signalValue; - - g_signal_query(signalHint->signal_id, &signalQuery); - - 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(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(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(signalQuery.signal_name, "property-change")) - signalName.set(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail))); - else - signalName.set(g_strdup(signalQuery.signal_name)); - - printAccessibilityEvent(accessible, signalName.get(), signalValue.get()); - - return TRUE; -} - -void connectAccessibilityCallbacks() -{ - // Ensure no callbacks are connected before. - disconnectAccessibilityCallbacks(); - - // 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, "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. - GObject* dummyAxObject = G_OBJECT(g_object_new(ATK_TYPE_OBJECT, 0)); - AtkObject* dummyNoOpAxObject = atk_no_op_object_new(dummyAxObject); - g_object_unref(G_OBJECT(dummyNoOpAxObject)); - g_object_unref(dummyAxObject); -} - -void disconnectAccessibilityCallbacks() -{ - // AtkObject signals. - if (stateChangeListenerId) { - atk_remove_global_event_listener(stateChangeListenerId); - stateChangeListenerId = 0; - } - if (focusEventListenerId) { - atk_remove_global_event_listener(focusEventListenerId); - focusEventListenerId = 0; - } - if (activeDescendantChangedListenerId) { - atk_remove_global_event_listener(activeDescendantChangedListenerId); - activeDescendantChangedListenerId = 0; - } - if (childrenChangedListenerId) { - atk_remove_global_event_listener(childrenChangedListenerId); - childrenChangedListenerId = 0; - } - if (propertyChangedListenerId) { - atk_remove_global_event_listener(propertyChangedListenerId); - propertyChangedListenerId = 0; - } - if (visibleDataChangedListenerId) { - atk_remove_global_event_listener(visibleDataChangedListenerId); - visibleDataChangedListenerId = 0; - } -} - -#endif diff --git a/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp b/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp deleted file mode 100644 index ddeaf2834..000000000 --- a/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 deleted file mode 100644 index 009b8a8d8..000000000 --- a/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp +++ /dev/null @@ -1,1070 +0,0 @@ -/* - * 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 deleted file mode 100644 index 5b6b699f9..000000000 --- a/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "AccessibilityController.h" - -#include "AccessibilityUIElement.h" -#include "NotImplemented.h" - -AccessibilityController::AccessibilityController() -{ -} - -AccessibilityController::~AccessibilityController() -{ -} - -AccessibilityUIElement AccessibilityController::focusedElement() -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityController::rootElement() -{ - notImplemented(); - return 0; -} - -void AccessibilityController::setLogFocusEvents(bool) -{ - notImplemented(); -} - -void AccessibilityController::setLogScrollingStartEvents(bool) -{ - notImplemented(); -} - -void AccessibilityController::setLogValueChangeEvents(bool) -{ - notImplemented(); -} - -AccessibilityUIElement AccessibilityController::elementAtPoint(int, int) -{ - notImplemented(); - return 0; -} - -void AccessibilityController::setLogAccessibilityEvents(bool) -{ - notImplemented(); -} - -bool AccessibilityController::addNotificationListener(JSObjectRef) -{ - return false; -} - -void AccessibilityController::removeNotificationListener() -{ -} - -AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef) -{ - notImplemented(); - return 0; -} diff --git a/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp deleted file mode 100644 index dc6635466..000000000 --- a/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp +++ /dev/null @@ -1,651 +0,0 @@ -/* - * Copyright (C) 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "AccessibilityUIElement.h" - -#include "NotImplemented.h" - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) -{ -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) -{ -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ -} - -void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>&) -{ - notImplemented(); -} - -void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&) -{ - notImplemented(); -} - -void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>&) -{ - notImplemented(); -} - -void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>&, unsigned, unsigned) -{ - notImplemented(); -} - -int AccessibilityUIElement::childrenCount() -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int, int) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::allAttributes() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::titleUIElement() -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::parentElement() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfChildren() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::parameterizedAttributeNames() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::role() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::subrole() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::roleDescription() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::title() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::description() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::stringValue() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::language() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::x() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::y() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::width() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::height() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::clickPointX() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::clickPointY() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::orientation() const -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::minValue() -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::maxValue() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::valueDescription() -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isEnabled() -{ - notImplemented(); - return 0; -} - -int AccessibilityUIElement::insertionPointLineNumber() -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isPressActionSupported() -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isIncrementActionSupported() -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isDecrementActionSupported() -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isRequired() const -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isSelected() const -{ - notImplemented(); - return 0; -} - -int AccessibilityUIElement::hierarchicalLevel() const -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::ariaIsGrabbed() const -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::ariaDropEffects() const -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isExpanded() const -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfRowHeaders() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfColumns() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfRows() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfVisibleCells() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfHeader() -{ - notImplemented(); - return 0; -} - -int AccessibilityUIElement::indexInTable() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::rowIndexRange() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::columnIndexRange() -{ - notImplemented(); - return 0; -} - -int AccessibilityUIElement::lineForIndex(int) -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::boundsForRange(unsigned, unsigned) -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned, unsigned) -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::selectedTextRange() -{ - notImplemented(); - return 0; -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) -{ - notImplemented(); -} - -bool AccessibilityUIElement::isAttributeSettable(JSStringRef) -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isAttributeSupported(JSStringRef) -{ - notImplemented(); - return 0; -} - -void AccessibilityUIElement::increment() -{ - notImplemented(); -} - -void AccessibilityUIElement::decrement() -{ - notImplemented(); -} - -void AccessibilityUIElement::showMenu() -{ - notImplemented(); -} - -AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned) -{ - notImplemented(); - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::disclosedByRow() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::accessibilityValue() const -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::documentEncoding() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::documentURI() -{ - notImplemented(); - return 0; -} - -unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement*) -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::numberAttributeValue(JSStringRef) -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::boolAttributeValue(JSStringRef) -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef) -{ - notImplemented(); - return 0; -} - -double AccessibilityUIElement::intValue() const -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isChecked() const -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::url() -{ - notImplemented(); - return 0; -} - - -bool AccessibilityUIElement::addNotificationListener(JSObjectRef) -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isSelectable() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isMultiSelectable() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isSelectedOptionActive() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isVisible() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isOffScreen() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isCollapsed() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::hasPopup() const -{ - notImplemented(); - return false; -} - -void AccessibilityUIElement::scrollToMakeVisible() -{ - notImplemented(); -} - -void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int, int, int, int) -{ - notImplemented(); -} - -void AccessibilityUIElement::scrollToGlobalPoint(int, int) -{ - notImplemented(); -} - -void AccessibilityUIElement::takeFocus() -{ - notImplemented(); -} - -void AccessibilityUIElement::takeSelection() -{ - notImplemented(); -} - -void AccessibilityUIElement::addSelection() -{ - notImplemented(); -} - -void AccessibilityUIElement::removeSelection() -{ - notImplemented(); -} - -int AccessibilityUIElement::columnCount() -{ - notImplemented(); - return 0; -} - -void AccessibilityUIElement::removeNotificationListener() -{ - notImplemented(); -} - -void AccessibilityUIElement::press() -{ - notImplemented(); -} - -int AccessibilityUIElement::rowCount() -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::helpText() const -{ - notImplemented(); - return 0; -} - -JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) -{ - notImplemented(); - return 0; -} - -bool AccessibilityUIElement::isIgnored() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isFocused() const -{ - notImplemented(); - return false; -} - -bool AccessibilityUIElement::isFocusable() const -{ - notImplemented(); - return false; -} - diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp deleted file mode 100644 index 4f803af04..000000000 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ /dev/null @@ -1,987 +0,0 @@ -/* - * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "DumpRenderTree.h" - -#include "APICast.h" -#include "AccessibilityController.h" -#include "BackForwardController.h" -#include "BackForwardListBlackBerry.h" -#include "Credential.h" -#include "DatabaseTracker.h" -#include "DocumentLoader.h" -#include "DumpRenderTree/GCController.h" -#include "DumpRenderTreeSupport.h" -#include "EditingBehaviorTypes.h" -#include "EditorClientBlackBerry.h" -#include "EditorInsertAction.h" -#include "Element.h" -#include "EventSender.h" -#include "Frame.h" -#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" -#include "PixelDumpSupport.h" -#include "PixelDumpSupportBlackBerry.h" -#include "Range.h" -#include "RenderTreeAsText.h" -#include "ScriptController.h" -#include "SecurityOrigin.h" -#include "Settings.h" -#include "TestRunner.h" -#include "TextAffinity.h" -#include "Timer.h" -#include "WebCoreTestSupport.h" -#include "WebPage.h" -#include "WebPageClient.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <BlackBerryPlatformLayoutTest.h> -#include <BlackBerryPlatformPrimitives.h> -#include <WebSettings.h> -#include <stdio.h> -#include <sys/stat.h> -#include <unistd.h> -#include <wtf/NonCopyingSort.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/Vector.h> - -#define SDCARD_PATH "/developer" - -volatile bool testDone; - -RefPtr<TestRunner> gTestRunner; - -WebCore::Frame* mainFrame = 0; -WebCore::Frame* topLoadingFrame = 0; -bool waitForPolicy = false; -bool runFromCommandLine = false; - -// FIXME: Assuming LayoutTests has been copied to /developer/LayoutTests/ -static const char* const kSDCLayoutTestsURI = "file:///developer/LayoutTests/"; -static const char* httpTestSyntax = "http/tests/"; -static const char* localTestSyntax = "local/"; -static const char* httpPrefixURL = "http://127.0.0.1:8000/"; - -using namespace std; - -static String drtAffinityDescription(WebCore::EAffinity affinity) -{ - if (affinity == WebCore::UPSTREAM) - return String("NSSelectionAffinityUpstream"); - if (affinity == WebCore::DOWNSTREAM) - return String("NSSelectionAffinityDownstream"); - return ""; -} - -static String drtDumpPath(WebCore::Node* node) -{ - WebCore::Node* parent = node->parentNode(); - String str = String::format("%s", node->nodeName().utf8().data()); - if (parent) { - str.append(" > "); - str.append(drtDumpPath(parent)); - } - return str; -} - -static String drtRangeDescription(WebCore::Range* range) -{ - if (!range) - return "(null)"; - return String::format("range from %d of %s to %d of %s", range->startOffset(), drtDumpPath(range->startContainer()).utf8().data(), range->endOffset(), drtDumpPath(range->endContainer()).utf8().data()); -} - -static String drtFrameDescription(WebCore::Frame* frame) -{ - String name = frame->tree()->uniqueName().string(); - if (frame == mainFrame) { - if (!name.isNull() && name.length()) - return String::format("main frame \"%s\"", name.utf8().data()); - return "main frame"; - } - if (!name.isNull()) - return String::format("frame \"%s\"", name.utf8().data()); - return "frame (anonymous)"; -} - -static WTF::String drtCredentialDescription(WebCore::Credential&) -{ - // TODO: Implementation needed. - return "<unknown>"; -} - -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; - -static void createFile(const String& fileName) -{ - FILE* fd = fopen(fileName.utf8().data(), "wb"); - 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) - : m_gcController(0) - , m_accessibilityController(0) - , m_page(page) - , m_enablePixelTests(getenv("pixelTests")) - , 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; - m_resultsDir = sdcardPath + "/results/"; - m_doneFile = sdcardPath + "/done" + workerNumber; - m_currentTestFile = sdcardPath + "/current" + workerNumber + ".drt"; - m_page->resetVirtualViewportOnCommitted(false); - m_page->setVirtualViewportSize(Platform::IntSize(800, 600)); - s_currentInstance = this; -} - -DumpRenderTree::~DumpRenderTree() -{ - delete m_gcController; - delete m_accessibilityController; -} - -void DumpRenderTree::runTest(const String& url, const String& imageHash) -{ - mainFrame->loader()->stopForUserCancel(); - resetToConsistentStateBeforeTesting(url, imageHash); - if (shouldLogFrameLoadDelegates(url)) - gTestRunner->setDumpFrameLoadCallbacks(true); - if (!runFromCommandLine) { - createFile(m_resultsDir + *m_currentTest + ".dump.crash"); - - String stdoutFile = m_resultsDir + *m_currentTest + ".dump"; - String stderrFile = m_resultsDir + *m_currentTest + ".stderr"; - - // FIXME: we should preserve the original stdout and stderr here but aren't doing - // that yet due to issues with dup, etc. - freopen(stdoutFile.utf8().data(), "wb", stdout); - freopen(stderrFile.utf8().data(), "wb", stderr); - } - FILE* current = fopen(m_currentTestFile.utf8().data(), "w"); - 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() -{ - fclose(stdout); - fclose(stderr); - unlink(getPPSPath().c_str()); - - // Notify the external world that we're done. - createFile(m_doneFile); - (m_page->client())->notifyRunLayoutTestsFinished(); -} - -void DumpRenderTree::runCurrentTest() -{ - String imageHash = ""; - int posSplitter = m_currentTest->find('?'); - if (posSplitter > 1 && (unsigned)posSplitter < m_currentTest->length() - 1) { - imageHash = m_currentTest->substring(posSplitter + 1); - m_currentTest->truncate(posSplitter); - } - if (isHTTPTest(m_currentTest->utf8().data())) { - m_currentHttpTest = m_currentTest->utf8().data(); - m_currentHttpTest.remove(0, strlen(httpTestSyntax)); - runTest(httpPrefixURL + m_currentHttpTest, imageHash); - } else if (isFullUrl(*m_currentTest)) - runTest(*m_currentTest, imageHash); - else - runTest(kSDCLayoutTestsURI + *m_currentTest, imageHash); -} - -void DumpRenderTree::runRemainingTests() -{ - if (runFromCommandLine) { - doneDrt(); - return; - } - - // FIXME: fflush should not be necessary but is temporarily required due to a bug in stdio output. - fflush(stdout); - fflush(stderr); - - if (m_currentTest >= m_tests.end() - 1) { - m_tests.clear(); - if (m_bufferedTests.size() > 0) { - m_tests.append(m_bufferedTests); - m_bufferedTests.clear(); - m_currentTest = m_tests.begin(); - runCurrentTest(); - } - return; - } - - m_currentTest++; - runCurrentTest(); -} - -void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, const String& imageHash) -{ - 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; - 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); - settings->setLoadsImagesAutomatically(true); - settings->setJavaScriptOpenWindowsAutomatically(true); - settings->setZoomToFitOnLoad(false); - settings->setDefaultFontSize(16); - settings->setDefaultFixedFontSize(13); - settings->setMinimumFontSize(1); - 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->setMaximumPagesInCache(0); - settings->setPluginsEnabled(true); - - 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); - m_page->setUserScalable(true); - m_page->setJavaScriptCanAccessClipboard(true); - - if (WebCore::Page* page = DumpRenderTreeSupport::corePage(m_page)) { - page->setTabKeyCyclesThroughElements(true); - - // FIXME: Remove this once BlackBerry uses resetInternalsObject: https://bugs.webkit.org/show_bug.cgi?id=86899. - page->settings()->setEditingBehaviorType(WebCore::EditingUnixBehavior); - - page->settings()->setDOMPasteAllowed(true); - page->settings()->setValidationMessageTimerMagnification(-1); - page->settings()->setInteractiveFormValidationEnabled(true); - page->settings()->setAllowFileAccessFromFileURLs(true); - page->settings()->setAllowUniversalAccessFromFileURLs(true); - page->settings()->setAuthorAndUserStylesEnabled(true); - page->settings()->setUsePreHTML5ParserQuirks(false); - // FIXME: Other ports also clear history/backForwardList allong with visited links. - page->group().removeVisitedLinks(); - if ((mainFrame = page->mainFrame())) { - mainFrame->tree()->clearName(); - mainFrame->loader()->setOpener(0); - // [WebKit bug #86899] Reset JS state settings. - JSGlobalContextRef jsContext = toGlobalRef(mainFrame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()); - WebCoreTestSupport::resetInternalsObject(jsContext); - } - } - - // For now we manually garbage collect between each test to make sure the device won't run out of memory due to lazy collection. - DumpRenderTreeSupport::garbageCollectorCollect(); -} - -void DumpRenderTree::runTests() -{ - m_gcController = new GCController(); - m_accessibilityController = new AccessibilityController(); - if (!ensurePPS()) { - fprintf(stderr, "Failed to open PPS file '%s', error=%d\n", getPPSPath().c_str(), errno); - (m_page->client())->notifyRunLayoutTestsFinished(); - return; - } - - mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame(); - - if (const char* testFile = getenv("drtTestFile")) { - runFromCommandLine = true; - addTest(testFile); - } else { - // Get Test file name from PPS: /pps/services/drt/input - // Example: test_file::fast/js/arguments.html - waitForTest(); - } -} - -void DumpRenderTree::addTest(const char* testFile) -{ - String test(testFile); - if (test == "#DONE") - doneDrt(); - else if (!test.isEmpty()) { - if (m_tests.isEmpty()) { - // No test is being run, initialize iterator and start test - m_tests.append(test); - m_currentTest = m_tests.begin(); - runCurrentTest(); - } else - m_bufferedTests.append(test); - } -} - -String DumpRenderTree::dumpFramesAsText(WebCore::Frame* frame) -{ - String s; - WebCore::Element* documentElement = frame->document()->documentElement(); - if (!documentElement) - return s.utf8().data(); - - if (frame->tree()->parent()) - s = String::format("\n--------\nFrame: '%s'\n--------\n", frame->tree()->uniqueName().string().utf8().data()); - - s = s + documentElement->innerText() + "\n"; - - if (gTestRunner->dumpChildFramesAsText()) { - WebCore::FrameTree* tree = frame->tree(); - for (WebCore::Frame* child = tree->firstChild(); child; child = child->tree()->nextSibling()) - s = s + dumpFramesAsText(child); - } - return s; -} - -static void dumpToFile(const String& data) -{ - fwrite(data.utf8().data(), 1, data.utf8().length(), stdout); -} - -bool DumpRenderTree::isHTTPTest(const String& test) -{ - if (test.length() < strlen(httpTestSyntax)) - return false; - String testLower = test.lower(); - int lenHttpTestSyntax = strlen(httpTestSyntax); - return testLower.substring(0, lenHttpTestSyntax) == httpTestSyntax - && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax; -} - -void DumpRenderTree::invalidateAnyPreviousWaitToDumpWatchdog() -{ - m_waitToDumpWatchdogTimer.stop(); - waitForPolicy = false; -} - -String DumpRenderTree::renderTreeDump() const -{ - if (mainFrame) { - if (mainFrame->view() && mainFrame->view()->layoutPending()) - mainFrame->view()->layout(); - - return externalRepresentation(mainFrame); - } - return ""; -} - -static bool historyItemCompare(const RefPtr<WebCore::HistoryItem>& a, const RefPtr<WebCore::HistoryItem>& b) -{ - return codePointCompare(a->urlString(), b->urlString()) < 0; -} - -static String dumpHistoryItem(PassRefPtr<WebCore::HistoryItem> item, int indent, bool current) -{ - String result; - - int start = 0; - if (current) { - result = result + "curr->"; - start = 6; - } - for (int i = start; i < indent; i++) - result = result + ' '; - - String url = item->urlString(); - if (url.contains("file://")) { - static String layoutTestsString("/LayoutTests/"); - static String fileTestString("(file test):"); - - String res = url.substring(url.find(layoutTestsString) + layoutTestsString.length()); - if (res.isEmpty()) - return result; - - result = result + fileTestString; - result = result + res; - } else - result = result + url; - - String target = item->target(); - if (!target.isEmpty()) - result = result + " (in frame \"" + target + "\")"; - - if (item->isTargetItem()) - result = result + " **nav target**"; - result = result + '\n'; - - WebCore::HistoryItemVector children = item->children(); - // Must sort to eliminate arbitrary result ordering which defeats reproducible testing. - nonCopyingSort(children.begin(), children.end(), historyItemCompare); - unsigned resultSize = children.size(); - for (unsigned i = 0; i < resultSize; ++i) - result = result + dumpHistoryItem(children[i], indent + 4, false); - - return result; -} - -static String dumpBackForwardListForWebView() -{ - String result = "\n============== Back Forward List ==============\n"; - // 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::BackForwardListBlackBerry* bfList = static_cast<WebCore::BackForwardListBlackBerry*>(mainFrame->page()->backForward()->client()); - - int maxItems = bfList->capacity(); - WebCore::HistoryItemVector entries; - bfList->backListWithLimit(maxItems, entries); - unsigned resultSize = entries.size(); - for (unsigned i = 0; i < resultSize; ++i) - result = result + dumpHistoryItem(entries[i], 8, false); - - result = result + dumpHistoryItem(bfList->currentItem(), 8, true); - - bfList->forwardListWithLimit(maxItems, entries); - resultSize = entries.size(); - for (unsigned i = 0; i < resultSize; ++i) - result = result + dumpHistoryItem(entries[i], 8, false); - - result = result + "===============================================\n"; - - return result; -} - -void DumpRenderTree::dump() -{ - if (testDone) - return; - - invalidateAnyPreviousWaitToDumpWatchdog(); - - String dumpFile = m_resultsDir + *m_currentTest + ".dump"; - - String resultMimeType = "text/plain"; - String responseMimeType = mainFrame->loader()->documentLoader()->responseMIMEType(); - - bool dumpAsText = gTestRunner->dumpAsText() || responseMimeType == "text/plain"; - String data = dumpAsText ? dumpFramesAsText(mainFrame) : renderTreeDump(); - - if (gTestRunner->dumpBackForwardList()) - data = data + dumpBackForwardListForWebView(); - - String result = "Content-Type: " + resultMimeType + "\n" + data; - - dumpToFile(result); - - if (!runFromCommandLine) { - // 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(); - // 2. When the test case implicitly allows it by not calling dumpAsText() at all (with no parameters). - bool implicitPixelResults = !gTestRunner->dumpAsText(); - - // 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) { - // signal end of text block - fputs("#EOF\n", stdout); - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - } - - String crashFile = dumpFile + ".crash"; - unlink(crashFile.utf8().data()); - - String doneFile = m_resultsDir + *m_currentTest + ".done"; - createFile(doneFile); - } - testDone = true; - runRemainingTests(); -} - -void DumpRenderTree::setWaitToDumpWatchdog(double interval) -{ - invalidateAnyPreviousWaitToDumpWatchdog(); - m_waitToDumpWatchdogTimer.startOneShot(interval); -} - -void DumpRenderTree::waitToDumpWatchdogTimerFired(WebCore::Timer<DumpRenderTree>*) -{ - gTestRunner->waitToDumpWatchdogTimerFired(); -} - -void DumpRenderTree::processWork(WebCore::Timer<DumpRenderTree>*) -{ - if (topLoadingFrame) - return; - - if (WorkQueue::shared()->processWork() && !gTestRunner->waitToDump()) - dump(); -} - -void DumpRenderTree::locationChangeForFrame(WebCore::Frame* frame) -{ - if (frame != topLoadingFrame) - return; - - topLoadingFrame = 0; - WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue - if (gTestRunner->waitToDump()) - return; - - if (WorkQueue::shared()->count()) - m_workTimer.startOneShot(0); - else - dump(); -} - -// 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()) - printf("%s - didStartProvisionalLoadForFrame\n", drtFrameDescription(frame).utf8().data()); - - if (!testDone && gTestRunner->dumpUserGestureInFrameLoadCallbacks()) - printf("Frame with user gesture \"%s\" - in didStartProvisionalLoadForFrame\n", WebCore::ScriptController::processingUserGesture() ? "true" : "false"); - - if (!topLoadingFrame && !testDone) - topLoadingFrame = frame; - - if (!testDone && gTestRunner->stopProvisionalFrameLoads()) { - printf("%s - stopping load in didStartProvisionalLoadForFrame callback\n", drtFrameDescription(frame).utf8().data()); - frame->loader()->stopForUserCancel(); - } -} - -void DumpRenderTree::didCommitLoadForFrame(WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didCommitLoadForFrame\n", drtFrameDescription(frame).utf8().data()); - - gTestRunner->setWindowIsKey(true); -} - -void DumpRenderTree::didFailProvisionalLoadForFrame(WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFailProvisionalLoadWithError\n", drtFrameDescription(frame).utf8().data()); - - locationChangeForFrame(frame); -} - -void DumpRenderTree::didFailLoadForFrame(WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFailLoadWithError\n", drtFrameDescription(frame).utf8().data()); - - locationChangeForFrame(frame); -} - -void DumpRenderTree::didFinishLoadForFrame(WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFinishLoadForFrame\n", drtFrameDescription(frame).utf8().data()); - - if (frame == topLoadingFrame) { - m_loadFinished = true; - locationChangeForFrame(frame); - } -} - -void DumpRenderTree::didFinishDocumentLoadForFrame(WebCore::Frame* frame) -{ - if (!testDone) { - if (gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFinishDocumentLoadForFrame\n", drtFrameDescription(frame).utf8().data()); - else { - unsigned pendingFrameUnloadEvents = frame->document()->domWindow()->pendingUnloadEventListeners(); - if (pendingFrameUnloadEvents) - printf("%s - has %u onunload handler(s)\n", drtFrameDescription(frame).utf8().data(), pendingFrameUnloadEvents); - } - } -} - -void DumpRenderTree::didClearWindowObjectInWorld(WebCore::DOMWrapperWorld*, JSGlobalContextRef context, JSObjectRef windowObject) -{ - JSValueRef exception = 0; - - gTestRunner->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_gcController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_accessibilityController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); - JSValueRef eventSender = makeEventSender(context); - JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - JSStringRelease(eventSenderStr); - WebCoreTestSupport::injectInternalsObject(context); -} - -void DumpRenderTree::didReceiveTitleForFrame(const String& title, WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didReceiveTitle: %s\n", drtFrameDescription(frame).utf8().data(), title.utf8().data()); - - if (gTestRunner->dumpTitleChanges()) - printf("TITLE CHANGED: %s\n", title.utf8().data()); -} - -// ChromeClient delegates. -void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNumber, const String&) -{ - printf("CONSOLE MESSAGE: "); - if (lineNumber) - printf("line %d: ", lineNumber); - String newMessage = message; - int pos = message.find("file://"); - if (pos >= 0) { - newMessage = message.substring(0, pos); - String remaining = message.substring(pos); - String fileName; - int indexFile = remaining.reverseFind('/') + 1; - if (indexFile > 0 && unsigned(indexFile) < remaining.length()) - fileName = remaining.substring(indexFile); - else - fileName = "file:"; - newMessage.append(fileName); - } - printf("%s\n", newMessage.utf8().data()); -} - -void DumpRenderTree::runJavaScriptAlert(const String& message) -{ - if (!testDone) - printf("ALERT: %s\n", message.utf8().data()); -} - -bool DumpRenderTree::runJavaScriptConfirm(const String& message) -{ - if (!testDone) - printf("CONFIRM: %s\n", message.utf8().data()); - return true; -} - -String DumpRenderTree::runJavaScriptPrompt(const String& message, const String& defaultValue) -{ - if (!testDone) - printf("PROMPT: %s, default text: %s\n", message.utf8().data(), defaultValue.utf8().data()); - return defaultValue; -} - -bool DumpRenderTree::runBeforeUnloadConfirmPanel(const String& message) -{ - if (!testDone) - printf("CONFIRM NAVIGATION: %s\n", message.utf8().data()); - return true; -} - -void DumpRenderTree::setStatusText(const String& status) -{ - if (gTestRunner->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", status.utf8().data()); -} - -void DumpRenderTree::exceededDatabaseQuota(WebCore::SecurityOrigin* origin, const String& name) -{ - if (!testDone && gTestRunner->dumpDatabaseCallbacks()) - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", origin->protocol().utf8().data(), origin->host().utf8().data(), origin->port(), name.utf8().data()); - - WebCore::DatabaseTracker::tracker().setQuota(mainFrame->document()->securityOrigin(), 5 * 1024 * 1024); -} - -bool DumpRenderTree::allowsOpeningWindow() -{ - return gTestRunner->canOpenWindows(); -} - -void DumpRenderTree::windowCreated(BlackBerry::WebKit::WebPage* page) -{ - page->settings()->setJavaScriptOpenWindowsAutomatically(true); -} - -// EditorClient delegates. -void DumpRenderTree::didBeginEditing() -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidBeginEditing:%s\n", "WebViewDidBeginEditingNotification"); -} - -void DumpRenderTree::didEndEditing() -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidEndEditing:%s\n", "WebViewDidEndEditingNotification"); -} - -void DumpRenderTree::didChange() -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChange:%s\n", "WebViewDidChangeNotification"); -} - -void DumpRenderTree::didChangeSelection() -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", "WebViewDidChangeSelectionNotification"); -} - -bool DumpRenderTree::shouldBeginEditingInDOMRange(WebCore::Range* range) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", drtRangeDescription(range).utf8().data()); - return m_acceptsEditing; -} - -bool DumpRenderTree::shouldEndEditingInDOMRange(WebCore::Range* range) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", drtRangeDescription(range).utf8().data()); - return m_acceptsEditing; -} - -bool DumpRenderTree::shouldDeleteDOMRange(WebCore::Range* range) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", drtRangeDescription(range).utf8().data()); - return m_acceptsEditing; -} - -bool DumpRenderTree::shouldChangeSelectedDOMRangeToDOMRangeAffinityStillSelecting(WebCore::Range* fromRange, WebCore::Range* toRange, int affinity, bool stillSelecting) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", drtRangeDescription(fromRange).utf8().data(), drtRangeDescription(toRange).utf8().data(), drtAffinityDescription(static_cast<WebCore::EAffinity>(affinity)).utf8().data(), stillSelecting ? "TRUE" : "FALSE"); - return m_acceptsEditing; -} - -static const char* insertActionString(WebCore::EditorInsertAction action) -{ - switch (action) { - case WebCore::EditorInsertActionTyped: - return "WebViewInsertActionTyped"; - case WebCore::EditorInsertActionPasted: - return "WebViewInsertActionPasted"; - case WebCore::EditorInsertActionDropped: - return "WebViewInsertActionDropped"; - } - ASSERT_NOT_REACHED(); - return "WebViewInsertActionTyped"; -} - -bool DumpRenderTree::shouldInsertNode(WebCore::Node* node, WebCore::Range* range, int action) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", drtDumpPath(node).utf8().data(), drtRangeDescription(range).utf8().data(), insertActionString((WebCore::EditorInsertAction)action)); - return m_acceptsEditing; -} - -bool DumpRenderTree::shouldInsertText(const String& text, WebCore::Range* range, int action) -{ - if (!testDone && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", text.utf8().data(), drtRangeDescription(range).utf8().data(), insertActionString((WebCore::EditorInsertAction)action)); - return m_acceptsEditing; -} - -void DumpRenderTree::didDecidePolicyForNavigationAction(const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, WebCore::Frame* frame) -{ - if (testDone || !m_policyDelegateEnabled) - return; - - const char* typeDescription; - switch (action.type()) { - case WebCore::NavigationTypeLinkClicked: - typeDescription = "link clicked"; - break; - case WebCore::NavigationTypeFormSubmitted: - typeDescription = "form submitted"; - break; - case WebCore::NavigationTypeBackForward: - typeDescription = "back/forward"; - break; - case WebCore::NavigationTypeReload: - typeDescription = "reload"; - break; - case WebCore::NavigationTypeFormResubmitted: - typeDescription = "form resubmitted"; - break; - case WebCore::NavigationTypeOther: - typeDescription = "other"; - break; - default: - typeDescription = "illegal value"; - } - - 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(); -} - -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() -{ - if (!testDone && gTestRunner->dumpUserGestureInFrameLoadCallbacks()) - printf("Frame with user gesture \"%s\" - in willPerformClientRedirect\n", WebCore::ScriptController::processingUserGesture() ? "true" : "false"); -} - -void DumpRenderTree::didHandleOnloadEventsForFrame(WebCore::Frame* frame) -{ - if (!testDone && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didHandleOnloadEventsForFrame\n", drtFrameDescription(frame).utf8().data()); -} - -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()); -} - -bool DumpRenderTree::didReceiveAuthenticationChallenge(WebCore::Credential& credential) -{ - if (!gTestRunner->handlesAuthenticationChallenges()) { - credential = WebCore::Credential(); - printf("%s - didReceiveAuthenticationChallenge - Simulating cancelled authentication\n", drtCredentialDescription(credential).utf8().data()); - return false; - } - const char* user = gTestRunner->authenticationUsername().c_str(); - const char* password = gTestRunner->authenticationPassword().c_str(); - credential = WebCore::Credential(user, password, WebCore::CredentialPersistenceForSession); - printf("%s - didReceiveAuthenticationChallenge - Responding with %s:%s\n", drtCredentialDescription(credential).utf8().data(), user, password); - return true; -} - -void DumpRenderTree::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - m_policyDelegateEnabled = setDelegate; - m_policyDelegateIsPermissive = permissive; -} -} -} - -// Static dump() function required by cross-platform DRT code. -void dump() -{ - BlackBerry::WebKit::DumpRenderTree* dumper = BlackBerry::WebKit::DumpRenderTree::currentInstance(); - if (!dumper) - return; - - dumper->dump(); -} diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h deleted file mode 100644 index 6aa4a8a3d..000000000 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DumpRenderTreeBlackBerry_h -#define DumpRenderTreeBlackBerry_h - -#include "BlackBerryGlobal.h" - - -#include "DumpRenderTreeClient.h" -#include "Timer.h" -#include <BlackBerryPlatformLayoutTest.h> -#include <FindOptions.h> -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - -namespace WebCore { -class Credential; -class DOMWrapperWorld; -class Frame; -class Range; -} - -extern WebCore::Frame* mainFrame; -extern WebCore::Frame* topLoadingFrame; -extern bool waitForPolicy; - -class AccessibilityController; -class GCController; - -namespace BlackBerry { -namespace WebKit { -class WebPage; - -class DumpRenderTree : public BlackBerry::WebKit::DumpRenderTreeClient, public BlackBerry::Platform::LayoutTestClient { -public: - DumpRenderTree(WebPage*); - virtual ~DumpRenderTree(); - - static DumpRenderTree* currentInstance() { return s_currentInstance; } - - void dump(); - - void setWaitToDumpWatchdog(double interval); - - WebPage* page() { return m_page; } - - 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*); - void didFailLoadForFrame(WebCore::Frame*); - void didFinishLoadForFrame(WebCore::Frame*); - 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&, 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); - void runJavaScriptAlert(const String& message); - bool runJavaScriptConfirm(const String& message); - String runJavaScriptPrompt(const String& message, const String& defaultValue); - bool runBeforeUnloadConfirmPanel(const String& message); - void setStatusText(const String&); - void exceededDatabaseQuota(WebCore::SecurityOrigin*, const String& name); - bool allowsOpeningWindow(); - void windowCreated(WebPage*); - - // EditorClient delegates - void setAcceptsEditing(bool acceptsEditing) { m_acceptsEditing = acceptsEditing; } - - void didBeginEditing(); - void didEndEditing(); - void didChange(); - void didChangeSelection(); - bool shouldBeginEditingInDOMRange(WebCore::Range*); - bool shouldEndEditingInDOMRange(WebCore::Range*); - bool shouldDeleteDOMRange(WebCore::Range*); - bool shouldChangeSelectedDOMRangeToDOMRangeAffinityStillSelecting(WebCore::Range* fromRange, WebCore::Range* toRange, int affinity, bool stillSelecting); - bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction); - bool shouldInsertText(const String&, WebCore::Range*, int insertAction); - - 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(); - void runCurrentTest(); - - void processWork(WebCore::Timer<DumpRenderTree>*); - -private: - static DumpRenderTree* s_currentInstance; - - String dumpFramesAsText(WebCore::Frame*); - void locationChangeForFrame(WebCore::Frame*); - - void doneDrt(); - bool isHTTPTest(const String& test); - String renderTreeDump() const; - void resetToConsistentStateBeforeTesting(const String& url, const String& imageHash); - void runRemainingTests(); - void invalidateAnyPreviousWaitToDumpWatchdog(); - void waitToDumpWatchdogTimerFired(WebCore::Timer<DumpRenderTree>*); - - Vector<String> m_tests; - Vector<String>::iterator m_currentTest; - Vector<String> m_bufferedTests; - - String m_resultsDir; - String m_doneFile; - String m_currentHttpTest; - String m_currentTestFile; - - GCController* m_gcController; - AccessibilityController* m_accessibilityController; - WebPage* m_page; - bool m_enablePixelTests; - WebCore::Timer<DumpRenderTree> m_waitToDumpWatchdogTimer; - WebCore::Timer<DumpRenderTree> m_workTimer; - - bool m_acceptsEditing; - bool m_loadFinished; - bool m_policyDelegateEnabled; - bool m_policyDelegateIsPermissive; -}; -} -} - -#endif // DumpRenderTreeBlackBerry_h diff --git a/Tools/DumpRenderTree/blackberry/EventSender.cpp b/Tools/DumpRenderTree/blackberry/EventSender.cpp deleted file mode 100644 index 7fafb9eb0..000000000 --- a/Tools/DumpRenderTree/blackberry/EventSender.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ - * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "EventSender.h" - -#include "DumpRenderTreeBlackBerry.h" -#include "DumpRenderTreeSupport.h" -#include "IntPoint.h" -#include "NotImplemented.h" -#include "WebKitThreadViewportAccessor.h" -#include "WebPage.h" - -#include <BlackBerryPlatformKeyboardEvent.h> -#include <BlackBerryPlatformMouseEvent.h> -#include <BlackBerryPlatformTouchEvent.h> -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSValueRef.h> -#include <wtf/Vector.h> - -using namespace WebCore; - -static IntPoint lastMousePosition; -static Vector<BlackBerry::Platform::TouchPoint> touches; -static bool touchActive = false; - -void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type); - -// Callbacks - -static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static bool setDragModeCallback(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -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(); - 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, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - 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, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - int x = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - - lastMousePosition = IntPoint(x, y); - BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - 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, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -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); - unsigned charCode = 0; - bool needsShiftKeyModifier = false; - if (JSStringIsEqualToUTF8CString(character, "leftArrow")) - charCode = KEYCODE_LEFT; - else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) - charCode = KEYCODE_RIGHT; - else if (JSStringIsEqualToUTF8CString(character, "upArrow")) - charCode = KEYCODE_UP; - else if (JSStringIsEqualToUTF8CString(character, "downArrow")) - charCode = KEYCODE_DOWN; - else if (JSStringIsEqualToUTF8CString(character, "pageUp")) - charCode = KEYCODE_PG_UP; - else if (JSStringIsEqualToUTF8CString(character, "pageDown")) - charCode = KEYCODE_PG_DOWN; - else if (JSStringIsEqualToUTF8CString(character, "home")) - charCode = KEYCODE_HOME; - else if (JSStringIsEqualToUTF8CString(character, "end")) - charCode = KEYCODE_END; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - charCode = KEYCODE_BACKSPACE; - else { - charCode = JSStringGetCharactersPtr(character)[0]; - if (0x8 == charCode) - charCode = KEYCODE_BACKSPACE; - else if (0x7F == charCode) - charCode = KEYCODE_DELETE; - else if (WTF::isASCIIUpper(charCode)) - needsShiftKeyModifier = true; - } - JSStringRelease(character); - - static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); - bool needsAltKeyModifier = false; - bool needsCtrlKeyModifier = false; - if (argumentCount > 1) { - if (JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0)) { - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); - for (int i = 0; i < modifiersCount; ++i) { - JSStringRef string = JSValueToStringCopy(context, JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0), 0); - if (JSStringIsEqualToUTF8CString(string, "shiftKey")) - needsShiftKeyModifier = true; - else if (JSStringIsEqualToUTF8CString(string, "altKey")) - needsAltKeyModifier = true; - else if (JSStringIsEqualToUTF8CString(string, "ctrlKey")) - needsCtrlKeyModifier = true; - JSStringRelease(string); - } - } - } - - BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - - unsigned modifiers = 0; - if (needsShiftKeyModifier) - modifiers |= KEYMOD_SHIFT; - if (needsAltKeyModifier) - modifiers |= KEYMOD_ALT; - if (needsCtrlKeyModifier) - modifiers |= KEYMOD_CTRL; - - page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyDown, modifiers)); - page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyUp, modifiers)); - - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - int x = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - - 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); - - 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, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - int x = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - int y = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); - ASSERT(!exception || !*exception); - - if (index < 0 || index >= (int)touches.size()) - return JSValueMakeUndefined(context); - - BlackBerry::Platform::TouchPoint& touch = touches[index]; - - // pixelViewportPosition is unused in the WebKit layer - IntPoint pos(x, y); - - // 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, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - if (!touchActive) { - sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchStart); - touchActive = true; - } else - sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove); - return JSValueMakeUndefined(context); -} - -static JSValueRef touchCancelCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -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, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - for (unsigned i = 0; i < touches.size(); ++i) - if (touches[i].state() != BlackBerry::Platform::TouchPoint::TouchReleased) { - sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove); - return JSValueMakeUndefined(context); - } - sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchEnd); - touchActive = false; - return JSValueMakeUndefined(context); -} - -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, JSObjectRef, size_t, const JSValueRef[], JSValueRef*) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - if (index < 0 || index >= (int)touches.size()) - return JSValueMakeUndefined(context); - - touches[index].updateState(BlackBerry::Platform::TouchPoint::TouchReleased); - return JSValueMakeUndefined(context); -} - -void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type type) -{ - BlackBerry::Platform::TouchEvent event; - event.m_type = type; - event.m_points.assign(touches.begin(), touches.end()); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->touchEvent(event); - - Vector<BlackBerry::Platform::TouchPoint> t; - - for (Vector<BlackBerry::Platform::TouchPoint>::iterator it = touches.begin(); it != touches.end(); ++it) { - if (it->state() != BlackBerry::Platform::TouchPoint::TouchReleased) { - it->updateState(BlackBerry::Platform::TouchPoint::TouchStationary); - t.append(*it); - } - } - touches = t; -} - -static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - float scaleFactor = JSValueToNumber(context, arguments[0], exception); - float x = JSValueToNumber(context, arguments[1], exception); - float y = JSValueToNumber(context, arguments[2], exception); - - BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); - if (!page) - return JSValueMakeUndefined(context); - - DumpRenderTreeSupport::scalePageBy(page, scaleFactor, x, y); - - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "mouseWheelTo", mouseWheelToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "addTouchPoint", addTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "cancelTouchPoint", cancelTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "clearTouchPoints", clearTouchPointsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "releaseTouchPoint", releaseTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setTouchModifier", setTouchModifierCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchCancel", touchCancelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchEnd", touchEndCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchMove", touchMoveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchStart", touchStartCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "updateTouchPoint", updateTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticValues[] = { - { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef) -{ - static JSClassRef eventSenderClass = 0; - - if (!eventSenderClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticFunctions; - classDefinition.staticValues = staticValues; - - eventSenderClass = JSClassCreate(&classDefinition); - } - - return eventSenderClass; -} - -void replaySavedEvents() -{ - notImplemented(); -} - -JSObjectRef makeEventSender(JSContextRef context) -{ - return JSObjectMake(context, getClass(context), 0); -} - diff --git a/Tools/DumpRenderTree/blackberry/EventSender.h b/Tools/DumpRenderTree/blackberry/EventSender.h deleted file mode 100644 index 66f719629..000000000 --- a/Tools/DumpRenderTree/blackberry/EventSender.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2009, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EventSender_h -#define EventSender_h - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeEventSender(JSContextRef); -void replaySavedEvents(); - -#endif diff --git a/Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp deleted file mode 100644 index 8e8bd965b..000000000 --- a/Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "DumpRenderTree/GCController.h" - -#include "DumpRenderTreeSupport.h" - -void GCController::collect() const -{ - DumpRenderTreeSupport::garbageCollectorCollect(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - DumpRenderTreeSupport::garbageCollectorCollectOnAlternateThread(waitUntilDone); -} - -size_t GCController::getJSObjectCount() const -{ - return DumpRenderTreeSupport::javaScriptObjectsCount(); -} - diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp deleted file mode 100644 index bc4e7ab85..000000000 --- a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Portions of this file are Copyright 2005 Google Inc. - */ - -#include "config.h" -#include "PNGImageEncoder.h" - - -extern "C" { -#include "png.h" -} - -#include <wtf/OwnArrayPtr.h> - -// This code is almost a mirror of the code in WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp -// since we can't include this private WebCore file in a WebKit-client application. - -// Keep the premultipied for as it is the most faithful information -static void BGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output) -{ - for (int x = 0; x < numberOfPixels; x++) { - output[0] = input[2]; - output[1] = input[1]; - output[2] = input[0]; - output[3] = input[3]; - input += 4; - output += 4; - } -} - -// Passed around as the io_ptr in the png structs so our callbacks know where -// to write data. -struct PNGEncoderState { - PNGEncoderState(Vector<unsigned char>* o) : m_out(o) { } - Vector<unsigned char>* m_out; -}; - -// Called by libpng to flush its internal buffer to ours. -void encoderWriteCallback(png_structp png, png_bytep data, png_size_t size) -{ - PNGEncoderState* state = static_cast<PNGEncoderState*>(png_get_io_ptr(png)); - ASSERT(state->m_out); - - size_t oldSize = state->m_out->size(); - state->m_out->resize(oldSize + size); - memcpy(&(*state->m_out)[oldSize], data, size); -} - -// Automatically destroys the given write structs on destruction to make -// cleanup and error handling code cleaner. -class PNGWriteStructDestroyer { -public: - PNGWriteStructDestroyer(png_struct** ps, png_info** pi) - : m_pngStruct(ps) - , m_pngInfo(pi) - { - } - - ~PNGWriteStructDestroyer() - { - png_destroy_write_struct(m_pngStruct, m_pngInfo); - } - -private: - png_struct** m_pngStruct; - png_info** m_pngInfo; -}; - -typedef void (*PixelConversionFunc)(const unsigned char*, int, unsigned char*); -static bool encodeImpl(const unsigned char* input, int imageWidth, int imageHeight, int bytesPerRow, Vector<unsigned char>* output, PixelConversionFunc conversionFunc) -{ - int inputColorComponents = 4; - int outputColorComponents = 4; - int pngOutputColorType = PNG_COLOR_TYPE_RGB_ALPHA; - - if (imageWidth < 0) - imageWidth = 0; - - if (imageHeight < 0) - imageHeight = 0; - - // Row stride should be at least as long as the length of the data. - if (inputColorComponents * imageWidth > bytesPerRow) { - ASSERT(false); - return false; - } - - png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - if (!pngPtr) - return false; - - png_info* infoPtr = png_create_info_struct(pngPtr); - if (!infoPtr) { - png_destroy_write_struct(&pngPtr, 0); - return false; - } - PNGWriteStructDestroyer destroyer(&pngPtr, &infoPtr); - - if (setjmp(png_jmpbuf(pngPtr))) { - // The destroyer will ensure that the structures are cleaned up in this - // case, even though we may get here as a jump from random parts of the - // PNG library called below. - return false; - } - - // Set our callback for libpng to give us the data. - PNGEncoderState state(output); - png_set_write_fn(pngPtr, &state, encoderWriteCallback, 0); - - png_set_IHDR(pngPtr, infoPtr, imageWidth, imageHeight, 8, pngOutputColorType, - PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - png_write_info(pngPtr, infoPtr); - - OwnArrayPtr<unsigned char> rowPixels = adoptArrayPtr(new unsigned char[imageWidth * outputColorComponents]); - for (int y = 0; y < imageHeight; y ++) { - conversionFunc(&input[y * bytesPerRow], imageWidth, rowPixels.get()); - png_write_row(pngPtr, rowPixels.get()); - } - - png_write_end(pngPtr, infoPtr); - return true; -} - -bool encodeBitmapToPNG(unsigned char* data, int width, int height, Vector<unsigned char>* output) -{ - bool result = encodeImpl(data, width, height, width * 4, output, BGRAtoRGBA); - return result; -} diff --git a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h b/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h deleted file mode 100644 index 7a320a757..000000000 --- a/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PNGImageEncoder_h -#define PNGImageEncoder_h - -#include <wtf/Vector.h> - -bool encodeBitmapToPNG(unsigned char* data, int width, int height, WTF::Vector<unsigned char>* output); - -#endif // PNGImageEncoder_h diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp deleted file mode 100644 index 82b448d13..000000000 --- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "PixelDumpSupportBlackBerry.h" - -#include "BackingStore.h" -#include "BlackBerryPlatformExecutableMessage.h" -#include "BlackBerryPlatformGraphics.h" -#include "BlackBerryPlatformGraphicsContext.h" -#include "BlackBerryPlatformGraphicsImpl.h" -#include "BlackBerryPlatformMessageClient.h" -#include "DumpRenderTreeBlackBerry.h" -#include "PNGImageEncoder.h" -#include "PixelDumpSupport.h" -#include "WebPage.h" -#include "WebPageClient.h" - -#include <BlackBerryPlatformWindow.h> -#include <wtf/MD5.h> -#include <wtf/Vector.h> - -using namespace BlackBerry::WebKit; -using namespace BlackBerry; -using namespace WTF; - -void readPixelsUserInterfaceThread(BlackBerry::Platform::Graphics::PlatformGraphicsContext* context, const BlackBerry::Platform::IntRect& srcRect, unsigned char* pixels) -{ - context->readPixels(srcRect, pixels, false, false); -} - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool /*incrementalRepaint*/, bool /*sweepHorizontally*/, bool /*drawSelectionRect*/) -{ - Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window(); - ASSERT(window); - - // The BackingStore has a queue of pending jobs, which are run on idle - // and which may not have been run yet. - BackingStore* backingStore = DumpRenderTree::currentInstance()->page()->backingStore(); - while (backingStore->hasBlitJobs()) - backingStore->blitOnIdle(); - - const Platform::IntRect& windowRect = window->viewportRect(); - const Platform::IntSize& windowSize = window->viewportSize(); - unsigned char* data = new unsigned char[windowSize.width() * windowSize.height() * 4]; - - 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); - BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( - BlackBerry::Platform::createFunctionCallMessage(&readPixelsUserInterfaceThread, drawable, windowRect, data)); - BlackBerry::Platform::Graphics::releaseBufferDrawable(buffer); - } - BlackBerry::Platform::Graphics::destroyBuffer(buffer); - return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height()); -} - -void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33]) -{ - int pixelsWide = context->m_width; - int pixelsHigh = context->m_height; - int bytesPerRow = context->m_width * 4; - unsigned char* pixelData = context->m_data; - - MD5 md5; - for (int i = 0; i < pixelsHigh; ++i) { - md5.addBytes(pixelData, 4 * pixelsWide); - pixelData += bytesPerRow; - } - - Vector<uint8_t, 16> hash; - md5.checksum(hash); - - hashString[0] = '\0'; - for (int i = 0; i < 16; ++i) - snprintf(hashString, 33, "%s%02x", hashString, hash[i]); -} - -static void printPNG(BitmapContext* context, const char* checksum) -{ - Vector<unsigned char> pngData; - encodeBitmapToPNG(context->m_data, context->m_width, context->m_height, &pngData); - printPNG(pngData.data(), pngData.size(), checksum); -} - -void dumpBitmap(BitmapContext* context, const char* checksum) -{ - printPNG(context, checksum); -} diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h deleted file mode 100644 index 87c6bf08a..000000000 --- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PixelDumpSupportBlackBerry_h -#define PixelDumpSupportBlackBerry_h - -#include <stdio.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -class BitmapContext : public RefCounted<BitmapContext> { -public: - - static PassRefPtr<BitmapContext> createByAdoptingData(unsigned char* data, int width, int height) - { - return adoptRef(new BitmapContext(data, width, height)); - } - - ~BitmapContext() - { - delete m_data; - } - - unsigned char* m_data; - int m_width, m_height; - -private: - - BitmapContext(unsigned char* data, int width, int height) - : m_data(data) - , m_width(width) - , m_height(height) - { - } -}; - -#endif // PixelDumpSupportBlackBerry_h diff --git a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp deleted file mode 100644 index 04a215e75..000000000 --- a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp +++ /dev/null @@ -1,713 +0,0 @@ -/* - * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "TestRunner.h" - -#include "DatabaseTracker.h" -#include "Document.h" -#include "DocumentLoader.h" -#include "DocumentMarker.h" -#include "DumpRenderTree.h" -#include "DumpRenderTreeBlackBerry.h" -#include "DumpRenderTreeSupport.h" -#include "EditingBehaviorTypes.h" -#include "EditorClientBlackBerry.h" -#include "Element.h" -#include "Frame.h" -#include "HTMLInputElement.h" -#include "JSElement.h" -#include "KURL.h" -#include "NotImplemented.h" -#include "Page.h" -#include "RenderTreeAsText.h" -#include "SchemeRegistry.h" -#include "SecurityOrigin.h" -#include "SecurityPolicy.h" -#include "Settings.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" - -#include <JavaScriptCore/APICast.h> -#include <SharedPointer.h> -#include <WebPage.h> -#include <WebSettings.h> - -#include <wtf/OwnArrayPtr.h> -#include <wtf/text/CString.h> - -using WebCore::toElement; -using WebCore::toJS; - -TestRunner::~TestRunner() -{ -} - -void TestRunner::addDisallowedURL(JSStringRef url) -{ - UNUSED_PARAM(url); - notImplemented(); -} - -void TestRunner::clearAllDatabases() -{ -#if ENABLE(DATABASE) - WebCore::DatabaseTracker::tracker().deleteAllDatabases(); -#endif -} - -void TestRunner::clearBackForwardList() -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->clearBackForwardList(true); -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - notImplemented(); -} - -JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) -{ - UNUSED_PARAM(name); - notImplemented(); - return 0; -} - -JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) -{ - UNUSED_PARAM(name); - notImplemented(); - return 0; -} - -void TestRunner::dispatchPendingLoadRequests() -{ - notImplemented(); -} - -void TestRunner::display() -{ - notImplemented(); -} - -static String jsStringRefToWebCoreString(JSStringRef str) -{ - size_t strArrSize = JSStringGetMaximumUTF8CStringSize(str); - OwnArrayPtr<char> strArr = adoptArrayPtr(new char[strArrSize]); - JSStringGetUTF8CString(str, strArr.get(), strArrSize); - return String::fromUTF8(strArr.get()); -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - if (!mainFrame) - return; - - String nameStr = jsStringRefToWebCoreString(name); - String valueStr = jsStringRefToWebCoreString(value); - - mainFrame->editor()->command(nameStr).execute(valueStr); -} - -bool TestRunner::isCommandEnabled(JSStringRef name) -{ - if (!mainFrame) - return false; - - String nameStr = jsStringRefToWebCoreString(name); - - return mainFrame->editor()->command(nameStr).isEnabled(); -} - -void TestRunner::keepWebHistory() -{ - notImplemented(); -} - -void TestRunner::notifyDone() -{ - if (m_waitToDump && (!topLoadingFrame || BlackBerry::WebKit::DumpRenderTree::currentInstance()->loadFinished()) && !WorkQueue::shared()->count()) - dump(); - - m_waitToDump = false; - waitForPolicy = false; -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef, JSStringRef url) -{ - return JSStringRetain(url); -} - -void TestRunner::queueLoad(JSStringRef url, JSStringRef target) -{ - size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(url); - OwnArrayPtr<char> urlArr = adoptArrayPtr(new char[urlArrSize]); - JSStringGetUTF8CString(url, urlArr.get(), urlArrSize); - - WebCore::KURL base = mainFrame->loader()->documentLoader()->response().url(); - WebCore::KURL absolute(base, urlArr.get()); - - JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absolute.string().utf8().data())); - WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target)); -} - -void TestRunner::setAcceptsEditing(bool acceptsEditing) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->setAcceptsEditing(acceptsEditing); -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long quota) -{ - UNUSED_PARAM(quota); - notImplemented(); -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool enable) -{ - mainFrame->page()->settings()->setAuthorAndUserStylesEnabled(enable); -} - -void TestRunner::setCacheModel(int) -{ - notImplemented(); -} - -void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->setCustomPolicyDelegate(setDelegate, permissive); -} - -void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString*) -{ - // FIXME: Implement to support deleting all application caches for an origin. - notImplemented(); -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef) -{ - // FIXME: Implement to support getting disk usage in bytes for an origin. - notImplemented(); - return 0; -} - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - // FIXME: Implement to get origins that contain application caches. - notImplemented(); - return JSValueMakeUndefined(context); -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - if (!mainFrame) - return; - - WebCore::DatabaseTracker::tracker().setQuota(mainFrame->document()->securityOrigin(), quota); -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) -{ - WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, jsStringRefToWebCoreString(scheme)); -} - -void TestRunner::setIconDatabaseEnabled(bool iconDatabaseEnabled) -{ - UNUSED_PARAM(iconDatabaseEnabled); - notImplemented(); -} - -void TestRunner::setMainFrameIsFirstResponder(bool flag) -{ - UNUSED_PARAM(flag); - notImplemented(); -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path) -{ - UNUSED_PARAM(path); - notImplemented(); -} - -void TestRunner::setPopupBlockingEnabled(bool flag) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setJavaScriptOpenWindowsAutomatically(!flag); -} - -void TestRunner::setPrivateBrowsingEnabled(bool flag) -{ - UNUSED_PARAM(flag); - notImplemented(); -} - -void TestRunner::setXSSAuditorEnabled(bool flag) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setXSSAuditorEnabled(flag); -} - -void TestRunner::setTabKeyCyclesThroughElements(bool cycles) -{ - if (!mainFrame) - return; - - mainFrame->page()->setTabKeyCyclesThroughElements(cycles); -} - -void TestRunner::setUseDashboardCompatibilityMode(bool flag) -{ - UNUSED_PARAM(flag); - notImplemented(); -} - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ - UNUSED_PARAM(flag); - notImplemented(); -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef path) -{ - String pathStr = jsStringRefToWebCoreString(path); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setUserStyleSheetLocation(pathStr); -} - -void TestRunner::waitForPolicyDelegate() -{ - setCustomPolicyDelegate(true, true); - setWaitToDump(true); - waitForPolicy = true; -} - -size_t TestRunner::webHistoryItemCount() -{ - SharedArray<BlackBerry::WebKit::WebPage::BackForwardEntry> backForwardList; - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->getBackForwardList(backForwardList); - return backForwardList.length(); -} - -int TestRunner::windowCount() -{ - notImplemented(); - return 0; -} - -void TestRunner::setWaitToDump(bool waitToDump) -{ - // Change from 30s to 35s because some test cases in multipart need 30 seconds, - // refer to http/tests/multipart/resources/multipart-wait-before-boundary.php please. - static const double kWaitToDumpWatchdogInterval = 35.0; - m_waitToDump = waitToDump; - if (m_waitToDump) - BlackBerry::WebKit::DumpRenderTree::currentInstance()->setWaitToDumpWatchdog(kWaitToDumpWatchdogInterval); -} - -void TestRunner::setWindowIsKey(bool windowIsKey) -{ - m_windowIsKey = windowIsKey; - notImplemented(); -} - -void TestRunner::removeAllVisitedLinks() -{ - notImplemented(); -} - -void TestRunner::overridePreference(JSStringRef key, JSStringRef value) -{ - if (!mainFrame) - return; - - String keyStr = jsStringRefToWebCoreString(key); - String valueStr = jsStringRefToWebCoreString(value); - - if (keyStr == "WebKitUsesPageCachePreferenceKey") - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setMaximumPagesInCache(1); - else if (keyStr == "WebKitUsePreHTML5ParserQuirks") - mainFrame->page()->settings()->setUsePreHTML5ParserQuirks(true); - else if (keyStr == "WebKitTabToLinksPreferenceKey") - DumpRenderTreeSupport::setLinksIncludedInFocusChain(valueStr == "true" || valueStr == "1"); - else if (keyStr == "WebKitHyperlinkAuditingEnabled") - mainFrame->page()->settings()->setHyperlinkAuditingEnabled(valueStr == "true" || valueStr == "1"); - 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) -{ - UNUSED_PARAM(alwaysAcceptCookies); - notImplemented(); -} - -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, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); -} - -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) -{ - String messageStr = jsStringRefToWebCoreString(message); - DumpRenderTreeSupport::setMockGeolocationPositionUnavailableError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), messageStr); -} - -void TestRunner::showWebInspector() -{ - notImplemented(); -} - -void TestRunner::closeWebInspector() -{ - notImplemented(); -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - UNUSED_PARAM(callId); - UNUSED_PARAM(script); - notImplemented(); -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - UNUSED_PARAM(worldID); - UNUSED_PARAM(globalObject); - UNUSED_PARAM(script); - notImplemented(); -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - UNUSED_PARAM(worldID); - UNUSED_PARAM(globalObject); - UNUSED_PARAM(script); - notImplemented(); -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - UNUSED_PARAM(source); - UNUSED_PARAM(runAtStart); - UNUSED_PARAM(allFrames); - notImplemented(); -} - -void TestRunner::addUserStyleSheet(JSStringRef, bool) -{ - notImplemented(); -} - -void TestRunner::setScrollbarPolicy(JSStringRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::setWebViewEditable(bool) -{ - notImplemented(); -} - -void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ - notImplemented(); -} - -bool TestRunner::callShouldCloseOnWebView() -{ - notImplemented(); - return false; -} - -void TestRunner::setSpatialNavigationEnabled(bool) -{ - notImplemented(); -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - WebCore::SecurityPolicy::addOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)), - jsStringRefToWebCoreString(destinationProtocol), - jsStringRefToWebCoreString(destinationHost), - allowDestinationSubdomains); -} - -void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)), - jsStringRefToWebCoreString(destinationProtocol), - jsStringRefToWebCoreString(destinationHost), - allowDestinationSubdomains); -} - -void TestRunner::setAllowFileAccessFromFileURLs(bool enabled) -{ - if (!mainFrame) - return; - - mainFrame->page()->settings()->setAllowFileAccessFromFileURLs(enabled); -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) -{ - if (!mainFrame) - return; - - mainFrame->page()->settings()->setAllowUniversalAccessFromFileURLs(enabled); -} - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - notImplemented(); -} - -void TestRunner::setJavaScriptCanAccessClipboard(bool flag) -{ - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->setJavaScriptCanAccessClipboard(flag); -} - -void TestRunner::setPluginsEnabled(bool) -{ - notImplemented(); -} - -void TestRunner::abortModal() -{ - notImplemented(); -} - -void TestRunner::clearAllApplicationCaches() -{ - notImplemented(); -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long) -{ - notImplemented(); -} - -void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) -{ - DumpRenderTreeSupport::setMockDeviceOrientation(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); -} - -void TestRunner::addMockSpeechInputResult(JSStringRef, double, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::setGeolocationPermission(bool allow) -{ - setGeolocationPermissionCommon(allow); - DumpRenderTreeSupport::setMockGeolocationPermission(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), allow); -} - -void TestRunner::setViewModeMediaFeature(const JSStringRef) -{ - notImplemented(); -} - -void TestRunner::setSerializeHTTPLoads(bool) -{ - // FIXME: Implement if needed for https://bugs.webkit.org/show_bug.cgi?id=50758. - notImplemented(); -} - -void TestRunner::setTextDirection(JSStringRef) -{ - notImplemented(); -} - -void TestRunner::goBack() -{ - // FIXME: implement to enable loader/navigation-while-deferring-loads.html - notImplemented(); -} - -void TestRunner::setDefersLoading(bool) -{ - // FIXME: implement to enable loader/navigation-while-deferring-loads.html - notImplemented(); -} - -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -void TestRunner::observeStorageTrackerNotifications(unsigned) -{ - notImplemented(); -} - -void TestRunner::syncLocalStorage() -{ - notImplemented(); -} - -void TestRunner::deleteAllLocalStorage() -{ - notImplemented(); -} - -int TestRunner::numberOfPendingGeolocationPermissionRequests() -{ - return DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()); -} - -bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) -{ - WebCore::FindOptions options = 0; - - String nameStr = jsStringRefToWebCoreString(target); - - JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); - size_t length = 0; - if (optionsArray) { - JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); - if (!JSValueIsNumber(context, lengthValue)) - return false; - length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); - } - - for (size_t i = 0; i < length; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0); - if (!JSValueIsString(context, value)) - continue; - - JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0)); - - if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive")) - options |= WebCore::CaseInsensitive; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) - options |= WebCore::AtWordStarts; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) - options |= WebCore::TreatMedialCapitalAsWordStart; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) - options |= WebCore::Backwards; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) - options |= WebCore::WrapAround; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) - options |= WebCore::StartInSelection; - } - - // FIXME: we don't need to call WebPage::findNextString(), this is a workaround - // so that test platform/blackberry/editing/text-iterator/findString-markers.html can pass. - - // 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 */, false /* selectActiveMatchOnClear */); - - return mainFrame->page()->findString(nameStr, options); -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef) -{ - // FIXME: Implement. -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) -{ - JSC::ExecState* exec = toJS(context); - WebCore::Element* element = toElement(toJS(exec, nodeObject)); - if (!element) - return; - WebCore::HTMLInputElement* inputElement = element->toInputElement(); - if (!inputElement) - return; - - inputElement->setValueForUser(jsStringRefToWebCoreString(value)); -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef) -{ - // FIXME: Implement to support getting disk usage by all application caches for an origin. - return 0; -} - -void TestRunner::addChromeInputField() -{ -} - -void TestRunner::removeChromeInputField() -{ -} - -void TestRunner::focusWebView() -{ -} - -void TestRunner::setBackingScaleFactor(double) -{ -} - -void TestRunner::setMockSpeechInputDumpRect(bool) -{ -} - -void TestRunner::grantWebNotificationPermission(JSStringRef) -{ -} - -void TestRunner::denyWebNotificationPermission(JSStringRef) -{ -} - -void TestRunner::removeAllWebNotificationPermissions() -{ -} - -void TestRunner::simulateWebNotificationClick(JSValueRef) -{ -} - -void TestRunner::simulateLegacyWebNotificationClick(JSStringRef) -{ -} - -void TestRunner::resetPageVisibility() -{ - notImplemented(); -} - -void TestRunner::setPageVisibility(const char*) -{ - notImplemented(); -} - -void TestRunner::setAutomaticLinkDetectionEnabled(bool) -{ - notImplemented(); -} - -void TestRunner::setStorageDatabaseIdleInterval(double) -{ - // FIXME: Implement this. - notImplemented(); -} - -void TestRunner::closeIdleLocalStorageDatabases() -{ - notImplemented(); -} diff --git a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp deleted file mode 100644 index 827b5ebce..000000000 --- a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "WorkQueueItem.h" - -#include "DumpRenderTreeBlackBerry.h" -#include "Frame.h" -#include "FrameLoadRequest.h" -#include "KURL.h" -#include "WebPage.h" -#include <wtf/OwnArrayPtr.h> - -using namespace WebCore; - -bool LoadItem::invoke() const -{ - size_t targetArrSize = JSStringGetMaximumUTF8CStringSize(m_target.get()); - size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(m_url.get()); - OwnArrayPtr<char> target = adoptArrayPtr(new char[targetArrSize]); - OwnArrayPtr<char> url = adoptArrayPtr(new char[urlArrSize]); - size_t targetLen = JSStringGetUTF8CString(m_target.get(), target.get(), targetArrSize) - 1; - JSStringGetUTF8CString(m_url.get(), url.get(), urlArrSize); - - Frame* frame; - if (target && targetLen) - frame = mainFrame->tree()->find(target.get()); - else - frame = mainFrame; - - if (!frame) - return false; - - KURL kurl = KURL(KURL(), url.get()); - frame->loader()->load(FrameLoadRequest(frame, ResourceRequest(kurl))); - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - size_t contentSize = JSStringGetMaximumUTF8CStringSize(m_content.get()); - size_t baseURLSize = JSStringGetMaximumUTF8CStringSize(m_baseURL.get()); - size_t unreachableURLSize = JSStringGetMaximumUTF8CStringSize(m_unreachableURL.get()); - OwnArrayPtr<char> content = adoptArrayPtr(new char[contentSize]); - OwnArrayPtr<char> baseURL = adoptArrayPtr(new char[baseURLSize]); - OwnArrayPtr<char> unreachableURL = adoptArrayPtr(new char[unreachableURLSize]); - JSStringGetUTF8CString(m_content.get(), content.get(), contentSize); - JSStringGetUTF8CString(m_baseURL.get(), baseURL.get(), baseURLSize); - JSStringGetUTF8CString(m_unreachableURL.get(), unreachableURL.get(), unreachableURLSize); - 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; -} - -bool ReloadItem::invoke() const -{ - mainFrame->loader()->reload(true); - return true; -} - -bool ScriptItem::invoke() const -{ - BlackBerry::WebKit::JavaScriptDataType type; - BlackBerry::Platform::String result; - size_t scriptArrSize = JSStringGetMaximumUTF8CStringSize(m_script.get()); - OwnArrayPtr<char> script = adoptArrayPtr(new char[scriptArrSize]); - JSStringGetUTF8CString(m_script.get(), script.get(), scriptArrSize); - BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(BlackBerry::Platform::String::fromRawData(script.get(), scriptArrSize), type, result); - return true; -} - -bool BackForwardItem::invoke() const -{ - return BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->goBackOrForward(m_howFar); -} - diff --git a/Tools/DumpRenderTree/blackberry/build b/Tools/DumpRenderTree/blackberry/build deleted file mode 100755 index fb8dce473..000000000 --- a/Tools/DumpRenderTree/blackberry/build +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# This file builds the ImageDiff executable, to run -# on the host machine. - -which qmake-qt4 > /dev/null -if [ $? -eq 0 ] ; then - qmake-qt4 -else - qmake -fi -make diff --git a/Tools/DumpRenderTree/blackberry/src.pro b/Tools/DumpRenderTree/blackberry/src.pro deleted file mode 100644 index 10967958e..000000000 --- a/Tools/DumpRenderTree/blackberry/src.pro +++ /dev/null @@ -1,16 +0,0 @@ -lessThan(QT_VERSION, 4.5) { - error("Qt 4.5 or greater is required.") -} - -TEMPLATE = app -TARGET = ImageDiff - -SOURCES += ../qt/ImageDiff.cpp -DESTDIR = . - -unix:CONFIG += debug_and_release -mac:CONFIG -= app_bundle -win32: CONFIG += console - -QT = core gui - diff --git a/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp b/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp deleted file mode 100644 index c10a3a7dc..000000000 --- a/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * (C) 2009 Brent Fulgham <bfulgham@webkit.org> - * (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 "config.h" -#include "PixelDumpSupportCairo.h" - -#include "DumpRenderTree.h" -#include "PixelDumpSupport.h" -#include <algorithm> -#include <ctype.h> -#include <wtf/Assertions.h> -#include <wtf/MD5.h> -#include <wtf/RefPtr.h> -#include <wtf/StringExtras.h> - -using namespace std; - -static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) -{ - Vector<unsigned char>* in = reinterpret_cast<Vector<unsigned char>*>(closure); - in->append(data, length); - return CAIRO_STATUS_SUCCESS; -} - -static void printPNG(cairo_surface_t* image, const char* checksum) -{ - Vector<unsigned char> pixelData; - // Only PNG output is supported for now. - cairo_surface_write_to_png_stream(image, writeFunction, &pixelData); - - const size_t dataLength = pixelData.size(); - const unsigned char* data = pixelData.data(); - - printPNG(data, dataLength, checksum); -} - -void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33]) -{ - cairo_t* bitmapContext = context->cairoContext(); - cairo_surface_t* surface = cairo_get_target(bitmapContext); - - ASSERT(cairo_image_surface_get_format(surface) == CAIRO_FORMAT_ARGB32); // ImageDiff assumes 32 bit RGBA, we must as well. - - size_t pixelsHigh = cairo_image_surface_get_height(surface); - size_t pixelsWide = cairo_image_surface_get_width(surface); - size_t bytesPerRow = cairo_image_surface_get_stride(surface); - - MD5 md5Context; - unsigned char* bitmapData = static_cast<unsigned char*>(cairo_image_surface_get_data(surface)); - for (unsigned row = 0; row < pixelsHigh; row++) { - md5Context.addBytes(bitmapData, 4 * pixelsWide); - bitmapData += bytesPerRow; - } - Vector<uint8_t, 16> hash; - md5Context.checksum(hash); - - snprintf(hashString, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], - hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); -} - -void dumpBitmap(BitmapContext* context, const char* checksum) -{ - cairo_surface_t* surface = cairo_get_target(context->cairoContext()); - printPNG(surface, checksum); -} diff --git a/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.h b/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.h deleted file mode 100644 index 071e874d0..000000000 --- a/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * (C) 2009 Brent Fulgham <bfulgham@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. - */ - -#ifndef PixelDumpSupportCairo_h -#define PixelDumpSupportCairo_h - -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -#if PLATFORM(WIN) -#include <windows.h> -#include <cairo-win32.h> -#elif PLATFORM(GTK) || PLATFORM(EFL) -#include <cairo.h> -#endif - -#if PLATFORM(WIN) -typedef HBITMAP PlatformBitmapBuffer; -#else -typedef void* PlatformBitmapBuffer; -#endif - -class BitmapContext : public RefCounted<BitmapContext> { -public: - static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(PlatformBitmapBuffer buffer, cairo_t* context) - { - return adoptRef(new BitmapContext(buffer, context)); - } - - ~BitmapContext() - { - if (m_buffer) -#if PLATFORM(WIN) - DeleteObject(m_buffer); -#else - free(m_buffer); -#endif - cairo_destroy(m_context); - } - - cairo_t* cairoContext() const { return m_context; } - -private: - - BitmapContext(PlatformBitmapBuffer buffer, cairo_t* context) - : m_buffer(buffer) - , m_context(context) - { - } - - PlatformBitmapBuffer m_buffer; - cairo_t* m_context; -}; - -#endif // PixelDumpSupportCairo_h diff --git a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp deleted file mode 100644 index 43936d65d..000000000 --- a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009, 2010 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 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 "WebArchiveDumpSupport.h" - -#include <CFNetwork/CFNetwork.h> -#include <CoreFoundation/CoreFoundation.h> -#include <wtf/RetainPtr.h> - -extern "C" { - -CFURLRef CFURLResponseGetURL(CFURLResponseRef); -CFStringRef CFURLResponseGetMIMEType(CFURLResponseRef); -CFStringRef CFURLResponseGetTextEncodingName(CFURLResponseRef); -SInt64 CFURLResponseGetExpectedContentLength(CFURLResponseRef); -CFHTTPMessageRef CFURLResponseGetHTTPResponse(CFURLResponseRef); - -CFTypeID CFURLResponseGetTypeID(void); - -} - -static void convertMIMEType(CFMutableStringRef mimeType) -{ - // Workaround for <rdar://problem/6234318> with Dashcode 2.0 - if (CFStringCompare(mimeType, CFSTR("application/x-javascript"), kCFCompareAnchored | kCFCompareCaseInsensitive) == kCFCompareEqualTo) - CFStringReplaceAll(mimeType, CFSTR("text/javascript")); -} - -static void convertWebResourceDataToString(CFMutableDictionaryRef resource) -{ - CFMutableStringRef mimeType = (CFMutableStringRef)CFDictionaryGetValue(resource, CFSTR("WebResourceMIMEType")); - CFStringLowercase(mimeType, CFLocaleGetSystem()); - convertMIMEType(mimeType); - - CFArrayRef supportedMIMETypes = supportedNonImageMIMETypes(); - if (CFStringHasPrefix(mimeType, CFSTR("text/")) || CFArrayContainsValue(supportedMIMETypes, CFRangeMake(0, CFArrayGetCount(supportedMIMETypes)), mimeType)) { - CFStringRef textEncodingName = static_cast<CFStringRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceTextEncodingName"))); - CFStringEncoding stringEncoding; - if (textEncodingName && CFStringGetLength(textEncodingName)) - stringEncoding = CFStringConvertIANACharSetNameToEncoding(textEncodingName); - else - stringEncoding = kCFStringEncodingUTF8; - - CFDataRef data = static_cast<CFDataRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceData"))); - RetainPtr<CFStringRef> dataAsString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding)); - if (dataAsString) - CFDictionarySetValue(resource, CFSTR("WebResourceData"), dataAsString.get()); - } -} - -static void normalizeHTTPResponseHeaderFields(CFMutableDictionaryRef fields) -{ - // Normalize headers - if (CFDictionaryContainsKey(fields, CFSTR("Date"))) - CFDictionarySetValue(fields, CFSTR("Date"), CFSTR("Sun, 16 Nov 2008 17:00:00 GMT")); - if (CFDictionaryContainsKey(fields, CFSTR("Last-Modified"))) - CFDictionarySetValue(fields, CFSTR("Last-Modified"), CFSTR("Sun, 16 Nov 2008 16:55:00 GMT")); - if (CFDictionaryContainsKey(fields, CFSTR("Etag"))) - CFDictionarySetValue(fields, CFSTR("Etag"), CFSTR("\"301925-21-45c7d72d3e780\"")); - if (CFDictionaryContainsKey(fields, CFSTR("Server"))) - CFDictionarySetValue(fields, CFSTR("Server"), CFSTR("Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6")); - - // Remove headers - CFDictionaryRemoveValue(fields, CFSTR("Connection")); - CFDictionaryRemoveValue(fields, CFSTR("Keep-Alive")); -} - -static void normalizeWebResourceURL(CFMutableStringRef webResourceURL) -{ - static CFIndex fileUrlLength = CFStringGetLength(CFSTR("file://")); - CFRange layoutTestsWebArchivePathRange = CFStringFind(webResourceURL, CFSTR("/LayoutTests/"), kCFCompareBackwards); - if (layoutTestsWebArchivePathRange.location == kCFNotFound) - return; - CFRange currentWorkingDirectoryRange = CFRangeMake(fileUrlLength, layoutTestsWebArchivePathRange.location - fileUrlLength); - CFStringReplace(webResourceURL, currentWorkingDirectoryRange, CFSTR("")); -} - -static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef propertyList) -{ - CFDataRef responseData = static_cast<CFDataRef>(CFDictionaryGetValue(propertyList, CFSTR("WebResourceResponse"))); // WebResourceResponseKey in WebResource.m - if (CFGetTypeID(responseData) != CFDataGetTypeID()) - return; - - RetainPtr<CFURLResponseRef> response = adoptCF(createCFURLResponseFromResponseData(responseData)); - if (!response) - return; - - RetainPtr<CFMutableDictionaryRef> responseDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - - 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()))); - convertMIMEType(mimeTypeString.get()); - CFDictionarySetValue(responseDictionary.get(), CFSTR("MIMEType"), mimeTypeString.get()); - - CFStringRef textEncodingName = CFURLResponseGetTextEncodingName(response.get()); - if (textEncodingName) - CFDictionarySetValue(responseDictionary.get(), CFSTR("textEncodingName"), textEncodingName); - - SInt64 expectedContentLength = CFURLResponseGetExpectedContentLength(response.get()); - 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())); - normalizeHTTPResponseHeaderFields(allHeaderFields.get()); - CFDictionarySetValue(responseDictionary.get(), CFSTR("allHeaderFields"), allHeaderFields.get()); - - CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(httpMessage); - RetainPtr<CFNumberRef> statusCodeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode)); - CFDictionarySetValue(responseDictionary.get(), CFSTR("statusCode"), statusCodeNumber.get()); - } - - CFDictionarySetValue(propertyList, CFSTR("WebResourceResponse"), responseDictionary.get()); -} - -static CFComparisonResult compareResourceURLs(const void *val1, const void *val2, void *context) -{ - 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); -} - -CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData) -{ - CFErrorRef error = 0; - CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; - RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error)); - - if (!propertyList) { - if (error) - return CFErrorCopyDescription(error); - return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting data to property list."))); - } - - RetainPtr<CFMutableArrayRef> resources = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); - CFArrayAppendValue(resources.get(), propertyList.get()); - - while (CFArrayGetCount(resources.get())) { - RetainPtr<CFMutableDictionaryRef> resourcePropertyList = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(resources.get(), 0); - CFArrayRemoveValueAtIndex(resources.get(), 0); - - CFMutableDictionaryRef mainResource = (CFMutableDictionaryRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebMainResource")); - normalizeWebResourceURL((CFMutableStringRef)CFDictionaryGetValue(mainResource, CFSTR("WebResourceURL"))); - convertWebResourceDataToString(mainResource); - - // Add subframeArchives to list for processing - CFMutableArrayRef subframeArchives = (CFMutableArrayRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebSubframeArchives")); // WebSubframeArchivesKey in WebArchive.m - if (subframeArchives) - CFArrayAppendArray(resources.get(), subframeArchives, CFRangeMake(0, CFArrayGetCount(subframeArchives))); - - CFMutableArrayRef subresources = (CFMutableArrayRef)CFDictionaryGetValue(resourcePropertyList.get(), CFSTR("WebSubresources")); // WebSubresourcesKey in WebArchive.m - if (!subresources) - continue; - - CFIndex subresourcesCount = CFArrayGetCount(subresources); - for (CFIndex i = 0; i < subresourcesCount; ++i) { - CFMutableDictionaryRef subresourcePropertyList = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(subresources, i); - normalizeWebResourceURL((CFMutableStringRef)CFDictionaryGetValue(subresourcePropertyList, CFSTR("WebResourceURL"))); - convertWebResourceResponseToDictionary(subresourcePropertyList); - convertWebResourceDataToString(subresourcePropertyList); - } - - // Sort the subresources so they're always in a predictable order for the dump - CFArraySortValues(subresources, CFRangeMake(0, CFArrayGetCount(subresources)), compareResourceURLs, 0); - } - - error = 0; - RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error)); - - if (!xmlData) { - if (error) - return CFErrorCopyDescription(error); - 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())); - - // Replace "Apple Computer" with "Apple" in the DTD declaration. - CFStringFindAndReplace(string.get(), CFSTR("-//Apple Computer//"), CFSTR("-//Apple//"), CFRangeMake(0, CFStringGetLength(string.get())), 0); - - return string.leakRef(); -} diff --git a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.h b/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.h deleted file mode 100644 index 00c58184e..000000000 --- a/Tools/DumpRenderTree/cf/WebArchiveDumpSupport.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009, 2010 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 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 WebArchiveDumpSupport_h -#define WebArchiveDumpSupport_h - -#include <CoreFoundation/CoreFoundation.h> - -typedef struct _CFURLResponse* CFURLResponseRef; - -CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData); - -// MARK: - -// MARK: Platform-specific methods - -CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData); -CFArrayRef supportedNonImageMIMETypes(); - -#endif /* WebArchiveDumpSupport_h */ diff --git a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp b/Tools/DumpRenderTree/cg/ImageDiffCG.cpp deleted file mode 100644 index 900f1ba15..000000000 --- a/Tools/DumpRenderTree/cg/ImageDiffCG.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (C) 2005, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2005 Ben La Monica <ben.lamonica@gmail.com>. 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 THE AUTHOR ``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 AUTHOR 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. - */ - -#if defined(WIN32) || defined(_WIN32) -#define max max -#define min min -#endif - -// FIXME: We need to be able to include these defines from a config.h somewhere. -#define JS_EXPORT_PRIVATE -#define WTF_EXPORT_PRIVATE - -#include <stdio.h> -#include <wtf/Platform.h> -#include <wtf/RetainPtr.h> - -#if PLATFORM(WIN) -#include <winsock2.h> -#include <windows.h> -#include <fcntl.h> -#include <io.h> -#include <wtf/MathExtras.h> -#endif - -#include <CoreGraphics/CGBitmapContext.h> -#include <CoreGraphics/CGImage.h> -#include <ImageIO/CGImageDestination.h> - -#if PLATFORM(MAC) -#include <LaunchServices/UTCoreTypes.h> -#endif - -#ifndef CGFLOAT_DEFINED -#ifdef __LP64__ -typedef double CGFloat; -#else -typedef float CGFloat; -#endif -#define CGFLOAT_DEFINED 1 -#endif - -using namespace std; - -#if PLATFORM(WIN) -static inline float strtof(const char *nptr, char **endptr) -{ - return strtod(nptr, endptr); -} -static const CFStringRef kUTTypePNG = CFSTR("public.png"); -#endif - -static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining) -{ - unsigned char buffer[2048]; - RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining)); - - while (bytesRemaining > 0) { - size_t bytesToRead = min(bytesRemaining, 2048); - size_t bytesRead = fread(buffer, 1, bytesToRead, stdin); - CFDataAppendBytes(data.get(), buffer, static_cast<CFIndex>(bytesRead)); - bytesRemaining -= static_cast<int>(bytesRead); - } - 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) -{ - free((void*)data); -} - -static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImageRef testImage, float& difference) -{ - size_t width = CGImageGetWidth(baseImage); - size_t height = CGImageGetHeight(baseImage); - size_t rowBytes = width * 4; - - // 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)); - 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)); - CGContextDrawImage(context.get(), CGRectMake(0, 0, width, height), testImage); - - // Compare the content of the 2 bitmaps - void* diffBuffer = malloc(width * height); - float count = 0.0f; - float sum = 0.0f; - float maxDistance = 0.0f; - unsigned char* basePixel = (unsigned char*)baseBuffer; - unsigned char* pixel = (unsigned char*)buffer; - unsigned char* diff = (unsigned char*)diffBuffer; - for (size_t y = 0; y < height; ++y) { - for (size_t x = 0; x < width; ++x) { - float red = (pixel[0] - basePixel[0]) / max<float>(255 - basePixel[0], basePixel[0]); - float green = (pixel[1] - basePixel[1]) / max<float>(255 - basePixel[1], basePixel[1]); - float blue = (pixel[2] - basePixel[2]) / max<float>(255 - basePixel[2], basePixel[2]); - float alpha = (pixel[3] - basePixel[3]) / max<float>(255 - basePixel[3], basePixel[3]); - float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0f; - - *diff++ = (unsigned char)(distance * 255.0f); - - if (distance >= 1.0f / 255.0f) { - count += 1.0f; - sum += distance; - if (distance > maxDistance) - maxDistance = distance; - } - - basePixel += 4; - pixel += 4; - } - } - - // 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 - if (count > 0.0f) - difference = 100.0f * sum / (height * width); - else - difference = 0.0f; - - RetainPtr<CGImageRef> diffImage; - // Generate a normalized diff image if there is any difference - if (difference > 0.0f) { - if (maxDistance < 1.0f) { - diff = (unsigned char*)diffBuffer; - for(size_t p = 0; p < height * width; ++p) - diff[p] = diff[p] / maxDistance; - } - - 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)); - } - else - free(diffBuffer); - - // Destroy drawing buffers - if (buffer) - free(buffer); - if (baseBuffer) - free(baseBuffer); - - return diffImage; -} - -static inline bool imageHasAlpha(CGImageRef image) -{ - CGImageAlphaInfo info = CGImageGetAlphaInfo(image); - - return (info >= kCGImageAlphaPremultipliedLast) && (info <= kCGImageAlphaFirst); -} - -int main(int argc, const char* argv[]) -{ -#if PLATFORM(WIN) - _setmode(0, _O_BINARY); - _setmode(1, _O_BINARY); -#endif - - float tolerance = 0.0f; - - for (int i = 1; i < argc; ++i) { - if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tolerance")) { - if (i >= argc - 1) - exit(1); - tolerance = strtof(argv[i + 1], 0); - ++i; - continue; - } - } - - char buffer[2048]; - RetainPtr<CGImageRef> actualImage; - RetainPtr<CGImageRef> 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 && !actualImage) - actualImage = createImageFromStdin(imageSize); - else if (imageSize > 0 && !baselineImage) - baselineImage = createImageFromStdin(imageSize); - else - fputs("Error: image size must be specified.\n", stderr); - } - - if (actualImage && baselineImage) { - RetainPtr<CGImageRef> diffImage; - float difference = 100.0f; - - if ((CGImageGetWidth(actualImage.get()) == CGImageGetWidth(baselineImage.get())) && (CGImageGetHeight(actualImage.get()) == CGImageGetHeight(baselineImage.get())) && (imageHasAlpha(actualImage.get()) == imageHasAlpha(baselineImage.get()))) { - diffImage = createDifferenceImage(actualImage.get(), baselineImage.get(), difference); // difference is passed by reference - if (difference <= tolerance) - difference = 0.0f; - else { - difference = roundf(difference * 100.0f) / 100.0f; - difference = max(difference, 0.01f); // round to 2 decimal places - } - } else { - if (CGImageGetWidth(actualImage.get()) != CGImageGetWidth(baselineImage.get()) || CGImageGetHeight(actualImage.get()) != CGImageGetHeight(baselineImage.get())) - fprintf(stderr, "Error: test and reference images have different sizes. Test image is %lux%lu, reference image is %lux%lu\n", - CGImageGetWidth(actualImage.get()), CGImageGetHeight(actualImage.get()), - CGImageGetWidth(baselineImage.get()), CGImageGetHeight(baselineImage.get())); - else if (imageHasAlpha(actualImage.get()) != imageHasAlpha(baselineImage.get())) - fprintf(stderr, "Error: test and reference images differ in alpha. Test image %s alpha, reference image %s alpha.\n", - imageHasAlpha(actualImage.get()) ? "has" : "does not have", - imageHasAlpha(baselineImage.get()) ? "has" : "does not have"); - } - - if (difference > 0.0f) { - if (diffImage) { - 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())); - fwrite(CFDataGetBytePtr(imageData.get()), 1, CFDataGetLength(imageData.get()), stdout); - } - - fprintf(stdout, "diff: %01.2f%% failed\n", difference); - } else - fprintf(stdout, "diff: %01.2f%% passed\n", difference); - - actualImage = 0; - baselineImage = 0; - } - - fflush(stdout); - } - - return 0; -} diff --git a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp b/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp deleted file mode 100644 index 3168d20a5..000000000 --- a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp +++ /dev/null @@ -1,113 +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 "PixelDumpSupportCG.h" - -#include "DumpRenderTree.h" -#include "PixelDumpSupport.h" -#include <ImageIO/CGImageDestination.h> -#include <algorithm> -#include <ctype.h> -#include <wtf/Assertions.h> -#include <wtf/RefPtr.h> -#include <wtf/RetainPtr.h> -#include <wtf/StringExtras.h> - -#if PLATFORM(WIN) -#include "MD5.h" -#elif PLATFORM(MAC) -#include <LaunchServices/UTCoreTypes.h> -#define COMMON_DIGEST_FOR_OPENSSL -#include <CommonCrypto/CommonDigest.h> -#endif - -using namespace std; - -#if PLATFORM(WIN) -static const CFStringRef kUTTypePNG = CFSTR("public.png"); -#endif - -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)); - CGImageDestinationAddImage(imageDest.get(), image, 0); - CGImageDestinationFinalize(imageDest.get()); - - const UInt8* data = CFDataGetBytePtr(imageData.get()); - CFIndex dataLength = CFDataGetLength(imageData.get()); - - printPNG(static_cast<const unsigned char*>(data), static_cast<size_t>(dataLength), checksum); -} - -void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33]) -{ - CGContextRef bitmapContext = context->cgContext(); - - ASSERT(CGBitmapContextGetBitsPerPixel(bitmapContext) == 32); // ImageDiff assumes 32 bit RGBA, we must as well. - size_t pixelsHigh = CGBitmapContextGetHeight(bitmapContext); - size_t pixelsWide = CGBitmapContextGetWidth(bitmapContext); - size_t bytesPerRow = CGBitmapContextGetBytesPerRow(bitmapContext); - - // We need to swap the bytes to ensure consistent hashes independently of endianness - MD5_CTX md5Context; - MD5_Init(&md5Context); - unsigned char* bitmapData = static_cast<unsigned char*>(CGBitmapContextGetData(bitmapContext)); -#if PLATFORM(MAC) - if ((CGBitmapContextGetBitmapInfo(bitmapContext) & kCGBitmapByteOrderMask) == kCGBitmapByteOrder32Big) { - for (unsigned row = 0; row < pixelsHigh; row++) { - uint32_t buffer[pixelsWide]; - for (unsigned column = 0; column < pixelsWide; column++) - buffer[column] = OSReadLittleInt32(bitmapData, 4 * column); - MD5_Update(&md5Context, buffer, 4 * pixelsWide); - bitmapData += bytesPerRow; - } - } else -#endif - { - for (unsigned row = 0; row < pixelsHigh; row++) { - MD5_Update(&md5Context, bitmapData, 4 * pixelsWide); - bitmapData += bytesPerRow; - } - } - unsigned char hash[16]; - MD5_Final(hash, &md5Context); - - hashString[0] = '\0'; - for (int i = 0; i < 16; i++) - snprintf(hashString, 33, "%s%02x", hashString, hash[i]); -} - -void dumpBitmap(BitmapContext* context, const char* checksum) -{ - 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 deleted file mode 100644 index 353a6b605..000000000 --- a/Tools/DumpRenderTree/cg/PixelDumpSupportCG.h +++ /dev/null @@ -1,84 +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. - */ - -#ifndef PixelDumpSupportCG_h -#define PixelDumpSupportCG_h - -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/RetainPtr.h> - -#if PLATFORM(WIN) -#include <windows.h> -#endif - -typedef struct CGContext* CGContextRef; - -#if PLATFORM(MAC) -typedef void* PlatformBitmapBuffer; -#elif PLATFORM(WIN) -typedef HBITMAP PlatformBitmapBuffer; -#endif - -class BitmapContext : public RefCounted<BitmapContext> { -public: - static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(PlatformBitmapBuffer buffer, CGContextRef context) - { - return adoptRef(new BitmapContext(buffer, context)); - } - - ~BitmapContext() - { - if (m_buffer) -#if PLATFORM(MAC) - free(m_buffer); -#elif PLATFORM(WIN) - DeleteObject(m_buffer); -#endif - } - - CGContextRef cgContext() const { return m_context.get(); } - -private: - - BitmapContext(PlatformBitmapBuffer buffer, CGContextRef context) - : m_buffer(buffer) - , m_context(adoptCF(context)) - { - } - - PlatformBitmapBuffer m_buffer; - RetainPtr<CGContextRef> m_context; - -}; - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect); - -#endif // PixelDumpSupportCG_h diff --git a/Tools/DumpRenderTree/config.h b/Tools/DumpRenderTree/config.h index 05b264ed1..9e0fe4fd4 100644 --- a/Tools/DumpRenderTree/config.h +++ b/Tools/DumpRenderTree/config.h @@ -20,16 +20,11 @@ #define Config_H -#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H -#if defined(BUILDING_WITH_CMAKE) +#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H && defined(BUILDING_WITH_CMAKE) #include "cmakeconfig.h" -#else -#include "autotoolsconfig.h" -#endif #endif -#include <wtf/Platform.h> -#include <wtf/ExportMacros.h> +#include <WebCore/PlatformExportMacros.h> #include <runtime/JSExportMacros.h> #ifdef __cplusplus @@ -38,43 +33,26 @@ #include <wtf/FastMalloc.h> #endif -#if PLATFORM(MAC) -#define WTF_USE_CF 1 - -// FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. - -#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0 -#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0 - -#define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED -#define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED -#define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED - -#define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED -#define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED -#define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED - -#endif // PLATFORM(MAC) - -#if OS(WINDOWS) -// If we don't define these, they get defined in windef.h. -// We want to use std::min and std::max -#undef max -#define max max -#undef min -#define min min +#if PLATFORM(COCOA) +#define USE_CF 1 #endif #if PLATFORM(WIN) -#define WTF_USE_CF 1 +#define USE_CF 1 #if PLATFORM(WIN_CAIRO) -#define WTF_USE_CAIRO 1 -#define WTF_USE_CURL 1 +#define USE_CAIRO 1 +#define USE_CURL 1 #else -#define WTF_USE_CG 1 -#define WTF_USE_CFNETWORK 1 +#define USE_CG 1 +#define USE_CFNETWORK 1 #endif +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x601 + +#undef WINVER +#define WINVER 0x0601 + #undef _WINSOCKAPI_ #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h #endif // PLATFORM(WIN) diff --git a/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp b/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp deleted file mode 100644 index 8012da637..000000000 --- a/Tools/DumpRenderTree/efl/AccessibilityControllerEfl.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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/efl/AccessibilityUIElementEfl.cpp b/Tools/DumpRenderTree/efl/AccessibilityUIElementEfl.cpp deleted file mode 100644 index 9e115d9e9..000000000 --- a/Tools/DumpRenderTree/efl/AccessibilityUIElementEfl.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * 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 "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> - -JSStringRef AccessibilityUIElement::helpText() const -{ - if (!m_element) - return JSStringCreateWithCharacters(0, 0); - - ASSERT(ATK_IS_OBJECT(m_element)); - - 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 deleted file mode 100644 index 998019121..000000000 --- a/Tools/DumpRenderTree/efl/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -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 - ${TOOLS_DIR}/DumpRenderTree/efl/DumpRenderTreeView.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/EditingCallbacks.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/EventSender.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/FontManagement.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/GCControllerEfl.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/JSStringUtils.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/TestRunnerEfl.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/PixelDumpSupportEfl.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/TextInputController.cpp - ${TOOLS_DIR}/DumpRenderTree/efl/WorkQueueItemEfl.cpp -) - -set(DumpRenderTree_LIBRARIES - JavaScriptCore - WebCoreTestSupport - WebCore - WebKit - WTF - ${CAIRO_LIBRARIES} - ${ECORE_LIBRARIES} - ${ECORE_EVAS_LIBRARIES} - ${ECORE_FILE_LIBRARIES} - ${ECORE_INPUT_LIBRARIES} - ${EDJE_LIBRARIES} - ${EINA_LIBRARIES} - ${EO_LIBRARIES} - ${EVAS_LIBRARIES} - ${FONTCONFIG_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${LIBXSLT_LIBRARIES} -lm - ${SQLITE_LIBRARIES} - ${GLIB_LIBRARIES} - ${LIBSOUP_LIBRARIES} -) - -set(DumpRenderTree_INCLUDE_DIRECTORIES - "${WEBKIT_DIR}/efl/ewk" - ${WEBKIT_DIR}/efl - ${WEBKIT_DIR}/efl/WebCoreSupport - ${WEBCORE_DIR} - ${WEBCORE_DIR}/bridge - ${WEBCORE_DIR}/bridge/jsc - ${WEBCORE_DIR}/bindings - ${WEBCORE_DIR}/dom - ${WEBCORE_DIR}/editing - ${WEBCORE_DIR}/css - ${WEBCORE_DIR}/html - ${WEBCORE_DIR}/inspector - ${WEBCORE_DIR}/page - ${WEBCORE_DIR}/page/animation - ${WEBCORE_DIR}/platform - ${WEBCORE_DIR}/platform/animation - ${WEBCORE_DIR}/platform/text - ${WEBCORE_DIR}/platform/graphics - ${WEBCORE_DIR}/platform/graphics/cairo - ${WEBCORE_DIR}/platform/graphics/transforms - ${WEBCORE_DIR}/platform/network - ${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 - ${WEBCORE_DIR}/loader/cache - ${WEBCORE_DIR}/loader/icon - ${JAVASCRIPTCORE_DIR} - ${JAVASCRIPTCORE_DIR}/API - ${JAVASCRIPTCORE_DIR}/assembler - ${JAVASCRIPTCORE_DIR}/bytecode - ${JAVASCRIPTCORE_DIR}/dfg - ${JAVASCRIPTCORE_DIR}/disassembler - ${JAVASCRIPTCORE_DIR}/heap - ${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} - ${CMAKE_SOURCE_DIR}/Source - ${CMAKE_BINARY_DIR} - ${DERIVED_SOURCES_WEBCORE_DIR} - ${WEBCORE_DIR}/bindings/js - ${WEBCORE_DIR}/testing/js - ${CAIRO_INCLUDE_DIRS} - ${ECORE_INCLUDE_DIRS} - ${ECORE_INCLUDE_DIRS} - ${ECORE_EVAS_INCLUDE_DIRS} - ${ECORE_FILE_INCLUDE_DIRS} - ${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") - -include_directories(${DumpRenderTree_INCLUDE_DIRECTORIES}) - -add_executable(DumpRenderTree ${DumpRenderTree_SOURCES}) -target_link_libraries(DumpRenderTree ${DumpRenderTree_LIBRARIES}) -set_target_properties(DumpRenderTree PROPERTIES FOLDER "Tools") diff --git a/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp b/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp deleted file mode 100644 index 125b12847..000000000 --- a/Tools/DumpRenderTree/efl/DumpHistoryItem.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - * - * 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 "config.h" -#include "DumpHistoryItem.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "ewk_private.h" -#include <EWebKit.h> -#include <algorithm> -#include <cstdio> -#include <wtf/HashMap.h> -#include <wtf/OwnPtr.h> -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - -Ewk_History_Item* prevTestBFItem = 0; -const unsigned historyItemIndent = 8; - -static bool compareHistoryItemsByTarget(const Ewk_History_Item* item1, const Ewk_History_Item* item2) -{ - return WTF::codePointCompare(DumpRenderTreeSupportEfl::historyItemTarget(item1), - DumpRenderTreeSupportEfl::historyItemTarget(item2)) < 1; -} - -static void dumpHistoryItem(const Ewk_History_Item* item, int indent, bool current) -{ - ASSERT(item); - int start = 0; - if (current) { - printf("curr->"); - start = 6; - } - for (int i = start; i < indent; i++) - putchar(' '); - - // normalize file URLs. - const char* uri = ewk_history_item_uri_get(item); - if (!strncasecmp(uri, "file://", sizeof("file://") - 1)) { - const char* pos = strstr(uri, "/LayoutTests/"); - if (!pos) - return; - - printf("(file test):%s", pos + sizeof("/LayoutTests/") - 1); - } else - printf("%s", uri); - - const String target = DumpRenderTreeSupportEfl::historyItemTarget(item); - if (!target.isEmpty()) - printf(" (in frame \"%s\")", target.utf8().data()); - if (DumpRenderTreeSupportEfl::isTargetItem(item)) - printf(" **nav target**"); - putchar('\n'); - - HistoryItemChildrenVector children = DumpRenderTreeSupportEfl::childHistoryItems(item); - - // Must sort to eliminate arbitrary result ordering which defeats reproducible testing. - std::stable_sort(children.begin(), children.end(), compareHistoryItemsByTarget); - - const size_t size = children.size(); - for (size_t i = 0; i < size; ++i) - dumpHistoryItem(children[i], indent + 4, false); -} - -static void dumpBackForwardListForWebView(Evas_Object* view) -{ - printf("\n============== Back Forward List ==============\n"); - - const Ewk_History* history = ewk_view_history_get(view); - - // Print out all items in the list after prevTestBFItem, which was from the previous test - // Gather items from the end of the list, the print them out from oldest to newest - Eina_List* itemsToPrint = 0; - void* historyItem; - Eina_List* backwardList = ewk_history_back_list_get(history); - EINA_LIST_FREE(backwardList, historyItem) { - if (historyItem == prevTestBFItem) { - eina_list_free(backwardList); - break; - } - itemsToPrint = eina_list_append(itemsToPrint, historyItem); - } - - const Ewk_History_Item* currentItem = ewk_history_history_item_current_get(history); - if (currentItem) - itemsToPrint = eina_list_append(itemsToPrint, currentItem); - - Eina_List* forwardList = ewk_history_forward_list_get(history); - EINA_LIST_FREE(forwardList, historyItem) { - ASSERT(historyItem != prevTestBFItem); - itemsToPrint = eina_list_append(itemsToPrint, historyItem); - } - - EINA_LIST_FREE(itemsToPrint, historyItem) { - dumpHistoryItem(static_cast<Ewk_History_Item*>(historyItem), historyItemIndent, historyItem == currentItem); - ewk_history_item_free(static_cast<Ewk_History_Item*>(historyItem)); - } - - printf("===============================================\n"); -} - -void dumpBackForwardListForWebViews() -{ - // Dump the back forward list of the main WebView first - dumpBackForwardListForWebView(browser->mainView()); - - Vector<Evas_Object*>::const_iterator it = browser->extraViews().begin(); - for (; it != browser->extraViews().end(); ++it) - dumpBackForwardListForWebView(*it); -} diff --git a/Tools/DumpRenderTree/efl/DumpHistoryItem.h b/Tools/DumpRenderTree/efl/DumpHistoryItem.h deleted file mode 100644 index ea8afeaaf..000000000 --- a/Tools/DumpRenderTree/efl/DumpHistoryItem.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - * - * 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. - */ - -#ifndef DumpHistoryItem_h -#define DumpHistoryItem_h - -#include <Evas.h> - -void dumpBackForwardListForWebViews(); - -#endif // DumpHistoryItem_h diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp deleted file mode 100644 index ac85f04ab..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/* - * 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. - * - * 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 "config.h" -#include "DumpRenderTree.h" - -#include "DumpHistoryItem.h" -#include "DumpRenderTreeChrome.h" -#include "DumpRenderTreeView.h" -#include "EventSender.h" -#include "FontManagement.h" -#include "NotImplemented.h" -#include "PixelDumpSupport.h" -#include "TestRunner.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "WebCoreTestSupport.h" -#include "WorkQueue.h" -#include "ewk_private.h" -#include <EWebKit.h> -#include <Ecore.h> -#include <Ecore_Evas.h> -#include <Ecore_File.h> -#include <Edje.h> -#include <Evas.h> -#include <fontconfig/fontconfig.h> -#include <getopt.h> -#include <stdlib.h> -#include <unistd.h> -#include <wtf/Assertions.h> -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> -#include <wtf/text/StringBuilder.h> - -OwnPtr<DumpRenderTreeChrome> browser; -Evas_Object* topLoadingFrame = 0; -bool waitForPolicy = false; -bool policyDelegateEnabled = false; -bool policyDelegatePermissive = false; -Ecore_Timer* waitToDumpWatchdog = 0; -extern Ewk_History_Item* prevTestBFItem; - -// From the top-level DumpRenderTree.h -RefPtr<TestRunner> gTestRunner; -volatile bool done = false; - -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: '"); - result.append(String::fromUTF8(ewk_frame_name_get(frame))); - result.append("'\n--------\n"); - } - - result.append(String::fromUTF8(frameContents)); - result.append("\n"); - eina_stringshare_del(frameContents); - - if (gTestRunner->dumpChildFramesAsText()) { - Eina_List* children = DumpRenderTreeSupportEfl::frameChildren(frame); - void* iterator; - - EINA_LIST_FREE(children, iterator) { - Evas_Object* currentFrame = static_cast<Evas_Object*>(iterator); - String tempText(dumpFramesAsText(currentFrame)); - - if (tempText.isEmpty()) - continue; - - result.append(tempText); - } - } - - return result; -} - -static void dumpFrameScrollPosition(Evas_Object* frame) -{ - int x, y; - ewk_frame_scroll_pos_get(frame, &x, &y); - if (abs(x) > 0 || abs(y) > 0) { - StringBuilder result; - - Evas_Object* parent = evas_object_smart_parent_get(frame); - - // smart parent of main frame is view object. - if (parent != browser->mainView()) { - result.append("frame '"); - result.append(ewk_frame_name_get(frame)); - result.append("' "); - } - - result.append("scrolled to "); - result.append(WTF::String::number(x)); - result.append(","); - result.append(WTF::String::number(y)); - result.append("\n"); - - printf("%s", result.toString().utf8().data()); - } - - if (gTestRunner->dumpChildFrameScrollPositions()) { - Eina_List* children = DumpRenderTreeSupportEfl::frameChildren(frame); - void* iterator; - - EINA_LIST_FREE(children, iterator) { - Evas_Object* currentFrame = static_cast<Evas_Object*>(iterator); - dumpFrameScrollPosition(currentFrame); - } - } -} - -static bool shouldLogFrameLoadDelegates(const String& pathOrURL) -{ - return pathOrURL.contains("loading/"); -} - -static bool shouldDumpAsText(const String& pathOrURL) -{ - return pathOrURL.contains("dumpAsText/"); -} - -static bool shouldOpenWebInspector(const String& pathOrURL) -{ - return pathOrURL.contains("inspector/"); -} - -static void sendPixelResultsEOF() -{ - puts("#EOF"); - fflush(stdout); - fflush(stderr); -} - -bool shouldSetWaitToDumpWatchdog() -{ - return !waitToDumpWatchdog && useTimeoutWatchdog; -} - -static void invalidateAnyPreviousWaitToDumpWatchdog() -{ - if (waitToDumpWatchdog) { - ecore_timer_del(waitToDumpWatchdog); - waitToDumpWatchdog = 0; - } - waitForPolicy = false; -} - -static void onEcoreEvasResize(Ecore_Evas* ecoreEvas) -{ - int width, height; - - ecore_evas_geometry_get(ecoreEvas, 0, 0, &width, &height); - evas_object_move(browser->mainView(), 0, 0); - evas_object_resize(browser->mainView(), width, height); -} - -static void onCloseWindow(Ecore_Evas*) -{ - notImplemented(); -} - -static Eina_Bool useLongRunningServerMode(int argc, char** argv) -{ - return (argc == optind + 1 && !strcmp(argv[optind], "-")); -} - -static bool parseCommandLineOptions(int argc, char** argv) -{ - static const option options[] = { - {"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} - }; - - int option; - while ((option = getopt_long(argc, (char* const*)argv, "", options, 0)) != -1) { - switch (option) { - case '?': - case ':': - return false; - } - } - - return true; -} - -static inline bool isGlobalHistoryTest(const String& cTestPathOrURL) -{ - return cTestPathOrURL.contains("/globalhistory/"); -} - -static void createTestRunner(const String& testURL, const String& expectedPixelHash) -{ - gTestRunner = - TestRunner::create(std::string(testURL.utf8().data()), - std::string(expectedPixelHash.utf8().data())); - - topLoadingFrame = 0; - done = false; - - gTestRunner->setIconDatabaseEnabled(false); - - if (shouldLogFrameLoadDelegates(testURL)) - gTestRunner->setDumpFrameLoadCallbacks(true); - - gTestRunner->setDeveloperExtrasEnabled(true); - if (shouldOpenWebInspector(testURL)) - gTestRunner->showWebInspector(); - - gTestRunner->setDumpHistoryDelegateCallbacks(isGlobalHistoryTest(testURL)); - - if (shouldDumpAsText(testURL)) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } -} - -static String getFinalTestURL(const String& testURL) -{ - if (!testURL.startsWith("http://") && !testURL.startsWith("https://")) { - char* cFilePath = ecore_file_realpath(testURL.utf8().data()); - const String filePath = String::fromUTF8(cFilePath); - free(cFilePath); - - if (ecore_file_exists(filePath.utf8().data())) - return String("file://") + filePath; - } - - return testURL; -} - -static void runTest(const char* inputLine) -{ - TestCommand command = parseInputLine(inputLine); - const String testPathOrURL(command.pathOrURL.c_str()); - ASSERT(!testPathOrURL.isEmpty()); - dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; - const String expectedPixelHash(command.expectedPixelHash.c_str()); - - // Convert the path into a full file URL if it does not look - // like an HTTP/S URL (doesn't start with http:// or https://). - const String testURL = getFinalTestURL(testPathOrURL); - - browser->resetDefaultsToConsistentValues(); - createTestRunner(testURL, expectedPixelHash); - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - const bool isSVGW3CTest = testURL.contains("svg/W3C-SVG-1.1"); - 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) - ewk_history_item_free(prevTestBFItem); - const Ewk_History* history = ewk_view_history_get(browser->mainView()); - prevTestBFItem = ewk_history_history_item_current_get(history); - - evas_object_focus_set(browser->mainView(), EINA_TRUE); - ewk_view_uri_set(browser->mainView(), testURL.utf8().data()); - - ecore_main_loop_begin(); - - gTestRunner->closeWebInspector(); - gTestRunner->setDeveloperExtrasEnabled(false); - - browser->clearExtraViews(); - - // FIXME: Move to DRTChrome::resetDefaultsToConsistentValues() after bug 85209 lands. - WebCoreTestSupport::resetInternalsObject(DumpRenderTreeSupportEfl::globalContextRefForFrame(browser->mainFrame())); - - ewk_view_uri_set(browser->mainView(), "about:blank"); - - gTestRunner.clear(); - sendPixelResultsEOF(); -} - -static void runTestingServerLoop() -{ - char filename[PATH_MAX]; - - while (fgets(filename, sizeof(filename), stdin)) { - char* newLine = strrchr(filename, '\n'); - if (newLine) - *newLine = '\0'; - - if (filename[0] != '\0') - runTest(filename); - } -} - -static void adjustOutputTypeByMimeType(const Evas_Object* frame) -{ - const String responseMimeType(DumpRenderTreeSupportEfl::responseMimeType(frame)); - if (responseMimeType == "text/plain") { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } -} - -static void dumpFrameContentsAsText(Evas_Object* frame) -{ - String result; - if (gTestRunner->dumpAsText()) - result = dumpFramesAsText(frame); - else - result = DumpRenderTreeSupportEfl::renderTreeDump(frame); - - printf("%s", result.utf8().data()); -} - -static bool shouldDumpFrameScrollPosition() -{ - return !gTestRunner->dumpAsText() && !gTestRunner->dumpDOMAsWebArchive() && !gTestRunner->dumpSourceAsWebArchive(); -} - -static bool shouldDumpPixelsAndCompareWithExpected() -{ - return dumpPixelsForCurrentTest && gTestRunner->generatePixelResults() && !gTestRunner->dumpDOMAsWebArchive() && !gTestRunner->dumpSourceAsWebArchive(); -} - -static bool shouldDumpBackForwardList() -{ - return gTestRunner->dumpBackForwardList(); -} - -static bool initEfl() -{ - if (!ecore_evas_init()) - return false; - if (!ecore_file_init()) { - ecore_evas_shutdown(); - return false; - } - if (!edje_init()) { - ecore_file_shutdown(); - ecore_evas_shutdown(); - return false; - } - if (!ewk_init()) { - edje_shutdown(); - ecore_file_shutdown(); - ecore_evas_shutdown(); - return false; - } - - return true; -} - -static void shutdownEfl() -{ - ewk_shutdown(); - edje_shutdown(); - ecore_file_shutdown(); - ecore_evas_shutdown(); -} - -void displayWebView() -{ - DumpRenderTreeSupportEfl::forceLayout(browser->mainFrame()); - DumpRenderTreeSupportEfl::setTracksRepaints(browser->mainFrame(), true); - DumpRenderTreeSupportEfl::resetTrackedRepaints(browser->mainFrame()); -} - -void dump() -{ - Evas_Object* frame = browser->mainFrame(); - - invalidateAnyPreviousWaitToDumpWatchdog(); - - if (dumpTree) { - adjustOutputTypeByMimeType(frame); - dumpFrameContentsAsText(frame); - - if (shouldDumpFrameScrollPosition()) - dumpFrameScrollPosition(frame); - - if (shouldDumpBackForwardList()) - dumpBackForwardListForWebViews(); - - if (printSeparators) { - puts("#EOF"); - fputs("#EOF\n", stderr); - fflush(stdout); - fflush(stderr); - } - } - - if (shouldDumpPixelsAndCompareWithExpected()) - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - - done = true; - ecore_main_loop_quit(); -} - -static Ecore_Evas* initEcoreEvas() -{ - Ecore_Evas* ecoreEvas = 0; -#if defined(WTF_USE_ACCELERATED_COMPOSITING) && defined(HAVE_ECORE_X) - ecoreEvas = ecore_evas_new("opengl_x11", 0, 0, 800, 600, 0); - if (!ecoreEvas) -#endif - ecoreEvas = ecore_evas_new(0, 0, 0, 800, 600, 0); - if (!ecoreEvas) { - shutdownEfl(); - exit(EXIT_FAILURE); - } - - ecore_evas_title_set(ecoreEvas, "EFL DumpRenderTree"); - ecore_evas_callback_resize_set(ecoreEvas, onEcoreEvasResize); - ecore_evas_callback_delete_request_set(ecoreEvas, onCloseWindow); - ecore_evas_show(ecoreEvas); - - return ecoreEvas; -} - -int main(int argc, char** argv) -{ - if (!parseCommandLineOptions(argc, argv)) - return EXIT_FAILURE; - - if (!initEfl()) - return EXIT_FAILURE; - - WTFInstallReportBacktraceOnCrashHook(); - - OwnPtr<Ecore_Evas> ecoreEvas = adoptPtr(initEcoreEvas()); - browser = DumpRenderTreeChrome::create(ecore_evas_get(ecoreEvas.get())); - addFontsToEnvironment(); - - if (useLongRunningServerMode(argc, argv)) { - printSeparators = true; - runTestingServerLoop(); - } else { - printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); - for (int i = optind; i != argc; ++i) - runTest(argv[i]); - } - - ecoreEvas.clear(); - - shutdownEfl(); - return EXIT_SUCCESS; -} diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp deleted file mode 100644 index 5a63384d8..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ /dev/null @@ -1,873 +0,0 @@ -/* - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * Copyright (C) 2012 Intel Corporation - * - * 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 THE COPYRIGHT HOLDERS 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 THE COPYRIGHT - * HOLDERS 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 "DumpRenderTreeChrome.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeView.h" -#include "EditingCallbacks.h" -#include "EventSender.h" -#include "GCController.h" -#include "KURL.h" -#include "NotImplemented.h" -#include "TestRunner.h" -#include "TextInputController.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "WebCoreTestSupport.h" -#include "WorkQueue.h" -#include "ewk_private.h" // FIXME: create some WebCoreSupport/DumpRenderTree.cpp instead - -#include <EWebKit.h> -#include <Ecore.h> -#include <Eina.h> -#include <Evas.h> -#include <cstdio> -#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; - -PassOwnPtr<DumpRenderTreeChrome> DumpRenderTreeChrome::create(Evas* evas) -{ - OwnPtr<DumpRenderTreeChrome> chrome = adoptPtr(new DumpRenderTreeChrome(evas)); - - if (!chrome->initialize()) - return nullptr; - - return chrome.release(); -} - -DumpRenderTreeChrome::DumpRenderTreeChrome(Evas* evas) - : m_mainView(0) - , m_mainFrame(0) - , m_evas(evas) - , m_gcController(adoptPtr(new GCController)) -#if HAVE(ACCESSIBILITY) - , m_axController(adoptPtr(new AccessibilityController)) -#endif -{ -} - -DumpRenderTreeChrome::~DumpRenderTreeChrome() -{ -} - -Evas_Object* DumpRenderTreeChrome::createNewWindow() -{ - Evas_Object* newView = createView(); - - ewk_view_setting_scripts_can_open_windows_set(newView, EINA_TRUE); - ewk_view_setting_scripts_can_close_windows_set(newView, EINA_TRUE); - - m_extraViews.append(newView); - - return newView; -} - -Evas_Object* DumpRenderTreeChrome::createView() const -{ - Evas_Object* view = drtViewAdd(m_evas); - if (!view) - return 0; - - 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); - evas_object_smart_callback_add(view, "load,resource,finished", onResourceLoadFinished, 0); - evas_object_smart_callback_add(view, "load,started", onLoadStarted, 0); - evas_object_smart_callback_add(view, "window,object,cleared", onWindowObjectCleared, m_gcController.get()); - evas_object_smart_callback_add(view, "statusbar,text,set", onStatusbarTextSet, 0); - evas_object_smart_callback_add(view, "load,document,finished", onDocumentLoadFinished, 0); - evas_object_smart_callback_add(view, "resource,request,new", onNewResourceRequest, 0); - evas_object_smart_callback_add(view, "resource,request,willsend", onWillSendRequest, 0); - evas_object_smart_callback_add(view, "resource,response,received", onResponseReceived, 0); - evas_object_smart_callback_add(view, "onload,event", onWebViewOnloadEvent, 0); - evas_object_smart_callback_add(view, "mixedcontent,run", onInsecureContentRun, 0); - evas_object_smart_callback_add(view, "mixedcontent,displayed", onInsecureContentDisplayed, 0); - evas_object_smart_callback_add(view, "frame,created", onFrameCreated, 0); - evas_object_smart_callback_add(view, "navigate,with,data", onWebViewNavigatedWithData, 0); - evas_object_smart_callback_add(view, "perform,server,redirect", onWebViewServerRedirect, 0); - evas_object_smart_callback_add(view, "perform,client,redirect", onWebViewClientRedirect, 0); - evas_object_smart_callback_add(view, "populate,visited,links", onWebViewPopulateVisitedLinks, 0); - evas_object_smart_callback_add(view, "inspector,view,create", onInspectorViewCreate, 0); - evas_object_smart_callback_add(view, "inspector,view,close", onInspectorViewClose, 0); - - connectEditingCallbacks(view); - - 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, "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); - evas_object_smart_callback_add(mainFrame, "load,finished", onFrameLoadFinished, 0); - evas_object_smart_callback_add(mainFrame, "load,error", onFrameLoadError, 0); - evas_object_smart_callback_add(mainFrame, "redirect,cancelled", onFrameRedirectCancelled, 0); - evas_object_smart_callback_add(mainFrame, "redirect,load,provisional", onFrameRedirectForProvisionalLoad, 0); - evas_object_smart_callback_add(mainFrame, "redirect,requested", onFrameRedirectRequested, 0); - evas_object_smart_callback_add(mainFrame, "title,changed", onFrameTitleChanged, 0); - evas_object_smart_callback_add(mainFrame, "xss,detected", onDidDetectXSS, 0); - - return view; -} - -Evas_Object* DumpRenderTreeChrome::createInspectorView() -{ - Evas_Object* inspectorView = drtViewAdd(m_evas); - if (!inspectorView) - return 0; - - // Inspector-related views are not expected to have their output logged. - const bool ignoreMessages = true; - evas_object_data_set(inspectorView, "ignore-console-messages", &ignoreMessages); - - 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::viewWidth, TestRunner::viewHeight); - evas_object_show(inspectorView); - evas_object_focus_set(inspectorView, true); - - return inspectorView; -} - -void DumpRenderTreeChrome::removeInspectorView() -{ - Evas_Object* inspectorView = ewk_view_inspector_view_get(mainView()); - if (!inspectorView) - return; - - Evas_Object* mainFrame = ewk_view_frame_main_get(inspectorView); - evas_object_smart_callback_del(mainFrame, "load,finished", onInspectorFrameLoadFinished); - - evas_object_del(inspectorView); - ewk_view_inspector_view_set(mainView(), 0); -} - -void DumpRenderTreeChrome::waitInspectorLoadFinished() -{ - // Waits until the page has finished loading. - // Because it can't complete loading inspector.html before loading testURL. - Evas_Object* inspectorView = ewk_view_inspector_view_get(mainView()); - if (inspectorView) - ecore_main_loop_begin(); -} - -void DumpRenderTreeChrome::removeWindow(Evas_Object* view) -{ - const size_t pos = m_extraViews.find(view); - - if (pos == notFound) - return; - - m_extraViews.remove(pos); - evas_object_del(view); -} - -bool DumpRenderTreeChrome::initialize() -{ - // Notifies that DRT is running for ewkView to create testable objects. - DumpRenderTreeSupportEfl::setDumpRenderTreeModeEnabled(true); - DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(true); - - m_mainView = createView(); - if (!m_mainView) - return false; - - 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, 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); - - m_mainFrame = ewk_view_frame_main_get(m_mainView); - - return true; -} - -const Vector<Evas_Object*>& DumpRenderTreeChrome::extraViews() const -{ - return m_extraViews; -} - -void DumpRenderTreeChrome::clearExtraViews() -{ - Vector<Evas_Object*>::iterator it = m_extraViews.begin(); - for (; it != m_extraViews.end(); ++it) - evas_object_del(*it); - m_extraViews.clear(); -} - -Evas_Object* DumpRenderTreeChrome::mainFrame() const -{ - return m_mainFrame; -} - -Evas_Object* DumpRenderTreeChrome::mainView() const -{ - return m_mainView; -} - -void DumpRenderTreeChrome::resetDefaultsToConsistentValues() -{ - ewk_settings_icon_database_clear(); - ewk_settings_icon_database_path_set(0); - - ewk_web_database_remove_all(); - ewk_settings_web_database_default_quota_set(5 * 1024 * 1024); - - ewk_settings_memory_cache_clear(); - ewk_settings_application_cache_clear(); - ewk_settings_shadow_dom_enable_set(EINA_TRUE); - - ewk_view_setting_private_browsing_set(mainView(), EINA_FALSE); - ewk_view_setting_spatial_navigation_set(mainView(), EINA_FALSE); - ewk_view_setting_enable_frame_flattening_set(mainView(), EINA_FALSE); - ewk_view_setting_application_cache_set(mainView(), EINA_TRUE); - ewk_view_setting_enable_scripts_set(mainView(), EINA_TRUE); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_STANDARD, "Times"); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_MONOSPACE, "Courier"); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_SERIF, "Times"); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_SANS_SERIF, "Helvetica"); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_CURSIVE, "cursive"); - ewk_view_font_family_name_set(mainView(), EWK_FONT_FAMILY_FANTASY, "fantasy"); - ewk_view_setting_font_default_size_set(mainView(), 16); - ewk_view_setting_font_monospace_size_set(mainView(), 13); - ewk_view_setting_font_minimum_size_set(mainView(), 0); - ewk_view_setting_caret_browsing_set(mainView(), EINA_FALSE); - ewk_view_setting_page_cache_set(mainView(), EINA_FALSE); - ewk_view_setting_enable_auto_resize_window_set(mainView(), EINA_TRUE); - ewk_view_setting_enable_plugins_set(mainView(), EINA_TRUE); - ewk_view_setting_scripts_can_open_windows_set(mainView(), EINA_TRUE); - ewk_view_setting_scripts_can_close_windows_set(mainView(), EINA_TRUE); - 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_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_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); - - ewk_view_zoom_set(mainView(), 1.0, 0, 0); - ewk_view_scale_set(mainView(), 1.0, 0, 0); - ewk_view_text_zoom_set(mainView(), 1.0); - ewk_view_visibility_state_set(mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, true); - ewk_view_text_direction_set(mainView(), EWK_TEXT_DIRECTION_DEFAULT); - - ewk_history_clear(ewk_view_history_get(mainView())); - - ewk_frame_feed_focus_in(mainFrame()); - - ewk_cookies_clear(); - ewk_cookies_policy_set(EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); - - ewk_security_policy_whitelist_origin_reset(); - -#if HAVE(ACCESSIBILITY) - browser->accessibilityController()->resetToConsistentState(); -#endif - - DumpRenderTreeSupportEfl::clearFrameName(mainFrame()); - DumpRenderTreeSupportEfl::clearOpener(mainFrame()); - DumpRenderTreeSupportEfl::clearUserScripts(mainView()); - DumpRenderTreeSupportEfl::clearUserStyleSheets(mainView()); - DumpRenderTreeSupportEfl::resetGeolocationClientMock(mainView()); - DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled(mainView(), true); - DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(mainView(), -1); - DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(mainView(), true); - DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(mainView(), false); - DumpRenderTreeSupportEfl::setDefersLoading(mainView(), false); - DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(mainView(), false); - DumpRenderTreeSupportEfl::setSerializeHTTPLoads(false); - DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(mainView(), 9); - 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; - ewk_settings_object_cache_capacity_set(0, cacheTotalCapacity, cacheTotalCapacity); - DumpRenderTreeSupportEfl::setDeadDecodedDataDeletionInterval(0); - ewk_settings_page_cache_capacity_set(3); - - policyDelegateEnabled = false; - policyDelegatePermissive = false; -} - -static CString pathSuitableForTestResult(const char* uriString) -{ - if (!uriString) - return CString(); - - KURL uri = KURL(ParsedURLString, uriString); - - if (!uri.isLocalFile()) - return uri.string().utf8(); - - String pathString = uri.path(); - size_t indexBaseName = pathString.reverseFind('/'); - String baseName; - if (indexBaseName == notFound) - baseName = pathString; - else - baseName = pathString.substring(indexBaseName + 1); - - String dirName; - if (indexBaseName != notFound) { - size_t indexDirName = pathString.reverseFind('/', indexBaseName - 1); - if (indexDirName != notFound) - dirName = pathString.substring(indexDirName + 1, indexBaseName - indexDirName - 1); - } - - String ret = dirName + "/" + baseName; - return ret.utf8(); -} - -static CString urlSuitableForTestResult(const char* uriString) -{ - KURL uri = KURL(ParsedURLString, uriString); - if (!uri.isLocalFile()) - return CString(uriString); - - unsigned startIndex = uri.pathAfterLastSlash(); - return uri.string().substring(startIndex).utf8(); -} - -static CString descriptionSuitableForTestResult(Ewk_Frame_Resource_Request* request) -{ - StringBuilder builder; - builder.appendLiteral("<NSURLRequest URL "); - builder.append(pathSuitableForTestResult(request->url).data()); - builder.appendLiteral(", main document URL "); - builder.append(urlSuitableForTestResult(request->first_party).data()); - builder.appendLiteral(", http method "); - - if (request->http_method) - builder.append(String(request->http_method)); - else - builder.appendLiteral("(none)"); - - builder.append('>'); - return builder.toString().utf8(); -} - -static CString descriptionSuitableForTestResult(const Ewk_Frame_Resource_Response* response) -{ - if (!response) - return CString("(null)"); - - StringBuilder builder; - builder.appendLiteral("<NSURLResponse "); - builder.append(pathSuitableForTestResult(response->url).data()); - builder.appendLiteral(", http status code "); - builder.append(String::number(response->status_code)); - builder.append('>'); - return builder.toString().utf8(); -} - -static CString descriptionSuitableForTestResult(Ewk_Frame_Load_Error* error) -{ - const char* errorDomain = error->domain; - int errorCode = error->code; - - // We need to do some error mapping here to match - // the test expectations. - if (!strcmp(error->domain, "WebKitNetworkError")) { - errorDomain = "NSURLErrorDomain"; - errorCode = -999; - } - - if (!strcmp(errorDomain, "WebKitPolicyError")) - errorDomain = "WebKitErrorDomain"; - - String ret = makeString("<NSError domain ", errorDomain, ", code ", String::number(errorCode)); - if (error->failing_url && *error->failing_url != '\0') - ret = makeString(ret, ", failing URL \"", error->failing_url, "\""); - ret = makeString(ret, ">"); - - return ret.utf8(); -} - -// Smart Callbacks -// --------------- - -void DumpRenderTreeChrome::onWindowObjectCleared(void* userData, Evas_Object*, void* eventInfo) -{ - Ewk_Window_Object_Cleared_Event* objectClearedInfo = static_cast<Ewk_Window_Object_Cleared_Event*>(eventInfo); - 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); - - gTestRunner->makeWindowObject(objectClearedInfo->context, objectClearedInfo->windowObject, &exception); - ASSERT(!exception); - - gcController->makeWindowObject(objectClearedInfo->context, objectClearedInfo->windowObject, &exception); - ASSERT(!exception); - - JSRetainPtr<JSStringRef> controllerName(Adopt, JSStringCreateWithUTF8CString("eventSender")); - JSObjectSetProperty(objectClearedInfo->context, objectClearedInfo->windowObject, - controllerName.get(), - makeEventSender(objectClearedInfo->context, !DumpRenderTreeSupportEfl::frameParent(objectClearedInfo->frame)), - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - - JSRetainPtr<JSStringRef> textInputControllerName(Adopt, JSStringCreateWithUTF8CString("textInputController")); - JSObjectSetProperty(objectClearedInfo->context, objectClearedInfo->windowObject, - textInputControllerName.get(), - makeTextInputController(objectClearedInfo->context), - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - - WebCoreTestSupport::injectInternalsObject(objectClearedInfo->context); -} - -void DumpRenderTreeChrome::onLoadStarted(void*, Evas_Object* view, void* eventInfo) -{ - Evas_Object* frame = static_cast<Evas_Object*>(eventInfo); - - // Make sure we only set this once per test. If it gets cleared, and then set again, we might - // end up doing two dumps for one test. - if (!topLoadingFrame && !done) - topLoadingFrame = frame; -} - -Eina_Bool DumpRenderTreeChrome::processWork(void*) -{ - if (WorkQueue::shared()->processWork() && !gTestRunner->waitToDump()) - dump(); - - return ECORE_CALLBACK_CANCEL; -} - -void DumpRenderTreeChrome::topLoadingFrameLoadFinished() -{ - topLoadingFrame = 0; - - WorkQueue::shared()->setFrozen(true); - if (gTestRunner->waitToDump()) - return; - - if (WorkQueue::shared()->count()) - ecore_idler_add(processWork, 0 /*frame*/); - else - dump(); -} - -void DumpRenderTreeChrome::onStatusbarTextSet(void*, Evas_Object*, void* eventInfo) -{ - if (!gTestRunner->dumpStatusCallbacks()) - return; - - const char* statusbarText = static_cast<const char*>(eventInfo); - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", statusbarText); -} - -void DumpRenderTreeChrome::onFrameIconChanged(void*, Evas_Object* frame, void*) -{ - if (!done && gTestRunner->dumpIconChanges()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didChangeIcons\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onFrameTitleChanged(void*, Evas_Object* frame, void* eventInfo) -{ - const Ewk_Text_With_Direction* titleText = static_cast<const Ewk_Text_With_Direction*>(eventInfo); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didReceiveTitle: %s\n", frameName.utf8().data(), (titleText && titleText->string) ? titleText->string : ""); - } - - if (!done && gTestRunner->dumpTitleChanges()) - printf("TITLE CHANGED: '%s'\n", (titleText && titleText->string) ? titleText->string : ""); - - if (!done && gTestRunner->dumpHistoryDelegateCallbacks()) - printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", ewk_frame_uri_get(frame) - , (titleText && titleText->string) ? titleText->string : ""); - - gTestRunner->setTitleTextDirection(titleText->direction == EWK_TEXT_DIRECTION_LEFT_TO_RIGHT ? "ltr" : "rtl"); -} - -void DumpRenderTreeChrome::onDocumentLoadFinished(void*, Evas_Object*, void* eventInfo) -{ - const Evas_Object* frame = static_cast<Evas_Object*>(eventInfo); - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFinishDocumentLoadForFrame\n", frameName.utf8().data()); - else if (!done) { - const unsigned pendingFrameUnloadEvents = DumpRenderTreeSupportEfl::pendingUnloadEventCount(frame); - if (pendingFrameUnloadEvents) - printf("%s - has %u onunload handler(s)\n", frameName.utf8().data(), pendingFrameUnloadEvents); - } -} - -void DumpRenderTreeChrome::onWillSendRequest(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Frame_Resource_Messages* messages = static_cast<Ewk_Frame_Resource_Messages*>(eventInfo); - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - printf("%s - willSendRequest %s redirectResponse %s\n", - m_dumpAssignedUrls.contains(messages->request->identifier) ? m_dumpAssignedUrls.get(messages->request->identifier).data() : "<unknown>", - descriptionSuitableForTestResult(messages->request).data(), - descriptionSuitableForTestResult(messages->redirect_response).data()); - - if (!done && gTestRunner->willSendRequestReturnsNull()) { - // As requested by the TestRunner, don't perform the request. - messages->request->url = 0; - return; - } - - if (!done && gTestRunner->willSendRequestReturnsNullOnRedirect() && messages->redirect_response) { - printf("Returning null for this redirect\n"); - messages->request->url = 0; - return; - } - - KURL url = KURL(ParsedURLString, messages->request->url); - - if (url.isValid() - && url.protocolIsInHTTPFamily() - && url.host() != "127.0.0.1" - && url.host() != "255.255.255.255" - && url.host().lower() != "localhost") { - printf("Blocked access to external URL %s\n", messages->request->url); - messages->request->url = 0; - return; - } - - const std::string& destination = gTestRunner->redirectionDestinationForURL(url.string().utf8().data()); - if (destination.length()) - messages->request->url = strdup(destination.c_str()); -} - -void DumpRenderTreeChrome::onWebViewOnloadEvent(void*, Evas_Object*, void* eventInfo) -{ - const Evas_Object* frame = static_cast<Evas_Object*>(eventInfo); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didHandleOnloadEventsForFrame\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onInsecureContentRun(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); -} - -void DumpRenderTreeChrome::onInsecureContentDisplayed(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didDisplayInsecureContent\n"); -} - -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, "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); - evas_object_smart_callback_add(frame, "load,finished", onFrameLoadFinished, 0); - evas_object_smart_callback_add(frame, "load,error", onFrameLoadError, 0); - evas_object_smart_callback_add(frame, "redirect,cancelled", onFrameRedirectCancelled, 0); - evas_object_smart_callback_add(frame, "redirect,load,provisional", onFrameRedirectForProvisionalLoad, 0); - evas_object_smart_callback_add(frame, "redirect,requested", onFrameRedirectRequested, 0); - evas_object_smart_callback_add(frame, "title,changed", onFrameTitleChanged, 0); - evas_object_smart_callback_add(frame, "xss,detected", onDidDetectXSS, 0); -} - -void DumpRenderTreeChrome::onWebViewNavigatedWithData(void*, Evas_Object*, void* eventInfo) -{ - if (done || !gTestRunner->dumpHistoryDelegateCallbacks()) - return; - - ASSERT(eventInfo); - const Ewk_View_Navigation_Data* navigationData = static_cast<Ewk_View_Navigation_Data*>(eventInfo); - - ASSERT(navigationData->request); - ASSERT(navigationData->response); - - const bool wasFailure = navigationData->has_substitute_data || navigationData->response->status_code >= 400; - const bool wasRedirected = navigationData->client_redirect_source && *(navigationData->client_redirect_source); - - printf("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was %s and was %s%s.\n", - navigationData->url, - navigationData->title, - navigationData->request->http_method, - wasFailure? "a failure" : "successful", - (wasRedirected ? "a client redirect from " : "not a client redirect"), - (wasRedirected ? navigationData->client_redirect_source : "")); -} - -void DumpRenderTreeChrome::onWebViewServerRedirect(void*, Evas_Object*, void* eventInfo) -{ - if (done || !gTestRunner->dumpHistoryDelegateCallbacks()) - return; - - ASSERT(eventInfo); - const Ewk_View_Redirection_Data* data = static_cast<Ewk_View_Redirection_Data*>(eventInfo); - printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", data->source_url, data->destination_url); -} - -void DumpRenderTreeChrome::onWebViewClientRedirect(void*, Evas_Object*, void* eventInfo) -{ - if (done || !gTestRunner->dumpHistoryDelegateCallbacks()) - return; - - ASSERT(eventInfo); - const Ewk_View_Redirection_Data* data = static_cast<Ewk_View_Redirection_Data*>(eventInfo); - printf("WebView performed a client redirect from \"%s\" to \"%s\".\n", data->source_url, data->destination_url); -} - -void DumpRenderTreeChrome::onWebViewPopulateVisitedLinks(void*, Evas_Object* ewkView, void*) -{ - if (done || !gTestRunner->dumpHistoryDelegateCallbacks()) - return; - - printf("Asked to populate visited links for WebView \"%s\"\n", ewk_view_uri_get(ewkView)); -} - -void DumpRenderTreeChrome::onInspectorViewCreate(void*, Evas_Object*, void*) -{ - Evas_Object* inspectorView = browser->createInspectorView(); - if (inspectorView) - ewk_view_inspector_view_set(browser->mainView(), inspectorView); -} - -void DumpRenderTreeChrome::onInspectorViewClose(void*, Evas_Object*, void*) -{ - browser->removeInspectorView(); -} - -void DumpRenderTreeChrome::onInspectorFrameLoadFinished(void*, Evas_Object*, void*) -{ - Evas_Object* inspectorView = ewk_view_inspector_view_get(browser->mainView()); - if (inspectorView) - ecore_main_loop_quit(); -} - -void DumpRenderTreeChrome::onFrameProvisionalLoad(void*, Evas_Object* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didStartProvisionalLoadForFrame\n", frameName.utf8().data()); - } - - if (!topLoadingFrame && !done) - topLoadingFrame = frame; - - if (!done && gTestRunner->stopProvisionalFrameLoads()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - stopping load in didStartProvisionalLoadForFrame callback\n", frameName.utf8().data()); - ewk_frame_stop(frame); - } -} - -void DumpRenderTreeChrome::onFrameProvisionalLoadFailed(void*, Evas_Object* frame, void*) -{ - m_provisionalLoadFailedFrame = frame; - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didFailProvisionalLoadWithError\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onFrameLoadCommitted(void*, Evas_Object* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didCommitLoadForFrame\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onFrameLoadFinished(void*, Evas_Object* frame, void* eventInfo) -{ - const Ewk_Frame_Load_Error* error = static_cast<Ewk_Frame_Load_Error*>(eventInfo); - - // EFL port emits both "load,finished" and "load,error" signals in error case. - // Error case is therefore already handled in onFrameLoadError() and we don't need - // to handle it here. - if (error) - return; - - if (!done && gTestRunner->dumpProgressFinishedCallback()) - printf("postProgressFinishedNotification\n"); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didFinishLoadForFrame\n", frameName.utf8().data()); - } - - if (frame == topLoadingFrame) - topLoadingFrameLoadFinished(); -} - -void DumpRenderTreeChrome::onFrameLoadError(void*, Evas_Object* frame, void*) -{ - // In case of provisional load error, we receive both "load,error" and "load,provisional,failed" - // signals. m_provisionalLoadFailedFrame is used to avoid printing twice the load error: in - // onFrameProvisionalLoadFailed() and onFrameLoadError(). - if (!done && gTestRunner->dumpFrameLoadCallbacks() && frame != m_provisionalLoadFailedFrame) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didFailLoadWithError\n", frameName.utf8().data()); - } - - if (m_provisionalLoadFailedFrame && frame == m_provisionalLoadFailedFrame) - m_provisionalLoadFailedFrame = 0; - - if (frame == topLoadingFrame) - topLoadingFrameLoadFinished(); -} - -void DumpRenderTreeChrome::onFrameRedirectCancelled(void*, Evas_Object* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didCancelClientRedirectForFrame\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onFrameRedirectForProvisionalLoad(void*, Evas_Object* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", frameName.utf8().data()); - } -} - -void DumpRenderTreeChrome::onFrameRedirectRequested(void*, Evas_Object* frame, void* eventInfo) -{ - const char* url = static_cast<const char*>(eventInfo); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame)); - printf("%s - willPerformClientRedirectToURL: %s \n", frameName.utf8().data(), pathSuitableForTestResult(url).data()); - } -} - -void DumpRenderTreeChrome::onDidDetectXSS(void*, Evas_Object* view, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didDetectXSS\n"); -} - -void DumpRenderTreeChrome::onResponseReceived(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Frame_Resource_Response* response = static_cast<Ewk_Frame_Resource_Response*>(eventInfo); - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - CString responseDescription(descriptionSuitableForTestResult(response)); - printf("%s - didReceiveResponse %s\n", - m_dumpAssignedUrls.contains(response->identifier) ? m_dumpAssignedUrls.get(response->identifier).data() : "<unknown>", - responseDescription.data()); - } - - if (!done && gTestRunner->dumpResourceResponseMIMETypes()) { - printf("%s has MIME type %s\n", - KURL(ParsedURLString, response->url).lastPathComponent().utf8().data(), - response->mime_type); - } -} - -void DumpRenderTreeChrome::onResourceLoadFinished(void*, Evas_Object*, void* eventInfo) -{ - unsigned long identifier = *static_cast<unsigned long*>(eventInfo); - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - printf("%s - didFinishLoading\n", - (m_dumpAssignedUrls.contains(identifier) ? m_dumpAssignedUrls.take(identifier).data() : "<unknown>")); -} - -void DumpRenderTreeChrome::onResourceLoadFailed(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Frame_Load_Error* error = static_cast<Ewk_Frame_Load_Error*>(eventInfo); - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - printf("%s - didFailLoadingWithError: %s\n", - (m_dumpAssignedUrls.contains(error->resource_identifier) ? m_dumpAssignedUrls.take(error->resource_identifier).data() : "<unknown>"), - descriptionSuitableForTestResult(error).data()); -} - -void DumpRenderTreeChrome::onNewResourceRequest(void*, Evas_Object*, void* eventInfo) -{ - Ewk_Frame_Resource_Request* request = static_cast<Ewk_Frame_Resource_Request*>(eventInfo); - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - m_dumpAssignedUrls.add(request->identifier, pathSuitableForTestResult(request->url)); -} - -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. - // Because there is no download agent for the DumpRenderTree, - // create a new view and load the URL on that view just for a test. - Evas_Object* newView = browser->createView(); - if (!newView) - return; - - Ewk_Download* download = static_cast<Ewk_Download*>(eventInfo); - 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 deleted file mode 100644 index 836596561..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * Copyright (C) 2012 Intel Corporation - * - * 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 THE COPYRIGHT HOLDERS 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 THE COPYRIGHT - * HOLDERS 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 DumpRenderTreeChrome_h -#define DumpRenderTreeChrome_h - -#include "GCController.h" - -#include <Eina.h> -#include <Evas.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(); - - static PassOwnPtr<DumpRenderTreeChrome> create(Evas*); - - Evas_Object* createNewWindow(); - void removeWindow(Evas_Object*); - - Evas_Object* createInspectorView(); - void removeInspectorView(); - void waitInspectorLoadFinished(); - - const Vector<Evas_Object*>& extraViews() const; - void clearExtraViews(); - - Evas_Object* mainFrame() const; - Evas_Object* mainView() const; - - void resetDefaultsToConsistentValues(); - -private: - DumpRenderTreeChrome(Evas*); - - 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; - OwnPtr<GCController> m_gcController; - Vector<Evas_Object*> m_extraViews; - static HashMap<unsigned long, CString> m_dumpAssignedUrls; - static Evas_Object* m_provisionalLoadFailedFrame; - - // Smart callbacks - static void onWindowObjectCleared(void*, Evas_Object*, void*); - static void onLoadStarted(void*, Evas_Object*, void*); - - static Eina_Bool processWork(void*); - - static void topLoadingFrameLoadFinished(); - - static void onStatusbarTextSet(void*, Evas_Object*, void*); - - static void onFrameTitleChanged(void*, Evas_Object*, void*); - - static void onDocumentLoadFinished(void*, Evas_Object*, void*); - - static void onWillSendRequest(void*, Evas_Object*, void*); - - static void onWebViewOnloadEvent(void*, Evas_Object*, void*); - - static void onWebViewNavigatedWithData(void*, Evas_Object*, void*); - - static void onWebViewServerRedirect(void*, Evas_Object*, void*); - - static void onWebViewClientRedirect(void*, Evas_Object*, void*); - - static void onWebViewPopulateVisitedLinks(void*, Evas_Object*, void*); - - static void onInsecureContentRun(void*, Evas_Object*, void*); - - static void onInsecureContentDisplayed(void*, Evas_Object*, void*); - - static void onFrameCreated(void*, Evas_Object*, void*); - - static void onInspectorViewCreate(void*, Evas_Object*, void*); - - static void onInspectorViewClose(void*, Evas_Object*, void*); - - static void onInspectorFrameLoadFinished(void*, Evas_Object*, void*); - - static void onFrameIconChanged(void*, Evas_Object*, void*); - - static void onFrameProvisionalLoad(void*, Evas_Object*, void*); - static void onFrameProvisionalLoadFailed(void*, Evas_Object*, void*); - - static void onFrameLoadCommitted(void*, Evas_Object*, void*); - - static void onFrameLoadFinished(void*, Evas_Object*, void*); - - static void onFrameRedirectCancelled(void*, Evas_Object*, void*); - static void onFrameRedirectForProvisionalLoad(void*, Evas_Object*, void*); - static void onFrameRedirectRequested(void*, Evas_Object*, void*); - - static void onFrameLoadError(void*, Evas_Object*, void*); - static void onDidDetectXSS(void*, Evas_Object*, void*); - - static void onResponseReceived(void*, Evas_Object*, void*); - - static void onResourceLoadFinished(void*, Evas_Object*, void*); - - static void onResourceLoadFailed(void*, Evas_Object*, void*); - - static void onNewResourceRequest(void*, Evas_Object*, void*); - - static void onDownloadRequest(void*, Evas_Object*, void*); -}; - -#endif // DumpRenderTreeChrome_h diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h b/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h deleted file mode 100644 index ebc5cd35a..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeEfl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. Red istributions 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 THE COPYRIGHT HOLDERS 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 THE COPYRIGHT - * HOLDERS 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 DumpRenderTreeEfl_h -#define DumpRenderTreeEfl_h - -#include <Ecore.h> -#include <Evas.h> -#include <wtf/OwnPtr.h> - -class DumpRenderTreeChrome; - -extern OwnPtr<DumpRenderTreeChrome> browser; -extern Evas_Object* topLoadingFrame; -extern bool waitForPolicy; -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 deleted file mode 100644 index f7b425c6e..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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. Red istributions 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. - */ - -#define __STDC_FORMAT_MACROS -#include "config.h" -#include "DumpRenderTreeView.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" -#include "DumpRenderTreeEfl.h" -#include "TestRunner.h" -#include <EWebKit.h> -#include <Ecore.h> -#include <Eina.h> -#include <Evas.h> -#include <cstdio> -#include <cstdlib> -#include <inttypes.h> -#include <wtf/NotFound.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -using namespace std; - -static Ewk_View_Smart_Class gParentSmartClass = EWK_VIEW_SMART_CLASS_INIT_NULL; - -static WTF::String urlSuitableForTestResult(const WTF::String& uriString) -{ - if (uriString.isEmpty() || !uriString.startsWith("file://")) - return uriString; - - const size_t index = uriString.reverseFind('/'); - return (index == WTF::notFound) ? uriString : uriString.substring(index + 1); -} - -static void onConsoleMessage(Ewk_View_Smart_Data* smartData, const char* message, unsigned lineNumber, const char*) -{ - Evas_Object* evasObject = smartData->self; - if (evas_object_data_get(evasObject, "ignore-console-messages")) - return; - - // Tests expect only the filename part of local URIs - WTF::String newMessage = WTF::String::fromUTF8(message); - if (!newMessage.isEmpty()) { - const size_t fileProtocol = newMessage.find("file://"); - if (fileProtocol != WTF::notFound) - newMessage = newMessage.left(fileProtocol) + urlSuitableForTestResult(newMessage.substring(fileProtocol)); - } - - // Ignore simple translation-related messages and unnecessary messages - if (newMessage.contains("Localized string") || newMessage.contains("Protocol Error: the message is for non-existing domain 'Profiler'")) - return; - - printf("CONSOLE MESSAGE: "); - if (lineNumber) - printf("line %u: ", lineNumber); - printf("%s\n", newMessage.utf8().data()); -} - -static void onJavaScriptAlert(Ewk_View_Smart_Data*, Evas_Object*, const char* message) -{ - printf("ALERT: %s\n", message); - fflush(stdout); -} - -static Eina_Bool onJavaScriptConfirm(Ewk_View_Smart_Data*, Evas_Object*, const char* message) -{ - printf("CONFIRM: %s\n", message); - 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); - *value = eina_stringshare_add(defaultValue); - return EINA_TRUE; -} - -static Evas_Object* onWindowCreate(Ewk_View_Smart_Data*, Eina_Bool, const Ewk_Window_Features*) -{ - return gTestRunner->canOpenWindows() ? browser->createNewWindow() : 0; -} - -static Eina_Bool onWindowCloseDelayed(void* data) -{ - Evas_Object* view = static_cast<Evas_Object*>(data); - browser->removeWindow(view); - return EINA_FALSE; -} - -static void onWindowClose(Ewk_View_Smart_Data* smartData) -{ - Evas_Object* view = smartData->self; - ecore_idler_add(onWindowCloseDelayed, view); -} - -static uint64_t onExceededDatabaseQuota(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize) -{ - if (!gTestRunner->dumpDatabaseCallbacks()) - return 0; - - Ewk_Security_Origin* origin = ewk_frame_security_origin_get(frame); - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", - ewk_security_origin_protocol_get(origin), - ewk_security_origin_host_get(origin), - ewk_security_origin_port_get(origin), - databaseName); - ewk_security_origin_free(origin); - - return 5 * 1024 * 1024; -} - -static int64_t onExceededApplicationCacheQuota(Ewk_View_Smart_Data*, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded) -{ - if (gTestRunner->dumpApplicationCacheDelegateCallbacks()) { - // For example, numbers from 30000 - 39999 will output as 30000. - // Rounding up or down does not really matter for these tests. It's - // sufficient to just get a range of 10000 to determine if we were - // above or below a threshold. - int64_t truncatedSpaceNeeded = (totalSpaceNeeded / 10000) * 10000; - printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:~%" PRId64 "\n", - ewk_security_origin_protocol_get(origin), - ewk_security_origin_host_get(origin), - ewk_security_origin_port_get(origin), - truncatedSpaceNeeded); - } - - if (gTestRunner->disallowIncreaseForApplicationCacheQuota()) - return 0; - - return defaultOriginQuota; -} - -static bool shouldUseTiledBackingStore() -{ - const char* useTiledBackingStore = getenv("DRT_USE_TILED_BACKING_STORE"); - return useTiledBackingStore && *useTiledBackingStore == '1'; -} - -static bool chooseAndInitializeAppropriateSmartClass(Ewk_View_Smart_Class* api) -{ - return !shouldUseTiledBackingStore() ? ewk_view_single_smart_set(api) : ewk_view_tiled_smart_set(api); -} - -// Taken from the file "WebKit/Tools/DumpRenderTree/chromium/WebViewHost.cpp". -static inline const char* navigationTypeToString(const Ewk_Navigation_Type type) -{ - switch (type) { - case EWK_NAVIGATION_TYPE_LINK_CLICKED: - return "link clicked"; - case EWK_NAVIGATION_TYPE_FORM_SUBMITTED: - return "form submitted"; - case EWK_NAVIGATION_TYPE_BACK_FORWARD: - return "back/forward"; - case EWK_NAVIGATION_TYPE_RELOAD: - return "reload"; - case EWK_NAVIGATION_TYPE_FORM_RESUBMITTED: - return "form resubmitted"; - case EWK_NAVIGATION_TYPE_OTHER: - return "other"; - } - return "illegal value"; -} - -static Eina_Bool onNavigationPolicyDecision(Ewk_View_Smart_Data*, Ewk_Frame_Resource_Request* request, Ewk_Navigation_Type navigationType) -{ - if (!policyDelegateEnabled) - return true; - - printf("Policy delegate: attempt to load %s with navigation type '%s'\n", urlSuitableForTestResult(request->url).utf8().data(), - navigationTypeToString(navigationType)); - - if (gTestRunner) - gTestRunner->notifyDone(); - - return policyDelegatePermissive; -} - -static Eina_Bool onFocusCanCycle(Ewk_View_Smart_Data*, Ewk_Focus_Direction) -{ - // This is the behavior of Mac and Chromium ports and is expected by some test cases. - return true; -} - -Evas_Object* drtViewAdd(Evas* evas) -{ - static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("DRT_View"); - - if (!chooseAndInitializeAppropriateSmartClass(&api)) - return 0; - - if (EINA_UNLIKELY(!gParentSmartClass.sc.add)) - ewk_view_base_smart_set(&gParentSmartClass); - - 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; - api.exceeded_application_cache_quota = onExceededApplicationCacheQuota; - api.exceeded_database_quota = onExceededDatabaseQuota; - api.navigation_policy_decision = onNavigationPolicyDecision; - api.focus_can_cycle = onFocusCanCycle; - - return evas_object_smart_add(evas, evas_smart_class_new(&api.sc)); -} diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeView.h b/Tools/DumpRenderTree/efl/DumpRenderTreeView.h deleted file mode 100644 index 72ddab56d..000000000 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2011 ProFUSION Embedded Systems. 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. Red istributions 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. - */ - -#ifndef DumpRenderTreeView_h -#define DumpRenderTreeView_h - -#include <Evas.h> - -Evas_Object* drtViewAdd(Evas*); - -#endif // DumpRenderTreeView_h diff --git a/Tools/DumpRenderTree/efl/EditingCallbacks.cpp b/Tools/DumpRenderTree/efl/EditingCallbacks.cpp deleted file mode 100644 index 7a03cddd1..000000000 --- a/Tools/DumpRenderTree/efl/EditingCallbacks.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2010 Igalia S.L. - * Copyright (C) 2012 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 "EditingCallbacks.h" - -#include "DumpRenderTree.h" -#include "EditorClientEfl.h" -#include "EditorInsertAction.h" -#include "Node.h" -#include "Range.h" -#include "StylePropertySet.h" -#include "TestRunner.h" -#include "TextAffinity.h" -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -static WTF::String dumpPath(WebCore::Node* node) -{ - WebCore::Node* parent = node->parentNode(); - WTF::String str = WTF::String::format("%s", node->nodeName().utf8().data()); - if (parent) { - str.append(" > "); - str.append(dumpPath(parent)); - } - return str; -} - -static WTF::String dumpRange(WebCore::Range* range) -{ - if (!range) - return "(null)"; - return WTF::String::format("range from %d of %s to %d of %s", range->startOffset(), dumpPath(range->startContainer()).utf8().data(), range->endOffset(), dumpPath(range->endContainer()).utf8().data()); -} - -static const char* insertActionString(WebCore::EditorInsertAction action) -{ - switch (action) { - case WebCore::EditorInsertActionTyped: - return "WebViewInsertActionTyped"; - case WebCore::EditorInsertActionPasted: - return "WebViewInsertActionPasted"; - case WebCore::EditorInsertActionDropped: - return "WebViewInsertActionDropped"; - } - ASSERT_NOT_REACHED(); - return "WebViewInsertActionTyped"; -} - -static const char* selectionAffinityString(WebCore::EAffinity affinity) -{ - switch (affinity) { - case WebCore::UPSTREAM: - return "NSSelectionAffinityUpstream"; - case WebCore::DOWNSTREAM: - return "NSSelectionAffinityDownstream"; - } - ASSERT_NOT_REACHED(); - return "NSSelectionAffinityUpstream"; -} - -void shouldBeginEditing(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - WebCore::Range* range = static_cast<WebCore::Range*>(eventInfo); - printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dumpRange(range).utf8().data()); - } -} - -void shouldEndEditing(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - WebCore::Range* range = static_cast<WebCore::Range*>(eventInfo); - printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dumpRange(range).utf8().data()); - } -} - -void shouldInsertNode(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - Ewk_Should_Insert_Node_Event* shouldInsertNodeEvent = static_cast<Ewk_Should_Insert_Node_Event*>(eventInfo); - printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", - dumpPath(shouldInsertNodeEvent->node).utf8().data(), dumpRange(shouldInsertNodeEvent->range).utf8().data(), - insertActionString(shouldInsertNodeEvent->action)); - } -} - -void shouldInsertText(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - Ewk_Should_Insert_Text_Event* shouldInsertTextEvent = static_cast<Ewk_Should_Insert_Text_Event*>(eventInfo); - printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", - shouldInsertTextEvent->text, dumpRange(shouldInsertTextEvent->range).utf8().data(), insertActionString(shouldInsertTextEvent->action)); - } -} - -void shouldDeleteRange(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - WebCore::Range* range = static_cast<WebCore::Range*>(eventInfo); - printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dumpRange(range).utf8().data()); - } -} - -void shouldChangeSelectedRange(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - Ewk_Should_Change_Selected_Range_Event* shouldChangeSelectedRangeEvent = static_cast<Ewk_Should_Change_Selected_Range_Event*>(eventInfo); - printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", - dumpRange(shouldChangeSelectedRangeEvent->fromRange).utf8().data(), dumpRange(shouldChangeSelectedRangeEvent->toRange).utf8().data(), - selectionAffinityString(shouldChangeSelectedRangeEvent->affinity), shouldChangeSelectedRangeEvent->stillSelecting ? "TRUE" : "FALSE"); - } -} - -void shouldApplyStyle(void*, Evas_Object*, void* eventInfo) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - Ewk_Should_Apply_Style_Event* shouldApplyStyleEvent = static_cast<Ewk_Should_Apply_Style_Event*>(eventInfo); - printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", - shouldApplyStyleEvent->style->asText().utf8().data(), dumpRange(shouldApplyStyleEvent->range).utf8().data()); - } -} - -void editingBegan(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n"); -} - -void userChangedContents(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); -} - -void editingEnded(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n"); -} - -void selectionChanged(void*, Evas_Object*, void*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n"); -} - -void connectEditingCallbacks(Evas_Object* webView) -{ - evas_object_smart_callback_add(webView, "editorclient,editing,begin", shouldBeginEditing, 0); - evas_object_smart_callback_add(webView, "editorclient,editing,end", shouldEndEditing, 0); - evas_object_smart_callback_add(webView, "editorclient,node,insert", shouldInsertNode, 0); - evas_object_smart_callback_add(webView, "editorclient,text,insert", shouldInsertText, 0); - evas_object_smart_callback_add(webView, "editorclient,range,delete", shouldDeleteRange, 0); - evas_object_smart_callback_add(webView, "editorclient,selected,range,change", shouldChangeSelectedRange, 0); - evas_object_smart_callback_add(webView, "editorclient,style,apply", shouldApplyStyle, 0); - evas_object_smart_callback_add(webView, "editorclient,editing,began", editingBegan, 0); - evas_object_smart_callback_add(webView, "editorclient,contents,changed", userChangedContents, 0); - evas_object_smart_callback_add(webView, "editorclient,editing,ended", editingEnded, 0); - evas_object_smart_callback_add(webView, "editorclient,selection,changed", selectionChanged, 0); -} diff --git a/Tools/DumpRenderTree/efl/EditingCallbacks.h b/Tools/DumpRenderTree/efl/EditingCallbacks.h deleted file mode 100644 index cf535e492..000000000 --- a/Tools/DumpRenderTree/efl/EditingCallbacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2010 Igalia S.L. - * Copyright (C) 2012 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. - */ - -#ifndef EditingCallbacks_h -#define EditingCallbacks_h - -#include <Evas.h> - -void connectEditingCallbacks(Evas_Object*); - -#endif diff --git a/Tools/DumpRenderTree/efl/EventSender.cpp b/Tools/DumpRenderTree/efl/EventSender.cpp deleted file mode 100644 index 92b788991..000000000 --- a/Tools/DumpRenderTree/efl/EventSender.cpp +++ /dev/null @@ -1,1035 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> - * Copyright (C) 2009 Holger Hans Peter Freyther - * Copyright (C) 2010 Igalia S.L. - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011, 2012 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 "EventSender.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" -#include "IntPoint.h" -#include "JSStringUtils.h" -#include "NotImplemented.h" -#include "PlatformEvent.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "ewk_private.h" -#include <EWebKit.h> -#include <Ecore_Input.h> -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/OpaqueJSString.h> -#include <wtf/ASCIICType.h> -#include <wtf/Platform.h> -#include <wtf/text/CString.h> - -static bool gDragMode; -static int gTimeOffset = 0; - -static int gLastMousePositionX; -static int gLastMousePositionY; -static int gLastClickPositionX; -static int gLastClickPositionY; -static int gLastClickTimeOffset; -static int gLastClickButton; -static int gButtonCurrentlyDown; -static int gClickCount; - -static const float zoomMultiplierRatio = 1.2f; - -// Key event location code defined in DOM Level 3. -enum KeyLocationCode { - DomKeyLocationStandard, - DomKeyLocationLeft, - DomKeyLocationRight, - DomKeyLocationNumpad -}; - -enum EvasKeyModifier { - EvasKeyModifierNone = 0, - EvasKeyModifierControl = 1 << 0, - EvasKeyModifierShift = 1 << 1, - EvasKeyModifierAlt = 1 << 2, - EvasKeyModifierMeta = 1 << 3 -}; - -enum EvasMouseButton { - EvasMouseButtonNone, - EvasMouseButtonLeft, - EvasMouseButtonMiddle, - EvasMouseButtonRight -}; - -enum EvasMouseEvent { - EvasMouseEventNone = 0, - EvasMouseEventDown = 1 << 0, - EvasMouseEventUp = 1 << 1, - EvasMouseEventMove = 1 << 2, - EvasMouseEventScrollUp = 1 << 3, - EvasMouseEventScrollDown = 1 << 4, - EvasMouseEventScrollLeft = 1 << 5, - EvasMouseEventScrollRight = 1 << 6, - EvasMouseEventClick = EvasMouseEventMove | EvasMouseEventDown | EvasMouseEventUp, -}; - -enum ZoomEvent { - ZoomIn, - ZoomOut -}; - -enum EventQueueStrategy { - FeedQueuedEvents, - DoNotFeedQueuedEvents -}; - -struct KeyEventInfo { - KeyEventInfo(const CString& keyName, unsigned modifiers, const CString& keyString = CString()) - : keyName(keyName) - , keyString(keyString) - , modifiers(modifiers) - { - } - - const CString keyName; - const CString keyString; - unsigned modifiers; -}; - -struct MouseEventInfo { - MouseEventInfo(EvasMouseEvent event, unsigned modifiers = EvasKeyModifierNone, EvasMouseButton button = EvasMouseButtonNone, int horizontalDelta = 0, int verticalDelta = 0) - : event(event) - , modifiers(modifiers) - , button(button) - , horizontalDelta(horizontalDelta) - , verticalDelta(verticalDelta) - { - } - - EvasMouseEvent event; - unsigned modifiers; - EvasMouseButton button; - int horizontalDelta; - int verticalDelta; -}; - -struct DelayedEvent { - DelayedEvent(MouseEventInfo* eventInfo, unsigned long delay = 0) - : eventInfo(eventInfo) - , delay(delay) - { - } - - MouseEventInfo* eventInfo; - unsigned long delay; -}; - -struct TouchEventInfo { - TouchEventInfo(unsigned id, Ewk_Touch_Point_Type state, const WebCore::IntPoint& point) - : state(state) - , point(point) - , id(id) - { - } - - unsigned id; - Ewk_Touch_Point_Type state; - WebCore::IntPoint point; -}; - -static unsigned touchModifiers; - -WTF::Vector<TouchEventInfo>& touchPointList() -{ - DEFINE_STATIC_LOCAL(WTF::Vector<TouchEventInfo>, staticTouchPointList, ()); - return staticTouchPointList; -} - -WTF::Vector<DelayedEvent>& delayedEventQueue() -{ - DEFINE_STATIC_LOCAL(WTF::Vector<DelayedEvent>, staticDelayedEventQueue, ()); - return staticDelayedEventQueue; -} - - -static void feedOrQueueMouseEvent(MouseEventInfo*, EventQueueStrategy); -static void feedMouseEvent(MouseEventInfo*); -static void feedQueuedMouseEvents(); - -static void setEvasModifiers(Evas* evas, unsigned modifiers) -{ - static const char* modifierNames[] = { "Control", "Shift", "Alt", "Super" }; - for (unsigned modifier = 0; modifier < 4; ++modifier) { - if (modifiers & (1 << modifier)) - evas_key_modifier_on(evas, modifierNames[modifier]); - else - evas_key_modifier_off(evas, modifierNames[modifier]); - } -} - -static EvasMouseButton translateMouseButtonNumber(int eventSenderButtonNumber) -{ - static const EvasMouseButton translationTable[] = { - EvasMouseButtonLeft, - EvasMouseButtonMiddle, - EvasMouseButtonRight, - EvasMouseButtonMiddle // fast/events/mouse-click-events expects the 4th button to be treated as the middle button - }; - static const unsigned translationTableSize = sizeof(translationTable) / sizeof(translationTable[0]); - - if (eventSenderButtonNumber < translationTableSize) - return translationTable[eventSenderButtonNumber]; - - return EvasMouseButtonLeft; -} - -static Eina_Bool sendClick(void*) -{ - MouseEventInfo* eventInfo = new MouseEventInfo(EvasMouseEventClick, EvasKeyModifierNone, EvasMouseButtonLeft); - feedOrQueueMouseEvent(eventInfo, FeedQueuedEvents); - return ECORE_CALLBACK_CANCEL; -} - -static JSValueRef scheduleAsynchronousClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - ecore_idler_add(sendClick, 0); - return JSValueMakeUndefined(context); -} - -static void updateClickCount(int button) -{ - if (gLastClickPositionX != gLastMousePositionX - || gLastClickPositionY != gLastMousePositionY - || gLastClickButton != button - || gTimeOffset - gLastClickTimeOffset >= 1) - gClickCount = 1; - else - gClickCount++; -} - -static EvasKeyModifier modifierFromJSValue(JSContextRef context, const JSValueRef value) -{ - JSRetainPtr<JSStringRef> jsKeyValue(Adopt, JSValueToStringCopy(context, value, 0)); - - if (equals(jsKeyValue, "ctrlKey") || equals(jsKeyValue, "addSelectionKey")) - return EvasKeyModifierControl; - if (equals(jsKeyValue, "shiftKey") || equals(jsKeyValue, "rangeSelectionKey")) - return EvasKeyModifierShift; - if (equals(jsKeyValue, "altKey")) - return EvasKeyModifierAlt; - if (equals(jsKeyValue, "metaKey")) - return EvasKeyModifierMeta; - - return EvasKeyModifierNone; -} - -static unsigned modifiersFromJSValue(JSContextRef context, const JSValueRef modifiers) -{ - // The value may either be a string with a single modifier or an array of modifiers. - if (JSValueIsString(context, modifiers)) - return modifierFromJSValue(context, modifiers); - - JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0); - if (!modifiersArray) - return EvasKeyModifierNone; - - unsigned modifier = EvasKeyModifierNone; - JSRetainPtr<JSStringRef> lengthProperty(Adopt, JSStringCreateWithUTF8CString("length")); - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty.get(), 0), 0); - for (int i = 0; i < modifiersCount; ++i) - modifier |= modifierFromJSValue(context, JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0)); - return modifier; -} - -static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(JSObjectGetPrivate(object)); - CString label; - if (ewk_context_menu_item_type_get(item) == EWK_SEPARATOR_TYPE) - label = "<separator>"; - else - label = ewk_context_menu_item_title_get(item); - - return JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data())); -} - -static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) -{ - return true; -} - -static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(JSObjectGetPrivate(thisObject)); - ewk_context_menu_item_select(ewk_context_menu_item_parent_get(item), item); - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticMenuItemFunctions[] = { - { "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticMenuItemValues[] = { - { "title", getMenuItemTitleCallback, setMenuItemTitleCallback, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getMenuItemClass() -{ - static JSClassRef menuItemClass = 0; - - if (!menuItemClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticMenuItemFunctions; - classDefinition.staticValues = staticMenuItemValues; - - menuItemClass = JSClassCreate(&classDefinition); - } - - return menuItemClass; -} - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); - if (!view) - return JSValueMakeUndefined(context); - - Evas* evas = evas_object_evas_get(view); - if (!evas) - return JSValueMakeUndefined(context); - - Evas_Event_Mouse_Down mouseDown; - mouseDown.button = 3; - mouseDown.output.x = gLastMousePositionX; - mouseDown.output.y = gLastMousePositionY; - mouseDown.canvas.x = gLastMousePositionX; - mouseDown.canvas.y = gLastMousePositionY; - mouseDown.data = 0; - mouseDown.modifiers = const_cast<Evas_Modifier*>(evas_key_modifier_get(evas)); - mouseDown.locks = const_cast<Evas_Lock*>(evas_key_lock_get(evas)); - mouseDown.flags = EVAS_BUTTON_NONE; - mouseDown.timestamp = ecore_loop_time_get(); - mouseDown.event_flags = EVAS_EVENT_FLAG_NONE; - mouseDown.dev = 0; - - ewk_view_context_menu_forward_event(view, &mouseDown); - Ewk_Context_Menu* ewkMenu = ewk_view_context_menu_get(view); - - JSValueRef valueRef = JSObjectMakeArray(context, 0, 0, 0); - if (ewkMenu) { - const Eina_List* ewkMenuItems = ewk_context_menu_item_list_get(ewkMenu); - JSValueRef arrayValues[eina_list_count(ewkMenuItems)]; - - const Eina_List* listIterator; - void* data; - int index = 0; - EINA_LIST_FOREACH(ewkMenuItems, listIterator, data) - arrayValues[index++] = JSObjectMake(context, getMenuItemClass(), data); - - if (index) - valueRef = JSObjectMakeArray(context, index - 1, arrayValues, 0); - } - - return valueRef; -} - -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int button = 0; - if (argumentCount == 1) { - button = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - - if (exception && *exception) - return JSValueMakeUndefined(context); - } - - button = translateMouseButtonNumber(button); - // If the same mouse button is already in the down position don't send another event as it may confuse Xvfb. - if (gButtonCurrentlyDown == button) - return JSValueMakeUndefined(context); - - updateClickCount(button); - - unsigned modifiers = argumentCount >= 2 ? modifiersFromJSValue(context, arguments[1]) : EvasKeyModifierNone; - MouseEventInfo* eventInfo = new MouseEventInfo(EvasMouseEventDown, modifiers, static_cast<EvasMouseButton>(button)); - feedOrQueueMouseEvent(eventInfo, FeedQueuedEvents); - gButtonCurrentlyDown = button; - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int button = 0; - if (argumentCount == 1) { - button = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - if (exception && *exception) - return JSValueMakeUndefined(context); - } - - gLastClickPositionX = gLastMousePositionX; - gLastClickPositionY = gLastMousePositionY; - gLastClickButton = gButtonCurrentlyDown; - gLastClickTimeOffset = gTimeOffset; - gButtonCurrentlyDown = 0; - - unsigned modifiers = argumentCount >= 2 ? modifiersFromJSValue(context, arguments[1]) : EvasKeyModifierNone; - MouseEventInfo* eventInfo = new MouseEventInfo(EvasMouseEventUp, modifiers, translateMouseButtonNumber(button)); - feedOrQueueMouseEvent(eventInfo, FeedQueuedEvents); - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - gLastMousePositionX = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - if (exception && *exception) - return JSValueMakeUndefined(context); - gLastMousePositionY = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - if (exception && *exception) - return JSValueMakeUndefined(context); - - MouseEventInfo* eventInfo = new MouseEventInfo(EvasMouseEventMove); - feedOrQueueMouseEvent(eventInfo, DoNotFeedQueuedEvents); - return JSValueMakeUndefined(context); -} - -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount > 0) { - const unsigned long leapForwardDelay = JSValueToNumber(context, arguments[0], exception); - if (delayedEventQueue().isEmpty()) - delayedEventQueue().append(DelayedEvent(0, leapForwardDelay)); - else - delayedEventQueue().last().delay = leapForwardDelay; - gTimeOffset += leapForwardDelay; - } - - return JSValueMakeUndefined(context); -} - -static EvasMouseEvent evasMouseEventFromHorizontalAndVerticalOffsets(int horizontalOffset, int verticalOffset) -{ - unsigned mouseEvent = 0; - - if (verticalOffset > 0) - mouseEvent |= EvasMouseEventScrollUp; - else if (verticalOffset < 0) - mouseEvent |= EvasMouseEventScrollDown; - - if (horizontalOffset > 0) - mouseEvent |= EvasMouseEventScrollRight; - else if (horizontalOffset < 0) - mouseEvent |= EvasMouseEventScrollLeft; - - return static_cast<EvasMouseEvent>(mouseEvent); -} - -static JSValueRef mouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - // We need to invert scrolling values since in EFL negative z value means that - // canvas is scrolling down - const int horizontal = -(static_cast<int>(JSValueToNumber(context, arguments[0], exception))); - if (exception && *exception) - return JSValueMakeUndefined(context); - const int vertical = -(static_cast<int>(JSValueToNumber(context, arguments[1], exception))); - if (exception && *exception) - return JSValueMakeUndefined(context); - - MouseEventInfo* eventInfo = new MouseEventInfo(evasMouseEventFromHorizontalAndVerticalOffsets(horizontal, vertical), EvasKeyModifierNone, EvasMouseButtonNone, horizontal, vertical); - feedOrQueueMouseEvent(eventInfo, FeedQueuedEvents); - return JSValueMakeUndefined(context); -} - -static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - return JSValueMakeUndefined(context); -} - -static KeyEventInfo* keyPadNameFromJSValue(JSStringRef character, unsigned modifiers) -{ - if (equals(character, "leftArrow")) - return new KeyEventInfo("KP_Left", modifiers); - if (equals(character, "rightArrow")) - return new KeyEventInfo("KP_Right", modifiers); - if (equals(character, "upArrow")) - return new KeyEventInfo("KP_Up", modifiers); - if (equals(character, "downArrow")) - return new KeyEventInfo("KP_Down", modifiers); - if (equals(character, "pageUp")) - return new KeyEventInfo("KP_Prior", modifiers); - if (equals(character, "pageDown")) - return new KeyEventInfo("KP_Next", modifiers); - if (equals(character, "home")) - return new KeyEventInfo("KP_Home", modifiers); - if (equals(character, "end")) - return new KeyEventInfo("KP_End", modifiers); - if (equals(character, "insert")) - return new KeyEventInfo("KP_Insert", modifiers); - if (equals(character, "delete")) - return new KeyEventInfo("KP_Delete", modifiers); - - return new KeyEventInfo(character->string().utf8(), modifiers, character->string().utf8()); -} - -static KeyEventInfo* keyNameFromJSValue(JSStringRef character, unsigned modifiers) -{ - if (equals(character, "leftArrow")) - return new KeyEventInfo("Left", modifiers); - if (equals(character, "rightArrow")) - return new KeyEventInfo("Right", modifiers); - if (equals(character, "upArrow")) - return new KeyEventInfo("Up", modifiers); - if (equals(character, "downArrow")) - return new KeyEventInfo("Down", modifiers); - if (equals(character, "pageUp")) - return new KeyEventInfo("Prior", modifiers); - if (equals(character, "pageDown")) - return new KeyEventInfo("Next", modifiers); - if (equals(character, "home")) - return new KeyEventInfo("Home", modifiers); - if (equals(character, "end")) - return new KeyEventInfo("End", modifiers); - if (equals(character, "insert")) - return new KeyEventInfo("Insert", modifiers); - if (equals(character, "delete")) - return new KeyEventInfo("Delete", modifiers); - if (equals(character, "printScreen")) - return new KeyEventInfo("Print", modifiers); - if (equals(character, "menu")) - return new KeyEventInfo("Menu", modifiers); - if (equals(character, "leftControl")) - return new KeyEventInfo("Control_L", modifiers); - if (equals(character, "rightControl")) - return new KeyEventInfo("Control_R", modifiers); - if (equals(character, "leftShift")) - return new KeyEventInfo("Shift_L", modifiers); - if (equals(character, "rightShift")) - return new KeyEventInfo("Shift_R", modifiers); - if (equals(character, "leftAlt")) - return new KeyEventInfo("Alt_L", modifiers); - if (equals(character, "rightAlt")) - return new KeyEventInfo("Alt_R", modifiers); - if (equals(character, "F1")) - return new KeyEventInfo("F1", modifiers); - if (equals(character, "F2")) - return new KeyEventInfo("F2", modifiers); - if (equals(character, "F3")) - return new KeyEventInfo("F3", modifiers); - if (equals(character, "F4")) - return new KeyEventInfo("F4", modifiers); - if (equals(character, "F5")) - return new KeyEventInfo("F5", modifiers); - if (equals(character, "F6")) - return new KeyEventInfo("F6", modifiers); - if (equals(character, "F7")) - return new KeyEventInfo("F7", modifiers); - if (equals(character, "F8")) - return new KeyEventInfo("F8", modifiers); - if (equals(character, "F9")) - return new KeyEventInfo("F9", modifiers); - if (equals(character, "F10")) - return new KeyEventInfo("F10", modifiers); - if (equals(character, "F11")) - return new KeyEventInfo("F11", modifiers); - if (equals(character, "F12")) - return new KeyEventInfo("F12", modifiers); - - int charCode = JSStringGetCharactersPtr(character)[0]; - if (charCode == '\n' || charCode == '\r') - return new KeyEventInfo("Return", modifiers, "\r"); - if (charCode == '\t') - return new KeyEventInfo("Tab", modifiers, "\t"); - if (charCode == '\x8') - return new KeyEventInfo("BackSpace", modifiers, "\x8"); - if (charCode == ' ') - return new KeyEventInfo("space", modifiers, " "); - if (charCode == '\x1B') - return new KeyEventInfo("Escape", modifiers, "\x1B"); - - if ((character->length() == 1) && (charCode >= 'A' && charCode <= 'Z')) - modifiers |= EvasKeyModifierShift; - - return new KeyEventInfo(character->string().utf8(), modifiers, character->string().utf8()); -} - -static KeyEventInfo* createKeyEventInfo(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!ewk_frame_view_get(browser->mainFrame())) - return 0; - - if (argumentCount < 1) - return 0; - - // handle location argument. - int location = DomKeyLocationStandard; - if (argumentCount > 2) - location = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); - - JSRetainPtr<JSStringRef> character(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - if (exception && *exception) - return 0; - - unsigned modifiers = EvasKeyModifierNone; - if (argumentCount >= 2) - modifiers = modifiersFromJSValue(context, arguments[1]); - - return (location == DomKeyLocationNumpad) ? keyPadNameFromJSValue(character.get(), modifiers) : keyNameFromJSValue(character.get(), modifiers); -} - -static void sendKeyDown(Evas* evas, KeyEventInfo* keyEventInfo) -{ - if (!keyEventInfo) - return; - - const char* keyName = keyEventInfo->keyName.data(); - const char* keyString = keyEventInfo->keyString.data(); - unsigned modifiers = keyEventInfo->modifiers; - - DumpRenderTreeSupportEfl::layoutFrame(browser->mainFrame()); - - ASSERT(evas); - - int eventIndex = 0; - // Mimic the emacs ctrl-o binding by inserting a paragraph - // separator and then putting the cursor back to its original - // position. Allows us to pass emacs-ctrl-o.html - if ((modifiers & EvasKeyModifierControl) && !strcmp(keyName, "o")) { - setEvasModifiers(evas, EvasKeyModifierNone); - evas_event_feed_key_down(evas, "Return", "Return", "\r", 0, eventIndex++, 0); - evas_event_feed_key_up(evas, "Return", "Return", "\r", 0, eventIndex++, 0); - - modifiers = EvasKeyModifierNone; - keyName = "Left"; - keyString = 0; - } - - setEvasModifiers(evas, modifiers); - evas_event_feed_key_down(evas, keyName, keyName, keyString, 0, eventIndex++, 0); - evas_event_feed_key_up(evas, keyName, keyName, keyString, 0, eventIndex++, 0); - setEvasModifiers(evas, EvasKeyModifierNone); - - DumpRenderTreeSupportEfl::deliverAllMutationsIfNecessary(); -} - -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - OwnPtr<KeyEventInfo> keyEventInfo = adoptPtr(createKeyEventInfo(context, argumentCount, arguments, exception)); - sendKeyDown(evas_object_evas_get(browser->mainFrame()), keyEventInfo.get()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); - if (!view) - return JSValueMakeUndefined(context); - - float scaleFactor = JSValueToNumber(context, arguments[0], exception); - float x = JSValueToNumber(context, arguments[1], exception); - float y = JSValueToNumber(context, arguments[2], exception); - ewk_view_scale_set(view, scaleFactor, x, y); - - return JSValueMakeUndefined(context); -} - -static void textZoom(ZoomEvent zoomEvent) -{ - Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); - if (!view) - return; - - float zoomFactor = ewk_view_text_zoom_get(view); - if (zoomEvent == ZoomIn) - zoomFactor *= zoomMultiplierRatio; - else - zoomFactor /= zoomMultiplierRatio; - - ewk_view_text_zoom_set(view, zoomFactor); -} - -static void pageZoom(ZoomEvent zoomEvent) -{ - Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); - if (!view) - return; - - float zoomFactor = ewk_view_page_zoom_get(view); - if (zoomEvent == ZoomIn) - zoomFactor *= zoomMultiplierRatio; - else - zoomFactor /= zoomMultiplierRatio; - - ewk_view_page_zoom_set(view, zoomFactor); -} - -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - textZoom(ZoomIn); - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - textZoom(ZoomOut); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - pageZoom(ZoomIn); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - pageZoom(ZoomOut); - return JSValueMakeUndefined(context); -} - -static Eina_Bool sendAsynchronousKeyDown(void* userData) -{ - OwnPtr<KeyEventInfo> keyEventInfo = adoptPtr(static_cast<KeyEventInfo*>(userData)); - sendKeyDown(evas_object_evas_get(browser->mainFrame()), keyEventInfo.get()); - return ECORE_CALLBACK_CANCEL; -} - -static JSValueRef scheduleAsynchronousKeyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - KeyEventInfo* keyEventInfo = createKeyEventInfo(context, argumentCount, arguments, exception); - ecore_idler_add(sendAsynchronousKeyDown, static_cast<void*>(keyEventInfo)); - return JSValueMakeUndefined(context); -} - -static void sendTouchEvent(Ewk_Touch_Event_Type type) -{ - Eina_List* eventList = 0; - - for (unsigned i = 0; i < touchPointList().size(); ++i) { - Ewk_Touch_Point* event = new Ewk_Touch_Point; - WebCore::IntPoint point = touchPointList().at(i).point; - event->id = touchPointList().at(i).id; - event->x = point.x(); - event->y = point.y(); - event->state = touchPointList().at(i).state; - eventList = eina_list_append(eventList, event); - } - - ewk_frame_feed_touch_event(browser->mainFrame(), type, eventList, touchModifiers); - - void* listData; - EINA_LIST_FREE(eventList, listData) { - Ewk_Touch_Point* event = static_cast<Ewk_Touch_Point*>(listData); - delete event; - } - - for (unsigned i = 0; i < touchPointList().size(); ) { - if (touchPointList().at(i).state == EWK_TOUCH_POINT_RELEASED) - touchPointList().remove(i); - else { - touchPointList().at(i).state = EWK_TOUCH_POINT_STATIONARY; - ++i; - } - } -} - -static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 2) - return JSValueMakeUndefined(context); - - int x = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - - const WebCore::IntPoint point(x, y); - const unsigned id = touchPointList().isEmpty() ? 0 : touchPointList().last().id + 1; - TouchEventInfo eventInfo(id, EWK_TOUCH_POINT_PRESSED, point); - touchPointList().append(eventInfo); - - return JSValueMakeUndefined(context); -} - -static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - sendTouchEvent(EWK_TOUCH_START); - return JSValueMakeUndefined(context); -} - -static JSValueRef updateTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 3) - return JSValueMakeUndefined(context); - - int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - int x = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - int y = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); - ASSERT(!exception || !*exception); - - if (index < 0 || index >= touchPointList().size()) - return JSValueMakeUndefined(context); - - WebCore::IntPoint& point = touchPointList().at(index).point; - point.setX(x); - point.setY(y); - touchPointList().at(index).state = EWK_TOUCH_POINT_MOVED; - - return JSValueMakeUndefined(context); -} - -static JSValueRef touchMoveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - sendTouchEvent(EWK_TOUCH_MOVE); - return JSValueMakeUndefined(context); -} - -static JSValueRef cancelTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 1) - return JSValueMakeUndefined(context); - - int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - if (index < 0 || index >= touchPointList().size()) - return JSValueMakeUndefined(context); - - touchPointList().at(index).state = EWK_TOUCH_POINT_CANCELLED; - return JSValueMakeUndefined(context); -} - -static JSValueRef touchCancelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - sendTouchEvent(EWK_TOUCH_CANCEL); - return JSValueMakeUndefined(context); -} - -static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 1) - return JSValueMakeUndefined(context); - - int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - if (index < 0 || index >= touchPointList().size()) - return JSValueMakeUndefined(context); - - touchPointList().at(index).state = EWK_TOUCH_POINT_RELEASED; - return JSValueMakeUndefined(context); -} - -static JSValueRef touchEndCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - sendTouchEvent(EWK_TOUCH_END); - touchModifiers = 0; - return JSValueMakeUndefined(context); -} - -static JSValueRef clearTouchPointsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - touchPointList().clear(); - return JSValueMakeUndefined(context); -} - -static JSValueRef setTouchModifierCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount != 2) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> jsModifier(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - unsigned mask = 0; - - if (equals(jsModifier, "alt")) - mask |= ECORE_EVENT_MODIFIER_ALT; - else if (equals(jsModifier, "ctrl")) - mask |= ECORE_EVENT_MODIFIER_CTRL; - else if (equals(jsModifier, "meta")) - mask |= ECORE_EVENT_MODIFIER_WIN; - else if (equals(jsModifier, "shift")) - mask |= ECORE_EVENT_MODIFIER_SHIFT; - - if (JSValueToBoolean(context, arguments[1])) - touchModifiers |= mask; - else - touchModifiers &= ~mask; - - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scheduleAsynchronousKeyDown", scheduleAsynchronousKeyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "addTouchPoint", addTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchStart", touchStartCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "updateTouchPoint", updateTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchMove", touchMoveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "releaseTouchPoint", releaseTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchEnd", touchEndCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "cancelTouchPoint", cancelTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "touchCancel", touchCancelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "clearTouchPoints", clearTouchPointsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "setTouchModifier", setTouchModifierCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticValues[] = { - { 0, 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef eventSenderClass = 0; - - if (!eventSenderClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticFunctions; - classDefinition.staticValues = staticValues; - - eventSenderClass = JSClassCreate(&classDefinition); - } - - return eventSenderClass; -} - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame) -{ - if (isTopFrame) { - gDragMode = true; - - // Fly forward in time one second when the main frame loads. This will - // ensure that when a test begins clicking in the same location as - // a previous test, those clicks won't be interpreted as continuations - // of the previous test's click sequences. - gTimeOffset += 1000; - - gLastMousePositionX = gLastMousePositionY = 0; - gLastClickPositionX = gLastClickPositionY = 0; - gLastClickTimeOffset = 0; - gLastClickButton = 0; - gButtonCurrentlyDown = 0; - gClickCount = 0; - } - - return JSObjectMake(context, getClass(context), 0); -} - -static void feedOrQueueMouseEvent(MouseEventInfo* eventInfo, EventQueueStrategy strategy) -{ - if (!delayedEventQueue().isEmpty()) { - if (delayedEventQueue().last().eventInfo) - delayedEventQueue().append(DelayedEvent(eventInfo)); - else - delayedEventQueue().last().eventInfo = eventInfo; - - if (strategy == FeedQueuedEvents) - feedQueuedMouseEvents(); - } else - feedMouseEvent(eventInfo); -} - -static void feedMouseEvent(MouseEventInfo* eventInfo) -{ - if (!eventInfo) - return; - - unsigned timeStamp = 0; - Evas_Object* mainFrame = browser->mainFrame(); - Evas* evas = evas_object_evas_get(mainFrame); - EvasMouseEvent event = eventInfo->event; - - setEvasModifiers(evas, eventInfo->modifiers); - - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - // FIXME: We need to pass additional information with our events, so that - // we could construct correct PlatformWheelEvent. At the moment, max number - // of clicks is 3 - if (gClickCount == 3) - flags = EVAS_BUTTON_TRIPLE_CLICK; - else if (gClickCount == 2) - flags = EVAS_BUTTON_DOUBLE_CLICK; - - if (event & EvasMouseEventMove) - evas_event_feed_mouse_move(evas, gLastMousePositionX, gLastMousePositionY, timeStamp++, 0); - if (event & EvasMouseEventDown) - evas_event_feed_mouse_down(evas, eventInfo->button, flags, timeStamp++, 0); - if (event & EvasMouseEventUp) - evas_event_feed_mouse_up(evas, eventInfo->button, flags, timeStamp++, 0); - if (event & EvasMouseEventScrollLeft | event & EvasMouseEventScrollRight) - evas_event_feed_mouse_wheel(evas, 1, eventInfo->horizontalDelta, timeStamp, 0); - if (event & EvasMouseEventScrollUp | event & EvasMouseEventScrollDown) - evas_event_feed_mouse_wheel(evas, 0, eventInfo->verticalDelta, timeStamp, 0); - - setEvasModifiers(evas, EvasKeyModifierNone); - - delete eventInfo; -} - -static void feedQueuedMouseEvents() -{ - WTF::Vector<DelayedEvent>::const_iterator it = delayedEventQueue().begin(); - for (; it != delayedEventQueue().end(); it++) { - DelayedEvent delayedEvent = *it; - if (delayedEvent.delay) - usleep(delayedEvent.delay * 1000); - feedMouseEvent(delayedEvent.eventInfo); - } - delayedEventQueue().clear(); -} diff --git a/Tools/DumpRenderTree/efl/EventSender.h b/Tools/DumpRenderTree/efl/EventSender.h deleted file mode 100644 index bded6552d..000000000 --- a/Tools/DumpRenderTree/efl/EventSender.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * Copyright (C) 2009 Holger Hans Peter Freyther - * 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. - */ - -#ifndef EventSender_h -#define EventSender_h - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -// The boolean parameter refers to whether this is being called from a top-level frame. -JSObjectRef makeEventSender(JSContextRef, bool); - -#endif // EventSender_h diff --git a/Tools/DumpRenderTree/efl/FontManagement.cpp b/Tools/DumpRenderTree/efl/FontManagement.cpp deleted file mode 100644 index eee26d141..000000000 --- a/Tools/DumpRenderTree/efl/FontManagement.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * Copyright (C) 2012 Intel Corporation. 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 "config.h" -#include "FontManagement.h" - -#include <Ecore_File.h> -#include <cstdio> -#include <fontconfig/fontconfig.h> -#include <wtf/Vector.h> -#include <wtf/text/CString.h> -#include <wtf/text/StringBuilder.h> - -static CString buildPath(const char* base, const char* first, ...) -{ - va_list ap; - StringBuilder result; - result.append(base); - - if (const char* current = first) { - va_start(ap, first); - do { - result.append('/'); - result.append(current); - } while ((current = va_arg(ap, const char*))); - va_end(ap); - } - - return result.toString().utf8(); -} - -static Vector<CString> getCoreFontFiles() -{ - Vector<CString> fontFilePaths; - - // Ahem is used by many layout tests. - fontFilePaths.append(CString(FONTS_CONF_DIR "/AHEM____.TTF")); - // A font with no valid Fontconfig encoding to test https://bugs.webkit.org/show_bug.cgi?id=47452 - fontFilePaths.append(CString(FONTS_CONF_DIR "/FontWithNoValidEncoding.fon")); - - for (int i = 1; i <= 9; i++) { - char fontPath[EINA_PATH_MAX]; - snprintf(fontPath, EINA_PATH_MAX - 1, FONTS_CONF_DIR "/../../fonts/WebKitWeightWatcher%i00.ttf", i); - fontFilePaths.append(CString(fontPath)); - } - - return fontFilePaths; -} - -static void addFontDirectory(const CString& fontDirectory, FcConfig* config) -{ - const char* fontPath = fontDirectory.data(); - if (!fontPath || !FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(fontPath))) - fprintf(stderr, "Could not add font directory %s!\n", fontPath); -} - -static void addFontFiles(const Vector<CString>& fontFiles, FcConfig* config) -{ - Vector<CString>::const_iterator it, end = fontFiles.end(); - for (it = fontFiles.begin(); it != end; ++it) { - const char* filePath = (*it).data(); - if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(filePath))) - fprintf(stderr, "Could not load font at %s!\n", filePath); - } -} - -static CString getCustomBuildDir() -{ - if (const char* userChosenBuildDir = getenv("WEBKIT_OUTPUTDIR")) { - if (ecore_file_is_dir(userChosenBuildDir)) - return userChosenBuildDir; - fprintf(stderr, "WEBKIT_OUTPUTDIR set to '%s', but path doesn't exist.\n", userChosenBuildDir); - } - - return CString(); -} - -static CString getPlatformFontsPath() -{ - CString customBuildDir = getCustomBuildDir(); - if (!customBuildDir.isNull()) { - CString fontsPath = buildPath(customBuildDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", 0); - if (!ecore_file_exists(fontsPath.data())) - fprintf(stderr, "WEBKIT_OUTPUTDIR set to '%s', but could not local test fonts.\n", customBuildDir.data()); - return fontsPath; - } - - CString fontsPath = CString(DOWNLOADED_FONTS_DIR); - if (ecore_file_exists(fontsPath.data())) - return fontsPath; - - fprintf(stderr, "Could not locate tests fonts, try setting WEBKIT_OUTPUTDIR.\n"); - return CString(); -} - -void addFontsToEnvironment() -{ - FcInit(); - - // Load our configuration file, which sets up proper aliases for family - // names like sans, serif and monospace. - FcConfig* config = FcConfigCreate(); - const char* fontConfigFilename = FONTS_CONF_DIR "/fonts.conf"; - if (!FcConfigParseAndLoad(config, reinterpret_cast<const FcChar8*>(fontConfigFilename), true)) { - fprintf(stderr, "Couldn't load font configuration file from: %s\n", fontConfigFilename); - exit(1); - } - - addFontFiles(getCoreFontFiles(), config); - addFontDirectory(getPlatformFontsPath(), config); - - if (!FcConfigSetCurrent(config)) { - fprintf(stderr, "Could not set the current font configuration!\n"); - exit(1); - } -} - diff --git a/Tools/DumpRenderTree/efl/FontManagement.h b/Tools/DumpRenderTree/efl/FontManagement.h deleted file mode 100644 index d497513ae..000000000 --- a/Tools/DumpRenderTree/efl/FontManagement.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - * - * 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. - */ - -#ifndef FontManagement_h -#define FontManagement_h - -void addFontsToEnvironment(); - -#endif // FontManagement_h diff --git a/Tools/DumpRenderTree/efl/GCControllerEfl.cpp b/Tools/DumpRenderTree/efl/GCControllerEfl.cpp deleted file mode 100644 index 1f55a5ce6..000000000 --- a/Tools/DumpRenderTree/efl/GCControllerEfl.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "GCController.h" - -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "ewk_private.h" - -void GCController::collect() const -{ - DumpRenderTreeSupportEfl::garbageCollectorCollect(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - DumpRenderTreeSupportEfl::garbageCollectorCollectOnAlternateThread(waitUntilDone); -} - -size_t GCController::getJSObjectCount() const -{ - return DumpRenderTreeSupportEfl::javaScriptObjectsCount(); -} diff --git a/Tools/DumpRenderTree/efl/JSStringUtils.cpp b/Tools/DumpRenderTree/efl/JSStringUtils.cpp deleted file mode 100644 index 19ca55736..000000000 --- a/Tools/DumpRenderTree/efl/JSStringUtils.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT - * HOLDERS 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 "JSStringUtils.h" - -bool equals(JSStringRef jsString, const char* cString) -{ - return JSStringIsEqualToUTF8CString(jsString, cString); -} - -bool equals(JSRetainPtr<JSStringRef> jsString, const char* cString) -{ - return equals(jsString.get(), cString); -} diff --git a/Tools/DumpRenderTree/efl/JSStringUtils.h b/Tools/DumpRenderTree/efl/JSStringUtils.h deleted file mode 100644 index 04d7e0812..000000000 --- a/Tools/DumpRenderTree/efl/JSStringUtils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT - * HOLDERS 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 JSStringUtils_h -#define JSStringUtils_h - -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> - -bool equals(JSStringRef, const char*); -bool equals(JSRetainPtr<JSStringRef>, const char*); - -#endif // JSStringUtils_h - diff --git a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp deleted file mode 100644 index 241903988..000000000 --- a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp +++ /dev/null @@ -1,97 +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 - * Copyright (C) 2012 Intel Corporation. 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 "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" -#include "IntRect.h" -#include "PixelDumpSupportCairo.h" -#include "RefPtrCairo.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "ewk_view.h" - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool drawSelectionRect) -{ - Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(browser->mainView())); - Ewk_View_Private_Data* privateData = static_cast<Ewk_View_Private_Data*>(smartData->_priv); - const Evas_Object* mainFrame = browser->mainFrame(); - - int x, y, width, height; - evas_object_geometry_get(browser->mainFrame(), &x, &y, &width, &height); - const Eina_Rectangle rect = { x, y, width, height }; - - RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect.w, rect.h)); - RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get())); - - if (!ewk_view_paint(privateData, context.get(), &rect)) - return 0; - - if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) { - cairo_push_group(context.get()); - - // Paint the gray mask over the original image. - cairo_set_source_rgba(context.get(), 0, 0, 0, 0.66); - cairo_paint(context.get()); - - // Paint transparent rectangles over the mask to show the repainted regions. - cairo_set_source_rgba(context.get(), 0, 0, 0, 0); - cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE); - - Eina_List* repaintRects = DumpRenderTreeSupportEfl::trackedRepaintRects(mainFrame); - void* iter = 0; - EINA_LIST_FREE(repaintRects, iter) { - Eina_Rectangle* rect = static_cast<Eina_Rectangle*>(iter); - - cairo_rectangle(context.get(), rect->x, rect->y, rect->w, rect->h); - cairo_fill(context.get()); - - eina_rectangle_free(rect); - } - - cairo_pop_group_to_source(context.get()); - cairo_paint(context.get()); - } - - if (drawSelectionRect) { - const WebCore::IntRect selectionRect = DumpRenderTreeSupportEfl::selectionRectangle(mainFrame); - - if (!selectionRect.isEmpty()) { - cairo_set_line_width(context.get(), 1.0); - cairo_rectangle(context.get(), selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height()); - cairo_set_source_rgba(context.get(), 1.0, 0.0, 0.0, 1.0); - cairo_stroke(context.get()); - } - } - - return BitmapContext::createByAdoptingBitmapAndContext(0, context.release().leakRef()); -} diff --git a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp b/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp deleted file mode 100644 index 9f66e95e9..000000000 --- a/Tools/DumpRenderTree/efl/TestRunnerEfl.cpp +++ /dev/null @@ -1,850 +0,0 @@ -/* - * Copyright (C) 2007, 2012 Apple Inc. All rights reserved. - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * Copyright (C) 2008 Nuanti Ltd. - * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com> - * Copyright (C) 2009,2011 Collabora Ltd. - * Copyright (C) 2010 Joone Hur <joone@kldp.org> - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * Copyright (C) 2012 Intel Corporation - * - * 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 "DumpRenderTreeChrome.h" -#include "JSStringUtils.h" -#include "NotImplemented.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include "ewk_private.h" -#include <EWebKit.h> -#include <Ecore_File.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/OpaqueJSString.h> -#include <KURL.h> -#include <editing/FindOptions.h> -#include <stdio.h> -#include <wtf/text/WTFString.h> - -// Same as Mac cache model enum in Source/WebKit/mac/WebView/WebPreferences.h. -enum { - WebCacheModelDocumentViewer = 0, - WebCacheModelDocumentBrowser = 1, - WebCacheModelPrimaryWebBrowser = 2 -}; - -TestRunner::~TestRunner() -{ -} - -void TestRunner::addDisallowedURL(JSStringRef) -{ - notImplemented(); -} - -void TestRunner::clearBackForwardList() -{ - Ewk_History* history = ewk_view_history_get(browser->mainView()); - if (!history) - return; - - Ewk_History_Item* item = ewk_history_history_item_current_get(history); - ewk_history_clear(history); - ewk_history_history_item_add(history, item); - ewk_history_history_item_set(history, item); - ewk_history_item_free(item); -} - -JSStringRef TestRunner::copyDecodedHostName(JSStringRef) -{ - notImplemented(); - return 0; -} - -JSStringRef TestRunner::copyEncodedHostName(JSStringRef) -{ - notImplemented(); - return 0; -} - -void TestRunner::dispatchPendingLoadRequests() -{ - // FIXME: Implement for testing fix for 6727495 - notImplemented(); -} - -void TestRunner::display() -{ - displayWebView(); -} - -void TestRunner::keepWebHistory() -{ - DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(true); -} - -size_t TestRunner::webHistoryItemCount() -{ - const Ewk_History* history = ewk_view_history_get(browser->mainView()); - if (!history) - return -1; - - return ewk_history_back_list_length(history) + ewk_history_forward_list_length(history); -} - -void TestRunner::notifyDone() -{ - if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) - dump(); - m_waitToDump = false; - waitForPolicy = false; -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url) -{ - String requestedUrl(url->characters(), url->length()); - String resourceRoot; - String requestedRoot; - - if (requestedUrl.find("LayoutTests") != notFound) { - // If the URL contains LayoutTests we need to remap that to - // LOCAL_RESOURCE_ROOT which is the path of the LayoutTests directory - // within the WebKit source tree. - requestedRoot = "/tmp/LayoutTests"; - resourceRoot = getenv("LOCAL_RESOURCE_ROOT"); - } else if (requestedUrl.find("tmp") != notFound) { - // If the URL is a child of /tmp we need to convert it to be a child - // DUMPRENDERTREE_TEMP replace tmp with DUMPRENDERTREE_TEMP - requestedRoot = "/tmp"; - resourceRoot = getenv("DUMPRENDERTREE_TEMP"); - } - - size_t indexOfRootStart = requestedUrl.reverseFind(requestedRoot); - size_t indexOfSeparatorAfterRoot = indexOfRootStart + requestedRoot.length(); - String fullPathToUrl = "file://" + resourceRoot + requestedUrl.substring(indexOfSeparatorAfterRoot); - - return JSStringCreateWithUTF8CString(fullPathToUrl.utf8().data()); -} - -void TestRunner::queueLoad(JSStringRef url, JSStringRef target) -{ - WebCore::KURL baseURL(WebCore::KURL(), String::fromUTF8(ewk_frame_uri_get(browser->mainFrame()))); - WebCore::KURL absoluteURL(baseURL, url->string()); - - JSRetainPtr<JSStringRef> jsAbsoluteURL( - Adopt, JSStringCreateWithUTF8CString(absoluteURL.string().utf8().data())); - - WorkQueue::shared()->queue(new LoadItem(jsAbsoluteURL.get(), target)); -} - -void TestRunner::setAcceptsEditing(bool acceptsEditing) -{ - ewk_view_editable_set(browser->mainView(), acceptsEditing); -} - -void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - ewk_cookies_policy_set(alwaysAcceptCookies ? EWK_COOKIE_JAR_ACCEPT_ALWAYS : EWK_COOKIE_JAR_ACCEPT_NEVER); -} - -void TestRunner::setCustomPolicyDelegate(bool enabled, bool permissive) -{ - policyDelegateEnabled = enabled; - policyDelegatePermissive = permissive; -} - -void TestRunner::waitForPolicyDelegate() -{ - setCustomPolicyDelegate(true, false); - waitForPolicy = true; - setWaitToDump(true); -} - -void TestRunner::setScrollbarPolicy(JSStringRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) -{ - WebCore::KURL kurl; - kurl.setProtocol(String(protocol->characters(), protocol->length())); - kurl.setHost(String(host->characters(), host->length())); - - ewk_security_policy_whitelist_origin_add(sourceOrigin->string().utf8().data(), kurl.string().utf8().data(), includeSubdomains); -} - -void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) -{ - WebCore::KURL kurl; - kurl.setProtocol(String(protocol->characters(), protocol->length())); - kurl.setHost(String(host->characters(), host->length())); - - ewk_security_policy_whitelist_origin_del(sourceOrigin->string().utf8().data(), kurl.string().utf8().data(), includeSubdomains); -} - -void TestRunner::setMainFrameIsFirstResponder(bool) -{ - notImplemented(); -} - -void TestRunner::setTabKeyCyclesThroughElements(bool) -{ - notImplemented(); -} - -void TestRunner::setUseDashboardCompatibilityMode(bool) -{ - notImplemented(); -} - -static CString gUserStyleSheet; -static bool gUserStyleSheetEnabled = true; - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ - gUserStyleSheetEnabled = flag; - ewk_view_setting_user_stylesheet_set(browser->mainView(), flag ? gUserStyleSheet.data() : 0); -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef path) -{ - gUserStyleSheet = path->string().utf8(); - - if (gUserStyleSheetEnabled) - setUserStyleSheetEnabled(true); -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) -{ - DumpRenderTreeSupportEfl::setValueForUser(context, nodeObject, value->string()); -} - -void TestRunner::setViewModeMediaFeature(JSStringRef mode) -{ -#if ENABLE(VIEW_MODE_CSS_MEDIA) - Evas_Object* view = browser->mainView(); - if (!view) - return; - - if (equals(mode, "windowed")) - ewk_view_mode_set(view, EWK_VIEW_MODE_WINDOWED); - else if (equals(mode, "floating")) - ewk_view_mode_set(view, EWK_VIEW_MODE_FLOATING); - else if (equals(mode, "fullscreen")) - ewk_view_mode_set(view, EWK_VIEW_MODE_FULLSCREEN); - else if (equals(mode, "maximized")) - 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) -{ - notImplemented(); -} - -static Eina_Bool waitToDumpWatchdogFired(void*) -{ - waitToDumpWatchdog = 0; - gTestRunner->waitToDumpWatchdogTimerFired(); - return ECORE_CALLBACK_CANCEL; -} - -void TestRunner::setWaitToDump(bool waitUntilDone) -{ - static const double timeoutSeconds = 30; - - m_waitToDump = waitUntilDone; - if (m_waitToDump && shouldSetWaitToDumpWatchdog()) - waitToDumpWatchdog = ecore_timer_add(timeoutSeconds, waitToDumpWatchdogFired, 0); -} - -int TestRunner::windowCount() -{ - return browser->extraViews().size() + 1; // + 1 for the main view. -} - -void TestRunner::setPrivateBrowsingEnabled(bool flag) -{ - ewk_view_setting_private_browsing_set(browser->mainView(), flag); -} - -void TestRunner::setJavaScriptCanAccessClipboard(bool flag) -{ - ewk_view_setting_scripts_can_access_clipboard_set(browser->mainView(), flag); -} - -void TestRunner::setXSSAuditorEnabled(bool flag) -{ - ewk_view_setting_enable_xss_auditor_set(browser->mainView(), flag); -} - -void TestRunner::setSpatialNavigationEnabled(bool flag) -{ - ewk_view_setting_spatial_navigation_set(browser->mainView(), flag); -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(bool flag) -{ - ewk_view_setting_allow_universal_access_from_file_urls_set(browser->mainView(), flag); -} - -void TestRunner::setAllowFileAccessFromFileURLs(bool flag) -{ - ewk_view_setting_allow_file_access_from_file_urls_set(browser->mainView(), flag); -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool flag) -{ - DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(browser->mainView(), flag); -} - -void TestRunner::setMockDeviceOrientation(bool, double, bool, double, bool, double) -{ - // FIXME: Implement for DeviceOrientation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=30335. - notImplemented(); -} - -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool canProvideAltitude, double altitude, bool canProvideAltitudeAccuracy, double altitudeAccuracy, bool canProvideHeading, double heading, bool canProvideSpeed, double speed) -{ - Evas_Object* view = browser->mainView(); - if (browser->extraViews().size() > 0) - view = browser->extraViews().last(); - - DumpRenderTreeSupportEfl::setMockGeolocationPosition(view, latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed); -} - -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) -{ - Evas_Object* view = browser->mainView(); - if (browser->extraViews().size() > 0) - view = browser->extraViews().last(); - - DumpRenderTreeSupportEfl::setMockGeolocationPositionUnavailableError(view, message->string().utf8().data()); -} - -void TestRunner::setGeolocationPermission(bool allow) -{ - setGeolocationPermissionCommon(allow); - Evas_Object* view = browser->mainView(); - if (browser->extraViews().size() > 0) - view = browser->extraViews().last(); - - DumpRenderTreeSupportEfl::setMockGeolocationPermission(view, allow); -} - -int TestRunner::numberOfPendingGeolocationPermissionRequests() -{ - Evas_Object* view = browser->mainView(); - if (browser->extraViews().size() > 0) - view = browser->extraViews().last(); - - return DumpRenderTreeSupportEfl::numberOfPendingGeolocationPermissionRequests(view); -} - -void TestRunner::addMockSpeechInputResult(JSStringRef, double, JSStringRef) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. - notImplemented(); -} - -void TestRunner::setMockSpeechInputDumpRect(bool) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. - notImplemented(); -} - -void TestRunner::startSpeechInput(JSContextRef inputElement) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. - notImplemented(); -} - -void TestRunner::setIconDatabaseEnabled(bool enabled) -{ - ewk_settings_icon_database_path_set(0); - - if (!enabled) - return; - - String databasePath; - const char* tempDir = getenv("TMPDIR"); - - if (tempDir) - databasePath = String::fromUTF8(tempDir); - else if (tempDir = getenv("TEMP")) - databasePath = String::fromUTF8(tempDir); - else - databasePath = String::fromUTF8("/tmp"); - - databasePath.append("/DumpRenderTree/IconDatabase"); - - if (ecore_file_mkpath(databasePath.utf8().data())) - ewk_settings_icon_database_path_set(databasePath.utf8().data()); -} - -void TestRunner::setPopupBlockingEnabled(bool flag) -{ - ewk_view_setting_scripts_can_open_windows_set(browser->mainView(), !flag); -} - -void TestRunner::setPluginsEnabled(bool flag) -{ - ewk_view_setting_enable_plugins_set(browser->mainView(), flag); -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - DumpRenderTreeSupportEfl::executeCoreCommandByName(browser->mainView(), name->string().utf8().data(), value->string().utf8().data()); -} - -bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) -{ - JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); - JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); - if (!JSValueIsNumber(context, lengthValue)) - return false; - - WebCore::FindOptions options = 0; - - const size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); - for (size_t i = 0; i < length; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0); - if (!JSValueIsString(context, value)) - continue; - - JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0)); - - if (equals(optionName, "CaseInsensitive")) - options |= WebCore::CaseInsensitive; - else if (equals(optionName, "AtWordStarts")) - options |= WebCore::AtWordStarts; - else if (equals(optionName, "TreatMedialCapitalAsWordStart")) - options |= WebCore::TreatMedialCapitalAsWordStart; - else if (equals(optionName, "Backwards")) - options |= WebCore::Backwards; - else if (equals(optionName, "WrapAround")) - options |= WebCore::WrapAround; - else if (equals(optionName, "StartInSelection")) - options |= WebCore::StartInSelection; - } - - return DumpRenderTreeSupportEfl::findString(browser->mainView(), target->string(), options); -} - -bool TestRunner::isCommandEnabled(JSStringRef name) -{ - return DumpRenderTreeSupportEfl::isCommandEnabled(browser->mainView(), name->string().utf8().data()); -} - -void TestRunner::setCacheModel(int cacheModel) -{ - unsigned int cacheTotalCapacity; - unsigned int cacheMinDeadCapacity; - unsigned int cacheMaxDeadCapacity; - double deadDecodedDataDeletionInterval; - unsigned int pageCacheCapacity; - - // These constants are derived from the Mac cache model enum in Source/WebKit/mac/WebView/WebPreferences.h. - switch (cacheModel) { - case WebCacheModelDocumentViewer: - pageCacheCapacity = 0; - cacheTotalCapacity = 0; - cacheMinDeadCapacity = 0; - cacheMaxDeadCapacity = 0; - deadDecodedDataDeletionInterval = 0; - break; - case WebCacheModelDocumentBrowser: - pageCacheCapacity = 2; - cacheTotalCapacity = 16 * 1024 * 1024; - cacheMinDeadCapacity = cacheTotalCapacity / 8; - cacheMaxDeadCapacity = cacheTotalCapacity / 4; - deadDecodedDataDeletionInterval = 0; - break; - case WebCacheModelPrimaryWebBrowser: - pageCacheCapacity = 3; - cacheTotalCapacity = 32 * 1024 * 1024; - cacheMinDeadCapacity = cacheTotalCapacity / 4; - cacheMaxDeadCapacity = cacheTotalCapacity / 2; - deadDecodedDataDeletionInterval = 60; - break; - default: - fprintf(stderr, "trying to set an invalid value %d for the Cache model.", cacheModel); - return; - } - - ewk_settings_object_cache_capacity_set(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); - DumpRenderTreeSupportEfl::setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); - ewk_settings_page_cache_capacity_set(pageCacheCapacity); -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef) -{ - notImplemented(); -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - notImplemented(); -} - -void TestRunner::clearAllApplicationCaches() -{ - ewk_settings_application_cache_clear(); -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) -{ - Ewk_Security_Origin* origin = ewk_frame_security_origin_get(browser->mainFrame()); - ewk_security_origin_application_cache_quota_set(origin, quota); - ewk_security_origin_free(origin); -} - -void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString* url) -{ - Ewk_Security_Origin* origin = ewk_security_origin_new_from_string(url->string().utf8().data()); - ewk_security_origin_application_cache_clear(origin); - ewk_security_origin_free(origin); -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef) -{ - // FIXME: Implement to support getting disk usage in bytes for an origin. - notImplemented(); - return 0; -} - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - // FIXME: Implement to get origins that contain application caches. - notImplemented(); - return JSValueMakeUndefined(context); -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef) -{ - notImplemented(); - return 0; -} - -void TestRunner::clearAllDatabases() -{ - ewk_web_database_remove_all(); -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - Ewk_Security_Origin* origin = ewk_frame_security_origin_get(browser->mainFrame()); - ewk_security_origin_web_database_quota_set(origin, quota); - ewk_security_origin_free(origin); -} - -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - notImplemented(); - return JSValueMakeUndefined(context); -} - -void TestRunner::deleteAllLocalStorage() -{ - notImplemented(); -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef) -{ - notImplemented(); -} - -void TestRunner::observeStorageTrackerNotifications(unsigned) -{ - notImplemented(); -} - -void TestRunner::syncLocalStorage() -{ - notImplemented(); -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) -{ - DumpRenderTreeSupportEfl::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme->string()); -} - -void TestRunner::goBack() -{ - ewk_frame_back(browser->mainFrame()); -} - -void TestRunner::setDefersLoading(bool defers) -{ - DumpRenderTreeSupportEfl::setDefersLoading(browser->mainView(), defers); -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long size) -{ - ewk_settings_application_cache_max_quota_set(size); -} - -static inline bool toBool(JSStringRef value) -{ - return equals(value, "true") || equals(value, "1"); -} - -static inline int toInt(JSStringRef value) -{ - return atoi(value->string().utf8().data()); -} - -void TestRunner::overridePreference(JSStringRef key, JSStringRef value) -{ - if (equals(key, "WebKitJavaScriptEnabled")) - ewk_view_setting_enable_scripts_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitDefaultFontSize")) - ewk_view_setting_font_default_size_set(browser->mainView(), toInt(value)); - else if (equals(key, "WebKitMinimumFontSize")) - ewk_view_setting_font_minimum_size_set(browser->mainView(), toInt(value)); - else if (equals(key, "WebKitPluginsEnabled")) - ewk_view_setting_enable_plugins_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitWebGLEnabled")) - ewk_view_setting_enable_webgl_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitEnableCaretBrowsing")) - ewk_view_setting_caret_browsing_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitUsesPageCachePreferenceKey")) - ewk_view_setting_page_cache_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitHyperlinkAuditingEnabled")) - ewk_view_setting_enable_hyperlink_auditing_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitTabToLinksPreferenceKey")) - ewk_view_setting_include_links_in_focus_chain_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitOfflineWebApplicationCacheEnabled")) - ewk_view_setting_application_cache_set(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitLoadSiteIconsKey")) - DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitCSSGridLayoutEnabled")) - DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitCSSRegionsEnabled")) - DumpRenderTreeSupportEfl::setCSSRegionsEnabled(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitWebAudioEnabled")) - DumpRenderTreeSupportEfl::setWebAudioEnabled(browser->mainView(), toBool(value)); - else if (equals(key, "WebKitDisplayImagesKey")) - ewk_view_setting_auto_load_images_set(browser->mainView(), toBool(value)); - else - fprintf(stderr, "TestRunner::overridePreference tried to override unknown preference '%s'.\n", value->string().utf8().data()); -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - DumpRenderTreeSupportEfl::addUserScript(browser->mainView(), source->string(), runAtStart, allFrames); -} - -void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) -{ - DumpRenderTreeSupportEfl::addUserStyleSheet(browser->mainView(), source->string(), allFrames); -} - -void TestRunner::setDeveloperExtrasEnabled(bool enabled) -{ - ewk_view_setting_enable_developer_extras_set(browser->mainView(), enabled); -} - -void TestRunner::showWebInspector() -{ - ewk_view_inspector_show(browser->mainView()); - browser->waitInspectorLoadFinished(); -} - -void TestRunner::closeWebInspector() -{ - ewk_view_inspector_close(browser->mainView()); -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - DumpRenderTreeSupportEfl::evaluateInWebInspector(browser->mainView(), callId, script->string()); -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned, JSObjectRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(browser->mainFrame(), worldID, globalObject, script->string()); -} - -void TestRunner::removeAllVisitedLinks() -{ - Ewk_History* history = ewk_view_history_get(browser->mainView()); - if (!history) - return; - - ewk_history_clear(history); -} - -bool TestRunner::callShouldCloseOnWebView() -{ - return DumpRenderTreeSupportEfl::callShouldCloseOnWebView(browser->mainFrame()); -} - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - notImplemented(); -} - -void TestRunner::setWebViewEditable(bool) -{ - ewk_frame_editable_set(browser->mainFrame(), EINA_TRUE); -} - -void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ - notImplemented(); -} - -void TestRunner::abortModal() -{ - notImplemented(); -} - -void TestRunner::setSerializeHTTPLoads(bool serialize) -{ - DumpRenderTreeSupportEfl::setSerializeHTTPLoads(serialize); -} - -void TestRunner::setTextDirection(JSStringRef direction) -{ - Ewk_Text_Direction ewkDirection; - if (JSStringIsEqualToUTF8CString(direction, "auto")) - ewkDirection = EWK_TEXT_DIRECTION_DEFAULT; - else if (JSStringIsEqualToUTF8CString(direction, "rtl")) - ewkDirection = EWK_TEXT_DIRECTION_RIGHT_TO_LEFT; - else if (JSStringIsEqualToUTF8CString(direction, "ltr")) - ewkDirection = EWK_TEXT_DIRECTION_LEFT_TO_RIGHT; - else { - fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", direction->string().utf8().data()); - return; - } - - ewk_view_text_direction_set(browser->mainView(), ewkDirection); -} - -void TestRunner::addChromeInputField() -{ - notImplemented(); -} - -void TestRunner::removeChromeInputField() -{ - notImplemented(); -} - -void TestRunner::focusWebView() -{ - notImplemented(); -} - -void TestRunner::setBackingScaleFactor(double) -{ - notImplemented(); -} - -void TestRunner::grantWebNotificationPermission(JSStringRef origin) -{ -} - -void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) -{ -} - -void TestRunner::removeAllWebNotificationPermissions() -{ -} - -void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) -{ -} - -void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) -{ -} - -void TestRunner::resetPageVisibility() -{ - ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, true); -} - -void TestRunner::setPageVisibility(const char* visibility) -{ - String newVisibility(visibility); - if (newVisibility == "visible") - ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false); - else if (newVisibility == "hidden") - 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 == "unloaded") - ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_UNLOADED, false); -} - -void TestRunner::setAutomaticLinkDetectionEnabled(bool) -{ - notImplemented(); -} - -void TestRunner::setStorageDatabaseIdleInterval(double) -{ - notImplemented(); -} - -void TestRunner::closeIdleLocalStorageDatabases() -{ - notImplemented(); -} - -JSRetainPtr<JSStringRef> TestRunner::platformName() const -{ - JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("efl")); - return platformName; -} diff --git a/Tools/DumpRenderTree/efl/TextInputController.cpp b/Tools/DumpRenderTree/efl/TextInputController.cpp deleted file mode 100644 index 62b6d6be8..000000000 --- a/Tools/DumpRenderTree/efl/TextInputController.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2011 Igalia S.L. - * Copyright (C) 2012 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. - * - * 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 "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" -#include "WebCoreSupport/DumpRenderTreeSupportEfl.h" -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/OpaqueJSString.h> - -static JSValueRef setMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView() || argumentCount < 3) - return JSValueMakeUndefined(context); - - JSStringRef string = JSValueToStringCopy(context, arguments[0], exception); - - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string); - char* text = new char[bufferSize]; - JSStringGetUTF8CString(string, text, bufferSize); - JSStringRelease(string); - - int start = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - int length = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); - - DumpRenderTreeSupportEfl::setComposition(browser->mainView(), text, start, length); - - delete[] text; - return JSValueMakeUndefined(context); -} - -static JSValueRef hasMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView()) - return JSValueMakeUndefined(context); - - return JSValueMakeBoolean(context, DumpRenderTreeSupportEfl::hasComposition(browser->mainView())); -} - -static JSValueRef markedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView()) - return JSValueMakeUndefined(context); - - int start, length; - if (!DumpRenderTreeSupportEfl::compositionRange(browser->mainView(), &start, &length)) - return JSValueMakeUndefined(context); - - JSValueRef arrayValues[2]; - arrayValues[0] = JSValueMakeNumber(context, start); - arrayValues[1] = JSValueMakeNumber(context, length); - JSObjectRef arrayObject = JSObjectMakeArray(context, 2, arrayValues, exception); - return arrayObject; -} - -static JSValueRef insertTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView() || argumentCount < 1) - return JSValueMakeUndefined(context); - - JSStringRef string = JSValueToStringCopy(context, arguments[0], exception); - - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string); - char* text = new char[bufferSize]; - JSStringGetUTF8CString(string, text, bufferSize); - JSStringRelease(string); - - DumpRenderTreeSupportEfl::confirmComposition(browser->mainView(), text); - - delete[] text; - return JSValueMakeUndefined(context); -} - -static JSValueRef unmarkTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView()) - return JSValueMakeUndefined(context); - - DumpRenderTreeSupportEfl::confirmComposition(browser->mainView(), 0); - return JSValueMakeUndefined(context); -} - -static JSValueRef firstRectForCharacterRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView() || argumentCount < 2) - return JSValueMakeUndefined(context); - - int location = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - int length = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - - WebCore::IntRect rect = DumpRenderTreeSupportEfl::firstRectForCharacterRange(browser->mainView(), location, length); - - JSValueRef arrayValues[4]; - arrayValues[0] = JSValueMakeNumber(context, rect.x()); - arrayValues[1] = JSValueMakeNumber(context, rect.y()); - arrayValues[2] = JSValueMakeNumber(context, rect.width()); - arrayValues[3] = JSValueMakeNumber(context, rect.height()); - JSObjectRef arrayObject = JSObjectMakeArray(context, 4, arrayValues, exception); - return arrayObject; -} - -static JSValueRef selectedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (!browser->mainView()) - return JSValueMakeUndefined(context); - - int start, length; - if (!DumpRenderTreeSupportEfl::selectedRange(browser->mainView(), &start, &length)) - return JSValueMakeUndefined(context); - - JSValueRef arrayValues[2]; - arrayValues[0] = JSValueMakeNumber(context, start); - arrayValues[1] = JSValueMakeNumber(context, length); - JSObjectRef arrayObject = JSObjectMakeArray(context, 2, arrayValues, exception); - return arrayObject; -} - -static JSStaticFunction staticFunctions[] = { - { "setMarkedText", setMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "hasMarkedText", hasMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "markedRange", markedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "insertText", insertTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "unmarkText", unmarkTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "firstRectForCharacterRange", firstRectForCharacterRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "selectedRange", selectedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef textInputControllerClass = 0; - - if (!textInputControllerClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticFunctions; - - textInputControllerClass = JSClassCreate(&classDefinition); - } - - return textInputControllerClass; -} - -JSObjectRef makeTextInputController(JSContextRef context) -{ - return JSObjectMake(context, getClass(context), 0); -} - diff --git a/Tools/DumpRenderTree/efl/TextInputController.h b/Tools/DumpRenderTree/efl/TextInputController.h deleted file mode 100644 index 5ee271983..000000000 --- a/Tools/DumpRenderTree/efl/TextInputController.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2011 Igalia S.L. - * Copyright (C) 2012 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. - * - * 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 TextInputController_h -#define TextInputController_h - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeTextInputController(JSContextRef); - -#endif diff --git a/Tools/DumpRenderTree/efl/WorkQueueItemEfl.cpp b/Tools/DumpRenderTree/efl/WorkQueueItemEfl.cpp deleted file mode 100644 index 5ffec2969..000000000 --- a/Tools/DumpRenderTree/efl/WorkQueueItemEfl.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2011 ProFUSION Embedded Systems - * Copyright (C) 2011 Samsung Electronics - * - * 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 "config.h" -#include "WorkQueueItem.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeChrome.h" - -#include <EWebKit.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/OpaqueJSString.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -bool LoadItem::invoke() const -{ - Evas_Object* targetFrame; - - if (!m_target->length()) - targetFrame = browser->mainFrame(); - else - targetFrame = ewk_frame_child_find(browser->mainFrame(), m_target->string().utf8().data()); - - ewk_frame_uri_set(targetFrame, m_url->string().utf8().data()); - - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - if (!m_unreachableURL->length()) - ewk_frame_contents_set(browser->mainFrame(), m_content->string().utf8().data(), 0, 0, 0, m_baseURL->string().utf8().data()); - else - ewk_frame_contents_alternate_set(browser->mainFrame(), m_content->string().utf8().data(), 0, 0, 0, m_baseURL->string().utf8().data(), m_unreachableURL->string().utf8().data()); - - return true; -} - -bool ReloadItem::invoke() const -{ - ewk_view_reload(browser->mainView()); - return true; -} - -bool ScriptItem::invoke() const -{ - return ewk_frame_script_execute(browser->mainFrame(), m_script->string().utf8().data()); -} - -bool BackForwardItem::invoke() const -{ - if (m_howFar == 1) - ewk_view_forward(browser->mainView()); - else if (m_howFar == -1) - ewk_view_back(browser->mainView()); - else - ewk_view_navigate(browser->mainView(), m_howFar); - - return true; -} diff --git a/Tools/DumpRenderTree/fonts/SampleFont.sfont b/Tools/DumpRenderTree/fonts/SampleFont.sfont deleted file mode 100644 index d50dfc44d..000000000 --- a/Tools/DumpRenderTree/fonts/SampleFont.sfont +++ /dev/null @@ -1,223 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE PosingFont SYSTEM "file://localhost/System/Library/DTDs/SplicedFont.dtd"> - -<PosingFont name="HiraMaruMono-W4" version="1.0"> - <Name type="1" string="Hiragino Maru Gothic Monospaced" language="en"/> - <Name type="2" string="W4" language="en"/> - <Name type="3" string="Composite Font Reference (Spliced Font) sample using Hiragino Maru Gothic W4 for Monospaced" language="en"/> - <Name type="4" string="Hiragino Maru Gothic Monospaced W4" language="en"/> - <FontMetrics - unitsPerEm="1000" - ascender="561.1" - descender="214.3" - lineGap="21.0" - italicAngle="0.0" - isFixedPitch="1" - vertTypoLineGap="4.2" - familyClass="1" - /> - <Components> - <ComponentDef name="HiraMaruPro-W4"> - <Matrix - xx="1.0" - xy="0.0" - yx="0.0" - yy="1.0" - tx="0.0" - ty="0.0" - /> - <UnicodeCharSet - uset="[[\u0020-\u007E]|[\u00A0-\u00FC]|[\u02BB-\u0336]|[\u2010-\u2044]|[\u2212-\u223C]]" - /> - <cmapOverride> - <map charValue="u0020" charName="SPACE" glyphRefID="231"/> - <map charValue="u0021" charName="EXCLAMATION MARK" glyphRefID="232"/> - <map charValue="u0022" charName="QUOTATION MARK" glyphRefID="12087"/> - <map charValue="u0023" charName="NUMBER SIGN" glyphRefID="234"/> - <map charValue="u0024" charName="DOLLAR SIGN" glyphRefID="235"/> - <map charValue="u0025" charName="PERCENT SIGN" glyphRefID="236"/> - <map charValue="u0026" charName="AMPERSAND" glyphRefID="237"/> - <map charValue="u0027" charName="APOSTROPHE" glyphRefID="12086"/> - <map charValue="u0028" charName="LEFT PARENTHESIS" glyphRefID="239"/> - <map charValue="u0029" charName="RIGHT PARENTHESIS" glyphRefID="240"/> - <map charValue="u002A" charName="ASTERISK" glyphRefID="241"/> - <map charValue="u002B" charName="PLUS SIGN" glyphRefID="242"/> - <map charValue="u002C" charName="COMMA" glyphRefID="243"/> - <map charValue="u002D" charName="HYPHEN-MINUS" glyphRefID="244"/> - <map charValue="u002E" charName="FULL STOP" glyphRefID="245"/> - <map charValue="u002F" charName="SOLIDUS" glyphRefID="246"/> - <map charValue="u0030" charName="DIGIT ZERO" glyphRefID="247"/> - <map charValue="u0031" charName="DIGIT ONE" glyphRefID="248"/> - <map charValue="u0032" charName="DIGIT TWO" glyphRefID="249"/> - <map charValue="u0033" charName="DIGIT THREE" glyphRefID="250"/> - <map charValue="u0034" charName="DIGIT FOUR" glyphRefID="251"/> - <map charValue="u0035" charName="DIGIT FIVE" glyphRefID="252"/> - <map charValue="u0036" charName="DIGIT SIX" glyphRefID="253"/> - <map charValue="u0037" charName="DIGIT SEVEN" glyphRefID="254"/> - <map charValue="u0038" charName="DIGIT EIGHT" glyphRefID="255"/> - <map charValue="u0039" charName="DIGIT NINE" glyphRefID="256"/> - <map charValue="u003A" charName="COLON" glyphRefID="257"/> - <map charValue="u003B" charName="SEMICOLON" glyphRefID="258"/> - <map charValue="u003C" charName="LESS-THAN SIGN" glyphRefID="259"/> - <map charValue="u003D" charName="EQUALS SIGN" glyphRefID="260"/> - <map charValue="u003E" charName="GREATER-THAN SIGN" glyphRefID="261"/> - <map charValue="u003F" charName="QUESTION MARK" glyphRefID="262"/> - <map charValue="u0040" charName="COMMERCIAL AT" glyphRefID="263"/> - <map charValue="u0041" charName="LATIN CAPITAL LETTER A" glyphRefID="264"/> - <map charValue="u0042" charName="LATIN CAPITAL LETTER B" glyphRefID="265"/> - <map charValue="u0043" charName="LATIN CAPITAL LETTER C" glyphRefID="266"/> - <map charValue="u0044" charName="LATIN CAPITAL LETTER D" glyphRefID="267"/> - <map charValue="u0045" charName="LATIN CAPITAL LETTER E" glyphRefID="268"/> - <map charValue="u0046" charName="LATIN CAPITAL LETTER F" glyphRefID="269"/> - <map charValue="u0047" charName="LATIN CAPITAL LETTER G" glyphRefID="270"/> - <map charValue="u0048" charName="LATIN CAPITAL LETTER H" glyphRefID="271"/> - <map charValue="u0049" charName="LATIN CAPITAL LETTER I" glyphRefID="272"/> - <map charValue="u004A" charName="LATIN CAPITAL LETTER J" glyphRefID="273"/> - <map charValue="u004B" charName="LATIN CAPITAL LETTER K" glyphRefID="274"/> - <map charValue="u004C" charName="LATIN CAPITAL LETTER L" glyphRefID="275"/> - <map charValue="u004D" charName="LATIN CAPITAL LETTER M" glyphRefID="276"/> - <map charValue="u004E" charName="LATIN CAPITAL LETTER N" glyphRefID="277"/> - <map charValue="u004F" charName="LATIN CAPITAL LETTER O" glyphRefID="278"/> - <map charValue="u0050" charName="LATIN CAPITAL LETTER P" glyphRefID="279"/> - <map charValue="u0051" charName="LATIN CAPITAL LETTER Q" glyphRefID="280"/> - <map charValue="u0052" charName="LATIN CAPITAL LETTER R" glyphRefID="281"/> - <map charValue="u0053" charName="LATIN CAPITAL LETTER S" glyphRefID="282"/> - <map charValue="u0054" charName="LATIN CAPITAL LETTER T" glyphRefID="283"/> - <map charValue="u0055" charName="LATIN CAPITAL LETTER U" glyphRefID="284"/> - <map charValue="u0056" charName="LATIN CAPITAL LETTER V" glyphRefID="285"/> - <map charValue="u0057" charName="LATIN CAPITAL LETTER W" glyphRefID="286"/> - <map charValue="u0058" charName="LATIN CAPITAL LETTER X" glyphRefID="287"/> - <map charValue="u0059" charName="LATIN CAPITAL LETTER Y" glyphRefID="288"/> - <map charValue="u005A" charName="LATIN CAPITAL LETTER Z" glyphRefID="289"/> - <map charValue="u005B" charName="LEFT SQUARE BRACKET" glyphRefID="290"/> - <map charValue="u005C" charName="REVERSE SOLIDUS" glyphRefID="8719"/> - <map charValue="u005D" charName="RIGHT SQUARE BRACKET" glyphRefID="292"/> - <map charValue="u005E" charName="CIRCUMFLEX ACCENT" glyphRefID="293"/> - <map charValue="u005F" charName="LOW LINE" glyphRefID="294"/> - <map charValue="u0060" charName="GRAVE ACCENT" glyphRefID="390"/> - <map charValue="u0061" charName="LATIN SMALL LETTER A" glyphRefID="296"/> - <map charValue="u0062" charName="LATIN SMALL LETTER B" glyphRefID="297"/> - <map charValue="u0063" charName="LATIN SMALL LETTER C" glyphRefID="298"/> - <map charValue="u0064" charName="LATIN SMALL LETTER D" glyphRefID="299"/> - <map charValue="u0065" charName="LATIN SMALL LETTER E" glyphRefID="300"/> - <map charValue="u0066" charName="LATIN SMALL LETTER F" glyphRefID="301"/> - <map charValue="u0067" charName="LATIN SMALL LETTER G" glyphRefID="302"/> - <map charValue="u0068" charName="LATIN SMALL LETTER H" glyphRefID="303"/> - <map charValue="u0069" charName="LATIN SMALL LETTER I" glyphRefID="304"/> - <map charValue="u006A" charName="LATIN SMALL LETTER J" glyphRefID="305"/> - <map charValue="u006B" charName="LATIN SMALL LETTER K" glyphRefID="306"/> - <map charValue="u006C" charName="LATIN SMALL LETTER L" glyphRefID="307"/> - <map charValue="u006D" charName="LATIN SMALL LETTER M" glyphRefID="308"/> - <map charValue="u006E" charName="LATIN SMALL LETTER N" glyphRefID="309"/> - <map charValue="u006F" charName="LATIN SMALL LETTER O" glyphRefID="310"/> - <map charValue="u0070" charName="LATIN SMALL LETTER P" glyphRefID="311"/> - <map charValue="u0071" charName="LATIN SMALL LETTER Q" glyphRefID="312"/> - <map charValue="u0072" charName="LATIN SMALL LETTER R" glyphRefID="313"/> - <map charValue="u0073" charName="LATIN SMALL LETTER S" glyphRefID="314"/> - <map charValue="u0074" charName="LATIN SMALL LETTER T" glyphRefID="315"/> - <map charValue="u0075" charName="LATIN SMALL LETTER U" glyphRefID="316"/> - <map charValue="u0076" charName="LATIN SMALL LETTER V" glyphRefID="317"/> - <map charValue="u0077" charName="LATIN SMALL LETTER W" glyphRefID="318"/> - <map charValue="u0078" charName="LATIN SMALL LETTER X" glyphRefID="319"/> - <map charValue="u0079" charName="LATIN SMALL LETTER Y" glyphRefID="320"/> - <map charValue="u007A" charName="LATIN SMALL LETTER Z" glyphRefID="321"/> - <map charValue="u007B" charName="LEFT CURLY BRACKET" glyphRefID="322"/> - <map charValue="u007C" charName="VERTICAL LINE" glyphRefID="323"/> - <map charValue="u007D" charName="RIGHT CURLY BRACKET" glyphRefID="324"/> - <map charValue="u007E" charName="TILDE" glyphRefID="631"/> - <map charValue="u00A0" charName="NO-BREAK SPACE" glyphRefID="231"/> - <map charValue="u00A1" charName="INVERTED EXCLAMATION MARK" glyphRefID="612"/> - <map charValue="u00A2" charName="CENT SIGN" glyphRefID="608"/> - <map charValue="u00A3" charName="POUND SIGN" glyphRefID="609"/> - <map charValue="u00A5" charName="YEN SIGN" glyphRefID="291"/> - <map charValue="u00A6" charName="BROKEN BAR" glyphRefID="323"/> - <map charValue="u00A8" charName="DIAERESIS" glyphRefID="502"/> - <map charValue="u00AC" charName="NOT SIGN" glyphRefID="8718"/> - <map charValue="u00AD" charName="SOFT HYPHEN" glyphRefID="514"/> - <map charValue="u00AF" charName="MACRON" glyphRefID="325"/> - <map charValue="u00B4" charName="ACUTE ACCENT" glyphRefID="501"/> - <map charValue="u00B7" charName="MIDDLE DOT" glyphRefID="331"/> - <map charValue="u00BD" charName="VULGAR FRACTION ONE HALF" glyphRefID="614"/> - <map charValue="u00BF" charName="INVERTED QUESTION MARK" glyphRefID="613"/> - <map charValue="u00C4" charName="LATIN CAPITAL LETTER A WITH DIAERESIS" glyphRefID="599"/> - <map charValue="u00C7" charName="LATIN CAPITAL LETTER C WITH CEDILLA" glyphRefID="605"/> - <map charValue="u00D1" charName="LATIN CAPITAL LETTER N WITH TILDE" glyphRefID="606"/> - <map charValue="u00D6" charName="LATIN CAPITAL LETTER O WITH DIAERESIS" glyphRefID="615"/> - <map charValue="u00DC" charName="LATIN CAPITAL LETTER U WITH DIAERESIS" glyphRefID="616"/> - <map charValue="u00DF" charName="LATIN SMALL LETTER SHARP S" glyphRefID="603"/> - <map charValue="u00E0" charName="LATIN SMALL LETTER A WITH GRAVE" glyphRefID="627"/> - <map charValue="u00E1" charName="LATIN SMALL LETTER A WITH ACUTE" glyphRefID="630"/> - <map charValue="u00E2" charName="LATIN SMALL LETTER A WITH CIRCUMFLEX" glyphRefID="622"/> - <map charValue="u00E4" charName="LATIN SMALL LETTER A WITH DIAERESIS" glyphRefID="617"/> - <map charValue="u00E7" charName="LATIN SMALL LETTER C WITH CEDILLA" glyphRefID="604"/> - <map charValue="u00E8" charName="LATIN SMALL LETTER E WITH GRAVE" glyphRefID="628"/> - <map charValue="u00E9" charName="LATIN SMALL LETTER E WITH ACUTE" glyphRefID="601"/> - <map charValue="u00EA" charName="LATIN SMALL LETTER E WITH CIRCUMFLEX" glyphRefID="623"/> - <map charValue="u00EB" charName="LATIN SMALL LETTER E WITH DIAERESIS" glyphRefID="618"/> - <map charValue="u00ED" charName="LATIN SMALL LETTER I WITH ACUTE" glyphRefID="602"/> - <map charValue="u00EE" charName="LATIN SMALL LETTER I WITH CIRCUMFLEX" glyphRefID="624"/> - <map charValue="u00EF" charName="LATIN SMALL LETTER I WITH DIAERESIS" glyphRefID="619"/> - <map charValue="u00F1" charName="LATIN SMALL LETTER N WITH TILDE" glyphRefID="607"/> - <map charValue="u00F3" charName="LATIN SMALL LETTER O WITH ACUTE" glyphRefID="610"/> - <map charValue="u00F4" charName="LATIN SMALL LETTER O WITH CIRCUMFLEX" glyphRefID="625"/> - <map charValue="u00F6" charName="LATIN SMALL LETTER O WITH DIAERESIS" glyphRefID="620"/> - <map charValue="u00F9" charName="LATIN SMALL LETTER U WITH GRAVE" glyphRefID="600"/> - <map charValue="u00FA" charName="LATIN SMALL LETTER U WITH ACUTE" glyphRefID="611"/> - <map charValue="u00FB" charName="LATIN SMALL LETTER U WITH CIRCUMFLEX" glyphRefID="626"/> - <map charValue="u00FC" charName="LATIN SMALL LETTER U WITH DIAERESIS" glyphRefID="621"/> - <map charValue="u02BB" charName="MODIFIER LETTER TURNED COMMA" glyphRefID="295"/> - <map charValue="u02BC" charName="MODIFIER LETTER APOSTROPHE" glyphRefID="238"/> - <map charValue="u02DC" charName="SMALL TILDE" glyphRefID="631"/> - <map charValue="u0300" charName="COMBINING GRAVE ACCENT" glyphRefID="390"/> - <map charValue="u0301" charName="COMBINING ACUTE ACCENT" glyphRefID="501"/> - <map charValue="u0302" charName="COMBINING CIRCUMFLEX ACCENT" glyphRefID="293"/> - <map charValue="u0303" charName="COMBINING TILDE" glyphRefID="631"/> - <map charValue="u0304" charName="COMBINING MACRON" glyphRefID="325"/> - <map charValue="u0305" charName="COMBINING OVERLINE" glyphRefID="325"/> - <map charValue="u0308" charName="COMBINING DIAERESIS" glyphRefID="502"/> - <map charValue="u0332" charName="COMBINING LOW LINE" glyphRefID="294"/> - <map charValue="u0336" charName="COMBINING LONG STROKE OVERLAY" glyphRefID="514"/> - <map charValue="u2010" charName="HYPHEN" glyphRefID="244"/> - <map charValue="u2011" charName="NON-BREAKING HYPHEN" glyphRefID="244"/> - <map charValue="u2012" charName="FIGURE DASH" glyphRefID="244"/> - <map charValue="u2013" charName="EN DASH" glyphRefID="514"/> - <map charValue="u2014" charName="EM DASH" glyphRefID="514"/> - <map charValue="u2018" charName="LEFT SINGLE QUOTATION MARK" glyphRefID="295"/> - <map charValue="u2019" charName="RIGHT SINGLE QUOTATION MARK" glyphRefID="238"/> - <map charValue="u201C" charName="LEFT DOUBLE QUOTATION MARK" glyphRefID="503"/> - <map charValue="u201D" charName="RIGHT DOUBLE QUOTATION MARK" glyphRefID="233"/> - <map charValue="u2039" charName="SINGLE LEFT-POINTING ANGLE QUOTATION MARK" glyphRefID="259"/> - <map charValue="u203A" charName="SINGLE RIGHT-POINTING ANGLE QUOTATION MARK" glyphRefID="261"/> - <map charValue="u203E" charName="OVERLINE" glyphRefID="325"/> - <map charValue="u2044" charName="FRACTION SLASH" glyphRefID="246"/> - <map charValue="u2212" charName="MINUS SIGN" glyphRefID="514"/> - <map charValue="u2219" charName="BULETTE OPERATOR" glyphRefID="331"/> - <map charValue="u223C" charName="TILDE OPERATOR" glyphRefID="631"/> - </cmapOverride> - </ComponentDef> - <ComponentDef name="HiraMaruPro-W4"> - <Matrix - xx="1.0" - xy="0.0" - yx="0.0" - yy="1.0" - tx="0.0" - ty="0.0" - /> - <Tracking trackingValue="1.0"/> - <ToUnicode fromEncoding="CID Japen1"> - <mapChar fromCharValue="0x20" toCharValue="u20"/> - <mapChar fromCharValue="0x30" toCharValue="u30"/> - <mapChar fromCharValue="0x31" toCharValue="u31"/> - <mapChar fromCharValue="0x32" toCharValue="u32"/> - <mapChar fromCharValue="0x33" toCharValue="u33"/> - <mapChar fromCharValue="0x34" toCharValue="u34"/> - <mapChar fromCharValue="0x35" toCharValue="u35"/> - <mapChar fromCharValue="0x36" toCharValue="u36"/> - <mapChar fromCharValue="0x37" toCharValue="u37"/> - <mapChar fromCharValue="0x38" toCharValue="u38"/> - <mapChar fromCharValue="0x39" toCharValue="u39"/> - </ToUnicode> - </ComponentDef> - </Components> -</PosingFont> diff --git a/Tools/DumpRenderTree/fonts/WebKit Layout Tests 2.ttf b/Tools/DumpRenderTree/fonts/WebKit Layout Tests 2.ttf Binary files differdeleted file mode 100644 index e732fbc42..000000000 --- a/Tools/DumpRenderTree/fonts/WebKit Layout Tests 2.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKit Layout Tests.ttf b/Tools/DumpRenderTree/fonts/WebKit Layout Tests.ttf Binary files differdeleted file mode 100644 index f9f997e63..000000000 --- a/Tools/DumpRenderTree/fonts/WebKit Layout Tests.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf Binary files differdeleted file mode 100644 index 22b00dec7..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf Binary files differdeleted file mode 100644 index 1ccadbad5..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf Binary files differdeleted file mode 100644 index ab5563dfa..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf Binary files differdeleted file mode 100644 index 56d279e0e..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf Binary files differdeleted file mode 100644 index d827d7d85..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf Binary files differdeleted file mode 100644 index 914159670..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf Binary files differdeleted file mode 100644 index a2d05059d..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf Binary files differdeleted file mode 100644 index d0f354bf3..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf b/Tools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf Binary files differdeleted file mode 100644 index 6b895ca71..000000000 --- a/Tools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf +++ /dev/null diff --git a/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp deleted file mode 100644 index d89a8d2f6..000000000 --- a/Tools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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" - -#include "AccessibilityCallbacks.h" -#include "AccessibilityUIElement.h" -#include "DumpRenderTree.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" - -#include <atk/atk.h> -#include <gtk/gtk.h> -#include <webkit/webkit.h> -#include <wtf/gobject/GOwnPtr.h> - -AccessibilityUIElement AccessibilityController::focusedElement() -{ - AtkObject* accessible = DumpRenderTreeSupportGtk::getFocusedAccessibleElement(mainFrame); - if (!accessible) - return 0; - - return AccessibilityUIElement(accessible); -} - -AccessibilityUIElement AccessibilityController::rootElement() -{ - AtkObject* accessible = DumpRenderTreeSupportGtk::getRootAccessibleElement(mainFrame); - if (!accessible) - return 0; - - return AccessibilityUIElement(accessible); -} - -AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef id) -{ - AtkObject* root = DumpRenderTreeSupportGtk::getRootAccessibleElement(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; - -} diff --git a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp deleted file mode 100644 index 30f7b6436..000000000 --- a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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" - -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include <JavaScriptCore/JSStringRef.h> -#include <atk/atk.h> -#include <gtk/gtk.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> - -JSStringRef AccessibilityUIElement::helpText() const -{ - if (!m_element) - return JSStringCreateWithCharacters(0, 0); - - ASSERT(ATK_IS_OBJECT(m_element)); - - CString helpText = DumpRenderTreeSupportGtk::accessibilityHelpText(ATK_OBJECT(m_element)); - GOwnPtr<gchar> axHelpText(g_strdup_printf("AXHelp: %s", helpText.data())); - return JSStringCreateWithUTF8CString(axHelpText.get()); -} diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp deleted file mode 100644 index 83212e65d..000000000 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ /dev/null @@ -1,1535 +0,0 @@ -/* - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * Copyright (C) 2008 Alp Toker <alp@nuanti.com> - * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com> - * Copyright (C) 2010, 2011 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 "config.h" -#include "DumpRenderTree.h" - -#include "AccessibilityController.h" -#include "EditingCallbacks.h" -#include "EventSender.h" -#include "GCController.h" -#include "PixelDumpSupport.h" -#include "SelfScrollingWebKitWebView.h" -#include "TestRunner.h" -#include "TextInputController.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include "WebCoreTestSupport.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <JavaScriptCore/JavaScript.h> -#include <cassert> -#include <cstdlib> -#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> -#include <wtf/gobject/GlibUtilities.h> - -#if PLATFORM(X11) -#include <fontconfig/fontconfig.h> -#endif - - -using namespace std; - -extern "C" { -// This API is not yet public. -extern gchar* webkit_web_history_item_get_target(WebKitWebHistoryItem*); -extern gboolean webkit_web_history_item_is_target_item(WebKitWebHistoryItem*); -extern GList* webkit_web_history_item_get_children(WebKitWebHistoryItem*); -extern void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* view, const gchar* directory); -extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); -} - -volatile bool done; -static bool printSeparators; -static int dumpPixelsForAllTests = false; -static bool dumpPixelsForCurrentTest; -static int dumpTree = 1; -static int useTimeoutWatchdog = 1; - -AccessibilityController* axController = 0; -RefPtr<TestRunner> gTestRunner; -static GCController* gcController = 0; -static WebKitWebView* webView; -static GtkWidget* window; -static GtkWidget* container; -static GtkWidget* webInspectorWindow; -WebKitWebFrame* mainFrame = 0; -WebKitWebFrame* topLoadingFrame = 0; -guint waitToDumpWatchdog = 0; -bool waitForPolicy = false; - -// This is a list of opened webviews -GSList* webViewList = 0; - -// current b/f item at the end of the previous test -static WebKitWebHistoryItem* prevTestBFItem = NULL; - -const unsigned historyItemIndent = 8; - -static void runTest(const string& inputLine); - -static void didRunInsecureContent(WebKitWebFrame*, WebKitSecurityOrigin*, const char* url); - -static bool shouldLogFrameLoadDelegates(const string& pathOrURL) -{ - return pathOrURL.find("loading/") != string::npos; -} - -static bool shouldOpenWebInspector(const string& pathOrURL) -{ - return pathOrURL.find("inspector/") != string::npos; -} - -static bool shouldDumpAsText(const string& pathOrURL) -{ - return pathOrURL.find("dumpAsText/") != string::npos; -} - -static bool shouldEnableDeveloperExtras(const string& pathOrURL) -{ - return true; -} - -void dumpFrameScrollPosition(WebKitWebFrame* frame) -{ - WebKitDOMDocument* document = webkit_web_frame_get_dom_document(frame); - if (!document) - return; - - WebKitDOMDOMWindow* domWindow = webkit_dom_document_get_default_view(document); - if (!domWindow) - return; - - glong x = webkit_dom_dom_window_get_page_x_offset(domWindow); - glong y = webkit_dom_dom_window_get_page_y_offset(domWindow); - - if (abs(x) > 0 || abs(y) > 0) { - if (webkit_web_frame_get_parent(frame)) - printf("frame '%s' ", webkit_web_frame_get_name(frame)); - printf("scrolled to %ld,%ld\n", x, y); - } - - if (gTestRunner->dumpChildFrameScrollPositions()) { - GSList* children = DumpRenderTreeSupportGtk::getFrameChildren(frame); - for (GSList* child = children; child; child = g_slist_next(child)) - dumpFrameScrollPosition(static_cast<WebKitWebFrame*>(child->data)); - g_slist_free(children); - } -} - -void displayWebView() -{ - DumpRenderTreeSupportGtk::forceWebViewPaint(webView); - DumpRenderTreeSupportGtk::setTracksRepaints(mainFrame, true); - DumpRenderTreeSupportGtk::resetTrackedRepaints(mainFrame); -} - -static void appendString(gchar*& target, const gchar* string) -{ - gchar* oldString = target; - target = g_strconcat(target, string, NULL); - g_free(oldString); -} - -static void initializeGtkFontSettings(const char* testURL) -{ - GtkSettings* settings = gtk_settings_get_default(); - if (!settings) - return; - g_object_set(settings, - "gtk-xft-dpi", 98304, // This is 96 * 1024 or 96 DPI according to the GTK+ docs. - "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); - - // One test needs subpixel anti-aliasing turned on, but generally we - // want all text in other tests to use to grayscale anti-aliasing. - if (testURL && strstr(testURL, "xsettings_antialias_settings.html")) - g_object_set(settings, "gtk-xft-rgba", "rgb", NULL); - else - g_object_set(settings, "gtk-xft-rgba", "none", NULL); -} - -CString getTopLevelPath() -{ - if (!g_getenv("WEBKIT_TOP_LEVEL")) - g_setenv("WEBKIT_TOP_LEVEL", TOP_LEVEL_DIR, FALSE); - - return TOP_LEVEL_DIR; -} - -CString getOutputDir() -{ - const char* webkitOutputDir = g_getenv("WEBKIT_OUTPUTDIR"); - if (webkitOutputDir) - return webkitOutputDir; - - CString topLevelPath = getTopLevelPath(); - GOwnPtr<char> outputDir(g_build_filename(topLevelPath.data(), "WebKitBuild", NULL)); - return outputDir.get(); -} - -static CString getFontsPath() -{ - CString webkitOutputDir = getOutputDir(); - GOwnPtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); - if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - return fontsPath.get(); - - // Try alternative fonts path. - fontsPath.set(g_build_filename(webkitOutputDir.data(), "webkitgtk-test-fonts", NULL)); - if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - return fontsPath.get(); - - return CString(); -} - -static void initializeFonts(const char* testURL = 0) -{ -#if PLATFORM(X11) - initializeGtkFontSettings(testURL); - - FcInit(); - - // If a test resulted a font being added or removed via the @font-face rule, then - // we want to reset the FontConfig configuration to prevent it from affecting other tests. - static int numFonts = 0; - FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication); - if (appFontSet && numFonts && appFontSet->nfont == numFonts) - return; - - // Load our configuration file, which sets up proper aliases for family - // names like sans, serif and monospace. - FcConfig* config = FcConfigCreate(); - GOwnPtr<gchar> fontConfigFilename(g_build_filename(FONTS_CONF_DIR, "fonts.conf", NULL)); - if (!FcConfigParseAndLoad(config, reinterpret_cast<FcChar8*>(fontConfigFilename.get()), true)) - g_error("Couldn't load font configuration file from: %s", fontConfigFilename.get()); - - CString fontsPath = getFontsPath(); - if (fontsPath.isNull()) - g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.data()); - - 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; - GOwnPtr<gchar> fontPath(g_build_filename(fontsPath.data(), directoryEntry, NULL)); - if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(fontPath.get()))) - g_error("Could not load font at %s!", fontPath.get()); - - } - - // Ahem is used by many layout tests. - GOwnPtr<gchar> ahemFontFilename(g_build_filename(FONTS_CONF_DIR, "AHEM____.TTF", NULL)); - if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(ahemFontFilename.get()))) - g_error("Could not load font at %s!", ahemFontFilename.get()); - - for (int i = 1; i <= 9; i++) { - GOwnPtr<gchar> fontFilename(g_strdup_printf("WebKitWeightWatcher%i00.ttf", i)); - GOwnPtr<gchar> fontPath(g_build_filename(FONTS_CONF_DIR, "..", "..", "fonts", fontFilename.get(), NULL)); - if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontPath.get()))) - g_error("Could not load font at %s!", fontPath.get()); - } - - // A font with no valid Fontconfig encoding to test https://bugs.webkit.org/show_bug.cgi?id=47452 - GOwnPtr<gchar> fontWithNoValidEncodingFilename(g_build_filename(FONTS_CONF_DIR, "FontWithNoValidEncoding.fon", NULL)); - if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontWithNoValidEncodingFilename.get()))) - g_error("Could not load font at %s!", fontWithNoValidEncodingFilename.get()); - - if (!FcConfigSetCurrent(config)) - g_error("Could not set the current font configuration!"); - - numFonts = FcConfigGetFonts(config, FcSetApplication)->nfont; -#endif -} - -static gchar* dumpFramesAsText(WebKitWebFrame* frame) -{ - gchar* result = 0; - - // Add header for all but the main frame. - bool isMainFrame = (webkit_web_view_get_main_frame(webView) == frame); - - CString innerText = DumpRenderTreeSupportGtk::getInnerText(frame); - if (isMainFrame) - result = g_strdup_printf("%s\n", innerText.data()); - else { - const gchar* frameName = webkit_web_frame_get_name(frame); - result = g_strdup_printf("\n--------\nFrame: '%s'\n--------\n%s\n", frameName, innerText.data()); - } - - if (gTestRunner->dumpChildFramesAsText()) { - GSList* children = DumpRenderTreeSupportGtk::getFrameChildren(frame); - for (GSList* child = children; child; child = g_slist_next(child)) { - GOwnPtr<gchar> childData(dumpFramesAsText(static_cast<WebKitWebFrame*>(child->data))); - appendString(result, childData.get()); - } - g_slist_free(children); - } - - return result; -} - -static gint compareHistoryItems(gpointer* item1, gpointer* item2) -{ - GOwnPtr<gchar> firstItemTarget(webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item1))); - GOwnPtr<gchar> secondItemTarget(webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item2))); - return g_ascii_strcasecmp(firstItemTarget.get(), secondItemTarget.get()); -} - -static void dumpHistoryItem(WebKitWebHistoryItem* item, int indent, bool current) -{ - ASSERT(item != NULL); - int start = 0; - g_object_ref(item); - if (current) { - printf("curr->"); - start = 6; - } - for (int i = start; i < indent; i++) - putchar(' '); - - // normalize file URLs. - const gchar* uri = webkit_web_history_item_get_uri(item); - gchar* uriScheme = g_uri_parse_scheme(uri); - if (g_strcmp0(uriScheme, "file") == 0) { - gchar* pos = g_strstr_len(uri, -1, "/LayoutTests/"); - if (!pos) { - g_free(uriScheme); - return; - } - - GString* result = g_string_sized_new(strlen(uri)); - result = g_string_append(result, "(file test):"); - result = g_string_append(result, pos + strlen("/LayoutTests/")); - printf("%s", result->str); - g_string_free(result, TRUE); - } else - printf("%s", uri); - - g_free(uriScheme); - - GOwnPtr<gchar> target(webkit_web_history_item_get_target(item)); - if (target.get() && strlen(target.get()) > 0) - printf(" (in frame \"%s\")", target.get()); - if (webkit_web_history_item_is_target_item(item)) - printf(" **nav target**"); - putchar('\n'); - - if (GList* kids = webkit_web_history_item_get_children(item)) { - // must sort to eliminate arbitrary result ordering which defeats reproducible testing - for (GList* kid = g_list_sort(kids, (GCompareFunc) compareHistoryItems); kid; kid = g_list_next(kid)) { - WebKitWebHistoryItem* item = WEBKIT_WEB_HISTORY_ITEM(kid->data); - dumpHistoryItem(item, indent + 4, FALSE); - g_object_unref(item); - } - g_list_free(kids); - } - g_object_unref(item); -} - -static void dumpBackForwardListForWebView(WebKitWebView* view) -{ - printf("\n============== Back Forward List ==============\n"); - WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(view); - - // Print out all items in the list after prevTestBFItem, which was from the previous test - // Gather items from the end of the list, the print them out from oldest to newest - GList* itemsToPrint = NULL; - gint forwardListCount = webkit_web_back_forward_list_get_forward_length(bfList); - for (int i = forwardListCount; i > 0; i--) { - WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i); - // something is wrong if the item from the last test is in the forward part of the b/f list - ASSERT(item != prevTestBFItem); - g_object_ref(item); - itemsToPrint = g_list_prepend(itemsToPrint, item); - } - - WebKitWebHistoryItem* currentItem = webkit_web_back_forward_list_get_current_item(bfList); - g_object_ref(currentItem); - itemsToPrint = g_list_prepend(itemsToPrint, currentItem); - - gint backListCount = webkit_web_back_forward_list_get_back_length(bfList); - for (int i = -1; i >= -(backListCount); i--) { - WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i); - if (item == prevTestBFItem) - break; - g_object_ref(item); - itemsToPrint = g_list_prepend(itemsToPrint, item); - } - - for (GList* itemToPrint = itemsToPrint; itemToPrint; itemToPrint = g_list_next(itemToPrint)) { - WebKitWebHistoryItem* item = WEBKIT_WEB_HISTORY_ITEM(itemToPrint->data); - dumpHistoryItem(item, historyItemIndent, item == currentItem); - g_object_unref(item); - } - - g_list_free(itemsToPrint); - printf("===============================================\n"); -} - -static void dumpBackForwardListForAllWebViews() -{ - // Dump the back forward list of the main WebView first - dumpBackForwardListForWebView(webView); - - // The view list is prepended. Reverse the list so we get the order right. - for (GSList* currentView = g_slist_reverse(webViewList); currentView; currentView = g_slist_next(currentView)) - dumpBackForwardListForWebView(WEBKIT_WEB_VIEW(currentView->data)); -} - -void setWaitToDumpWatchdog(guint timer) -{ - waitToDumpWatchdog = timer; -} - -bool shouldSetWaitToDumpWatchdog() -{ - return !waitToDumpWatchdog && useTimeoutWatchdog; -} - -static void invalidateAnyPreviousWaitToDumpWatchdog() -{ - if (waitToDumpWatchdog) { - g_source_remove(waitToDumpWatchdog); - waitToDumpWatchdog = 0; - } - - waitForPolicy = false; -} - -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-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); - - DumpRenderTreeSupportGtk::clearMainFrameName(mainFrame); - DumpRenderTreeSupportGtk::scalePageBy(webView, 1, 0, 0); - - WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); - g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL); - - webkit_web_view_set_zoom_level(webView, 1.0); - - DumpRenderTreeSupportGtk::resetOriginAccessWhiteLists(); - - WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); - webkit_web_back_forward_list_clear(list); - - SoupSession* session = webkit_get_default_session(); - SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR)); - - // We only create the jar when the soup backend needs to do - // HTTP. Should we initialize it earlier, perhaps? - if (jar) - g_object_set(G_OBJECT(jar), SOUP_COOKIE_JAR_ACCEPT_POLICY, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, NULL); - - setlocale(LC_ALL, ""); - - DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true); - webkit_icon_database_set_path(webkit_get_icon_database(), 0); - DumpRenderTreeSupportGtk::setDefersLoading(webView, false); - DumpRenderTreeSupportGtk::setSerializeHTTPLoads(false); - - if (axController) - axController->resetToConsistentState(); - - DumpRenderTreeSupportGtk::clearOpener(mainFrame); - DumpRenderTreeSupportGtk::setTracksRepaints(mainFrame, false); - - DumpRenderTreeSupportGtk::resetGeolocationClientMock(webView); - - 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[]) -{ - // This assumes you've already called getopt_long - return (argc == optind+1 && !strcmp(argv[optind], "-")); -} - -static void runTestingServerLoop() -{ - // When DumpRenderTree runs in server mode, we just wait around for file names - // to be passed to us and read each in turn, passing the results back to the client - char filenameBuffer[2048]; - while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { - char* newLineCharacter = strchr(filenameBuffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (!strlen(filenameBuffer)) - continue; - - runTest(filenameBuffer); - } -} - -static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[]) -{ - struct option options[] = { - {"notree", no_argument, &dumpTree, false}, - {"pixel-tests", no_argument, &dumpPixelsForAllTests, true}, - {"tree", no_argument, &dumpTree, true}, - {"no-timeout", no_argument, &useTimeoutWatchdog, false}, - {NULL, 0, NULL, 0} - }; - - int option; - while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1) { - switch (option) { - case '?': // unknown or ambiguous option - case ':': // missing argument - exit(1); - break; - } - } -} - - -void dump() -{ - invalidateAnyPreviousWaitToDumpWatchdog(); - - // Grab widget focus before dumping the contents of a widget, in - // case it was lost in the course of the test. - gtk_widget_grab_focus(GTK_WIDGET(webView)); - - if (dumpTree) { - char* result = 0; - gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame); - - if (g_str_equal(responseMimeType, "text/plain")) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } - g_free(responseMimeType); - - if (gTestRunner->dumpAsText()) - result = dumpFramesAsText(mainFrame); - else { - // Widget resizing is done asynchronously in GTK+. We pump the main - // loop here, to flush any pending resize requests. This prevents - // timing issues which affect the size of elements in the output. - // We only enable this workaround for tests that print the render tree - // because this seems to break some dumpAsText tests: see bug 39988 - // After fixing that test, we should apply this approach to all dumps. - while (gtk_events_pending()) - gtk_main_iteration(); - - result = g_strdup(DumpRenderTreeSupportGtk::dumpRenderTree(mainFrame).data()); - } - - if (!result) { - const char* errorMessage; - if (gTestRunner->dumpAsText()) - errorMessage = "[documentElement innerText]"; - else if (gTestRunner->dumpDOMAsWebArchive()) - errorMessage = "[[mainFrame DOMDocument] webArchive]"; - else if (gTestRunner->dumpSourceAsWebArchive()) - errorMessage = "[[mainFrame dataSource] webArchive]"; - else - errorMessage = "[mainFrame renderTreeAsExternalRepresentation]"; - printf("ERROR: nil result from %s", errorMessage); - } else { - printf("%s", result); - g_free(result); - if (!gTestRunner->dumpAsText() && !gTestRunner->dumpDOMAsWebArchive() && !gTestRunner->dumpSourceAsWebArchive()) - dumpFrameScrollPosition(mainFrame); - - if (gTestRunner->dumpBackForwardList()) - dumpBackForwardListForAllWebViews(); - } - - if (printSeparators) { - puts("#EOF"); // terminate the content block - fputs("#EOF\n", stderr); - fflush(stdout); - fflush(stderr); - } - } - - if (dumpPixelsForCurrentTest - && gTestRunner->generatePixelResults() - && !gTestRunner->dumpDOMAsWebArchive() - && !gTestRunner->dumpSourceAsWebArchive()) { - DumpRenderTreeSupportGtk::forceWebViewPaint(webView); - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - } - - // FIXME: call displayWebView here when we support --paint - - done = true; - 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(); - -#if PLATFORM(X11) - webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR); -#endif - - webkit_set_web_database_directory_path(temporaryDatabaseDirectory().data()); - -#if defined(GTK_API_VERSION_2) - gtk_rc_parse_string("style \"nix_scrollbar_spacing\" " - "{ " - " GtkScrolledWindow::scrollbar-spacing = 0 " - "} " - "class \"GtkWidget\" style \"nix_scrollbar_spacing\""); - -#else - GtkCssProvider* cssProvider = gtk_css_provider_new(); - gtk_css_provider_load_from_data(cssProvider, - "@binding-set NoKeyboardNavigation { " - " unbind \"<shift>F10\"; " - "} " - " * { " - " -GtkScrolledWindow-scrollbar-spacing: 0;" - " gtk-key-bindings: NoKeyboardNavigation; " - "} ", - -1, 0); - gtk_style_context_add_provider_for_screen(gdk_display_get_default_screen(gdk_display_get_default()), - GTK_STYLE_PROVIDER(cssProvider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref(cssProvider); -#endif -} - -static void sendPixelResultsEOF() -{ - puts("#EOF"); - - fflush(stdout); - fflush(stderr); -} - -static void runTest(const string& inputLine) -{ - ASSERT(!inputLine.empty()); - - TestCommand command = parseInputLine(inputLine); - string& testURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; - - // Convert the path into a full file URL if it does not look - // like an HTTP/S URL (doesn't start with http:// or https://). - if (testURL.find("http://") && testURL.find("https://")) { - GFile* testFile = g_file_new_for_path(testURL.c_str()); - gchar* testURLCString = g_file_get_uri(testFile); - testURL = testURLCString; - g_free(testURLCString); - g_object_unref(testFile); - } - - resetDefaultsToConsistentValues(); - - gTestRunner = TestRunner::create(testURL, command.expectedPixelHash); - topLoadingFrame = 0; - done = false; - - gTestRunner->setIconDatabaseEnabled(false); - - if (shouldLogFrameLoadDelegates(testURL)) - gTestRunner->setDumpFrameLoadCallbacks(true); - - if (shouldEnableDeveloperExtras(testURL)) { - gTestRunner->setDeveloperExtrasEnabled(true); - if (shouldOpenWebInspector(testURL)) - gTestRunner->showWebInspector(); - if (shouldDumpAsText(testURL)) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } - } - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - bool isSVGW3CTest = (testURL.find("svg/W3C-SVG-1.1") != string::npos); - GtkAllocation size; - size.x = size.y = 0; - 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); - - if (prevTestBFItem) - g_object_unref(prevTestBFItem); - WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(webView); - prevTestBFItem = webkit_web_back_forward_list_get_current_item(bfList); - if (prevTestBFItem) - g_object_ref(prevTestBFItem); - - initializeFonts(testURL.c_str()); - - // Focus the web view before loading the test to avoid focusing problems - gtk_widget_grab_focus(GTK_WIDGET(webView)); - webkit_web_view_open(webView, testURL.c_str()); - - gtk_main(); - - // If developer extras enabled Web Inspector may have been open by the test. - if (shouldEnableDeveloperExtras(testURL)) { - gTestRunner->closeWebInspector(); - gTestRunner->setDeveloperExtrasEnabled(false); - } - - // Also check if we still have opened webViews and free them. - if (gTestRunner->closeRemainingWindowsWhenComplete() || webViewList) { - while (webViewList) { - g_object_unref(WEBKIT_WEB_VIEW(webViewList->data)); - webViewList = g_slist_next(webViewList); - } - g_slist_free(webViewList); - webViewList = 0; - } - - WebCoreTestSupport::resetInternalsObject(webkit_web_frame_get_global_context(mainFrame)); - DumpRenderTreeSupportGtk::clearMemoryCache(); - DumpRenderTreeSupportGtk::clearApplicationCache(); - - // A blank load seems to be necessary to reset state after certain tests. - webkit_web_view_open(webView, "about:blank"); - - gTestRunner.clear(); - - // terminate the (possibly empty) pixels block after all the state reset - sendPixelResultsEOF(); -} - -void webViewLoadStarted(WebKitWebView* view, WebKitWebFrame* frame, void*) -{ - // Make sure we only set this once per test. If it gets cleared, and then set again, we might - // end up doing two dumps for one test. - if (!topLoadingFrame && !done) - topLoadingFrame = frame; -} - -static gboolean processWork(void* data) -{ - // if we finish all the commands, we're ready to dump state - if (WorkQueue::shared()->processWork() && !gTestRunner->waitToDump()) - dump(); - - return FALSE; -} - -static char* getFrameNameSuitableForTestResult(WebKitWebView* view, WebKitWebFrame* frame) -{ - char* frameName = g_strdup(webkit_web_frame_get_name(frame)); - - if (frame == webkit_web_view_get_main_frame(view)) { - // This is a bit strange. Shouldn't web_frame_get_name return NULL? - if (frameName && (frameName[0] != '\0')) { - char* tmp = g_strdup_printf("main frame \"%s\"", frameName); - g_free(frameName); - frameName = tmp; - } else { - g_free(frameName); - frameName = g_strdup("main frame"); - } - } else if (!frameName || (frameName[0] == '\0')) { - g_free(frameName); - frameName = g_strdup("frame (anonymous)"); - } else { - char* tmp = g_strdup_printf("frame \"%s\"", frameName); - g_free(frameName); - frameName = tmp; - } - - return frameName; -} - -static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*) -{ - // The deprecated "load-finished" signal is triggered by postProgressFinishedNotification(), - // so we can use it here in the DRT to provide the correct dump. - if (frame != topLoadingFrame) - return; - if (gTestRunner->dumpProgressFinishedCallback()) - printf("postProgressFinishedNotification\n"); -} - -static gboolean webViewLoadError(WebKitWebView*, WebKitWebFrame*, gchar*, gpointer, gpointer) -{ - return TRUE; // Return true here to disable the default error page. -} - -static void webViewDocumentLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - char* frameName = getFrameNameSuitableForTestResult(view, frame); - printf("%s - didFinishDocumentLoadForFrame\n", frameName); - g_free(frameName); - } else if (!done) { - guint pendingFrameUnloadEvents = DumpRenderTreeSupportGtk::getPendingUnloadEventCount(frame); - if (pendingFrameUnloadEvents) { - char* frameName = getFrameNameSuitableForTestResult(view, frame); - printf("%s - has %u onunload handler(s)\n", frameName, pendingFrameUnloadEvents); - g_free(frameName); - } - } -} - -static void webViewOnloadEvent(WebKitWebView* view, WebKitWebFrame* frame, void*) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - char* frameName = getFrameNameSuitableForTestResult(view, frame); - printf("%s - didHandleOnloadEventsForFrame\n", frameName); - g_free(frameName); - } -} - -static void addControllerToWindow(JSContextRef context, JSObjectRef windowObject, const char* controllerName, JSValueRef controller) -{ - JSStringRef controllerNameStr = JSStringCreateWithUTF8CString(controllerName); - JSObjectSetProperty(context, windowObject, controllerNameStr, controller, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - JSStringRelease(controllerNameStr); -} - -static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef windowObject, gpointer data) -{ - JSValueRef exception = 0; - ASSERT(gTestRunner); - - gTestRunner->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - gcController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - axController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - addControllerToWindow(context, windowObject, "eventSender", makeEventSender(context, !webkit_web_frame_get_parent(frame))); - addControllerToWindow(context, windowObject, "textInputController", makeTextInputController(context)); - WebCoreTestSupport::injectInternalsObject(context); -} - -static gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId, gpointer data) -{ - gchar* testMessage = 0; - const gchar* uriScheme; - - // Tests expect only the filename part of local URIs - uriScheme = g_strstr_len(message, -1, "file://"); - if (uriScheme) { - GString* tempString = g_string_sized_new(strlen(message)); - gchar* filename = g_strrstr(uriScheme, G_DIR_SEPARATOR_S); - - if (filename) { - // If the path is a lone slash, keep it to avoid empty output. - if (strlen(filename) > 1) - filename += strlen(G_DIR_SEPARATOR_S); - tempString = g_string_append_len(tempString, message, (uriScheme - message)); - tempString = g_string_append_len(tempString, filename, strlen(filename)); - testMessage = g_string_free(tempString, FALSE); - } - } - - fprintf(stdout, "CONSOLE MESSAGE: "); - if (line) - fprintf(stdout, "line %d: ", line); - fprintf(stdout, "%s\n", testMessage ? testMessage : message); - g_free(testMessage); - - return TRUE; -} - - -static gboolean webViewScriptAlert(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gpointer data) -{ - fprintf(stdout, "ALERT: %s\n", message); - fflush(stdout); - return TRUE; -} - -static gboolean webViewScriptPrompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value, gpointer data) -{ - fprintf(stdout, "PROMPT: %s, default text: %s\n", message, defaultValue); - *value = g_strdup(defaultValue); - return TRUE; -} - -static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm, gpointer data) -{ - fprintf(stdout, "CONFIRM: %s\n", message); - *didConfirm = TRUE; - return TRUE; -} - -static void webViewTitleChanged(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, gpointer data) -{ - if (gTestRunner->dumpFrameLoadCallbacks() && !done) { - GOwnPtr<char> frameName(getFrameNameSuitableForTestResult(view, frame)); - printf("%s - didReceiveTitle: %s\n", frameName.get(), title ? title : ""); - } - - if (gTestRunner->dumpTitleChanges() && !done) - printf("TITLE CHANGED: '%s'\n", title ? title : ""); -} - -static bool webViewNavigationPolicyDecisionRequested(WebKitWebView* view, WebKitWebFrame* frame, - WebKitNetworkRequest* request, - WebKitWebNavigationAction* navAction, - WebKitWebPolicyDecision* policyDecision) -{ - // Use the default handler if we're not waiting for policy, - // i.e., TestRunner::waitForPolicyDelegate - if (!waitForPolicy) - return FALSE; - - gchar* typeDescription; - WebKitWebNavigationReason reason; - g_object_get(G_OBJECT(navAction), "reason", &reason, NULL); - - switch(reason) { - case WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED: - typeDescription = g_strdup("link clicked"); - break; - case WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED: - typeDescription = g_strdup("form submitted"); - break; - case WEBKIT_WEB_NAVIGATION_REASON_BACK_FORWARD: - typeDescription = g_strdup("back/forward"); - break; - case WEBKIT_WEB_NAVIGATION_REASON_RELOAD: - typeDescription = g_strdup("reload"); - break; - case WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED: - typeDescription = g_strdup("form resubmitted"); - break; - case WEBKIT_WEB_NAVIGATION_REASON_OTHER: - typeDescription = g_strdup("other"); - break; - default: - typeDescription = g_strdup("illegal value"); - } - - printf("Policy delegate: attempt to load %s with navigation type '%s'\n", webkit_network_request_get_uri(request), typeDescription); - g_free(typeDescription); - - webkit_web_policy_decision_ignore(policyDecision); - gTestRunner->notifyDone(); - - return TRUE; -} - -static void webViewStatusBarTextChanged(WebKitWebView* view, const gchar* message, gpointer data) -{ - // Are we doing anything wrong? One test that does not call - // dumpStatusCallbacks gets true here - if (gTestRunner->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", message); -} - -static gboolean webViewClose(WebKitWebView* view) -{ - ASSERT(view); - - webViewList = g_slist_remove(webViewList, view); - g_object_unref(view); - - return TRUE; -} - -static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, WebKitWebDatabase *database) -{ - ASSERT(view); - ASSERT(frame); - ASSERT(database); - - WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin(database); - if (gTestRunner->dumpDatabaseCallbacks()) { - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", - webkit_security_origin_get_protocol(origin), - webkit_security_origin_get_host(origin), - webkit_security_origin_get_port(origin), - webkit_web_database_get_name(database)); - } - webkit_security_origin_set_web_database_quota(origin, 5 * 1024 * 1024); -} - -static bool -geolocationPolicyDecisionRequested(WebKitWebView*, WebKitWebFrame*, WebKitGeolocationPolicyDecision* decision) -{ - if (!gTestRunner->isGeolocationPermissionSet()) - return FALSE; - if (gTestRunner->geolocationPermission()) - webkit_geolocation_policy_allow(decision); - else - webkit_geolocation_policy_deny(decision); - - return TRUE; -} - - -static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*); - -static gboolean webInspectorShowWindow(WebKitWebInspector*, gpointer data) -{ - gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), TestRunner::viewWidth, TestRunner::viewHeight); - gtk_widget_show_all(webInspectorWindow); - return TRUE; -} - -static gboolean webInspectorCloseWindow(WebKitWebInspector*, gpointer data) -{ - gtk_widget_destroy(webInspectorWindow); - webInspectorWindow = 0; - return TRUE; -} - -static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer data) -{ - webInspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - GtkWidget* webView = self_scrolling_webkit_web_view_new(); - gtk_container_add(GTK_CONTAINER(webInspectorWindow), - webView); - - return WEBKIT_WEB_VIEW(webView); -} - -static void topLoadingFrameLoadFinished() -{ - topLoadingFrame = 0; - WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test - if (gTestRunner->waitToDump()) - return; - - if (WorkQueue::shared()->count()) - g_timeout_add(0, processWork, 0); - else - dump(); -} - -static void webFrameLoadStatusNotified(WebKitWebFrame* frame, gpointer user_data) -{ - WebKitLoadStatus loadStatus = webkit_web_frame_get_load_status(frame); - - if (gTestRunner->dumpFrameLoadCallbacks()) { - GOwnPtr<char> frameName(getFrameNameSuitableForTestResult(webkit_web_frame_get_web_view(frame), frame)); - - switch (loadStatus) { - case WEBKIT_LOAD_PROVISIONAL: - if (!done) - printf("%s - didStartProvisionalLoadForFrame\n", frameName.get()); - break; - case WEBKIT_LOAD_COMMITTED: - if (!done) - printf("%s - didCommitLoadForFrame\n", frameName.get()); - break; - case WEBKIT_LOAD_FINISHED: - if (!done) - printf("%s - didFinishLoadForFrame\n", frameName.get()); - break; - default: - break; - } - } - - if ((loadStatus == WEBKIT_LOAD_FINISHED || loadStatus == WEBKIT_LOAD_FAILED) - && frame == topLoadingFrame) - topLoadingFrameLoadFinished(); -} - -static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, gpointer user_data) -{ - g_signal_connect(webFrame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL); - g_signal_connect(webFrame, "insecure-content-run", G_CALLBACK(didRunInsecureContent), NULL); -} - - -static CString pathFromSoupURI(SoupURI* uri) -{ - if (!uri) - return CString(); - - if (g_str_equal(uri->scheme, "http") || g_str_equal(uri->scheme, "ftp")) { - GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE)); - return CString(uriString.get()); - } - - GOwnPtr<gchar> parentPath(g_path_get_dirname(uri->path)); - GOwnPtr<gchar> pathDirname(g_path_get_basename(parentPath.get())); - GOwnPtr<gchar> pathBasename(g_path_get_basename(uri->path)); - GOwnPtr<gchar> urlPath(g_strdup_printf("%s/%s", pathDirname.get(), pathBasename.get())); - return CString(urlPath.get()); -} - -static CString convertSoupMessageToURLPath(SoupMessage* soupMessage) -{ - if (!soupMessage) - return CString(); - if (SoupURI* requestURI = soup_message_get_uri(soupMessage)) - return pathFromSoupURI(requestURI); - return CString(); -} - -static CString convertNetworkRequestToURLPath(WebKitNetworkRequest* request) -{ - return convertSoupMessageToURLPath(webkit_network_request_get_message(request)); -} - -static CString convertWebResourceToURLPath(WebKitWebResource* webResource) -{ - SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource)); - CString urlPath(pathFromSoupURI(uri)); - soup_uri_free(uri); - return urlPath; -} - -static CString urlSuitableForTestResult(const char* uriString) -{ - if (!g_str_has_prefix(uriString, "file://")) - return CString(uriString); - - GOwnPtr<gchar> basename(g_path_get_basename(uriString)); - return CString(basename.get()); -} - -static CString descriptionSuitableForTestResult(SoupURI* uri) -{ - if (!uri) - return CString(""); - - GOwnPtr<char> uriString(soup_uri_to_string(uri, false)); - return urlSuitableForTestResult(uriString.get()); -} - -static CString descriptionSuitableForTestResult(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource) -{ - SoupURI* uri = soup_uri_new(webkit_web_resource_get_uri(webResource)); - CString description; - WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(webFrame); - - if (webResource == webkit_web_data_source_get_main_resource(dataSource) - && (!webkit_web_view_get_progress(webView) || g_str_equal(uri->scheme, "file"))) - description = CString("<unknown>"); - else - description = convertWebResourceToURLPath(webResource); - - if (uri) - soup_uri_free(uri); - - return description; -} - -static CString descriptionSuitableForTestResult(GError* error, WebKitWebResource* webResource) -{ - const gchar* errorDomain = g_quark_to_string(error->domain); - CString resourceURIString(urlSuitableForTestResult(webkit_web_resource_get_uri(webResource))); - - if (g_str_equal(errorDomain, "webkit-network-error-quark") || g_str_equal(errorDomain, "soup_http_error_quark")) - errorDomain = "NSURLErrorDomain"; - - if (g_str_equal(errorDomain, "WebKitPolicyError")) - errorDomain = "WebKitErrorDomain"; - - // TODO: the other ports get the failingURL from the ResourceError - GOwnPtr<char> errorString(g_strdup_printf("<NSError domain %s, code %d, failing URL \"%s\">", - errorDomain, error->code, resourceURIString.data())); - return CString(errorString.get()); -} - -static CString descriptionSuitableForTestResult(WebKitNetworkRequest* request) -{ - SoupMessage* soupMessage = webkit_network_request_get_message(request); - - if (!soupMessage) - return CString(""); - - SoupURI* requestURI = soup_message_get_uri(soupMessage); - SoupURI* mainDocumentURI = soup_message_get_first_party(soupMessage); - CString requestURIString(descriptionSuitableForTestResult(requestURI)); - 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->method)); - return CString(description.get()); -} - -static CString descriptionSuitableForTestResult(WebKitNetworkResponse* response) -{ - if (!response) - return CString("(null)"); - - int statusCode = 0; - CString responseURIString(urlSuitableForTestResult(webkit_network_response_get_uri(response))); - SoupMessage* soupMessage = webkit_network_response_get_message(response); - CString path; - - if (soupMessage) { - statusCode = soupMessage->status_code; - path = convertSoupMessageToURLPath(soupMessage); - } else - path = CString(""); - - GOwnPtr<char> description(g_strdup_printf("<NSURLResponse %s, http status code %d>", path.data(), statusCode)); - return CString(description.get()); -} - -static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* resource, WebKitNetworkRequest* request, WebKitNetworkResponse* response) -{ - - - if (!done && gTestRunner->willSendRequestReturnsNull()) { - // As requested by the TestRunner, don't perform the request. - webkit_network_request_set_uri(request, "about:blank"); - return; - } - - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - printf("%s - willSendRequest %s redirectResponse %s\n", - convertNetworkRequestToURLPath(request).data(), - descriptionSuitableForTestResult(request).data(), - descriptionSuitableForTestResult(response).data()); - - SoupMessage* soupMessage = webkit_network_request_get_message(request); - SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request)); - - 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) - soup_uri_free(uri); - - if (soupMessage) { - const set<string>& clearHeaders = gTestRunner->willSendRequestClearHeaders(); - for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) - soup_message_headers_remove(soupMessage->request_headers, header->c_str()); - } -} - - -static void didReceiveResponse(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource* webResource, WebKitNetworkResponse* response) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - CString responseDescription(descriptionSuitableForTestResult(response)); - CString path(convertWebResourceToURLPath(webResource)); - printf("%s - didReceiveResponse %s\n", path.data(), responseDescription.data()); - } - - // TODO: add "has MIME type" whenever dumpResourceResponseMIMETypes() is supported. - // See https://bugs.webkit.org/show_bug.cgi?id=58222. -} - -static void didFinishLoading(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) - printf("%s - didFinishLoading\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data()); -} - -static void didFailLoadingWithError(WebKitWebView* webView, WebKitWebFrame* webFrame, WebKitWebResource* webResource, GError* webError) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - CString webErrorString(descriptionSuitableForTestResult(webError, webResource)); - printf("%s - didFailLoadingWithError: %s\n", descriptionSuitableForTestResult(webView, webFrame, webResource).data(), - webErrorString.data()); - } -} - -static void didRunInsecureContent(WebKitWebFrame*, WebKitSecurityOrigin*, const char* url) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); -} - -static gboolean webViewRunFileChooser(WebKitWebView*, WebKitFileChooserRequest*) -{ - // We return TRUE to not propagate the event further so the - // default file chooser dialog is not shown. - 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), - "signal::load-started", webViewLoadStarted, 0, - "signal::load-finished", webViewLoadFinished, 0, - "signal::load-error", webViewLoadError, 0, - "signal::window-object-cleared", webViewWindowObjectCleared, 0, - "signal::console-message", webViewConsoleMessage, 0, - "signal::script-alert", webViewScriptAlert, 0, - "signal::script-prompt", webViewScriptPrompt, 0, - "signal::script-confirm", webViewScriptConfirm, 0, - "signal::title-changed", webViewTitleChanged, 0, - "signal::navigation-policy-decision-requested", webViewNavigationPolicyDecisionRequested, 0, - "signal::status-bar-text-changed", webViewStatusBarTextChanged, 0, - "signal::create-web-view", webViewCreate, 0, - "signal::close-web-view", webViewClose, 0, - "signal::database-quota-exceeded", databaseQuotaExceeded, 0, - "signal::document-load-finished", webViewDocumentLoadFinished, 0, - "signal::geolocation-policy-decision-requested", geolocationPolicyDecisionRequested, 0, - "signal::onload-event", webViewOnloadEvent, 0, - "signal::drag-begin", dragBeginCallback, 0, - "signal::drag-end", dragEndCallback, 0, - "signal::drag-failed", dragFailedCallback, 0, - "signal::frame-created", frameCreatedCallback, 0, - "signal::resource-request-starting", willSendRequestCallback, 0, - "signal::resource-response-received", didReceiveResponse, 0, - "signal::resource-load-finished", didFinishLoading, 0, - "signal::resource-load-failed", didFailLoadingWithError, 0, - "signal::run-file-chooser", webViewRunFileChooser, 0, - NULL); - connectEditingCallbacks(view); - - WebKitWebInspector* inspector = webkit_web_view_get_inspector(view); - g_object_connect(G_OBJECT(inspector), - "signal::inspect-web-view", webInspectorInspectWebView, 0, - "signal::show-window", webInspectorShowWindow, 0, - "signal::close-window", webInspectorCloseWindow, 0, - NULL); - - if (webView) { - WebKitWebSettings* settings = webkit_web_view_get_settings(webView); - webkit_web_view_set_settings(view, settings); - } - - // frame-created is not issued for main frame. That's why we must do this here - WebKitWebFrame* frame = webkit_web_view_get_main_frame(view); - g_signal_connect(frame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL); - g_signal_connect(frame, "insecure-content-run", G_CALLBACK(didRunInsecureContent), NULL); - - return view; -} - -static WebKitWebView* webViewCreate(WebKitWebView* view, WebKitWebFrame* frame) -{ - if (!gTestRunner->canOpenWindows()) - return 0; - - // Make sure that waitUntilDone has been called. - ASSERT(gTestRunner->waitToDump()); - - WebKitWebView* newWebView = createWebView(); - g_object_ref_sink(G_OBJECT(newWebView)); - webViewList = g_slist_prepend(webViewList, newWebView); - return newWebView; -} - -static void logHandler(const gchar* domain, GLogLevelFlags level, const gchar* message, gpointer data) -{ - if (level < G_LOG_LEVEL_DEBUG) - fprintf(stderr, "%s\n", message); -} - -int main(int argc, char* argv[]) -{ - gtk_init(&argc, &argv); - - // Some plugins might try to use the GLib logger for printing debug - // messages. This will cause tests to fail because of unexpected output. - // We squelch all debug messages sent to the logger. - g_log_set_default_handler(logHandler, 0); - - initializeGlobalsFromCommandLineOptions(argc, argv); - initializeFonts(); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); -#ifdef GTK_API_VERSION_2 - container = gtk_hbox_new(TRUE, 0); -#else - container = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(container), TRUE); -#endif - gtk_container_add(GTK_CONTAINER(window), container); - gtk_widget_show_all(window); - - webView = createWebView(); - gtk_box_pack_start(GTK_BOX(container), GTK_WIDGET(webView), TRUE, TRUE, 0); - gtk_widget_realize(GTK_WIDGET(webView)); - gtk_widget_show_all(container); - mainFrame = webkit_web_view_get_main_frame(webView); - - setDefaultsToConsistentStateValuesForTesting(); - - gcController = new GCController(); - axController = new AccessibilityController(); - - if (useLongRunningServerMode(argc, argv)) { - printSeparators = true; - runTestingServerLoop(); - } else { - printSeparators = (optind < argc-1 || (dumpPixelsForCurrentTest && dumpTree)); - for (int i = optind; i != argc; ++i) - runTest(argv[i]); - } - - delete gcController; - gcController = 0; - - delete axController; - axController = 0; - - gtk_widget_destroy(window); - - return 0; -} diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTreeGtk.h b/Tools/DumpRenderTree/gtk/DumpRenderTreeGtk.h deleted file mode 100644 index e07d6f0fa..000000000 --- a/Tools/DumpRenderTree/gtk/DumpRenderTreeGtk.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (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. - */ - -#ifndef DumpRenderTreeGtk_h -#define DumpRenderTreeGtk_h - -#include <webkit/webkitdefines.h> -#include <JavaScriptCore/JSBase.h> -#include <glib.h> -#include <wtf/text/CString.h> - -extern WebKitWebFrame* mainFrame; -extern WebKitWebFrame* topLoadingFrame; -extern bool waitForPolicy; -extern GSList* webViewList; - -gchar* JSStringCopyUTF8CString(JSStringRef jsString); -CString getTopLevelPath(); - -void setWaitToDumpWatchdog(guint timer); -bool shouldSetWaitToDumpWatchdog(); - -#endif // DumpRenderTreeGtk_h diff --git a/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp b/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp deleted file mode 100644 index ef5a969ae..000000000 --- a/Tools/DumpRenderTree/gtk/EditingCallbacks.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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 "config.h" -#include "EditingCallbacks.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <gtk/gtk.h> -#include <webkit/webkit.h> -#include <wtf/gobject/GOwnPtr.h> -#include <wtf/text/CString.h> - -static CString dumpNodePath(WebKitDOMNode* node) -{ - GOwnPtr<gchar> nodeName(webkit_dom_node_get_node_name(node)); - GString* path = g_string_new(nodeName.get()); - - WebKitDOMNode* parent = webkit_dom_node_get_parent_node(node); - while (parent) { - GOwnPtr<gchar> parentName(webkit_dom_node_get_node_name(parent)); - - g_string_append(path, " > "); - g_string_append(path, parentName.get()); - parent = webkit_dom_node_get_parent_node(parent); - } - - GOwnPtr<gchar> pathBuffer(g_string_free(path, FALSE)); - return pathBuffer.get(); -} - -static CString dumpRange(WebKitDOMRange* range) -{ - if (!range) - return "(null)"; - - GOwnPtr<gchar> dump(g_strdup_printf("range from %li of %s to %li of %s", - 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(); -} - -static const char* insertActionString(WebKitInsertAction action) -{ - switch (action) { - case WEBKIT_INSERT_ACTION_TYPED: - return "WebViewInsertActionTyped"; - case WEBKIT_INSERT_ACTION_PASTED: - return "WebViewInsertActionPasted"; - case WEBKIT_INSERT_ACTION_DROPPED: - return "WebViewInsertActionDropped"; - } - ASSERT_NOT_REACHED(); - return "WebViewInsertActionTyped"; -} - -static const char* selectionAffinityString(WebKitSelectionAffinity affinity) -{ - switch (affinity) { - case WEBKIT_SELECTION_AFFINITY_UPSTREAM: - return "NSSelectionAffinityUpstream"; - case WEBKIT_SELECTION_AFFINITY_DOWNSTREAM: - return "NSSelectionAffinityDownstream"; - } - ASSERT_NOT_REACHED(); - return "NSSelectionAffinityUpstream"; -} - -gboolean shouldBeginEditing(WebKitWebView* webView, WebKitDOMRange* range) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dumpRange(range).data()); - return TRUE; -} - -gboolean shouldEndEditing(WebKitWebView* webView, WebKitDOMRange* range) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dumpRange(range).data()); - return TRUE; -} - -gboolean shouldInsertNode(WebKitWebView* webView, WebKitDOMNode* node, WebKitDOMRange* range, WebKitInsertAction action) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", - dumpNodePath(node).data(), dumpRange(range).data(), insertActionString(action)); - } - return TRUE; -} - -gboolean shouldInsertText(WebKitWebView* webView, const gchar* text, WebKitDOMRange* range, WebKitInsertAction action) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", - text, dumpRange(range).data(), insertActionString(action)); - } - return TRUE; -} - -gboolean shouldDeleteRange(WebKitWebView* webView, WebKitDOMRange* range) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dumpRange(range).data()); - return TRUE; -} - -gboolean shouldShowDeleteInterfaceForElement(WebKitWebView* webView, WebKitDOMHTMLElement* element) -{ - return FALSE; -} - -gboolean shouldChangeSelectedRange(WebKitWebView* webView, WebKitDOMRange* fromRange, WebKitDOMRange* toRange, WebKitSelectionAffinity affinity, gboolean stillSelecting) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", - dumpRange(fromRange).data(), dumpRange(toRange).data(), selectionAffinityString(affinity), - stillSelecting ? "TRUE" : "FALSE"); - } - return TRUE; -} - -gboolean shouldApplyStyle(WebKitWebView* webView, WebKitDOMCSSStyleDeclaration* style, WebKitDOMRange* range) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) { - GOwnPtr<gchar> styleText(webkit_dom_css_style_declaration_get_css_text(style)); - printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", - styleText.get(), dumpRange(range).data()); - } - return TRUE; -} - -void editingBegan(WebKitWebView*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n"); -} - -void userChangedContents(WebKitWebView*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); -} - -void editingEnded(WebKitWebView*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n"); -} - -void selectionChanged(WebKitWebView*) -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n"); -} - -void connectEditingCallbacks(WebKitWebView* webView) -{ - g_object_connect(G_OBJECT(webView), - "signal::should-begin-editing", shouldBeginEditing, 0, - "signal::should-end-editing", shouldEndEditing, 0, - "signal::should-insert-node", shouldInsertNode, 0, - "signal::should-insert-text", shouldInsertText, 0, - "signal::should-delete-range", shouldDeleteRange, 0, - "signal::should-show-delete-interface-for-element", shouldShowDeleteInterfaceForElement, 0, - "signal::should-change-selected-range", shouldChangeSelectedRange, 0, - "signal::should-apply-style", shouldApplyStyle, 0, - "signal::editing-began", editingBegan, 0, - "signal::user-changed-contents", userChangedContents, 0, - "signal::editing-ended", editingEnded, 0, - "signal::selection-changed", selectionChanged, 0, - NULL); -} - diff --git a/Tools/DumpRenderTree/gtk/EditingCallbacks.h b/Tools/DumpRenderTree/gtk/EditingCallbacks.h deleted file mode 100644 index 7a9514917..000000000 --- a/Tools/DumpRenderTree/gtk/EditingCallbacks.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -#ifndef EditingCallbacks_h -#define EditingCallbacks_h - -typedef struct _WebKitWebView WebKitWebView; -void connectEditingCallbacks(WebKitWebView*); - -#endif diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp deleted file mode 100644 index 8fd693564..000000000 --- a/Tools/DumpRenderTree/gtk/EventSender.cpp +++ /dev/null @@ -1,999 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com> - * Copyright (C) 2009 Holger Hans Peter Freyther - * Copyright (C) 2010 Igalia S.L. - * Copyright (C) 2012 ChangSeok Oh <shivamidow@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * 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 "EventSender.h" - -#include "DumpRenderTree.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include <GOwnPtrGtk.h> -#include <GRefPtrGtk.h> -#include <GtkVersioning.h> -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <cstring> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> -#include <webkit/webkitwebframe.h> -#include <webkit/webkitwebview.h> -#include <wtf/ASCIICType.h> -#include <wtf/Platform.h> -#include <wtf/text/CString.h> - -extern "C" { - extern GtkMenu* webkit_web_view_get_context_menu(WebKitWebView*); -} - -static bool dragMode; -static int timeOffset = 0; - -static int lastMousePositionX; -static int lastMousePositionY; -static int lastClickPositionX; -static int lastClickPositionY; -static int lastClickTimeOffset; -static int lastClickButton; -static unsigned buttonCurrentlyDown; -static int clickCount; -GdkDragContext* currentDragSourceContext; - -struct DelayedMessage { - GdkEvent* event; - gulong delay; -}; - -static DelayedMessage msgQueue[1024]; - -static unsigned endOfQueue; -static unsigned startOfQueue; - -static const float zoomMultiplierRatio = 1.2f; - -// WebCore and layout tests assume this value. -static const float pixelsPerScrollTick = 40; - -// Key event location code defined in DOM Level 3. -enum KeyLocationCode { - DOM_KEY_LOCATION_STANDARD = 0x00, - DOM_KEY_LOCATION_LEFT = 0x01, - DOM_KEY_LOCATION_RIGHT = 0x02, - DOM_KEY_LOCATION_NUMPAD = 0x03 -}; - -static void sendOrQueueEvent(GdkEvent*, bool = true); -static void dispatchEvent(GdkEvent* event); -static guint getStateFlags(); - -static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - return JSValueMakeBoolean(context, dragMode); -} - -static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) -{ - dragMode = JSValueToBoolean(context, value); - return true; -} - -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount > 0) { - msgQueue[endOfQueue].delay = JSValueToNumber(context, arguments[0], exception); - timeOffset += msgQueue[endOfQueue].delay; - ASSERT(!exception || !*exception); - } - - return JSValueMakeUndefined(context); -} - -bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber, guint modifiers) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return false; - - // The logic for mapping EventSender button numbers to GDK button - // numbers originates from the Windows EventSender. - int gdkButtonNumber = 3; - if (eventSenderButtonNumber >= 0 && eventSenderButtonNumber <= 2) - gdkButtonNumber = eventSenderButtonNumber + 1; - - // fast/events/mouse-click-events expects the 4th button - // to be event->button = 1, so send a middle-button event. - else if (eventSenderButtonNumber == 3) - gdkButtonNumber = 2; - - event->button.button = gdkButtonNumber; - event->button.x = lastMousePositionX; - event->button.y = lastMousePositionY; - event->button.window = gtk_widget_get_window(GTK_WIDGET(view)); - g_object_ref(event->button.window); - event->button.device = getDefaultGDKPointerDevice(event->button.window); - event->button.state = modifiers | getStateFlags(); - event->button.time = GDK_CURRENT_TIME; - event->button.axes = 0; - - int xRoot, yRoot; - gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); - event->button.x_root = xRoot; - event->button.y_root = yRoot; - - return true; -} - -static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - GtkWidget* widget = GTK_WIDGET(JSObjectGetPrivate(object)); - CString label; - if (GTK_IS_SEPARATOR_MENU_ITEM(widget)) - label = "<separator>"; - else - label = gtk_menu_item_get_label(GTK_MENU_ITEM(widget)); - - JSRetainPtr<JSStringRef> itemText(Adopt, JSStringCreateWithUTF8CString(label.data())); - return JSValueMakeString(context, itemText.get()); -} - -static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) -{ - return true; -} - -static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - GtkMenuItem* item = GTK_MENU_ITEM(JSObjectGetPrivate(thisObject)); - gtk_menu_item_activate(item); - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticMenuItemFunctions[] = { - { "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticMenuItemValues[] = { - { "title", getMenuItemTitleCallback, setMenuItemTitleCallback, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getMenuItemClass() -{ - static JSClassRef menuItemClass = 0; - - if (!menuItemClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticMenuItemFunctions; - classDefinition.staticValues = staticMenuItemValues; - - menuItemClass = JSClassCreate(&classDefinition); - } - - return menuItemClass; -} - - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS); - - if (!prepareMouseButtonEvent(pressEvent, 2, 0)) { - gdk_event_free(pressEvent); - return JSObjectMakeArray(context, 0, 0, 0); - } - - GdkEvent* releaseEvent = gdk_event_copy(pressEvent); - sendOrQueueEvent(pressEvent); - - JSValueRef valueRef = JSObjectMakeArray(context, 0, 0, 0); - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - GtkMenu* gtkMenu = webkit_web_view_get_context_menu(view); - if (gtkMenu) { - GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(gtkMenu))); - JSValueRef arrayValues[g_list_length(items.get())]; - int index = 0; - for (GList* item = g_list_first(items.get()); item; item = g_list_next(item)) { - arrayValues[index] = JSObjectMake(context, getMenuItemClass(), item->data); - index++; - } - if (index) - valueRef = JSObjectMakeArray(context, index - 1, arrayValues, 0); - } - - releaseEvent->type = GDK_BUTTON_RELEASE; - sendOrQueueEvent(releaseEvent); - return valueRef; -} - -static gboolean sendClick(gpointer) -{ - GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS); - - if (!prepareMouseButtonEvent(pressEvent, 1, 0)) { - gdk_event_free(pressEvent); - return FALSE; - } - - GdkEvent* releaseEvent = gdk_event_copy(pressEvent); - dispatchEvent(pressEvent); - releaseEvent->type = GDK_BUTTON_RELEASE; - dispatchEvent(releaseEvent); - - return FALSE; -} - -static JSValueRef scheduleAsynchronousClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - g_timeout_add(0, sendClick, 0); - return JSValueMakeUndefined(context); -} - -static void updateClickCount(int button) -{ - if (lastClickPositionX != lastMousePositionX - || lastClickPositionY != lastMousePositionY - || lastClickButton != button - || timeOffset - lastClickTimeOffset >= 1) - clickCount = 1; - else - clickCount++; -} - -static guint gdkModifierFromJSValue(JSContextRef context, const JSValueRef value) -{ - JSStringRef string = JSValueToStringCopy(context, value, 0); - guint gdkModifier = 0; - if (JSStringIsEqualToUTF8CString(string, "ctrlKey") - || JSStringIsEqualToUTF8CString(string, "addSelectionKey")) - gdkModifier = GDK_CONTROL_MASK; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey") - || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey")) - gdkModifier = GDK_SHIFT_MASK; - else if (JSStringIsEqualToUTF8CString(string, "altKey")) - gdkModifier = GDK_MOD1_MASK; - - // Currently the metaKey as defined in WebCore/platform/gtk/PlatformMouseEventGtk.cpp - // is GDK_META_MASK. This code must be kept in sync with that file. - else if (JSStringIsEqualToUTF8CString(string, "metaKey")) - gdkModifier = GDK_META_MASK; - - JSStringRelease(string); - return gdkModifier; -} - -static guint gdkModifersFromJSValue(JSContextRef context, const JSValueRef modifiers) -{ - // The value may either be a string with a single modifier or an array of modifiers. - if (JSValueIsString(context, modifiers)) - return gdkModifierFromJSValue(context, modifiers); - - JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0); - if (!modifiersArray) - return 0; - - guint gdkModifiers = 0; - JSRetainPtr<JSStringRef> lengthProperty(Adopt, JSStringCreateWithUTF8CString("length")); - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty.get(), 0), 0); - for (int i = 0; i < modifiersCount; ++i) - gdkModifiers |= gdkModifierFromJSValue(context, JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0)); - return gdkModifiers; -} - -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int button = 0; - if (argumentCount == 1) { - button = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - } - guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0; - - GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); - if (!prepareMouseButtonEvent(event, button, modifiers)) { - gdk_event_free(event); - return JSValueMakeUndefined(context); - } - - // If the same mouse button is already in the down position don't send another event as it may confuse Xvfb. - if (buttonCurrentlyDown == event->button.button) { - gdk_event_free(event); - return JSValueMakeUndefined(context); - } - - buttonCurrentlyDown = event->button.button; - - // Normally GDK will send both GDK_BUTTON_PRESS and GDK_2BUTTON_PRESS for - // the second button press during double-clicks. WebKit GTK+ selectively - // ignores the first GDK_BUTTON_PRESS of that pair using gdk_event_peek. - // Since our events aren't ever going onto the GDK event queue, WebKit won't - // be able to filter out the first GDK_BUTTON_PRESS, so we just don't send - // it here. Eventually this code should probably figure out a way to get all - // appropriate events onto the event queue and this work-around should be - // removed. - updateClickCount(event->button.button); - if (clickCount == 2) - event->type = GDK_2BUTTON_PRESS; - else if (clickCount == 3) - event->type = GDK_3BUTTON_PRESS; - - sendOrQueueEvent(event); - return JSValueMakeUndefined(context); -} - -static guint getStateFlags() -{ - if (buttonCurrentlyDown == 1) - return GDK_BUTTON1_MASK; - if (buttonCurrentlyDown == 2) - return GDK_BUTTON2_MASK; - if (buttonCurrentlyDown == 3) - return GDK_BUTTON3_MASK; - return 0; -} - -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int button = 0; - if (argumentCount == 1) { - button = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - } - guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0; - - GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); - if (!prepareMouseButtonEvent(event, button, modifiers)) { - gdk_event_free(event); - return JSValueMakeUndefined(context); - } - - lastClickPositionX = lastMousePositionX; - lastClickPositionY = lastMousePositionY; - lastClickButton = buttonCurrentlyDown; - lastClickTimeOffset = timeOffset; - buttonCurrentlyDown = 0; - - sendOrQueueEvent(event); - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - lastMousePositionX = (int)JSValueToNumber(context, arguments[0], exception); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - lastMousePositionY = (int)JSValueToNumber(context, arguments[1], exception); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - - GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY); - event->motion.x = lastMousePositionX; - event->motion.y = lastMousePositionY; - - event->motion.time = GDK_CURRENT_TIME; - event->motion.window = gtk_widget_get_window(GTK_WIDGET(view)); - g_object_ref(event->motion.window); - event->button.device = getDefaultGDKPointerDevice(event->motion.window); - - guint modifiers = argumentCount >= 3 ? gdkModifersFromJSValue(context, arguments[2]) : 0; - event->motion.state = modifiers | getStateFlags(); - event->motion.axes = 0; - - int xRoot, yRoot; - gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); - event->motion.x_root = xRoot; - event->motion.y_root = yRoot; - - sendOrQueueEvent(event, false); - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - int horizontal = (int)JSValueToNumber(context, arguments[0], exception); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - 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; - event->scroll.time = GDK_CURRENT_TIME; - event->scroll.window = gtk_widget_get_window(GTK_WIDGET(view)); - g_object_ref(event->scroll.window); - - // GTK+ only supports one tick in each scroll event that is not smooth. For the cases of more than one direction, - // and more than one step in a direction, we can only use smooth events, supported from Gtk 3.3.18. -#if GTK_CHECK_VERSION(3, 3, 18) - if ((horizontal && vertical) || horizontal > 1 || horizontal < -1 || vertical > 1 || vertical < -1) { - event->scroll.direction = GDK_SCROLL_SMOOTH; - event->scroll.delta_x = -horizontal; - event->scroll.delta_y = -vertical; - - sendOrQueueEvent(event); - return JSValueMakeUndefined(context); - } -#else - g_return_val_if_fail((!vertical || !horizontal), JSValueMakeUndefined(context)); -#endif - - if (horizontal < 0) - event->scroll.direction = GDK_SCROLL_RIGHT; - else if (horizontal > 0) - event->scroll.direction = GDK_SCROLL_LEFT; - else if (vertical < 0) - event->scroll.direction = GDK_SCROLL_DOWN; - else if (vertical > 0) - event->scroll.direction = GDK_SCROLL_UP; - else - g_assert_not_reached(); - - sendOrQueueEvent(event); - return JSValueMakeUndefined(context); -} - -static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ -#if GTK_CHECK_VERSION(3, 3, 18) - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - int horizontal = JSValueToNumber(context, arguments[0], exception); - g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context)); - int vertical = JSValueToNumber(context, arguments[1], exception); - g_return_val_if_fail((!exception || !*exception), 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; - event->scroll.time = GDK_CURRENT_TIME; - event->scroll.window = gtk_widget_get_window(GTK_WIDGET(view)); - g_object_ref(event->scroll.window); - - event->scroll.direction = GDK_SCROLL_SMOOTH; - event->scroll.delta_x = -horizontal / pixelsPerScrollTick; - event->scroll.delta_y = -vertical / pixelsPerScrollTick; - - sendOrQueueEvent(event); -#endif - return JSValueMakeUndefined(context); -} - -static void dragWithFilesDragDataGetCallback(GtkWidget*, GdkDragContext*, GtkSelectionData *data, guint, guint, gpointer userData) -{ - gtk_selection_data_set_uris(data, static_cast<gchar**>(userData)); -} - -static void dragWithFilesDragEndCallback(GtkWidget* widget, GdkDragContext*, gpointer userData) -{ - g_signal_handlers_disconnect_by_func(widget, reinterpret_cast<void*>(dragWithFilesDragEndCallback), userData); - g_signal_handlers_disconnect_by_func(widget, reinterpret_cast<void*>(dragWithFilesDragDataGetCallback), userData); - g_strfreev(static_cast<gchar**>(userData)); -} - -static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSObjectRef filesArray = JSValueToObject(context, arguments[0], exception); - ASSERT(!exception || !*exception); - - const gchar* mainFrameURI = webkit_web_frame_get_uri(mainFrame); - GRefPtr<GFile> testFile(adoptGRef(g_file_new_for_uri(mainFrameURI))); - GRefPtr<GFile> parentDirectory(g_file_get_parent(testFile.get())); - if (!parentDirectory) - return JSValueMakeUndefined(context); - - // If this is an HTTP test, we still need to pass a local file path - // to WebCore. Even though the file doesn't exist, this should be fine - // for most tests. - 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 = adoptGRef(g_file_new_for_path(currentDirectory.get())); - } - - JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); - int filesArrayLength = JSValueToNumber(context, JSObjectGetProperty(context, filesArray, lengthProperty, 0), 0); - JSStringRelease(lengthProperty); - - gchar** draggedFilesURIList = g_new0(gchar*, filesArrayLength + 1); - for (int i = 0; i < filesArrayLength; ++i) { - JSStringRef filenameString = JSValueToStringCopy(context, - JSObjectGetPropertyAtIndex(context, filesArray, i, 0), 0); - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(filenameString); - GOwnPtr<gchar> filenameBuffer(static_cast<gchar*>(g_malloc(bufferSize))); - JSStringGetUTF8CString(filenameString, filenameBuffer.get(), bufferSize); - JSStringRelease(filenameString); - - GRefPtr<GFile> dragFile(g_file_get_child(parentDirectory.get(), filenameBuffer.get())); - draggedFilesURIList[i] = g_file_get_uri(dragFile.get()); - } - - GtkWidget* view = GTK_WIDGET(webkit_web_frame_get_web_view(mainFrame)); - g_object_connect(G_OBJECT(view), - "signal::drag-end", dragWithFilesDragEndCallback, draggedFilesURIList, - "signal::drag-data-get", dragWithFilesDragDataGetCallback, draggedFilesURIList, - NULL); - - GdkEvent event; - GdkWindow* viewGDKWindow = gtk_widget_get_window(view); - memset(&event, 0, sizeof(event)); - event.type = GDK_MOTION_NOTIFY; - event.motion.x = lastMousePositionX; - event.motion.y = lastMousePositionY; - event.motion.time = GDK_CURRENT_TIME; - event.motion.window = viewGDKWindow; - event.motion.device = getDefaultGDKPointerDevice(viewGDKWindow); - event.motion.state = GDK_BUTTON1_MASK; - - int xRoot, yRoot; - gdk_window_get_root_coords(viewGDKWindow, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); - event.motion.x_root = xRoot; - event.motion.y_root = yRoot; - - GtkTargetList* targetList = gtk_target_list_new(0, 0); - gtk_target_list_add_uri_targets(targetList, 0); - gtk_drag_begin(view, targetList, GDK_ACTION_COPY, 1, &event); - gtk_target_list_unref(targetList); - - return JSValueMakeUndefined(context); -} - -static void sendOrQueueEvent(GdkEvent* event, bool shouldReplaySavedEvents) -{ - // Mouse move events are queued if the previous event was queued or if a - // delay was set up by leapForward(). - if ((dragMode && buttonCurrentlyDown) || endOfQueue != startOfQueue || msgQueue[endOfQueue].delay) { - msgQueue[endOfQueue++].event = event; - - if (shouldReplaySavedEvents) - replaySavedEvents(); - - return; - } - - dispatchEvent(event); -} - -static void dispatchEvent(GdkEvent* event) -{ - DumpRenderTreeSupportGtk::layoutFrame(mainFrame); - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) { - gdk_event_free(event); - return; - } - - // The widget focus may have been lost in the course of the test, - // so force another explicit focus grab here. - gtk_widget_grab_focus(GTK_WIDGET(view)); - gtk_main_do_event(event); - - if (!currentDragSourceContext) { - gdk_event_free(event); - return; - } - - if (event->type == GDK_MOTION_NOTIFY) { - // WebKit has called gtk_drag_start(), but because the main loop isn't - // running GDK internals don't know that the drag has started yet. Pump - // the main loop a little bit so that GDK is in the correct state. - while (gtk_events_pending()) - gtk_main_iteration(); - - // Simulate a drag motion on the top-level GDK window. - GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view)); - GdkWindow* parentWidgetWindow = gtk_widget_get_window(parentWidget); - gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND, - event->motion.x_root, event->motion.y_root, - gdk_drag_context_get_selected_action(currentDragSourceContext), - gdk_drag_context_get_actions(currentDragSourceContext), - GDK_CURRENT_TIME); - - } else if (currentDragSourceContext && event->type == GDK_BUTTON_RELEASE) { - // We've released the mouse button, we should just be able to spin the - // event loop here and have GTK+ send the appropriate notifications for - // the end of the drag. - while (gtk_events_pending()) - gtk_main_iteration(); - } - - gdk_event_free(event); -} - -void replaySavedEvents() -{ - // First send all the events that are ready to be sent - while (startOfQueue < endOfQueue) { - if (msgQueue[startOfQueue].delay) { - g_usleep(msgQueue[startOfQueue].delay * 1000); - msgQueue[startOfQueue].delay = 0; - } - - dispatchEvent(msgQueue[startOfQueue++].event); - } - - startOfQueue = 0; - endOfQueue = 0; -} - -static GdkEvent* createKeyPressEvent(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - g_return_val_if_fail(argumentCount >= 1, 0); - guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0; - - // handle location argument. - int location = DOM_KEY_LOCATION_STANDARD; - if (argumentCount > 2) - location = (int)JSValueToNumber(context, arguments[2], exception); - - JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); - g_return_val_if_fail((!exception || !*exception), 0); - - int gdkKeySym = GDK_VoidSymbol; - if (location == DOM_KEY_LOCATION_NUMPAD) { - if (JSStringIsEqualToUTF8CString(character, "leftArrow")) - gdkKeySym = GDK_KP_Left; - else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) - gdkKeySym = GDK_KP_Right; - else if (JSStringIsEqualToUTF8CString(character, "upArrow")) - gdkKeySym = GDK_KP_Up; - else if (JSStringIsEqualToUTF8CString(character, "downArrow")) - gdkKeySym = GDK_KP_Down; - else if (JSStringIsEqualToUTF8CString(character, "pageUp")) - gdkKeySym = GDK_KP_Page_Up; - else if (JSStringIsEqualToUTF8CString(character, "pageDown")) - gdkKeySym = GDK_KP_Page_Down; - else if (JSStringIsEqualToUTF8CString(character, "home")) - gdkKeySym = GDK_KP_Home; - else if (JSStringIsEqualToUTF8CString(character, "end")) - gdkKeySym = GDK_KP_End; - else if (JSStringIsEqualToUTF8CString(character, "insert")) - gdkKeySym = GDK_KP_Insert; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - gdkKeySym = GDK_KP_Delete; - else - // If we get some other key specified with the numpad location, - // crash here, so we add it sooner rather than later. - g_assert_not_reached(); - } else { - if (JSStringIsEqualToUTF8CString(character, "leftArrow")) - gdkKeySym = GDK_Left; - else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) - gdkKeySym = GDK_Right; - else if (JSStringIsEqualToUTF8CString(character, "upArrow")) - gdkKeySym = GDK_Up; - else if (JSStringIsEqualToUTF8CString(character, "downArrow")) - gdkKeySym = GDK_Down; - else if (JSStringIsEqualToUTF8CString(character, "pageUp")) - gdkKeySym = GDK_Page_Up; - else if (JSStringIsEqualToUTF8CString(character, "pageDown")) - gdkKeySym = GDK_Page_Down; - else if (JSStringIsEqualToUTF8CString(character, "home")) - gdkKeySym = GDK_Home; - else if (JSStringIsEqualToUTF8CString(character, "end")) - gdkKeySym = GDK_End; - else if (JSStringIsEqualToUTF8CString(character, "insert")) - gdkKeySym = GDK_Insert; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - gdkKeySym = GDK_Delete; - else if (JSStringIsEqualToUTF8CString(character, "printScreen")) - gdkKeySym = GDK_Print; - else if (JSStringIsEqualToUTF8CString(character, "menu")) - gdkKeySym = GDK_Menu; - else if (JSStringIsEqualToUTF8CString(character, "F1")) - gdkKeySym = GDK_F1; - else if (JSStringIsEqualToUTF8CString(character, "F2")) - gdkKeySym = GDK_F2; - else if (JSStringIsEqualToUTF8CString(character, "F3")) - gdkKeySym = GDK_F3; - else if (JSStringIsEqualToUTF8CString(character, "F4")) - gdkKeySym = GDK_F4; - else if (JSStringIsEqualToUTF8CString(character, "F5")) - gdkKeySym = GDK_F5; - else if (JSStringIsEqualToUTF8CString(character, "F6")) - gdkKeySym = GDK_F6; - else if (JSStringIsEqualToUTF8CString(character, "F7")) - gdkKeySym = GDK_F7; - else if (JSStringIsEqualToUTF8CString(character, "F8")) - gdkKeySym = GDK_F8; - else if (JSStringIsEqualToUTF8CString(character, "F9")) - gdkKeySym = GDK_F9; - else if (JSStringIsEqualToUTF8CString(character, "F10")) - gdkKeySym = GDK_F10; - else if (JSStringIsEqualToUTF8CString(character, "F11")) - gdkKeySym = GDK_F11; - else if (JSStringIsEqualToUTF8CString(character, "F12")) - gdkKeySym = GDK_F12; - else if (JSStringIsEqualToUTF8CString(character, "leftAlt")) - gdkKeySym = GDK_Alt_L; - else if (JSStringIsEqualToUTF8CString(character, "leftControl")) - gdkKeySym = GDK_Control_L; - else if (JSStringIsEqualToUTF8CString(character, "leftShift")) - gdkKeySym = GDK_Shift_L; - else if (JSStringIsEqualToUTF8CString(character, "rightAlt")) - gdkKeySym = GDK_Alt_R; - else if (JSStringIsEqualToUTF8CString(character, "rightControl")) - gdkKeySym = GDK_Control_R; - else if (JSStringIsEqualToUTF8CString(character, "rightShift")) - gdkKeySym = GDK_Shift_R; - else { - int charCode = JSStringGetCharactersPtr(character)[0]; - if (charCode == '\n' || charCode == '\r') - gdkKeySym = GDK_Return; - else if (charCode == '\t') - gdkKeySym = GDK_Tab; - else if (charCode == '\x8') - gdkKeySym = GDK_BackSpace; - else { - gdkKeySym = gdk_unicode_to_keyval(charCode); - if (WTF::isASCIIUpper(charCode)) - modifiers |= GDK_SHIFT_MASK; - } - } - } - JSStringRelease(character); - - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - g_return_val_if_fail(view, 0); - - GdkEvent* pressEvent = gdk_event_new(GDK_KEY_PRESS); - pressEvent->key.keyval = gdkKeySym; - pressEvent->key.state = modifiers; - pressEvent->key.window = gtk_widget_get_window(GTK_WIDGET(view)); - g_object_ref(pressEvent->key.window); -#ifndef GTK_API_VERSION_2 - gdk_event_set_device(pressEvent, getDefaultGDKPointerDevice(pressEvent->key.window)); -#endif - - // When synthesizing an event, an invalid hardware_keycode value - // can cause it to be badly processed by Gtk+. - GOwnPtr<GdkKeymapKey> keys; - gint nKeys; - if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), gdkKeySym, &keys.outPtr(), &nKeys)) - pressEvent->key.hardware_keycode = keys.get()[0].keycode; - - return pressEvent; -} - -static void sendKeyDown(GdkEvent* pressEvent) -{ - g_return_if_fail(pressEvent); - GdkEvent* releaseEvent = gdk_event_copy(pressEvent); - releaseEvent->type = GDK_KEY_RELEASE; - - dispatchEvent(pressEvent); - dispatchEvent(releaseEvent); - - DumpRenderTreeSupportGtk::deliverAllMutationsIfNecessary(); -} - -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - GdkEvent* pressEvent = createKeyPressEvent(context, argumentCount, arguments, exception); - sendKeyDown(pressEvent); - - return JSValueMakeUndefined(context); -} - -static void zoomIn(gboolean fullContentsZoom) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return; - - webkit_web_view_set_full_content_zoom(view, fullContentsZoom); - gfloat currentZoom = webkit_web_view_get_zoom_level(view); - webkit_web_view_set_zoom_level(view, currentZoom * zoomMultiplierRatio); -} - -static void zoomOut(gboolean fullContentsZoom) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return; - - webkit_web_view_set_full_content_zoom(view, fullContentsZoom); - gfloat currentZoom = webkit_web_view_get_zoom_level(view); - webkit_web_view_set_zoom_level(view, currentZoom / zoomMultiplierRatio); -} - -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - zoomIn(FALSE); - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - zoomOut(FALSE); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - zoomIn(TRUE); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - zoomOut(TRUE); - return JSValueMakeUndefined(context); -} - -static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - float scaleFactor = JSValueToNumber(context, arguments[0], exception); - float x = JSValueToNumber(context, arguments[1], exception); - float y = JSValueToNumber(context, arguments[2], exception); - - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - return JSValueMakeUndefined(context); - - DumpRenderTreeSupportGtk::scalePageBy(view, scaleFactor, x, y); - - return JSValueMakeUndefined(context); -} - -static gboolean sendAsynchronousKeyDown(gpointer userData) -{ - sendKeyDown(static_cast<GdkEvent*>(userData)); - return FALSE; -} - -static JSValueRef scheduleAsynchronousKeyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - GdkEvent* pressEvent = createKeyPressEvent(context, argumentCount, arguments, exception); - if (pressEvent) - g_timeout_add(0, sendAsynchronousKeyDown, static_cast<gpointer>(pressEvent)); - - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "scheduleAsynchronousKeyDown", scheduleAsynchronousKeyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - - { 0, 0, 0 } -}; - -static JSStaticValue staticValues[] = { - { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef eventSenderClass = 0; - - if (!eventSenderClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticFunctions; - classDefinition.staticValues = staticValues; - - eventSenderClass = JSClassCreate(&classDefinition); - } - - return eventSenderClass; -} - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame) -{ - if (isTopFrame) { - dragMode = true; - - // Fly forward in time one second when the main frame loads. This will - // ensure that when a test begins clicking in the same location as - // a previous test, those clicks won't be interpreted as continuations - // of the previous test's click sequences. - timeOffset += 1000; - - lastMousePositionX = lastMousePositionY = 0; - lastClickPositionX = lastClickPositionY = 0; - lastClickTimeOffset = 0; - lastClickButton = 0; - buttonCurrentlyDown = 0; - clickCount = 0; - - endOfQueue = 0; - startOfQueue = 0; - - currentDragSourceContext = 0; - } - - return JSObjectMake(context, getClass(context), 0); -} - -void dragBeginCallback(GtkWidget*, GdkDragContext* context, gpointer) -{ - currentDragSourceContext = context; -} - -void dragEndCallback(GtkWidget*, GdkDragContext* context, gpointer) -{ - currentDragSourceContext = 0; -} - -gboolean dragFailedCallback(GtkWidget*, GdkDragContext* context, gpointer) -{ - // Return TRUE here to disable the stupid GTK+ drag failed animation, - // which introduces asynchronous behavior into our drags. - return TRUE; -} diff --git a/Tools/DumpRenderTree/gtk/EventSender.h b/Tools/DumpRenderTree/gtk/EventSender.h deleted file mode 100644 index f440f0d3d..000000000 --- a/Tools/DumpRenderTree/gtk/EventSender.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * Copyright (C) 2009 Holger Hans Peter Freyther - * - * 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 EventSender_h -#define EventSender_h - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame); -void replaySavedEvents(); -void dragBeginCallback(GtkWidget*, GdkDragContext*, gpointer); -void dragEndCallback(GtkWidget*, GdkDragContext*, gpointer); -gboolean dragFailedCallback(GtkWidget*, GdkDragContext*, gpointer); - -#endif diff --git a/Tools/DumpRenderTree/gtk/GCControllerGtk.cpp b/Tools/DumpRenderTree/gtk/GCControllerGtk.cpp deleted file mode 100644 index 4eb5d6ec9..000000000 --- a/Tools/DumpRenderTree/gtk/GCControllerGtk.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (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 "GCController.h" - -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" - -#include <glib.h> -#include <webkit/webkit.h> - -void GCController::collect() const -{ - DumpRenderTreeSupportGtk::gcCollectJavascriptObjects(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - DumpRenderTreeSupportGtk::gcCollectJavascriptObjectsOnAlternateThread(waitUntilDone); -} - -size_t GCController::getJSObjectCount() const -{ - return DumpRenderTreeSupportGtk::gcCountJavascriptObjects(); -} diff --git a/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp b/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp deleted file mode 100644 index 0a800ec13..000000000 --- a/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp +++ /dev/null @@ -1,115 +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 "config.h" - -#include "DumpRenderTree.h" -#include "GtkVersioning.h" -#include "PixelDumpSupportCairo.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include <webkit/webkit.h> - -static void paintOverlay(cairo_surface_t* surface) -{ - cairo_t* context = cairo_create(surface); - - // Paint a transparent black overlay from which the repainted rectangles are then cleared. - // The alpha component of the overlay should have a value of 0.66, as on other ports. - cairo_set_source_rgba(context, 0.0, 0.0, 0.0, 0.66); - cairo_rectangle(context, 0, 0, cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface)); - cairo_fill(context); - - GSList* trackedRectsList = DumpRenderTreeSupportGtk::trackedRepaintRects(mainFrame); - for (GSList* listElement = trackedRectsList; listElement; listElement = g_slist_next(listElement)) { - GdkRectangle* rect = static_cast<GdkRectangle*>(listElement->data); - - cairo_set_operator(context, CAIRO_OPERATOR_CLEAR); - cairo_rectangle(context, rect->x, rect->y, rect->width, rect->height); - cairo_fill(context); - } - - g_slist_free_full(trackedRectsList, g_free); - cairo_destroy(context); -} - -static void fillRepaintOverlayIntoContext(cairo_t* context, gint width, gint height) -{ - cairo_surface_t* overlaySurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); - paintOverlay(overlaySurface); - - cairo_set_source_surface(context, overlaySurface, 0, 0); - cairo_rectangle(context, 0, 0, width, height); - cairo_fill(context); - - cairo_surface_destroy(overlaySurface); -} - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool drawSelectionRect) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - GtkWidget* viewContainer = gtk_widget_get_parent(GTK_WIDGET(view)); - gint width, height; -#ifdef GTK_API_VERSION_2 - GdkPixmap* pixmap = gtk_widget_get_snapshot(viewContainer, 0); - gdk_pixmap_get_size(pixmap, &width, &height); -#else - width = gtk_widget_get_allocated_width(viewContainer); - height = gtk_widget_get_allocated_height(viewContainer); -#endif - - while (gtk_events_pending()) - gtk_main_iteration(); - - cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); - cairo_t* context = cairo_create(imageSurface); - -#ifdef GTK_API_VERSION_2 - gdk_cairo_set_source_pixmap(context, pixmap, 0, 0); - cairo_paint(context); - g_object_unref(pixmap); -#else - gtk_widget_draw(viewContainer, context); -#endif - - if (DumpRenderTreeSupportGtk::isTrackingRepaints(mainFrame)) - fillRepaintOverlayIntoContext(context, width, height); - - if (drawSelectionRect) { - cairo_rectangle_int_t rectangle; - DumpRenderTreeSupportGtk::rectangleForSelection(mainFrame, &rectangle); - - cairo_set_line_width(context, 1.0); - cairo_rectangle(context, rectangle.x, rectangle.y, rectangle.width, rectangle.height); - cairo_set_source_rgba(context, 1.0, 0.0, 0.0, 1.0); - cairo_stroke(context); - } - - cairo_surface_destroy(imageSurface); - return BitmapContext::createByAdoptingBitmapAndContext(0, context); -} diff --git a/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.cpp b/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.cpp deleted file mode 100644 index d77cfd5f1..000000000 --- a/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2011 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 "config.h" -#include "SelfScrollingWebKitWebView.h" - -#include <webkit/webkit.h> - -G_BEGIN_DECLS - -#ifdef GTK_API_VERSION_2 -static void sizeRequestMethod(GtkWidget*, GtkRequisition*); -#else -static void getPreferredSizeMethod(GtkWidget*, gint* minimum, gint* natural); -#endif - -G_DEFINE_TYPE(SelfScrollingWebKitWebView, self_scrolling_webkit_web_view, WEBKIT_TYPE_WEB_VIEW) - -static void self_scrolling_webkit_web_view_class_init(SelfScrollingWebKitWebViewClass* klass) -{ - GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(klass); -#ifdef GTK_API_VERSION_2 - widgetClass->size_request = sizeRequestMethod; -#else - widgetClass->get_preferred_width = getPreferredSizeMethod; - widgetClass->get_preferred_height = getPreferredSizeMethod; -#endif -} - -static void self_scrolling_webkit_web_view_init(SelfScrollingWebKitWebView* webView) -{ -} - -GtkWidget* self_scrolling_webkit_web_view_new() -{ - return GTK_WIDGET(g_object_new(self_scrolling_webkit_web_view_get_type(), "self-scrolling", TRUE, NULL)); -} - -#ifdef GTK_API_VERSION_2 -static void sizeRequestMethod(GtkWidget*, GtkRequisition* requisition) -{ - requisition->width = 1; - requisition->height = 1; -} -#else -static void getPreferredSizeMethod(GtkWidget*, gint* minimum, gint* natural) -{ - *minimum = 1; - *natural = 1; -} -#endif - -G_END_DECLS diff --git a/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.h b/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.h deleted file mode 100644 index 648d38c97..000000000 --- a/Tools/DumpRenderTree/gtk/SelfScrollingWebKitWebView.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#ifndef SelfScrollingWebKitWebView_h -#define SelfScrollingWebKitWebView_h - -#include <webkit/webkit.h> - -G_BEGIN_DECLS - -typedef struct _SelfScrollingWebKitWebView SelfScrollingWebKitWebView; -typedef struct _SelfScrollingWebKitWebViewClass SelfScrollingWebKitWebViewClass; - -struct _SelfScrollingWebKitWebView { - WebKitWebView web_view; -}; - -struct _SelfScrollingWebKitWebViewClass { - WebKitWebViewClass parent_class; -}; - -GtkWidget* self_scrolling_webkit_web_view_new(); - -G_END_DECLS - -#endif // SelfScrollingWebKitWebView_h diff --git a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp b/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp deleted file mode 100644 index 7669a0133..000000000 --- a/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp +++ /dev/null @@ -1,942 +0,0 @@ -/* - * Copyright (C) 2007, 2012 Apple Inc. All rights reserved. - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * Copyright (C) 2008 Nuanti Ltd. - * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com> - * Copyright (C) 2009,2011 Collabora Ltd. - * Copyright (C) 2010 Joone Hur <joone@kldp.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 "TestRunner.h" - -#include "DumpRenderTree.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <cstring> -#include <iostream> -#include <sstream> -#include <stdio.h> -#include <glib.h> -#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); -} - -TestRunner::~TestRunner() -{ - // FIXME: implement -} - -void TestRunner::addDisallowedURL(JSStringRef url) -{ - // FIXME: implement -} - -void TestRunner::clearBackForwardList() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); - WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_current_item(list); - g_object_ref(item); - - // We clear the history by setting the back/forward list's capacity to 0 - // then restoring it back and adding back the current item. - gint limit = webkit_web_back_forward_list_get_limit(list); - webkit_web_back_forward_list_set_limit(list, 0); - webkit_web_back_forward_list_set_limit(list, limit); - webkit_web_back_forward_list_add_item(list, item); - webkit_web_back_forward_list_go_to_item(list, item); - g_object_unref(item); -} - -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() -{ - displayWebView(); -} - -void TestRunner::keepWebHistory() -{ - // FIXME: implement -} - -size_t TestRunner::webHistoryItemCount() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); - - if (!list) - return -1; - - // We do not add the current page to the total count as it's not - // considered in DRT tests - return webkit_web_back_forward_list_get_back_length(list) + - webkit_web_back_forward_list_get_forward_length(list); -} - -JSRetainPtr<JSStringRef> TestRunner::platformName() const -{ - JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("gtk")); - return platformName; -} - -void TestRunner::notifyDone() -{ - if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) - dump(); - m_waitToDump = false; - waitForPolicy = false; -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url) -{ - GOwnPtr<char> urlCString(JSStringCopyUTF8CString(url)); - if (!g_str_has_prefix(urlCString.get(), "file:///tmp/LayoutTests/")) - return JSStringRetain(url); - - const char* layoutTestsSuffix = urlCString.get() + strlen("file:///tmp/"); - GOwnPtr<char> testPath(g_build_filename(getTopLevelPath().data(), layoutTestsSuffix, NULL)); - GOwnPtr<char> testURI(g_filename_to_uri(testPath.get(), 0, 0)); - 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) -{ - 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.get()); - soup_uri_free(baseURI); - - 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) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - webkit_web_view_set_editable(webView, acceptsEditing); -} - -void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - SoupSession* session = webkit_get_default_session(); - SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR)); - - /* If the jar was not created - we create it on demand, i.e, just - in case we have HTTP requests - then we must create it here in - order to set the proper accept policy */ - if (!jar) { - jar = soup_cookie_jar_new(); - soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar)); - g_object_unref(jar); - } - - SoupCookieJarAcceptPolicy policy; - - if (alwaysAcceptCookies) - policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS; - else - policy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY; - - g_object_set(G_OBJECT(jar), SOUP_COOKIE_JAR_ACCEPT_POLICY, policy, NULL); -} - -void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - // FIXME: implement -} - -void TestRunner::waitForPolicyDelegate() -{ - waitForPolicy = true; - setWaitToDump(true); -} - -void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) -{ - // FIXME: implement -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) -{ - gchar* sourceOriginGChar = JSStringCopyUTF8CString(sourceOrigin); - gchar* protocolGChar = JSStringCopyUTF8CString(protocol); - gchar* hostGChar = JSStringCopyUTF8CString(host); - DumpRenderTreeSupportGtk::whiteListAccessFromOrigin(sourceOriginGChar, protocolGChar, hostGChar, includeSubdomains); - g_free(sourceOriginGChar); - g_free(protocolGChar); - g_free(hostGChar); -} - -void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) -{ - GOwnPtr<gchar> sourceOriginGChar(JSStringCopyUTF8CString(sourceOrigin)); - GOwnPtr<gchar> protocolGChar(JSStringCopyUTF8CString(protocol)); - GOwnPtr<gchar> hostGChar(JSStringCopyUTF8CString(host)); - DumpRenderTreeSupportGtk::removeWhiteListAccessFromOrigin(sourceOriginGChar.get(), protocolGChar.get(), hostGChar.get(), includeSubdomains); -} - -void TestRunner::setMainFrameIsFirstResponder(bool flag) -{ - // FIXME: implement -} - -void TestRunner::setTabKeyCyclesThroughElements(bool cycles) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebSettings* settings = webkit_web_view_get_settings(webView); - g_object_set(G_OBJECT(settings), "tab-key-cycles-through-elements", cycles, NULL); -} - -void TestRunner::setUseDashboardCompatibilityMode(bool flag) -{ - // FIXME: implement -} - -static gchar* userStyleSheet = NULL; -static gboolean userStyleSheetEnabled = TRUE; - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ - userStyleSheetEnabled = flag; - - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebSettings* settings = webkit_web_view_get_settings(webView); - if (flag && userStyleSheet) - g_object_set(G_OBJECT(settings), "user-stylesheet-uri", userStyleSheet, NULL); - else - g_object_set(G_OBJECT(settings), "user-stylesheet-uri", "", NULL); -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef path) -{ - g_free(userStyleSheet); - userStyleSheet = JSStringCopyUTF8CString(path); - if (userStyleSheetEnabled) - setUserStyleSheetEnabled(true); -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) -{ - DumpRenderTreeSupportGtk::setValueForUser(context, nodeObject, value); -} - -void TestRunner::setViewModeMediaFeature(JSStringRef mode) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - char* viewMode = JSStringCopyUTF8CString(mode); - - if (!g_strcmp0(viewMode, "windowed")) - webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED); - else if (!g_strcmp0(viewMode, "floating")) - webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_FLOATING); - else if (!g_strcmp0(viewMode, "fullscreen")) - webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_FULLSCREEN); - else if (!g_strcmp0(viewMode, "maximized")) - webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_MAXIMIZED); - else if (!g_strcmp0(viewMode, "minimized")) - webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_MINIMIZED); - - g_free(viewMode); -} - -void TestRunner::setWindowIsKey(bool windowIsKey) -{ - // FIXME: implement -} - -static gboolean waitToDumpWatchdogFired(void*) -{ - setWaitToDumpWatchdog(0); - gTestRunner->waitToDumpWatchdogTimerFired(); - return FALSE; -} - -void TestRunner::setWaitToDump(bool waitUntilDone) -{ - static const int timeoutSeconds = 30; - - m_waitToDump = waitUntilDone; - if (m_waitToDump && shouldSetWaitToDumpWatchdog()) - setWaitToDumpWatchdog(g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0)); -} - -int TestRunner::windowCount() -{ - // +1 -> including the main view - return g_slist_length(webViewList) + 1; -} - -void TestRunner::setPrivateBrowsingEnabled(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-private-browsing", flag, NULL); -} - -void TestRunner::setJavaScriptCanAccessClipboard(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), "javascript-can-access-clipboard", flag, NULL); -} - -void TestRunner::setXSSAuditorEnabled(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-xss-auditor", flag, NULL); -} - -void TestRunner::setSpatialNavigationEnabled(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-spatial-navigation", flag, NULL); -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(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-universal-access-from-file-uris", flag, NULL); -} - -void TestRunner::setAllowFileAccessFromFileURLs(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-file-access-from-file-uris", flag, NULL); -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool flag) -{ - // FIXME: implement -} - -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, double, bool, double, bool, double, bool, double) -{ - WebKitWebView* view = WEBKIT_WEB_VIEW(g_slist_nth_data(webViewList, 0)); - if (!view) - view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - DumpRenderTreeSupportGtk::setMockGeolocationPosition(view, latitude, longitude, accuracy); -} - -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) -{ - WebKitWebView* view = WEBKIT_WEB_VIEW(g_slist_nth_data(webViewList, 0)); - if (!view) - view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - GOwnPtr<gchar> cMessage(JSStringCopyUTF8CString(message)); - DumpRenderTreeSupportGtk::setMockGeolocationPositionUnavailableError(view, cMessage.get()); -} - -void TestRunner::setGeolocationPermission(bool allow) -{ - setGeolocationPermissionCommon(allow); - WebKitWebView* view = WEBKIT_WEB_VIEW(g_slist_nth_data(webViewList, 0)); - if (!view) - view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - DumpRenderTreeSupportGtk::setMockGeolocationPermission(view, allow); -} - -int TestRunner::numberOfPendingGeolocationPermissionRequests() -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - if (!view) - view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - return DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests(view); -} - -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 enabled) -{ - WebKitIconDatabase* database = webkit_get_icon_database(); - if (enabled) { - GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_tmp_dir(), "DumpRenderTree", "icondatabase", NULL)); - webkit_icon_database_set_path(database, iconDatabasePath.get()); - } else - webkit_icon_database_set_path(database, 0); -} - -void TestRunner::setPopupBlockingEnabled(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), "javascript-can-open-windows-automatically", !flag, NULL); - -} - -void TestRunner::setPluginsEnabled(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-plugins", flag, NULL); -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - gchar* cName = JSStringCopyUTF8CString(name); - gchar* cValue = JSStringCopyUTF8CString(value); - DumpRenderTreeSupportGtk::executeCoreCommandByName(view, cName, cValue); - g_free(cName); - g_free(cValue); -} - -bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) -{ - WebKitFindOptions findOptions = 0; - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - ASSERT(webView); - - JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); - JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); - if (!JSValueIsNumber(context, lengthValue)) - return false; - - GOwnPtr<gchar> targetString(JSStringCopyUTF8CString(target)); - - size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0)); - for (size_t i = 0; i < length; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0); - if (!JSValueIsString(context, value)) - continue; - - JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0)); - - if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive")) - findOptions |= WebKit::WebFindOptionsCaseInsensitive; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) - findOptions |= WebKit::WebFindOptionsAtWordStarts; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) - findOptions |= WebKit::WebFindOptionsTreatMedialCapitalAsWordStart; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) - findOptions |= WebKit::WebFindOptionsBackwards; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) - findOptions |= WebKit::WebFindOptionsWrapAround; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) - findOptions |= WebKit::WebFindOptionsStartInSelection; - } - - return DumpRenderTreeSupportGtk::findString(webView, targetString.get(), findOptions); -} - -bool TestRunner::isCommandEnabled(JSStringRef name) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - gchar* cName = JSStringCopyUTF8CString(name); - bool result = DumpRenderTreeSupportGtk::isCommandEnabled(view, cName); - g_free(cName); - return result; -} - -void TestRunner::setCacheModel(int cacheModel) -{ - // These constants are derived from the Mac cache model enum in Source/WebKit/mac/WebView/WebPreferences.h. - switch (cacheModel) { - case 0: - webkit_set_cache_model(WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER); - break; - case 1: - webkit_set_cache_model(WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER); - break; - case 2: - webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER); - break; - default: - ASSERT_NOT_REACHED(); - } -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) -{ - // FIXME: implement -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - // FIXME: implement -} - -void TestRunner::clearAllApplicationCaches() -{ - // FIXME: Implement to support application cache quotas. -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) -{ - // FIXME: Implement to support application cache quotas. -} - -void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString*) -{ - // FIXME: Implement to support deleting all application caches for an origin. -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) -{ - // FIXME: Implement to support getting disk usage in bytes for an origin. - return 0; -} - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - // FIXME: Implement to get origins that contain application caches. - return JSValueMakeUndefined(context); -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef name) -{ - // FIXME: implement - return 0; -} - -void TestRunner::clearAllDatabases() -{ - webkit_remove_all_web_databases(); -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(mainFrame); - webkit_security_origin_set_web_database_quota(origin, quota); -} - -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - // FIXME: implement - return JSValueMakeUndefined(context); -} - -void TestRunner::deleteAllLocalStorage() -{ - // FIXME: implement -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef originIdentifier) -{ - // FIXME: implement -} - -void TestRunner::observeStorageTrackerNotifications(unsigned number) -{ - // FIXME: implement -} - -void TestRunner::syncLocalStorage() -{ - // FIXME: implement -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) -{ - GOwnPtr<gchar> urlScheme(JSStringCopyUTF8CString(scheme)); - DumpRenderTreeSupportGtk::setDomainRelaxationForbiddenForURLScheme(forbidden, urlScheme.get()); -} - -void TestRunner::goBack() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - webkit_web_view_go_back(webView); -} - -void TestRunner::setDefersLoading(bool defers) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - DumpRenderTreeSupportGtk::setDefersLoading(webView, defers); -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long size) -{ - webkit_application_cache_set_maximum_size(size); -} - -static gboolean booleanFromValue(gchar* value) -{ - return !g_ascii_strcasecmp(value, "true") || !g_ascii_strcasecmp(value, "1"); -} - -void TestRunner::overridePreference(JSStringRef key, JSStringRef value) -{ - GOwnPtr<gchar> originalName(JSStringCopyUTF8CString(key)); - GOwnPtr<gchar> valueAsString(JSStringCopyUTF8CString(value)); - - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - // This transformation could be handled by a hash table (and it once was), but - // having it prominent, makes it easier for people from other ports to keep the - // list up to date. - const gchar* propertyName = 0; - if (g_str_equal(originalName.get(), "WebKitJavaScriptEnabled")) - propertyName = "enable-scripts"; - else if (g_str_equal(originalName.get(), "WebKitDefaultFontSize")) - propertyName = "default-font-size"; - else if (g_str_equal(originalName.get(), "WebKitEnableCaretBrowsing")) - propertyName = "enable-caret-browsing"; - else if (g_str_equal(originalName.get(), "WebKitUsesPageCachePreferenceKey")) - propertyName = "enable-page-cache"; - else if (g_str_equal(originalName.get(), "WebKitPluginsEnabled")) - propertyName = "enable-plugins"; - else if (g_str_equal(originalName.get(), "WebKitHyperlinkAuditingEnabled")) - propertyName = "enable-hyperlink-auditing"; - else if (g_str_equal(originalName.get(), "WebKitWebGLEnabled")) - propertyName = "enable-webgl"; - else if (g_str_equal(originalName.get(), "WebKitWebAudioEnabled")) - propertyName = "enable-webaudio"; - else if (g_str_equal(originalName.get(), "WebKitDisplayImagesKey")) - propertyName = "auto-load-images"; - else if (g_str_equal(originalName.get(), "WebKitTabToLinksPreferenceKey")) { - DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(booleanFromValue(valueAsString.get())); - return; - } else if (g_str_equal(originalName.get(), "WebKitPageCacheSupportsPluginsPreferenceKey")) { - DumpRenderTreeSupportGtk::setPageCacheSupportsPlugins(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); - return; - } else if (g_str_equal(originalName.get(), "WebKitCSSGridLayoutEnabled")) { - DumpRenderTreeSupportGtk::setCSSGridLayoutEnabled(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); - return; - } else if (g_str_equal(originalName.get(), "WebKitCSSRegionsEnabled")) { - DumpRenderTreeSupportGtk::setCSSRegionsEnabled(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); - return; - } else if (g_str_equal(originalName.get(), "WebKitCSSCustomFilterEnabled")) { - DumpRenderTreeSupportGtk::setCSSCustomFilterEnabled(webkit_web_frame_get_web_view(mainFrame), booleanFromValue(valueAsString.get())); - return; - } else { - fprintf(stderr, "TestRunner::overridePreference tried to override " - "unknown preference '%s'.\n", originalName.get()); - return; - } - - WebKitWebSettings* settings = webkit_web_view_get_settings(view); - GParamSpec* pspec = g_object_class_find_property(G_OBJECT_CLASS( - WEBKIT_WEB_SETTINGS_GET_CLASS(settings)), propertyName); - GValue currentPropertyValue = { 0, { { 0 } } }; - g_value_init(¤tPropertyValue, pspec->value_type); - - if (G_VALUE_HOLDS_STRING(¤tPropertyValue)) - g_object_set(settings, propertyName, valueAsString.get(), NULL); - else if (G_VALUE_HOLDS_BOOLEAN(¤tPropertyValue)) - g_object_set(G_OBJECT(settings), propertyName, booleanFromValue(valueAsString.get()), NULL); - else if (G_VALUE_HOLDS_INT(¤tPropertyValue)) - g_object_set(G_OBJECT(settings), propertyName, atoi(valueAsString.get()), NULL); - else if (G_VALUE_HOLDS_FLOAT(¤tPropertyValue)) { - gfloat newValue = g_ascii_strtod(valueAsString.get(), 0); - g_object_set(G_OBJECT(settings), propertyName, newValue, NULL); - } else - fprintf(stderr, "TestRunner::overridePreference failed to override " - "preference '%s'.\n", originalName.get()); -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - GOwnPtr<gchar> sourceCode(JSStringCopyUTF8CString(source)); - DumpRenderTreeSupportGtk::addUserScript(mainFrame, sourceCode.get(), runAtStart, allFrames); -} - -void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) -{ - GOwnPtr<gchar> sourceCode(JSStringCopyUTF8CString(source)); - DumpRenderTreeSupportGtk::addUserStyleSheet(mainFrame, sourceCode.get(), allFrames); - // FIXME: needs more investigation why userscripts/user-style-top-frame-only.html fails when allFrames is false. - -} - -void TestRunner::setDeveloperExtrasEnabled(bool enabled) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView); - - g_object_set(webSettings, "enable-developer-extras", enabled, NULL); -} - -void TestRunner::showWebInspector() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); - - webkit_web_inspector_show(inspector); -} - -void TestRunner::closeWebInspector() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); - - webkit_web_inspector_close(inspector); -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView); - char* scriptString = JSStringCopyUTF8CString(script); - - webkit_web_inspector_execute_script(inspector, callId, scriptString); - g_free(scriptString); -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - // FIXME: Implement this. -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - // FIXME: Implement this. -} - -void TestRunner::removeAllVisitedLinks() -{ - // FIXME: Implement this. -} - -bool TestRunner::callShouldCloseOnWebView() -{ - return DumpRenderTreeSupportGtk::shouldClose(mainFrame); -} - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) -{ - -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - -} - -void TestRunner::setWebViewEditable(bool) -{ -} - -void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ -} - -void TestRunner::abortModal() -{ -} - -void TestRunner::setSerializeHTTPLoads(bool serialize) -{ - DumpRenderTreeSupportGtk::setSerializeHTTPLoads(serialize); -} - -void TestRunner::setTextDirection(JSStringRef direction) -{ - 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() -{ -} - -void TestRunner::removeChromeInputField() -{ -} - -void TestRunner::focusWebView() -{ -} - -void TestRunner::setBackingScaleFactor(double) -{ -} - -void TestRunner::grantWebNotificationPermission(JSStringRef origin) -{ -} - -void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) -{ -} - -void TestRunner::removeAllWebNotificationPermissions() -{ -} - -void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) -{ -} - -void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) -{ -} - -void TestRunner::resetPageVisibility() -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - DumpRenderTreeSupportGtk::setPageVisibility(webView, WebCore::PageVisibilityStateVisible, true); -} - -void TestRunner::setPageVisibility(const char* visibility) -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - String visibilityString(visibility); - WebCore::PageVisibilityState visibilityState = WebCore::PageVisibilityStateVisible; - - if (visibilityString == "visible") - visibilityState = WebCore::PageVisibilityStateVisible; - else if (visibilityString == "hidden") - visibilityState = WebCore::PageVisibilityStateHidden; - else - return; - - DumpRenderTreeSupportGtk::setPageVisibility(webView, visibilityState, false); -} - -void TestRunner::setAutomaticLinkDetectionEnabled(bool) -{ - // FIXME: Implement this. -} - -void TestRunner::setStorageDatabaseIdleInterval(double) -{ - // FIXME: Implement this. -} - -void TestRunner::closeIdleLocalStorageDatabases() -{ -} diff --git a/Tools/DumpRenderTree/gtk/TextInputController.cpp b/Tools/DumpRenderTree/gtk/TextInputController.cpp deleted file mode 100644 index eed3bbe54..000000000 --- a/Tools/DumpRenderTree/gtk/TextInputController.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2011 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 "config.h" -#include "TextInputController.h" - -#include "DumpRenderTree.h" -#include "WebCoreSupport/DumpRenderTreeSupportGtk.h" -#include <GOwnPtrGtk.h> -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <cstring> -#include <webkit/webkit.h> - -static JSValueRef setMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - JSStringRef string = JSValueToStringCopy(context, arguments[0], exception); - ASSERT(!exception || !*exception); - - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string); - GOwnPtr<gchar> stringBuffer(static_cast<gchar*>(g_malloc(bufferSize))); - JSStringGetUTF8CString(string, stringBuffer.get(), bufferSize); - JSStringRelease(string); - - int start = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - - int length = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); - ASSERT(!exception || !*exception); - - DumpRenderTreeSupportGtk::setComposition(view, stringBuffer.get(), start, length); - return JSValueMakeUndefined(context); -} - -static JSValueRef hasMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - return JSValueMakeBoolean(context, DumpRenderTreeSupportGtk::hasComposition(view)); -} - -static JSValueRef markedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - int start, length; - if (!DumpRenderTreeSupportGtk::compositionRange(view, &start, &length)) - return JSValueMakeUndefined(context); - - JSValueRef arrayValues[2]; - arrayValues[0] = JSValueMakeNumber(context, start); - arrayValues[1] = JSValueMakeNumber(context, length); - JSObjectRef arrayObject = JSObjectMakeArray(context, 2, arrayValues, exception); - ASSERT(!exception || !*exception); - return arrayObject; -} - -static JSValueRef insertTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSStringRef string = JSValueToStringCopy(context, arguments[0], exception); - ASSERT(!exception || !*exception); - - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string); - GOwnPtr<gchar> stringBuffer(static_cast<gchar*>(g_malloc(bufferSize))); - JSStringGetUTF8CString(string, stringBuffer.get(), bufferSize); - JSStringRelease(string); - - DumpRenderTreeSupportGtk::confirmComposition(view, stringBuffer.get()); - return JSValueMakeUndefined(context); -} - -static JSValueRef unmarkTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - DumpRenderTreeSupportGtk::confirmComposition(view, 0); - return JSValueMakeUndefined(context); -} - -static JSValueRef firstRectForCharacterRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - int location = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - ASSERT(!exception || !*exception); - - int length = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); - ASSERT(!exception || !*exception); - - cairo_rectangle_int_t rect; - if (!DumpRenderTreeSupportGtk::firstRectForCharacterRange(view, location, length, &rect)) - return JSValueMakeUndefined(context); - - JSValueRef arrayValues[4]; - arrayValues[0] = JSValueMakeNumber(context, rect.x); - arrayValues[1] = JSValueMakeNumber(context, rect.y); - arrayValues[2] = JSValueMakeNumber(context, rect.width); - arrayValues[3] = JSValueMakeNumber(context, rect.height); - JSObjectRef arrayObject = JSObjectMakeArray(context, 4, arrayValues, exception); - ASSERT(!exception || !*exception); - - return arrayObject; -} - -static JSValueRef selectedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - - int start, length; - if (!DumpRenderTreeSupportGtk::selectedRange(view, &start, &length)) - return JSValueMakeUndefined(context); - - JSValueRef arrayValues[2]; - arrayValues[0] = JSValueMakeNumber(context, start); - arrayValues[1] = JSValueMakeNumber(context, length); - JSObjectRef arrayObject = JSObjectMakeArray(context, 2, arrayValues, exception); - ASSERT(!exception || !*exception); - - return arrayObject; -} - -static JSValueRef doCommandCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - ASSERT(view); - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSStringRef string = JSValueToStringCopy(context, arguments[0], exception); - ASSERT(!exception || !*exception); - - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string); - GOwnPtr<gchar> stringBuffer(static_cast<gchar*>(g_malloc(bufferSize))); - JSStringGetUTF8CString(string, stringBuffer.get(), bufferSize); - JSStringRelease(string); - - DumpRenderTreeSupportGtk::doCommand(view, stringBuffer.get()); - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "setMarkedText", setMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "hasMarkedText", hasMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "markedRange", markedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "insertText", insertTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "unmarkText", unmarkTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "firstRectForCharacterRange", firstRectForCharacterRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "selectedRange", selectedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "doCommand", doCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef textInputControllerClass = 0; - - if (!textInputControllerClass) { - JSClassDefinition classDefinition = { - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - classDefinition.staticFunctions = staticFunctions; - - textInputControllerClass = JSClassCreate(&classDefinition); - } - - return textInputControllerClass; -} - -JSObjectRef makeTextInputController(JSContextRef context) -{ - return JSObjectMake(context, getClass(context), 0); -} diff --git a/Tools/DumpRenderTree/gtk/TextInputController.h b/Tools/DumpRenderTree/gtk/TextInputController.h deleted file mode 100644 index 53793f637..000000000 --- a/Tools/DumpRenderTree/gtk/TextInputController.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#ifndef TextInputController_h -#define TextInputController_h - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeTextInputController(JSContextRef); - -#endif diff --git a/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp b/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp deleted file mode 100644 index 23eca7b8b..000000000 --- a/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * - * 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 "config.h" -#include "WorkQueueItem.h" - -#include "DumpRenderTree.h" - -#include <JavaScriptCore/JSStringRef.h> -#include <string.h> -#include <webkit/webkit.h> -#include <wtf/gobject/GOwnPtr.h> - -// Returns a newly allocated UTF-8 character buffer which must be freed with g_free() -gchar* JSStringCopyUTF8CString(JSStringRef jsString) -{ - size_t dataSize = JSStringGetMaximumUTF8CStringSize(jsString); - gchar* utf8 = (gchar*)g_malloc(dataSize); - JSStringGetUTF8CString(jsString, utf8, dataSize); - - return utf8; -} - -bool LoadItem::invoke() const -{ - gchar* targetString = JSStringCopyUTF8CString(m_target.get()); - - WebKitWebFrame* targetFrame; - if (!strlen(targetString)) - targetFrame = mainFrame; - else - targetFrame = webkit_web_frame_find_frame(mainFrame, targetString); - g_free(targetString); - - gchar* urlString = JSStringCopyUTF8CString(m_url.get()); - WebKitNetworkRequest* request = webkit_network_request_new(urlString); - g_free(urlString); - webkit_web_frame_load_request(targetFrame, request); - g_object_unref(request); - - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - GOwnPtr<gchar> content(JSStringCopyUTF8CString(m_content.get())); - GOwnPtr<gchar> baseURL(JSStringCopyUTF8CString(m_baseURL.get())); - - if (m_unreachableURL) { - GOwnPtr<gchar> unreachableURL(JSStringCopyUTF8CString(m_unreachableURL.get())); - webkit_web_frame_load_alternate_string(mainFrame, content.get(), baseURL.get(), unreachableURL.get()); - return true; - } - webkit_web_frame_load_string(mainFrame, content.get(), 0, 0, baseURL.get()); - return true; -} - -bool ReloadItem::invoke() const -{ - webkit_web_frame_reload(mainFrame); - return true; -} - -bool ScriptItem::invoke() const -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - gchar* scriptString = JSStringCopyUTF8CString(m_script.get()); - webkit_web_view_execute_script(webView, scriptString); - g_free(scriptString); - return true; -} - -bool BackForwardItem::invoke() const -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); - if (m_howFar == 1) - webkit_web_view_go_forward(webView); - else if (m_howFar == -1) - webkit_web_view_go_back(webView); - else { - WebKitWebBackForwardList* webBackForwardList = webkit_web_view_get_back_forward_list(webView); - WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(webBackForwardList, m_howFar); - webkit_web_view_go_to_back_forward_item(webView, item); - } - return true; -} diff --git a/Tools/DumpRenderTree/gtk/fonts/AHEM____.TTF b/Tools/DumpRenderTree/gtk/fonts/AHEM____.TTF Binary files differdeleted file mode 100644 index ac81cb031..000000000 --- a/Tools/DumpRenderTree/gtk/fonts/AHEM____.TTF +++ /dev/null diff --git a/Tools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon b/Tools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon Binary files differdeleted file mode 100644 index 8fff7d9c1..000000000 --- a/Tools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon +++ /dev/null diff --git a/Tools/DumpRenderTree/gtk/fonts/fonts.conf b/Tools/DumpRenderTree/gtk/fonts/fonts.conf deleted file mode 100644 index 3c55e87f3..000000000 --- a/Tools/DumpRenderTree/gtk/fonts/fonts.conf +++ /dev/null @@ -1,419 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> -<fontconfig> - - <!-- Due to patent (http://freetype.sourceforge.net/patents.html) - issues hinting gives different results depending on the - freetype version of the linux distribution, avoiding hinting - gives more consistent results. When all the distributions - release freetype the 2.4, which enables by default the - hinting method that was patented, we could undo this change - and try the hinting again. --> - <match target="font"> - <edit name="hinting" mode="assign"> - <bool>false</bool> - </edit> - </match> - - <!-- This system may have turned off selection of bitmap fonts, but - we must turn it on again, because we want to be able to test that - bitmap fonts with no valid encodings are *never* selected regardless - of the Fontconfig settings. So force Fontconfig to select our cruddy - bitmap font --> - <selectfont> - <acceptfont> - <pattern> - <patelt name="family"> - <string>FontWithNoValidEncoding</string> - </patelt> - </pattern> - </acceptfont> - </selectfont> - - <!-- The sans-serif font should be Liberation Serif --> - <match target="pattern"> - <test qual="any" name="family"> - <string>serif</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Times</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Times New Roman</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - </match> - - <!-- Until we find good fonts to use for cursive and fantasy - just use our serif font. --> - <match target="pattern"> - <test qual="any" name="family"> - <string>cursive</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>fantasy</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - </match> - - <!-- The sans-serif font should be Liberation Sans --> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans serif</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - </match> - <!-- We need to ensure that layout tests that use "Helvetica" don't - fall back to the default serif font --> - <match target="pattern"> - <test qual="any" name="family"> - <string>Helvetica</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Arial</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Lucida Grande</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - </match> - - <!-- The Monospace font should be Liberation Mono --> - <match target="pattern"> - <test qual="any" name="family"> - <string>monospace</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Mono</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>mono</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Mono</string> - </edit> - </match> - <!-- We need to ensure that layout tests that use "Courier", "Courier New", - and "Monaco" (all monospace fonts) don't fall back to the default - serif font --> - <match target="pattern"> - <test qual="any" name="family"> - <string>Courier</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Mono</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Courier New</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Mono</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>Monaco</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Mono</string> - </edit> - </match> - - <!-- The following hinting specializations are adapted from those in the - Chromium test_shell. We try to duplicate their incredibly thorough - testing here --> - <match target="pattern"> - <test name="family" compare="eq"> - <string>NonAntiAliasedSans</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - <edit name="antialias" mode="assign"> - <bool>false</bool> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>SlightHintedSerif</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Serif</string> - </edit> - <edit name="hinting" mode="assign"> - <bool>true</bool> - </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>Liberation Sans</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>Liberation Serif</string> - </edit> - <edit name="hinting" mode="assign"> - <bool>true</bool> - </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>Liberation Serif</string> - </edit> - <edit name="hinting" mode="assign"> - <bool>true</bool> - </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>Liberation Serif</string> - </edit> - <edit name="hinting" mode="assign"> - <bool>true</bool> - </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>SubpixelEnabledSans</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - <edit name="rgba" mode="assign"> - <const>rgb</const> - </edit> - </match> - - <match target="pattern"> - <test name="family" compare="eq"> - <string>SubpixelDisabledSans</string> - </test> - <edit name="family" mode="assign"> - <string>Liberation Sans</string> - </edit> - <edit name="rgba" mode="assign"> - <const>none</const> - </edit> - </match> - - <!-- We need to enable simulated bold to for DejaVu Serif to ensure that we interpret - this property correctly in: platform/gtk/fonts/fontconfig-synthetic-bold.html --> - <match target="font"> - <test qual="any" name="family"> - <string>DejaVu Serif</string> - </test> - <test name="weight" compare="less_eq"> - <const>medium</const> - </test> - <test target="pattern" name="weight" compare="more"> - <const>medium</const> - </test> - <edit name="embolden" mode="assign"> - <bool>true</bool> - </edit> - <edit name="weight" mode="assign"> - <const>bold</const> - </edit> - </match> - - <!-- We need to enable simulated oblique to for DejaVu Serif to ensure that we interpret - this property correctly in: platform/gtk/fonts/fontconfig-synthetic-oblique.html --> - <match target="font"> - <test qual="any" name="family"> - <string>DejaVu Serif</string> - </test> - <test name="slant"> - <const>roman</const> - </test> - <test target="pattern" name="slant" compare="not_eq"> - <const>roman</const> - </test> - <edit name="matrix" mode="assign"> - <times> - <name>matrix</name> - <matrix><double>1</double><double>0.2</double> - <double>0</double><double>1</double> - </matrix> - </times> - </edit> - <edit name="slant" mode="assign"> - <const>oblique</const> - </edit> - <edit name="embeddedbitmap" mode="assign"> - <bool>false</bool> - </edit> - </match> - - <!-- If this font doesn't have a family name we are falling back. The fallback - font will certainly be one of the DejaVu fonts that we have in our - collection since they have a wide range of characters. Fontconfig might - choose DejaVu Sans or DejaVu Serif depending on the system, so we force - the use of DejaVu Sans in these situations to maintain consistency. --> - <match target="pattern"> - <test qual="all" name="family" compare="eq"> - <string></string> - </test> - <edit name="family" mode="append_last"> - <string>DejaVu Sans</string> - </edit> - </match> - - <config> - <!-- These are the default Unicode chars that are expected to be blank - in fonts. All other blank chars are assumed to be broken and won't - appear in the resulting charsets --> - <blank> - <int>0x0020</int> <!-- SPACE --> - <int>0x00A0</int> <!-- NO-BREAK SPACE --> - <int>0x00AD</int> <!-- SOFT HYPHEN --> - <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER --> - <int>0x0600</int> <!-- ARABIC NUMBER SIGN --> - <int>0x0601</int> <!-- ARABIC SIGN SANAH --> - <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER --> - <int>0x0603</int> <!-- ARABIC SIGN SAFHA --> - <int>0x06DD</int> <!-- ARABIC END OF AYAH --> - <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK --> - <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER --> - <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER --> - <int>0x1680</int> <!-- OGHAM SPACE MARK --> - <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ --> - <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA --> - <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR --> - <int>0x2000</int> <!-- EN QUAD --> - <int>0x2001</int> <!-- EM QUAD --> - <int>0x2002</int> <!-- EN SPACE --> - <int>0x2003</int> <!-- EM SPACE --> - <int>0x2004</int> <!-- THREE-PER-EM SPACE --> - <int>0x2005</int> <!-- FOUR-PER-EM SPACE --> - <int>0x2006</int> <!-- SIX-PER-EM SPACE --> - <int>0x2007</int> <!-- FIGURE SPACE --> - <int>0x2008</int> <!-- PUNCTUATION SPACE --> - <int>0x2009</int> <!-- THIN SPACE --> - <int>0x200A</int> <!-- HAIR SPACE --> - <int>0x200B</int> <!-- ZERO WIDTH SPACE --> - <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER --> - <int>0x200D</int> <!-- ZERO WIDTH JOINER --> - <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK --> - <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK --> - <int>0x2028</int> <!-- LINE SEPARATOR --> - <int>0x2029</int> <!-- PARAGRAPH SEPARATOR --> - <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING --> - <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING --> - <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING --> - <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE --> - <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE --> - <int>0x202F</int> <!-- NARROW NO-BREAK SPACE --> - <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE --> - <int>0x2060</int> <!-- WORD JOINER --> - <int>0x2061</int> <!-- FUNCTION APPLICATION --> - <int>0x2062</int> <!-- INVISIBLE TIMES --> - <int>0x2063</int> <!-- INVISIBLE SEPARATOR --> - <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING --> - <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING --> - <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING --> - <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING --> - <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES --> - <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES --> - <int>0x3000</int> <!-- IDEOGRAPHIC SPACE --> - <int>0x3164</int> <!-- HANGUL FILLER --> - <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE --> - <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER --> - <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR --> - <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR --> - <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR --> - </blank> - </config> -</fontconfig> diff --git a/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm b/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm deleted file mode 100644 index ac57ecc8c..000000000 --- a/Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 deleted file mode 100644 index e66aa32a6..000000000 --- a/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm +++ /dev/null @@ -1,811 +0,0 @@ -/* - * 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/AccessibilityCommonMac.h b/Tools/DumpRenderTree/mac/AccessibilityCommonMac.h deleted file mode 100644 index c8b91257f..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityCommonMac.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 AccessibilityCommonMac_h -#define AccessibilityCommonMac_h - -#import <JavaScriptCore/JSStringRef.h> - -// If an unsupported attribute is passed in, it will raise an accessibility exception. These are usually caught by the Accessibility Runtime to inform -// the AX client app of the error. However, DRT is the AX client app, so it must catch these exceptions. -#define BEGIN_AX_OBJC_EXCEPTIONS @try { -#define END_AX_OBJC_EXCEPTIONS } @catch(NSException *e) { if (![[e name] isEqualToString:NSAccessibilityException]) @throw; } - - -@interface NSString (JSStringRefAdditions) -+ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef; -- (JSStringRef)createJSStringRef; -@end - -#endif // AccessibilityCommonMac_h diff --git a/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm b/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm deleted file mode 100644 index 082c0f0cc..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm +++ /dev/null @@ -1,52 +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. - */ - -#import "config.h" -#import "AccessibilityCommonMac.h" - -#import <JavaScriptCore/JSStringRefCF.h> - -@implementation NSString (JSStringRefAdditions) - -+ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef -{ - if (!jsStringRef) - return nil; - - CFStringRef cfString = JSStringCopyCFString(kCFAllocatorDefault, jsStringRef); - return [(NSString *)cfString autorelease]; -} - -- (JSStringRef)createJSStringRef -{ - return JSStringCreateWithCFString((CFStringRef)self); -} - -@end diff --git a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm b/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm deleted file mode 100644 index 0909b86fa..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010 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" - -#import "AccessibilityCommonMac.h" -#import "AccessibilityNotificationHandler.h" -#import "AccessibilityUIElement.h" -#import <AppKit/NSColor.h> -#import <Foundation/Foundation.h> -#import <JavaScriptCore/JSStringRef.h> -#import <JavaScriptCore/JSStringRefCF.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebFramePrivate.h> -#import <WebKit/WebHTMLView.h> - -AccessibilityController::AccessibilityController() -{ -} - -AccessibilityController::~AccessibilityController() -{ - // The notification handler should be nil because removeNotificationListener() should have been called in the test. - ASSERT(!m_globalNotificationHandler); -} - -AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) -{ - id accessibilityObject = [[[mainFrame frameView] documentView] accessibilityHitTest:NSMakePoint(x, y)]; - return AccessibilityUIElement(accessibilityObject); -} - -AccessibilityUIElement AccessibilityController::focusedElement() -{ - id accessibilityObject = [[mainFrame accessibilityRoot] accessibilityFocusedUIElement]; - return AccessibilityUIElement(accessibilityObject); -} - -AccessibilityUIElement AccessibilityController::rootElement() -{ - // FIXME: we could do some caching here. - - // Layout tests expect that the root element will be the scroll area - // containing the web area object. That will be the parent of the accessibilityRoot on WK1. - - id accessibilityObject = [[mainFrame accessibilityRoot] accessibilityAttributeValue:NSAccessibilityParentAttribute]; - return AccessibilityUIElement(accessibilityObject); -} - -static id findAccessibleObjectById(id obj, NSString *idAttribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id objIdAttribute = [obj accessibilityAttributeValue:@"AXDRTElementIdAttribute"]; - if ([objIdAttribute isKindOfClass:[NSString class]] && [objIdAttribute isEqualToString:idAttribute]) - return obj; - END_AX_OBJC_EXCEPTIONS - - BEGIN_AX_OBJC_EXCEPTIONS - NSArray *children = [obj accessibilityAttributeValue:NSAccessibilityChildrenAttribute]; - NSUInteger childrenCount = [children count]; - for (NSUInteger i = 0; i < childrenCount; ++i) { - id result = findAccessibleObjectById([children objectAtIndex:i], idAttribute); - if (result) - return result; - } - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityController::accessibleElementById(JSStringRef idAttributeRef) -{ - NSString *idAttribute = [NSString stringWithJSStringRef:idAttributeRef]; - id root = [[mainFrame accessibilityRoot] accessibilityAttributeValue:NSAccessibilityParentAttribute]; - 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) -{ - if (!functionCallback) - return false; - - // Mac programmers should not be adding more than one global notification listener. - // Other platforms may be different. - if (m_globalNotificationHandler) - return false; - m_globalNotificationHandler = [[AccessibilityNotificationHandler alloc] init]; - [m_globalNotificationHandler.get() setCallback:functionCallback]; - [m_globalNotificationHandler.get() startObserving]; - - return true; -} - -void AccessibilityController::removeNotificationListener() -{ - // Mac programmers should not be trying to remove a listener that's already removed. - ASSERT(m_globalNotificationHandler); - m_globalNotificationHandler.clear(); -} diff --git a/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.h b/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.h deleted file mode 100644 index 19386ceb0..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.h +++ /dev/null @@ -1,48 +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 AccessibilityNotificationHandler_h -#define AccessibilityNotificationHandler_h - -#import <JavaScriptCore/JSObjectRef.h> - -@interface AccessibilityNotificationHandler : NSObject { - id m_platformElement; - JSObjectRef m_notificationFunctionCallback; -} - -- (id)init; -- (void)setPlatformElement:(id)platformElement; -- (void)setCallback:(JSObjectRef)callback; -- (void)startObserving; - -@end - -#endif // AccessibilityNotificationHandler_h diff --git a/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm b/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm deleted file mode 100644 index 13d08c9f4..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm +++ /dev/null @@ -1,131 +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. - */ - -#import "config.h" -#import "DumpRenderTree.h" -#import "AccessibilityNotificationHandler.h" -#import "AccessibilityUIElement.h" - -#import <JavaScriptCore/JSRetainPtr.h> -#import <JavaScriptCore/JSStringRef.h> -#import <JavaScriptCore/JSStringRefCF.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebTypesInternal.h> -#import <wtf/RetainPtr.h> - -@interface NSObject (WebAccessibilityObjectWrapperAdditions) -+ (void)accessibilitySetShouldRepostNotifications:(BOOL)repost; -@end - -@interface NSString (JSStringRefAdditions) -- (JSStringRef)createJSStringRef; -@end - -@implementation NSString (JSStringRefAdditions) - -- (JSStringRef)createJSStringRef -{ - return JSStringCreateWithCFString((CFStringRef)self); -} - -@end - -@implementation AccessibilityNotificationHandler - -- (id)init -{ - if (!(self = [super init])) - return nil; - - m_platformElement = nil; - return self; -} - -- (void)setPlatformElement:(id)platformElement -{ - m_platformElement = platformElement; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - JSValueUnprotect([mainFrame globalContext], m_notificationFunctionCallback); - m_notificationFunctionCallback = 0; - - [super dealloc]; -} - -- (void)setCallback:(JSObjectRef)callback -{ - if (!callback) - return; - - if (m_notificationFunctionCallback) - JSValueUnprotect([mainFrame globalContext], m_notificationFunctionCallback); - - m_notificationFunctionCallback = callback; - JSValueProtect([mainFrame globalContext], m_notificationFunctionCallback); -} - -- (void)startObserving -{ - // Once we start requesting notifications, it's on for the duration of the program. - // This is to avoid any race conditions between tests turning this flag on and off. Instead - // AccessibilityNotificationHandler can ignore events it doesn't care about. - id webAccessibilityObjectWrapperClass = NSClassFromString(@"WebAccessibilityObjectWrapper"); - ASSERT(webAccessibilityObjectWrapperClass); - [webAccessibilityObjectWrapperClass accessibilitySetShouldRepostNotifications:YES]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_notificationReceived:) name:@"AXDRTNotification" object:nil]; -} - -- (void)_notificationReceived:(NSNotification *)notification -{ - NSString *notificationName = [[notification userInfo] objectForKey:@"notificationName"]; - if (!notificationName) - return; - if (m_platformElement && m_platformElement != [notification object]) - return; - - JSRetainPtr<JSStringRef> jsNotification(Adopt, [notificationName createJSStringRef]); - JSValueRef notificationNameArgument = JSValueMakeString([mainFrame globalContext], jsNotification.get()); - if (m_platformElement) { - // Listener for one element just gets one argument, the notification name. - JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 1, ¬ificationNameArgument, 0); - } else { - // A global listener gets the element and the notification name as arguments. - JSValueRef arguments[2]; - arguments[0] = AccessibilityUIElement::makeJSAccessibilityUIElement([mainFrame globalContext], AccessibilityUIElement([notification object])); - arguments[1] = notificationNameArgument; - JSObjectCallAsFunction([mainFrame globalContext], m_notificationFunctionCallback, 0, 2, arguments, 0); - } -} - -@end - diff --git a/Tools/DumpRenderTree/mac/AccessibilityTextMarkerMac.mm b/Tools/DumpRenderTree/mac/AccessibilityTextMarkerMac.mm deleted file mode 100644 index 18ddb85c6..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityTextMarkerMac.mm +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2010 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 "AccessibilityTextMarker.h" -#import "DumpRenderTree.h" - -// MARK: AccessibilityTextMarker - -AccessibilityTextMarker::AccessibilityTextMarker(PlatformTextMarker marker) - : m_textMarker(marker) -{ -} - -AccessibilityTextMarker::AccessibilityTextMarker(const AccessibilityTextMarker& marker) - : m_textMarker(marker.platformTextMarker()) -{ -} - -AccessibilityTextMarker::~AccessibilityTextMarker() -{ -} - -bool AccessibilityTextMarker::isEqual(AccessibilityTextMarker* other) -{ - return [(id)platformTextMarker() isEqual:(id)other->platformTextMarker()]; -} - -PlatformTextMarker AccessibilityTextMarker::platformTextMarker() const -{ - return m_textMarker.get(); -} - -// MARK: AccessibilityTextMarkerRange - -AccessibilityTextMarkerRange::AccessibilityTextMarkerRange(PlatformTextMarkerRange markerRange) - : m_textMarkerRange(markerRange) -{ -} - -AccessibilityTextMarkerRange::AccessibilityTextMarkerRange(const AccessibilityTextMarkerRange& markerRange) - : m_textMarkerRange(markerRange.platformTextMarkerRange()) -{ -} - -AccessibilityTextMarkerRange::~AccessibilityTextMarkerRange() -{ -} - -bool AccessibilityTextMarkerRange::isEqual(AccessibilityTextMarkerRange* other) -{ - return [(id)platformTextMarkerRange() isEqual:(id)other->platformTextMarkerRange()]; -} - -PlatformTextMarkerRange AccessibilityTextMarkerRange::platformTextMarkerRange() const -{ - return m_textMarkerRange.get(); -} diff --git a/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm deleted file mode 100644 index f775006fc..000000000 --- a/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm +++ /dev/null @@ -1,1577 +0,0 @@ -/* - * Copyright (C) 2008 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 "AccessibilityCommonMac.h" -#import "AccessibilityNotificationHandler.h" -#import "AccessibilityUIElement.h" - -#import <Foundation/Foundation.h> -#import <JavaScriptCore/JSRetainPtr.h> -#import <JavaScriptCore/JSStringRef.h> -#import <JavaScriptCore/JSStringRefCF.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebHTMLView.h> -#import <WebKit/WebTypesInternal.h> -#import <wtf/RetainPtr.h> -#import <wtf/Vector.h> - - -#ifndef NSAccessibilityOwnsAttribute -#define NSAccessibilityOwnsAttribute @"AXOwns" -#endif - -#ifndef NSAccessibilityGrabbedAttribute -#define NSAccessibilityGrabbedAttribute @"AXGrabbed" -#endif - -#ifndef NSAccessibilityDropEffectsAttribute -#define NSAccessibilityDropEffectsAttribute @"AXDropEffects" -#endif - -#ifndef NSAccessibilityPathAttribute -#define NSAccessibilityPathAttribute @"AXPath" -#endif - -typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context); - -@interface NSObject (WebKitAccessibilityAdditions) -- (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount; -- (NSUInteger)accessibilityIndexOfChild:(id)child; -- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute; -@end - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) - , m_notificationHandler(0) -{ - // FIXME: ap@webkit.org says ObjC objects need to be CFRetained/CFRelease to be GC-compliant on the mac. - [m_element retain]; -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) - , m_notificationHandler(0) -{ - [m_element retain]; -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ - // The notification handler should be nil because removeNotificationListener() should have been called in the test. - ASSERT(!m_notificationHandler); - [m_element release]; -} - -static NSString* descriptionOfValue(id valueObject, id focusedAccessibilityObject) -{ - if (!valueObject) - return NULL; - - if ([valueObject isKindOfClass:[NSArray class]]) - return [NSString stringWithFormat:@"<array of size %lu>", static_cast<unsigned long>([(NSArray*)valueObject count])]; - - if ([valueObject isKindOfClass:[NSNumber class]]) - return [(NSNumber*)valueObject stringValue]; - - if ([valueObject isKindOfClass:[NSValue class]]) { - NSString* type = [NSString stringWithCString:[valueObject objCType] encoding:NSASCIIStringEncoding]; - NSValue* value = (NSValue*)valueObject; - if ([type rangeOfString:@"NSRect"].length > 0) - return [NSString stringWithFormat:@"NSRect: %@", NSStringFromRect([value rectValue])]; - if ([type rangeOfString:@"NSPoint"].length > 0) - return [NSString stringWithFormat:@"NSPoint: %@", NSStringFromPoint([value pointValue])]; - if ([type rangeOfString:@"NSSize"].length > 0) - return [NSString stringWithFormat:@"NSSize: %@", NSStringFromSize([value sizeValue])]; - if ([type rangeOfString:@"NSRange"].length > 0) - return [NSString stringWithFormat:@"NSRange: %@", NSStringFromRange([value rangeValue])]; - } - - // Strip absolute URL paths - NSString* description = [valueObject description]; - NSRange range = [description rangeOfString:@"LayoutTests"]; - if (range.length) - return [description substringFromIndex:range.location]; - - // Strip pointer locations - if ([description rangeOfString:@"0x"].length) { - NSString* role = [focusedAccessibilityObject accessibilityAttributeValue:NSAccessibilityRoleAttribute]; - NSString* title = [focusedAccessibilityObject accessibilityAttributeValue:NSAccessibilityTitleAttribute]; - if ([title length]) - return [NSString stringWithFormat:@"<%@: '%@'>", role, title]; - return [NSString stringWithFormat:@"<%@>", role]; - } - - return [valueObject description]; -} - -static NSString* attributesOfElement(id accessibilityObject) -{ - NSArray* supportedAttributes = [accessibilityObject accessibilityAttributeNames]; - - NSMutableString* attributesString = [NSMutableString string]; - for (NSUInteger i = 0; i < [supportedAttributes count]; ++i) { - NSString* attribute = [supportedAttributes objectAtIndex:i]; - - // Right now, position provides useless and screen-specific information, so we do not - // want to include it for the sake of universally passing tests. - if ([attribute isEqualToString:@"AXPosition"]) - continue; - - // accessibilityAttributeValue: can throw an if an attribute is not returned. - // For DumpRenderTree's purpose, we should ignore those exceptions - BEGIN_AX_OBJC_EXCEPTIONS - id valueObject = [accessibilityObject accessibilityAttributeValue:attribute]; - NSString* value = descriptionOfValue(valueObject, accessibilityObject); - [attributesString appendFormat:@"%@: %@\n", attribute, value]; - END_AX_OBJC_EXCEPTIONS - } - - return attributesString; -} - -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()); -} - -static void convertNSArrayToVector(NSArray* array, Vector<AccessibilityUIElement>& elementVector) -{ - NSUInteger count = [array count]; - for (NSUInteger i = 0; i < count; ++i) - elementVector.append(AccessibilityUIElement([array objectAtIndex:i])); -} - -static JSStringRef descriptionOfElements(Vector<AccessibilityUIElement>& elementVector) -{ - NSMutableString* allElementString = [NSMutableString string]; - size_t size = elementVector.size(); - for (size_t i = 0; i < size; ++i) { - NSString* attributes = attributesOfElement(elementVector[i].platformUIElement()); - [allElementString appendFormat:@"%@\n------------\n", attributes]; - } - - return [allElementString createJSStringRef]; -} - -void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elementVector) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* linkedElements = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute]; - convertNSArrayToVector(linkedElements, elementVector); - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>& elementVector) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* linkElements = [m_element accessibilityAttributeValue:@"AXLinkUIElements"]; - convertNSArrayToVector(linkElements, elementVector); - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& elementVector) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* children = [m_element accessibilityAttributeValue:NSAccessibilityChildrenAttribute]; - convertNSArrayToVector(children, elementVector); - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* children = [m_element accessibilityArrayAttributeValues:NSAccessibilityChildrenAttribute index:location maxCount:length]; - convertNSArrayToVector(children, elementVector); - END_AX_OBJC_EXCEPTIONS -} - -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 [m_element accessibilityIndexOfChild:element->platformUIElement()]; -} - -AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) -{ - Vector<AccessibilityUIElement> children; - getChildrenWithRange(children, index, 1); - - if (children.size() == 1) - return children[0]; - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* objects = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute]; - if (index < [objects count]) - return [objects objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* objects = [m_element accessibilityAttributeValue:NSAccessibilityOwnsAttribute]; - if (index < [objects count]) - return [objects objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* objects = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute]; - if (index < [objects count]) - return [objects objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* rows = [m_element accessibilityAttributeValue:NSAccessibilityDisclosedRowsAttribute]; - if (index < [rows count]) - return [rows objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned index) const -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* array = [m_element accessibilityAttributeValue:NSAccessibilitySelectedChildrenAttribute]; - if (index < [array count]) - return [array objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -unsigned AccessibilityUIElement::selectedChildrenCount() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - return [m_element accessibilityArrayAttributeCount:NSAccessibilitySelectedChildrenAttribute]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* rows = [m_element accessibilityAttributeValue:NSAccessibilitySelectedRowsAttribute]; - if (index < [rows count]) - return [rows objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* rows = [m_element accessibilityAttributeValue:NSAccessibilityRowsAttribute]; - if (index < [rows count]) - return [rows objectAtIndex:index]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::titleUIElement() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id accessibilityObject = [m_element accessibilityAttributeValue:NSAccessibilityTitleUIElementAttribute]; - if (accessibilityObject) - return AccessibilityUIElement(accessibilityObject); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::parentElement() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id accessibilityObject = [m_element accessibilityAttributeValue:NSAccessibilityParentAttribute]; - if (accessibilityObject) - return AccessibilityUIElement(accessibilityObject); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::disclosedByRow() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id accessibilityObject = [m_element accessibilityAttributeValue:NSAccessibilityDisclosedByRowAttribute]; - if (accessibilityObject) - return AccessibilityUIElement(accessibilityObject); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() -{ - Vector<AccessibilityUIElement> linkedElements; - getLinkedUIElements(linkedElements); - return descriptionOfElements(linkedElements); -} - -JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() -{ - Vector<AccessibilityUIElement> linkElements; - getDocumentLinks(linkElements); - return descriptionOfElements(linkElements); -} - -JSStringRef AccessibilityUIElement::attributesOfChildren() -{ - Vector<AccessibilityUIElement> children; - getChildren(children); - return descriptionOfElements(children); -} - -JSStringRef AccessibilityUIElement::allAttributes() -{ - NSString* attributes = attributesOfElement(m_element); - return [attributes createJSStringRef]; -} - -JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]]; - if ([value isKindOfClass:[NSString class]]) - return [value createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id uiElement = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]]; - return AccessibilityUIElement(uiElement); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - - -double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]]; - if ([value isKindOfClass:[NSNumber class]]) - return [value doubleValue]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - return [m_element accessibilityIsAttributeSettable:[NSString stringWithJSStringRef:attribute]]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) -{ - BEGIN_AX_OBJC_EXCEPTIONS - return [[m_element accessibilityAttributeNames] containsObject:[NSString stringWithJSStringRef:attribute]]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -JSStringRef AccessibilityUIElement::parameterizedAttributeNames() -{ - NSArray* supportedParameterizedAttributes = [m_element accessibilityParameterizedAttributeNames]; - - NSMutableString* attributesString = [NSMutableString string]; - for (NSUInteger i = 0; i < [supportedParameterizedAttributes count]; ++i) { - [attributesString appendFormat:@"%@\n", [supportedParameterizedAttributes objectAtIndex:i]]; - } - - return [attributesString createJSStringRef]; -} - -JSStringRef AccessibilityUIElement::role() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSString *role = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityRoleAttribute], m_element); - return concatenateAttributeAndValue(@"AXRole", role); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::subrole() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSString* role = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilitySubroleAttribute], m_element); - return concatenateAttributeAndValue(@"AXSubrole", role); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::roleDescription() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSString* role = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityRoleDescriptionAttribute], m_element); - return concatenateAttributeAndValue(@"AXRoleDescription", role); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::title() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSString* title = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityTitleAttribute], m_element); - return concatenateAttributeAndValue(@"AXTitle", title); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::description() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id description = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityDescriptionAttribute], m_element); - return concatenateAttributeAndValue(@"AXDescription", description); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::orientation() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id description = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityOrientationAttribute], m_element); - return concatenateAttributeAndValue(@"AXOrientation", description); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::stringValue() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id description = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityValueAttribute], m_element); - return concatenateAttributeAndValue(@"AXValue", description); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::language() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id description = descriptionOfValue([m_element accessibilityAttributeValue:@"AXLanguage"], m_element); - return concatenateAttributeAndValue(@"AXLanguage", description); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::helpText() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id description = descriptionOfValue([m_element accessibilityAttributeValue:NSAccessibilityHelpAttribute], m_element); - return concatenateAttributeAndValue(@"AXHelp", description); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -double AccessibilityUIElement::x() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* positionValue = [m_element accessibilityAttributeValue:NSAccessibilityPositionAttribute]; - return static_cast<double>([positionValue pointValue].x); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::y() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* positionValue = [m_element accessibilityAttributeValue:NSAccessibilityPositionAttribute]; - return static_cast<double>([positionValue pointValue].y); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::width() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* sizeValue = [m_element accessibilityAttributeValue:NSAccessibilitySizeAttribute]; - return static_cast<double>([sizeValue sizeValue].width); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::height() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* sizeValue = [m_element accessibilityAttributeValue:NSAccessibilitySizeAttribute]; - return static_cast<double>([sizeValue sizeValue].height); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::clickPointX() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* positionValue = [m_element accessibilityAttributeValue:@"AXClickPoint"]; - return static_cast<double>([positionValue pointValue].x); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::clickPointY() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* positionValue = [m_element accessibilityAttributeValue:@"AXClickPoint"]; - return static_cast<double>([positionValue pointValue].y); - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::intValue() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityValueAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [(NSNumber*)value doubleValue]; - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::minValue() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityMinValueAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [(NSNumber*)value doubleValue]; - END_AX_OBJC_EXCEPTIONS - - return 0.0f; -} - -double AccessibilityUIElement::maxValue() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityMaxValueAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [(NSNumber*)value doubleValue]; - END_AX_OBJC_EXCEPTIONS - - return 0.0; -} - -JSStringRef AccessibilityUIElement::valueDescription() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSString* valueDescription = [m_element accessibilityAttributeValue:NSAccessibilityValueDescriptionAttribute]; - if ([valueDescription isKindOfClass:[NSString class]]) - return [valueDescription createJSStringRef]; - - END_AX_OBJC_EXCEPTIONS - return 0; -} - -int AccessibilityUIElement::insertionPointLineNumber() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityInsertionPointLineNumberAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [(NSNumber *)value intValue]; - END_AX_OBJC_EXCEPTIONS - - return -1; -} - -bool AccessibilityUIElement::isPressActionSupported() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* actions = [m_element accessibilityActionNames]; - 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; -} - -bool AccessibilityUIElement::isEnabled() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityEnabledAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isRequired() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:@"AXRequired"]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isFocused() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isSelected() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilitySelectedAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isExpanded() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityExpandedAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -bool AccessibilityUIElement::isChecked() const -{ - // On the Mac, intValue()==1 if a a checkable control is checked. - return intValue() == 1; -} - -int AccessibilityUIElement::hierarchicalLevel() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityDisclosureLevelAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [value intValue]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::speak() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:@"AXDRTSpeechAttribute"]; - if ([value isKindOfClass:[NSString class]]) - return [value createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -bool AccessibilityUIElement::ariaIsGrabbed() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityGrabbedAttribute]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -JSStringRef AccessibilityUIElement::ariaDropEffects() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityDropEffectsAttribute]; - if (![value isKindOfClass:[NSArray class]]) - return 0; - - NSMutableString* dropEffects = [NSMutableString string]; - NSInteger length = [value count]; - for (NSInteger k = 0; k < length; ++k) { - [dropEffects appendString:[value objectAtIndex:k]]; - if (k < length - 1) - [dropEffects appendString:@","]; - } - - return [dropEffects createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -// parameterized attributes -int AccessibilityUIElement::lineForIndex(int index) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityLineForIndexParameterizedAttribute forParameter:[NSNumber numberWithInt:index]]; - if ([value isKindOfClass:[NSNumber class]]) - return [(NSNumber *)value intValue]; - END_AX_OBJC_EXCEPTIONS - - return -1; -} - -JSStringRef AccessibilityUIElement::rangeForLine(int line) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForLineParameterizedAttribute forParameter:[NSNumber numberWithInt:line]]; - if ([value isKindOfClass:[NSValue class]]) - return [NSStringFromRange([value rangeValue]) createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::rangeForPosition(int x, int y) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForPositionParameterizedAttribute forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]]; - if ([value isKindOfClass:[NSValue class]]) - return [NSStringFromRange([value rangeValue]) createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - - -JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) -{ - NSRange range = NSMakeRange(location, length); - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:NSAccessibilityBoundsForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; - NSRect rect = NSMakeRect(0,0,0,0); - if ([value isKindOfClass:[NSValue class]]) - rect = [value rectValue]; - - // don't return position information because it is platform dependent - NSMutableString* boundsDescription = [NSMutableString stringWithFormat:@"{{%f, %f}, {%f, %f}}",-1.0f,-1.0f,rect.size.width,rect.size.height]; - return [boundsDescription createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::stringForRange(unsigned location, unsigned length) -{ - NSRange range = NSMakeRange(location, length); - BEGIN_AX_OBJC_EXCEPTIONS - id string = [m_element accessibilityAttributeValue:NSAccessibilityStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; - if (![string isKindOfClass:[NSString class]]) - return 0; - - return [string createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length) -{ - NSRange range = NSMakeRange(location, length); - BEGIN_AX_OBJC_EXCEPTIONS - NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; - if (![string isKindOfClass:[NSAttributedString class]]) - return 0; - - NSString* stringWithAttrs = [string description]; - return [stringWithAttrs createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) -{ - NSRange range = NSMakeRange(location, length); - BEGIN_AX_OBJC_EXCEPTIONS - NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; - if (![string isKindOfClass:[NSAttributedString class]]) - return false; - - NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil]; - 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(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) { - 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]; - return AccessibilityUIElement(uiElement); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() -{ - // not yet defined in AppKit... odd - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* columnHeadersArray = [m_element accessibilityAttributeValue:@"AXColumnHeaderUIElements"]; - Vector<AccessibilityUIElement> columnHeadersVector; - convertNSArrayToVector(columnHeadersArray, columnHeadersVector); - return descriptionOfElements(columnHeadersVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfRowHeaders() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* rowHeadersArray = [m_element accessibilityAttributeValue:@"AXRowHeaderUIElements"]; - Vector<AccessibilityUIElement> rowHeadersVector; - convertNSArrayToVector(rowHeadersArray, rowHeadersVector); - return descriptionOfElements(rowHeadersVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfColumns() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* columnsArray = [m_element accessibilityAttributeValue:NSAccessibilityColumnsAttribute]; - Vector<AccessibilityUIElement> columnsVector; - convertNSArrayToVector(columnsArray, columnsVector); - return descriptionOfElements(columnsVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfRows() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* rowsArray = [m_element accessibilityAttributeValue:NSAccessibilityRowsAttribute]; - Vector<AccessibilityUIElement> rowsVector; - convertNSArrayToVector(rowsArray, rowsVector); - return descriptionOfElements(rowsVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfVisibleCells() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* cellsArray = [m_element accessibilityAttributeValue:@"AXVisibleCells"]; - Vector<AccessibilityUIElement> cellsVector; - convertNSArrayToVector(cellsArray, cellsVector); - return descriptionOfElements(cellsVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfHeader() -{ - BEGIN_AX_OBJC_EXCEPTIONS - id headerObject = [m_element accessibilityAttributeValue:NSAccessibilityHeaderAttribute]; - if (!headerObject) - return [@"" createJSStringRef]; - - Vector<AccessibilityUIElement> headerVector; - headerVector.append(headerObject); - return descriptionOfElements(headerVector); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -int AccessibilityUIElement::rowCount() -{ - BEGIN_AX_OBJC_EXCEPTIONS - return [m_element accessibilityArrayAttributeCount:NSAccessibilityRowsAttribute]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -int AccessibilityUIElement::columnCount() -{ - BEGIN_AX_OBJC_EXCEPTIONS - return [m_element accessibilityArrayAttributeCount:NSAccessibilityColumnsAttribute]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -int AccessibilityUIElement::indexInTable() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSNumber* indexNumber = [m_element accessibilityAttributeValue:NSAccessibilityIndexAttribute]; - if (indexNumber) - return [indexNumber intValue]; - END_AX_OBJC_EXCEPTIONS - - return -1; -} - -JSStringRef AccessibilityUIElement::rowIndexRange() -{ - NSRange range = NSMakeRange(0, 0); - BEGIN_AX_OBJC_EXCEPTIONS - NSValue* indexRange = [m_element accessibilityAttributeValue:@"AXRowIndexRange"]; - if (indexRange) - range = [indexRange rangeValue]; - NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", static_cast<unsigned long>(range.location), static_cast<unsigned long>(range.length)]; - return [rangeDescription createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::columnIndexRange() -{ - NSRange range = NSMakeRange(0, 0); - BEGIN_AX_OBJC_EXCEPTIONS - NSNumber* indexRange = [m_element accessibilityAttributeValue:@"AXColumnIndexRange"]; - if (indexRange) - range = [indexRange rangeValue]; - NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}",static_cast<unsigned long>(range.location), static_cast<unsigned long>(range.length)]; - return [rangeDescription createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned col, unsigned row) -{ - NSArray *colRowArray = [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:col], [NSNumber numberWithUnsignedInt:row], nil]; - BEGIN_AX_OBJC_EXCEPTIONS - return [m_element accessibilityAttributeValue:@"AXCellForColumnAndRow" forParameter:colRowArray]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::horizontalScrollbar() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - return AccessibilityUIElement([m_element accessibilityAttributeValue:NSAccessibilityHorizontalScrollBarAttribute]); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - return AccessibilityUIElement([m_element accessibilityAttributeValue:NSAccessibilityVerticalScrollBarAttribute]); - END_AX_OBJC_EXCEPTIONS - - 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); - BEGIN_AX_OBJC_EXCEPTIONS - NSValue *indexRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextRangeAttribute]; - if (indexRange) - range = [indexRange rangeValue]; - NSMutableString *rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", static_cast<unsigned long>(range.location), static_cast<unsigned long>(range.length)]; - return [rangeDescription createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) -{ - NSRange textRange = NSMakeRange(location, length); - NSValue *textRangeValue = [NSValue valueWithRange:textRange]; - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilitySetValue:textRangeValue forAttribute:NSAccessibilitySelectedTextRangeAttribute]; - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::increment() -{ - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilityPerformAction:NSAccessibilityIncrementAction]; - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::decrement() -{ - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilityPerformAction:NSAccessibilityDecrementAction]; - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::showMenu() -{ - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilityPerformAction:NSAccessibilityShowMenuAction]; - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::press() -{ - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilityPerformAction:NSAccessibilityPressAction]; - END_AX_OBJC_EXCEPTIONS -} - -void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement* element) const -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* array = [NSArray arrayWithObject:element->platformUIElement()]; - [m_element accessibilitySetValue:array forAttribute:NSAccessibilitySelectedChildrenAttribute]; - END_AX_OBJC_EXCEPTIONS -} - -JSStringRef AccessibilityUIElement::accessibilityValue() const -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::documentEncoding() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::documentURI() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::url() -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSURL *url = [m_element accessibilityAttributeValue:NSAccessibilityURLAttribute]; - return [[url absoluteString] createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return nil; -} - -bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) -{ - if (!functionCallback) - return false; - - // Mac programmers should not be adding more than one notification listener per element. - // Other platforms may be different. - if (m_notificationHandler) - return false; - m_notificationHandler = [[AccessibilityNotificationHandler alloc] init]; - [m_notificationHandler setPlatformElement:platformUIElement()]; - [m_notificationHandler setCallback:functionCallback]; - [m_notificationHandler startObserving]; - - return true; -} - -void AccessibilityUIElement::removeNotificationListener() -{ - // Mac programmers should not be trying to remove a listener that's already removed. - ASSERT(m_notificationHandler); - - [m_notificationHandler release]; - m_notificationHandler = nil; -} - -bool AccessibilityUIElement::isFocusable() const -{ - bool result = false; - BEGIN_AX_OBJC_EXCEPTIONS - result = [m_element accessibilityIsAttributeSettable:NSAccessibilityFocusedAttribute]; - END_AX_OBJC_EXCEPTIONS - - return result; -} - -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 -{ - BOOL result = NO; - BEGIN_AX_OBJC_EXCEPTIONS - result = [m_element accessibilityIsIgnored]; - END_AX_OBJC_EXCEPTIONS - return result; -} - -bool AccessibilityUIElement::hasPopup() const -{ - BEGIN_AX_OBJC_EXCEPTIONS - id value = [m_element accessibilityAttributeValue:@"AXHasPopup"]; - if ([value isKindOfClass:[NSNumber class]]) - return [value boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -void AccessibilityUIElement::takeFocus() -{ - // FIXME: implement -} - -void AccessibilityUIElement::takeSelection() -{ - // FIXME: implement -} - -void AccessibilityUIElement::addSelection() -{ - // FIXME: implement -} - -void AccessibilityUIElement::removeSelection() -{ - // FIXME: implement -} - -#if SUPPORTS_AX_TEXTMARKERS - -// Text markers -AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement* element) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUIElement" forParameter:element->platformUIElement()]; - return AccessibilityTextMarkerRange(textMarkerRange); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSNumber* lengthValue = [m_element accessibilityAttributeValue:@"AXLengthForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()]; - return [lengthValue intValue]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSAttributedString* string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()]; - if (![string isKindOfClass:[NSAttributedString class]]) - return false; - - NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil]; - if ([attrs objectForKey:[NSString stringWithJSStringRef:attribute]]) - return true; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -int AccessibilityUIElement::indexForTextMarker(AccessibilityTextMarker* marker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSNumber* indexNumber = [m_element accessibilityAttributeValue:@"AXIndexForTextMarker" forParameter:(id)marker->platformTextMarker()]; - return [indexNumber intValue]; - END_AX_OBJC_EXCEPTIONS - - return -1; -} - -AccessibilityTextMarker AccessibilityUIElement::textMarkerForIndex(int textIndex) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForIndex" forParameter:[NSNumber numberWithInteger:textIndex]]; - return AccessibilityTextMarker(textMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker* textMarker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSNumber* validNumber = [m_element accessibilityAttributeValue:@"AXTextMarkerIsValid" forParameter:(id)textMarker->platformTextMarker()]; - return [validNumber boolValue]; - END_AX_OBJC_EXCEPTIONS - - return false; -} - -AccessibilityTextMarker AccessibilityUIElement::previousTextMarker(AccessibilityTextMarker* textMarker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id previousMarker = [m_element accessibilityAttributeValue:@"AXPreviousTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()]; - return AccessibilityTextMarker(previousMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityTextMarker AccessibilityUIElement::nextTextMarker(AccessibilityTextMarker* textMarker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id nextMarker = [m_element accessibilityAttributeValue:@"AXNextTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()]; - return AccessibilityTextMarker(nextMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -JSStringRef AccessibilityUIElement::stringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textString = [m_element accessibilityAttributeValue:@"AXStringForTextMarkerRange" forParameter:(id)markerRange->platformTextMarkerRange()]; - return [textString createJSStringRef]; - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - NSArray* textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil]; - id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers]; - return AccessibilityTextMarkerRange(textMarkerRange); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarkerForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()]; - return AccessibilityTextMarker(textMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarkerForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()]; - return AccessibilityTextMarker(textMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForPosition" forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]]; - return AccessibilityTextMarker(textMarker); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker* marker) -{ - BEGIN_AX_OBJC_EXCEPTIONS - id uiElement = [m_element accessibilityAttributeValue:@"AXUIElementForTextMarker" forParameter:(id)marker->platformTextMarker()]; - return AccessibilityUIElement(uiElement); - END_AX_OBJC_EXCEPTIONS - - return 0; -} - -#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() -{ - BEGIN_AX_OBJC_EXCEPTIONS - [m_element accessibilityPerformAction:@"AXScrollToVisible"]; - END_AX_OBJC_EXCEPTIONS -} - -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/mac/AppleScriptController.h b/Tools/DumpRenderTree/mac/AppleScriptController.h deleted file mode 100644 index c29789c2e..000000000 --- a/Tools/DumpRenderTree/mac/AppleScriptController.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.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. - */ - -#import <Foundation/Foundation.h> - -@class WebView; - -@interface AppleScriptController : NSObject -{ - WebView *webView; -} -- (id)initWithWebView:(WebView *)view; -@end diff --git a/Tools/DumpRenderTree/mac/AppleScriptController.m b/Tools/DumpRenderTree/mac/AppleScriptController.m deleted file mode 100644 index 2eab8271e..000000000 --- a/Tools/DumpRenderTree/mac/AppleScriptController.m +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.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. - */ - -#import "config.h" -#import "AppleScriptController.h" - -#import <WebKit/WebView.h> -#import <WebKit/WebViewPrivate.h> // for aeDescByEvaluatingJavaScriptFromString, which is pending API review - -@implementation AppleScriptController - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (aSelector == @selector(doJavaScript:)) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(doJavaScript:)) - return @"doJavaScript"; - - return nil; -} - -- (id)initWithWebView:(WebView *)wv -{ - self = [super init]; - webView = wv; - return self; -} - -static id convertAEDescToObject(NSAppleEventDescriptor *aeDesc) -{ - id value = nil; - - DescType descType = [aeDesc descriptorType]; - switch (descType) { - case typeUnicodeText: - value = [NSString stringWithFormat:@"\"%@\"", [aeDesc stringValue]]; - break; - case typeLongDateTime: - if ([[aeDesc data] length] == sizeof(LongDateTime)) { - LongDateTime d; - [[aeDesc data] getBytes:&d]; - value = [NSString stringWithFormat:@"%016llX", (unsigned long long)d]; - } - break; - case typeAEList: - value = [NSMutableString stringWithString:@"("]; - int numItems = [aeDesc numberOfItems]; - for (int i = 0; i < numItems; ++i) { - if (i != 0) - [(NSMutableString*)value appendString:@", "]; - id obj = convertAEDescToObject([aeDesc descriptorAtIndex:(i + 1)]); - [(NSMutableString*)value appendString:[obj description]]; - } - [(NSMutableString*)value appendString:@")"]; - break; - case typeType: { - OSType type = [aeDesc typeCodeValue]; - - char typeStr[5]; - typeStr[0] = type >> 24; - typeStr[1] = type >> 16; - typeStr[2] = type >> 8; - typeStr[3] = type; - typeStr[4] = 0; - - value = [NSString stringWithFormat:@"'%s'", typeStr]; - break; - } - } - - if (!value) - value = [aeDesc stringValue]; - if (!value) - value = [aeDesc data]; - - return value; -} - -- (NSString *)doJavaScript:(NSString *)aString -{ - NSAppleEventDescriptor *aeDesc = [webView aeDescByEvaluatingJavaScriptFromString:aString]; - if (!aeDesc) - return @"(null)"; - - DescType descType = [aeDesc descriptorType]; - char descTypeStr[5]; - descTypeStr[0] = descType >> 24; - descTypeStr[1] = descType >> 16; - descTypeStr[2] = descType >> 8; - descTypeStr[3] = descType; - descTypeStr[4] = 0; - - return [NSString stringWithFormat:@"%@ ('%s')", convertAEDescToObject(aeDesc), descTypeStr]; -} - -@end diff --git a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp b/Tools/DumpRenderTree/mac/CheckedMalloc.cpp deleted file mode 100644 index b56cb280d..000000000 --- a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2010 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. - */ - -#import "config.h" -#import "CheckedMalloc.h" - -#import <mach/mach_init.h> -#import <mach/mach_vm.h> -#import <mach/vm_region.h> -#import <malloc/malloc.h> -#import <unistd.h> - -static void* (*savedMalloc)(malloc_zone_t*, size_t); -static void* (*savedRealloc)(malloc_zone_t*, void*, size_t); - -static void* checkedMalloc(malloc_zone_t* zone, size_t size) -{ - if (size >= 0x10000000) - return 0; - return savedMalloc(zone, size); -} - -static void* checkedRealloc(malloc_zone_t* zone, void* ptr, size_t size) -{ - if (size >= 0x10000000) - return 0; - return savedRealloc(zone, ptr, size); -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -static vm_prot_t protectionOfRegion(mach_vm_address_t address) -{ - mach_vm_size_t regionSize = 0; - vm_region_basic_info_64 regionInfo; - mach_msg_type_number_t regionInfoCount = VM_REGION_BASIC_INFO_COUNT_64; - mach_port_t objectName; - if (mach_vm_region(mach_task_self(), &address, ®ionSize, VM_REGION_BASIC_INFO_64, (vm_region_info_t)®ionInfo, ®ionInfoCount, &objectName)) - CRASH(); - return regionInfo.protection; -} -#endif - -void makeLargeMallocFailSilently() -{ - malloc_zone_t* zone = malloc_default_zone(); - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - mach_vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1)); - vm_prot_t initialProtection = protectionOfRegion(pageStart); - - vm_size_t len = reinterpret_cast<vm_address_t>(zone) - pageStart + sizeof(malloc_zone_t); - if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection | VM_PROT_WRITE)) - CRASH(); -#endif - - savedMalloc = zone->malloc; - savedRealloc = zone->realloc; - zone->malloc = checkedMalloc; - zone->realloc = checkedRealloc; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection)) - CRASH(); -#endif -} diff --git a/Tools/DumpRenderTree/mac/CheckedMalloc.h b/Tools/DumpRenderTree/mac/CheckedMalloc.h deleted file mode 100644 index c03bd2072..000000000 --- a/Tools/DumpRenderTree/mac/CheckedMalloc.h +++ /dev/null @@ -1,31 +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. - */ - -void makeLargeMallocFailSilently(); diff --git a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig b/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig deleted file mode 100644 index be91f5e50..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/Base.xcconfig +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -CLANG_CXX_LANGUAGE_STANDARD = gnu++0x; -CLANG_CXX_LIBRARY = libc++; -CLANG_WARN_CXX0X_EXTENSIONS = NO; -HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include ForwardingHeaders mac/InternalHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport ${SRCROOT}/../../Source/JavaScriptCore/icu; -FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; -GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; -PREBINDING = NO -GCC_C_LANGUAGE_STANDARD = gnu99 -GCC_ENABLE_CPP_RTTI = NO; -GCC_OBJC_CALL_CXX_CDTORS = YES -GCC_PRECOMPILE_PREFIX_HEADER = YES -GCC_TREAT_WARNINGS_AS_ERRORS = YES -GCC_VERSION = com.apple.compilers.llvm.clang.1_0; -GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_VARIABLE = YES -WARNING_CFLAGS = -Wall -W -Wno-unused-parameter -Wundef -LINKER_DISPLAYS_MANGLED_NAMES = YES; - -TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); - - -TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; -TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; -TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; - -// Don't build against an SDK unless we're targeting an older OS version. -SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); -SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; - -WEBKIT_SYSTEM_INTERFACE_LIBRARY = WebKitSystemInterface diff --git a/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig b/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig deleted file mode 100644 index fd5ebdbd1..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig +++ /dev/null @@ -1,41 +0,0 @@ -// 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. - -#include "Base.xcconfig" - -ARCHS = $(ARCHS_STANDARD_32_64_BIT); - -ONLY_ACTIVE_ARCH = YES; - -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)) -MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; -MACOSX_DEPLOYMENT_TARGET_1080 = 10.8; -MACOSX_DEPLOYMENT_TARGET_1090 = 10.9; - -WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(PLATFORM_NAME)); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos = WebKitSystemInterface; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphonesimulator = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig b/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig deleted file mode 100644 index cf0d22d0c..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -OTHER_LDFLAGS = -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -LD_RUNPATH_SEARCH_PATHS = "@loader_path/."; -PRODUCT_NAME = DumpRenderTree -GCC_ENABLE_OBJC_EXCEPTIONS = YES -GCC_PREFIX_HEADER = DumpRenderTreePrefix.h diff --git a/Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig b/Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig deleted file mode 100644 index 35968afcf..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/ImageDiff.xcconfig +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -PRODUCT_NAME = ImageDiff diff --git a/Tools/DumpRenderTree/mac/Configurations/TestNetscapePlugIn.xcconfig b/Tools/DumpRenderTree/mac/Configurations/TestNetscapePlugIn.xcconfig deleted file mode 100644 index 22ea4c230..000000000 --- a/Tools/DumpRenderTree/mac/Configurations/TestNetscapePlugIn.xcconfig +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -PRODUCT_NAME = TestNetscapePlugIn -WRAPPER_EXTENSION = plugin -INFOPLIST_FILE = TestNetscapePlugIn.subproj/Info.plist -INSTALL_PATH = "$(USER_LIBRARY_DIR)/Plugins" -WARNING_CFLAGS = -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -LIBRARY_STYLE = BUNDLE diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm deleted file mode 100644 index 2f301c8a2..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm +++ /dev/null @@ -1,1488 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * (C) 2007 Graham Dennis (graham.dennis@gmail.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. - */ - -#import "config.h" -#import "DumpRenderTree.h" - -#import "AccessibilityController.h" -#import "CheckedMalloc.h" -#import "DefaultPolicyDelegate.h" -#import "DumpRenderTreeDraggingInfo.h" -#import "DumpRenderTreePasteboard.h" -#import "DumpRenderTreeWindow.h" -#import "EditingDelegate.h" -#import "EventSendingController.h" -#import "FrameLoadDelegate.h" -#import "HistoryDelegate.h" -#import "JavaScriptThreading.h" -#import "TestRunner.h" -#import "MockGeolocationProvider.h" -#import "MockWebNotificationProvider.h" -#import "NavigationController.h" -#import "ObjCPlugin.h" -#import "ObjCPluginFunction.h" -#import "PixelDumpSupport.h" -#import "PolicyDelegate.h" -#import "ResourceLoadDelegate.h" -#import "StorageTrackerDelegate.h" -#import "UIDelegate.h" -#import "WebArchiveDumpSupport.h" -#import "WebCoreTestSupport.h" -#import "WorkQueue.h" -#import "WorkQueueItem.h" -#import <Carbon/Carbon.h> -#import <CoreFoundation/CoreFoundation.h> -#import <JavaScriptCore/HeapStatistics.h> -#import <JavaScriptCore/Options.h> -#import <WebCore/FoundationExtras.h> -#import <WebKit/DOMElement.h> -#import <WebKit/DOMExtensions.h> -#import <WebKit/DOMRange.h> -#import <WebKit/WebArchive.h> -#import <WebKit/WebBackForwardList.h> -#import <WebKit/WebCache.h> -#import <WebKit/WebCoreStatistics.h> -#import <WebKit/WebDataSourcePrivate.h> -#import <WebKit/WebDatabaseManagerPrivate.h> -#import <WebKit/WebDocumentPrivate.h> -#import <WebKit/WebDeviceOrientationProviderMock.h> -#import <WebKit/WebDynamicScrollBarsView.h> -#import <WebKit/WebEditingDelegate.h> -#import <WebKit/WebFrameView.h> -#import <WebKit/WebHistory.h> -#import <WebKit/WebHistoryItemPrivate.h> -#import <WebKit/WebInspector.h> -#import <WebKit/WebKitNSStringExtras.h> -#import <WebKit/WebPluginDatabase.h> -#import <WebKit/WebPreferences.h> -#import <WebKit/WebPreferencesPrivate.h> -#import <WebKit/WebPreferenceKeysPrivate.h> -#import <WebKit/WebResourceLoadDelegate.h> -#import <WebKit/WebStorageManagerPrivate.h> -#import <WebKit/WebTypesInternal.h> -#import <WebKit/WebViewPrivate.h> -#import <getopt.h> -#import <wtf/Assertions.h> -#import <wtf/FastMalloc.h> -#import <wtf/RetainPtr.h> -#import <wtf/Threading.h> -#import <wtf/ObjcRuntimeExtras.h> -#import <wtf/OwnPtr.h> - -extern "C" { -#import <mach-o/getsect.h> -} - -using namespace std; - -@interface DumpRenderTreeApplication : NSApplication -@end - -@interface DumpRenderTreeEvent : NSEvent -@end - -@interface NSURLRequest (PrivateThingsWeShouldntReallyUse) -+(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: -// - There is no load in progress -// - There is no work queued up (see workQueue var, below) -// - waitToDump==NO. This means either waitUntilDone was never called, or it was called -// and notifyDone was called subsequently. -// Note that the call to notifyDone and the end of the load can happen in either order. - -volatile bool done; - -NavigationController* gNavigationController = 0; -RefPtr<TestRunner> gTestRunner; - -WebFrame *mainFrame = 0; -// This is the topmost frame that is loading, during a given load, or nil when no load is -// in progress. Usually this is the same as the main frame, but not always. In the case -// where a frameset is loaded, and then new content is loaded into one of the child frames, -// that child frame is the "topmost frame that is loading". -WebFrame *topLoadingFrame = nil; // !nil iff a load is in progress - - -CFMutableSetRef disallowedURLs = 0; -static CFRunLoopTimerRef waitToDumpWatchdog = 0; - -// Delegates -static FrameLoadDelegate *frameLoadDelegate; -static UIDelegate *uiDelegate; -static EditingDelegate *editingDelegate; -static ResourceLoadDelegate *resourceLoadDelegate; -static HistoryDelegate *historyDelegate; -PolicyDelegate *policyDelegate; -DefaultPolicyDelegate *defaultPolicyDelegate; -StorageTrackerDelegate *storageDelegate; - -static int dumpPixelsForAllTests = NO; -static bool dumpPixelsForCurrentTest = false; -static int threaded; -static int dumpTree = YES; -static int useTimeoutWatchdog = YES; -static int forceComplexText; -static int gcBetweenTests; -static BOOL printSeparators; -static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; - -static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test - -#ifdef __OBJC2__ -static void swizzleAllMethods(Class imposter, Class original) -{ - unsigned int imposterMethodCount; - Method* imposterMethods = class_copyMethodList(imposter, &imposterMethodCount); - - unsigned int originalMethodCount; - Method* originalMethods = class_copyMethodList(original, &originalMethodCount); - - for (unsigned int i = 0; i < imposterMethodCount; i++) { - SEL imposterMethodName = method_getName(imposterMethods[i]); - - // Attempt to add the method to the original class. If it fails, the method already exists and we should - // instead exchange the implementations. - if (class_addMethod(original, imposterMethodName, method_getImplementation(imposterMethods[i]), method_getTypeEncoding(imposterMethods[i]))) - continue; - - unsigned int j = 0; - for (; j < originalMethodCount; j++) { - SEL originalMethodName = method_getName(originalMethods[j]); - if (sel_isEqual(imposterMethodName, originalMethodName)) - break; - } - - // If class_addMethod failed above then the method must exist on the original class. - ASSERT(j < originalMethodCount); - method_exchangeImplementations(imposterMethods[i], originalMethods[j]); - } - - free(imposterMethods); - free(originalMethods); -} -#endif - -static void poseAsClass(const char* imposter, const char* original) -{ - Class imposterClass = objc_getClass(imposter); - Class originalClass = objc_getClass(original); - -#ifndef __OBJC2__ - class_poseAs(imposterClass, originalClass); -#else - - // Swizzle instance methods - swizzleAllMethods(imposterClass, originalClass); - // and then class methods - swizzleAllMethods(object_getClass(imposterClass), object_getClass(originalClass)); -#endif -} - -void setPersistentUserStyleSheetLocation(CFStringRef url) -{ - persistentUserStyleSheetLocation = url; -} - -static bool shouldIgnoreWebCoreNodeLeaks(const string& URLString) -{ - static char* const ignoreSet[] = { - // Keeping this infrastructure around in case we ever need it again. - }; - static const int ignoreSetCount = sizeof(ignoreSet) / sizeof(char*); - - for (int i = 0; i < ignoreSetCount; i++) { - // FIXME: ignore case - string curIgnore(ignoreSet[i]); - // Match at the end of the URLString - if (!URLString.compare(URLString.length() - curIgnore.length(), curIgnore.length(), curIgnore)) - return true; - } - return false; -} - -static NSSet *allowedFontFamilySet() -{ - static NSSet *fontFamilySet = [[NSSet setWithObjects: - @"Ahem", - @"Al Bayan", - @"American Typewriter", - @"Andale Mono", - @"Apple Braille", - @"Apple Color Emoji", - @"Apple Chancery", - @"Apple Garamond BT", - @"Apple LiGothic", - @"Apple LiSung", - @"Apple Symbols", - @"AppleGothic", - @"AppleMyungjo", - @"Arial Black", - @"Arial Hebrew", - @"Arial Narrow", - @"Arial Rounded MT Bold", - @"Arial Unicode MS", - @"Arial", - @"Ayuthaya", - @"Baghdad", - @"Baskerville", - @"BiauKai", - @"Big Caslon", - @"Brush Script MT", - @"Chalkboard", - @"Chalkduster", - @"Charcoal CY", - @"Cochin", - @"Comic Sans MS", - @"Copperplate", - @"Corsiva Hebrew", - @"Courier New", - @"Courier", - @"DecoType Naskh", - @"Devanagari MT", - @"Didot", - @"Euphemia UCAS", - @"Futura", - @"GB18030 Bitmap", - @"Geeza Pro", - @"Geneva CY", - @"Geneva", - @"Georgia", - @"Gill Sans", - @"Gujarati MT", - @"GungSeo", - @"Gurmukhi MT", - @"HeadLineA", - @"Hei", - @"Heiti SC", - @"Heiti TC", - @"Helvetica CY", - @"Helvetica Neue", - @"Helvetica", - @"Herculanum", - @"Hiragino Kaku Gothic Pro", - @"Hiragino Kaku Gothic ProN", - @"Hiragino Kaku Gothic Std", - @"Hiragino Kaku Gothic StdN", - @"Hiragino Maru Gothic Monospaced", - @"Hiragino Maru Gothic Pro", - @"Hiragino Maru Gothic ProN", - @"Hiragino Mincho Pro", - @"Hiragino Mincho ProN", - @"Hiragino Sans GB", - @"Hoefler Text", - @"Impact", - @"InaiMathi", - @"Kai", - @"Kailasa", - @"Kokonor", - @"Krungthep", - @"KufiStandardGK", - @"LiHei Pro", - @"LiSong Pro", - @"Lucida Grande", - @"Marker Felt", - @"Menlo", - @"Microsoft Sans Serif", - @"Monaco", - @"Mshtakan", - @"Nadeem", - @"New Peninim MT", - @"Optima", - @"Osaka", - @"Papyrus", - @"PCMyungjo", - @"PilGi", - @"Plantagenet Cherokee", - @"Raanana", - @"Sathu", - @"Silom", - @"Skia", - @"Songti SC", - @"Songti TC", - @"STFangsong", - @"STHeiti", - @"STIXGeneral", - @"STIXSizeOneSym", - @"STKaiti", - @"STSong", - @"Symbol", - @"Tahoma", - @"Thonburi", - @"Times New Roman", - @"Times", - @"Trebuchet MS", - @"Verdana", - @"Webdings", - @"WebKit WeightWatcher", - @"Wingdings 2", - @"Wingdings 3", - @"Wingdings", - @"Zapf Dingbats", - @"Zapfino", - nil] retain]; - - return fontFamilySet; -} - -static NSSet *systemHiddenFontFamilySet() -{ - static NSSet *fontFamilySet = [[NSSet setWithObjects: - @".LucidaGrandeUI", - nil] retain]; - - return fontFamilySet; -} - -static IMP appKitAvailableFontFamiliesIMP; -static IMP appKitAvailableFontsIMP; - -static NSArray *drt_NSFontManager_availableFontFamilies(id self, SEL _cmd) -{ - static NSArray *availableFontFamilies; - if (availableFontFamilies) - return availableFontFamilies; - - NSArray *availableFamilies = wtfCallIMP<id>(appKitAvailableFontFamiliesIMP, self, _cmd); - - NSMutableSet *prunedFamiliesSet = [NSMutableSet setWithArray:availableFamilies]; - [prunedFamiliesSet intersectSet:allowedFontFamilySet()]; - - availableFontFamilies = [[prunedFamiliesSet allObjects] retain]; - return availableFontFamilies; -} - -static NSArray *drt_NSFontManager_availableFonts(id self, SEL _cmd) -{ - static NSArray *availableFonts; - if (availableFonts) - return availableFonts; - - NSSet *allowedFamilies = allowedFontFamilySet(); - NSMutableArray *availableFontList = [[NSMutableArray alloc] initWithCapacity:[allowedFamilies count] * 2]; - for (NSString *fontFamily in allowedFontFamilySet()) { - NSArray* fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily]; - for (NSArray* fontInfo in fontsForFamily) { - // Font name is the first entry in the array. - [availableFontList addObject:[fontInfo objectAtIndex:0]]; - } - } - - for (NSString *hiddenFontFamily in systemHiddenFontFamilySet()) { - [availableFontList addObject:hiddenFontFamily]; - } - - availableFonts = availableFontList; - return availableFonts; -} - -static void swizzleNSFontManagerMethods() -{ - Method availableFontFamiliesMethod = class_getInstanceMethod(objc_getClass("NSFontManager"), @selector(availableFontFamilies)); - ASSERT(availableFontFamiliesMethod); - if (!availableFontFamiliesMethod) { - NSLog(@"Failed to swizzle the \"availableFontFamilies\" method on NSFontManager"); - return; - } - - appKitAvailableFontFamiliesIMP = method_setImplementation(availableFontFamiliesMethod, (IMP)drt_NSFontManager_availableFontFamilies); - - Method availableFontsMethod = class_getInstanceMethod(objc_getClass("NSFontManager"), @selector(availableFonts)); - ASSERT(availableFontsMethod); - if (!availableFontsMethod) { - NSLog(@"Failed to swizzle the \"availableFonts\" method on NSFontManager"); - return; - } - - appKitAvailableFontsIMP = method_setImplementation(availableFontsMethod, (IMP)drt_NSFontManager_availableFonts); -} - -static void activateTestingFonts() -{ - static const char* fontFileNames[] = { - "AHEM____.TTF", - "WebKitWeightWatcher100.ttf", - "WebKitWeightWatcher200.ttf", - "WebKitWeightWatcher300.ttf", - "WebKitWeightWatcher400.ttf", - "WebKitWeightWatcher500.ttf", - "WebKitWeightWatcher600.ttf", - "WebKitWeightWatcher700.ttf", - "WebKitWeightWatcher800.ttf", - "WebKitWeightWatcher900.ttf", -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - "SampleFont.sfont", -#endif - 0 - }; - - NSMutableArray *fontURLs = [NSMutableArray array]; - NSURL *resourcesDirectory = [NSURL URLWithString:@"DumpRenderTree.resources" relativeToURL:[[NSBundle mainBundle] executableURL]]; - for (unsigned i = 0; fontFileNames[i]; ++i) { - NSURL *fontURL = [resourcesDirectory URLByAppendingPathComponent:[NSString stringWithUTF8String:fontFileNames[i]]]; - [fontURLs addObject:[fontURL absoluteURL]]; - } - - CFArrayRef errors = 0; - if (!CTFontManagerRegisterFontsForURLs((CFArrayRef)fontURLs, kCTFontManagerScopeProcess, &errors)) { - NSLog(@"Failed to activate fonts: %@", errors); - CFRelease(errors); - exit(1); - } -} - -static void adjustFonts() -{ - swizzleNSFontManagerMethods(); - activateTestingFonts(); -} - -@interface DRTMockScroller : NSScroller -@end - -@implementation DRTMockScroller - -- (NSRect)rectForPart:(NSScrollerPart)partCode -{ - switch (partCode) { - case NSScrollerKnob: { - NSRect frameRect = [self frame]; - NSRect bounds = [self bounds]; - BOOL isHorizontal = frameRect.size.width > frameRect.size.height; - CGFloat trackLength = isHorizontal ? bounds.size.width : bounds.size.height; - CGFloat minKnobSize = isHorizontal ? bounds.size.height : bounds.size.width; - CGFloat knobLength = max(minKnobSize, static_cast<CGFloat>(round(trackLength * [self knobProportion]))); - CGFloat knobPosition = static_cast<CGFloat>((round([self doubleValue] * (trackLength - knobLength)))); - - if (isHorizontal) - return NSMakeRect(bounds.origin.x + knobPosition, bounds.origin.y, knobLength, bounds.size.height); - - return NSMakeRect(bounds.origin.x, bounds.origin.y + + knobPosition, bounds.size.width, knobLength); - } - } - - return [super rectForPart:partCode]; -} - -- (void)drawKnob -{ - if (![self isEnabled]) - return; - - NSRect knobRect = [self rectForPart:NSScrollerKnob]; - - static NSColor *knobColor = [[NSColor colorWithDeviceRed:0x80 / 255.0 green:0x80 / 255.0 blue:0x80 / 255.0 alpha:1] retain]; - [knobColor set]; - - NSRectFill(knobRect); -} - -- (void)drawRect:(NSRect)dirtyRect -{ - static NSColor *trackColor = [[NSColor colorWithDeviceRed:0xC0 / 255.0 green:0xC0 / 255.0 blue:0xC0 / 255.0 alpha:1] retain]; - static NSColor *disabledTrackColor = [[NSColor colorWithDeviceRed:0xE0 / 255.0 green:0xE0 / 255.0 blue:0xE0 / 255.0 alpha:1] retain]; - - if ([self isEnabled]) - [trackColor set]; - else - [disabledTrackColor set]; - - NSRectFill(dirtyRect); - - [self drawKnob]; -} - -@end - -static void registerMockScrollbars() -{ - [WebDynamicScrollBarsView setCustomScrollerClass:[DRTMockScroller class]]; -} - -WebView *createWebViewAndOffscreenWindow() -{ - NSRect rect = NSMakeRect(0, 0, TestRunner::viewWidth, TestRunner::viewHeight); - WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil groupName:@"org.webkit.DumpRenderTree"]; - - [webView setUIDelegate:uiDelegate]; - [webView setFrameLoadDelegate:frameLoadDelegate]; - [webView setEditingDelegate:editingDelegate]; - [webView setResourceLoadDelegate:resourceLoadDelegate]; - [webView _setGeolocationProvider:[MockGeolocationProvider shared]]; - [webView _setDeviceOrientationProvider:[WebDeviceOrientationProviderMock shared]]; - [webView _setNotificationProvider:[MockWebNotificationProvider shared]]; - - // Register the same schemes that Safari does - [WebView registerURLSchemeAsLocal:@"feed"]; - [WebView registerURLSchemeAsLocal:@"feeds"]; - [WebView registerURLSchemeAsLocal:@"feedsearch"]; - - [webView setContinuousSpellCheckingEnabled:YES]; - [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]; - - // To make things like certain NSViews, dragging, and plug-ins work, put the WebView a window, but put it off-screen so you don't see it. - // Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates. - NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000); - 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]; - - // For reasons that are not entirely clear, the following pair of calls makes WebView handle its - // dynamic scrollbars properly. Without it, every frame will always have scrollbars. - NSBitmapImageRep *imageRep = [webView bitmapImageRepForCachingDisplayInRect:[webView bounds]]; - [webView cacheDisplayInRect:[webView bounds] toBitmapImageRep:imageRep]; - - return webView; -} - -static NSString *libraryPathForDumpRenderTree() -{ - //FIXME: This may not be sufficient to prevent interactions/crashes - //when running more than one copy of DumpRenderTree. - //See https://bugs.webkit.org/show_bug.cgi?id=10906 - char* dumpRenderTreeTemp = getenv("DUMPRENDERTREE_TEMP"); - if (dumpRenderTreeTemp) - return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:dumpRenderTreeTemp length:strlen(dumpRenderTreeTemp)]; - else - return [@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath]; -} - -// Called before each test. -static void resetDefaultsToConsistentValues() -{ - static const int NoFontSmoothing = 0; - static const int BlueTintedAppearance = 1; - - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setInteger:4 forKey:@"AppleAntiAliasingThreshold"]; // smallest font size to CG should perform antialiasing on - [defaults setInteger:NoFontSmoothing forKey:@"AppleFontSmoothing"]; - [defaults setInteger:BlueTintedAppearance forKey:@"AppleAquaColorVariant"]; - [defaults setObject:@"0.709800 0.835300 1.000000" forKey:@"AppleHighlightColor"]; - [defaults setObject:@"0.500000 0.500000 0.500000" forKey:@"AppleOtherHighlightColor"]; - [defaults setObject:[NSArray arrayWithObject:@"en"] forKey:@"AppleLanguages"]; - [defaults setBool:YES forKey:WebKitEnableFullDocumentTeardownPreferenceKey]; - [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); - CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), CFSTR("DoubleMax"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); -#ifndef __LP64__ - // See <rdar://problem/6347388>. - ThemeScrollBarArrowStyle style; - GetThemeScrollBarArrowStyle(&style); // Force HIToolbox to read from CFPreferences -#endif - - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - [defaults setBool:NO forKey:@"NSScrollAnimationEnabled"]; -#else - [defaults setBool:NO forKey:@"AppleScrollAnimationEnabled"]; -#endif - - [defaults setBool:NO forKey:@"NSOverlayScrollersEnabled"]; - [defaults setObject:@"Always" forKey:@"AppleShowScrollBars"]; - - if (initialValue) - CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), initialValue.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - NSString *path = libraryPathForDumpRenderTree(); - [defaults setObject:[path stringByAppendingPathComponent:@"Databases"] forKey:WebDatabaseDirectoryDefaultsKey]; - [defaults setObject:[path stringByAppendingPathComponent:@"LocalStorage"] forKey:WebStorageDirectoryDefaultsKey]; - [defaults setObject:[path stringByAppendingPathComponent:@"LocalCache"] forKey:WebKitLocalCacheDefaultsKey]; - - [defaults setBool:NO forKey:@"WebKitKerningAndLigaturesEnabledByDefault"]; - - WebPreferences *preferences = [WebPreferences standardPreferences]; - - [preferences setAllowUniversalAccessFromFileURLs:YES]; - [preferences setAllowFileAccessFromFileURLs:YES]; - [preferences setStandardFontFamily:@"Times"]; - [preferences setFixedFontFamily:@"Courier"]; - [preferences setSerifFontFamily:@"Times"]; - [preferences setSansSerifFontFamily:@"Helvetica"]; - [preferences setCursiveFontFamily:@"Apple Chancery"]; - [preferences setFantasyFontFamily:@"Papyrus"]; - [preferences setPictographFontFamily:@"Apple Color Emoji"]; - [preferences setDefaultFontSize:16]; - [preferences setDefaultFixedFontSize:13]; - [preferences setMinimumFontSize:0]; - [preferences setDefaultTextEncodingName:@"ISO-8859-1"]; - [preferences setJavaEnabled:NO]; - [preferences setJavaScriptEnabled:YES]; - [preferences setEditableLinkBehavior:WebKitEditableLinkOnlyLiveWithShiftKey]; - [preferences setTabsToLinks:NO]; - [preferences setDOMPasteAllowed:YES]; - [preferences setShouldPrintBackgrounds:YES]; - [preferences setCacheModel:WebCacheModelDocumentBrowser]; - [preferences setXSSAuditorEnabled:NO]; - [preferences setExperimentalNotificationsEnabled:NO]; - [preferences setPlugInsEnabled:YES]; - [preferences setTextAreasAreResizable:YES]; - - [preferences setPrivateBrowsingEnabled:NO]; - [preferences setAuthorAndUserStylesEnabled:YES]; - [preferences setJavaScriptCanOpenWindowsAutomatically:YES]; - [preferences setJavaScriptCanAccessClipboard:YES]; - [preferences setOfflineWebApplicationCacheEnabled:YES]; - [preferences setDeveloperExtrasEnabled:NO]; - [preferences setJavaScriptExperimentsEnabled:YES]; - [preferences setLoadsImagesAutomatically:YES]; - [preferences setLoadsSiteIconsIgnoringImageLoadingPreference:NO]; - [preferences setFrameFlatteningEnabled:NO]; - [preferences setSpatialNavigationEnabled:NO]; - if (persistentUserStyleSheetLocation) { - [preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]]; - [preferences setUserStyleSheetEnabled:YES]; - } else - [preferences setUserStyleSheetEnabled:NO]; - - // The back/forward cache is causing problems due to layouts during transition from one page to another. - // So, turn it off for now, but we might want to turn it back on some day. - [preferences setUsesPageCache:NO]; - [preferences setAcceleratedCompositingEnabled:YES]; -#if USE(CA) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - [preferences setCanvasUsesAcceleratedDrawing:YES]; - [preferences setAcceleratedDrawingEnabled:NO]; -#endif - [preferences setWebGLEnabled:NO]; - [preferences setCSSRegionsEnabled:YES]; - [preferences setCSSGridLayoutEnabled:NO]; - [preferences setUsePreHTML5ParserQuirks:NO]; - [preferences setAsynchronousSpellCheckingEnabled:NO]; - [preferences setMockScrollbarsEnabled:YES]; - [preferences setSeamlessIFramesEnabled:YES]; - -#if ENABLE(WEB_AUDIO) - [preferences setWebAudioEnabled:YES]; -#endif - - [preferences setScreenFontSubstitutionEnabled:YES]; - - [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain]; - - TestRunner::setSerializeHTTPLoads(false); - - setlocale(LC_ALL, ""); -} - -// Called once on DumpRenderTree startup. -static void setDefaultsToConsistentValuesForTesting() -{ - // FIXME: We'd like to start with a clean state for every test, but this function can't be used more than once yet. - [WebPreferences _switchNetworkLoaderToNewTestingSession]; - - resetDefaultsToConsistentValues(); - - NSString *path = libraryPathForDumpRenderTree(); - NSURLCache *sharedCache = - [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 - diskCapacity:0 - diskPath:[path stringByAppendingPathComponent:@"URLCache"]]; - [NSURLCache setSharedURLCache:sharedCache]; - [sharedCache release]; -} - -static void runThread(void* arg) -{ - static ThreadIdentifier previousId = 0; - ThreadIdentifier currentId = currentThread(); - // Verify 2 successive threads do not get the same Id. - ASSERT(previousId != currentId); - previousId = currentId; -} - -static void* runPthread(void* arg) -{ - runThread(arg); - return 0; -} - -static void testThreadIdentifierMap() -{ - // Imitate 'foreign' threads that are not created by WTF. - pthread_t pthread; - pthread_create(&pthread, 0, &runPthread, 0); - pthread_join(pthread, 0); - - pthread_create(&pthread, 0, &runPthread, 0); - pthread_join(pthread, 0); - - // Now create another thread using WTF. On OSX, it will have the same pthread handle - // but should get a different ThreadIdentifier. - createThread(runThread, 0, "DumpRenderTree: test"); -} - -static void allocateGlobalControllers() -{ - // FIXME: We should remove these and move to the ObjC standard [Foo sharedInstance] model - gNavigationController = [[NavigationController alloc] init]; - frameLoadDelegate = [[FrameLoadDelegate alloc] init]; - uiDelegate = [[UIDelegate alloc] init]; - editingDelegate = [[EditingDelegate alloc] init]; - resourceLoadDelegate = [[ResourceLoadDelegate alloc] init]; - 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. -static inline void releaseAndZero(NSObject** object) -{ - [*object release]; - *object = nil; -} - -static void releaseGlobalControllers() -{ - releaseAndZero(&gNavigationController); - releaseAndZero(&frameLoadDelegate); - releaseAndZero(&editingDelegate); - releaseAndZero(&resourceLoadDelegate); - releaseAndZero(&uiDelegate); - releaseAndZero(&policyDelegate); - releaseAndZero(&storageDelegate); -} - -static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[]) -{ - struct option options[] = { - {"notree", no_argument, &dumpTree, NO}, - {"pixel-tests", no_argument, &dumpPixelsForAllTests, YES}, - {"tree", no_argument, &dumpTree, YES}, - {"threaded", no_argument, &threaded, YES}, - {"complex-text", no_argument, &forceComplexText, YES}, - {"gc-between-tests", no_argument, &gcBetweenTests, YES}, - {"no-timeout", no_argument, &useTimeoutWatchdog, NO}, - {NULL, 0, NULL, 0} - }; - - int option; - while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1) { - switch (option) { - case '?': // unknown or ambiguous option - case ':': // missing argument - exit(1); - break; - } - } -} - -static void addTestPluginsToPluginSearchPath(const char* executablePath) -{ - NSString *pwd = [[NSString stringWithUTF8String:executablePath] stringByDeletingLastPathComponent]; - [WebPluginDatabase setAdditionalWebPlugInPaths:[NSArray arrayWithObject:pwd]]; - [[WebPluginDatabase sharedDatabase] refresh]; -} - -static bool useLongRunningServerMode(int argc, const char *argv[]) -{ - // This assumes you've already called getopt_long - return (argc == optind+1 && strcmp(argv[optind], "-") == 0); -} - -static void runTestingServerLoop() -{ - // When DumpRenderTree run in server mode, we just wait around for file names - // to be passed to us and read each in turn, passing the results back to the client - char filenameBuffer[2048]; - while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { - char *newLineCharacter = strchr(filenameBuffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (strlen(filenameBuffer) == 0) - continue; - - runTest(filenameBuffer); - } -} - -static void prepareConsistentTestingEnvironment() -{ - poseAsClass("DumpRenderTreePasteboard", "NSPasteboard"); - poseAsClass("DumpRenderTreeEvent", "NSEvent"); - - setDefaultsToConsistentValuesForTesting(); - adjustFonts(); - registerMockScrollbars(); - - 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[]) -{ - initializeGlobalsFromCommandLineOptions(argc, argv); - prepareConsistentTestingEnvironment(); - addTestPluginsToPluginSearchPath(argv[0]); - - if (forceComplexText) - [WebView _setAlwaysUsesComplexTextCodePath:YES]; - -#if USE(APPKIT) - [NSSound _setAlertType:0]; -#endif - - WebView *webView = createWebViewAndOffscreenWindow(); - mainFrame = [webView mainFrame]; - - [[NSURLCache sharedURLCache] removeAllCachedResponses]; - [WebCache empty]; - - [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"localhost"]; - [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"127.0.0.1"]; - - // http://webkit.org/b/32689 - testThreadIdentifierMap(); - - if (threaded) - startJavaScriptThreads(); - - if (useLongRunningServerMode(argc, argv)) { - printSeparators = YES; - runTestingServerLoop(); - } else { - printSeparators = optind < argc - 1; - for (int i = optind; i != argc; ++i) - runTest(argv[i]); - } - - if (threaded) - stopJavaScriptThreads(); - - NSWindow *window = [webView window]; - [webView close]; - mainFrame = nil; - - // Work around problem where registering drag types leaves an outstanding - // "perform selector" on the window, which retains the window. It's a bit - // inelegant and perhaps dangerous to just blow them all away, but in practice - // it probably won't cause any trouble (and this is just a test tool, after all). - [NSObject cancelPreviousPerformRequestsWithTarget:window]; - - [window close]; // releases when closed - [webView release]; - - releaseGlobalControllers(); - - [DumpRenderTreePasteboard releaseLocalPasteboards]; - - // FIXME: This should be moved onto TestRunner and made into a HashSet - if (disallowedURLs) { - CFRelease(disallowedURLs); - disallowedURLs = 0; - } -} - -int main(int argc, const char *argv[]) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [DumpRenderTreeApplication sharedApplication]; // Force AppKit to init itself - dumpRenderTree(argc, argv); - [WebCoreStatistics garbageCollectJavaScriptObjects]; - [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts - if (JSC::Options::logHeapStatisticsAtExit()) - JSC::HeapStatistics::reportSuccess(); - [pool release]; - return 0; -} - -static NSInteger compareHistoryItems(id item1, id item2, void *context) -{ - return [[item1 target] caseInsensitiveCompare:[item2 target]]; -} - -static NSData *dumpAudio() -{ - const char *encodedAudioData = gTestRunner->encodedAudioData().c_str(); - - NSData *data = [NSData dataWithBytes:encodedAudioData length:gTestRunner->encodedAudioData().length()]; - return data; -} - -static void dumpHistoryItem(WebHistoryItem *item, int indent, BOOL current) -{ - int start = 0; - if (current) { - printf("curr->"); - start = 6; - } - for (int i = start; i < indent; i++) - putchar(' '); - - NSString *urlString = [item URLString]; - if ([[NSURL URLWithString:urlString] isFileURL]) { - NSRange range = [urlString rangeOfString:@"/LayoutTests/"]; - urlString = [@"(file test):" stringByAppendingString:[urlString substringFromIndex:(range.length + range.location)]]; - } - - printf("%s", [urlString UTF8String]); - NSString *target = [item target]; - if (target && [target length] > 0) - printf(" (in frame \"%s\")", [target UTF8String]); - if ([item isTargetItem]) - printf(" **nav target**"); - putchar('\n'); - NSArray *kids = [item children]; - if (kids) { - // must sort to eliminate arbitrary result ordering which defeats reproducible testing - kids = [kids sortedArrayUsingFunction:&compareHistoryItems context:nil]; - for (unsigned i = 0; i < [kids count]; i++) - dumpHistoryItem([kids objectAtIndex:i], indent+4, NO); - } -} - -static void dumpFrameScrollPosition(WebFrame *f) -{ - WebScriptObject* scriptObject = [f windowObject]; - NSPoint scrollPosition = NSMakePoint( - [[scriptObject valueForKey:@"pageXOffset"] floatValue], - [[scriptObject valueForKey:@"pageYOffset"] floatValue]); - if (ABS(scrollPosition.x) > 0.00000001 || ABS(scrollPosition.y) > 0.00000001) { - if ([f parentFrame] != nil) - printf("frame '%s' ", [[f name] UTF8String]); - printf("scrolled to %.f,%.f\n", scrollPosition.x, scrollPosition.y); - } - - if (gTestRunner->dumpChildFrameScrollPositions()) { - NSArray *kids = [f childFrames]; - if (kids) - for (unsigned i = 0; i < [kids count]; i++) - dumpFrameScrollPosition([kids objectAtIndex:i]); - } -} - -static NSString *dumpFramesAsText(WebFrame *frame) -{ - DOMDocument *document = [frame DOMDocument]; - DOMElement *documentElement = [document documentElement]; - - if (!documentElement) - return @""; - - NSMutableString *result = [[[NSMutableString alloc] init] autorelease]; - - // Add header for all but the main frame. - if ([frame parentFrame]) - result = [NSMutableString stringWithFormat:@"\n--------\nFrame: '%@'\n--------\n", [frame name]]; - - [result appendFormat:@"%@\n", [documentElement innerText]]; - - if (gTestRunner->dumpChildFramesAsText()) { - NSArray *kids = [frame childFrames]; - if (kids) { - for (unsigned i = 0; i < [kids count]; i++) - [result appendString:dumpFramesAsText([kids objectAtIndex:i])]; - } - } - - return result; -} - -static NSData *dumpFrameAsPDF(WebFrame *frame) -{ - if (!frame) - return nil; - - // Sadly we have to dump to a file and then read from that file again - // +[NSPrintOperation PDFOperationWithView:insideRect:] requires a rect and prints to a single page - // likewise +[NSView dataWithPDFInsideRect:] also prints to a single continuous page - // The goal of this function is to test "real" printing across multiple pages. - // FIXME: It's possible there might be printing SPI to let us print a multi-page PDF to an NSData object - NSString *path = [libraryPathForDumpRenderTree() stringByAppendingPathComponent:@"test.pdf"]; - - NSMutableDictionary *printInfoDict = [NSMutableDictionary dictionaryWithDictionary:[[NSPrintInfo sharedPrintInfo] dictionary]]; - [printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition]; - [printInfoDict setObject:path forKey:NSPrintSavePath]; - - NSPrintInfo *printInfo = [[NSPrintInfo alloc] initWithDictionary:printInfoDict]; - [printInfo setHorizontalPagination:NSAutoPagination]; - [printInfo setVerticalPagination:NSAutoPagination]; - [printInfo setVerticallyCentered:NO]; - - NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:[frame frameView] printInfo:printInfo]; - [printOperation setShowPanels:NO]; - [printOperation runOperation]; - - [printInfo release]; - - NSData *pdfData = [NSData dataWithContentsOfFile:path]; - [[NSFileManager defaultManager] removeFileAtPath:path handler:nil]; - - return pdfData; -} - -static void dumpBackForwardListForWebView(WebView *view) -{ - printf("\n============== Back Forward List ==============\n"); - WebBackForwardList *bfList = [view backForwardList]; - - // Print out all items in the list after prevTestBFItem, which was from the previous test - // Gather items from the end of the list, the print them out from oldest to newest - NSMutableArray *itemsToPrint = [[NSMutableArray alloc] init]; - for (int i = [bfList forwardListCount]; i > 0; i--) { - WebHistoryItem *item = [bfList itemAtIndex:i]; - // something is wrong if the item from the last test is in the forward part of the b/f list - assert(item != prevTestBFItem); - [itemsToPrint addObject:item]; - } - - assert([bfList currentItem] != prevTestBFItem); - [itemsToPrint addObject:[bfList currentItem]]; - int currentItemIndex = [itemsToPrint count] - 1; - - for (int i = -1; i >= -[bfList backListCount]; i--) { - WebHistoryItem *item = [bfList itemAtIndex:i]; - if (item == prevTestBFItem) - break; - [itemsToPrint addObject:item]; - } - - for (int i = [itemsToPrint count]-1; i >= 0; i--) - dumpHistoryItem([itemsToPrint objectAtIndex:i], 8, i == currentItemIndex); - - [itemsToPrint release]; - printf("===============================================\n"); -} - -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(TestRunner::w3cSVGViewWidth, TestRunner::w3cSVGViewHeight)]; - else - [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::viewWidth, TestRunner::viewHeight)]; -} - -static const char *methodNameStringForFailedTest() -{ - const char *errorMessage; - if (gTestRunner->dumpAsText()) - errorMessage = "[documentElement innerText]"; - else if (gTestRunner->dumpDOMAsWebArchive()) - errorMessage = "[[mainFrame DOMDocument] webArchive]"; - else if (gTestRunner->dumpSourceAsWebArchive()) - errorMessage = "[[mainFrame dataSource] webArchive]"; - else - errorMessage = "[mainFrame renderTreeAsExternalRepresentation]"; - - return errorMessage; -} - -static void dumpBackForwardListForAllWindows() -{ - CFArrayRef openWindows = (CFArrayRef)[DumpRenderTreeWindow openWindows]; - unsigned count = CFArrayGetCount(openWindows); - for (unsigned i = 0; i < count; i++) { - NSWindow *window = (NSWindow *)CFArrayGetValueAtIndex(openWindows, i); - WebView *webView = [[[window contentView] subviews] objectAtIndex:0]; - dumpBackForwardListForWebView(webView); - } -} - -static void invalidateAnyPreviousWaitToDumpWatchdog() -{ - if (waitToDumpWatchdog) { - CFRunLoopTimerInvalidate(waitToDumpWatchdog); - CFRelease(waitToDumpWatchdog); - waitToDumpWatchdog = 0; - } -} - -void setWaitToDumpWatchdog(CFRunLoopTimerRef timer) -{ - ASSERT(timer); - ASSERT(shouldSetWaitToDumpWatchdog()); - waitToDumpWatchdog = timer; - CFRunLoopAddTimer(CFRunLoopGetCurrent(), waitToDumpWatchdog, kCFRunLoopCommonModes); -} - -bool shouldSetWaitToDumpWatchdog() -{ - return !waitToDumpWatchdog && useTimeoutWatchdog; -} - -void dump() -{ - invalidateAnyPreviousWaitToDumpWatchdog(); - ASSERT(!gTestRunner->hasPendingWebNotificationClick()); - - if (dumpTree) { - NSString *resultString = nil; - NSData *resultData = nil; - NSString *resultMimeType = @"text/plain"; - - if ([[[mainFrame dataSource] _responseMIMEType] isEqualToString:@"text/plain"]) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } - if (gTestRunner->dumpAsAudio()) { - resultData = dumpAudio(); - resultMimeType = @"audio/wav"; - } else if (gTestRunner->dumpAsText()) { - resultString = dumpFramesAsText(mainFrame); - } else if (gTestRunner->dumpAsPDF()) { - resultData = dumpFrameAsPDF(mainFrame); - resultMimeType = @"application/pdf"; - } else if (gTestRunner->dumpDOMAsWebArchive()) { - WebArchive *webArchive = [[mainFrame DOMDocument] webArchive]; - resultString = HardAutorelease(createXMLStringFromWebArchiveData((CFDataRef)[webArchive data])); - resultMimeType = @"application/x-webarchive"; - } else if (gTestRunner->dumpSourceAsWebArchive()) { - WebArchive *webArchive = [[mainFrame dataSource] webArchive]; - resultString = HardAutorelease(createXMLStringFromWebArchiveData((CFDataRef)[webArchive data])); - resultMimeType = @"application/x-webarchive"; - } else - resultString = [mainFrame renderTreeAsExternalRepresentationForPrinting:gTestRunner->isPrinting()]; - - if (resultString && !resultData) - resultData = [resultString dataUsingEncoding:NSUTF8StringEncoding]; - - printf("Content-Type: %s\n", [resultMimeType UTF8String]); - - if (gTestRunner->dumpAsAudio()) - printf("Content-Transfer-Encoding: base64\n"); - - WTF::FastMallocStatistics mallocStats = WTF::fastMallocStatistics(); - printf("DumpMalloc: %li\n", mallocStats.committedVMBytes); - - if (resultData) { - fwrite([resultData bytes], 1, [resultData length], stdout); - - if (!gTestRunner->dumpAsText() && !gTestRunner->dumpDOMAsWebArchive() && !gTestRunner->dumpSourceAsWebArchive()) - dumpFrameScrollPosition(mainFrame); - - if (gTestRunner->dumpBackForwardList()) - dumpBackForwardListForAllWindows(); - } else - printf("ERROR: nil result from %s", methodNameStringForFailedTest()); - - // Stop the watchdog thread before we leave this test to make sure it doesn't - // fire in between tests causing the next test to fail. - // This is a speculative fix for: https://bugs.webkit.org/show_bug.cgi?id=32339 - invalidateAnyPreviousWaitToDumpWatchdog(); - - if (printSeparators) { - puts("#EOF"); // terminate the content block - fputs("#EOF\n", stderr); - } - } - - if (dumpPixelsForCurrentTest && gTestRunner->generatePixelResults()) - // FIXME: when isPrinting is set, dump the image with page separators. - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - - puts("#EOF"); // terminate the (possibly empty) pixels block - - fflush(stdout); - fflush(stderr); - - done = YES; -} - -static bool shouldLogFrameLoadDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "loading/"); -} - -static bool shouldLogHistoryDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "globalhistory/"); -} - -static bool shouldOpenWebInspector(const char* pathOrURL) -{ - return strstr(pathOrURL, "inspector/"); -} - -static bool shouldDumpAsText(const char* pathOrURL) -{ - return strstr(pathOrURL, "dumpAsText/"); -} - -static bool shouldEnableDeveloperExtras(const char* pathOrURL) -{ - return true; -} - -static void resetWebViewToConsistentStateBeforeTesting() -{ - WebView *webView = [mainFrame webView]; - [webView setEditable:NO]; - [(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES]; - [webView makeTextStandardSize:nil]; - [webView resetPageZoom:nil]; - [webView _scaleWebView:1.0 atOrigin:NSZeroPoint]; - [webView _setCustomBackingScaleFactor:0]; - [webView setTabKeyCyclesThroughElements:YES]; - [webView setPolicyDelegate:defaultPolicyDelegate]; - [policyDelegate setPermissive:NO]; - [policyDelegate setControllerToNotifyDone:0]; - [frameLoadDelegate resetToConsistentState]; - [webView _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO]; - [webView _clearMainFrameName]; - [[webView undoManager] removeAllActions]; - [WebView _removeAllUserContentFromGroup:[webView groupName]]; - [[webView window] setAutodisplay:NO]; - [webView setTracksRepaints:NO]; - - resetDefaultsToConsistentValues(); - - if (gTestRunner) { - WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]); - // in the case that a test using the chrome input field failed, be sure to clean up for the next test - gTestRunner->removeChromeInputField(); - } - - [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]; - [WebView _setAllowsRoundingHacks:NO]; - - [[MockGeolocationProvider shared] stopTimer]; - [[MockWebNotificationProvider shared] reset]; - - // Clear the contents of the general pasteboard - [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; - - [mainFrame _clearOpener]; -} - -static void runTest(const string& inputLine) -{ - ASSERT(!inputLine.empty()); - - TestCommand command = parseInputLine(inputLine); - const string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; - - NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()]; - if (!pathOrURLString) { - fprintf(stderr, "Failed to parse \"%s\" as UTF-8\n", pathOrURL.c_str()); - return; - } - - NSURL *url; - if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"] || [pathOrURLString hasPrefix:@"file://"]) - url = [NSURL URLWithString:pathOrURLString]; - else - url = [NSURL fileURLWithPath:pathOrURLString]; - if (!url) { - fprintf(stderr, "Failed to parse \"%s\" as a URL\n", pathOrURL.c_str()); - return; - } - - const string testURL([[url absoluteString] UTF8String]); - - resetWebViewToConsistentStateBeforeTesting(); - - gTestRunner = TestRunner::create(testURL, command.expectedPixelHash); - topLoadingFrame = nil; - ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop! - releaseAndZero(&draggingInfo); - done = NO; - - sizeWebViewForCurrentTest(); - gTestRunner->setIconDatabaseEnabled(false); - - if (disallowedURLs) - CFSetRemoveAllValues(disallowedURLs); - if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) - gTestRunner->setDumpFrameLoadCallbacks(true); - - if (shouldLogHistoryDelegates(pathOrURL.c_str())) - [[mainFrame webView] setHistoryDelegate:historyDelegate]; - else - [[mainFrame webView] setHistoryDelegate:nil]; - - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gTestRunner->setDeveloperExtrasEnabled(true); - if (shouldOpenWebInspector(pathOrURL.c_str())) - gTestRunner->showWebInspector(); - if (shouldDumpAsText(pathOrURL.c_str())) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } - } - - if ([WebHistory optionalSharedHistory]) - [WebHistory setOptionalSharedHistory:nil]; - lastMousePosition = NSZeroPoint; - lastClickPosition = NSZeroPoint; - - [prevTestBFItem release]; - prevTestBFItem = [[[[mainFrame webView] backForwardList] currentItem] retain]; - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - bool ignoreWebCoreNodeLeaks = shouldIgnoreWebCoreNodeLeaks(testURL); - if (ignoreWebCoreNodeLeaks) - [WebCoreStatistics startIgnoringWebCoreNodeLeaks]; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [mainFrame loadRequest:[NSURLRequest requestWithURL:url]]; - [pool release]; - - while (!done) { - pool = [[NSAutoreleasePool alloc] init]; - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; - [pool release]; - } - - pool = [[NSAutoreleasePool alloc] init]; - [EventSendingController clearSavedEvents]; - [[mainFrame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream]; - - WorkQueue::shared()->clear(); - - if (gTestRunner->closeRemainingWindowsWhenComplete()) { - NSArray* array = [DumpRenderTreeWindow openWindows]; - - unsigned count = [array count]; - for (unsigned i = 0; i < count; i++) { - NSWindow *window = [array objectAtIndex:i]; - - // Don't try to close the main window - if (window == [[mainFrame webView] window]) - continue; - - WebView *webView = [[[window contentView] subviews] objectAtIndex:0]; - - [webView close]; - [window close]; - } - } - - // If developer extras enabled Web Inspector may have been open by the test. - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gTestRunner->closeWebInspector(); - gTestRunner->setDeveloperExtrasEnabled(false); - } - - resetWebViewToConsistentStateBeforeTesting(); - - [mainFrame loadHTMLString:@"<html></html>" baseURL:[NSURL URLWithString:@"about:blank"]]; - [mainFrame stopLoading]; - - [pool release]; - - // We should only have our main window left open when we're done - ASSERT(CFArrayGetCount(openWindowsRef) == 1); - ASSERT(CFArrayGetValueAtIndex(openWindowsRef, 0) == [[mainFrame webView] window]); - - gTestRunner.clear(); - - if (ignoreWebCoreNodeLeaks) - [WebCoreStatistics stopIgnoringWebCoreNodeLeaks]; - - if (gcBetweenTests) - [WebCoreStatistics garbageCollectJavaScriptObjects]; -} - -void displayWebView() -{ - WebView *webView = [mainFrame webView]; - [webView display]; - - [webView setTracksRepaints:YES]; - [webView resetTrackedRepaints]; -} - -@implementation DumpRenderTreeEvent - -+ (NSPoint)mouseLocation -{ - return [[[mainFrame webView] window] convertBaseToScreen:lastMousePosition]; -} - -@end - -@implementation DumpRenderTreeApplication - -- (BOOL)isRunning -{ - // <rdar://problem/7686123> Java plug-in freezes unless NSApplication is running - return YES; -} - -@end diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.h b/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.h deleted file mode 100644 index 249809c94..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, 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. - */ - -#import <Cocoa/Cocoa.h> - -@interface DumpRenderTreeDraggingInfo : NSObject <NSDraggingInfo> { -@private - NSSize offset; - NSImage *draggedImage; - NSPasteboard *draggingPasteboard; - id draggingSource; -} - -- (id)initWithImage:(NSImage *)image offset:(NSSize)offset pasteboard:(NSPasteboard *)pasteboard source:(id)source; - -- (NSWindow *)draggingDestinationWindow; -- (NSDragOperation)draggingSourceOperationMask; -- (NSPoint)draggingLocation; -- (NSPoint)draggedImageLocation; -- (NSImage *)draggedImage; -- (NSPasteboard *)draggingPasteboard; -- (id)draggingSource; -- (int)draggingSequenceNumber; - -- (void)slideDraggedImageTo:(NSPoint)screenPoint; -- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination; -@end - diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm b/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm deleted file mode 100644 index b6b22c269..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, 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. - */ - -#import "config.h" -#import "DumpRenderTreeDraggingInfo.h" - -#import "DumpRenderTree.h" -#import "EventSendingController.h" -#import <WebKit/WebKit.h> - -@implementation DumpRenderTreeDraggingInfo - -- (id)initWithImage:(NSImage *)anImage offset:(NSSize)o pasteboard:(NSPasteboard *)pboard source:(id)source -{ - draggedImage = [anImage retain]; - draggingPasteboard = [pboard retain]; - draggingSource = [source retain]; - offset = o; - - return [super init]; -} - -- (void)dealloc -{ - [draggedImage release]; - [draggingPasteboard release]; - [draggingSource release]; - [super dealloc]; -} - -- (NSWindow *)draggingDestinationWindow -{ - return [[mainFrame webView] window]; -} - -- (NSDragOperation)draggingSourceOperationMask -{ - return [draggingSource draggingSourceOperationMaskForLocal:YES]; -} - -- (NSPoint)draggingLocation -{ - return lastMousePosition; -} - -- (NSPoint)draggedImageLocation -{ - return NSMakePoint(lastMousePosition.x + offset.width, lastMousePosition.y + offset.height); -} - -- (NSImage *)draggedImage -{ - return draggedImage; -} - -- (NSPasteboard *)draggingPasteboard -{ - return draggingPasteboard; -} - -- (id)draggingSource -{ - return draggingSource; -} - -- (int)draggingSequenceNumber -{ - NSLog(@"DumpRenderTree doesn't support draggingSequenceNumber"); - return 0; -} - -- (void)slideDraggedImageTo:(NSPoint)screenPoint -{ - NSLog(@"DumpRenderTree doesn't support slideDraggedImageTo:"); -} - -- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination -{ - NSLog(@"DumpRenderTree doesn't support namesOfPromisedFilesDroppedAtDestination:"); - return nil; -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -- (NSDraggingFormation)draggingFormation -{ - return NSDraggingFormationDefault; -} - -- (void)setDraggingFormation:(NSDraggingFormation)formation -{ - // Ignored. -} - -- (BOOL)animatesToDestination -{ - return NO; -} - -- (void)setAnimatesToDestination:(BOOL)flag -{ - // Ignored. -} - -- (NSInteger)numberOfValidItemsForDrop -{ - return 1; -} - -- (void)setNumberOfValidItemsForDrop:(NSInteger)number -{ - // Ignored. -} - -- (void)enumerateDraggingItemsWithOptions:(NSEnumerationOptions)enumOpts forView:(NSView *)view classes:(NSArray *)classArray searchOptions:(NSDictionary *)searchOptions usingBlock:(void (^)(NSDraggingItem *draggingItem, NSInteger idx, BOOL *stop))block -{ - // Ignored. -} -#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - -@end - diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h b/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h deleted file mode 100644 index 6c7331171..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef DumpRenderTreeMac_h -#define DumpRenderTreeMac_h - -#include <CoreFoundation/CoreFoundation.h> - -#ifdef __OBJC__ -@class DefaultPolicyDelegate; -@class DumpRenderTreeDraggingInfo; -@class NavigationController; -@class PolicyDelegate; -@class StorageTrackerDelegate; -@class WebFrame; -@class WebScriptWorld; -@class WebView; -#else -class DefaultPolicyDelegate; -class DumpRenderTreeDraggingInfo; -class NavigationController; -class PolicyDelegate; -class StorageTrackerDelegate; -class WebFrame; -class WebScriptWorld; -class WebView; -#endif - -extern CFMutableArrayRef openWindowsRef; -extern CFMutableSetRef disallowedURLs; -extern WebFrame* mainFrame; -extern WebFrame* topLoadingFrame; -extern DumpRenderTreeDraggingInfo *draggingInfo; -extern NavigationController* gNavigationController; -extern PolicyDelegate* policyDelegate; -extern StorageTrackerDelegate* storageDelegate; -extern DefaultPolicyDelegate *defaultPolicyDelegate; - -void setWaitToDumpWatchdog(CFRunLoopTimerRef); -bool shouldSetWaitToDumpWatchdog(); - -WebView* createWebViewAndOffscreenWindow(); -void setPersistentUserStyleSheetLocation(CFStringRef); - -unsigned worldIDForWorld(WebScriptWorld *); - -#endif // DumpRenderTreeMac_h diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.h b/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.h deleted file mode 100644 index ba2754ba7..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.h +++ /dev/null @@ -1,38 +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. - */ - -#import <AppKit/AppKit.h> -#import <WebKit/WebTypesInternal.h> - -@interface DumpRenderTreePasteboard : NSPasteboard -- (NSInteger)declareType:(NSString *)type owner:(id)newOwner; -+ (void)releaseLocalPasteboards; -@end - diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.m b/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.m deleted file mode 100644 index 04fafd84c..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.m +++ /dev/null @@ -1,211 +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. - */ - -#import "config.h" -#import "DumpRenderTreeMac.h" -#import "DumpRenderTreePasteboard.h" - -#import <WebKit/WebTypesInternal.h> - -@interface LocalPasteboard : NSPasteboard -{ - NSMutableArray *typesArray; - NSMutableSet *typesSet; - NSMutableDictionary *dataByType; - NSInteger changeCount; - NSString *pasteboardName; -} - --(id)initWithName:(NSString *)name; -@end - -static NSMutableDictionary *localPasteboards; - -@implementation DumpRenderTreePasteboard - -// Return a local pasteboard so we don't disturb the real pasteboards when running tests. -+ (NSPasteboard *)_pasteboardWithName:(NSString *)name -{ - static int number = 0; - if (!name) - name = [NSString stringWithFormat:@"LocalPasteboard%d", ++number]; - if (!localPasteboards) - localPasteboards = [[NSMutableDictionary alloc] init]; - LocalPasteboard *pasteboard = [localPasteboards objectForKey:name]; - if (pasteboard) - return pasteboard; - pasteboard = [[LocalPasteboard alloc] initWithName:name]; - [localPasteboards setObject:pasteboard forKey:name]; - [pasteboard release]; - return pasteboard; -} - -+ (void)releaseLocalPasteboards -{ - [localPasteboards release]; - localPasteboards = nil; -} - -// Convenience method for JS so that it doesn't have to try and create a NSArray on the objc side instead -// of the usual WebScriptObject that is passed around -- (NSInteger)declareType:(NSString *)type owner:(id)newOwner -{ - return [self declareTypes:[NSArray arrayWithObject:type] owner:newOwner]; -} - -@end - -@implementation LocalPasteboard - -+ (id)alloc -{ - return NSAllocateObject(self, 0, 0); -} - -- (id)initWithName:(NSString *)name -{ - typesArray = [[NSMutableArray alloc] init]; - typesSet = [[NSMutableSet alloc] init]; - dataByType = [[NSMutableDictionary alloc] init]; - pasteboardName = [name copy]; - return self; -} - -- (void)dealloc -{ - [typesArray release]; - [typesSet release]; - [dataByType release]; - [pasteboardName release]; - [super dealloc]; -} - -- (NSString *)name -{ - return pasteboardName; -} - -- (void)releaseGlobally -{ -} - -- (NSInteger)declareTypes:(NSArray *)newTypes owner:(id)newOwner -{ - [typesArray removeAllObjects]; - [typesSet removeAllObjects]; - [dataByType removeAllObjects]; - return [self addTypes:newTypes owner:newOwner]; -} - -- (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner -{ - unsigned count = [newTypes count]; - unsigned i; - for (i = 0; i < count; ++i) { - NSString *type = [newTypes objectAtIndex:i]; - NSString *setType = [typesSet member:type]; - if (!setType) { - setType = [type copy]; - [typesArray addObject:setType]; - [typesSet addObject:setType]; - [setType release]; - } - if (newOwner && [newOwner respondsToSelector:@selector(pasteboard:provideDataForType:)]) - [newOwner pasteboard:self provideDataForType:setType]; - } - return ++changeCount; -} - -- (NSInteger)changeCount -{ - return changeCount; -} - -- (NSArray *)types -{ - return typesArray; -} - -- (NSString *)availableTypeFromArray:(NSArray *)types -{ - unsigned count = [types count]; - unsigned i; - for (i = 0; i < count; ++i) { - NSString *type = [types objectAtIndex:i]; - NSString *setType = [typesSet member:type]; - if (setType) - return setType; - } - return nil; -} - -- (BOOL)setData:(NSData *)data forType:(NSString *)dataType -{ - if (data == nil) - data = [NSData data]; - if (![typesSet containsObject:dataType]) - return NO; - [dataByType setObject:data forKey:dataType]; - ++changeCount; - return YES; -} - -- (NSData *)dataForType:(NSString *)dataType -{ - return [dataByType objectForKey:dataType]; -} - -- (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType -{ - CFDataRef data = NULL; - if (propertyList) - data = CFPropertyListCreateXMLData(NULL, propertyList); - BOOL result = [self setData:(NSData *)data forType:dataType]; - if (data) - CFRelease(data); - return result; -} - -- (BOOL)setString:(NSString *)string forType:(NSString *)dataType -{ - CFDataRef data = NULL; - if (string) { - if ([string length] == 0) - data = CFDataCreate(NULL, NULL, 0); - else - data = CFStringCreateExternalRepresentation(NULL, (CFStringRef)string, kCFStringEncodingUTF8, 0); - } - BOOL result = [self setData:(NSData *)data forType:dataType]; - if (data) - CFRelease(data); - return result; -} - -@end diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h deleted file mode 100644 index 3b1d77eb3..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h +++ /dev/null @@ -1,52 +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. - */ - -#import <AppKit/AppKit.h> - -@class WebView; - -@interface NSWindow (Details) - -- (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged; - -@end - -@interface DumpRenderTreeWindow : NSWindow -{ -} - -// I'm not sure why we can't just use [NSApp windows] -+ (NSArray *)openWindows; - -- (WebView *)webView; - -- (void)startListeningForAcceleratedCompositingChanges; - -@end diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm b/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm deleted file mode 100644 index 4a6fd6bbc..000000000 --- a/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm +++ /dev/null @@ -1,128 +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. - */ - -#import "config.h" -#import "DumpRenderTreeWindow.h" - -#import "DumpRenderTree.h" - -// FIXME: This file is ObjC++ only because of this include. :( -#import "TestRunner.h" -#import <WebKit/WebViewPrivate.h> -#import <WebKit/WebTypesInternal.h> - -CFMutableArrayRef openWindowsRef = 0; - -static CFArrayCallBacks NonRetainingArrayCallbacks = { - 0, - NULL, - NULL, - CFCopyDescription, - CFEqual -}; - -@implementation DumpRenderTreeWindow - -+ (NSArray *)openWindows -{ - return [[(NSArray *)openWindowsRef copy] autorelease]; -} - -- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation -{ - if (!openWindowsRef) - openWindowsRef = CFArrayCreateMutable(NULL, 0, &NonRetainingArrayCallbacks); - - CFArrayAppendValue(openWindowsRef, self); - - return [super initWithContentRect:contentRect styleMask:styleMask backing:bufferingType defer:deferCreation]; -} - -- (void)close -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - CFRange arrayRange = CFRangeMake(0, CFArrayGetCount(openWindowsRef)); - CFIndex i = CFArrayGetFirstIndexOfValue(openWindowsRef, arrayRange, self); - if (i != kCFNotFound) - CFArrayRemoveValueAtIndex(openWindowsRef, i); - - [super close]; -} - -- (BOOL)isKeyWindow -{ - return gTestRunner ? gTestRunner->windowIsKey() : YES; -} - -- (BOOL)_hasKeyAppearance -{ - return [self isKeyWindow]; -} - -- (void)keyDown:(NSEvent *)event -{ - // Do nothing, avoiding the beep we'd otherwise get from NSResponder, - // once we get to the end of the responder chain. -} - -- (WebView *)webView -{ - NSView *firstView = nil; - if ([[[self contentView] subviews] count] > 0) { - firstView = [[[self contentView] subviews] objectAtIndex:0]; - if ([firstView isKindOfClass:[WebView class]]) - return static_cast<WebView *>(firstView); - } - return nil; -} - -- (void)startListeningForAcceleratedCompositingChanges -{ - [[self webView] _setPostsAcceleratedCompositingNotifications:YES]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewStartedAcceleratedCompositing:) - name:_WebViewDidStartAcceleratedCompositingNotification object:nil]; -} - -- (void)webViewStartedAcceleratedCompositing:(NSNotification *)notification -{ - // If the WebView has gone into compositing mode, turn on window autodisplay. This is necessary for CA - // to update layers and start animations. - // We only ever turn autodisplay on here, because we turn it off before every test. - if ([[self webView] _isUsingAcceleratedCompositing]) - [self setAutodisplay:YES]; -} - -- (CGFloat)backingScaleFactor -{ - return 1; -} - -@end diff --git a/Tools/DumpRenderTree/mac/EditingDelegate.h b/Tools/DumpRenderTree/mac/EditingDelegate.h deleted file mode 100644 index b5563c887..000000000 --- a/Tools/DumpRenderTree/mac/EditingDelegate.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, 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. - */ - -#import <Cocoa/Cocoa.h> - -@interface EditingDelegate : NSObject -{ - BOOL acceptsEditing; -} - -- (void)setAcceptsEditing:(BOOL)newAcceptsEditing; - -@end diff --git a/Tools/DumpRenderTree/mac/EditingDelegate.mm b/Tools/DumpRenderTree/mac/EditingDelegate.mm deleted file mode 100644 index d6227a72c..000000000 --- a/Tools/DumpRenderTree/mac/EditingDelegate.mm +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, 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. - */ - -#import "config.h" -#import "EditingDelegate.h" - -#import "DumpRenderTree.h" -#import "TestRunner.h" -#import <WebKit/WebKit.h> - -@interface DOMNode (dumpPath) -- (NSString *)dumpPath; -@end - -@implementation DOMNode (dumpPath) -- (NSString *)dumpPath -{ - DOMNode *parent = [self parentNode]; - NSString *str = [NSString stringWithFormat:@"%@", [self nodeName]]; - if (parent != nil) { - str = [str stringByAppendingString:@" > "]; - str = [str stringByAppendingString:[parent dumpPath]]; - } - return str; -} -@end - -@interface DOMRange (dump) -- (NSString *)dump; -@end - -@implementation DOMRange (dump) -- (NSString *)dump -{ - return [NSString stringWithFormat:@"range from %d of %@ to %d of %@", [self startOffset], [[self startContainer] dumpPath], [self endOffset], [[self endContainer] dumpPath]]; -} -@end - -@implementation EditingDelegate - -- (id)init -{ - self = [super init]; - if (!self) - return nil; - acceptsEditing = YES; - return self; -} - -- (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", [[range dump] UTF8String]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", [[range dump] UTF8String]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action -{ - static const char *insertactionstring[] = { - "WebViewInsertActionTyped", - "WebViewInsertActionPasted", - "WebViewInsertActionDropped", - }; - - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", [[node dumpPath] UTF8String], [[range dump] UTF8String], insertactionstring[action]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action -{ - static const char *insertactionstring[] = { - "WebViewInsertActionTyped", - "WebViewInsertActionPasted", - "WebViewInsertActionDropped", - }; - - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", [[text description] UTF8String], [[range dump] UTF8String], insertactionstring[action]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldDeleteDOMRange:(DOMRange *)range -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", [[range dump] UTF8String]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldShowDeleteInterfaceForElement:(DOMHTMLElement *)element -{ - return [[element className] isEqualToString:@"needsDeletionUI"]; -} - -- (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag -{ - static const char *affinitystring[] = { - "NSSelectionAffinityUpstream", - "NSSelectionAffinityDownstream" - }; - static const char *boolstring[] = { - "FALSE", - "TRUE" - }; - - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", [[currentRange dump] UTF8String], [[proposedRange dump] UTF8String], affinitystring[selectionAffinity], boolstring[flag]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldApplyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", [[style description] UTF8String], [[range dump] UTF8String]); - return acceptsEditing; -} - -- (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", [[currentStyle description] UTF8String], [[proposedStyle description] UTF8String]); - return acceptsEditing; -} - -- (void)webViewDidBeginEditing:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidBeginEditing:%s\n", [[notification name] UTF8String]); -} - -- (void)webViewDidChange:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChange:%s\n", [[notification name] UTF8String]); -} - -- (void)webViewDidEndEditing:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidEndEditing:%s\n", [[notification name] UTF8String]); -} - -- (void)webViewDidChangeTypingStyle:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n", [[notification name] UTF8String]); -} - -- (void)webViewDidChangeSelection:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpEditingCallbacks()) - printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", [[notification name] UTF8String]); -} - -- (void)setAcceptsEditing:(BOOL)newAcceptsEditing -{ - acceptsEditing = newAcceptsEditing; -} - -@end diff --git a/Tools/DumpRenderTree/mac/EventSendingController.h b/Tools/DumpRenderTree/mac/EventSendingController.h deleted file mode 100644 index 944057546..000000000 --- a/Tools/DumpRenderTree/mac/EventSendingController.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 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. - */ - -#import <Cocoa/Cocoa.h> -#import <WebKit/WebKit.h> - -@interface EventSendingController : NSObject <DOMEventListener> -{ - BOOL leftMouseButtonDown; - BOOL dragMode; - int clickCount; - NSTimeInterval lastClick; - int eventNumber; - double timeOffset; -} - -+ (void)saveEvent:(NSInvocation *)event; -+ (void)replaySavedEvents; -+ (void)clearSavedEvents; - -- (void)scheduleAsynchronousClick; - -- (void)enableDOMUIEventLogging:(WebScriptObject *)node; - -- (void)handleEvent:(DOMEvent *)event; - -@end - -extern NSPoint lastMousePosition; -extern NSPoint lastClickPosition;
\ No newline at end of file diff --git a/Tools/DumpRenderTree/mac/EventSendingController.mm b/Tools/DumpRenderTree/mac/EventSendingController.mm deleted file mode 100644 index 05bfd3679..000000000 --- a/Tools/DumpRenderTree/mac/EventSendingController.mm +++ /dev/null @@ -1,962 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com> - * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> - * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.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. - */ - -#import "config.h" -#import "EventSendingController.h" - -#import "DumpRenderTree.h" -#import "DumpRenderTreeDraggingInfo.h" -#import "DumpRenderTreeFileDraggingSource.h" - -#import <Carbon/Carbon.h> // for GetCurrentEventTime() -#import <WebKit/DOMPrivate.h> -#import <WebKit/WebKit.h> -#import <WebKit/WebViewPrivate.h> - -extern "C" void _NSNewKillRingSequence(); - -enum MouseAction { - MouseDown, - MouseUp, - MouseDragged -}; - -// Match the DOM spec (sadly the DOM spec does not provide an enum) -enum MouseButton { - LeftMouseButton = 0, - MiddleMouseButton = 1, - RightMouseButton = 2, - NoMouseButton = -1 -}; - -struct KeyMappingEntry { - int macKeyCode; - int macNumpadKeyCode; - unichar character; - NSString* characterName; -}; - -NSPoint lastMousePosition; -NSPoint lastClickPosition; -int lastClickButton = NoMouseButton; -NSArray *webkitDomEventNames; -NSMutableArray *savedMouseEvents; // mouse events sent between mouseDown and mouseUp are stored here, and then executed at once. -BOOL replayingSavedEvents; - -@implementation EventSendingController - -+ (void)initialize -{ - webkitDomEventNames = [[NSArray alloc] initWithObjects: - @"abort", - @"beforecopy", - @"beforecut", - @"beforepaste", - @"blur", - @"change", - @"click", - @"contextmenu", - @"copy", - @"cut", - @"dblclick", - @"drag", - @"dragend", - @"dragenter", - @"dragleave", - @"dragover", - @"dragstart", - @"drop", - @"error", - @"focus", - @"input", - @"keydown", - @"keypress", - @"keyup", - @"load", - @"mousedown", - @"mousemove", - @"mouseout", - @"mouseover", - @"mouseup", - @"mousewheel", - @"beforeunload", - @"paste", - @"readystatechange", - @"reset", - @"resize", - @"scroll", - @"search", - @"select", - @"selectstart", - @"submit", - @"textInput", - @"textzoomin", - @"textzoomout", - @"unload", - @"zoom", - nil]; -} - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (aSelector == @selector(beginDragWithFiles:) - || aSelector == @selector(clearKillRing) - || aSelector == @selector(contextClick) - || aSelector == @selector(enableDOMUIEventLogging:) - || aSelector == @selector(fireKeyboardEventsToElement:) - || aSelector == @selector(keyDown:withModifiers:withLocation:) - || aSelector == @selector(leapForward:) - || aSelector == @selector(mouseDown:withModifiers:) - || aSelector == @selector(mouseMoveToX:Y:) - || aSelector == @selector(mouseUp:withModifiers:) - || aSelector == @selector(scheduleAsynchronousClick) - || aSelector == @selector(scheduleAsynchronousKeyDown:withModifiers:withLocation:) - || aSelector == @selector(textZoomIn) - || aSelector == @selector(textZoomOut) - || aSelector == @selector(zoomPageIn) - || aSelector == @selector(zoomPageOut) - || aSelector == @selector(scalePageBy:atX:andY:) - || aSelector == @selector(mouseScrollByX:andY:) - || aSelector == @selector(continuousMouseScrollByX:andY:)) - return NO; - return YES; -} - -+ (BOOL)isKeyExcludedFromWebScript:(const char*)name -{ - if (strcmp(name, "dragMode") == 0) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(beginDragWithFiles:)) - return @"beginDragWithFiles"; - if (aSelector == @selector(contextClick)) - return @"contextClick"; - if (aSelector == @selector(enableDOMUIEventLogging:)) - return @"enableDOMUIEventLogging"; - if (aSelector == @selector(fireKeyboardEventsToElement:)) - return @"fireKeyboardEventsToElement"; - if (aSelector == @selector(keyDown:withModifiers:withLocation:)) - return @"keyDown"; - if (aSelector == @selector(scheduleAsynchronousKeyDown:withModifiers:withLocation:)) - return @"scheduleAsynchronousKeyDown"; - if (aSelector == @selector(leapForward:)) - return @"leapForward"; - if (aSelector == @selector(mouseDown:withModifiers:)) - return @"mouseDown"; - if (aSelector == @selector(mouseUp:withModifiers:)) - return @"mouseUp"; - if (aSelector == @selector(mouseMoveToX:Y:)) - return @"mouseMoveTo"; - if (aSelector == @selector(setDragMode:)) - return @"setDragMode"; - if (aSelector == @selector(mouseScrollByX:andY:)) - return @"mouseScrollBy"; - if (aSelector == @selector(continuousMouseScrollByX:andY:)) - return @"continuousMouseScrollBy"; - if (aSelector == @selector(scalePageBy:atX:andY:)) - return @"scalePageBy"; - return nil; -} - -- (id)init -{ - self = [super init]; - if (self) - dragMode = YES; - return self; -} - -- (void)dealloc -{ - [super dealloc]; -} - -- (double)currentEventTime -{ - return GetCurrentEventTime() + timeOffset; -} - -- (void)leapForward:(int)milliseconds -{ - if (dragMode && leftMouseButtonDown && !replayingSavedEvents) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(leapForward:)]]; - [invocation setTarget:self]; - [invocation setSelector:@selector(leapForward:)]; - [invocation setArgument:&milliseconds atIndex:2]; - - [EventSendingController saveEvent:invocation]; - - return; - } - - timeOffset += milliseconds / 1000.0; -} - -- (void)clearKillRing -{ - _NSNewKillRingSequence(); -} - -static NSEventType eventTypeForMouseButtonAndAction(int button, MouseAction action) -{ - switch (button) { - case LeftMouseButton: - switch (action) { - case MouseDown: - return NSLeftMouseDown; - case MouseUp: - return NSLeftMouseUp; - case MouseDragged: - return NSLeftMouseDragged; - } - case RightMouseButton: - switch (action) { - case MouseDown: - return NSRightMouseDown; - case MouseUp: - return NSRightMouseUp; - case MouseDragged: - return NSRightMouseDragged; - } - default: - switch (action) { - case MouseDown: - return NSOtherMouseDown; - case MouseUp: - return NSOtherMouseUp; - case MouseDragged: - return NSOtherMouseDragged; - } - } - assert(0); - return static_cast<NSEventType>(0); -} - -- (void)beginDragWithFiles:(WebScriptObject*)jsFilePaths -{ - assert(!draggingInfo); - assert([jsFilePaths isKindOfClass:[WebScriptObject class]]); - - NSPasteboard *pboard = [NSPasteboard pasteboardWithUniqueName]; - [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; - - NSURL *currentTestURL = [NSURL URLWithString:[[mainFrame webView] mainFrameURL]]; - - NSMutableArray *filePaths = [NSMutableArray array]; - for (unsigned i = 0; [[jsFilePaths webScriptValueAtIndex:i] isKindOfClass:[NSString class]]; i++) { - NSString *filePath = (NSString *)[jsFilePaths webScriptValueAtIndex:i]; - // Have NSURL encode the name so that we handle '?' in file names correctly. - NSURL *fileURL = [NSURL fileURLWithPath:filePath]; - NSURL *absoluteFileURL = [NSURL URLWithString:[fileURL relativeString] relativeToURL:currentTestURL]; - [filePaths addObject:[absoluteFileURL path]]; - } - - [pboard setPropertyList:filePaths forType:NSFilenamesPboardType]; - assert([pboard propertyListForType:NSFilenamesPboardType]); // setPropertyList will silently fail on error, assert that it didn't fail - - // Provide a source, otherwise [DumpRenderTreeDraggingInfo draggingSourceOperationMask] defaults to NSDragOperationNone - DumpRenderTreeFileDraggingSource *source = [[[DumpRenderTreeFileDraggingSource alloc] init] autorelease]; - draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:nil offset:NSZeroSize pasteboard:pboard source:source]; - [[mainFrame webView] draggingEntered:draggingInfo]; - - dragMode = NO; // dragMode saves events and then replays them later. We don't need/want that. - leftMouseButtonDown = YES; // Make the rest of eventSender think a drag is in progress -} - -- (void)updateClickCountForButton:(int)buttonNumber -{ - if (([self currentEventTime] - lastClick >= 1) || - !NSEqualPoints(lastMousePosition, lastClickPosition) || - lastClickButton != buttonNumber) { - clickCount = 1; - lastClickButton = buttonNumber; - } else - clickCount++; -} - -static int modifierFlags(const NSString* modifierName) -{ - int flags = 0; - if ([modifierName isEqual:@"ctrlKey"]) - flags |= NSControlKeyMask; - else if ([modifierName isEqual:@"shiftKey"] || [modifierName isEqual:@"rangeSelectionKey"]) - flags |= NSShiftKeyMask; - else if ([modifierName isEqual:@"altKey"]) - flags |= NSAlternateKeyMask; - else if ([modifierName isEqual:@"metaKey"] || [modifierName isEqual:@"addSelectionKey"]) - flags |= NSCommandKeyMask; - - return flags; -} - -static int buildModifierFlags(const WebScriptObject* modifiers) -{ - int flags = 0; - if ([modifiers isKindOfClass:[NSString class]]) - return modifierFlags((NSString*)modifiers); - else if (![modifiers isKindOfClass:[WebScriptObject class]]) - return flags; - for (unsigned i = 0; [[modifiers webScriptValueAtIndex:i] isKindOfClass:[NSString class]]; i++) { - NSString* modifierName = (NSString*)[modifiers webScriptValueAtIndex:i]; - flags |= modifierFlags(modifierName); - } - return flags; -} - -- (void)mouseDown:(int)buttonNumber withModifiers:(WebScriptObject*)modifiers -{ - [[[mainFrame frameView] documentView] layout]; - [self updateClickCountForButton:buttonNumber]; - - NSEventType eventType = eventTypeForMouseButtonAndAction(buttonNumber, MouseDown); - NSEvent *event = [NSEvent mouseEventWithType:eventType - location:lastMousePosition - modifierFlags:buildModifierFlags(modifiers) - timestamp:[self currentEventTime] - windowNumber:[[[mainFrame webView] window] windowNumber] - context:[NSGraphicsContext currentContext] - eventNumber:++eventNumber - clickCount:clickCount - pressure:0.0]; - - NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]]; - if (subView) { - [subView mouseDown:event]; - if (buttonNumber == LeftMouseButton) - leftMouseButtonDown = YES; - } -} - -- (void)mouseDown:(int)buttonNumber -{ - [self mouseDown:buttonNumber withModifiers:nil]; -} - -- (void)textZoomIn -{ - [[mainFrame webView] makeTextLarger:self]; -} - -- (void)textZoomOut -{ - [[mainFrame webView] makeTextSmaller:self]; -} - -- (void)zoomPageIn -{ - [[mainFrame webView] zoomPageIn:self]; -} - -- (void)zoomPageOut -{ - [[mainFrame webView] zoomPageOut:self]; -} - -- (void)scalePageBy:(float)scale atX:(float)x andY:(float)y -{ - [[mainFrame webView] _scaleWebView:scale atOrigin:NSMakePoint(x, y)]; -} - -- (void)mouseUp:(int)buttonNumber withModifiers:(WebScriptObject*)modifiers -{ - if (dragMode && !replayingSavedEvents) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseUp:withModifiers:)]]; - [invocation setTarget:self]; - [invocation setSelector:@selector(mouseUp:withModifiers:)]; - [invocation setArgument:&buttonNumber atIndex:2]; - [invocation setArgument:&modifiers atIndex:3]; - - [EventSendingController saveEvent:invocation]; - [EventSendingController replaySavedEvents]; - - return; - } - - [[[mainFrame frameView] documentView] layout]; - NSEventType eventType = eventTypeForMouseButtonAndAction(buttonNumber, MouseUp); - NSEvent *event = [NSEvent mouseEventWithType:eventType - location:lastMousePosition - modifierFlags:buildModifierFlags(modifiers) - timestamp:[self currentEventTime] - windowNumber:[[[mainFrame webView] window] windowNumber] - context:[NSGraphicsContext currentContext] - eventNumber:++eventNumber - clickCount:clickCount - pressure:0.0]; - - NSView *targetView = [[mainFrame webView] hitTest:[event locationInWindow]]; - // FIXME: Silly hack to teach DRT to respect capturing mouse events outside the WebView. - // The right solution is just to use NSApplication's built-in event sending methods, - // instead of rolling our own algorithm for selecting an event target. - targetView = targetView ? targetView : [[mainFrame frameView] documentView]; - assert(targetView); - [targetView mouseUp:event]; - if (buttonNumber == LeftMouseButton) - leftMouseButtonDown = NO; - lastClick = [event timestamp]; - lastClickPosition = lastMousePosition; - if (draggingInfo) { - WebView *webView = [mainFrame webView]; - - NSDragOperation dragOperation = [webView draggingUpdated:draggingInfo]; - - if (dragOperation != NSDragOperationNone) - [webView performDragOperation:draggingInfo]; - else - [webView draggingExited:draggingInfo]; - // Per NSDragging.h: draggingSources may not implement draggedImage:endedAt:operation: - if ([[draggingInfo draggingSource] respondsToSelector:@selector(draggedImage:endedAt:operation:)]) - [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:dragOperation]; - [draggingInfo release]; - draggingInfo = nil; - } -} - -- (void)mouseUp:(int)buttonNumber -{ - [self mouseUp:buttonNumber withModifiers:nil]; -} - -- (void)mouseMoveToX:(int)x Y:(int)y -{ - if (dragMode && leftMouseButtonDown && !replayingSavedEvents) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseMoveToX:Y:)]]; - [invocation setTarget:self]; - [invocation setSelector:@selector(mouseMoveToX:Y:)]; - [invocation setArgument:&x atIndex:2]; - [invocation setArgument:&y atIndex:3]; - - [EventSendingController saveEvent:invocation]; - return; - } - - NSView *view = [mainFrame webView]; - lastMousePosition = [view convertPoint:NSMakePoint(x, [view frame].size.height - y) toView:nil]; - NSEvent *event = [NSEvent mouseEventWithType:(leftMouseButtonDown ? NSLeftMouseDragged : NSMouseMoved) - location:lastMousePosition - modifierFlags:0 - timestamp:[self currentEventTime] - windowNumber:[[view window] windowNumber] - context:[NSGraphicsContext currentContext] - eventNumber:++eventNumber - clickCount:(leftMouseButtonDown ? clickCount : 0) - pressure:0.0]; - - NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]]; - if (subView) { - if (leftMouseButtonDown) { - if (draggingInfo) { - // Per NSDragging.h: draggingSources may not implement draggedImage:movedTo: - if ([[draggingInfo draggingSource] respondsToSelector:@selector(draggedImage:movedTo:)]) - [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] movedTo:lastMousePosition]; - [[mainFrame webView] draggingUpdated:draggingInfo]; - } else - [subView mouseDragged:event]; - } else - [subView mouseMoved:event]; - } -} - -- (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)c -{ - CGScrollEventUnit unit = c?kCGScrollEventUnitPixel:kCGScrollEventUnitLine; - CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, unit, 2, y, x); - - // CGEvent locations are in global display coordinates. - CGPoint lastGlobalMousePosition = { - lastMousePosition.x, - [[NSScreen mainScreen] frame].size.height - lastMousePosition.y - }; - CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition); - - NSEvent *scrollEvent = [NSEvent eventWithCGEvent:cgScrollEvent]; - CFRelease(cgScrollEvent); - - NSView *subView = [[mainFrame webView] hitTest:[scrollEvent locationInWindow]]; - if (subView) - [subView scrollWheel:scrollEvent]; -} - -- (void)continuousMouseScrollByX:(int)x andY:(int)y -{ - [self mouseScrollByX:x andY:y continuously:YES]; -} - -- (void)mouseScrollByX:(int)x andY:(int)y -{ - [self mouseScrollByX:x andY:y continuously:NO]; -} - -- (NSArray *)contextClick -{ - [[[mainFrame frameView] documentView] layout]; - [self updateClickCountForButton:RightMouseButton]; - - NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown - location:lastMousePosition - modifierFlags:0 - timestamp:[self currentEventTime] - windowNumber:[[[mainFrame webView] window] windowNumber] - context:[NSGraphicsContext currentContext] - eventNumber:++eventNumber - clickCount:clickCount - pressure:0.0]; - - NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]]; - NSMutableArray *menuItemStrings = [NSMutableArray array]; - - if (subView) { - NSMenu* menu = [subView menuForEvent:event]; - - for (int i = 0; i < [menu numberOfItems]; ++i) { - NSMenuItem* menuItem = [menu itemAtIndex:i]; - if (!strcmp("Inspect Element", [[menuItem title] UTF8String])) - continue; - - if ([menuItem isSeparatorItem]) - [menuItemStrings addObject:@"<separator>"]; - else - [menuItemStrings addObject:[menuItem title]]; - } - } - - return menuItemStrings; -} - -- (void)scheduleAsynchronousClick -{ - [self performSelector:@selector(mouseDown:) withObject:nil afterDelay:0]; - [self performSelector:@selector(mouseUp:) withObject:nil afterDelay:0]; -} - -+ (void)saveEvent:(NSInvocation *)event -{ - if (!savedMouseEvents) - savedMouseEvents = [[NSMutableArray alloc] init]; - [savedMouseEvents addObject:event]; -} - -+ (void)replaySavedEvents -{ - replayingSavedEvents = YES; - while ([savedMouseEvents count]) { - // if a drag is initiated, the remaining saved events will be dispatched from our dragging delegate - NSInvocation *invocation = [[[savedMouseEvents objectAtIndex:0] retain] autorelease]; - [savedMouseEvents removeObjectAtIndex:0]; - [invocation invoke]; - } - replayingSavedEvents = NO; -} - -+ (void)clearSavedEvents -{ - [savedMouseEvents release]; - savedMouseEvents = nil; -} - -- (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location -{ - NSString *eventCharacter = character; - unsigned short keyCode = 0; - if ([character isEqualToString:@"leftArrow"]) { - const unichar ch = NSLeftArrowFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x7B; - } else if ([character isEqualToString:@"rightArrow"]) { - const unichar ch = NSRightArrowFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x7C; - } else if ([character isEqualToString:@"upArrow"]) { - const unichar ch = NSUpArrowFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x7E; - } else if ([character isEqualToString:@"downArrow"]) { - const unichar ch = NSDownArrowFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x7D; - } else if ([character isEqualToString:@"pageUp"]) { - const unichar ch = NSPageUpFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x74; - } else if ([character isEqualToString:@"pageDown"]) { - const unichar ch = NSPageDownFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x79; - } else if ([character isEqualToString:@"home"]) { - const unichar ch = NSHomeFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x73; - } else if ([character isEqualToString:@"end"]) { - const unichar ch = NSEndFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x77; - } else if ([character isEqualToString:@"insert"]) { - const unichar ch = NSInsertFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x72; - } else if ([character isEqualToString:@"delete"]) { - const unichar ch = NSDeleteFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x75; - } else if ([character isEqualToString:@"printScreen"]) { - const unichar ch = NSPrintScreenFunctionKey; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x0; // There is no known virtual key code for PrintScreen. - } else if ([character isEqualToString:@"cyrillicSmallLetterA"]) { - const unichar ch = 0x0430; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3; // Shares key with "F" on Russian layout. - } else if ([character isEqualToString:@"leftControl"]) { - const unichar ch = 0xFFE3; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3B; - } else if ([character isEqualToString:@"leftShift"]) { - const unichar ch = 0xFFE1; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x38; - } else if ([character isEqualToString:@"leftAlt"]) { - const unichar ch = 0xFFE7; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3A; - } else if ([character isEqualToString:@"rightControl"]) { - const unichar ch = 0xFFE4; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3E; - } else if ([character isEqualToString:@"rightShift"]) { - const unichar ch = 0xFFE2; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3C; - } else if ([character isEqualToString:@"rightAlt"]) { - const unichar ch = 0xFFE8; - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - keyCode = 0x3D; - } - - // 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 (unsigned i = 1; i <= 24; i++) { - if ([character isEqualToString:[NSString stringWithFormat:@"F%u", i]]) { - const unichar ch = NSF1FunctionKey + (i - 1); - eventCharacter = [NSString stringWithCharacters:&ch length:1]; - switch (i) { - case 1: keyCode = 0x7A; break; - case 2: keyCode = 0x78; break; - case 3: keyCode = 0x63; break; - case 4: keyCode = 0x76; break; - case 5: keyCode = 0x60; break; - case 6: keyCode = 0x61; break; - case 7: keyCode = 0x62; break; - case 8: keyCode = 0x64; break; - case 9: keyCode = 0x65; break; - case 10: keyCode = 0x6D; break; - case 11: keyCode = 0x67; break; - case 12: keyCode = 0x6F; break; - case 13: keyCode = 0x69; break; - case 14: keyCode = 0x6B; break; - case 15: keyCode = 0x71; break; - case 16: keyCode = 0x6A; break; - case 17: keyCode = 0x40; break; - case 18: keyCode = 0x4F; break; - case 19: keyCode = 0x50; break; - case 20: keyCode = 0x5A; break; - } - } - } - - // FIXME: No keyCode is set for most keys. - if ([character isEqualToString:@"\t"]) - keyCode = 0x30; - else if ([character isEqualToString:@" "]) - keyCode = 0x31; - else if ([character isEqualToString:@"\r"]) - keyCode = 0x24; - else if ([character isEqualToString:@"\n"]) - keyCode = 0x4C; - else if ([character isEqualToString:@"\x8"]) - keyCode = 0x33; - else if ([character isEqualToString:@"a"]) - keyCode = 0x00; - else if ([character isEqualToString:@"b"]) - keyCode = 0x0B; - else if ([character isEqualToString:@"d"]) - keyCode = 0x02; - else if ([character isEqualToString:@"e"]) - keyCode = 0x0E; - - KeyMappingEntry table[] = { - {0x2F, 0x41, '.', nil}, - {0, 0x43, '*', nil}, - {0, 0x45, '+', nil}, - {0, 0x47, NSClearLineFunctionKey, @"clear"}, - {0x2C, 0x4B, '/', nil}, - {0, 0x4C, 3, @"enter" }, - {0x1B, 0x4E, '-', nil}, - {0x18, 0x51, '=', nil}, - {0x1D, 0x52, '0', nil}, - {0x12, 0x53, '1', nil}, - {0x13, 0x54, '2', nil}, - {0x14, 0x55, '3', nil}, - {0x15, 0x56, '4', nil}, - {0x17, 0x57, '5', nil}, - {0x16, 0x58, '6', nil}, - {0x1A, 0x59, '7', nil}, - {0x1C, 0x5B, '8', nil}, - {0x19, 0x5C, '9', nil}, - }; - 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 (location == DOM_KEY_LOCATION_NUMPAD) - keyCode = table[i].macNumpadKeyCode; - else - keyCode = table[i].macKeyCode; - eventCharacter = currentCharacterString; - break; - } - } - - NSString *charactersIgnoringModifiers = eventCharacter; - - int modifierFlags = 0; - - if ([character length] == 1 && [character characterAtIndex:0] >= 'A' && [character characterAtIndex:0] <= 'Z') { - modifierFlags |= NSShiftKeyMask; - charactersIgnoringModifiers = [character lowercaseString]; - } - - modifierFlags |= buildModifierFlags(modifiers); - - if (location == DOM_KEY_LOCATION_NUMPAD) - modifierFlags |= NSNumericPadKeyMask; - - [[[mainFrame frameView] documentView] layout]; - - NSEvent *event = [NSEvent keyEventWithType:NSKeyDown - location:NSMakePoint(5, 5) - modifierFlags:modifierFlags - timestamp:[self currentEventTime] - windowNumber:[[[mainFrame webView] window] windowNumber] - context:[NSGraphicsContext currentContext] - characters:eventCharacter - charactersIgnoringModifiers:charactersIgnoringModifiers - isARepeat:NO - keyCode:keyCode]; - - [[[[mainFrame webView] window] firstResponder] keyDown:event]; - - event = [NSEvent keyEventWithType:NSKeyUp - location:NSMakePoint(5, 5) - modifierFlags:modifierFlags - timestamp:[self currentEventTime] - windowNumber:[[[mainFrame webView] window] windowNumber] - context:[NSGraphicsContext currentContext] - characters:eventCharacter - charactersIgnoringModifiers:charactersIgnoringModifiers - isARepeat:NO - keyCode:keyCode]; - - [[[[mainFrame webView] window] firstResponder] keyUp:event]; -} - -- (void)keyDownWrapper:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location -{ - [self keyDown:character withModifiers:modifiers withLocation:location]; -} - -- (void)scheduleAsynchronousKeyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers withLocation:(unsigned long)location -{ - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(keyDownWrapper:withModifiers:withLocation:)]]; - [invocation retainArguments]; - [invocation setTarget:self]; - [invocation setSelector:@selector(keyDownWrapper:withModifiers:withLocation:)]; - [invocation setArgument:&character atIndex:2]; - [invocation setArgument:&modifiers atIndex:3]; - [invocation setArgument:&location atIndex:4]; - [invocation performSelector:@selector(invoke) withObject:nil afterDelay:0]; -} - -- (void)enableDOMUIEventLogging:(WebScriptObject *)node -{ - NSEnumerator *eventEnumerator = [webkitDomEventNames objectEnumerator]; - id eventName; - while ((eventName = [eventEnumerator nextObject])) { - [(id<DOMEventTarget>)node addEventListener:eventName listener:self useCapture:NO]; - } -} - -- (void)handleEvent:(DOMEvent *)event -{ - DOMNode *target = [event target]; - - printf("event type: %s\n", [[event type] UTF8String]); - printf(" target: <%s>\n", [[[target nodeName] lowercaseString] UTF8String]); - - if ([event isKindOfClass:[DOMEvent class]]) { - printf(" eventPhase: %d\n", [event eventPhase]); - printf(" bubbles: %d\n", [event bubbles] ? 1 : 0); - printf(" cancelable: %d\n", [event cancelable] ? 1 : 0); - } - - if ([event isKindOfClass:[DOMUIEvent class]]) { - printf(" detail: %d\n", [(DOMUIEvent*)event detail]); - - DOMAbstractView *view = [(DOMUIEvent*)event view]; - if (view) { - printf(" view: OK"); - if ([view document]) - printf(" (document: OK)"); - printf("\n"); - } - } - - if ([event isKindOfClass:[DOMKeyboardEvent class]]) { - printf(" keyIdentifier: %s\n", [[(DOMKeyboardEvent*)event keyIdentifier] UTF8String]); - 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, - [(DOMKeyboardEvent*)event altKey] ? 1 : 0, - [(DOMKeyboardEvent*)event metaKey] ? 1 : 0); - printf(" keyCode: %d\n", [(DOMKeyboardEvent*)event keyCode]); - printf(" charCode: %d\n", [(DOMKeyboardEvent*)event charCode]); - } - - if ([event isKindOfClass:[DOMMouseEvent class]]) { - printf(" button: %d\n", [(DOMMouseEvent*)event button]); - printf(" clientX: %d\n", [(DOMMouseEvent*)event clientX]); - printf(" clientY: %d\n", [(DOMMouseEvent*)event clientY]); - printf(" screenX: %d\n", [(DOMMouseEvent*)event screenX]); - printf(" screenY: %d\n", [(DOMMouseEvent*)event screenY]); - printf(" modifier keys: c:%d s:%d a:%d m:%d\n", - [(DOMMouseEvent*)event ctrlKey] ? 1 : 0, - [(DOMMouseEvent*)event shiftKey] ? 1 : 0, - [(DOMMouseEvent*)event altKey] ? 1 : 0, - [(DOMMouseEvent*)event metaKey] ? 1 : 0); - id relatedTarget = [(DOMMouseEvent*)event relatedTarget]; - if (relatedTarget) { - printf(" relatedTarget: %s", [[[relatedTarget class] description] UTF8String]); - if ([relatedTarget isKindOfClass:[DOMNode class]]) - printf(" (nodeName: %s)", [[(DOMNode*)relatedTarget nodeName] UTF8String]); - printf("\n"); - } - } - - if ([event isKindOfClass:[DOMMutationEvent class]]) { - printf(" prevValue: %s\n", [[(DOMMutationEvent*)event prevValue] UTF8String]); - printf(" newValue: %s\n", [[(DOMMutationEvent*)event newValue] UTF8String]); - printf(" attrName: %s\n", [[(DOMMutationEvent*)event attrName] UTF8String]); - printf(" attrChange: %d\n", [(DOMMutationEvent*)event attrChange]); - DOMNode *relatedNode = [(DOMMutationEvent*)event relatedNode]; - if (relatedNode) { - printf(" relatedNode: %s (nodeName: %s)\n", - [[[relatedNode class] description] UTF8String], - [[relatedNode nodeName] UTF8String]); - } - } - - if ([event isKindOfClass:[DOMWheelEvent class]]) { - printf(" clientX: %d\n", [(DOMWheelEvent*)event clientX]); - printf(" clientY: %d\n", [(DOMWheelEvent*)event clientY]); - printf(" screenX: %d\n", [(DOMWheelEvent*)event screenX]); - printf(" screenY: %d\n", [(DOMWheelEvent*)event screenY]); - printf(" modifier keys: c:%d s:%d a:%d m:%d\n", - [(DOMWheelEvent*)event ctrlKey] ? 1 : 0, - [(DOMWheelEvent*)event shiftKey] ? 1 : 0, - [(DOMWheelEvent*)event altKey] ? 1 : 0, - [(DOMWheelEvent*)event metaKey] ? 1 : 0); - printf(" isHorizontal: %d\n", [(DOMWheelEvent*)event isHorizontal] ? 1 : 0); - printf(" wheelDelta: %d\n", [(DOMWheelEvent*)event wheelDelta]); - } -} - -// FIXME: It's not good to have a test hard-wired into this controller like this. -// Instead we need to get testing framework based on the Objective-C bindings -// to work well enough that we can test that way instead. -- (void)fireKeyboardEventsToElement:(WebScriptObject *)element { - - if (![element isKindOfClass:[DOMHTMLElement class]]) - return; - - DOMHTMLElement *target = (DOMHTMLElement*)element; - DOMDocument *document = [target ownerDocument]; - - // Keyboard Event 1 - - DOMEvent *domEvent = [document createEvent:@"KeyboardEvent"]; - [(DOMKeyboardEvent*)domEvent initKeyboardEvent:@"keydown" - canBubble:YES - cancelable:YES - view:[document defaultView] - keyIdentifier:@"U+000041" - location:0 - ctrlKey:YES - altKey:NO - shiftKey:NO - metaKey:NO]; - [target dispatchEvent:domEvent]; - - // Keyboard Event 2 - - domEvent = [document createEvent:@"KeyboardEvent"]; - [(DOMKeyboardEvent*)domEvent initKeyboardEvent:@"keypress" - canBubble:YES - cancelable:YES - view:[document defaultView] - keyIdentifier:@"U+000045" - location:1 - ctrlKey:NO - altKey:YES - shiftKey:NO - metaKey:NO]; - [target dispatchEvent:domEvent]; - - // Keyboard Event 3 - - domEvent = [document createEvent:@"KeyboardEvent"]; - [(DOMKeyboardEvent*)domEvent initKeyboardEvent:@"keyup" - canBubble:YES - cancelable:YES - view:[document defaultView] - keyIdentifier:@"U+000056" - location:0 - ctrlKey:NO - altKey:NO - shiftKey:NO - metaKey:NO]; - [target dispatchEvent:domEvent]; - -} - -@end diff --git a/Tools/DumpRenderTree/mac/FrameLoadDelegate.h b/Tools/DumpRenderTree/mac/FrameLoadDelegate.h deleted file mode 100644 index 390a88184..000000000 --- a/Tools/DumpRenderTree/mac/FrameLoadDelegate.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#import <Foundation/Foundation.h> - -class AccessibilityController; -class GCController; - -@interface FrameLoadDelegate : NSObject -{ - AccessibilityController* accessibilityController; - GCController* gcController; -} - -- (void)resetToConsistentState; - -@end diff --git a/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm b/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm deleted file mode 100644 index 21be9227f..000000000 --- a/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#import "config.h" -#import "DumpRenderTree.h" -#import "FrameLoadDelegate.h" - -#import "AccessibilityController.h" -#import "AppleScriptController.h" -#import "EventSendingController.h" -#import "Foundation/NSNotification.h" -#import "GCController.h" -#import "TestRunner.h" -#import "NavigationController.h" -#import "ObjCController.h" -#import "ObjCPlugin.h" -#import "ObjCPluginFunction.h" -#import "TextInputController.h" -#import "WebCoreTestSupport.h" -#import "WorkQueue.h" -#import "WorkQueueItem.h" -#import <JavaScriptCore/JavaScriptCore.h> -#import <WebKitSystemInterface.h> -#import <WebKit/WebFramePrivate.h> -#import <WebKit/WebHTMLViewPrivate.h> -#import <WebKit/WebKit.h> -#import <WebKit/WebNSURLExtras.h> -#import <WebKit/WebScriptWorld.h> -#import <WebKit/WebSecurityOriginPrivate.h> -#import <WebKit/WebViewPrivate.h> -#import <wtf/Assertions.h> - -#ifndef NSEC_PER_MSEC -#define NSEC_PER_MSEC 1000000ull -#endif - -@interface NSURL (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSError (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSURLResponse (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSURLRequest (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface WebFrame (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@implementation WebFrame (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult -{ - BOOL isMainFrame = (self == [[self webView] mainFrame]); - NSString *name = [self name]; - if (isMainFrame) { - if ([name length]) - return [NSString stringWithFormat:@"main frame \"%@\"", name]; - else - return @"main frame"; - } else { - if (name) - return [NSString stringWithFormat:@"frame \"%@\"", name]; - else - return @"frame (anonymous)"; - } -} - -- (NSString *)_drt_printFrameUserGestureStatus -{ - BOOL isUserGesture = [[self webView] _isProcessingUserGesture]; - return [NSString stringWithFormat:@"Frame with user gesture \"%@\"", isUserGesture ? @"true" : @"false"]; -} -@end - -@implementation FrameLoadDelegate - -- (id)init -{ - if ((self = [super init])) { - gcController = new GCController; - accessibilityController = new AccessibilityController; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressFinishedNotification:) name:WebViewProgressFinishedNotification object:nil]; - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - delete gcController; - delete accessibilityController; - [super dealloc]; -} - -// Exec messages in the work queue until they're all done, or one of them starts a new load -- (void)processWork:(id)dummy -{ - // if another load started, then wait for it to complete. - if (topLoadingFrame) - return; - - // if we finish all the commands, we're ready to dump state - if (WorkQueue::shared()->processWork() && !gTestRunner->waitToDump()) - dump(); -} - -- (void)resetToConsistentState -{ - accessibilityController->resetToConsistentState(); -} - -- (void)webView:(WebView *)c locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource -{ - if ([dataSource webFrame] == topLoadingFrame) { - topLoadingFrame = nil; - WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test - if (!gTestRunner->waitToDump()) { - if (WorkQueue::shared()->count()) - [self performSelector:@selector(processWork:) withObject:nil afterDelay:0]; - else - dump(); - } - } -} - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -static NSString *testPathFromURL(NSURL* url) -{ - if ([url isFileURL]) { - NSString *filePath = [url path]; - NSRange layoutTestsRange = [filePath rangeOfString:@"/LayoutTests/"]; - if (layoutTestsRange.location == NSNotFound) - return nil; - - return [filePath substringFromIndex:NSMaxRange(layoutTestsRange)]; - } - - // HTTP test URLs look like: http://127.0.0.1:8000/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html - if (![[url scheme] isEqualToString:@"http"] && ![[url scheme] isEqualToString:@"https"]) - return nil; - - if ([[url host] isEqualToString:@"127.0.0.1"] && ([[url port] intValue] == 8000 || [[url port] intValue] == 8443)) - return [url path]; - - return nil; -} -#endif - -- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame -{ - ASSERT([frame provisionalDataSource]); - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - if (!done && [[sender mainFrame] isEqual:frame]) { - NSURL *provisionalLoadURL = [[[frame provisionalDataSource] initialRequest] URL]; - if (NSString *testPath = testPathFromURL(provisionalLoadURL)) - WKSetCrashReportApplicationSpecificInformation((CFStringRef)[@"CRASHING TEST: " stringByAppendingString:testPath]); - } -#endif - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didStartProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } - - if (!done && gTestRunner->dumpUserGestureInFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - in didStartProvisionalLoadForFrame", [frame _drt_printFrameUserGestureStatus]]; - printf ("%s\n", [string UTF8String]); - } - - // Make sure we only set this once per test. If it gets cleared, and then set again, we might - // end up doing two dumps for one test. - if (!topLoadingFrame && !done) - topLoadingFrame = frame; - - if (!done && gTestRunner->stopProvisionalFrameLoads()) { - NSString *string = [NSString stringWithFormat:@"%@ - stopping load in didStartProvisionalLoadForFrame callback", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - [frame stopLoading]; - } - - if (!done && gTestRunner->useDeferredFrameLoading()) { - [sender setDefersCallbacks:YES]; - int64_t deferredWaitTime = 5 * NSEC_PER_MSEC; - dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, deferredWaitTime); - dispatch_after(when, dispatch_get_main_queue(), ^{ - [sender setDefersCallbacks:NO]; - }); - } -} - -- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didCommitLoadForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } - - ASSERT(![frame provisionalDataSource]); - ASSERT([frame dataSource]); - - gTestRunner->setWindowIsKey(true); - NSView *documentView = [[mainFrame frameView] documentView]; - [[[mainFrame webView] window] makeFirstResponder:documentView]; -} - -- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFailProvisionalLoadWithError", [frame _drt_descriptionSuitableForTestResult]]; - printf("%s\n", [string UTF8String]); - } - - if ([error domain] == NSURLErrorDomain && ([error code] == NSURLErrorServerCertificateHasUnknownRoot || [error code] == NSURLErrorServerCertificateUntrusted)) { - // <http://webkit.org/b/31200> In order to prevent extra frame load delegate logging being generated if the first test to use SSL - // is set to log frame load delegate calls we ignore SSL certificate errors on localhost and 127.0.0.1 from within dumpRenderTree. - // Those are the only hosts that we use SSL with at present. If we hit this code path then we've found another host that we need - // to apply the workaround to. - ASSERT_NOT_REACHED(); - return; - } - - ASSERT([frame provisionalDataSource]); - [self webView:sender locationChangeDone:error forDataSource:[frame provisionalDataSource]]; -} - -- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame -{ - ASSERT([frame dataSource]); - ASSERT(frame == [[frame dataSource] webFrame]); - - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoadForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } - - // FIXME: This call to displayIfNeeded can be removed when <rdar://problem/5092361> is fixed. - // After that is fixed, we will reenable painting after WebCore is done loading the document, - // and this call will no longer be needed. - if ([[sender mainFrame] isEqual:frame]) - [sender displayIfNeeded]; - [self webView:sender locationChangeDone:nil forDataSource:[frame dataSource]]; - [gNavigationController webView:sender didFinishLoadForFrame:frame]; -} - -- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadWithError", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } - - ASSERT(![frame provisionalDataSource]); - ASSERT([frame dataSource]); - - [self webView:sender locationChangeDone:error forDataSource:[frame dataSource]]; -} - -- (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"?? - windowScriptObjectAvailable"]; - printf ("%s\n", [string UTF8String]); - } - - ASSERT_NOT_REACHED(); -} - -- (void)didClearWindowObjectInStandardWorldForFrame:(WebFrame *)frame -{ - // Make New-Style TestRunner - JSContextRef context = [frame globalContext]; - JSObjectRef globalObject = JSContextGetGlobalObject(context); - JSValueRef exception = 0; - - ASSERT(gTestRunner); - gTestRunner->makeWindowObject(context, globalObject, &exception); - ASSERT(!exception); - - gcController->makeWindowObject(context, globalObject, &exception); - ASSERT(!exception); - - accessibilityController->makeWindowObject(context, globalObject, &exception); - ASSERT(!exception); - - WebCoreTestSupport::injectInternalsObject(context); - - // Make Old-Style controllers - - WebView *webView = [frame webView]; - WebScriptObject *obj = [frame windowObject]; - AppleScriptController *asc = [[AppleScriptController alloc] initWithWebView:webView]; - [obj setValue:asc forKey:@"appleScriptController"]; - [asc release]; - - EventSendingController *esc = [[EventSendingController alloc] init]; - [obj setValue:esc forKey:@"eventSender"]; - [esc release]; - - [obj setValue:gNavigationController forKey:@"navigationController"]; - - ObjCController *occ = [[ObjCController alloc] init]; - [obj setValue:occ forKey:@"objCController"]; - [occ release]; - - ObjCPlugin *plugin = [[ObjCPlugin alloc] init]; - [obj setValue:plugin forKey:@"objCPlugin"]; - [plugin release]; - - ObjCPluginFunction *pluginFunction = [[ObjCPluginFunction alloc] init]; - [obj setValue:pluginFunction forKey:@"objCPluginFunction"]; - [pluginFunction release]; - - TextInputController *tic = [[TextInputController alloc] initWithWebView:webView]; - [obj setValue:tic forKey:@"textInputController"]; - [tic release]; -} - -- (void)didClearWindowObjectForFrame:(WebFrame *)frame inIsolatedWorld:(WebScriptWorld *)world -{ - JSGlobalContextRef ctx = [frame _globalContextForScriptWorld:world]; - if (!ctx) - return; - - JSObjectRef globalObject = JSContextGetGlobalObject(ctx); - if (!globalObject) - return; - - JSObjectSetProperty(ctx, globalObject, JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString("__worldID")).get(), JSValueMakeNumber(ctx, worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0); -} - -- (void)webView:(WebView *)sender didClearWindowObjectForFrame:(WebFrame *)frame inScriptWorld:(WebScriptWorld *)world -{ - if (world == [WebScriptWorld standardWorld]) - [self didClearWindowObjectInStandardWorldForFrame:frame]; - else - [self didClearWindowObjectForFrame:frame inIsolatedWorld:world]; -} - -- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didReceiveTitle: %@", [frame _drt_descriptionSuitableForTestResult], title]; - printf ("%s\n", [string UTF8String]); - } - - if (gTestRunner->dumpTitleChanges()) - printf("TITLE CHANGED: '%s'\n", [title UTF8String]); -} - -- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didReceiveServerRedirectForProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } -} - -- (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didChangeLocationWithinPageForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } -} - -- (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - willPerformClientRedirectToURL: %@ ", [frame _drt_descriptionSuitableForTestResult], [URL _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } - - if (!done && gTestRunner->dumpUserGestureInFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - in willPerformClientRedirect", [frame _drt_printFrameUserGestureStatus]]; - printf ("%s\n", [string UTF8String]); - } -} - -- (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didCancelClientRedirectForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } -} - -- (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFinishDocumentLoadForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } else if (!done) { - unsigned pendingFrameUnloadEvents = [frame _pendingFrameUnloadEventCount]; - if (pendingFrameUnloadEvents) { - NSString *string = [NSString stringWithFormat:@"%@ - has %u onunload handler(s)", [frame _drt_descriptionSuitableForTestResult], pendingFrameUnloadEvents]; - printf ("%s\n", [string UTF8String]); - } - } -} - -- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didHandleOnloadEventsForFrame", [frame _drt_descriptionSuitableForTestResult]]; - printf ("%s\n", [string UTF8String]); - } -} - -- (void)webViewDidDisplayInsecureContent:(WebView *)sender -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf ("didDisplayInsecureContent\n"); -} - -- (void)webView:(WebView *)sender didRunInsecureContent:(WebSecurityOrigin *)origin -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf ("didRunInsecureContent\n"); -} - -- (void)webView:(WebView *)sender didDetectXSS:(NSURL *)insecureURL -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf ("didDetectXSS\n"); -} - -- (void)webViewProgressFinishedNotification:(NSNotification *)notification -{ - if (!done && gTestRunner->dumpProgressFinishedCallback()) - printf ("postProgressFinishedNotification\n"); -} - -@end diff --git a/Tools/DumpRenderTree/mac/GCControllerMac.mm b/Tools/DumpRenderTree/mac/GCControllerMac.mm deleted file mode 100644 index de8a61e59..000000000 --- a/Tools/DumpRenderTree/mac/GCControllerMac.mm +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.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. - */ - -#import "config.h" -#import "GCController.h" - -#import <WebKit/WebCoreStatistics.h> - - -void GCController::collect() const -{ - [WebCoreStatistics garbageCollectJavaScriptObjects]; -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - [WebCoreStatistics garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging:waitUntilDone]; -} - -size_t GCController::getJSObjectCount() const -{ - return [WebCoreStatistics javaScriptObjectsCount]; -} diff --git a/Tools/DumpRenderTree/mac/HistoryDelegate.h b/Tools/DumpRenderTree/mac/HistoryDelegate.h deleted file mode 100644 index c56d20368..000000000 --- a/Tools/DumpRenderTree/mac/HistoryDelegate.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 <Cocoa/Cocoa.h> - -@interface HistoryDelegate : NSObject -{ -} - -@end diff --git a/Tools/DumpRenderTree/mac/HistoryDelegate.mm b/Tools/DumpRenderTree/mac/HistoryDelegate.mm deleted file mode 100644 index 4c703f90a..000000000 --- a/Tools/DumpRenderTree/mac/HistoryDelegate.mm +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 "HistoryDelegate.h" - -#import "DumpRenderTree.h" -#import "TestRunner.h" - -#import <WebKit/WebNavigationData.h> -#import <WebKit/WebView.h> - -@interface NSURL (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@implementation HistoryDelegate - -- (void)webView:(WebView *)webView didNavigateWithNavigationData:(WebNavigationData *)navigationData inFrame:(WebFrame *)webFrame -{ - NSURL *url = [navigationData url] ? [NSURL URLWithString:[navigationData url]] : nil; - bool hasClientRedirect = [[navigationData clientRedirectSource] length]; - NSHTTPURLResponse *httpResponse = [[navigationData response] isKindOfClass:[NSHTTPURLResponse class]] ? (NSHTTPURLResponse *)[navigationData response] : nil; - bool wasFailure = [navigationData hasSubstituteData] || (httpResponse && [httpResponse statusCode] >= 400); - - printf("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was %s and was %s%s.\n", - url ? [[url _drt_descriptionSuitableForTestResult] UTF8String] : "<none>", - [navigationData title] ? [[navigationData title] UTF8String] : "", - [navigationData originalRequest] ? [[[navigationData originalRequest] HTTPMethod] UTF8String] : "", - wasFailure ? "a failure" : "successful", - hasClientRedirect ? "a client redirect from " : "not a client redirect", - hasClientRedirect ? [[navigationData clientRedirectSource] UTF8String] : ""); -} - -- (void)webView:(WebView *)webView didPerformClientRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame -{ - NSURL *source = [NSURL URLWithString:sourceURL]; - NSURL *dest = [NSURL URLWithString:destinationURL]; - printf("WebView performed a client redirect from \"%s\" to \"%s\".\n", [[source _drt_descriptionSuitableForTestResult] UTF8String], [[dest _drt_descriptionSuitableForTestResult] UTF8String]); -} - -- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame -{ - NSURL *source = [NSURL URLWithString:sourceURL]; - NSURL *dest = [NSURL URLWithString:destinationURL]; - printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", [[source _drt_descriptionSuitableForTestResult] UTF8String], [[dest _drt_descriptionSuitableForTestResult] UTF8String]); -} - -- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url -{ - printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", [[[NSURL URLWithString:url]_drt_descriptionSuitableForTestResult] UTF8String], [title UTF8String]); -} - -- (void)populateVisitedLinksForWebView:(WebView *)webView -{ - if (gTestRunner->dumpVisitedLinksCallback()) - printf("Asked to populate visited links for WebView \"%s\"\n", [[[NSURL URLWithString:[webView mainFrameURL]] _drt_descriptionSuitableForTestResult] UTF8String]); -} - -@end diff --git a/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h b/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h deleted file mode 100644 index ae1371fc6..000000000 --- a/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../../../Source/WebKit/mac/Misc/WebTypesInternal.h" diff --git a/Tools/DumpRenderTree/mac/LayoutTestHelper.m b/Tools/DumpRenderTree/mac/LayoutTestHelper.m deleted file mode 100644 index ee7bd713b..000000000 --- a/Tools/DumpRenderTree/mac/LayoutTestHelper.m +++ /dev/null @@ -1,211 +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> -#import <ApplicationServices/ApplicationServices.h> -#import <signal.h> -#import <stdio.h> -#import <stdlib.h> - -// This is a simple helper app that changes the color profile of the main display -// to GenericRGB 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. - -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - -static CFURLRef sUserColorProfileURL; - -static 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); -} - -static 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. - -static 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. - - 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. Many pixel tests may fail as a result. 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 GenericRGB color profile. Many pixel tests may fail as a result. Error: %d", (int)error); - initialColorProfileLocation.locType = cmNoProfileBase; - } -} - -static 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 - -static void simpleSignalHandler(int sig) -{ - // Try to restore the color profile and try to go down cleanly - restoreUserColorProfile(); - exit(128 + sig); -} - -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/mac/MockGeolocationProvider.h b/Tools/DumpRenderTree/mac/MockGeolocationProvider.h deleted file mode 100644 index ba3a842a9..000000000 --- a/Tools/DumpRenderTree/mac/MockGeolocationProvider.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010, 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. - * - * 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. - */ - -#ifndef MockGeolocationProvider_h -#define MockGeolocationProvider_h - -#import <WebKit/WebViewPrivate.h> -#import <wtf/HashSet.h> -#import <wtf/RetainPtr.h> - -@interface MockGeolocationProvider : NSObject<WebGeolocationProvider> { - RetainPtr<WebGeolocationPosition> _lastPosition; - BOOL _hasError; - RetainPtr<NSString> _errorMessage; - NSTimer *_timer; - HashSet<WebView *> _registeredViews; -} - -+ (MockGeolocationProvider *)shared; - -- (void)setPosition:(WebGeolocationPosition *)position; -- (void)setPositionUnavailableErrorWithMessage:(NSString *)errorMessage; - -- (void)stopTimer; - -@end -#endif diff --git a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm b/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm deleted file mode 100644 index 4acaac04b..000000000 --- a/Tools/DumpRenderTree/mac/MockGeolocationProvider.mm +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2010, 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. - * - * 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 "MockGeolocationProvider.h" - -@implementation MockGeolocationProvider - -+ (MockGeolocationProvider *)shared -{ - static MockGeolocationProvider *provider = [[MockGeolocationProvider alloc] init]; - return provider; -} - -- (void)dealloc -{ - ASSERT(_registeredViews.isEmpty()); - - _lastPosition.clear(); - _errorMessage.clear(); - [super dealloc]; -} - -- (void)resetError -{ - _hasError = NO; - _errorMessage.clear(); -} - -- (void)setPosition:(WebGeolocationPosition *)position -{ - _lastPosition = position; - - [self resetError]; - - if (!_timer) - _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; -} - -- (void)setPositionUnavailableErrorWithMessage:(NSString *)errorMessage -{ - _hasError = YES; - _errorMessage = errorMessage; - - _lastPosition.clear(); - - if (!_timer) - _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; -} - -- (void)registerWebView:(WebView *)webView -{ - _registeredViews.add(webView); - - if (!_timer) - _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; -} - -- (void)unregisterWebView:(WebView *)webView -{ - _registeredViews.remove(webView); -} - -- (WebGeolocationPosition *)lastPosition -{ - return _lastPosition.get(); -} - -- (void)stopTimer -{ - [_timer invalidate]; - _timer = 0; -} - -- (void)timerFired -{ - _timer = 0; - - // Expect that views won't be (un)registered while iterating. - HashSet<WebView*> views = _registeredViews; - for (HashSet<WebView*>::iterator iter = views.begin(); iter != views.end(); ++iter) { - if (_hasError) - [*iter _geolocationDidFailWithMessage:_errorMessage.get()]; - else - [*iter _geolocationDidChangePosition:_lastPosition.get()]; - } -} - -@end diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h deleted file mode 100644 index 293ea49d0..000000000 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#ifndef MockWebNotificationProvider_h -#define MockWebNotificationProvider_h - -#import <WebKit/WebNotification.h> -#import <WebKit/WebViewPrivate.h> -#import <wtf/HashMap.h> -#import <wtf/HashSet.h> -#import <wtf/RetainPtr.h> - -typedef HashMap<uint64_t, RetainPtr<WebNotification> > NotificationIDMap; -typedef HashMap<uint64_t, WebView *> NotificationViewMap; - -@interface MockWebNotificationProvider : NSObject <WebNotificationProvider> { - HashSet<WebView *> _registeredWebViews; - NotificationIDMap _notifications; - NotificationViewMap _notificationViewMap; - RetainPtr<NSMutableDictionary> _permissions; -} - -+ (MockWebNotificationProvider *)shared; - -- (void)simulateWebNotificationClick:(uint64_t)notificationID; -- (void)setWebNotificationOrigin:(NSString *)origin permission:(BOOL)allowed; -- (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin; -- (void)removeAllWebNotificationPermissions; - -- (void)reset; -@end - -#endif // MockWebNotificationProvider_h diff --git a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm b/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm deleted file mode 100644 index adf5d9e31..000000000 --- a/Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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. - */ - -#import "config.h" -#import "MockWebNotificationProvider.h" - -#import <WebKit/WebSecurityOriginPrivate.h> - -@implementation MockWebNotificationProvider - -+ (MockWebNotificationProvider *)shared -{ - static MockWebNotificationProvider *provider = [[MockWebNotificationProvider alloc] init]; - return provider; -} - -- (id)init -{ - if (!(self = [super init])) - return nil; - _permissions = adoptNS([[NSMutableDictionary alloc] init]); - return self; -} - -- (void)registerWebView:(WebView *)webView -{ - ASSERT(!_registeredWebViews.contains(webView)); - _registeredWebViews.add(webView); -} - -- (void)unregisterWebView:(WebView *)webView -{ - ASSERT(_registeredWebViews.contains(webView)); - _registeredWebViews.remove(webView); -} - -- (void)showNotification:(WebNotification *)notification fromWebView:(WebView *)webView -{ - ASSERT(_registeredWebViews.contains(webView)); - - uint64_t notificationID = [notification notificationID]; - _notifications.add(notificationID, notification); - _notificationViewMap.add(notificationID, webView); - - [webView _notificationDidShow:notificationID]; -} - -- (void)cancelNotification:(WebNotification *)notification -{ - uint64_t notificationID = [notification notificationID]; - ASSERT(_notifications.contains(notificationID)); - - [_notificationViewMap.get(notificationID) _notificationsDidClose:[NSArray arrayWithObject:[NSNumber numberWithUnsignedLongLong:notificationID]]]; -} - -- (void)notificationDestroyed:(WebNotification *)notification -{ - _notifications.remove([notification notificationID]); - _notificationViewMap.remove([notification notificationID]); -} - -- (void)clearNotifications:(NSArray *)notificationIDs -{ - for (NSNumber *notificationID in notificationIDs) { - uint64_t id = [notificationID unsignedLongLongValue]; - RetainPtr<WebNotification> notification = _notifications.take(id); - _notificationViewMap.remove(id); - } -} - -- (void)webView:(WebView *)webView didShowNotification:(uint64_t)notificationID -{ - [_notifications.get(notificationID).get() dispatchShowEvent]; -} - -- (void)webView:(WebView *)webView didClickNotification:(uint64_t)notificationID -{ - [_notifications.get(notificationID).get() dispatchClickEvent]; -} - -- (void)webView:(WebView *)webView didCloseNotifications:(NSArray *)notificationIDs -{ - for (NSNumber *notificationID in notificationIDs) { - uint64_t id = [notificationID unsignedLongLongValue]; - NotificationIDMap::iterator it = _notifications.find(id); - ASSERT(it != _notifications.end()); - [it->value.get() dispatchCloseEvent]; - _notifications.remove(it); - _notificationViewMap.remove(id); - } -} - -- (void)simulateWebNotificationClick:(uint64_t)notificationID -{ - ASSERT(_notifications.contains(notificationID)); - [_notificationViewMap.get(notificationID) _notificationDidClick:notificationID]; -} - -- (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin -{ - NSNumber *permission = [_permissions.get() objectForKey:[origin stringValue]]; - if (!permission) - return WebNotificationPermissionNotAllowed; - if ([permission boolValue]) - return WebNotificationPermissionAllowed; - return WebNotificationPermissionDenied; -} - -- (void)setWebNotificationOrigin:(NSString *)origin permission:(BOOL)allowed -{ - [_permissions.get() setObject:[NSNumber numberWithBool:allowed] forKey:origin]; -} - -- (void)removeAllWebNotificationPermissions -{ - [_permissions.get() removeAllObjects]; -} - -- (void)reset -{ - _notifications.clear(); - _notificationViewMap.clear(); - [self removeAllWebNotificationPermissions]; -} - -@end diff --git a/Tools/DumpRenderTree/mac/NavigationController.h b/Tools/DumpRenderTree/mac/NavigationController.h deleted file mode 100644 index 8ee3432d9..000000000 --- a/Tools/DumpRenderTree/mac/NavigationController.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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. - */ - -#import <Cocoa/Cocoa.h> -#import <WebKit/WebView.h> - -@interface NavigationController : NSObject -{ - enum { None, Load, GoBack, ExecuteScript } pendingAction; - NSString *pendingScript; - NSURLRequest *pendingRequest; -} -- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame; -@end diff --git a/Tools/DumpRenderTree/mac/NavigationController.m b/Tools/DumpRenderTree/mac/NavigationController.m deleted file mode 100644 index 8c01d507b..000000000 --- a/Tools/DumpRenderTree/mac/NavigationController.m +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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. - */ - -#import "config.h" -#import "NavigationController.h" - -#import <WebKit/WebFrame.h> -#import <WebKit/WebScriptObject.h> - - -@implementation NavigationController -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector -{ - if (selector == @selector(evaluateWebScript:afterBackForwardNavigation:)) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)selector -{ - if (selector == @selector(evaluateWebScript:afterBackForwardNavigation:)) - return @"evalAfterBackForwardNavigation"; - return nil; -} - -- (void)setPendingScript:(NSString *)script -{ - if (script != pendingScript) { - [pendingScript release]; - pendingScript = [script copy]; - } -} - -- (void)setPendingRequest:(NSURLRequest *)request -{ - if (request != pendingRequest) { - [pendingRequest release]; - pendingRequest = [request copy]; - } -} - -- (void)evaluateWebScript:(NSString *)script afterBackForwardNavigation:(NSString *)navigation -{ - // Allow both arguments to be optional - if (![script isKindOfClass:[NSString class]]) - script = @""; - if (![navigation isKindOfClass:[NSString class]]) - navigation = @"about:blank"; - - [self setPendingScript:script]; - [self setPendingRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:navigation]]]; - pendingAction = Load; -} - -- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame -{ - if (frame == [[frame webView] mainFrame]) { - switch (pendingAction) { - case Load: - pendingAction = GoBack; - [frame loadRequest:pendingRequest]; - [self setPendingRequest:nil]; - break; - case GoBack: - pendingAction = ExecuteScript; - [[frame webView] goBack]; - break; - case ExecuteScript: - pendingAction = None; - [[[frame webView] windowScriptObject] evaluateWebScript:pendingScript]; - [self setPendingScript:nil]; - break; - case None: - default: - break; - } - } -} - -- (void)dealloc -{ - [self setPendingScript:nil]; - [self setPendingRequest:nil]; - [super dealloc]; -} -@end - diff --git a/Tools/DumpRenderTree/mac/ObjCController.h b/Tools/DumpRenderTree/mac/ObjCController.h deleted file mode 100644 index d1d001cc5..000000000 --- a/Tools/DumpRenderTree/mac/ObjCController.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#import <Foundation/Foundation.h> - -@class WebScriptObject; - -// This controller should be used to test Objective-C language features and the WebScriptObject. -@interface ObjCController : NSObject -{ - WebScriptObject *storedWebScriptObject; -} -@end diff --git a/Tools/DumpRenderTree/mac/ObjCController.m b/Tools/DumpRenderTree/mac/ObjCController.m deleted file mode 100644 index af237bf69..000000000 --- a/Tools/DumpRenderTree/mac/ObjCController.m +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#import "config.h" -#import "ObjCController.h" - -// Avoid compile error in DOMPrivate.h. -@class NSFont; - -#import <JavaScriptCore/JavaScriptCore.h> -#import <WebKit/DOMAbstractView.h> -#import <WebKit/DOMPrivate.h> -#import <WebKit/WebScriptObject.h> -#import <WebKit/WebView.h> -#import <pthread.h> -#import <wtf/Assertions.h> - -// Remove this once hasWebScriptKey has been made public. -@interface WebScriptObject (StagedForPublic) -- (BOOL)hasWebScriptKey:(NSString *)name; -@end - -static void* runJavaScriptThread(void* arg) -{ - JSGlobalContextRef ctx = JSGlobalContextCreate(0); - JSStringRef scriptRef = JSStringCreateWithUTF8CString("'Hello World!'"); - - JSValueRef exception = 0; - JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); - ASSERT(!exception); - - JSGlobalContextRelease(ctx); - JSStringRelease(scriptRef); - - return 0; -} - -@implementation ObjCController - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (0 - || aSelector == @selector(classNameOf:) - || aSelector == @selector(isObject:instanceOf:) - || aSelector == @selector(objectOfClass:) - || aSelector == @selector(arrayOfString) - || aSelector == @selector(identityIsEqual::) - || aSelector == @selector(longLongRoundTrip:) - || aSelector == @selector(unsignedLongLongRoundTrip:) - || aSelector == @selector(testWrapperRoundTripping:) - || aSelector == @selector(accessStoredWebScriptObject) - || aSelector == @selector(storeWebScriptObject:) - || aSelector == @selector(testValueForKey) - || aSelector == @selector(testHasWebScriptKey:) - || aSelector == @selector(testArray) - || aSelector == @selector(setSelectElement:selectedIndex:allowingMultiple:) - ) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(classNameOf:)) - return @"className"; - if (aSelector == @selector(isObject:instanceOf:)) - return @"isObjectInstanceOf"; - if (aSelector == @selector(objectOfClass:)) - return @"objectOfClass"; - if (aSelector == @selector(arrayOfString)) - return @"arrayOfString"; - if (aSelector == @selector(identityIsEqual::)) - return @"identityIsEqual"; - if (aSelector == @selector(longLongRoundTrip:)) - return @"longLongRoundTrip"; - if (aSelector == @selector(unsignedLongLongRoundTrip:)) - return @"unsignedLongLongRoundTrip"; - if (aSelector == @selector(testWrapperRoundTripping:)) - return @"testWrapperRoundTripping"; - if (aSelector == @selector(storeWebScriptObject:)) - return @"storeWebScriptObject"; - if (aSelector == @selector(testValueForKey)) - return @"testValueForKey"; - if (aSelector == @selector(testHasWebScriptKey:)) - return @"testHasWebScriptKey"; - if (aSelector == @selector(testArray)) - return @"testArray"; - if (aSelector == @selector(setSelectElement:selectedIndex:allowingMultiple:)) - return @"setSelectElementSelectedIndexAllowingMultiple"; - - return nil; -} - -- (BOOL)isObject:(id)object instanceOf:(NSString *)aClass -{ - if (!object) - return [aClass isEqualToString:@"nil"]; - - return [object isKindOfClass:NSClassFromString(aClass)]; -} - -- (NSString *)classNameOf:(id)object -{ - if (!object) - return @"nil"; - return NSStringFromClass([object class]); -} - -- (id)objectOfClass:(NSString *)aClass -{ - if ([aClass isEqualToString:@"NSNull"]) - return [NSNull null]; - if ([aClass isEqualToString:@"WebUndefined"]) - return [WebUndefined undefined]; - if ([aClass isEqualToString:@"NSCFBoolean"]) - return [NSNumber numberWithBool:true]; - if ([aClass isEqualToString:@"NSCFNumber"]) - return [NSNumber numberWithInt:1]; - if ([aClass isEqualToString:@"NSCFString"]) - return @""; - if ([aClass isEqualToString:@"WebScriptObject"]) - return self; - if ([aClass isEqualToString:@"NSArray"]) - return [NSArray array]; - - return nil; -} - -- (NSArray *)arrayOfString -{ - NSString *strings[3]; - strings[0] = @"one"; - strings[1] = @"two"; - strings[2] = @"three"; - NSArray *array = [NSArray arrayWithObjects:strings count:3]; - return array; -} - -- (BOOL)identityIsEqual:(WebScriptObject *)a :(WebScriptObject *)b -{ - if ([a isKindOfClass:[NSString class]] && [b isKindOfClass:[NSString class]]) - return [(NSString *)a isEqualToString:(NSString *)b]; - return a == b; -} - -- (long long)longLongRoundTrip:(long long)num -{ - return num; -} - -- (unsigned long long)unsignedLongLongRoundTrip:(unsigned long long)num -{ - return num; -} - -- (void)testValueForKey -{ - ASSERT(storedWebScriptObject); - - @try { - [storedWebScriptObject valueForKey:@"ThisKeyDoesNotExist"]; - } @catch (NSException *e) { - } - - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_join(pthread, 0); -} - -- (BOOL)testHasWebScriptKey:(NSString *)key -{ - ASSERT(storedWebScriptObject); - return [storedWebScriptObject hasWebScriptKey:key]; -} - -- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject -{ - JSObjectRef jsObject = [webScriptObject JSObject]; - - if (!jsObject) - return false; - - if (!webScriptObject) - return false; - - if ([[webScriptObject evaluateWebScript:@"({ })"] class] != [webScriptObject class]) - return false; - - [webScriptObject setValue:[NSNumber numberWithInt:666] forKey:@"key"]; - if (![[webScriptObject valueForKey:@"key"] isKindOfClass:[NSNumber class]] || - ![[webScriptObject valueForKey:@"key"] isEqualToNumber:[NSNumber numberWithInt:666]]) - return false; - - [webScriptObject removeWebScriptKey:@"key"]; - @try { - if ([webScriptObject valueForKey:@"key"]) - return false; - } @catch(NSException *exception) { - // NSObject throws an exception if the key doesn't exist. - } - - [webScriptObject setWebScriptValueAtIndex:0 value:webScriptObject]; - if ([webScriptObject webScriptValueAtIndex:0] != webScriptObject) - return false; - - if ([[webScriptObject stringRepresentation] isEqualToString:@"[Object object]"]) - return false; - - if ([webScriptObject callWebScriptMethod:@"returnThis" withArguments:nil] != webScriptObject) - return false; - - return true; -} - -- (void)accessStoredWebScriptObject -{ -#if !ASSERT_DISABLED - BOOL isWindowObject = [storedWebScriptObject isKindOfClass:[DOMAbstractView class]]; - JSObjectRef jsObject = [storedWebScriptObject JSObject]; - ASSERT((jsObject && isWindowObject) || (!jsObject && !isWindowObject)); -#endif - [storedWebScriptObject callWebScriptMethod:@"" withArguments:nil]; - [storedWebScriptObject evaluateWebScript:@""]; - [storedWebScriptObject setValue:[WebUndefined undefined] forKey:@"key"]; - [storedWebScriptObject valueForKey:@"key"]; - [storedWebScriptObject removeWebScriptKey:@"key"]; - [storedWebScriptObject stringRepresentation]; - [storedWebScriptObject webScriptValueAtIndex:0]; - [storedWebScriptObject setWebScriptValueAtIndex:0 value:[WebUndefined undefined]]; - [storedWebScriptObject setException:@"exception"]; -} - -- (void)storeWebScriptObject:(WebScriptObject *)webScriptObject -{ - if (webScriptObject == storedWebScriptObject) - return; - - [storedWebScriptObject release]; - storedWebScriptObject = [webScriptObject retain]; -} - -- (NSArray *)testArray -{ - return [NSArray array]; -} - -- (void)dealloc -{ - [storedWebScriptObject release]; - [super dealloc]; -} - -- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args -{ - // FIXME: Perhaps we should log that this has been called. - return nil; -} - -// MARK: - -// MARK: Testing Objective-C DOM HTML Bindings - -- (void)setSelectElement:(WebScriptObject *)element selectedIndex:(int)index allowingMultiple:(BOOL)allowingMultiple -{ - if (![element isKindOfClass:[DOMHTMLSelectElement class]]) - return; - - DOMHTMLSelectElement *select = (DOMHTMLSelectElement*)element; - [select _activateItemAtIndex:index allowMultipleSelection:allowingMultiple]; -} - -@end diff --git a/Tools/DumpRenderTree/mac/ObjCPlugin.h b/Tools/DumpRenderTree/mac/ObjCPlugin.h deleted file mode 100644 index a6d3e50c1..000000000 --- a/Tools/DumpRenderTree/mac/ObjCPlugin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, 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 THE AUTHOR ``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 AUTHOR 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 <Cocoa/Cocoa.h> - - -@interface ObjCPlugin : NSObject -{ - BOOL throwOnDealloc; -} - -- (void)removeBridgeRestrictions:(id)container; - -@end diff --git a/Tools/DumpRenderTree/mac/ObjCPlugin.m b/Tools/DumpRenderTree/mac/ObjCPlugin.m deleted file mode 100644 index ffd9968f9..000000000 --- a/Tools/DumpRenderTree/mac/ObjCPlugin.m +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 James G. Speth (speth@end.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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "ObjCPlugin.h" - -#import <WebKit/WebKit.h> -#import <objc/runtime.h> - -// === NSObject category to expose almost everything to JavaScript === - -// Warning: this class introduces huge security weaknesses, and should only be used -// for testing inside of DumpRenderTree, and only with trusted code. By default, it has -// the same restrictive behavior as the standard WebKit setup. However, scripts can use the -// plugin's removeBridgeRestrictions: method to open up almost total access to the Cocoa -// frameworks. - -static BOOL _allowsScriptsFullAccess = NO; - -@interface NSObject (ObjCScriptAccess) - -+ (void)setAllowsScriptsFullAccess:(BOOL)value; -+ (BOOL)allowsScriptsFullAccess; - -@end - -@implementation NSObject (ObjCScriptAccess) - -+ (void)setAllowsScriptsFullAccess:(BOOL)value -{ - _allowsScriptsFullAccess = value; -} - -+ (BOOL)allowsScriptsFullAccess -{ - return _allowsScriptsFullAccess; -} - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector -{ - return !_allowsScriptsFullAccess; -} - -+ (NSString *)webScriptNameForSelector:(SEL)selector -{ - return nil; -} - -@end - -@interface JSObjC : NSObject { -} - -// expose some useful objc functions to the scripting environment -- (id)lookUpClass:(NSString *)name; -- (void)log:(NSString *)message; -- (id)retainObject:(id)obj; -- (id)classOfObject:(id)obj; -- (NSString *)classNameOfObject:(id)obj; - -@end - -@implementation JSObjC - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector -{ - return NO; -} - -+ (NSString *)webScriptNameForSelector:(SEL)selector -{ - return nil; -} - -- (id)invokeDefaultMethodWithArguments:(NSArray *)args -{ - // this is a useful shortcut for accessing objective-c classes from the scripting - // environment, e.g. 'var myObject = objc("NSObject").alloc().init();' - if ([args count] == 1) - return [self lookUpClass:[args objectAtIndex:0]]; - return nil; -} - -- (id)lookUpClass:(NSString *)name -{ - return NSClassFromString(name); -} - -- (void)log:(NSString *)message -{ - NSLog(@"%@", message); -} - -- (id)retainObject:(id)obj -{ - return [obj retain]; -} - -- (id)classOfObject:(id)obj -{ - return (id)[obj class]; -} - -- (NSString *)classNameOfObject:(id)obj -{ - return [obj className]; -} - -@end - -@implementation ObjCPlugin - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (aSelector == @selector(removeBridgeRestrictions:)) - return NO; - - if (aSelector == @selector(echo:)) - return NO; - - if (aSelector == @selector(throwIfArgumentIsNotHello:)) - return NO; - - if (aSelector == @selector(methodMappedToLongName)) - return NO; - - NSString *selectorName = NSStringFromSelector(aSelector); - if ([selectorName hasPrefix:@"testConversion"]) - return NO; - - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(echo:)) - return @"echo"; - - if (aSelector == @selector(throwIfArgumentIsNotHello:)) - return @"throwIfArgumentIsNotHello"; - - if (aSelector == @selector(methodMappedToLongName)) - return [@"" stringByPaddingToLength:4096 withString: @"long" startingAtIndex:0]; - - return nil; -} - -+ (NSString *)webScriptNameForKey:(const char *)key -{ - if (strcmp(key, "throwOnDealloc") == 0) - return @"throwOnDealloc"; - - return nil; -} - -+ (BOOL)isKeyExcludedFromWebScript:(const char *)key -{ - if (strcmp(key, "throwOnDealloc") == 0) - return NO; - - return YES; -} - -- (void)removeBridgeRestrictions:(id)container -{ - // let scripts invoke any selector - [NSObject setAllowsScriptsFullAccess:YES]; - - // store a JSObjC instance into the provided container - JSObjC *objc = [[JSObjC alloc] init]; - [container setValue:objc forKey:@"objc"]; - [objc release]; -} - -- (id)echo:(id)obj -{ - return obj; -} - -- (void)throwIfArgumentIsNotHello:(NSString *)str -{ - if (![str isEqualToString:@"Hello"]) - [WebScriptObject throwException:[NSString stringWithFormat:@"%@ != Hello", str]]; -} - -- (NSString *)methodMappedToLongName -{ - return @"methodMappedToLongName"; -} - -- (NSString *)testConversionColon:(int)useless -{ - return @"testConversionColon:(int)useless"; -} - -- (NSString *)testConversionEscapeChar$a_b$_:(int)useless -{ - return @"testConversionEscapeChar$a_b$_:(int)useless"; -} - -- (void)dealloc -{ - if (throwOnDealloc) - [WebScriptObject throwException:@"Throwing exception on dealloc of ObjCPlugin"]; - - [super dealloc]; -} - -@end diff --git a/Tools/DumpRenderTree/mac/ObjCPluginFunction.h b/Tools/DumpRenderTree/mac/ObjCPluginFunction.h deleted file mode 100644 index 1e81b21f4..000000000 --- a/Tools/DumpRenderTree/mac/ObjCPluginFunction.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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 THE AUTHOR ``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 AUTHOR 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 <Cocoa/Cocoa.h> - - -@interface ObjCPluginFunction : NSObject -{ -} - -@end diff --git a/Tools/DumpRenderTree/mac/ObjCPluginFunction.m b/Tools/DumpRenderTree/mac/ObjCPluginFunction.m deleted file mode 100644 index 5bf3617fc..000000000 --- a/Tools/DumpRenderTree/mac/ObjCPluginFunction.m +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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 THE AUTHOR ``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 AUTHOR 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 "ObjCPluginFunction.h" - - -@implementation ObjCPluginFunction - -- (id)invokeDefaultMethodWithArguments:(NSArray *)args -{ - return @"test"; -} - -@end diff --git a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport.c b/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport.c deleted file mode 100644 index 35f051c14..000000000 --- a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#include <sys/sysctl.h> - -int processIsCrashing(int pid) -{ - int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid }; - struct kinfo_proc info; - size_t bufferSize = sizeof(info); - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &info, &bufferSize, 0, 0)) { - perror("sysctl"); - return 0; - } - - struct extern_proc proc = info.kp_proc; - - // The process is crashing if it is waiting to exit, is not a zombie, and has a non-zero exit code. - return proc.p_stat != SZOMB && (proc.p_flag & P_WEXIT) && proc.p_xstat; -} diff --git a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupportPregenerated.pm b/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupportPregenerated.pm deleted file mode 100644 index 7b4ea34e5..000000000 --- a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupportPregenerated.pm +++ /dev/null @@ -1,54 +0,0 @@ -# This file was automatically generated by SWIG -package DumpRenderTreeSupport; -require Exporter; -require DynaLoader; -@ISA = qw(Exporter DynaLoader); -package DumpRenderTreeSupportc; -bootstrap DumpRenderTreeSupport; -package DumpRenderTreeSupport; -@EXPORT = qw( ); - -# ---------- BASE METHODS ------------- - -package DumpRenderTreeSupport; - -sub TIEHASH { - my ($classname,$obj) = @_; - return bless $obj, $classname; -} - -sub CLEAR { } - -sub FIRSTKEY { } - -sub NEXTKEY { } - -sub FETCH { - my ($self,$field) = @_; - my $member_func = "swig_${field}_get"; - $self->$member_func(); -} - -sub STORE { - my ($self,$field,$newval) = @_; - my $member_func = "swig_${field}_set"; - $self->$member_func($newval); -} - -sub this { - my $ptr = shift; - return tied(%$ptr); -} - - -# ------- FUNCTION WRAPPERS -------- - -package DumpRenderTreeSupport; - -*processIsCrashing = *DumpRenderTreeSupportc::processIsCrashing; - -# ------- VARIABLE STUBS -------- - -package DumpRenderTreeSupport; - -1; diff --git a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport_wrapPregenerated.c b/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport_wrapPregenerated.c deleted file mode 100644 index f73498934..000000000 --- a/Tools/DumpRenderTree/mac/PerlSupport/DumpRenderTreeSupport_wrapPregenerated.c +++ /dev/null @@ -1,1167 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.24 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - - -#ifndef SWIG_TEMPLATE_DISAMBIGUATOR -# if defined(__SUNPRO_CC) -# define SWIG_TEMPLATE_DISAMBIGUATOR template -# else -# define SWIG_TEMPLATE_DISAMBIGUATOR -# endif -#endif - -/*********************************************************************** - * swigrun.swg - * - * This file contains generic CAPI SWIG runtime support for pointer - * type checking. - * - ************************************************************************/ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "1" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -#define SWIG_QUOTE_STRING(x) #x -#define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -#define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -#define SWIG_TYPE_TABLE_NAME -#endif - -#include <string.h> - -#ifndef SWIGINLINE -#if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -#else -# define SWIGINLINE -#endif -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the swig runtime code. - In 99.9% of the cases, swig just needs to declare them as 'static'. - - But only do this if is strictly necessary, ie, if you have problems - with your compiler or so. -*/ -#ifndef SWIGRUNTIME -#define SWIGRUNTIME static -#endif -#ifndef SWIGRUNTIMEINLINE -#define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -typedef struct swig_type_info { - const char *name; - swig_converter_func converter; - const char *str; - void *clientdata; - swig_dycast_func dcast; - struct swig_type_info *next; - struct swig_type_info *prev; -} swig_type_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class<int>" == "Class<int >", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return *f1 - *f2; - } - return (l1 - f1) - (l2 - f2); -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0; - if (*ne) ++ne; - } - return equiv; -} - -/* - Register a type mapping with the type-checking -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeRegisterTL(swig_type_info **tl, swig_type_info *ti) { - swig_type_info *tc, *head, *ret, *next; - /* Check to see if this type has already been registered */ - tc = *tl; - while (tc) { - /* check simple type equivalence */ - int typeequiv = (strcmp(tc->name, ti->name) == 0); - /* check full type equivalence, resolving typedefs */ - if (!typeequiv) { - /* only if tc is not a typedef (no '|' on it) */ - if (tc->str && ti->str && !strstr(tc->str,"|")) { - typeequiv = SWIG_TypeEquiv(ti->str,tc->str); - } - } - if (typeequiv) { - /* Already exists in the table. Just add additional types to the list */ - if (ti->clientdata) tc->clientdata = ti->clientdata; - head = tc; - next = tc->next; - goto l1; - } - tc = tc->prev; - } - head = ti; - next = 0; - - /* Place in list */ - ti->prev = *tl; - *tl = ti; - - /* Build linked lists */ - l1: - ret = head; - tc = ti + 1; - /* Patch up the rest of the links */ - while (tc->name) { - head->next = tc; - tc->prev = head; - head = tc; - tc++; - } - if (next) next->prev = head; - head->next = next; - - return ret; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - swig_type_info *s; - if (!ty) return 0; /* Void pointer */ - s = ty->next; /* First element always just a name */ - do { - if (strcmp(s->name,c) == 0) { - if (s == ty->next) return s; - /* Move s to the top of the linked list */ - s->prev->next = s->next; - if (s->next) { - s->next->prev = s->prev; - } - /* Insert s as second element in the list */ - s->next = ty->next; - if (ty->next) ty->next->prev = s; - ty->next = s; - s->prev = ty; - return s; - } - s = s->next; - } while (s && (s != ty->next)); - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_type_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Search for a swig_type_info structure -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryTL(swig_type_info *tl, const char *name) { - swig_type_info *ty = tl; - while (ty) { - if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty; - if (ty->name && (strcmp(name,ty->name) == 0)) return ty; - ty = ty->prev; - } - return 0; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientDataTL(swig_type_info *tl, swig_type_info *ti, void *clientdata) { - swig_type_info *tc, *equiv; - if (ti->clientdata) return; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - equiv = ti->next; - while (equiv) { - if (!equiv->converter) { - tc = tl; - while (tc) { - if ((strcmp(tc->name, equiv->name) == 0)) - SWIG_TypeClientDataTL(tl,tc,clientdata); - tc = tc->prev; - } - } - equiv = equiv->next; - } -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static char hex[17] = "0123456789abcdef"; - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - register unsigned char uu; - for (; u != eu; ++u) { - uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register int d = *(c++); - register unsigned char uu = 0; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - This function will propagate the clientdata field of type to any new - swig_type_info structures that have been added into the list of - equivalent types. It is like calling SWIG_TypeClientData(type, - clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientDataTL(swig_type_info *tl, swig_type_info *type) { - swig_type_info *equiv = type->next; - swig_type_info *tc; - if (!type->clientdata) return; - while (equiv) { - if (!equiv->converter) { - tc = tl; - while (tc) { - if ((strcmp(tc->name, equiv->name) == 0) && !tc->clientdata) - SWIG_TypeClientDataTL(tl,tc, type->clientdata); - tc = tc->prev; - } - } - equiv = equiv->next; - } -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/*********************************************************************** - * common.swg - * - * This file contains generic SWIG runtime support for pointer - * type checking as well as a few commonly used macros to control - * external linkage. - * - * Author : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (c) 1999-2000, The University of Chicago - * - * This file may be freely redistributed without license or fee provided - * this copyright message remains intact. - ************************************************************************/ - - -#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if !defined(STATIC_LINKED) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# define SWIGEXPORT(a) a -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -/*************************************************************************/ - - -/* The static type info list */ - -static swig_type_info *swig_type_list = 0; -static swig_type_info **swig_type_list_handle = &swig_type_list; - - -/* Register a type mapping with the type-checking */ -static swig_type_info * -SWIG_TypeRegister(swig_type_info *ti) { - return SWIG_TypeRegisterTL(swig_type_list_handle, ti); -} - -/* Search for a swig_type_info structure */ -static swig_type_info * -SWIG_TypeQuery(const char *name) { - return SWIG_TypeQueryTL(*swig_type_list_handle, name); -} - -/* Set the clientdata field for a type */ -static void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientDataTL(*swig_type_list_handle, ti, clientdata); -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -static void -SWIG_PropagateClientData(swig_type_info *type) { - SWIG_PropagateClientDataTL(*swig_type_list_handle, type); -} - -#ifdef __cplusplus -} -#endif - -/* ---------------------------------------------------------------------- -*- c -*- - * perl5.swg - * - * Perl5 runtime library - * $Header: /cvsroot/swig/SWIG/Lib/perl5/perlrun.swg,v 1.20 2004/11/29 23:13:57 wuzzeb Exp $ - * ----------------------------------------------------------------------------- */ - -#define SWIGPERL -#define SWIGPERL5 -#ifdef __cplusplus -/* Needed on some windows machines---since MS plays funny games with the header files under C++ */ -#include <math.h> -#include <stdlib.h> -extern "C" { -#endif -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -/* Get rid of free and malloc defined by perl */ -#undef free -#undef malloc - -#ifndef pTHX_ -#define pTHX_ -#endif - -#include <string.h> -#ifdef __cplusplus -} -#endif - -/* Macro to call an XS function */ - -#ifdef PERL_OBJECT -# define SWIG_CALLXS(_name) _name(cv,pPerl) -#else -# ifndef MULTIPLICITY -# define SWIG_CALLXS(_name) _name(cv) -# else -# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) -# endif -#endif - -/* Contract support */ - -#define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else - -/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ - -#ifdef PERL_OBJECT -#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; -typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) -#define SWIGCLASS_STATIC -#else -#define MAGIC_PPERL -#define SWIGCLASS_STATIC static -#ifndef MULTIPLICITY -#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) -typedef int (*SwigMagicFunc)(SV *, MAGIC *); - -#ifdef __cplusplus -extern "C" { -#endif -typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - - -#else -#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) -typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); -#ifdef __cplusplus -extern "C" { -#endif -typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#endif -#endif - -#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) -#define PerlIO_exportFILE(fh,fl) (FILE*)(fh) -#endif - -/* Modifications for newer Perl 5.005 releases */ - -#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) -# ifndef PL_sv_yes -# define PL_sv_yes sv_yes -# endif -# ifndef PL_sv_undef -# define PL_sv_undef sv_undef -# endif -# ifndef PL_na -# define PL_na na -# endif -#endif - -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define SWIG_OWNER 1 -#define SWIG_SHADOW 2 - -/* Common SWIG API */ - -#ifdef PERL_OBJECT -# define SWIG_ConvertPtr(obj, pp, type, flags) \ - SWIG_Perl_ConvertPtr(pPerl, obj, pp, type, flags) -# define SWIG_NewPointerObj(p, type, flags) \ - SWIG_Perl_NewPointerObj(pPerl, p, type, flags) -# define SWIG_MakePackedObj(sv, p, s, type) \ - SWIG_Perl_MakePackedObj(pPerl, sv, p, s, type) -# define SWIG_ConvertPacked(obj, p, s, type, flags) \ - SWIG_Perl_ConvertPacked(pPerl, obj, p, s, type, flags) - -#else -# define SWIG_ConvertPtr(obj, pp, type, flags) \ - SWIG_Perl_ConvertPtr(obj, pp, type, flags) -# define SWIG_NewPointerObj(p, type, flags) \ - SWIG_Perl_NewPointerObj(p, type, flags) -# define SWIG_MakePackedObj(sv, p, s, type) \ - SWIG_Perl_MakePackedObj(sv, p, s, type ) -# define SWIG_ConvertPacked(obj, p, s, type, flags) \ - SWIG_Perl_ConvertPacked(obj, p, s, type, flags) -#endif - -/* Perl-specific API */ -#ifdef PERL_OBJECT -# define SWIG_MakePtr(sv, ptr, type, flags) \ - SWIG_Perl_MakePtr(pPerl, sv, ptr, type, flags) -# define SWIG_SetError(str) \ - SWIG_Perl_SetError(pPerl, str) -#else -# define SWIG_MakePtr(sv, ptr, type, flags) \ - SWIG_Perl_MakePtr(sv, ptr, type, flags) -# define SWIG_SetError(str) \ - SWIG_Perl_SetError(str) -# define SWIG_SetErrorSV(str) \ - SWIG_Perl_SetErrorSV(str) -#endif - -#define SWIG_SetErrorf SWIG_Perl_SetErrorf - - -#ifdef PERL_OBJECT -# define SWIG_MAYBE_PERL_OBJECT CPerlObj *pPerl, -#else -# define SWIG_MAYBE_PERL_OBJECT -#endif - -static swig_type_info ** -SWIG_Perl_GetTypeListHandle() { - static void *type_pointer = (void *)0; - SV *pointer; - - /* first check if pointer already created */ - if (!type_pointer) { - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); - if (pointer && SvOK(pointer)) { - type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); - } - } - - return (swig_type_info **) type_pointer; -} - -/* - Search for a swig_type_info structure - */ -SWIGRUNTIMEINLINE swig_type_info * -SWIG_Perl_GetTypeList() { - swig_type_info **tlh = SWIG_Perl_GetTypeListHandle(); - return tlh ? *tlh : (swig_type_info*)0; -} - -#define SWIG_Runtime_GetTypeList SWIG_Perl_GetTypeList - -static swig_type_info * -SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) { - swig_type_info *s; - if (!ty) return 0; /* Void pointer */ - s = ty->next; /* First element always just a name */ - do { - if (sv_derived_from(rv, (char *) s->name)) { - if (s == ty->next) return s; - /* Move s to the top of the linked list */ - s->prev->next = s->next; - if (s->next) { - s->next->prev = s->prev; - } - /* Insert s as second element in the list */ - s->next = ty->next; - if (ty->next) ty->next->prev = s; - ty->next = s; - s->prev = ty; - return s; - } - s = s->next; - } while (s && (s != ty->next)); - return 0; -} - -/* Function for getting a pointer value */ - -static int -SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { - swig_type_info *tc; - void *voidptr = (void *)0; - - /* If magical, apply more magic */ - if (SvGMAGICAL(sv)) - mg_get(sv); - - /* Check to see if this is an object */ - if (sv_isobject(sv)) { - SV *tsv = (SV*) SvRV(sv); - IV tmp = 0; - if ((SvTYPE(tsv) == SVt_PVHV)) { - MAGIC *mg; - if (SvMAGICAL(tsv)) { - mg = mg_find(tsv,'P'); - if (mg) { - sv = mg->mg_obj; - if (sv_isobject(sv)) { - tmp = SvIV((SV*)SvRV(sv)); - } - } - } else { - return -1; - } - } else { - tmp = SvIV((SV*)SvRV(sv)); - } - voidptr = (void *)tmp; - if (!_t) { - *(ptr) = voidptr; - return 0; - } - } else if (! SvOK(sv)) { /* Check for undef */ - *(ptr) = (void *) 0; - return 0; - } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ - *(ptr) = (void *) 0; - if (!SvROK(sv)) - return 0; - else - return -1; - } else { /* Don't know what it is */ - *(ptr) = (void *) 0; - return -1; - } - if (_t) { - /* Now see if the types match */ - char *_c = HvNAME(SvSTASH(SvRV(sv))); - tc = SWIG_TypeCheck(_c,_t); - if (!tc) { - *ptr = voidptr; - return -1; - } - *ptr = SWIG_TypeCast(tc,voidptr); - return 0; - } - *ptr = voidptr; - return 0; -} - -static void -SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { - if (ptr && (flags & SWIG_SHADOW)) { - SV *self; - SV *obj=newSV(0); - HV *hash=newHV(); - HV *stash; - sv_setref_pv(obj, (char *) t->name, ptr); - stash=SvSTASH(SvRV(obj)); - if (flags & SWIG_OWNER) { - HV *hv; - GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); - if (!isGV(gv)) - gv_init(gv, stash, "OWNER", 5, FALSE); - hv=GvHVn(gv); - hv_store_ent(hv, obj, newSViv(1), 0); - } - sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); - SvREFCNT_dec(obj); - self=newRV_noinc((SV *)hash); - sv_setsv(sv, self); - SvREFCNT_dec((SV *)self); - sv_bless(sv, stash); - } - else { - sv_setref_pv(sv, (char *) t->name, ptr); - } -} - -static SWIGINLINE SV * -SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { - SV *result = sv_newmortal(); - SWIG_MakePtr(result, ptr, t, flags); - return result; -} - -static void - SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { - char result[1024]; - char *r = result; - if ((2*sz + 1 + strlen(type->name)) > 1000) return; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - strcpy(r,type->name); - sv_setpv(sv, result); -} - -/* Convert a packed value value */ -static int -SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) { - swig_type_info *tc; - const char *c = 0; - - if ((!obj) || (!SvOK(obj))) return -1; - c = SvPV(obj, PL_na); - /* Pointer values must start with leading underscore */ - if (*c != '_') return -1; - c++; - c = SWIG_UnpackData(c,ptr,sz); - if (ty) { - tc = SWIG_TypeCheck(c,ty); - if (!tc) return -1; - } - return 0; -} - -static SWIGINLINE void -SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) { - if (error) sv_setpv(perl_get_sv("@", TRUE), error); -} - -static SWIGINLINE void -SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) { - if (error) sv_setsv(perl_get_sv("@", TRUE), error); -} - -static void -SWIG_Perl_SetErrorf(const char *fmt, ...) { - va_list args; - va_start(args, fmt); - sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*)); - va_end(args); -} - -/* Macros for low-level exception handling */ -#define SWIG_fail goto fail -#define SWIG_croak(x) { SWIG_SetError(x); goto fail; } -#define SWIG_croakSV(x) { SWIG_SetErrorSV(x); goto fail; } -/* most preprocessors do not support vararg macros :-( */ -/* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ - - -typedef XS(SwigPerlWrapper); -typedef SwigPerlWrapper *SwigPerlWrapperPtr; - -/* Structure for command table */ -typedef struct { - const char *name; - SwigPerlWrapperPtr wrapper; -} swig_command_info; - -/* Information for constant table */ - -#define SWIG_INT 1 -#define SWIG_FLOAT 2 -#define SWIG_STRING 3 -#define SWIG_POINTER 4 -#define SWIG_BINARY 5 - -/* Constant information structure */ -typedef struct swig_constant_info { - int type; - const char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_constant_info; - -#ifdef __cplusplus -} -#endif - -/* Structure for variable table */ -typedef struct { - const char *name; - SwigMagicFunc set; - SwigMagicFunc get; - swig_type_info **type; -} swig_variable_info; - -/* Magic variable code */ -#ifndef PERL_OBJECT -#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) - #ifndef MULTIPLICITY - static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) { - #else - static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { - #endif -#else -# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) -static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { -#endif - MAGIC *mg; - sv_magic(sv,sv,'U',(char *) name,strlen(name)); - mg = mg_find(sv,'U'); - mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); - mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; - mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; - mg->mg_virtual->svt_len = 0; - mg->mg_virtual->svt_clear = 0; - mg->mg_virtual->svt_free = 0; -} - - - - - - -#ifdef do_open - #undef do_open -#endif -#ifdef do_close - #undef do_close -#endif -#ifdef scalar - #undef scalar -#endif -#ifdef list - #undef list -#endif -#ifdef apply - #undef apply -#endif -#ifdef convert - #undef convert -#endif -#ifdef Error - #undef Error -#endif -#ifdef form - #undef form -#endif -#ifdef vform - #undef vform -#endif -#ifdef LABEL - #undef LABEL -#endif -#ifdef METHOD - #undef METHOD -#endif -#ifdef Move - #undef Move -#endif -#ifdef yylex - #undef yylex -#endif -#ifdef yyparse - #undef yyparse -#endif -#ifdef yyerror - #undef yyerror -#endif -#ifdef invert - #undef invert -#endif -#ifdef ref - #undef ref -#endif -#ifdef ENTER - #undef ENTER -#endif - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -static swig_type_info *swig_types[1]; - -/* -------- TYPES TABLE (END) -------- */ - -#define SWIG_init boot_DumpRenderTreeSupport - -#define SWIG_name "DumpRenderTreeSupportc::boot_DumpRenderTreeSupport" -#define SWIG_prefix "DumpRenderTreeSupportc::" - -#ifdef __cplusplus -extern "C" -#endif -#ifndef PERL_OBJECT -#ifndef MULTIPLICITY -SWIGEXPORT(void) SWIG_init (CV* cv); -#else -SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv); -#endif -#else -SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *); -#endif - -int processIsCrashing(int); -#ifdef PERL_OBJECT -#define MAGIC_CLASS _wrap_DumpRenderTreeSupport_var:: -class _wrap_DumpRenderTreeSupport_var : public CPerlObj { -public: -#else -#define MAGIC_CLASS -#endif -SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { - MAGIC_PPERL - sv = sv; mg = mg; - croak("Value is read-only."); - return 0; -} - - -#ifdef PERL_OBJECT -}; -#endif - -#ifdef __cplusplus -extern "C" { -#endif -XS(_wrap_processIsCrashing) { - { - int arg1 ; - int result; - int argvi = 0; - dXSARGS; - - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: processIsCrashing(pid);"); - } - arg1 = (int) SvIV(ST(0)); - result = (int)processIsCrashing(arg1); - - ST(argvi) = sv_newmortal(); - sv_setiv(ST(argvi++), (IV) result); - XSRETURN(argvi); - fail: - ; - } - croak(Nullch); -} - - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - - -static swig_type_info *swig_types_initial[] = { -0 -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_constant_info swig_constants[] = { -{0,0,0,0,0,0} -}; -#ifdef __cplusplus -} -#endif -static swig_variable_info swig_variables[] = { -{0,0,0,0} -}; -static swig_command_info swig_commands[] = { -{"DumpRenderTreeSupportc::processIsCrashing", _wrap_processIsCrashing}, -{0,0} -}; - - -static void SWIG_Perl_SetTypeListHandle(swig_type_info **handle) { - SV *pointer; - - /* create a new pointer */ - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); - sv_setiv(pointer, PTR2IV(swig_type_list_handle)); -} - -static swig_type_info ** -SWIG_Perl_LookupTypePointer(swig_type_info **type_list_handle) { - swig_type_info **type_pointer; - - /* first check if module already created */ - type_pointer = SWIG_Perl_GetTypeListHandle(); - if (type_pointer) { - return type_pointer; - } else { - /* create a new module and variable */ - SWIG_Perl_SetTypeListHandle(type_list_handle); - return type_list_handle; - } -} - - -#ifdef __cplusplus -extern "C" -#endif - -XS(SWIG_init) { - dXSARGS; - int i; - static int _init = 0; - if (!_init) { - swig_type_list_handle = SWIG_Perl_LookupTypePointer(swig_type_list_handle); - for (i = 0; swig_types_initial[i]; i++) { - swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); - } - _init = 1; - } - - /* Install commands */ - for (i = 0; swig_commands[i].name; i++) { - newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); - } - - /* Install variables */ - for (i = 0; swig_variables[i].name; i++) { - SV *sv; - sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); - if (swig_variables[i].type) { - SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); - } else { - sv_setiv(sv,(IV) 0); - } - swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); - } - - /* Install constant */ - for (i = 0; swig_constants[i].type; i++) { - SV *sv; - sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); - switch(swig_constants[i].type) { - case SWIG_INT: - sv_setiv(sv, (IV) swig_constants[i].lvalue); - break; - case SWIG_FLOAT: - sv_setnv(sv, (double) swig_constants[i].dvalue); - break; - case SWIG_STRING: - sv_setpv(sv, (char *) swig_constants[i].pvalue); - break; - case SWIG_POINTER: - SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); - break; - case SWIG_BINARY: - SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); - break; - default: - break; - } - SvREADONLY_on(sv); - } - - ST(0) = &PL_sv_yes; - XSRETURN(1); -} - diff --git a/Tools/DumpRenderTree/mac/PerlSupport/Makefile b/Tools/DumpRenderTree/mac/PerlSupport/Makefile deleted file mode 100644 index f7808dc3c..000000000 --- a/Tools/DumpRenderTree/mac/PerlSupport/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# 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. - -CONFIGURATION_BUILD_DIR ?= . -OUTPUT_DIR=$(CONFIGURATION_BUILD_DIR) - -WRAPPER_DIR=$(OUTPUT_DIR)/DerivedSources/DumpRenderTree -WRAPPER=$(WRAPPER_DIR)/DumpRenderTreeSupport_wrap.c -PERL_MODULE=$(OUTPUT_DIR)/DumpRenderTreeSupport.pm -DYLIB=$(OUTPUT_DIR)/DumpRenderTreeSupport.dylib -DUMPRENDERTREE=$(OUTPUT_DIR)/DumpRenderTree -PERL=/usr/bin/perl - -OSX_VERSION = $(shell sw_vers -productVersion | cut -d. -f 2) -ifeq "$(OSX_VERSION)" "5" -GENERATE_WRAPPER = YES -endif -ifeq "$(OSX_VERSION)" "6" -GENERATE_WRAPPER = NO -endif - -ifeq "$(GENERATE_WRAPPER)" "YES" - -SWIG=/usr/bin/swig - -all: $(DYLIB) $(PERL_MODULE) - -$(WRAPPER) $(PERL_MODULE): DumpRenderTreeSupport.c $(DUMPRENDERTREE) - mkdir -p $(WRAPPER_DIR) - $(SWIG) -o $(WRAPPER) -outdir $(OUTPUT_DIR) -perl -module DumpRenderTreeSupport $< - - -else - - -all: $(DYLIB) $(PERL_MODULE) - -$(WRAPPER): DumpRenderTreeSupport_wrapPregenerated.c $(DUMPRENDERTREE) - mkdir -p $(WRAPPER_DIR) - cp DumpRenderTreeSupport_wrapPregenerated.c $(WRAPPER) - -$(PERL_MODULE): DumpRenderTreeSupportPregenerated.pm $(DUMPRENDERTREE) - cp DumpRenderTreeSupportPregenerated.pm $(PERL_MODULE) - - -endif - -$(DYLIB): DumpRenderTreeSupport.c $(WRAPPER) - gcc -g -dynamiclib -o $(DYLIB) `$(PERL) -MExtUtils::Embed -eperl_inc` `$(PERL) -MExtUtils::Embed -e'my $$opts = ldopts(0); $$opts =~ s/-arch [^ ]*( |$$)//g; print $$opts, " -arch ", join(" -arch ", split(" ",$$ENV{ARCHS}))'` $^ - -clean: - rm -f $(WRAPPER) $(PERL_MODULE) $(DYLIB) - -installhdrs installsrc: - -INSTALL_LOCATION=$(DSTROOT)/$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH) - -install: all - mkdir -p $(INSTALL_LOCATION) - cp $(DYLIB) $(INSTALL_LOCATION)/DumpRenderTreeSupport.dylib - cp $(PERL_MODULE) $(INSTALL_LOCATION)/DumpRenderTreeSupport.pm - diff --git a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm deleted file mode 100644 index c2d43dabf..000000000 --- a/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm +++ /dev/null @@ -1,196 +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 "PixelDumpSupport.h" -#include "PixelDumpSupportCG.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <CoreGraphics/CGBitmapContext.h> -#include <wtf/Assertions.h> -#include <wtf/RefPtr.h> - -#import <WebKit/WebCoreStatistics.h> -#import <WebKit/WebDocumentPrivate.h> -#import <WebKit/WebHTMLViewPrivate.h> -#import <WebKit/WebKit.h> -#import <WebKit/WebViewPrivate.h> - -static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t pixelsHigh, size_t& rowBytes, void*& buffer) -{ - rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance - - buffer = calloc(pixelsHigh, rowBytes); - if (!buffer) - 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()); - 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); - return 0; - } - - return BitmapContext::createByAdoptingBitmapAndContext(buffer, context); -} - -static void paintRepaintRectOverlay(WebView* webView, CGContextRef context) -{ - CGRect viewRect = NSRectToCGRect([webView bounds]); - - CGContextSaveGState(context); - - // Using a transparency layer is easier than futzing with clipping. - CGContextBeginTransparencyLayer(context, 0); - - // Flip the context. - CGContextScaleCTM(context, 1, -1); - CGContextTranslateCTM(context, 0, -viewRect.size.height); - - CGContextSetRGBFillColor(context, 0, 0, 0, static_cast<CGFloat>(0.66)); - CGContextFillRect(context, viewRect); - - NSArray *repaintRects = [webView trackedRepaintRects]; - if (repaintRects) { - - for (NSValue *value in repaintRects) { - CGRect currRect = NSRectToCGRect([value rectValue]); - CGContextClearRect(context, currRect); - } - } - - CGContextEndTransparencyLayer(context); - CGContextRestoreGState(context); -} - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect) -{ - WebView* view = [mainFrame webView]; - - // If the WebHTMLView uses accelerated compositing, we need for force the on-screen capture path - // and also force Core Animation to start its animations with -display since the DRT window has autodisplay disabled. - if ([view _isUsingAcceleratedCompositing]) - onscreen = YES; - - float deviceScaleFactor = [view _backingScaleFactor]; - NSSize webViewSize = [view frame].size; - size_t pixelsWide = static_cast<size_t>(webViewSize.width * deviceScaleFactor); - size_t pixelsHigh = static_cast<size_t>(webViewSize.height * deviceScaleFactor); - size_t rowBytes = 0; - void* buffer = 0; - RefPtr<BitmapContext> bitmapContext = createBitmapContext(pixelsWide, pixelsHigh, rowBytes, buffer); - if (!bitmapContext) - return 0; - CGContextRef context = bitmapContext->cgContext(); - CGContextScaleCTM(context, deviceScaleFactor, deviceScaleFactor); - - NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]; - ASSERT(nsContext); - - if (incrementalRepaint) { - if (sweepHorizontally) { - for (NSRect column = NSMakeRect(0, 0, 1, webViewSize.height); column.origin.x < webViewSize.width; column.origin.x++) - [view displayRectIgnoringOpacity:column inContext:nsContext]; - } else { - for (NSRect line = NSMakeRect(0, 0, webViewSize.width, 1); line.origin.y < webViewSize.height; line.origin.y++) - [view displayRectIgnoringOpacity:line inContext:nsContext]; - } - } else { - if (deviceScaleFactor != 1) { - // Call displayRectIgnoringOpacity for HiDPI tests since it ensures we paint directly into the context - // that we have appropriately sized and scaled. - [view displayRectIgnoringOpacity:[view bounds] inContext:nsContext]; - if ([view isTrackingRepaints]) - paintRepaintRectOverlay(view, context); - } else if (onscreen) { - // displayIfNeeded does not update the CA layers if the layer-hosting view was not marked as needing display, so - // we're at the mercy of CA's display-link callback to update layers in time. So we need to force a display of the view - // to get AppKit to update the CA layers synchronously. - // FIXME: this will break repaint testing if we have compositing in repaint tests - // (displayWebView() painted gray over the webview, but we'll be making everything repaint again). - [view display]; - - // Ask the window server to provide us a composited version of the *real* window content including surfaces (i.e. OpenGL content) - // Note that the returned image might differ very slightly from the window backing because of dithering artifacts in the window server compositor. - CGImageRef image = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[view window] windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque); - CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); - CGImageRelease(image); - - if ([view isTrackingRepaints]) - paintRepaintRectOverlay(view, context); - } else { - // Make sure the view has been painted. - [view displayIfNeeded]; - - // Grab directly the contents of the window backing buffer (this ignores any surfaces on the window) - // FIXME: This path is suboptimal: data is read from window backing store, converted to RGB8 then drawn again into an RGBA8 bitmap - [view lockFocus]; - NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]] autorelease]; - [view unlockFocus]; - - RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext]; - [NSGraphicsContext setCurrentContext:nsContext]; - [imageRep draw]; - - if ([view isTrackingRepaints]) - paintRepaintRectOverlay(view, context); - - [NSGraphicsContext setCurrentContext:savedContext.get()]; - } - } - - if (drawSelectionRect) { - NSView *documentView = [[mainFrame frameView] documentView]; - ASSERT([documentView conformsToProtocol:@protocol(WebDocumentSelection)]); - NSRect rect = [documentView convertRect:[(id <WebDocumentSelection>)documentView selectionRect] fromView:nil]; - CGContextSaveGState(context); - CGContextSetLineWidth(context, 1.0); - CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0); - CGContextStrokeRect(context, CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)); - CGContextRestoreGState(context); - } - - return bitmapContext.release(); -} - -PassRefPtr<BitmapContext> createPagedBitmapContext() -{ - int pageWidthInPixels = TestRunner::viewWidth; - int pageHeightInPixels = TestRunner::viewHeight; - int numberOfPages = [mainFrame numberOfPagesWithPageWidth:pageWidthInPixels pageHeight:pageHeightInPixels]; - size_t rowBytes = 0; - void* buffer = 0; - - RefPtr<BitmapContext> bitmapContext = createBitmapContext(pageWidthInPixels, numberOfPages * (pageHeightInPixels + 1) - 1, rowBytes, buffer); - [mainFrame printToCGContext:bitmapContext->cgContext() pageWidth:pageWidthInPixels pageHeight:pageHeightInPixels]; - return bitmapContext.release(); -} diff --git a/Tools/DumpRenderTree/mac/PolicyDelegate.h b/Tools/DumpRenderTree/mac/PolicyDelegate.h deleted file mode 100644 index c1a7e6f25..000000000 --- a/Tools/DumpRenderTree/mac/PolicyDelegate.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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. - */ - -#import <Cocoa/Cocoa.h> - -class TestRunner; - -@interface PolicyDelegate : NSObject { - BOOL permissiveDelegate; - TestRunner* controllerToNotifyDone; -} - -- (void)setPermissive:(BOOL)permissive; -- (void)setControllerToNotifyDone:(TestRunner*)controller; - -@end diff --git a/Tools/DumpRenderTree/mac/PolicyDelegate.mm b/Tools/DumpRenderTree/mac/PolicyDelegate.mm deleted file mode 100644 index 6a0eeb9ec..000000000 --- a/Tools/DumpRenderTree/mac/PolicyDelegate.mm +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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. - */ - -#import "config.h" -#import "PolicyDelegate.h" - -#import "DumpRenderTree.h" -#import "TestRunner.h" -#import <WebKit/DOMElement.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebPolicyDelegate.h> -#import <WebKit/WebView.h> - -@interface NSURL (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface DOMNode (dumpPath) -- (NSString *)dumpPath; -@end - -@implementation PolicyDelegate - -- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation - request:(NSURLRequest *)request - frame:(WebFrame *)frame - decisionListener:(id<WebPolicyDecisionListener>)listener -{ - WebNavigationType navType = (WebNavigationType)[[actionInformation objectForKey:WebActionNavigationTypeKey] intValue]; - - const char* typeDescription; - switch (navType) { - case WebNavigationTypeLinkClicked: - typeDescription = "link clicked"; - break; - case WebNavigationTypeFormSubmitted: - typeDescription = "form submitted"; - break; - case WebNavigationTypeBackForward: - typeDescription = "back/forward"; - break; - case WebNavigationTypeReload: - typeDescription = "reload"; - break; - case WebNavigationTypeFormResubmitted: - typeDescription = "form resubmitted"; - break; - case WebNavigationTypeOther: - typeDescription = "other"; - break; - default: - typeDescription = "illegal value"; - } - - NSString *message = [NSString stringWithFormat:@"Policy delegate: attempt to load %@ with navigation type '%s'", [[request URL] _drt_descriptionSuitableForTestResult], typeDescription]; - - if (DOMElement *originatingNode = [[actionInformation objectForKey:WebActionElementKey] objectForKey:WebElementDOMNodeKey]) - message = [message stringByAppendingFormat:@" originating from %@", [originatingNode dumpPath]]; - - printf("%s\n", [message UTF8String]); - - if (permissiveDelegate) - [listener use]; - else - [listener ignore]; - - if (controllerToNotifyDone) { - controllerToNotifyDone->notifyDone(); - controllerToNotifyDone = 0; - } -} - -- (void)webView:(WebView *)webView unableToImplementPolicyWithError:(NSError *)error frame:(WebFrame *)frame -{ - NSString *message = [NSString stringWithFormat:@"Policy delegate: unable to implement policy with error domain '%@', error code %ld, in frame '%@'", [error domain], static_cast<long>([error code]), [frame name]]; - printf("%s\n", [message UTF8String]); -} - -static NSString *dispositionTypeFromContentDispositionHeader(NSString *header) -{ - NSMutableString *result = [[[[header componentsSeparatedByString:@";"] objectAtIndex:0] mutableCopy] autorelease]; - if (result) - CFStringTrimWhitespace((CFMutableStringRef)result); - return result; -} - -- (void)webView:(WebView *)c decidePolicyForMIMEType:(NSString *)type - request:(NSURLRequest *)request - frame:(WebFrame *)frame - decisionListener:(id<WebPolicyDecisionListener>)listener -{ - NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)[[frame provisionalDataSource] response]; - if (![HTTPResponse isKindOfClass:[NSHTTPURLResponse class]]) - HTTPResponse = nil; - - NSString *dispositionType = dispositionTypeFromContentDispositionHeader([[HTTPResponse allHeaderFields] objectForKey:@"Content-Disposition"]); - if (dispositionType && [dispositionType compare:@"attachment" options:NSCaseInsensitiveSearch] == NSOrderedSame) { - printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", [[HTTPResponse suggestedFilename] UTF8String]); - [listener ignore]; - return; - } - - [listener use]; -} - -- (void)setPermissive:(BOOL)permissive -{ - permissiveDelegate = permissive; -} - -- (void)setControllerToNotifyDone:(TestRunner*)controller -{ - controllerToNotifyDone = controller; -} - -@end diff --git a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.h b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.h deleted file mode 100644 index 0c4618e93..000000000 --- a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#import <Cocoa/Cocoa.h> - - -@interface ResourceLoadDelegate : NSObject { -} - -@end diff --git a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm deleted file mode 100644 index 5632aa285..000000000 --- a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2007, 2011 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. - */ - -#import "config.h" -#import "ResourceLoadDelegate.h" - -#import "DumpRenderTree.h" -#import "TestRunner.h" -#import <WebKit/WebKit.h> -#import <WebKit/WebTypesInternal.h> -#import <WebKit/WebDataSourcePrivate.h> -#import <wtf/Assertions.h> - -using namespace std; - -@interface NSURL (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSError (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSURLResponse (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@interface NSURLRequest (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult; -@end - -@implementation NSError (DRTExtras) -- (NSString *)_drt_descriptionSuitableForTestResult -{ - NSString *str = [NSString stringWithFormat:@"<NSError domain %@, code %ld", [self domain], static_cast<long>([self code])]; - NSURL *failingURL; - - if ((failingURL = [[self userInfo] objectForKey:@"NSErrorFailingURLKey"])) - str = [str stringByAppendingFormat:@", failing URL \"%@\"", [failingURL _drt_descriptionSuitableForTestResult]]; - - str = [str stringByAppendingFormat:@">"]; - - return str; -} - -@end - -@implementation NSURL (DRTExtras) - -- (NSString *)_drt_descriptionSuitableForTestResult -{ - if (![self isFileURL]) - return [self absoluteString]; - - WebDataSource *dataSource = [mainFrame dataSource]; - if (!dataSource) - dataSource = [mainFrame provisionalDataSource]; - - NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent]; - basePath = [basePath stringByAppendingString:@"/"]; - - if ([[self path] hasPrefix:basePath]) - return [[self path] substringFromIndex:[basePath length]]; - return [self absoluteString]; -} - -@end - -@implementation NSURLResponse (DRTExtras) - -- (NSString *)_drt_descriptionSuitableForTestResult -{ - int statusCode = 0; - if ([self isKindOfClass:[NSHTTPURLResponse class]]) - statusCode = [(NSHTTPURLResponse *)self statusCode]; - return [NSString stringWithFormat:@"<NSURLResponse %@, http status code %i>", [[self URL] _drt_descriptionSuitableForTestResult], statusCode]; -} - -@end - -@implementation NSURLRequest (DRTExtras) - -- (NSString *)_drt_descriptionSuitableForTestResult -{ - NSString *httpMethod = [self HTTPMethod]; - if (!httpMethod) - httpMethod = @"(none)"; - return [NSString stringWithFormat:@"<NSURLRequest URL %@, main document URL %@, http method %@>", [[self URL] _drt_descriptionSuitableForTestResult], [[self mainDocumentURL] _drt_descriptionSuitableForTestResult], httpMethod]; -} - -@end - -@implementation ResourceLoadDelegate - -- (id)webView: (WebView *)wv identifierForInitialRequest: (NSURLRequest *)request fromDataSource: (WebDataSource *)dataSource -{ - ASSERT([[dataSource webFrame] dataSource] || [[dataSource webFrame] provisionalDataSource]); - - if (!done) - return [[request URL] _drt_descriptionSuitableForTestResult]; - - return @"<unknown>"; -} - -BOOL isLocalhost(NSString *host) -{ - // FIXME: Support IPv6 loopbacks. - return NSOrderedSame == [host compare:@"127.0.0.1"] || NSOrderedSame == [host caseInsensitiveCompare:@"localhost"]; -} - -BOOL hostIsUsedBySomeTestsToGenerateError(NSString *host) -{ - return NSOrderedSame == [host compare:@"255.255.255.255"]; -} - --(NSURLRequest *)webView: (WebView *)wv resource:identifier willSendRequest: (NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - willSendRequest %@ redirectResponse %@", identifier, [request _drt_descriptionSuitableForTestResult], - [redirectResponse _drt_descriptionSuitableForTestResult]]; - printf("%s\n", [string UTF8String]); - } - - if (!done && !gTestRunner->deferMainResourceDataLoad()) { - [dataSource _setDeferMainResourceDataLoad:false]; - } - - if (!done && gTestRunner->willSendRequestReturnsNull()) - return nil; - - if (!done && gTestRunner->willSendRequestReturnsNullOnRedirect() && redirectResponse) { - printf("Returning null for this redirect\n"); - return nil; - } - - NSURL *url = [request URL]; - NSString *host = [url host]; - if (host && (NSOrderedSame == [[url scheme] caseInsensitiveCompare:@"http"] || NSOrderedSame == [[url scheme] caseInsensitiveCompare:@"https"])) { - NSString *testPathOrURL = [NSString stringWithUTF8String:gTestRunner->testPathOrURL().c_str()]; - NSString *lowercaseTestPathOrURL = [testPathOrURL lowercaseString]; - NSString *testHost = 0; - if ([lowercaseTestPathOrURL hasPrefix:@"http:"] || [lowercaseTestPathOrURL hasPrefix:@"https:"]) - testHost = [[NSURL URLWithString:testPathOrURL] host]; - if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) && (!testHost || isLocalhost(testHost))) { - printf("Blocked access to external URL %s\n", [[url absoluteString] cStringUsingEncoding:NSUTF8StringEncoding]); - return nil; - } - } - - if (disallowedURLs && CFSetContainsValue(disallowedURLs, url)) - return nil; - - NSMutableURLRequest *newRequest = [request mutableCopy]; - const set<string>& clearHeaders = gTestRunner->willSendRequestClearHeaders(); - for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { - NSString *nsHeader = [[NSString alloc] initWithUTF8String:header->c_str()]; - [newRequest setValue:nil forHTTPHeaderField:nsHeader]; - [nsHeader release]; - } - const std::string& destination = gTestRunner->redirectionDestinationForURL([[url absoluteString] UTF8String]); - if (destination.length()) - [newRequest setURL:[NSURL URLWithString:[NSString stringWithUTF8String:destination.data()]]]; - - return [newRequest autorelease]; -} - -- (void)webView:(WebView *)wv resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource -{ - if (!gTestRunner->handlesAuthenticationChallenges()) { - NSString *string = [NSString stringWithFormat:@"%@ - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet", identifier]; - printf("%s\n", [string UTF8String]); - - [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; - return; - } - - const char* user = gTestRunner->authenticationUsername().c_str(); - NSString *nsUser = [NSString stringWithFormat:@"%s", user ? user : ""]; - - const char* password = gTestRunner->authenticationPassword().c_str(); - NSString *nsPassword = [NSString stringWithFormat:@"%s", password ? password : ""]; - - NSString *string = [NSString stringWithFormat:@"%@ - didReceiveAuthenticationChallenge - Responding with %@:%@", identifier, nsUser, nsPassword]; - printf("%s\n", [string UTF8String]); - - [[challenge sender] useCredential:[NSURLCredential credentialWithUser:nsUser password:nsPassword persistence:NSURLCredentialPersistenceForSession] - forAuthenticationChallenge:challenge]; -} - -- (void)webView:(WebView *)wv resource:(id)identifier didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource -{ -} - --(void)webView: (WebView *)wv resource:identifier didReceiveResponse: (NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didReceiveResponse %@", identifier, [response _drt_descriptionSuitableForTestResult]]; - printf("%s\n", [string UTF8String]); - } - if (!done && gTestRunner->dumpResourceResponseMIMETypes()) - printf("%s has MIME type %s\n", [[[[response URL] relativePath] lastPathComponent] UTF8String], [[response MIMEType] UTF8String]); -} - --(void)webView: (WebView *)wv resource:identifier didReceiveContentLength: (NSInteger)length fromDataSource:(WebDataSource *)dataSource -{ -} - --(void)webView: (WebView *)wv resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoading", identifier]; - printf("%s\n", [string UTF8String]); - } -} - --(void)webView: (WebView *)wv resource:identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadingWithError: %@", identifier, [error _drt_descriptionSuitableForTestResult]]; - printf("%s\n", [string UTF8String]); - } -} - -- (void)webView: (WebView *)wv plugInFailedWithError:(NSError *)error dataSource:(WebDataSource *)dataSource -{ - // The call to -display here simulates the "Plug-in not found" sheet that Safari shows. - // It is used for platform/mac/plugins/update-widget-from-style-recalc.html - [wv display]; -} - --(NSCachedURLResponse *) webView: (WebView *)wv resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource -{ - if (!done && gTestRunner->dumpWillCacheResponse()) { - NSString *string = [NSString stringWithFormat:@"%@ - willCacheResponse: called", identifier]; - printf("%s\n", [string UTF8String]); - } - return response; -} - --(BOOL)webView: (WebView*)webView shouldPaintBrokenImageForURL:(NSURL*)imageURL -{ - // Only log the message when shouldPaintBrokenImage() returns NO; this avoids changing results of layout tests with failed - // images, e.g., security/block-test-no-port.html. - if (!done && gTestRunner->dumpResourceLoadCallbacks() && !gTestRunner->shouldPaintBrokenImage()) { - NSString *string = [NSString stringWithFormat:@"%@ - shouldPaintBrokenImage: NO", [imageURL _drt_descriptionSuitableForTestResult]]; - printf("%s\n", [string UTF8String]); - } - - return gTestRunner->shouldPaintBrokenImage(); -} -@end diff --git a/Tools/DumpRenderTree/mac/TestRunnerMac.mm b/Tools/DumpRenderTree/mac/TestRunnerMac.mm deleted file mode 100644 index a7d07de46..000000000 --- a/Tools/DumpRenderTree/mac/TestRunnerMac.mm +++ /dev/null @@ -1,1119 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009, 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. - */ - -#import "config.h" -#import "DumpRenderTree.h" -#import "TestRunner.h" - -#import "DefaultPolicyDelegate.h" -#import "EditingDelegate.h" -#import "MockGeolocationProvider.h" -#import "MockWebNotificationProvider.h" -#import "PolicyDelegate.h" -#import "StorageTrackerDelegate.h" -#import "UIDelegate.h" -#import "WorkQueue.h" -#import "WorkQueueItem.h" -#import <Foundation/Foundation.h> -#import <JavaScriptCore/JSRetainPtr.h> -#import <JavaScriptCore/JSStringRef.h> -#import <JavaScriptCore/JSStringRefCF.h> -#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> -#import <WebKit/WebDOMOperationsPrivate.h> -#import <WebKit/WebDataSource.h> -#import <WebKit/WebDatabaseManagerPrivate.h> -#import <WebKit/WebDeviceOrientation.h> -#import <WebKit/WebDeviceOrientationProviderMock.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebFrameViewPrivate.h> -#import <WebKit/WebGeolocationPosition.h> -#import <WebKit/WebHTMLRepresentation.h> -#import <WebKit/WebHTMLViewPrivate.h> -#import <WebKit/WebHistory.h> -#import <WebKit/WebHistoryPrivate.h> -#import <WebKit/WebIconDatabasePrivate.h> -#import <WebKit/WebInspectorPrivate.h> -#import <WebKit/WebNSURLExtras.h> -#import <WebKit/WebKitErrors.h> -#import <WebKit/WebPreferences.h> -#import <WebKit/WebPreferencesPrivate.h> -#import <WebKit/WebQuotaManager.h> -#import <WebKit/WebScriptWorld.h> -#import <WebKit/WebSecurityOriginPrivate.h> -#import <WebKit/WebStorageManagerPrivate.h> -#import <WebKit/WebTypesInternal.h> -#import <WebKit/WebView.h> -#import <WebKit/WebViewPrivate.h> -#import <wtf/CurrentTime.h> -#import <wtf/HashMap.h> -#import <wtf/RetainPtr.h> - -@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem> -{ - SEL _action; -} -- (id)initWithAction:(SEL)action; -@end - -@implementation CommandValidationTarget - -- (id)initWithAction:(SEL)action -{ - self = [super init]; - if (!self) - return nil; - - _action = action; - return self; -} - -- (SEL)action -{ - return _action; -} - -- (NSInteger)tag -{ - return 0; -} - -@end - -@interface WebGeolocationPosition (Internal) -- (id)initWithGeolocationPosition:(PassRefPtr<WebCore::GeolocationPosition>)coreGeolocationPosition; -@end - -TestRunner::~TestRunner() -{ -} - -void TestRunner::addDisallowedURL(JSStringRef url) -{ - RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); - - if (!disallowedURLs) - disallowedURLs = CFSetCreateMutable(kCFAllocatorDefault, 0, NULL); - - // Canonicalize the URL - NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; - request = [NSURLProtocol canonicalRequestForRequest:request]; - - CFSetAddValue(disallowedURLs, [request URL]); -} - -bool TestRunner::callShouldCloseOnWebView() -{ - return [[mainFrame webView] shouldClose]; -} - -void TestRunner::clearAllApplicationCaches() -{ - [WebApplicationCache deleteAllApplicationCaches]; -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef 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]; - return usage; -} - -void TestRunner::syncLocalStorage() -{ - [[WebStorageManager sharedWebStorageManager] syncLocalStorage]; -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef 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]; - return usage; -} - -void TestRunner::observeStorageTrackerNotifications(unsigned number) -{ - [storageDelegate logNotifications:number controller:this]; -} - -void TestRunner::clearApplicationCacheForOrigin(JSStringRef url) -{ - RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); - - WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; - [WebApplicationCache deleteCacheForOrigin:origin]; - [origin release]; -} - -JSValueRef originsArrayToJS(JSContextRef context, NSArray *origins) -{ - NSUInteger count = [origins count]; - - JSValueRef jsOriginsArray[count]; - for (NSUInteger i = 0; i < count; i++) { - NSString *origin = [[origins objectAtIndex:i] databaseIdentifier]; - JSRetainPtr<JSStringRef> originJS(Adopt, JSStringCreateWithCFString((CFStringRef)origin)); - jsOriginsArray[i] = JSValueMakeString(context, originJS.get()); - } - - return JSObjectMakeArray(context, count, jsOriginsArray, NULL); -} - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - return originsArrayToJS(context, [WebApplicationCache originsWithCache]); -} - -void TestRunner::clearAllDatabases() -{ - [[WebDatabaseManager sharedWebDatabaseManager] deleteAllDatabases]; -} - -void TestRunner::deleteAllLocalStorage() -{ - [[WebStorageManager sharedWebStorageManager] deleteAllOrigins]; -} - -void TestRunner::setStorageDatabaseIdleInterval(double interval) -{ - [WebStorageManager setStorageDatabaseIdleInterval:interval]; -} - -void TestRunner::closeIdleLocalStorageDatabases() -{ - [WebStorageManager closeIdleLocalStorageDatabases]; -} - -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - return originsArrayToJS(context, [[WebStorageManager sharedWebStorageManager] origins]); -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) -{ - RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, URL)); - - WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]]; - [[WebStorageManager sharedWebStorageManager] deleteOrigin:origin]; - [origin release]; -} - -void TestRunner::clearBackForwardList() -{ - WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList]; - WebHistoryItem *item = [[backForwardList currentItem] retain]; - - // We clear the history by setting the back/forward list's capacity to 0 - // then restoring it back and adding back the current item. - int capacity = [backForwardList capacity]; - [backForwardList setCapacity:0]; - [backForwardList setCapacity:capacity]; - [backForwardList addItem:item]; - [backForwardList goToItem:item]; - [item release]; -} - -JSStringRef TestRunner::copyDecodedHostName(JSStringRef 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)); - NSString *nameNS = (NSString *)nameCF.get(); - return JSStringCreateWithCFString((CFStringRef)[nameNS _web_encodeHostName]); -} - -void TestRunner::display() -{ - displayWebView(); -} - -void TestRunner::keepWebHistory() -{ - if (![WebHistory optionalSharedHistory]) { - WebHistory *history = [[WebHistory alloc] init]; - [WebHistory setOptionalSharedHistory:history]; - [history release]; - } -} - -int TestRunner::numberOfPendingGeolocationPermissionRequests() -{ - return [[[mainFrame webView] UIDelegate] numberOfPendingGeolocationPermissionRequests]; -} - -size_t TestRunner::webHistoryItemCount() -{ - return [[[WebHistory optionalSharedHistory] allItems] count]; -} - -JSRetainPtr<JSStringRef> TestRunner::platformName() const -{ - JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("mac")); - return platformName; -} - -void TestRunner::notifyDone() -{ - if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) - dump(); - m_waitToDump = false; -} - -static inline std::string stringFromJSString(JSStringRef jsString) -{ - size_t maxBufferSize = JSStringGetMaximumUTF8CStringSize(jsString); - char* utf8Buffer = new char[maxBufferSize]; - size_t bytesWrittenToUTF8Buffer = JSStringGetUTF8CString(jsString, utf8Buffer, maxBufferSize); - std::string stdString(utf8Buffer, bytesWrittenToUTF8Buffer - 1); // bytesWrittenToUTF8Buffer includes a trailing \0 which std::string doesn't need. - delete[] utf8Buffer; - return stdString; -} - -static inline size_t indexOfSeparatorAfterDirectoryName(const std::string& directoryName, const std::string& fullPath) -{ - std::string searchKey = "/" + directoryName + "/"; - size_t indexOfSearchKeyStart = fullPath.rfind(searchKey); - if (indexOfSearchKeyStart == std::string::npos) { - ASSERT_NOT_REACHED(); - return 0; - } - // Callers expect the return value not to end in "/", so searchKey.length() - 1. - return indexOfSearchKeyStart + searchKey.length() - 1; -} - -static inline std::string resourceRootAbsolutePath(const std::string& testPathOrURL, const std::string& expectedRootName) -{ - char* localResourceRootEnv = getenv("LOCAL_RESOURCE_ROOT"); - if (localResourceRootEnv) - return std::string(localResourceRootEnv); - - // This fallback approach works for non-http tests and is useful - // in the case when we're running DRT directly from the command line. - return testPathOrURL.substr(0, indexOfSeparatorAfterDirectoryName(expectedRootName, testPathOrURL)); -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef localResourceJSString) -{ - // The passed in path will be an absolute path to the resource starting - // with "/tmp" or "/tmp/LayoutTests", optionally starting with the explicit file:// protocol. - // /tmp maps to DUMPRENDERTREE_TEMP, and /tmp/LayoutTests maps to LOCAL_RESOURCE_ROOT. - // FIXME: This code should work on all *nix platforms and can be moved into TestRunner.cpp. - std::string expectedRootName; - std::string absolutePathToResourceRoot; - std::string localResourceString = stringFromJSString(localResourceJSString); - - if (localResourceString.find("LayoutTests") != std::string::npos) { - expectedRootName = "LayoutTests"; - absolutePathToResourceRoot = resourceRootAbsolutePath(m_testPathOrURL, expectedRootName); - } else if (localResourceString.find("tmp") != std::string::npos) { - expectedRootName = "tmp"; - absolutePathToResourceRoot = getenv("DUMPRENDERTREE_TEMP"); - } else { - ASSERT_NOT_REACHED(); // pathToLocalResource was passed a path it doesn't know how to map. - } - ASSERT(!absolutePathToResourceRoot.empty()); - size_t indexOfSeparatorAfterRootName = indexOfSeparatorAfterDirectoryName(expectedRootName, localResourceString); - std::string absolutePathToLocalResource = absolutePathToResourceRoot + localResourceString.substr(indexOfSeparatorAfterRootName); - - // Note: It's important that we keep the file:// or http tests will get confused. - if (localResourceString.find("file://") != std::string::npos) { - ASSERT(absolutePathToLocalResource[0] == '/'); - absolutePathToLocalResource = std::string("file://") + absolutePathToLocalResource; - } - return JSStringCreateWithUTF8CString(absolutePathToLocalResource.c_str()); -} - -void TestRunner::queueLoad(JSStringRef url, JSStringRef target) -{ - RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url)); - NSString *urlNS = (NSString *)urlCF.get(); - - NSURL *nsurl = [NSURL URLWithString:urlNS relativeToURL:[[[mainFrame dataSource] response] URL]]; - NSString *nsurlString = [nsurl absoluteString]; - - JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString([nsurlString UTF8String])); - WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target)); -} - -void TestRunner::setAcceptsEditing(bool newAcceptsEditing) -{ - [(EditingDelegate *)[[mainFrame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing]; -} - -void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - if (alwaysAcceptCookies == m_alwaysAcceptCookies) - return; - - m_alwaysAcceptCookies = alwaysAcceptCookies; - NSHTTPCookieAcceptPolicy cookieAcceptPolicy = alwaysAcceptCookies ? NSHTTPCookieAcceptPolicyAlways : NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; - [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:cookieAcceptPolicy]; -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long size) -{ - [WebApplicationCache setMaximumSize:size]; -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) -{ - WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:@"http://127.0.0.1:8000"]]; - [[origin applicationCacheQuotaManager] setQuota:quota]; - [origin release]; -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool flag) -{ - [[[mainFrame webView] preferences] setAuthorAndUserStylesEnabled:flag]; -} - -void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - if (!setDelegate) { - [[mainFrame webView] setPolicyDelegate:defaultPolicyDelegate]; - return; - } - - [policyDelegate setPermissive:permissive]; - [[mainFrame webView] setPolicyDelegate:policyDelegate]; -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:@"file:///"]]; - [[origin databaseQuotaManager] setQuota:quota]; - [origin release]; -} - -void TestRunner::goBack() -{ - [[mainFrame webView] goBack]; -} - -void TestRunner::setDefersLoading(bool defers) -{ - [[mainFrame webView] setDefersCallbacks:defers]; -} - -void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) -{ - RetainPtr<CFStringRef> schemeCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, scheme)); - [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()]; -} - -void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) -{ - // DumpRenderTree configured the WebView to use WebDeviceOrientationProviderMock. - id<WebDeviceOrientationProvider> provider = [[mainFrame webView] _deviceOrientationProvider]; - WebDeviceOrientationProviderMock *mockProvider = static_cast<WebDeviceOrientationProviderMock*>(provider); - WebDeviceOrientation *orientation = [[WebDeviceOrientation alloc] initWithCanProvideAlpha:canProvideAlpha alpha:alpha canProvideBeta:canProvideBeta beta:beta canProvideGamma:canProvideGamma gamma:gamma]; - [mockProvider setOrientation:orientation]; - [orientation release]; -} - -void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) -{ - WebGeolocationPosition *position = nil; - if (!providesAltitude && !providesAltitudeAccuracy && !providesHeading && !providesSpeed) { - // Test the exposed API. - position = [[WebGeolocationPosition alloc] initWithTimestamp:currentTime() latitude:latitude longitude:longitude accuracy:accuracy]; - } else { - RefPtr<WebCore::GeolocationPosition> coreGeolocationPosition = WebCore::GeolocationPosition::create(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); - position = [[WebGeolocationPosition alloc] initWithGeolocationPosition:(coreGeolocationPosition.release())]; - } - [[MockGeolocationProvider shared] setPosition:position]; - [position release]; -} - -void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) -{ - RetainPtr<CFStringRef> messageCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, message)); - NSString *messageNS = (NSString *)messageCF.get(); - [[MockGeolocationProvider shared] setPositionUnavailableErrorWithMessage:messageNS]; -} - -void TestRunner::setGeolocationPermission(bool allow) -{ - setGeolocationPermissionCommon(allow); - [[[mainFrame webView] UIDelegate] didSetMockGeolocationPermission]; -} - -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: Workaround <rdar://problem/6480108> - static WebIconDatabase *sharedWebIconDatabase = NULL; - if (!sharedWebIconDatabase) { - if (!iconDatabaseEnabled) - return; - sharedWebIconDatabase = [WebIconDatabase sharedIconDatabase]; - if ([sharedWebIconDatabase isEnabled] == iconDatabaseEnabled) - return; - } - [sharedWebIconDatabase setEnabled:iconDatabaseEnabled]; -} - -void TestRunner::setMainFrameIsFirstResponder(bool flag) -{ - NSView *documentView = [[mainFrame frameView] documentView]; - - NSResponder *firstResponder = flag ? documentView : nil; - [[[mainFrame webView] window] makeFirstResponder:firstResponder]; -} - -void TestRunner::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) -{ - [[[mainFrame webView] preferences] setPrivateBrowsingEnabled:privateBrowsingEnabled]; -} - -void TestRunner::setXSSAuditorEnabled(bool enabled) -{ - [[[mainFrame webView] preferences] setXSSAuditorEnabled:enabled]; -} - -void TestRunner::setSpatialNavigationEnabled(bool enabled) -{ - [[[mainFrame webView] preferences] setSpatialNavigationEnabled:enabled]; -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) -{ - [[[mainFrame webView] preferences] setAllowUniversalAccessFromFileURLs:enabled]; -} - -void TestRunner::setAllowFileAccessFromFileURLs(bool enabled) -{ - [[[mainFrame webView] preferences] setAllowFileAccessFromFileURLs:enabled]; -} - -void TestRunner::setPopupBlockingEnabled(bool popupBlockingEnabled) -{ - [[[mainFrame webView] preferences] setJavaScriptCanOpenWindowsAutomatically:!popupBlockingEnabled]; -} - -void TestRunner::setPluginsEnabled(bool pluginsEnabled) -{ - [[[mainFrame webView] preferences] setPlugInsEnabled:pluginsEnabled]; -} - -void TestRunner::setJavaScriptCanAccessClipboard(bool enabled) -{ - [[[mainFrame webView] preferences] setJavaScriptCanAccessClipboard:enabled]; -} - -void TestRunner::setAutomaticLinkDetectionEnabled(bool enabled) -{ - [[mainFrame webView] setAutomaticLinkDetectionEnabled:enabled]; -} - -void TestRunner::setTabKeyCyclesThroughElements(bool cycles) -{ - [[mainFrame webView] setTabKeyCyclesThroughElements:cycles]; -} - -void TestRunner::setUseDashboardCompatibilityMode(bool flag) -{ - [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag]; -} - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ - [[WebPreferences standardPreferences] setUserStyleSheetEnabled:flag]; -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef path) -{ - RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path)); - NSURL *url = [NSURL URLWithString:(NSString *)pathCF.get()]; - [[WebPreferences standardPreferences] setUserStyleSheetLocation:url]; -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) -{ - DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject]; - if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]]) - return; - - RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); - [(DOMHTMLInputElement *)element setValueForUser:(NSString *)valueCF.get()]; -} - -void TestRunner::setViewModeMediaFeature(JSStringRef mode) -{ - // FIXME: implement -} - -void TestRunner::dispatchPendingLoadRequests() -{ - [[mainFrame webView] _dispatchPendingLoadRequests]; -} - -void TestRunner::overridePreference(JSStringRef key, JSStringRef value) -{ - RetainPtr<CFStringRef> keyCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, key)); - NSString *keyNS = (NSString *)keyCF.get(); - - RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); - NSString *valueNS = (NSString *)valueCF.get(); - - [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS]; -} - -void TestRunner::removeAllVisitedLinks() -{ - [WebHistory _removeAllVisitedLinks]; -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) -{ - RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); - ::setPersistentUserStyleSheetLocation(urlString.get()); -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - ::setPersistentUserStyleSheetLocation(0); -} - -void TestRunner::setWindowIsKey(bool windowIsKey) -{ - m_windowIsKey = windowIsKey; - [[mainFrame webView] _updateActiveState]; -} - -static const CFTimeInterval waitToDumpWatchdogInterval = 30.0; - -static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info) -{ - gTestRunner->waitToDumpWatchdogTimerFired(); -} - -void TestRunner::setWaitToDump(bool waitUntilDone) -{ - m_waitToDump = waitUntilDone; - if (m_waitToDump && shouldSetWaitToDumpWatchdog()) - setWaitToDumpWatchdog(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogInterval, 0, 0, 0, waitUntilDoneWatchdogFired, NULL)); -} - -int TestRunner::windowCount() -{ - return CFArrayGetCount(openWindowsRef); -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)); - NSString *nameNS = (NSString *)nameCF.get(); - - RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value)); - NSString *valueNS = (NSString *)valueCF.get(); - - [[mainFrame webView] _executeCoreCommandByName:nameNS value:valueNS]; -} - -bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) -{ - WebFindOptions options = 0; - - JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); - JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0); - if (!JSValueIsNumber(context, lengthValue)) - return false; - - 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) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0); - if (!JSValueIsString(context, value)) - continue; - - JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0)); - - if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive")) - options |= WebFindOptionsCaseInsensitive; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) - options |= WebFindOptionsAtWordStarts; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) - options |= WebFindOptionsTreatMedialCapitalAsWordStart; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) - options |= WebFindOptionsBackwards; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) - options |= WebFindOptionsWrapAround; - else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) - options |= WebFindOptionsStartInSelection; - } - - return [[mainFrame webView] findString:(NSString *)targetCFString.get() options:options]; -} - -void TestRunner::setCacheModel(int cacheModel) -{ - [[WebPreferences standardPreferences] setCacheModel:cacheModel]; -} - -bool TestRunner::isCommandEnabled(JSStringRef 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. - if (![nameNS hasSuffix:@":"] && [nameNS length]) { - nameNS = [[[[nameNS substringToIndex:1] lowercaseString] - stringByAppendingString:[nameNS substringFromIndex:1]] - stringByAppendingString:@":"]; - } - - SEL selector = NSSelectorFromString(nameNS); - RetainPtr<CommandValidationTarget> target = adoptNS([[CommandValidationTarget alloc] initWithAction:selector]); - id validator = [NSApp targetForAction:selector to:[mainFrame webView] from:target.get()]; - if (!validator) - return false; - if (![validator respondsToSelector:selector]) - return false; - if (![validator respondsToSelector:@selector(validateUserInterfaceItem:)]) - return true; - return [validator validateUserInterfaceItem:target.get()]; -} - -void TestRunner::waitForPolicyDelegate() -{ - setWaitToDump(true); - [policyDelegate setControllerToNotifyDone:this]; - [[mainFrame webView] setPolicyDelegate:policyDelegate]; -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin)); - NSString *sourceOriginNS = (NSString *)sourceOriginCF.get(); - RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); - NSString *destinationProtocolNS = (NSString *)protocolCF.get(); - 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)); - NSString *sourceOriginNS = (NSString *)sourceOriginCF.get(); - RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol)); - NSString *destinationProtocolNS = (NSString *)protocolCF.get(); - RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost)); - NSString *destinationHostNS = (NSString *)hostCF.get(); - [WebView _removeOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains]; -} - -void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) -{ - // FIXME: implement -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - 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)); - 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)]; -} - -void TestRunner::setDeveloperExtrasEnabled(bool enabled) -{ - [[[mainFrame webView] preferences] setDeveloperExtrasEnabled:enabled]; -} - -void TestRunner::showWebInspector() -{ - [[[mainFrame webView] inspector] show:nil]; -} - -void TestRunner::closeWebInspector() -{ - [[[mainFrame webView] inspector] close:nil]; -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script)); - NSString *scriptNS = (NSString *)scriptCF.get(); - [[[mainFrame webView] inspector] evaluateInFrontend:nil callId:callId script:scriptNS]; -} - -typedef HashMap<unsigned, RetainPtr<WebScriptWorld> > WorldMap; -static WorldMap& worldMap() -{ - static WorldMap& map = *new WorldMap; - return map; -} - -unsigned worldIDForWorld(WebScriptWorld *world) -{ - WorldMap::const_iterator end = worldMap().end(); - for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { - if (it->value == world) - return it->key; - } - - return 0; -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - // FIXME: Implement this. -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef 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 - // that is created once and cached forever. - WebScriptWorld *world; - if (!worldID) - world = [WebScriptWorld world]; - else { - RetainPtr<WebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value; - if (!worldSlot) - worldSlot = adoptNS([[WebScriptWorld alloc] init]); - world = worldSlot.get(); - } - - [mainFrame _stringByEvaluatingJavaScriptFromString:scriptNS withGlobalObject:globalObject inScriptWorld:world]; -} - -@interface APITestDelegate : NSObject -{ - bool* m_condition; -} -@end - -@implementation APITestDelegate - -- (id)initWithCompletionCondition:(bool*)condition -{ - [super init]; - ASSERT(condition); - m_condition = condition; - *m_condition = false; - return self; -} - -- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame -{ - printf("API Test load failed\n"); - *m_condition = true; -} - -- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame -{ - printf("API Test load failed provisional\n"); - *m_condition = true; -} - -- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame -{ - printf("API Test load succeeded\n"); - *m_condition = true; -} - -@end - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - RetainPtr<CFStringRef> utf8DataCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, utf8Data)); - RetainPtr<CFStringRef> baseURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, baseURL)); - - WebView *webView = [[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""]; - - bool done = false; - APITestDelegate *delegate = [[APITestDelegate alloc] initWithCompletionCondition:&done]; - [webView setFrameLoadDelegate:delegate]; - - [[webView mainFrame] loadData:[(NSString *)utf8DataCF.get() dataUsingEncoding:NSUTF8StringEncoding] MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()]]; - - while (!done) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; - [pool release]; - } - - [webView close]; - [webView release]; - [delegate release]; - [pool release]; -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - WebView *view = [mainFrame webView]; - [view goToBackForwardItem:[[view backForwardList] currentItem]]; -} - -void TestRunner::setWebViewEditable(bool editable) -{ - WebView *view = [mainFrame webView]; - [view setEditable:editable]; -} - -static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoaderRunLoopMode"; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 -@protocol NSURLConnectionDelegate <NSObject> -@end -#endif - -@interface SynchronousLoader : NSObject <NSURLConnectionDelegate> -{ - NSString *m_username; - NSString *m_password; - BOOL m_isDone; -} -+ (void)makeRequest:(NSURLRequest *)request withUsername:(NSString *)username password:(NSString *)password; -@end - -@implementation SynchronousLoader : NSObject -- (void)dealloc -{ - [m_username release]; - [m_password release]; - - [super dealloc]; -} - -- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection -{ - return YES; -} - -- (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]); - [[challenge sender] useCredential:credential.get() forAuthenticationChallenge:challenge]; - return; - } - [[challenge sender] cancelAuthenticationChallenge:challenge]; -} - -- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error -{ - printf("SynchronousLoader failed: %s\n", [[error description] UTF8String]); - m_isDone = YES; -} - -- (void)connectionDidFinishLoading:(NSURLConnection *)connection -{ - m_isDone = YES; -} - -+ (void)makeRequest:(NSURLRequest *)request withUsername:(NSString *)username password:(NSString *)password -{ - ASSERT(![[request URL] user]); - ASSERT(![[request URL] password]); - - SynchronousLoader *delegate = [[SynchronousLoader alloc] init]; - delegate->m_username = [username copy]; - delegate->m_password = [password copy]; - - NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:delegate startImmediately:NO]; - [connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:SynchronousLoaderRunLoopMode]; - [connection start]; - - while (!delegate->m_isDone) - [[NSRunLoop currentRunLoop] runMode:SynchronousLoaderRunLoopMode beforeDate:[NSDate distantFuture]]; - - [connection cancel]; - - [connection release]; - [delegate release]; -} - -@end - -void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) -{ - // See <rdar://problem/7880699>. - 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()]]); - - [SynchronousLoader makeRequest:request.get() withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()]; -} - -void TestRunner::abortModal() -{ - [NSApp abortModal]; -} - -void TestRunner::setSerializeHTTPLoads(bool serialize) -{ - [WebView _setLoadResourcesSerially:serialize]; -} - -void TestRunner::setTextDirection(JSStringRef directionName) -{ - if (JSStringIsEqualToUTF8CString(directionName, "ltr")) - [[mainFrame webView] makeBaseWritingDirectionLeftToRight:0]; - else if (JSStringIsEqualToUTF8CString(directionName, "rtl")) - [[mainFrame webView] makeBaseWritingDirectionRightToLeft:0]; - else - ASSERT_NOT_REACHED(); -} - -void TestRunner::addChromeInputField() -{ - NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 20)]; - textField.tag = 1; - [[[[mainFrame webView] window] contentView] addSubview:textField]; - [textField release]; - - [textField setNextKeyView:[mainFrame webView]]; - [[mainFrame webView] setNextKeyView:textField]; -} - -void TestRunner::removeChromeInputField() -{ - NSView* textField = [[[[mainFrame webView] window] contentView] viewWithTag:1]; - if (textField) { - [textField removeFromSuperview]; - focusWebView(); - } -} - -void TestRunner::focusWebView() -{ - [[[mainFrame webView] window] makeFirstResponder:[mainFrame webView]]; -} - -void TestRunner::setBackingScaleFactor(double backingScaleFactor) -{ - [[mainFrame webView] _setCustomBackingScaleFactor:backingScaleFactor]; -} - -void TestRunner::resetPageVisibility() -{ - WebView *webView = [mainFrame webView]; - if ([webView respondsToSelector:@selector(_setVisibilityState:isInitialState:)]) - [webView _setVisibilityState:WebPageVisibilityStateVisible isInitialState:YES]; -} - -void TestRunner::setPageVisibility(const char* newVisibility) -{ - if (!newVisibility) - return; - - WebView *webView = [mainFrame webView]; - if (!strcmp(newVisibility, "visible")) - [webView _setVisibilityState:WebPageVisibilityStateVisible isInitialState:NO]; - else if (!strcmp(newVisibility, "hidden")) - [webView _setVisibilityState:WebPageVisibilityStateHidden isInitialState:NO]; - else if (!strcmp(newVisibility, "prerender")) - [webView _setVisibilityState:WebPageVisibilityStatePrerender isInitialState:NO]; - else if (!strcmp(newVisibility, "unloaded")) - [webView _setVisibilityState:WebPageVisibilityStateUnloaded isInitialState:NO]; -} - -void TestRunner::grantWebNotificationPermission(JSStringRef 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)); - ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]); - [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:FALSE]; -} - -void TestRunner::removeAllWebNotificationPermissions() -{ - [[MockWebNotificationProvider shared] removeAllWebNotificationPermissions]; -} - -void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) -{ - uint64_t notificationID = [[mainFrame webView] _notificationIDForTesting:jsNotification]; - m_hasPendingWebNotificationClick = true; - dispatch_async(dispatch_get_main_queue(), ^{ - if (!m_hasPendingWebNotificationClick) - return; - - [[MockWebNotificationProvider shared] simulateWebNotificationClick:notificationID]; - m_hasPendingWebNotificationClick = false; - }); -} - -void TestRunner::simulateLegacyWebNotificationClick(JSStringRef jsTitle) -{ -} - diff --git a/Tools/DumpRenderTree/mac/TextInputController.h b/Tools/DumpRenderTree/mac/TextInputController.h deleted file mode 100644 index 767e72f0c..000000000 --- a/Tools/DumpRenderTree/mac/TextInputController.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, 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. - */ - -#import <Foundation/Foundation.h> - -@class WebView; -@class WebHTMLView; -@class WebScriptObject; - -@interface TextInputController : NSObject -{ - WebView *webView; - WebHTMLView *inputMethodView; - WebScriptObject *inputMethodHandler; -} -- (id)initWithWebView:(WebView *)view; -@end diff --git a/Tools/DumpRenderTree/mac/TextInputController.m b/Tools/DumpRenderTree/mac/TextInputController.m deleted file mode 100644 index 91dbd84a1..000000000 --- a/Tools/DumpRenderTree/mac/TextInputController.m +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (C) 2005, 2007 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. - */ - -#import "config.h" -#import "TextInputController.h" - -#import "DumpRenderTreeMac.h" -#import <AppKit/NSInputManager.h> -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 -#define SUPPORT_DICTATION_ALTERNATIVES -#import <AppKit/NSTextAlternatives.h> -#endif -#import <WebKit/WebDocument.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebFramePrivate.h> -#import <WebKit/WebFrameView.h> -#import <WebKit/WebHTMLViewPrivate.h> -#import <WebKit/WebScriptObject.h> -#import <WebKit/WebTypesInternal.h> -#import <WebKit/WebView.h> - -@interface TextInputController (DumpRenderTreeInputMethodHandler) -- (BOOL)interpretKeyEvents:(NSArray *)eventArray withSender:(WebHTMLView *)sender; -@end - -@interface WebHTMLView (DumpRenderTreeInputMethodHandler) -- (void)interpretKeyEvents:(NSArray *)eventArray; -@end - -@interface WebHTMLView (WebKitSecretsTextInputControllerIsAwareOf) -- (WebFrame *)_frame; -@end - -@implementation WebHTMLView (DumpRenderTreeInputMethodHandler) -- (void)interpretKeyEvents:(NSArray *)eventArray -{ - WebScriptObject *obj = [[self _frame] windowObject]; - TextInputController *tic = [obj valueForKey:@"textInputController"]; - if (![tic interpretKeyEvents:eventArray withSender:self]) - [super interpretKeyEvents:eventArray]; -} -@end - -@implementation NSMutableAttributedString (TextInputController) - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (aSelector == @selector(string) - || aSelector == @selector(getLength) - || aSelector == @selector(attributeNamesAtIndex:) - || aSelector == @selector(valueOfAttribute:atIndex:) - || aSelector == @selector(addAttribute:value:) - || aSelector == @selector(addAttribute:value:from:length:) - || aSelector == @selector(addColorAttribute:red:green:blue:alpha:) - || aSelector == @selector(addColorAttribute:red:green:blue:alpha:from:length:) - || aSelector == @selector(addFontAttribute:fontName:size:) - || aSelector == @selector(addFontAttribute:fontName:size:from:length:)) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(getLength)) - return @"length"; - if (aSelector == @selector(attributeNamesAtIndex:)) - return @"getAttributeNamesAtIndex"; - if (aSelector == @selector(valueOfAttribute:atIndex:)) - return @"getAttributeValueAtIndex"; - if (aSelector == @selector(addAttribute:value:)) - return @"addAttribute"; - if (aSelector == @selector(addAttribute:value:from:length:)) - return @"addAttributeForRange"; - if (aSelector == @selector(addColorAttribute:red:green:blue:alpha:)) - return @"addColorAttribute"; - if (aSelector == @selector(addColorAttribute:red:green:blue:alpha:from:length:)) - return @"addColorAttributeForRange"; - if (aSelector == @selector(addFontAttribute:fontName:size:)) - return @"addFontAttribute"; - if (aSelector == @selector(addFontAttribute:fontName:size:from:length:)) - return @"addFontAttributeForRange"; - - return nil; -} - -- (int)getLength -{ - return (int)[self length]; -} - -- (NSArray *)attributeNamesAtIndex:(int)index -{ - NSDictionary *attributes = [self attributesAtIndex:(unsigned)index effectiveRange:nil]; - return [attributes allKeys]; -} - -- (id)valueOfAttribute:(NSString *)attrName atIndex:(int)index -{ - return [self attribute:attrName atIndex:(unsigned)index effectiveRange:nil]; -} - -- (void)addAttribute:(NSString *)attrName value:(id)value -{ - [self addAttribute:attrName value:value range:NSMakeRange(0, [self length])]; -} - -- (void)addAttribute:(NSString *)attrName value:(id)value from:(int)from length:(int)length -{ - [self addAttribute:attrName value:value range:NSMakeRange((unsigned)from, (unsigned)length)]; -} - -- (void)addColorAttribute:(NSString *)attrName red:(float)red green:(float)green blue:(float)blue alpha:(float)alpha -{ - [self addAttribute:attrName value:[NSColor colorWithDeviceRed:red green:green blue:blue alpha:alpha] range:NSMakeRange(0, [self length])]; -} - -- (void)addColorAttribute:(NSString *)attrName red:(float)red green:(float)green blue:(float)blue alpha:(float)alpha from:(int)from length:(int)length -{ - [self addAttribute:attrName value:[NSColor colorWithDeviceRed:red green:green blue:blue alpha:alpha] range:NSMakeRange((unsigned)from, (unsigned)length)]; -} - -- (void)addFontAttribute:(NSString *)attrName fontName:(NSString *)fontName size:(float)fontSize -{ - [self addAttribute:attrName value:[NSFont fontWithName:fontName size:fontSize] range:NSMakeRange(0, [self length])]; -} - -- (void)addFontAttribute:(NSString *)attrName fontName:(NSString *)fontName size:(float)fontSize from:(int)from length:(int)length -{ - [self addAttribute:attrName value:[NSFont fontWithName:fontName size:fontSize] range:NSMakeRange((unsigned)from, (unsigned)length)]; -} - -@end - -@implementation TextInputController - -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector -{ - if (aSelector == @selector(insertText:) - || aSelector == @selector(doCommand:) - || aSelector == @selector(setMarkedText:selectedFrom:length:) - || aSelector == @selector(unmarkText) - || aSelector == @selector(hasMarkedText) - || aSelector == @selector(conversationIdentifier) - || aSelector == @selector(substringFrom:length:) - || aSelector == @selector(attributedSubstringFrom:length:) - || aSelector == @selector(markedRange) - || aSelector == @selector(selectedRange) - || aSelector == @selector(firstRectForCharactersFrom:length:) - || aSelector == @selector(characterIndexForPointX:Y:) - || aSelector == @selector(validAttributesForMarkedText) - || aSelector == @selector(attributedStringWithString:) - || aSelector == @selector(setInputMethodHandler:) - || aSelector == @selector(dictatedStringWithPrimaryString:alternative:alternativeOffset:alternativeLength:)) - return NO; - return YES; -} - -+ (NSString *)webScriptNameForSelector:(SEL)aSelector -{ - if (aSelector == @selector(insertText:)) - return @"insertText"; - else if (aSelector == @selector(doCommand:)) - return @"doCommand"; - else if (aSelector == @selector(setMarkedText:selectedFrom:length:)) - return @"setMarkedText"; - else if (aSelector == @selector(substringFrom:length:)) - return @"substringFromRange"; - else if (aSelector == @selector(attributedSubstringFrom:length:)) - return @"attributedSubstringFromRange"; - else if (aSelector == @selector(firstRectForCharactersFrom:length:)) - return @"firstRectForCharacterRange"; - else if (aSelector == @selector(characterIndexForPointX:Y:)) - return @"characterIndexForPoint"; - else if (aSelector == @selector(attributedStringWithString:)) - return @"makeAttributedString"; // just a factory method, doesn't call into NSTextInput - else if (aSelector == @selector(setInputMethodHandler:)) - return @"setInputMethodHandler"; - else if (aSelector == @selector(dictatedStringWithPrimaryString:alternative:alternativeOffset:alternativeLength:)) - return @"makeDictatedString"; - - return nil; -} - -- (id)initWithWebView:(WebView *)wv -{ - self = [super init]; - webView = wv; - inputMethodView = nil; - inputMethodHandler = nil; - return self; -} - -- (void)dealloc -{ - [inputMethodHandler release]; - inputMethodHandler = nil; - - [super dealloc]; -} - -- (NSObject <NSTextInput> *)textInput -{ - NSView <NSTextInput> *view = inputMethodView ? inputMethodView : (id)[[[webView mainFrame] frameView] documentView]; - return [view conformsToProtocol:@protocol(NSTextInput)] ? view : nil; -} - -- (void)insertText:(id)aString -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - [textInput insertText:aString]; -} - -- (void)doCommand:(NSString *)aCommand -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - [textInput doCommandBySelector:NSSelectorFromString(aCommand)]; -} - -- (void)setMarkedText:(NSString *)aString selectedFrom:(int)from length:(int)length -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - [textInput setMarkedText:aString selectedRange:NSMakeRange(from, length)]; -} - -- (void)unmarkText -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - [textInput unmarkText]; -} - -- (BOOL)hasMarkedText -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - return [textInput hasMarkedText]; - - return FALSE; -} - -- (long)conversationIdentifier -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - return [textInput conversationIdentifier]; - - return 0; -} - -- (NSString *)substringFrom:(int)from length:(int)length -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - return [[textInput attributedSubstringFromRange:NSMakeRange(from, length)] string]; - - return @""; -} - -- (NSMutableAttributedString *)attributedSubstringFrom:(int)from length:(int)length -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - NSMutableAttributedString *ret = [[[NSMutableAttributedString alloc] init] autorelease]; - - if (textInput) - [ret setAttributedString:[textInput attributedSubstringFromRange:NSMakeRange(from, length)]]; - - return ret; -} - -- (NSArray *)markedRange -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) { - NSRange range = [textInput markedRange]; - return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:range.location], [NSNumber numberWithUnsignedInt:range.length], nil]; - } - - return nil; -} - -- (NSArray *)selectedRange -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) { - NSRange range = [textInput selectedRange]; - return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:range.location], [NSNumber numberWithUnsignedInt:range.length], nil]; - } - - return nil; -} - - -- (NSArray *)firstRectForCharactersFrom:(int)from length:(int)length -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) { - NSRect rect = [textInput firstRectForCharacterRange:NSMakeRange(from, length)]; - if (rect.origin.x || rect.origin.y || rect.size.width || rect.size.height) { - rect.origin = [[webView window] convertScreenToBase:rect.origin]; - rect = [webView convertRect:rect fromView:nil]; - } - return [NSArray arrayWithObjects: - [NSNumber numberWithFloat:rect.origin.x], - [NSNumber numberWithFloat:rect.origin.y], - [NSNumber numberWithFloat:rect.size.width], - [NSNumber numberWithFloat:rect.size.height], - nil]; - } - - return nil; -} - -- (NSInteger)characterIndexForPointX:(float)x Y:(float)y -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) { - NSPoint point = NSMakePoint(x, y); - point = [webView convertPoint:point toView:nil]; - point = [[webView window] convertBaseToScreen:point]; - NSInteger index = [textInput characterIndexForPoint:point]; - if (index == NSNotFound) - return -1; - - return index; - } - - return 0; -} - -- (NSArray *)validAttributesForMarkedText -{ - NSObject <NSTextInput> *textInput = [self textInput]; - - if (textInput) - return [textInput validAttributesForMarkedText]; - - return nil; -} - -- (NSMutableAttributedString *)attributedStringWithString:(NSString *)aString -{ - return [[[NSMutableAttributedString alloc] initWithString:aString] autorelease]; -} - -- (NSMutableAttributedString*)dictatedStringWithPrimaryString:(NSString*)aString alternative:(NSString*)alternative alternativeOffset:(int)offset alternativeLength:(int)length -{ -#if defined(SUPPORT_DICTATION_ALTERNATIVES) - NSMutableAttributedString* dictatedString = [self attributedStringWithString:aString]; - NSRange rangeWithAlternative = NSMakeRange((NSUInteger)offset, (NSUInteger)length); - NSString* subStringWithAlternative = [aString substringWithRange:rangeWithAlternative]; - if (!subStringWithAlternative) - return nil; - - NSTextAlternatives* alternativeObject = [[[NSTextAlternatives alloc] initWithPrimaryString:subStringWithAlternative alternativeStrings:[NSArray arrayWithObject:alternative]] autorelease]; - if (!alternativeObject) - return nil; - - [dictatedString addAttribute:NSTextAlternativesAttributeName value:alternativeObject range:rangeWithAlternative]; - - return dictatedString; -#else - return nil; -#endif -} - -- (void)setInputMethodHandler:(WebScriptObject *)handler -{ - if (inputMethodHandler == handler) - return; - [handler retain]; - [inputMethodHandler release]; - inputMethodHandler = handler; -} - -- (BOOL)interpretKeyEvents:(NSArray *)eventArray withSender:(WebHTMLView *)sender -{ - if (!inputMethodHandler) - return NO; - - inputMethodView = sender; - - NSEvent *event = [eventArray objectAtIndex:0]; - unsigned modifierFlags = [event modifierFlags]; - NSMutableArray *modifiers = [[NSMutableArray alloc] init]; - if (modifierFlags & NSAlphaShiftKeyMask) - [modifiers addObject:@"NSAlphaShiftKeyMask"]; - if (modifierFlags & NSShiftKeyMask) - [modifiers addObject:@"NSShiftKeyMask"]; - if (modifierFlags & NSControlKeyMask) - [modifiers addObject:@"NSControlKeyMask"]; - if (modifierFlags & NSAlternateKeyMask) - [modifiers addObject:@"NSAlternateKeyMask"]; - if (modifierFlags & NSCommandKeyMask) - [modifiers addObject:@"NSCommandKeyMask"]; - if (modifierFlags & NSNumericPadKeyMask) - [modifiers addObject:@"NSNumericPadKeyMask"]; - if (modifierFlags & NSHelpKeyMask) - [modifiers addObject:@"NSHelpKeyMask"]; - if (modifierFlags & NSFunctionKeyMask) - [modifiers addObject:@"NSFunctionKeyMask"]; - - WebScriptObject* eventParam = [inputMethodHandler evaluateWebScript:@"new Object();"]; - [eventParam setValue:[event characters] forKey:@"characters"]; - [eventParam setValue:[event charactersIgnoringModifiers] forKey:@"charactersIgnoringModifiers"]; - [eventParam setValue:[NSNumber numberWithBool:[event isARepeat]] forKey:@"isARepeat"]; - [eventParam setValue:[NSNumber numberWithUnsignedShort:[event keyCode]] forKey:@"keyCode"]; - [eventParam setValue:modifiers forKey:@"modifierFlags"]; - - [modifiers release]; - - id result = [inputMethodHandler callWebScriptMethod:@"call" withArguments:[NSArray arrayWithObjects:inputMethodHandler, eventParam, nil]]; - if (![result respondsToSelector:@selector(boolValue)] || ![result boolValue]) - [sender doCommandBySelector:@selector(noop:)]; // AppKit sends noop: if the ime does not handle an event - - inputMethodView = nil; - return YES; -} - -@end diff --git a/Tools/DumpRenderTree/mac/UIDelegate.h b/Tools/DumpRenderTree/mac/UIDelegate.h deleted file mode 100644 index 982b4802c..000000000 --- a/Tools/DumpRenderTree/mac/UIDelegate.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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. - */ - -#import <Cocoa/Cocoa.h> - -@interface UIDelegate : NSObject { - -@private - NSRect m_frame; - NSMutableSet *m_pendingGeolocationPermissionListeners; - NSTimer *m_timer; -} - -- (void)didSetMockGeolocationPermission; -- (int)numberOfPendingGeolocationPermissionRequests; - -@end diff --git a/Tools/DumpRenderTree/mac/UIDelegate.mm b/Tools/DumpRenderTree/mac/UIDelegate.mm deleted file mode 100644 index 3473d1797..000000000 --- a/Tools/DumpRenderTree/mac/UIDelegate.mm +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2006. 2007 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. - */ - -#import "config.h" -#import "UIDelegate.h" - -#import "DumpRenderTree.h" -#import "DumpRenderTreeDraggingInfo.h" -#import "EventSendingController.h" -#import "MockWebNotificationProvider.h" -#import "TestRunner.h" -#import <WebKit/WebApplicationCache.h> -#import <WebKit/WebFramePrivate.h> -#import <WebKit/WebHTMLViewPrivate.h> -#import <WebKit/WebQuotaManager.h> -#import <WebKit/WebSecurityOriginPrivate.h> -#import <WebKit/WebUIDelegatePrivate.h> -#import <WebKit/WebView.h> -#import <WebKit/WebViewPrivate.h> -#import <wtf/Assertions.h> - -DumpRenderTreeDraggingInfo *draggingInfo = nil; - -@implementation UIDelegate - -- (void)webView:(WebView *)sender setFrame:(NSRect)frame -{ - m_frame = frame; -} - -- (NSRect)webViewFrame:(WebView *)sender -{ - return m_frame; -} - -- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary withSource:(NSString *)source -{ - NSString *message = [dictionary objectForKey:@"message"]; - NSNumber *lineNumber = [dictionary objectForKey:@"lineNumber"]; - - NSRange range = [message rangeOfString:@"file://"]; - if (range.location != NSNotFound) - message = [[message substringToIndex:range.location] stringByAppendingString:[[message substringFromIndex:NSMaxRange(range)] lastPathComponent]]; - - printf ("CONSOLE MESSAGE: "); - if ([lineNumber intValue]) - printf ("line %d: ", [lineNumber intValue]); - printf ("%s\n", [message UTF8String]); -} - -- (void)modalWindowWillClose:(NSNotification *)notification -{ - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:nil]; - [NSApp abortModal]; -} - -- (void)webViewRunModal:(WebView *)sender -{ - gTestRunner->setWindowIsKey(false); - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modalWindowWillClose:) name:NSWindowWillCloseNotification object:nil]; - [NSApp runModalForWindow:[sender window]]; - gTestRunner->setWindowIsKey(true); -} - -- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame -{ - if (!done) { - printf("ALERT: %s\n", [message UTF8String]); - fflush(stdout); - } -} - -- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame -{ - if (!done) - printf("CONFIRM: %s\n", [message UTF8String]); - return YES; -} - -- (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame -{ - if (!done) - printf("PROMPT: %s, default text: %s\n", [prompt UTF8String], [defaultText UTF8String]); - return defaultText; -} - -- (BOOL)webView:(WebView *)c runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame -{ - if (!done) - printf("CONFIRM NAVIGATION: %s\n", [message UTF8String]); - - return !gTestRunner->shouldStayOnPageAfterHandlingBeforeUnload(); -} - - -- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view -{ - assert(!draggingInfo); - draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj]; - [sender draggingUpdated:draggingInfo]; - [EventSendingController replaySavedEvents]; -} - -- (void)webViewFocus:(WebView *)webView -{ - gTestRunner->setWindowIsKey(true); -} - -- (void)webViewUnfocus:(WebView *)webView -{ - gTestRunner->setWindowIsKey(false); -} - -- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request -{ - if (!gTestRunner->canOpenWindows()) - return nil; - - // Make sure that waitUntilDone has been called. - ASSERT(gTestRunner->waitToDump()); - - WebView *webView = createWebViewAndOffscreenWindow(); - - if (gTestRunner->newWindowsCopyBackForwardList()) - [webView _loadBackForwardListFromOtherView:sender]; - - return [webView autorelease]; -} - -- (void)webViewClose:(WebView *)sender -{ - NSWindow* window = [sender window]; - - if (gTestRunner->callCloseOnWebViews()) - [sender close]; - - [window close]; -} - -- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier -{ - if (!done && gTestRunner->dumpDatabaseCallbacks()) { - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n", [[origin protocol] UTF8String], [[origin host] UTF8String], - [origin port], [databaseIdentifier UTF8String]); - } - - static const unsigned long long defaultQuota = 5 * 1024 * 1024; - [[origin databaseQuotaManager] setQuota:defaultQuota]; -} - -- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded -{ - if (!done && gTestRunner->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 - // above or below a threshold. - unsigned long truncatedSpaceNeeded = static_cast<unsigned long>((totalSpaceNeeded / 10000) * 10000); - printf("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{%s, %s, %i} totalSpaceNeeded:~%lu\n", - [[origin protocol] UTF8String], [[origin host] UTF8String], [origin port], truncatedSpaceNeeded); - } - - if (gTestRunner->disallowIncreaseForApplicationCacheQuota()) - return; - - static const unsigned long long defaultOriginQuota = [WebApplicationCache defaultOriginQuota]; - [[origin applicationCacheQuotaManager] setQuota:defaultOriginQuota]; -} - -- (void)webView:(WebView *)sender setStatusText:(NSString *)text -{ - if (gTestRunner->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", [text UTF8String]); -} - -- (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id<WebAllowDenyPolicyListener>)listener -{ - if (!gTestRunner->isGeolocationPermissionSet()) { - if (!m_pendingGeolocationPermissionListeners) - m_pendingGeolocationPermissionListeners = [[NSMutableSet set] retain]; - [m_pendingGeolocationPermissionListeners addObject:listener]; - return; - } - - if (gTestRunner->geolocationPermission()) - [listener allow]; - else - [listener deny]; -} - -- (void)didSetMockGeolocationPermission -{ - ASSERT(gTestRunner->isGeolocationPermissionSet()); - if (m_pendingGeolocationPermissionListeners && !m_timer) - m_timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO]; -} - -- (int)numberOfPendingGeolocationPermissionRequests -{ - if (!m_pendingGeolocationPermissionListeners) - return 0; - return [m_pendingGeolocationPermissionListeners count]; -} - - -- (void)timerFired -{ - ASSERT(gTestRunner->isGeolocationPermissionSet()); - m_timer = 0; - NSEnumerator* enumerator = [m_pendingGeolocationPermissionListeners objectEnumerator]; - id<WebAllowDenyPolicyListener> listener; - while ((listener = [enumerator nextObject])) { - if (gTestRunner->geolocationPermission()) - [listener allow]; - else - [listener deny]; - } - [m_pendingGeolocationPermissionListeners removeAllObjects]; - [m_pendingGeolocationPermissionListeners release]; - m_pendingGeolocationPermissionListeners = nil; -} - -- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode -{ - return NO; -} - -- (BOOL)webView:(WebView *)webView supportsFullScreenForElement:(DOMElement*)element withKeyboard:(BOOL)withKeyboard -{ - return YES; -} - -- (void)enterFullScreenWithListener:(NSObject<WebKitFullScreenListener>*)listener -{ - [listener webkitWillEnterFullScreen]; - [listener webkitDidEnterFullScreen]; -} - -- (void)webView:(WebView *)webView enterFullScreenForElement:(DOMElement*)element listener:(NSObject<WebKitFullScreenListener>*)listener -{ - if (!gTestRunner->hasCustomFullScreenBehavior()) - [self performSelector:@selector(enterFullScreenWithListener:) withObject:listener afterDelay:0]; -} - -- (void)exitFullScreenWithListener:(NSObject<WebKitFullScreenListener>*)listener -{ - [listener webkitWillExitFullScreen]; - [listener webkitDidExitFullScreen]; -} - -- (void)webView:(WebView *)webView exitFullScreenForElement:(DOMElement*)element listener:(NSObject<WebKitFullScreenListener>*)listener -{ - if (!gTestRunner->hasCustomFullScreenBehavior()) - [self performSelector:@selector(exitFullScreenWithListener:) withObject:listener afterDelay:0]; -} - -- (void)webView:(WebView *)sender closeFullScreenWithListener:(NSObject<WebKitFullScreenListener>*)listener -{ - [listener webkitWillExitFullScreen]; - [listener webkitDidExitFullScreen]; -} - -- (BOOL)webView:(WebView *)webView didPressMissingPluginButton:(DOMElement *)element -{ - printf("MISSING PLUGIN BUTTON PRESSED\n"); - return TRUE; -} - -- (void)webView:(WebView *)webView decidePolicyForNotificationRequestFromOrigin:(WebSecurityOrigin *)origin listener:(id<WebAllowDenyPolicyListener>)listener -{ - MockWebNotificationProvider *provider = (MockWebNotificationProvider *)[webView _notificationProvider]; - switch ([provider policyForOrigin:origin]) { - case WebNotificationPermissionAllowed: - [listener allow]; - break; - case WebNotificationPermissionDenied: - [listener deny]; - break; - case WebNotificationPermissionNotAllowed: - [provider setWebNotificationOrigin:[origin stringValue] permission:YES]; - [listener allow]; - break; - } -} - -- (void)dealloc -{ - [draggingInfo release]; - draggingInfo = nil; - [m_pendingGeolocationPermissionListeners release]; - m_pendingGeolocationPermissionListeners = nil; - - [super dealloc]; -} - -@end diff --git a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm b/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm deleted file mode 100644 index e06e79750..000000000 --- a/Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010 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 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. - */ - -#import "config.h" -#import "WebArchiveDumpSupport.h" - -#import <CFNetwork/CFHTTPMessage.h> -#import <Foundation/Foundation.h> -#import <WebKit/WebHTMLRepresentation.h> -#import <wtf/RetainPtr.h> - -extern "C" { - -enum CFURLCacheStoragePolicy { - kCFURLCacheStorageAllowed = 0, - kCFURLCacheStorageAllowedInMemoryOnly = 1, - kCFURLCacheStorageNotAllowed = 2 -}; -typedef enum CFURLCacheStoragePolicy CFURLCacheStoragePolicy; - -extern const CFStringRef kCFHTTPVersion1_1; - -CFURLResponseRef CFURLResponseCreate(CFAllocatorRef alloc, CFURLRef URL, CFStringRef mimeType, SInt64 expectedContentLength, CFStringRef textEncodingName, CFURLCacheStoragePolicy recommendedPolicy); -CFURLResponseRef CFURLResponseCreateWithHTTPResponse(CFAllocatorRef alloc, CFURLRef URL, CFHTTPMessageRef httpResponse, CFURLCacheStoragePolicy recommendedPolicy); -void CFURLResponseSetExpectedContentLength(CFURLResponseRef response, SInt64 length); -void CFURLResponseSetMIMEType(CFURLResponseRef response, CFStringRef mimeType); - -} - -CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData) -{ - // Decode NSURLResponse - RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]); - NSURLResponse *response = [unarchiver.get() decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m - [unarchiver.get() finishDecoding]; - - if (![response isKindOfClass:[NSHTTPURLResponse class]]) - return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)[response URL], (CFStringRef)[response MIMEType], [response expectedContentLength], (CFStringRef)[response textEncodingName], kCFURLCacheStorageAllowed); - - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - - // NSURLResponse is not toll-free bridged to CFURLResponse. - RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1)); - - NSDictionary *headerFields = [httpResponse allHeaderFields]; - for (NSString *headerField in [headerFields keyEnumerator]) - CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (CFStringRef)headerField, (CFStringRef)[headerFields objectForKey:headerField]); - - return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (CFURLRef)[response URL], httpMessage.get(), kCFURLCacheStorageAllowed); -} - -CFArrayRef supportedNonImageMIMETypes() -{ - return (CFArrayRef)[WebHTMLRepresentation supportedNonImageMIMETypes]; -} diff --git a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm b/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm deleted file mode 100644 index f0b6c33dc..000000000 --- a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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. - */ - -#import "config.h" -#import "DumpRenderTree.h" -#import "WorkQueueItem.h" - -#import <JavaScriptCore/JSStringRef.h> -#import <JavaScriptCore/JSStringRefCF.h> -#import <WebKit/WebBackForwardList.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebScriptObject.h> -#import <WebKit/WebView.h> -#import <wtf/RetainPtr.h> - -bool LoadItem::invoke() const -{ - RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_url.get())); - NSString *urlNS = (NSString *)urlCF.get(); - RetainPtr<CFStringRef> targetCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_target.get())); - NSString *targetNS = (NSString *)targetCF.get(); - - WebFrame *targetFrame; - if (targetNS && [targetNS length]) - targetFrame = [mainFrame findFrameNamed:targetNS]; - else - targetFrame = mainFrame; - [targetFrame loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlNS]]]; - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - 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())); - [mainFrame loadAlternateHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()] forUnreachableURL:[NSURL URLWithString:(NSString *)unreachableURLCF.get()]]; - return true; - } - - [mainFrame loadHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()]]; - return true; -} - -bool ReloadItem::invoke() const -{ - [[mainFrame webView] reload:nil]; - return true; -} - -bool ScriptItem::invoke() const -{ - RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_script.get())); - NSString *scriptNS = (NSString *)scriptCF.get(); - [[mainFrame webView] stringByEvaluatingJavaScriptFromString:scriptNS]; - return true; -} - -bool BackForwardItem::invoke() const -{ - if (m_howFar == 1) - [[mainFrame webView] goForward]; - else if (m_howFar == -1) - [[mainFrame webView] goBack]; - else { - WebBackForwardList *bfList = [[mainFrame webView] backForwardList]; - [[mainFrame webView] goToBackForwardItem:[bfList itemAtIndex:m_howFar]]; - } - return true; -} diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro deleted file mode 100644 index 2d6cfca22..000000000 --- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro +++ /dev/null @@ -1,60 +0,0 @@ -# ------------------------------------------------------------------- -# Project file for the DumpRenderTree binary (DRT) -# -# See 'Tools/qmake/README' for an overview of the build system -# ------------------------------------------------------------------- - -TEMPLATE = app - -TARGET = DumpRenderTree -DESTDIR = $$ROOT_BUILD_DIR/bin - -WEBKIT += wtf javascriptcore webcore - -INCLUDEPATH += \ - $$PWD/ \ - $$PWD/.. \ - $${ROOT_WEBKIT_DIR}/Source/WebCore/platform/qt \ - $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \ - $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WidgetSupport \ - $${ROOT_WEBKIT_DIR}/Source/WTF - -QT = core gui network testlib webkitwidgets widgets -have?(QTPRINTSUPPORT): QT += printsupport -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 \ - testplugin.h - -SOURCES += \ - $$PWD/../WorkQueue.cpp \ - $$PWD/../DumpRenderTreeCommon.cpp \ - $$PWD/../GCController.cpp \ - $$PWD/../TestRunner.cpp \ - DumpRenderTreeQt.cpp \ - EventSenderQt.cpp \ - TextInputControllerQt.cpp \ - WorkQueueItemQt.cpp \ - TestRunnerQt.cpp \ - GCControllerQt.cpp \ - testplugin.cpp \ - DumpRenderTreeMain.cpp - -wince*: { - INCLUDEPATH += $$WCECOMPAT/include - LIBS += $$WCECOMPAT/lib/wcecompat.lib -} - -DEFINES -= USE_SYSTEM_MALLOC=0 -DEFINES += USE_SYSTEM_MALLOC=1 - -RESOURCES = DumpRenderTree.qrc diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp index 264947497..5eab260b5 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp @@ -29,6 +29,7 @@ #include "DumpRenderTreeQt.h" +#include "InitWebCoreQt.h" #include "QtTestSupport.h" #include <qapplication.h> #include <qdebug.h> @@ -111,6 +112,7 @@ int main(int argc, char* argv[]) if (suppressQtDebugOutput) qInstallMessageHandler(messageHandler); + WebCore::initializeWebCoreQt(); WebKit::QtTestSupport::initializeTestFonts(); QApplication::setStyle(QStyleFactory::create(QLatin1String("windows"))); diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index c0c285353..b730df61c 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -202,8 +202,6 @@ void WebPage::resetSettings() QWebSettings::setMaximumPagesInCache(0); // reset to default settings()->setUserStyleSheetUrl(QUrl()); // reset to default - DumpRenderTreeSupportQt::setSeamlessIFramesEnabled(true); - DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()->handle()); m_pendingGeolocationRequests.clear(); @@ -275,6 +273,7 @@ void WebPage::permissionSet(QWebPage::Feature feature) } } +// FIXME (119591): Make this match other platforms better. static QString urlSuitableForTestResult(const QString& url) { if (url.isEmpty() || !url.startsWith(QLatin1String("file://"))) @@ -292,7 +291,7 @@ void WebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, c if (!message.isEmpty()) { newMessage = message; - size_t fileProtocol = newMessage.indexOf(QLatin1String("file://")); + int fileProtocol = newMessage.indexOf(QLatin1String("file://")); if (fileProtocol != -1) { newMessage = newMessage.left(fileProtocol) + urlSuitableForTestResult(newMessage.mid(fileProtocol)); } @@ -567,8 +566,8 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) m_page->setNetworkAccessManager(m_networkAccessManager); } - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); + WorkQueue::singleton().clear(); + WorkQueue::singleton().setFrozen(false); DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); @@ -772,8 +771,7 @@ void DumpRenderTree::initJSObjects() " }\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" + " if (pd !== undefined && (pd.writable === false || pd.configurable === false)) continue;\n" " this.qtBasedTestRunner[prop] = bind(this.jscBasedTestRunner[prop], this.jscBasedTestRunner);\n" "}\n" "}).apply(this)\n")); @@ -869,19 +867,25 @@ static QString dumpHistoryItem(const QWebHistoryItem& item, int indent, bool cur for (int i = start; i < indent; i++) result.append(' '); - QString url = item.url().toString(); - if (url.contains("file://")) { + QUrl url = item.url(); + QString urlString; + if (url.scheme() == "data") + urlString = url.toString(QUrl::DecodeReserved); + else + urlString = url.toString(); + + if (urlString.contains("file://")) { static QString layoutTestsString("/LayoutTests/"); static QString fileTestString("(file test):"); - QString res = url.mid(url.indexOf(layoutTestsString) + layoutTestsString.length()); + QString res = urlString.mid(urlString.indexOf(layoutTestsString) + layoutTestsString.length()); if (res.isEmpty()) return result; result.append(fileTestString); result.append(res); } else { - result.append(url); + result.append(urlString); } QString target = DumpRenderTreeSupportQt::historyItemTarget(item); @@ -1001,18 +1005,22 @@ void DumpRenderTree::dump() fputs("#EOF\n", stderr); if (m_dumpPixelsForCurrentTest && m_jscController->generatePixelResults()) { + // Should use the same render hints as default QWebView/QGraphicsWebView + QPainter::RenderHints renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); + QImage image; if (!m_jscController->isPrinting()) { image = QImage(m_page->viewportSize(), QImage::Format_ARGB32); image.fill(Qt::white); QPainter painter(&image); + painter.setRenderHints(renderHints); mainFrame->render(&painter); painter.end(); } else image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame->handle()); if (DumpRenderTreeSupportQt::trackRepaintRects(mainFrameAdapter())) { - QVector<QRect> repaintRects; + QVector<QRectF> repaintRects; DumpRenderTreeSupportQt::getTrackedRepaintRects(mainFrameAdapter(), repaintRects); QImage mask(image.size(), image.format()); mask.fill(QColor(0, 0, 0, 0.66 * 255)); @@ -1023,6 +1031,7 @@ void DumpRenderTree::dump() maskPainter.fillRect(repaintRects[i], Qt::transparent); QPainter painter(&image); + painter.setRenderHints(renderHints); painter.drawImage(image.rect(), mask); DumpRenderTreeSupportQt::setTrackRepaintRects(mainFrameAdapter(), false); diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.h b/Tools/DumpRenderTree/qt/EventSenderQt.h index ad13cadb6..94fb1556f 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.h +++ b/Tools/DumpRenderTree/qt/EventSenderQt.h @@ -54,7 +54,7 @@ class EventSender : public QObject { Q_OBJECT public: EventSender(QWebPage* parent); - virtual bool eventFilter(QObject* watched, QEvent* event); + virtual bool eventFilter(QObject* watched, QEvent*); void resetClickCount() { m_clickCount = 0; } public Q_SLOTS: diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro deleted file mode 100644 index af2b5ac93..000000000 --- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ /dev/null @@ -1,62 +0,0 @@ -# ------------------------------------------------------------------- -# Project file for the NPAPI test plugin -# -# See 'Tools/qmake/README' for an overview of the build system -# ------------------------------------------------------------------- - -TEMPLATE = lib -TARGET = TestNetscapePlugIn - -CONFIG += plugin - -SOURCES += \ - PluginObject.cpp \ - PluginTest.cpp \ - TestObject.cpp \ - main.cpp \ - Tests/DocumentOpenInDestroyStream.cpp \ - Tests/EvaluateJSAfterRemovingPluginElement.cpp \ - Tests/FormValue.cpp \ - Tests/GetURLNotifyWithURLThatFailsToLoad.cpp \ - Tests/GetURLWithJavaScriptURL.cpp \ - Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \ - Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \ - Tests/NPDeallocateCalledBeforeNPShutdown.cpp \ - Tests/NPPNewFails.cpp \ - Tests/NPPSetWindowCalledDuringDestruction.cpp \ - Tests/NPRuntimeCallsWithNullNPP.cpp \ - Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ - Tests/NPRuntimeRemoveProperty.cpp \ - Tests/NullNPPGetValuePointer.cpp \ - Tests/PassDifferentNPPStruct.cpp \ - Tests/PluginScriptableNPObjectInvokeDefault.cpp \ - Tests/PluginScriptableObjectOverridesAllProperties.cpp \ - Tests/PrivateBrowsing.cpp \ - Tests/ToStringAndValueOfObject.cpp - -WEBKIT += webcore # For NPAPI headers - -VPATH = ../../unix/TestNetscapePlugin ../../TestNetscapePlugIn - - -INCLUDEPATH += \ - ../../TestNetscapePlugIn/unix/ForwardingHeaders \ - ../../TestNetscapePlugIn/unix/ForwardingHeaders/WebKit \ - ../../TestNetscapePlugIn - -DESTDIR = $${ROOT_BUILD_DIR}/lib/plugins - -mac { - CONFIG += plugin_bundle - QMAKE_INFO_PLIST = ../../TestNetscapePlugIn/mac/Info.plist - QMAKE_PLUGIN_BUNDLE_NAME = $$TARGET - QMAKE_BUNDLE_LOCATION += "Contents/MacOS" - - OBJECTIVE_SOURCES += PluginObjectMac.mm - LIBS += -framework Carbon -framework Cocoa -framework QuartzCore -} - -!win32:!mac { - LIBS += -lX11 - DEFINES += XP_UNIX -} diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 794c00ff1..09f1d09dc 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -89,7 +89,6 @@ void TestRunnerQt::reset() DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter()); DumpRenderTreeSupportQt::dumpNotification(false); DumpRenderTreeSupportQt::setShouldUseFontSmoothing(false); - DumpRenderTreeSupportQt::disableDefaultTypesettingFeatures(); setIconDatabaseEnabled(false); clearAllDatabases(); removeAllWebNotificationPermissions(); @@ -108,7 +107,7 @@ void TestRunnerQt::processWork() // qDebug() << ">>>processWork"; // if we didn't start a new load, then we finished all the commands, so we're ready to dump state - if (WorkQueue::shared()->processWork() && !shouldWaitUntilDone()) { + if (WorkQueue::singleton().processWork() && !shouldWaitUntilDone()) { emit done(); m_hasDumped = true; } @@ -137,8 +136,8 @@ void TestRunnerQt::maybeDump(bool /*success*/) if (m_hasDumped) return; - WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test - if (WorkQueue::shared()->count()) + WorkQueue::singleton().setFrozen(true); // first complete load freezes the queue for the rest of this test + if (WorkQueue::singleton().count()) QTimer::singleShot(0, this, SLOT(processWork())); else if (!shouldWaitUntilDone()) { emit done(); @@ -331,40 +330,40 @@ void TestRunnerQt::queueBackNavigation(int howFarBackward) { //qDebug() << ">>>queueBackNavigation" << howFarBackward; for (int i = 0; i != howFarBackward; ++i) - WorkQueue::shared()->queue(new BackItem(1)); + WorkQueue::singleton().queue(new BackItem(1)); } void TestRunnerQt::queueForwardNavigation(int howFarForward) { //qDebug() << ">>>queueForwardNavigation" << howFarForward; for (int i = 0; i != howFarForward; ++i) - WorkQueue::shared()->queue(new ForwardItem(1)); + WorkQueue::singleton().queue(new ForwardItem(1)); } void TestRunnerQt::queueLoadHTMLString(const QString& content, const QString& baseURL, const QString& failingURL) { if (failingURL.isEmpty()) - WorkQueue::shared()->queue(new LoadHTMLStringItem(JSStringCreateWithQString(content).get(), JSStringCreateWithQString(baseURL).get())); + WorkQueue::singleton().queue(new LoadHTMLStringItem(JSStringCreateWithQString(content).get(), JSStringCreateWithQString(baseURL).get())); else - WorkQueue::shared()->queue(new LoadAlternateHTMLStringItem(JSStringCreateWithQString(content), JSStringCreateWithQString(baseURL), JSStringCreateWithQString(failingURL))); + WorkQueue::singleton().queue(new LoadAlternateHTMLStringItem(JSStringCreateWithQString(content), JSStringCreateWithQString(baseURL), JSStringCreateWithQString(failingURL))); } void TestRunnerQt::queueReload() { //qDebug() << ">>>queueReload"; - WorkQueue::shared()->queue(new ReloadItem()); + WorkQueue::singleton().queue(new ReloadItem()); } void TestRunnerQt::queueLoadingScript(const QString& script) { //qDebug() << ">>>queueLoadingScript" << script; - WorkQueue::shared()->queue(new LoadingScriptItem(JSStringCreateWithQString(script).get())); + WorkQueue::singleton().queue(new LoadingScriptItem(JSStringCreateWithQString(script).get())); } void TestRunnerQt::queueNonLoadingScript(const QString& script) { //qDebug() << ">>>queueNonLoadingScript" << script; - WorkQueue::shared()->queue(new NonLoadingScriptItem(JSStringCreateWithQString(script).get())); + WorkQueue::singleton().queue(new NonLoadingScriptItem(JSStringCreateWithQString(script).get())); } void TestRunnerQt::provisionalLoad() @@ -416,9 +415,9 @@ void TestRunnerQt::showWebInspector() DumpRenderTreeSupportQt::webInspectorShow(m_drt->pageAdapter()); } -void TestRunnerQt::evaluateInWebInspector(long callId, const QString& script) +void TestRunnerQt::evaluateInWebInspector(const QString& script) { - DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->pageAdapter(), callId, script); + DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->pageAdapter(), script); } void TestRunnerQt::setAllowUniversalAccessFromFileURLs(bool enabled) @@ -785,7 +784,7 @@ void TestRunner::queueLoad(JSStringRef url, JSStringRef target) 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)); + WorkQueue::singleton().queue(new LoadItem(JSStringCreateWithQString(absoluteUrl).get(), target)); } void TestRunner::removeAllVisitedLinks() @@ -840,6 +839,11 @@ int TestRunner::numberOfPendingGeolocationPermissionRequests() return 0; } +bool TestRunner::isGeolocationProviderActive() +{ + return false; +} + void TestRunner::overridePreference(JSStringRef key, JSStringRef value) { } @@ -877,27 +881,6 @@ void TestRunner::addChromeInputField() { } -JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) -{ - return JSValueMakeNull(context); -} - -void TestRunner::deleteAllLocalStorage() -{ -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef originIdentifier) -{ -} - -void TestRunner::observeStorageTrackerNotifications(unsigned number) -{ -} - -void TestRunner::syncLocalStorage() -{ -} - int TestRunner::windowCount() { return 0; @@ -924,7 +907,7 @@ void TestRunner::closeWebInspector() { } -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) +void TestRunner::evaluateInWebInspector(JSStringRef script) { } @@ -1083,10 +1066,6 @@ void TestRunner::setPopupBlockingEnabled(bool) { } -void TestRunner::setMockSpeechInputDumpRect(bool flag) -{ -} - void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path) { } @@ -1140,10 +1119,6 @@ void TestRunner::setAllowUniversalAccessFromFileURLs(bool) { } -void TestRunner::setApplicationCacheOriginQuota(unsigned long long) -{ -} - void TestRunner::denyWebNotificationPermission(JSStringRef origin) { } @@ -1160,10 +1135,6 @@ void TestRunner::setViewModeMediaFeature(JSStringRef) { } -void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) -{ -} - void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { } @@ -1200,8 +1171,8 @@ void TestRunner::execCommand(JSStringRef name, JSStringRef value) { } -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) +JSStringRef TestRunner::inspectorTestStubURL() { - return 0; + return JSStringCreateWithUTF8CString("qrc:/webkit/inspector/UserInterface/TestStub.html"); } diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.h b/Tools/DumpRenderTree/qt/TestRunnerQt.h index 42026e141..8f2ef1f45 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.h +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.h @@ -125,7 +125,7 @@ public Q_SLOTS: void setDeveloperExtrasEnabled(bool); void showWebInspector(); void closeWebInspector(); - void evaluateInWebInspector(long callId, const QString& script); + void evaluateInWebInspector(const QString& script); void removeAllVisitedLinks(); void setAllowUniversalAccessFromFileURLs(bool enable); void setAllowFileAccessFromFileURLs(bool enable); diff --git a/Tools/DumpRenderTree/qt/fonts/AHEM____.TTF b/Tools/DumpRenderTree/qt/fonts/AHEM____.TTF Binary files differdeleted file mode 100644 index ac81cb031..000000000 --- a/Tools/DumpRenderTree/qt/fonts/AHEM____.TTF +++ /dev/null diff --git a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp deleted file mode 100644 index d8c89b3c6..000000000 --- a/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * 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 - * 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" - -#include "AccessibilityUIElement.h" -#include "DumpRenderTree.h" -#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; - -AccessibilityController::AccessibilityController() - : m_focusEventHook(0) - , m_scrollingStartEventHook(0) - , m_valueChangeEventHook(0) - , m_allEventsHook(0) - , m_notificationsEventHook(0) -{ -} - -AccessibilityController::~AccessibilityController() -{ - setLogFocusEvents(false); - setLogAccessibilityEvents(false); - setLogValueChangeEvents(false); - - if (m_notificationsEventHook) - UnhookWinEvent(m_notificationsEventHook); - - for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) - JSValueUnprotect(frame->globalContext(), it->value); -} - -AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) -{ - // FIXME: implement - 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) -{ - AccessibilityUIElement rootAccessibilityUIElement = rootElement(); - - BSTR idAttribute = JSStringCopyBSTR(id); - - COMPtr<IAccessible> result = findAccessibleObjectById(rootAccessibilityUIElement, idAttribute); - - ::SysFreeString(idAttribute); - - if (result) - return AccessibilityUIElement(result); - - return 0; -} - -AccessibilityUIElement AccessibilityController::focusedElement() -{ - COMPtr<IAccessible> rootAccessible = rootElement().platformUIElement(); - - VARIANT vFocus; - if (FAILED(rootAccessible->get_accFocus(&vFocus))) - return 0; - - if (V_VT(&vFocus) == VT_I4) { - ASSERT(V_I4(&vFocus) == CHILDID_SELF); - // The root accessible object is the focused object. - return rootAccessible; - } - - ASSERT(V_VT(&vFocus) == VT_DISPATCH); - // We have an IDispatch; query for IAccessible. - return COMPtr<IAccessible>(Query, V_DISPATCH(&vFocus)); -} - -AccessibilityUIElement AccessibilityController::rootElement() -{ - COMPtr<IWebView> view; - if (FAILED(frame->webView(&view))) - return 0; - - COMPtr<IWebViewPrivate> viewPrivate(Query, view); - if (!viewPrivate) - return 0; - - HWND webViewWindow; - if (FAILED(viewPrivate->viewWindow((OLE_HANDLE*)&webViewWindow))) - return 0; - - // Get the root accessible object by querying for the accessible object for the - // WebView's window. - COMPtr<IAccessible> rootAccessible; - if (FAILED(AccessibleObjectFromWindow(webViewWindow, static_cast<DWORD>(OBJID_CLIENT), __uuidof(IAccessible), reinterpret_cast<void**>(&rootAccessible)))) - return 0; - - return rootAccessible; -} - -static void CALLBACK logEventProc(HWINEVENTHOOK, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD) -{ - // Get the accessible object for this event. - COMPtr<IAccessible> parentObject; - - VARIANT vChild; - VariantInit(&vChild); - - HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &parentObject, &vChild); - ASSERT(SUCCEEDED(hr)); - - // Get the name of the focused element, and log it to stdout. - BSTR nameBSTR; - hr = parentObject->get_accName(vChild, &nameBSTR); - ASSERT(SUCCEEDED(hr)); - wstring name(nameBSTR, ::SysStringLen(nameBSTR)); - SysFreeString(nameBSTR); - - switch (event) { - case EVENT_OBJECT_FOCUS: - printf("Received focus event for object '%S'.\n", name.c_str()); - break; - - case EVENT_OBJECT_SELECTION: - printf("Received selection event for object '%S'.\n", name.c_str()); - break; - - case EVENT_OBJECT_VALUECHANGE: { - BSTR valueBSTR; - hr = parentObject->get_accValue(vChild, &valueBSTR); - ASSERT(SUCCEEDED(hr)); - wstring value(valueBSTR, ::SysStringLen(valueBSTR)); - SysFreeString(valueBSTR); - - printf("Received value change event for object '%S', value '%S'.\n", name.c_str(), value.c_str()); - break; - } - - case EVENT_SYSTEM_SCROLLINGSTART: - printf("Received scrolling start event for object '%S'.\n", name.c_str()); - break; - - default: - printf("Received unknown event for object '%S'.\n", name.c_str()); - break; - } - - VariantClear(&vChild); -} - -void AccessibilityController::setLogFocusEvents(bool logFocusEvents) -{ - if (!!m_focusEventHook == logFocusEvents) - return; - - if (!logFocusEvents) { - UnhookWinEvent(m_focusEventHook); - m_focusEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_focusEventHook = SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_focusEventHook); -} - -void AccessibilityController::setLogValueChangeEvents(bool logValueChangeEvents) -{ - if (!!m_valueChangeEventHook == logValueChangeEvents) - return; - - if (!logValueChangeEvents) { - UnhookWinEvent(m_valueChangeEventHook); - m_valueChangeEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_valueChangeEventHook = SetWinEventHook(EVENT_OBJECT_VALUECHANGE, EVENT_OBJECT_VALUECHANGE, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_valueChangeEventHook); -} - -void AccessibilityController::setLogScrollingStartEvents(bool logScrollingStartEvents) -{ - if (!!m_scrollingStartEventHook == logScrollingStartEvents) - return; - - if (!logScrollingStartEvents) { - UnhookWinEvent(m_scrollingStartEventHook); - m_scrollingStartEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_scrollingStartEventHook = SetWinEventHook(EVENT_SYSTEM_SCROLLINGSTART, EVENT_SYSTEM_SCROLLINGSTART, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_scrollingStartEventHook); -} - -void AccessibilityController::setLogAccessibilityEvents(bool logAccessibilityEvents) -{ - if (!!m_allEventsHook == logAccessibilityEvents) - return; - - if (!logAccessibilityEvents) { - UnhookWinEvent(m_allEventsHook); - m_allEventsHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_allEventsHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_allEventsHook); -} - -static string stringEvent(DWORD event) -{ - switch(event) { - case EVENT_OBJECT_VALUECHANGE: - return "value change event"; - default: - return "unknown event"; - } -} - -static void CALLBACK notificationListenerProc(HWINEVENTHOOK, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD) -{ - // Get the accessible object for this event. - COMPtr<IAccessible> parentObject; - - VARIANT vChild; - VariantInit(&vChild); - - HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &parentObject, &vChild); - if (FAILED(hr) || !parentObject) - return; - - COMPtr<IDispatch> childDispatch; - if (FAILED(parentObject->get_accChild(vChild, &childDispatch))) { - VariantClear(&vChild); - return; - } - - COMPtr<IAccessible> childAccessible(Query, childDispatch); - - sharedFrameLoadDelegate->accessibilityController()->winNotificationReceived(childAccessible, stringEvent(event)); - - VariantClear(&vChild); -} - -bool AccessibilityController::addNotificationListener(JSObjectRef functionCallback) -{ - return false; -} - -void AccessibilityController::removeNotificationListener() -{ -} - -void AccessibilityController::winNotificationReceived(PlatformUIElement element, const string& eventName) -{ - for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) { - COMPtr<IServiceProvider> thisServiceProvider(Query, it->key); - if (!thisServiceProvider) - continue; - - COMPtr<IAccessibleComparable> thisComparable = comparableObject(thisServiceProvider); - if (!thisComparable) - continue; - - COMPtr<IServiceProvider> elementServiceProvider(Query, element); - if (!elementServiceProvider) - continue; - - COMPtr<IAccessibleComparable> elementComparable = comparableObject(elementServiceProvider); - if (!elementComparable) - continue; - - BOOL isSame = FALSE; - thisComparable->isSameObject(elementComparable.get(), &isSame); - if (!isSame) - continue; - - JSRetainPtr<JSStringRef> jsNotification(Adopt, JSStringCreateWithUTF8CString(eventName.c_str())); - JSValueRef argument = JSValueMakeString(frame->globalContext(), jsNotification.get()); - JSObjectCallAsFunction(frame->globalContext(), it->value, 0, 1, &argument, 0); - } -} - -void AccessibilityController::winAddNotificationListener(PlatformUIElement element, JSObjectRef functionCallback) -{ - if (!m_notificationsEventHook) - m_notificationsEventHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), notificationListenerProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - JSValueProtect(frame->globalContext(), functionCallback); - m_notificationListeners.add(element, functionCallback); -} diff --git a/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp deleted file mode 100644 index 71d9f8b25..000000000 --- a/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/* - * 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 - * 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" - -#include "AccessibilityController.h" -#include "DumpRenderTree.h" -#include "FrameLoadDelegate.h" -#include <JavaScriptCore/JSStringRef.h> -#include <wtf/text/WTFString.h> -#include <comutil.h> -#include <tchar.h> -#include <string> - -using std::wstring; - -static COMPtr<IAccessibleComparable> comparableObject(IAccessible* accessible) -{ - COMPtr<IServiceProvider> serviceProvider(Query, accessible); - if (!serviceProvider) - return 0; - COMPtr<IAccessibleComparable> comparable; - serviceProvider->QueryService(SID_AccessibleComparable, __uuidof(IAccessibleComparable), reinterpret_cast<void**>(&comparable)); - return comparable; -} - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) -{ -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) -{ -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ -} - -bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement) -{ - COMPtr<IAccessibleComparable> comparable = comparableObject(m_element.get()); - COMPtr<IAccessibleComparable> otherComparable = comparableObject(otherElement->m_element.get()); - if (!comparable || !otherComparable) - return false; - BOOL isSame = FALSE; - if (FAILED(comparable->isSameObject(otherComparable.get(), &isSame))) - return false; - return isSame; -} - -void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>&) -{ -} - -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; - for (long i = 0; i < childCount; ++i) - children.append(getChildAtIndex(i)); -} - -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))) - return; - for (long i = location; i < childCount && appendedCount < length; ++i, ++appendedCount) - elementVector.append(getChildAtIndex(i)); -} - -int AccessibilityUIElement::childrenCount() -{ - if (!m_element) - return 0; - - long childCount; - m_element->get_accChildCount(&childCount); - return childCount; -} - -int AccessibilityUIElement::rowCount() -{ - // FIXME: implement - return 0; -} - -int AccessibilityUIElement::columnCount() -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) -{ - if (!m_element) - return 0; - - COMPtr<IDispatch> child; - VARIANT vChild; - ::VariantInit(&vChild); - V_VT(&vChild) = VT_I4; - // In MSAA, index 0 is the object itself. - V_I4(&vChild) = index + 1; - if (FAILED(m_element->get_accChild(vChild, &child))) - return 0; - return COMPtr<IAccessible>(Query, child); -} - -unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) -{ - // FIXME: implement - return 0; -} - -JSStringRef AccessibilityUIElement::allAttributes() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() -{ - return JSStringCreateWithCharacters(0, 0); -} - -AccessibilityUIElement AccessibilityUIElement::titleUIElement() -{ - 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); - - COMPtr<IAccessible> parentAccessible(Query, parent); - return parentAccessible; -} - -JSStringRef AccessibilityUIElement::attributesOfChildren() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::parameterizedAttributeNames() -{ - return JSStringCreateWithCharacters(0, 0); -} - -static VARIANT& self() -{ - static VARIANT vSelf; - static bool haveInitialized; - - if (!haveInitialized) { - ::VariantInit(&vSelf); - V_VT(&vSelf) = VT_I4; - V_I4(&vSelf) = CHILDID_SELF; - } - return vSelf; -} - -JSStringRef AccessibilityUIElement::role() -{ - if (!m_element) - return JSStringCreateWithCharacters(0, 0); - - VARIANT vRole; - if (FAILED(m_element->get_accRole(self(), &vRole))) - return JSStringCreateWithCharacters(0, 0); - - ASSERT(V_VT(&vRole) == VT_I4 || V_VT(&vRole) == VT_BSTR); - - wstring result; - if (V_VT(&vRole) == VT_I4) { - unsigned roleTextLength = ::GetRoleText(V_I4(&vRole), 0, 0) + 1; - - Vector<TCHAR> roleText(roleTextLength); - - ::GetRoleText(V_I4(&vRole), roleText.data(), roleTextLength); - - result = roleText.data(); - } else if (V_VT(&vRole) == VT_BSTR) - result = wstring(V_BSTR(&vRole), ::SysStringLen(V_BSTR(&vRole))); - - ::VariantClear(&vRole); - - return JSStringCreateWithCharacters(result.data(), result.length()); -} - -JSStringRef AccessibilityUIElement::subrole() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::roleDescription() -{ - return 0; -} - -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); - wstring title(titleBSTR, SysStringLen(titleBSTR)); - ::SysFreeString(titleBSTR); - return JSStringCreateWithCharacters(title.data(), title.length()); -} - -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); - wstring description(descriptionBSTR, SysStringLen(descriptionBSTR)); - ::SysFreeString(descriptionBSTR); - return JSStringCreateWithCharacters(description.data(), description.length()); -} - -JSStringRef AccessibilityUIElement::stringValue() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::language() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::helpText() const -{ - return 0; -} - -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; - return 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; - return 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; - return 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; - return height; -} - -double AccessibilityUIElement::clickPointX() -{ - return 0; -} - -double AccessibilityUIElement::clickPointY() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::valueDescription() -{ - return 0; -} - -static DWORD accessibilityState(COMPtr<IAccessible> element) -{ - VARIANT state; - element->get_accState(self(), &state); - - ASSERT(V_VT(&state) == VT_I4); - - DWORD result = state.lVal; - VariantClear(&state); - - return result; -} - -bool AccessibilityUIElement::isFocused() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isSelected() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_SELECTED) == STATE_SYSTEM_SELECTED; -} - -int AccessibilityUIElement::hierarchicalLevel() const -{ - return 0; -} - -bool AccessibilityUIElement::ariaIsGrabbed() const -{ - return false; -} - -JSStringRef AccessibilityUIElement::ariaDropEffects() const -{ - return 0; -} - -bool AccessibilityUIElement::isExpanded() const -{ - return false; -} - -bool AccessibilityUIElement::isChecked() const -{ - if (!m_element) - return false; - - VARIANT vState; - if (FAILED(m_element->get_accState(self(), &vState))) - return false; - - return vState.lVal & STATE_SYSTEM_CHECKED; -} - -JSStringRef AccessibilityUIElement::orientation() const -{ - return 0; -} - -double AccessibilityUIElement::intValue() const -{ - if (!m_element) - return 0; - - BSTR valueBSTR; - if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) - return 0; - wstring value(valueBSTR, SysStringLen(valueBSTR)); - ::SysFreeString(valueBSTR); - TCHAR* ignored; - return _tcstod(value.data(), &ignored); -} - -double AccessibilityUIElement::minValue() -{ - return 0; -} - -double AccessibilityUIElement::maxValue() -{ - return 0; -} - -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; -} - -bool AccessibilityUIElement::isEnabled() -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_UNAVAILABLE) != STATE_SYSTEM_UNAVAILABLE; -} - -bool AccessibilityUIElement::isRequired() const -{ - return false; -} - - -int AccessibilityUIElement::insertionPointLineNumber() -{ - return 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::indexInTable() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::rowIndexRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::columnIndexRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -int AccessibilityUIElement::lineForIndex(int) -{ - return 0; -} - -JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) -{ - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) -{ - return false; -} - -AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) -{ - return 0; -} - -JSStringRef AccessibilityUIElement::selectedTextRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) -{ -} - -JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return 0; -} - -bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) -{ - return false; -} - -bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) -{ - return false; -} - -void AccessibilityUIElement::increment() -{ -} - -void AccessibilityUIElement::decrement() -{ -} - -void AccessibilityUIElement::showMenu() -{ - if (!m_element) - return; - - ASSERT(hasPopup()); - m_element->accDoDefaultAction(self()); -} - -void AccessibilityUIElement::press() -{ - if (!m_element) - return; - - m_element->accDoDefaultAction(self()); -} - -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 -{ - if (!m_element) - return JSStringCreateWithCharacters(0, 0); - - BSTR valueBSTR; - if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) - return JSStringCreateWithCharacters(0, 0); - - wstring value(valueBSTR, SysStringLen(valueBSTR)); - ::SysFreeString(valueBSTR); - - return JSStringCreateWithCharacters(value.data(), value.length()); -} - - -JSStringRef AccessibilityUIElement::documentEncoding() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::documentURI() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::url() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) -{ - if (!functionCallback) - return false; - - sharedFrameLoadDelegate->accessibilityController()->winAddNotificationListener(m_element, functionCallback); - return true; -} - -void AccessibilityUIElement::removeNotificationListener() -{ - // FIXME: implement -} - -bool AccessibilityUIElement::isFocusable() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isSelectable() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_SELECTABLE) == STATE_SYSTEM_SELECTABLE; -} - -bool AccessibilityUIElement::isMultiSelectable() const -{ - DWORD multiSelectable = STATE_SYSTEM_EXTSELECTABLE | STATE_SYSTEM_MULTISELECTABLE; - DWORD state = accessibilityState(m_element); - return (state & multiSelectable) == multiSelectable; -} - -bool AccessibilityUIElement::isSelectedOptionActive() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isVisible() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_INVISIBLE) != STATE_SYSTEM_INVISIBLE; -} - -bool AccessibilityUIElement::isOffScreen() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_OFFSCREEN) == STATE_SYSTEM_OFFSCREEN; -} - -bool AccessibilityUIElement::isCollapsed() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_COLLAPSED) == STATE_SYSTEM_COLLAPSED; -} - -bool AccessibilityUIElement::isIgnored() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::hasPopup() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_HASPOPUP) == STATE_SYSTEM_HASPOPUP; -} - -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()); -} - -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/win/DRTDataObject.cpp b/Tools/DumpRenderTree/win/DRTDataObject.cpp deleted file mode 100644 index b3504539b..000000000 --- a/Tools/DumpRenderTree/win/DRTDataObject.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * Copyright (C) 2012 Baidu 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 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. - */ - -#include "config.h" -#include "DRTDataObject.h" - -FORMATETC* cfHDropFormat() -{ - static FORMATETC urlFormat = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - return &urlFormat; -} - -FORMATETC* cfFileNameWFormat() -{ - static UINT cf = RegisterClipboardFormat(L"FileNameW"); - static FORMATETC urlFormat = {cf, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - return &urlFormat; -} - -FORMATETC* cfUrlWFormat() -{ - static UINT cf = RegisterClipboardFormat(L"UniformResourceLocatorW"); - static FORMATETC urlFormat = {cf, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; - return &urlFormat; -} - -class WCEnumFormatEtc : public IEnumFORMATETC { -public: - explicit WCEnumFormatEtc(const Vector<FORMATETC>& formats); - explicit WCEnumFormatEtc(const Vector<FORMATETC*>& formats); - - // IUnknown members - STDMETHOD(QueryInterface)(REFIID, void**); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - // IEnumFORMATETC members - STDMETHOD(Next)(ULONG, LPFORMATETC, ULONG*); - STDMETHOD(Skip)(ULONG); - STDMETHOD(Reset)(); - STDMETHOD(Clone)(IEnumFORMATETC**); - -private: - long m_ref; - Vector<FORMATETC> m_formats; - size_t m_current; -}; - -WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC>& formats) - : m_ref(1) - , m_current(0) - , m_formats(formats) -{ -} - -WCEnumFormatEtc::WCEnumFormatEtc(const Vector<FORMATETC*>& formats) - : m_ref(1) - , m_current(0) -{ - for (size_t i = 0; i < formats.size(); ++i) - m_formats.append(*formats[i]); -} - -STDMETHODIMP WCEnumFormatEtc::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumFORMATETC)) { - *ppvObject = this; - AddRef(); - return S_OK; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) WCEnumFormatEtc::AddRef() -{ - return InterlockedIncrement(&m_ref); -} - -STDMETHODIMP_(ULONG) WCEnumFormatEtc::Release() -{ - long refCount = InterlockedDecrement(&m_ref); - if (!refCount) - delete this; - return refCount; -} - -STDMETHODIMP WCEnumFormatEtc::Next(ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched) -{ - if (pceltFetched) - *pceltFetched = 0; - - ULONG cReturn = celt; - - if (celt <= 0 || !lpFormatEtc || m_current >= m_formats.size()) - return S_FALSE; - - if (!pceltFetched && celt != 1) // pceltFetched can be 0 only for 1 item request - return S_FALSE; - - while (m_current < m_formats.size() && cReturn > 0) { - *lpFormatEtc++ = m_formats[m_current++]; - --cReturn; - } - if (pceltFetched) - *pceltFetched = celt - cReturn; - - return !cReturn ? S_OK : S_FALSE; -} - -STDMETHODIMP WCEnumFormatEtc::Skip(ULONG celt) -{ - if ((m_current + celt) >= m_formats.size()) - return S_FALSE; - m_current += celt; - return S_OK; -} - -STDMETHODIMP WCEnumFormatEtc::Reset() -{ - m_current = 0; - return S_OK; -} - -STDMETHODIMP WCEnumFormatEtc::Clone(IEnumFORMATETC** ppCloneEnumFormatEtc) -{ - if (!ppCloneEnumFormatEtc) - return E_POINTER; - - WCEnumFormatEtc* newEnum = new WCEnumFormatEtc(m_formats); - if (!newEnum) - return E_OUTOFMEMORY; - - newEnum->AddRef(); - newEnum->m_current = m_current; - *ppCloneEnumFormatEtc = newEnum; - return S_OK; -} - -////////////////////////////////////////////////////////////////////////// -HRESULT DRTDataObject::createInstance(DRTDataObject** result) -{ - if (!result) - return E_POINTER; - *result = new DRTDataObject(); - return S_OK; -} - -DRTDataObject::DRTDataObject() - : m_ref(1) -{ -} - -DRTDataObject::~DRTDataObject() -{ - for (size_t i = 0; i < m_medium.size(); ++i) { - ReleaseStgMedium(m_medium[i]); - delete m_medium[i]; - } - WTF::deleteAllValues(m_formats); -} - -STDMETHODIMP DRTDataObject::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDataObject)) - *ppvObject = this; - - if (*ppvObject) { - AddRef(); - return S_OK; - } - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) DRTDataObject::AddRef() -{ - return InterlockedIncrement(&m_ref); -} - -STDMETHODIMP_(ULONG) DRTDataObject::Release() -{ - long refCount = InterlockedDecrement(&m_ref); - if (!refCount) - delete this; - return refCount; -} - -STDMETHODIMP DRTDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium) -{ - if (!pformatetcIn || !pmedium) - return E_POINTER; - pmedium->hGlobal = 0; - - for (size_t i = 0; i < m_formats.size(); ++i) { - if (pformatetcIn->lindex == m_formats[i]->lindex && pformatetcIn->dwAspect == m_formats[i]->dwAspect && pformatetcIn->cfFormat == m_formats[i]->cfFormat) { - CopyMedium(pmedium, m_medium[i], m_formats[i]); - return S_OK; - } - } - return DV_E_FORMATETC; -} - -STDMETHODIMP DRTDataObject::GetDataHere(FORMATETC*, STGMEDIUM*) -{ - return E_NOTIMPL; -} - -STDMETHODIMP DRTDataObject::QueryGetData(FORMATETC* pformatetc) -{ - if (!pformatetc) - return E_POINTER; - - if (!(DVASPECT_CONTENT & pformatetc->dwAspect)) - return (DV_E_DVASPECT); - - for (size_t i = 0; i < m_formats.size(); ++i) { - if (pformatetc->tymed & m_formats[i]->tymed) { - if (pformatetc->cfFormat == m_formats[i]->cfFormat) - return S_OK; - } - } - return DV_E_TYMED; -} - -STDMETHODIMP DRTDataObject::GetCanonicalFormatEtc(FORMATETC*, FORMATETC*) -{ - return DATA_S_SAMEFORMATETC; -} - -STDMETHODIMP DRTDataObject::SetData(FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease) -{ - if (!pformatetc || !pmedium) - return E_POINTER; - - FORMATETC* formatetc = new FORMATETC; - if (!formatetc) - return E_OUTOFMEMORY; - - STGMEDIUM* pStgMed = new STGMEDIUM; - - if (!pStgMed) { - delete formatetc; - return E_OUTOFMEMORY; - } - - ZeroMemory(formatetc, sizeof(FORMATETC)); - ZeroMemory(pStgMed, sizeof(STGMEDIUM)); - - *formatetc = *pformatetc; - m_formats.append(formatetc); - - if (fRelease) - *pStgMed = *pmedium; - else - CopyMedium(pStgMed, pmedium, pformatetc); - m_medium.append(pStgMed); - - return S_OK; -} - -void DRTDataObject::CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc) -{ - switch (pMedSrc->tymed) { -#if !OS(WINCE) - case TYMED_HGLOBAL: - pMedDest->hGlobal = static_cast<HGLOBAL>(OleDuplicateData(pMedSrc->hGlobal, pFmtSrc->cfFormat, 0)); - break; - case TYMED_GDI: - pMedDest->hBitmap = static_cast<HBITMAP>(OleDuplicateData(pMedSrc->hBitmap, pFmtSrc->cfFormat, 0)); - break; - case TYMED_MFPICT: - pMedDest->hMetaFilePict = static_cast<HMETAFILEPICT>(OleDuplicateData(pMedSrc->hMetaFilePict, pFmtSrc->cfFormat, 0)); - break; - case TYMED_ENHMF: - pMedDest->hEnhMetaFile = static_cast<HENHMETAFILE>(OleDuplicateData(pMedSrc->hEnhMetaFile, pFmtSrc->cfFormat, 0)); - break; - case TYMED_FILE: - pMedSrc->lpszFileName = static_cast<LPOLESTR>(OleDuplicateData(pMedSrc->lpszFileName, pFmtSrc->cfFormat, 0)); - break; -#endif - case TYMED_ISTREAM: - pMedDest->pstm = pMedSrc->pstm; - pMedSrc->pstm->AddRef(); - break; - case TYMED_ISTORAGE: - pMedDest->pstg = pMedSrc->pstg; - pMedSrc->pstg->AddRef(); - break; - default: - break; - } - pMedDest->tymed = pMedSrc->tymed; - pMedDest->pUnkForRelease = 0; - if (pMedSrc->pUnkForRelease) { - pMedDest->pUnkForRelease = pMedSrc->pUnkForRelease; - pMedSrc->pUnkForRelease->AddRef(); - } -} -STDMETHODIMP DRTDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc) -{ - if (!ppenumFormatEtc) - return E_POINTER; - - *ppenumFormatEtc = 0; - switch (dwDirection) { - case DATADIR_GET: - *ppenumFormatEtc = new WCEnumFormatEtc(m_formats); - if (!(*ppenumFormatEtc)) - return E_OUTOFMEMORY; - break; - - case DATADIR_SET: - default: - return E_NOTIMPL; - break; - } - - return S_OK; -} - -STDMETHODIMP DRTDataObject::DAdvise(FORMATETC*, DWORD, IAdviseSink*, DWORD*) -{ - return OLE_E_ADVISENOTSUPPORTED; -} - -STDMETHODIMP DRTDataObject::DUnadvise(DWORD) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE DRTDataObject::EnumDAdvise(IEnumSTATDATA**) -{ - return OLE_E_ADVISENOTSUPPORTED; -} - -void DRTDataObject::clearData(CLIPFORMAT format) -{ - size_t position = 0; - while (position < m_formats.size()) { - if (m_formats[position]->cfFormat == format) { - FORMATETC* current = m_formats[position]; - m_formats[position] = m_formats[m_formats.size() - 1]; - m_formats[m_formats.size() - 1] = 0; - m_formats.removeLast(); - delete current; - STGMEDIUM* medium = m_medium[position]; - m_medium[position] = m_medium[m_medium.size() - 1]; - m_medium[m_medium.size() - 1] = 0; - m_medium.removeLast(); - ReleaseStgMedium(medium); - delete medium; - continue; - } - position++; - } -} diff --git a/Tools/DumpRenderTree/win/DRTDataObject.h b/Tools/DumpRenderTree/win/DRTDataObject.h deleted file mode 100644 index b772b253d..000000000 --- a/Tools/DumpRenderTree/win/DRTDataObject.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * Copyright (C) 2012 Baidu 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 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. - */ - -#ifndef DRTDataObject_h -#define DRTDataObject_h - -#include <ShlObj.h> -#include <objidl.h> -#include <wtf/Vector.h> - -FORMATETC* cfHDropFormat(); - -FORMATETC* cfFileNameWFormat(); - -FORMATETC* cfUrlWFormat(); - -class DRTDataObject : public IDataObject { -public: - void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(); - virtual ULONG STDMETHODCALLTYPE Release(); - - // IDataObject - virtual HRESULT STDMETHODCALLTYPE GetData(FORMATETC* pformatIn, STGMEDIUM* pmedium); - virtual HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC* pformat, STGMEDIUM* pmedium); - virtual HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC* pformat); - virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC* pformatectIn, FORMATETC* pformatOut); - virtual HRESULT STDMETHODCALLTYPE SetData(FORMATETC* pformat, STGMEDIUM*pmedium, BOOL release); - virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc); - virtual HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC*, DWORD, IAdviseSink*, DWORD*); - virtual HRESULT STDMETHODCALLTYPE DUnadvise(DWORD); - virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA**); - - void clearData(CLIPFORMAT); - - static HRESULT createInstance(DRTDataObject**); -private: - DRTDataObject(); - ~DRTDataObject(); - long m_ref; - Vector<FORMATETC*> m_formats; - Vector<STGMEDIUM*> m_medium; -}; - -#endif // DRTDataObject_h diff --git a/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp b/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp deleted file mode 100644 index a7bfc6d44..000000000 --- a/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2009 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 "DRTDesktopNotificationPresenter.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSStringRefBSTR.h> -#include <WebCore/NotificationClient.h> - -DRTDesktopNotificationPresenter::DRTDesktopNotificationPresenter() - : m_refCount(1) {} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<DRTDesktopNotificationPresenter*>(this); - else if (IsEqualGUID(riid, IID_IWebDesktopNotificationsDelegate)) - *ppvObject = static_cast<DRTDesktopNotificationPresenter*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE DRTDesktopNotificationPresenter::AddRef() -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE DRTDesktopNotificationPresenter::Release() -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::showDesktopNotification( - /* [in] */ IWebDesktopNotification* notification) -{ - BSTR title, text, url; - BOOL html; - - if (!notification->isHTML(&html) && html) { - notification->contentsURL(&url); - printf("DESKTOP NOTIFICATION: contents at %S\n", url ? url : L""); - } else { - notification->iconURL(&url); - notification->title(&title); - notification->text(&text); - printf("DESKTOP NOTIFICATION: icon %S, title %S, text %S\n", - url ? url : L"", - title ? title : L"", - text ? text : L""); - } - - // In this stub implementation, the notification is displayed immediately; - // we dispatch the display event to mimic that. - notification->notifyDisplay(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::cancelDesktopNotification( - /* [in] */ IWebDesktopNotification* notification) -{ - BSTR identifier; - BOOL html; - notification->isHTML(&html); - if (html) - notification->contentsURL(&identifier); - else - notification->title(&identifier); - - printf("DESKTOP NOTIFICATION CLOSED: %S\n", identifier ? identifier : L""); - notification->notifyClose(false); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::notificationDestroyed( - /* [in] */ IWebDesktopNotification* notification) -{ - // Since in these tests events happen immediately, we don't hold on to - // Notification pointers. So there's no cleanup to do. - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::checkNotificationPermission( - /* [in] */ BSTR origin, - /* [out, retval] */ int* result) -{ -#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - JSStringRef jsOrigin = JSStringCreateWithBSTR(origin); - bool allowed = ::gTestRunner->checkDesktopNotificationPermission(jsOrigin); - - if (allowed) - *result = WebCore::NotificationClient::PermissionAllowed; - else - *result = WebCore::NotificationClient::PermissionDenied; - - JSStringRelease(jsOrigin); -#endif - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::requestNotificationPermission( - /* [in] */ BSTR origin) -{ - printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %S\n", origin ? origin : L""); - return S_OK; -} diff --git a/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h b/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h deleted file mode 100644 index 567984503..000000000 --- a/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 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. - */ - -#ifndef DRTDesktopNotificationPresenter_h -#define DRTDesktopNotificationPresenter_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> -#include <windef.h> - -class DRTDesktopNotificationPresenter : public IWebDesktopNotificationsDelegate { -public: - DRTDesktopNotificationPresenter(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebDesktopNotificationsDelegate - virtual HRESULT STDMETHODCALLTYPE showDesktopNotification( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE cancelDesktopNotification( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE notificationDestroyed( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE checkNotificationPermission( - /* [in] */ BSTR origin, - /* [out, retval] */ int* result); - - virtual HRESULT STDMETHODCALLTYPE requestNotificationPermission( - /* [in] */ BSTR origin); - -private: - ULONG m_refCount; -}; - -#endif diff --git a/Tools/DumpRenderTree/win/DRTDropSource.cpp b/Tools/DumpRenderTree/win/DRTDropSource.cpp deleted file mode 100644 index 08b1be887..000000000 --- a/Tools/DumpRenderTree/win/DRTDropSource.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* Copyright (C) 2012 Baidu 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 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. -*/ - -#include "config.h" -#include "DRTDropSource.h" - -DRTDropSource::DRTDropSource() - : m_ref(1) - , m_dropped(false) -{ -} - -DRTDropSource::~DRTDropSource() -{ -} - -STDMETHODIMP DRTDropSource::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDropSource)) { - *ppvObject = this; - AddRef(); - - return S_OK; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) DRTDropSource::AddRef() -{ - return InterlockedIncrement(&m_ref); -} - -STDMETHODIMP_(ULONG) DRTDropSource::Release() -{ - long refCount = InterlockedDecrement(&m_ref); - if (!refCount) - delete this; - return refCount; -} - -HRESULT DRTDropSource::createInstance(IDropSource** result) -{ - if (!result) - return E_INVALIDARG; - *result = new DRTDropSource; - return S_OK; -} - -STDMETHODIMP DRTDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) -{ - if (fEscapePressed || !(grfKeyState & (MK_LBUTTON | MK_RBUTTON))) { - m_dropped = !fEscapePressed; - return fEscapePressed ? DRAGDROP_S_CANCEL : DRAGDROP_S_DROP; - } - - return S_OK; -} - -STDMETHODIMP DRTDropSource::GiveFeedback(DWORD dwEffect) -{ - return DRAGDROP_S_USEDEFAULTCURSORS; -} diff --git a/Tools/DumpRenderTree/win/DRTDropSource.h b/Tools/DumpRenderTree/win/DRTDropSource.h deleted file mode 100644 index f37f2b7e4..000000000 --- a/Tools/DumpRenderTree/win/DRTDropSource.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright (C) 2012 Baidu 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 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. -*/ - -#ifndef DRTDropSource_h -#define DRTDropSource_h - -#include <ShlObj.h> -#include <windows.h> - -class DRTDropSource : public IDropSource { -public: - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(); - virtual ULONG STDMETHODCALLTYPE Release(); - virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState); - virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect); - - static HRESULT createInstance(IDropSource** result); -private: - DRTDropSource(); - ~DRTDropSource(); - long m_ref; - bool m_dropped; -}; - -#endif // DRTDropSource_h diff --git a/Tools/DumpRenderTree/win/DraggingInfo.h b/Tools/DumpRenderTree/win/DraggingInfo.h deleted file mode 100644 index 98982bc16..000000000 --- a/Tools/DumpRenderTree/win/DraggingInfo.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef DraggingInfo_h -#define DraggingInfo_h - -#include <objidl.h> - -class DraggingInfo { -public: - DraggingInfo(IDataObject* object, IDropSource* source) - : m_object(object) - , m_source(source) - , m_performedDropEffect(DROPEFFECT_NONE) - { - m_object->AddRef(); - m_source->AddRef(); - } - - ~DraggingInfo() - { - if (m_object) - m_object->Release(); - m_object = 0; - if (m_source) - m_source->Release(); - m_source = 0; - } - - IDataObject* dataObject() const { return m_object; } - IDropSource* dropSource() const { return m_source; } - - DWORD performedDropEffect() const { return m_performedDropEffect; } - void setPerformedDropEffect(DWORD effect) { m_performedDropEffect = effect; } - -private: - IDataObject* m_object; - IDropSource* m_source; - DWORD m_performedDropEffect; -}; - -#endif // !defined(DraggingInfo_h) diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp deleted file mode 100644 index 46c528a6d..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp +++ /dev/null @@ -1,1445 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008, 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. - * 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 "EditingDelegate.h" -#include "FrameLoadDelegate.h" -#include "HistoryDelegate.h" -#include "JavaScriptThreading.h" -#include "PixelDumpSupport.h" -#include "PolicyDelegate.h" -#include "ResourceLoadDelegate.h" -#include "TestRunner.h" -#include "UIDelegate.h" -#include "WebCoreTestSupport.h" -#include "WorkQueueItem.h" -#include "WorkQueue.h" - -#include <comutil.h> -#include <fcntl.h> -#include <io.h> -#include <math.h> -#include <shlwapi.h> -#include <stdio.h> -#include <string.h> -#include <tchar.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.h> -#include <windows.h> -#include <CoreFoundation/CoreFoundation.h> -#include <WebCore/FileSystem.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> - -#if USE(CFNETWORK) -#include <CFNetwork/CFHTTPCookiesPriv.h> -#include <CFNetwork/CFURLCachePriv.h> -#endif - -using namespace std; - -#ifdef DEBUG_ALL -const LPWSTR TestPluginDir = L"TestNetscapePlugin_Debug"; -#else -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; -static bool dumpPixelsForAllTests = false; -static bool dumpPixelsForCurrentTest; -static bool dumpAllPixels; -static bool printSeparators; -static bool leakChecking = false; -static bool threaded = false; -static bool forceComplexText = false; -static bool printSupportedFeatures = false; -static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; - -volatile bool done; -// This is the topmost frame that is loading, during a given load, or nil when no load is -// in progress. Usually this is the same as the main frame, but not always. In the case -// where a frameset is loaded, and then new content is loaded into one of the child frames, -// that child frame is the "topmost frame that is loading". -IWebFrame* topLoadingFrame; // !nil iff a load is in progress -static COMPtr<IWebHistoryItem> prevTestBFItem; // current b/f item at the end of the previous test -PolicyDelegate* policyDelegate; -COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; -COMPtr<UIDelegate> sharedUIDelegate; -COMPtr<EditingDelegate> sharedEditingDelegate; -COMPtr<HistoryDelegate> sharedHistoryDelegate; - -IWebFrame* frame; -HWND webViewWindow; - -RefPtr<TestRunner> gTestRunner; - -UINT_PTR waitToDumpWatchdog = 0; - -void setPersistentUserStyleSheetLocation(CFStringRef url) -{ - persistentUserStyleSheetLocation = url; -} - -bool setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ -#if USE(CFNETWORK) - COMPtr<IWebCookieManager> cookieManager; - if (FAILED(WebKitCreateInstance(CLSID_WebCookieManager, 0, IID_IWebCookieManager, reinterpret_cast<void**>(&cookieManager)))) - return false; - CFHTTPCookieStorageRef cookieStorage = 0; - if (FAILED(cookieManager->cookieStorage(&cookieStorage)) || !cookieStorage) - return false; - - WebKitCookieStorageAcceptPolicy cookieAcceptPolicy = alwaysAcceptCookies ? WebKitCookieStorageAcceptPolicyAlways : WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain; - CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage, cookieAcceptPolicy); - return true; -#else - // FIXME: Implement! - return false; -#endif -} - -static RetainPtr<CFStringRef> substringFromIndex(CFStringRef string, CFIndex 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<CFStringRef> scheme = adoptCF(CFURLCopyScheme(url.get())); - if (scheme && CFStringCompare(scheme.get(), CFSTR("file"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) - return urlString; - - COMPtr<IWebDataSource> dataSource; - if (FAILED(frame->dataSource(&dataSource))) { - if (FAILED(frame->provisionalDataSource(&dataSource))) - return urlString; - } - - COMPtr<IWebMutableURLRequest> request; - if (FAILED(dataSource->request(&request))) - return urlString; - - _bstr_t requestURLString; - 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<CFStringRef> basePath = adoptCF(CFURLCopyPath(baseURL.get())); - RetainPtr<CFStringRef> path = adoptCF(CFURLCopyPath(url.get())); - - return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get()); -} - -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 = adoptCF(CFURLCopyLastPathComponent(url.get())); - - return cfStringRefToWString(lastPathComponent.get()); -} - -static string toUTF8(const wchar_t* wideString, size_t length) -{ - int result = WideCharToMultiByte(CP_UTF8, 0, wideString, length + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, wideString, length + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return string(); - - 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)); -} - -string toUTF8(const wstring& wideString) -{ - return toUTF8(wideString.c_str(), wideString.length()); -} - -wstring cfStringRefToWString(CFStringRef cfStr) -{ - Vector<wchar_t> v(CFStringGetLength(cfStr)); - CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data()); - - return wstring(v.data(), v.size()); -} - -static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_DESTROY: - for (unsigned i = openWindows().size() - 1; i >= 0; --i) { - if (openWindows()[i] == hWnd) { - openWindows().remove(i); - windowToWebViewMap().remove(hWnd); - break; - } - } - return 0; - break; - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } -} - -static const wstring& exePath() -{ - static wstring path; - static bool initialized; - - if (initialized) - return path; - initialized = true; - - TCHAR buffer[MAX_PATH]; - GetModuleFileName(GetModuleHandle(0), buffer, ARRAYSIZE(buffer)); - path = buffer; - int lastSlash = path.rfind('\\'); - if (lastSlash != -1 && lastSlash + 1 < path.length()) - path = path.substr(0, lastSlash + 1); - - return path; -} - -static const wstring& fontsPath() -{ - static wstring path; - static bool initialized; - - if (initialized) - return path; - initialized = true; - - DWORD size = GetEnvironmentVariable(fontsEnvironmentVariable, 0, 0); - Vector<TCHAR> buffer(size); - if (GetEnvironmentVariable(fontsEnvironmentVariable, buffer.data(), buffer.size())) { - path = buffer.data(); - if (path[path.length() - 1] != '\\') - path.append(L"\\"); - return path; - } - - path = exePath() + TEXT("DumpRenderTree.resources\\"); - return path; -} - -static void addQTDirToPATH() -{ - static LPCWSTR pathEnvironmentVariable = L"PATH"; - static LPCWSTR quickTimeKeyName = L"Software\\Apple Computer, Inc.\\QuickTime"; - static LPCWSTR quickTimeSysDir = L"QTSysDir"; - static bool initialized; - - if (initialized) - return; - initialized = true; - - // Get the QuickTime dll directory from the registry. The key can be in either HKLM or HKCU. - WCHAR qtPath[MAX_PATH]; - DWORD qtPathBufferLen = sizeof(qtPath); - DWORD keyType; - HRESULT result = SHGetValue(HKEY_LOCAL_MACHINE, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen); - if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) { - qtPathBufferLen = sizeof(qtPath); - result = SHGetValue(HKEY_CURRENT_USER, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen); - if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) - return; - } - - // Read the current PATH. - DWORD pathSize = GetEnvironmentVariableW(pathEnvironmentVariable, 0, 0); - Vector<WCHAR> oldPath(pathSize); - if (!GetEnvironmentVariableW(pathEnvironmentVariable, oldPath.data(), oldPath.size())) - return; - - // And add the QuickTime dll. - wstring newPath; - newPath.append(qtPath); - newPath.append(L";"); - newPath.append(oldPath.data(), oldPath.size()); - SetEnvironmentVariableW(pathEnvironmentVariable, newPath.data()); -} - -#ifdef DEBUG_ALL -#define WEBKITDLL TEXT("WebKit_debug.dll") -#else -#define WEBKITDLL TEXT("WebKit.dll") -#endif - -static void initialize() -{ - if (HMODULE webKitModule = LoadLibrary(WEBKITDLL)) - if (FARPROC dllRegisterServer = GetProcAddress(webKitModule, "DllRegisterServer")) - dllRegisterServer(); - - // Init COM - OleInitialize(0); - - static LPCTSTR fontsToInstall[] = { - TEXT("AHEM____.ttf"), - TEXT("Apple Chancery.ttf"), - TEXT("Courier Bold.ttf"), - TEXT("Courier.ttf"), - TEXT("Helvetica Bold Oblique.ttf"), - TEXT("Helvetica Bold.ttf"), - TEXT("Helvetica Oblique.ttf"), - TEXT("Helvetica.ttf"), - TEXT("Helvetica Neue Bold Italic.ttf"), - TEXT("Helvetica Neue Bold.ttf"), - TEXT("Helvetica Neue Condensed Black.ttf"), - TEXT("Helvetica Neue Condensed Bold.ttf"), - TEXT("Helvetica Neue Italic.ttf"), - TEXT("Helvetica Neue Light Italic.ttf"), - TEXT("Helvetica Neue Light.ttf"), - TEXT("Helvetica Neue UltraLight Italic.ttf"), - TEXT("Helvetica Neue UltraLight.ttf"), - TEXT("Helvetica Neue.ttf"), - TEXT("Lucida Grande.ttf"), - TEXT("Lucida Grande Bold.ttf"), - TEXT("Monaco.ttf"), - TEXT("Papyrus.ttf"), - TEXT("Times Bold Italic.ttf"), - TEXT("Times Bold.ttf"), - TEXT("Times Italic.ttf"), - TEXT("Times Roman.ttf"), - TEXT("WebKit Layout Tests 2.ttf"), - TEXT("WebKit Layout Tests.ttf"), - TEXT("WebKitWeightWatcher100.ttf"), - TEXT("WebKitWeightWatcher200.ttf"), - TEXT("WebKitWeightWatcher300.ttf"), - TEXT("WebKitWeightWatcher400.ttf"), - TEXT("WebKitWeightWatcher500.ttf"), - TEXT("WebKitWeightWatcher600.ttf"), - TEXT("WebKitWeightWatcher700.ttf"), - TEXT("WebKitWeightWatcher800.ttf"), - TEXT("WebKitWeightWatcher900.ttf") - }; - - wstring resourcesPath = fontsPath(); - - COMPtr<IWebTextRenderer> textRenderer; - if (SUCCEEDED(WebKitCreateInstance(CLSID_WebTextRenderer, 0, IID_IWebTextRenderer, (void**)&textRenderer))) - for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i) - textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str()); - - // Add the QuickTime dll directory to PATH or QT 7.6 will fail to initialize on systems - // linked with older versions of qtmlclientlib.dll. - addQTDirToPATH(); - - // Register a host window - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = DumpRenderTreeWndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = GetModuleHandle(0); - wcex.hIcon = 0; - wcex.hCursor = LoadCursor(0, IDC_ARROW); - wcex.hbrBackground = 0; - wcex.lpszMenuName = 0; - wcex.lpszClassName = kDumpRenderTreeClassName; - wcex.hIconSm = 0; - - RegisterClassEx(&wcex); -} - -void displayWebView() -{ - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); -} - -void dumpFrameScrollPosition(IWebFrame* frame) -{ - if (!frame) - return; - - COMPtr<IWebFramePrivate> framePrivate; - if (FAILED(frame->QueryInterface(&framePrivate))) - return; - - SIZE scrollPosition; - if (FAILED(framePrivate->scrollOffset(&scrollPosition))) - return; - - if (abs(scrollPosition.cx) > 0.00000001 || abs(scrollPosition.cy) > 0.00000001) { - COMPtr<IWebFrame> parent; - if (FAILED(frame->parentFrame(&parent))) - return; - if (parent) { - BSTR name; - if (FAILED(frame->name(&name))) - return; - printf("frame '%S' ", name ? name : L""); - SysFreeString(name); - } - printf("scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy); - } - - if (::gTestRunner->dumpChildFrameScrollPositions()) { - COMPtr<IEnumVARIANT> enumKids; - if (FAILED(frame->childFrames(&enumKids))) - return; - VARIANT var; - VariantInit(&var); - while (enumKids->Next(1, &var, 0) == S_OK) { - ASSERT(V_VT(&var) == VT_UNKNOWN); - COMPtr<IWebFrame> framePtr; - V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr); - dumpFrameScrollPosition(framePtr.get()); - VariantClear(&var); - } - } -} - -static wstring dumpFramesAsText(IWebFrame* frame) -{ - if (!frame) - return L""; - - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return L""; - - COMPtr<IDOMElement> documentElement; - if (FAILED(document->documentElement(&documentElement))) - return L""; - - wstring result; - - // Add header for all but the main frame. - COMPtr<IWebFrame> parent; - if (FAILED(frame->parentFrame(&parent))) - return L""; - if (parent) { - BSTR name = L""; - if (FAILED(frame->name(&name))) - return L""; - - result.append(L"\n--------\nFrame: '"); - result.append(name ? name : L"", SysStringLen(name)); - result.append(L"'\n--------\n"); - - SysFreeString(name); - } - - BSTR innerText = 0; - COMPtr<IDOMElementPrivate> docPrivate; - if (SUCCEEDED(documentElement->QueryInterface(&docPrivate))) - docPrivate->innerText(&innerText); - - result.append(innerText ? innerText : L"", SysStringLen(innerText)); - result.append(L"\n"); - - SysFreeString(innerText); - - if (::gTestRunner->dumpChildFramesAsText()) { - COMPtr<IEnumVARIANT> enumKids; - if (FAILED(frame->childFrames(&enumKids))) - return L""; - VARIANT var; - VariantInit(&var); - while (enumKids->Next(1, &var, 0) == S_OK) { - ASSERT(V_VT(&var) == VT_UNKNOWN); - COMPtr<IWebFrame> framePtr; - V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr); - result.append(dumpFramesAsText(framePtr.get())); - VariantClear(&var); - } - } - - return result; -} - -static int compareHistoryItems(const void* item1, const void* item2) -{ - COMPtr<IWebHistoryItemPrivate> itemA; - if (FAILED((*(COMPtr<IUnknown>*)item1)->QueryInterface(&itemA))) - return 0; - - COMPtr<IWebHistoryItemPrivate> itemB; - if (FAILED((*(COMPtr<IUnknown>*)item2)->QueryInterface(&itemB))) - return 0; - - BSTR targetA; - if (FAILED(itemA->target(&targetA))) - return 0; - - BSTR targetB; - if (FAILED(itemB->target(&targetB))) { - SysFreeString(targetA); - return 0; - } - - int result = wcsicmp(wstring(targetA, SysStringLen(targetA)).c_str(), wstring(targetB, SysStringLen(targetB)).c_str()); - SysFreeString(targetA); - SysFreeString(targetB); - return result; -} - -static void dumpHistoryItem(IWebHistoryItem* item, int indent, bool current) -{ - ASSERT(item); - - int start = 0; - if (current) { - printf("curr->"); - start = 6; - } - for (int i = start; i < indent; i++) - putchar(' '); - - BSTR url; - if (FAILED(item->URLString(&url))) - return; - - if (wcsstr(url, L"file:/") == url) { - static wchar_t* layoutTestsString = L"/LayoutTests/"; - static wchar_t* fileTestString = L"(file test):"; - - wchar_t* result = wcsstr(url, layoutTestsString); - if (result == NULL) - return; - wchar_t* start = result + wcslen(layoutTestsString); - - BSTR newURL = SysAllocStringLen(NULL, SysStringLen(url)); - wcscpy(newURL, fileTestString); - wcscpy(newURL + wcslen(fileTestString), start); - - SysFreeString(url); - url = newURL; - } - - printf("%S", url ? url : L""); - SysFreeString(url); - - COMPtr<IWebHistoryItemPrivate> itemPrivate; - if (FAILED(item->QueryInterface(&itemPrivate))) - return; - - BSTR target; - if (FAILED(itemPrivate->target(&target))) - return; - if (SysStringLen(target)) - printf(" (in frame \"%S\")", target); - SysFreeString(target); - BOOL isTargetItem = FALSE; - if (FAILED(itemPrivate->isTargetItem(&isTargetItem))) - return; - if (isTargetItem) - printf(" **nav target**"); - putchar('\n'); - - unsigned kidsCount; - SAFEARRAY* arrPtr; - if (FAILED(itemPrivate->children(&kidsCount, &arrPtr)) || !kidsCount) - return; - - Vector<COMPtr<IUnknown> > kidsVector; - - LONG lowerBound; - if (FAILED(::SafeArrayGetLBound(arrPtr, 1, &lowerBound))) - goto exit; - - LONG upperBound; - if (FAILED(::SafeArrayGetUBound(arrPtr, 1, &upperBound))) - goto exit; - - LONG length = upperBound - lowerBound + 1; - if (!length) - goto exit; - ASSERT(length == kidsCount); - - IUnknown** safeArrayData; - if (FAILED(::SafeArrayAccessData(arrPtr, (void**)&safeArrayData))) - goto exit; - - for (int i = 0; i < length; ++i) - kidsVector.append(safeArrayData[i]); - ::SafeArrayUnaccessData(arrPtr); - - // must sort to eliminate arbitrary result ordering which defeats reproducible testing - qsort(kidsVector.data(), kidsCount, sizeof(kidsVector[0]), compareHistoryItems); - - for (unsigned i = 0; i < kidsCount; ++i) { - COMPtr<IWebHistoryItem> item; - kidsVector[i]->QueryInterface(&item); - dumpHistoryItem(item.get(), indent + 4, false); - } - -exit: - if (arrPtr && SUCCEEDED(::SafeArrayUnlock(arrPtr))) - ::SafeArrayDestroy(arrPtr); -} - -static void dumpBackForwardList(IWebView* webView) -{ - ASSERT(webView); - - printf("\n============== Back Forward List ==============\n"); - - COMPtr<IWebBackForwardList> bfList; - if (FAILED(webView->backForwardList(&bfList))) - return; - - // Print out all items in the list after prevTestBFItem, which was from the previous test - // Gather items from the end of the list, the print them out from oldest to newest - - Vector<COMPtr<IUnknown> > itemsToPrint; - - int forwardListCount; - if (FAILED(bfList->forwardListCount(&forwardListCount))) - return; - - for (int i = forwardListCount; i > 0; --i) { - COMPtr<IWebHistoryItem> item; - 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); - COMPtr<IUnknown> itemUnknown; - item->QueryInterface(&itemUnknown); - itemsToPrint.append(itemUnknown); - } - - COMPtr<IWebHistoryItem> currentItem; - if (FAILED(bfList->currentItem(¤tItem))) - return; - - ASSERT(currentItem != prevTestBFItem); - COMPtr<IUnknown> currentItemUnknown; - currentItem->QueryInterface(¤tItemUnknown); - itemsToPrint.append(currentItemUnknown); - int currentItemIndex = itemsToPrint.size() - 1; - - int backListCount; - if (FAILED(bfList->backListCount(&backListCount))) - return; - - for (int i = -1; i >= -backListCount; --i) { - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(i, &item))) - return; - if (item == prevTestBFItem) - break; - COMPtr<IUnknown> itemUnknown; - item->QueryInterface(&itemUnknown); - itemsToPrint.append(itemUnknown); - } - - for (int i = itemsToPrint.size() - 1; i >= 0; --i) { - COMPtr<IWebHistoryItem> historyItemToPrint; - itemsToPrint[i]->QueryInterface(&historyItemToPrint); - dumpHistoryItem(historyItemToPrint.get(), 8, i == currentItemIndex); - } - - printf("===============================================\n"); -} - -static void dumpBackForwardListForAllWindows() -{ - unsigned count = openWindows().size(); - for (unsigned i = 0; i < count; i++) { - HWND window = openWindows()[i]; - IWebView* webView = windowToWebViewMap().get(window).get(); - dumpBackForwardList(webView); - } -} - -static void invalidateAnyPreviousWaitToDumpWatchdog() -{ - if (!waitToDumpWatchdog) - return; - - KillTimer(0, waitToDumpWatchdog); - waitToDumpWatchdog = 0; -} - -void dump() -{ - invalidateAnyPreviousWaitToDumpWatchdog(); - - COMPtr<IWebDataSource> dataSource; - if (SUCCEEDED(frame->dataSource(&dataSource))) { - COMPtr<IWebURLResponse> response; - if (SUCCEEDED(dataSource->response(&response)) && response) { - BSTR mimeType; - if (SUCCEEDED(response->MIMEType(&mimeType)) && !_tcscmp(mimeType, TEXT("text/plain"))) { - ::gTestRunner->setDumpAsText(true); - ::gTestRunner->setGeneratePixelResults(false); - } - SysFreeString(mimeType); - } - } - - BSTR resultString = 0; - - if (dumpTree) { - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); - - if (::gTestRunner->dumpAsText()) { - wstring result = dumpFramesAsText(frame); - resultString = SysAllocStringLen(result.data(), result.size()); - } else { - COMPtr<IWebFramePrivate> framePrivate; - if (FAILED(frame->QueryInterface(&framePrivate))) - goto fail; - framePrivate->renderTreeAsExternalRepresentation(gTestRunner->isPrinting(), &resultString); - } - - if (!resultString) - printf("ERROR: nil result from %s", ::gTestRunner->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation"); - else { - unsigned stringLength = SysStringLen(resultString); - int bufferSize = ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, 0, 0, 0, 0); - char* buffer = (char*)malloc(bufferSize + 1); - ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, buffer, bufferSize + 1, 0, 0); - fwrite(buffer, 1, bufferSize, stdout); - free(buffer); - if (!::gTestRunner->dumpAsText()) - dumpFrameScrollPosition(frame); - } - if (::gTestRunner->dumpBackForwardList()) - dumpBackForwardListForAllWindows(); - } - - if (printSeparators) { - puts("#EOF"); // terminate the content block - fputs("#EOF\n", stderr); - fflush(stdout); - fflush(stderr); - } - - if (dumpPixelsForCurrentTest - && gTestRunner->generatePixelResults() - && !gTestRunner->dumpDOMAsWebArchive() - && !gTestRunner->dumpSourceAsWebArchive()) - dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash()); - - printf("#EOF\n"); // terminate the (possibly empty) pixels block - fflush(stdout); - -fail: - SysFreeString(resultString); - // This will exit from our message loop. - PostQuitMessage(0); - done = true; -} - -static bool shouldLogFrameLoadDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "/loading/") || strstr(pathOrURL, "\\loading\\"); -} - -static bool shouldLogHistoryDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\"); -} - -static bool shouldOpenWebInspector(const char* pathOrURL) -{ - return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\"); -} - -static bool shouldDumpAsText(const char* pathOrURL) -{ - return strstr(pathOrURL, "/dumpAsText/") || strstr(pathOrURL, "\\dumpAsText\\"); -} - -static bool shouldEnableDeveloperExtras(const char* pathOrURL) -{ - return true; -} - -static void resetDefaultsToConsistentValues(IWebPreferences* preferences) -{ -#ifdef USE_MAC_FONTS - static BSTR standardFamily = SysAllocString(TEXT("Times")); - static BSTR fixedFamily = SysAllocString(TEXT("Courier")); - static BSTR sansSerifFamily = SysAllocString(TEXT("Helvetica")); - static BSTR cursiveFamily = SysAllocString(TEXT("Apple Chancery")); - static BSTR fantasyFamily = SysAllocString(TEXT("Papyrus")); - static BSTR pictographFamily = SysAllocString(TEXT("Apple Color Emoji")); -#else - static BSTR standardFamily = SysAllocString(TEXT("Times New Roman")); - static BSTR fixedFamily = SysAllocString(TEXT("Courier New")); - static BSTR sansSerifFamily = SysAllocString(TEXT("Arial")); - static BSTR cursiveFamily = SysAllocString(TEXT("Comic Sans MS")); // Not actually cursive, but it's what IE and Firefox use. - static BSTR fantasyFamily = SysAllocString(TEXT("Times New Roman")); - static BSTR pictographFamily = SysAllocString(TEXT("Times New Roman")); -#endif - - preferences->setStandardFontFamily(standardFamily); - preferences->setFixedFontFamily(fixedFamily); - preferences->setSerifFontFamily(standardFamily); - preferences->setSansSerifFontFamily(sansSerifFamily); - preferences->setCursiveFontFamily(cursiveFamily); - preferences->setFantasyFontFamily(fantasyFamily); - preferences->setPictographFontFamily(pictographFamily); - - preferences->setAutosaves(FALSE); - preferences->setDefaultFontSize(16); - preferences->setDefaultFixedFontSize(13); - preferences->setMinimumFontSize(0); - preferences->setJavaEnabled(FALSE); - preferences->setPlugInsEnabled(TRUE); - preferences->setDOMPasteAllowed(TRUE); - preferences->setEditableLinkBehavior(WebKitEditableLinkOnlyLiveWithShiftKey); - preferences->setFontSmoothing(FontSmoothingTypeStandard); - preferences->setUsesPageCache(FALSE); - preferences->setPrivateBrowsingEnabled(FALSE); - preferences->setJavaScriptCanOpenWindowsAutomatically(TRUE); - preferences->setJavaScriptEnabled(TRUE); - preferences->setTabsToLinks(FALSE); - preferences->setShouldPrintBackgrounds(TRUE); - preferences->setLoadsImagesAutomatically(TRUE); - preferences->setSeamlessIFramesEnabled(TRUE); - - if (persistentUserStyleSheetLocation) { - Vector<wchar_t> urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get())); - CFStringGetCharacters(persistentUserStyleSheetLocation.get(), CFRangeMake(0, CFStringGetLength(persistentUserStyleSheetLocation.get())), (UniChar *)urlCharacters.data()); - BSTR url = SysAllocStringLen(urlCharacters.data(), urlCharacters.size()); - preferences->setUserStyleSheetLocation(url); - SysFreeString(url); - preferences->setUserStyleSheetEnabled(TRUE); - } else - preferences->setUserStyleSheetEnabled(FALSE); - - COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); - if (prefsPrivate) { - prefsPrivate->setAllowUniversalAccessFromFileURLs(TRUE); - prefsPrivate->setAllowFileAccessFromFileURLs(TRUE); - prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); - prefsPrivate->setDeveloperExtrasEnabled(FALSE); - prefsPrivate->setExperimentalNotificationsEnabled(TRUE); - 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->setOfflineWebApplicationCacheEnabled(TRUE); - prefsPrivate->setLoadsSiteIconsIgnoringImageLoadingPreference(FALSE); - } - setAlwaysAcceptCookies(false); - - setlocale(LC_ALL, ""); -} - -static void resetWebViewToConsistentStateBeforeTesting() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - webView->setPolicyDelegate(0); - policyDelegate->setPermissive(false); - policyDelegate->setControllerToNotifyDone(0); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (webIBActions) { - webIBActions->makeTextStandardSize(0); - webIBActions->resetPageZoom(0); - } - - - COMPtr<IWebPreferences> preferences; - if (SUCCEEDED(webView->preferences(&preferences))) - resetDefaultsToConsistentValues(preferences.get()); - - if (gTestRunner) { - JSGlobalContextRef context = frame->globalContext(); - WebCoreTestSupport::resetInternalsObject(context); - } - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return; - - HWND viewWindow; - if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) - SetFocus(viewWindow); - - webViewPrivate->clearMainFrameName(); - webViewPrivate->resetOriginAccessWhitelists(); - - BSTR groupName; - if (SUCCEEDED(webView->groupName(&groupName))) { - webViewPrivate->removeAllUserContentFromGroup(groupName); - SysFreeString(groupName); - } - - sharedUIDelegate->resetUndoManager(); - - sharedFrameLoadDelegate->resetToConsistentState(); - - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->clearOpener(); -} - -static void sizeWebViewForCurrentTest() -{ - bool isSVGW3CTest = (gTestRunner->testPathOrURL().find("svg\\W3C-SVG-1.1") != string::npos); - unsigned width; - unsigned height; - if (isSVGW3CTest) { - width = TestRunner::w3cSVGViewWidth; - height = TestRunner::w3cSVGViewHeight; - } else { - 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); - const string& pathOrURL = command.pathOrURL; - dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; - - static BSTR methodBStr = SysAllocString(TEXT("GET")); - - BSTR urlBStr; - - CFStringRef str = CFStringCreateWithCString(0, pathOrURL.c_str(), kCFStringEncodingWindowsLatin1); - CFURLRef url = CFURLCreateWithString(0, str, 0); - - if (!url) - url = CFURLCreateWithFileSystemPath(0, str, kCFURLWindowsPathStyle, false); - - CFRelease(str); - - String fallbackPath = findFontFallback(pathOrURL.c_str()); - - str = CFURLGetString(url); - - CFIndex length = CFStringGetLength(str); - UniChar* buffer = new UniChar[length]; - - CFStringGetCharacters(str, CFRangeMake(0, length), buffer); - urlBStr = SysAllocStringLen((OLECHAR*)buffer, length); - delete[] buffer; - - CFRelease(url); - - ::gTestRunner = TestRunner::create(pathOrURL, command.expectedPixelHash); - done = false; - topLoadingFrame = 0; - - addFontFallbackIfPresent(fallbackPath); - - sizeWebViewForCurrentTest(); - gTestRunner->setIconDatabaseEnabled(false); - - if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) - gTestRunner->setDumpFrameLoadCallbacks(true); - - COMPtr<IWebView> webView; - if (SUCCEEDED(frame->webView(&webView))) { - COMPtr<IWebViewPrivate> viewPrivate; - if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) { - if (shouldLogHistoryDelegates(pathOrURL.c_str())) { - gTestRunner->setDumpHistoryDelegateCallbacks(true); - viewPrivate->setHistoryDelegate(sharedHistoryDelegate.get()); - } else - viewPrivate->setHistoryDelegate(0); - } - } - COMPtr<IWebHistory> history; - if (SUCCEEDED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - history->setOptionalSharedHistory(0); - - resetWebViewToConsistentStateBeforeTesting(); - - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gTestRunner->setDeveloperExtrasEnabled(true); - if (shouldOpenWebInspector(pathOrURL.c_str())) - gTestRunner->showWebInspector(); - } - if (shouldDumpAsText(pathOrURL.c_str())) { - gTestRunner->setDumpAsText(true); - gTestRunner->setGeneratePixelResults(false); - } - - prevTestBFItem = 0; - if (webView) { - COMPtr<IWebBackForwardList> bfList; - if (SUCCEEDED(webView->backForwardList(&bfList))) - bfList->currentItem(&prevTestBFItem); - } - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - HWND hostWindow; - webView->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - - COMPtr<IWebMutableURLRequest> request; - HRESULT hr = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, IID_IWebMutableURLRequest, (void**)&request); - if (FAILED(hr)) - goto exit; - - request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 60); - - request->setHTTPMethod(methodBStr); - frame->loadRequest(request.get()); - - MSG msg; - while (GetMessage(&msg, 0, 0, 0)) { - // We get spurious WM_MOUSELEAVE events which make event handling machinery think that mouse button - // is released during dragging (see e.g. fast\dynamic\layer-hit-test-crash.html). - // Mouse can never leave WebView during normal DumpRenderTree operation, so we just ignore all such events. - if (msg.message == WM_MOUSELEAVE) - continue; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gTestRunner->closeWebInspector(); - gTestRunner->setDeveloperExtrasEnabled(false); - } - - resetWebViewToConsistentStateBeforeTesting(); - - frame->stopLoading(); - - if (::gTestRunner->closeRemainingWindowsWhenComplete()) { - Vector<HWND> windows = openWindows(); - unsigned size = windows.size(); - for (unsigned i = 0; i < size; i++) { - HWND window = windows[i]; - - // Don't try to close the main window - if (window == hostWindow) - continue; - - DestroyWindow(window); - } - } - -exit: - removeFontFallbackIfPresent(fallbackPath); - SysFreeString(urlBStr); - ::gTestRunner.clear(); - - return; -} - -Vector<HWND>& openWindows() -{ - static Vector<HWND> vector; - return vector; -} - -WindowToWebViewMap& windowToWebViewMap() -{ - static WindowToWebViewMap map; - return map; -} - -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) -{ - 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); - - IWebView* webView; - - HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&webView); - if (FAILED(hr)) { - fprintf(stderr, "Failed to create CLSID_WebView instance, error 0x%x\n", hr); - return 0; - } - - if (FAILED(webView->setHostWindow((OLE_HANDLE)(ULONG64)hostWindow))) - return 0; - - RECT clientRect; - clientRect.bottom = clientRect.left = clientRect.top = clientRect.right = 0; - BSTR groupName = SysAllocString(L"org.webkit.DumpRenderTree"); - bool failed = FAILED(webView->initWithFrame(clientRect, 0, groupName)); - SysFreeString(groupName); - if (failed) - return 0; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return 0; - - viewPrivate->setShouldApplyMacFontAscentHack(TRUE); - viewPrivate->setAlwaysUsesComplexTextCodePath(forceComplexText); - - BSTR pluginPath = SysAllocStringLen(0, exePath().length() + _tcslen(TestPluginDir)); - _tcscpy(pluginPath, exePath().c_str()); - _tcscat(pluginPath, TestPluginDir); - failed = FAILED(viewPrivate->addAdditionalPluginDirectory(pluginPath)); - SysFreeString(pluginPath); - if (failed) - return 0; - - HWND viewWindow; - if (FAILED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) - return 0; - if (webViewWindow) - *webViewWindow = viewWindow; - - SetWindowPos(viewWindow, 0, 0, 0, maxViewWidth, maxViewHeight, 0); - ShowWindow(hostWindow, SW_SHOW); - - if (FAILED(webView->setFrameLoadDelegate(sharedFrameLoadDelegate.get()))) - return 0; - - if (FAILED(viewPrivate->setFrameLoadDelegatePrivate(sharedFrameLoadDelegate.get()))) - return 0; - - if (FAILED(webView->setUIDelegate(sharedUIDelegate.get()))) - return 0; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return 0; - - if (FAILED(viewEditing->setEditingDelegate(sharedEditingDelegate.get()))) - return 0; - - ResourceLoadDelegate* resourceLoadDelegate = new ResourceLoadDelegate(); - HRESULT result = webView->setResourceLoadDelegate(resourceLoadDelegate); - resourceLoadDelegate->Release(); // The delegate is owned by the WebView, so release our reference to it. - if (FAILED(result)) - return 0; - - openWindows().append(hostWindow); - windowToWebViewMap().set(hostWindow, webView); - return webView; -} - -#if USE(CFNETWORK) -RetainPtr<CFURLCacheRef> sharedCFURLCache() -{ -#ifndef DEBUG_ALL - HMODULE module = GetModuleHandle(TEXT("CFNetwork.dll")); -#else - HMODULE module = GetModuleHandle(TEXT("CFNetwork_debug.dll")); -#endif - if (!module) - return 0; - - typedef CFURLCacheRef (*CFURLCacheCopySharedURLCacheProcPtr)(void); - if (CFURLCacheCopySharedURLCacheProcPtr copyCache = reinterpret_cast<CFURLCacheCopySharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheCopySharedURLCache"))) - return adoptCF(copyCache()); - - typedef CFURLCacheRef (*CFURLCacheSharedURLCacheProcPtr)(void); - if (CFURLCacheSharedURLCacheProcPtr sharedCache = reinterpret_cast<CFURLCacheSharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheSharedURLCache"))) - return sharedCache(); - - return 0; -} -#endif - -static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*) -{ - fputs("#CRASHED\n", stderr); - fflush(stderr); - return EXCEPTION_CONTINUE_SEARCH; -} - -extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[]) -{ - // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for - // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the - // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>. - ::SetErrorMode(0); - - ::SetUnhandledExceptionFilter(exceptionFilter); - - leakChecking = false; - - _setmode(1, _O_BINARY); - _setmode(2, _O_BINARY); - - initialize(); - - Vector<const char*> tests; - - for (int i = 1; i < argc; ++i) { - if (!stricmp(argv[i], "--threaded")) { - threaded = true; - continue; - } - - if (!stricmp(argv[i], "--dump-all-pixels")) { - dumpAllPixels = true; - continue; - } - - if (!stricmp(argv[i], "--complex-text")) { - forceComplexText = true; - continue; - } - - if (!stricmp(argv[i], "--print-supported-features")) { - printSupportedFeatures = true; - continue; - } - - if (!stricmp(argv[i], "--pixel-tests")) { - dumpPixelsForAllTests = true; - continue; - } - - tests.append(argv[i]); - } - - policyDelegate = new PolicyDelegate(); - sharedFrameLoadDelegate.adoptRef(new FrameLoadDelegate); - sharedUIDelegate.adoptRef(new UIDelegate); - sharedEditingDelegate.adoptRef(new EditingDelegate); - sharedHistoryDelegate.adoptRef(new HistoryDelegate); - - // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> - COMPtr<IWebPreferences> tmpPreferences; - if (FAILED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, reinterpret_cast<void**>(&tmpPreferences)))) - return -1; - COMPtr<IWebPreferences> standardPreferences; - if (FAILED(tmpPreferences->standardPreferences(&standardPreferences))) - return -1; - COMPtr<IWebPreferencesPrivate> standardPreferencesPrivate; - if (FAILED(standardPreferences->QueryInterface(&standardPreferencesPrivate))) - return -1; - standardPreferencesPrivate->setShouldPaintNativeControls(FALSE); - standardPreferences->setJavaScriptEnabled(TRUE); - standardPreferences->setDefaultFontSize(16); - standardPreferences->setAcceleratedCompositingEnabled(true); - standardPreferences->setAVFoundationEnabled(TRUE); - standardPreferences->setContinuousSpellCheckingEnabled(TRUE); - - if (printSupportedFeatures) { - BOOL acceleratedCompositingAvailable; - standardPreferences->acceleratedCompositingEnabled(&acceleratedCompositingAvailable); - -#if ENABLE(3D_RENDERING) - // In theory, we could have a software-based 3D rendering implementation that we use when - // hardware-acceleration is not available. But we don't have any such software - // implementation, so 3D rendering is only available when hardware-acceleration is. - BOOL threeDRenderingAvailable = acceleratedCompositingAvailable; -#else - BOOL threeDRenderingAvailable = FALSE; -#endif - - printf("SupportedFeatures:%s %s\n", acceleratedCompositingAvailable ? "AcceleratedCompositing" : "", threeDRenderingAvailable ? "3DRendering" : ""); - 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; - - COMPtr<IWebIconDatabase> iconDatabase; - COMPtr<IWebIconDatabase> tmpIconDatabase; - if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) - return -1; - if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) - return -1; - - if (FAILED(webView->mainFrame(&frame))) - return -1; - -#if USE(CFNETWORK) - RetainPtr<CFURLCacheRef> urlCache = sharedCFURLCache(); - CFURLCacheRemoveAllCachedResponses(urlCache.get()); -#endif - -#ifdef _DEBUG - _CrtMemState entryToMainMemCheckpoint; - if (leakChecking) - _CrtMemCheckpoint(&entryToMainMemCheckpoint); -#endif - - if (threaded) - startJavaScriptThreads(); - - if (tests.size() == 1 && !strcmp(tests[0], "-")) { - char filenameBuffer[2048]; - printSeparators = true; - while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { - char* newLineCharacter = strchr(filenameBuffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (strlen(filenameBuffer) == 0) - continue; - - runTest(filenameBuffer); - } - } else { - printSeparators = tests.size() > 1; - for (int i = 0; i < tests.size(); i++) - runTest(tests[i]); - } - - if (threaded) - stopJavaScriptThreads(); - - delete policyDelegate; - frame->Release(); - -#ifdef _DEBUG - if (leakChecking) { - // dump leaks to stderr - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtMemDumpAllObjectsSince(&entryToMainMemCheckpoint); - } -#endif - - shutDownWebKit(); - - return 0; -} diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeWin.h b/Tools/DumpRenderTree/win/DumpRenderTreeWin.h deleted file mode 100644 index c64c3bf50..000000000 --- a/Tools/DumpRenderTree/win/DumpRenderTreeWin.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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. - */ - -#ifndef DumpRenderTreeWin_h -#define DumpRenderTreeWin_h - -struct IWebFrame; -struct IWebScriptWorld; -struct IWebView; -struct FrameLoadDelegate; -struct PolicyDelegate; -typedef const struct __CFString* CFStringRef; -typedef struct HWND__* HWND; - -extern IWebFrame* topLoadingFrame; -extern IWebFrame* frame; -extern PolicyDelegate* policyDelegate; - -extern HWND webViewWindow; - -#include <WebCore/COMPtr.h> -#include <string> -#include <wtf/HashMap.h> -#include <wtf/Vector.h> - -std::wstring urlSuitableForTestResult(const std::wstring& url); -std::wstring lastPathComponent(const std::wstring&); -std::string toUTF8(BSTR); -std::string toUTF8(const std::wstring&); -std::wstring cfStringRefToWString(CFStringRef); - -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); -Vector<HWND>& openWindows(); -typedef HashMap<HWND, COMPtr<IWebView> > WindowToWebViewMap; -WindowToWebViewMap& windowToWebViewMap(); - -void setPersistentUserStyleSheetLocation(CFStringRef); -bool setAlwaysAcceptCookies(bool alwaysAcceptCookies); - -unsigned worldIDForWorld(IWebScriptWorld*); - -extern UINT_PTR waitToDumpWatchdog; - -extern COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; - -#endif // DumpRenderTreeWin_h diff --git a/Tools/DumpRenderTree/win/EditingDelegate.cpp b/Tools/DumpRenderTree/win/EditingDelegate.cpp deleted file mode 100644 index 0975c54d4..000000000 --- a/Tools/DumpRenderTree/win/EditingDelegate.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (C) 2007 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 "EditingDelegate.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <WebCore/COMPtr.h> -#include <wtf/Assertions.h> -#include <wtf/Platform.h> -#include <string> -#include <tchar.h> - -using std::wstring; - -EditingDelegate::EditingDelegate() - : m_refCount(1) - , m_acceptsEditing(true) -{ -} - -// IUnknown -HRESULT STDMETHODCALLTYPE EditingDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebEditingDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebEditingDelegate)) - *ppvObject = static_cast<IWebEditingDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE EditingDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE EditingDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete this; - - return newRef; -} - -static wstring dumpPath(IDOMNode* node) -{ - ASSERT(node); - - wstring result; - - BSTR name; - if (FAILED(node->nodeName(&name))) - return result; - result.assign(name, SysStringLen(name)); - SysFreeString(name); - - COMPtr<IDOMNode> parent; - if (SUCCEEDED(node->parentNode(&parent))) - result += TEXT(" > ") + dumpPath(parent.get()); - - return result; -} - -static wstring dump(IDOMRange* range) -{ - ASSERT(range); - - int startOffset; - if (FAILED(range->startOffset(&startOffset))) - return 0; - - int endOffset; - if (FAILED(range->endOffset(&endOffset))) - return 0; - - COMPtr<IDOMNode> startContainer; - if (FAILED(range->startContainer(&startContainer))) - return 0; - - COMPtr<IDOMNode> endContainer; - if (FAILED(range->endContainer(&endContainer))) - return 0; - - wchar_t buffer[1024]; - _snwprintf(buffer, ARRAYSIZE(buffer), L"range from %ld of %s to %ld of %s", startOffset, dumpPath(startContainer.get()), endOffset, dumpPath(endContainer.get())); - return buffer; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldBeginEditingInDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldEndEditingInDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertNode( - /* [in] */ IWebView* webView, - /* [in] */ IDOMNode* node, - /* [in] */ IDOMRange* range, - /* [in] */ WebViewInsertAction action) -{ - static LPCTSTR insertactionstring[] = { - TEXT("WebViewInsertActionTyped"), - TEXT("WebViewInsertActionPasted"), - TEXT("WebViewInsertActionDropped"), - }; - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n"), dumpPath(node), dump(range), insertactionstring[action]); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertText( - /* [in] */ IWebView* webView, - /* [in] */ BSTR text, - /* [in] */ IDOMRange* range, - /* [in] */ WebViewInsertAction action, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - static LPCTSTR insertactionstring[] = { - TEXT("WebViewInsertActionTyped"), - TEXT("WebViewInsertActionPasted"), - TEXT("WebViewInsertActionDropped"), - }; - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n"), text ? text : TEXT(""), dump(range), insertactionstring[action]); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldDeleteDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldDeleteDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeSelectedDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* currentRange, - /* [in] */ IDOMRange* proposedRange, - /* [in] */ WebSelectionAffinity selectionAffinity, - /* [in] */ BOOL stillSelecting, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - static LPCTSTR affinitystring[] = { - TEXT("NSSelectionAffinityUpstream"), - TEXT("NSSelectionAffinityDownstream") - }; - static LPCTSTR boolstring[] = { - TEXT("FALSE"), - TEXT("TRUE") - }; - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n"), dump(currentRange), dump(proposedRange), affinitystring[selectionAffinity], boolstring[stillSelecting]); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldApplyStyle( - /* [in] */ IWebView* webView, - /* [in] */ IDOMCSSStyleDeclaration* style, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n"), TEXT("'style description'")/*[[style description] UTF8String]*/, dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeTypingStyle( - /* [in] */ IWebView* webView, - /* [in] */ IDOMCSSStyleDeclaration* currentStyle, - /* [in] */ IDOMCSSStyleDeclaration* proposedStyle, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n"), TEXT("'currentStyle description'"), TEXT("'proposedStyle description'")); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::doPlatformCommand( - /* [in] */ IWebView *webView, - /* [in] */ BSTR command, - /* [retval][out] */ BOOL *result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gTestRunner->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: doPlatformCommand:%s\n"), command ? command : TEXT("")); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidBeginEditing( - /* [in] */ IWebNotification* notification) -{ - if (::gTestRunner->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChange( - /* [in] */ IWebNotification *notification) -{ - if (::gTestRunner->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidEndEditing( - /* [in] */ IWebNotification *notification) -{ - if (::gTestRunner->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidEndEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeTypingStyle( - /* [in] */ IWebNotification *notification) -{ - if (::gTestRunner->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeSelection( - /* [in] */ IWebNotification *notification) -{ - if (::gTestRunner->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeSelection:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -static int indexOfFirstWordCharacter(const TCHAR* text) -{ - const TCHAR* cursor = text; - while (*cursor && !iswalpha(*cursor)) - ++cursor; - return *cursor ? (cursor - text) : -1; -}; - -static int wordLength(const TCHAR* text) -{ - const TCHAR* cursor = text; - while (*cursor && iswalpha(*cursor)) - ++cursor; - return cursor - text; -}; - -HRESULT STDMETHODCALLTYPE EditingDelegate::checkSpellingOfString( - /* [in] */ IWebView* view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ int* misspellingLocation, - /* [out] */ int* misspellingLength) -{ - static const TCHAR* 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. - TEXT("foo"), - TEXT("Foo"), - TEXT("baz"), - TEXT("fo"), - TEXT("LibertyF"), - TEXT("chello"), - TEXT("xxxtestxxx"), - TEXT("XXxxx"), - TEXT("Textx"), - TEXT("blockquoted"), - TEXT("asd"), - TEXT("Lorem"), - TEXT("Nunc"), - TEXT("Curabitur"), - TEXT("eu"), - TEXT("adlj"), - TEXT("adaasj"), - TEXT("sdklj"), - TEXT("jlkds"), - TEXT("jsaada"), - TEXT("jlda"), - TEXT("zz"), - TEXT("contentEditable"), - 0, - }; - - wstring textString(text, length); - int wordStart = indexOfFirstWordCharacter(textString.c_str()); - if (-1 == wordStart) - return S_OK; - wstring word = textString.substr(wordStart, wordLength(textString.c_str() + wordStart)); - for (size_t i = 0; misspelledWords[i]; ++i) { - if (word == misspelledWords[i]) { - *misspellingLocation = wordStart; - *misspellingLength = word.size(); - break; - } - } - - return S_OK; -} diff --git a/Tools/DumpRenderTree/win/EditingDelegate.h b/Tools/DumpRenderTree/win/EditingDelegate.h deleted file mode 100644 index 7b7f418aa..000000000 --- a/Tools/DumpRenderTree/win/EditingDelegate.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef EditingDelegate_h -#define EditingDelegate_h - -#include <WebKit/WebKit.h> - -class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate { -public: - EditingDelegate(); - - void setAcceptsEditing(bool b) { m_acceptsEditing = b; } - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebEditingDelegate - virtual HRESULT STDMETHODCALLTYPE shouldBeginEditingInDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldEndEditingInDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldInsertNode( - /* [in] */ IWebView *webView, - /* [in] */ IDOMNode *node, - /* [in] */ IDOMRange *range, - /* [in] */ WebViewInsertAction action); - - virtual HRESULT STDMETHODCALLTYPE shouldInsertText( - /* [in] */ IWebView *webView, - /* [in] */ BSTR text, - /* [in] */ IDOMRange *range, - /* [in] */ WebViewInsertAction action, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldDeleteDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldChangeSelectedDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *currentRange, - /* [in] */ IDOMRange *proposedRange, - /* [in] */ WebSelectionAffinity selectionAffinity, - /* [in] */ BOOL stillSelecting, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldApplyStyle( - /* [in] */ IWebView *webView, - /* [in] */ IDOMCSSStyleDeclaration *style, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldChangeTypingStyle( - /* [in] */ IWebView *webView, - /* [in] */ IDOMCSSStyleDeclaration *currentStyle, - /* [in] */ IDOMCSSStyleDeclaration *proposedStyle, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE doPlatformCommand( - /* [in] */ IWebView *webView, - /* [in] */ BSTR command, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE webViewDidBeginEditing( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChange( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidEndEditing( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChangeTypingStyle( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChangeSelection( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE undoManagerForWebView( - /* [in] */ IWebView *webView, - /* [retval][out] */ IWebUndoManager **undoManager) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE ignoreWordInSpellDocument( - /* [in] */ IWebView *view, - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE learnWord( - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE checkSpellingOfString( - /* [in] */ IWebView *view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ int *misspellingLocation, - /* [out] */ int *misspellingLength); - - virtual HRESULT STDMETHODCALLTYPE checkGrammarOfString( - /* [in] */ IWebView *view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ IEnumWebGrammarDetails **grammarDetails, - /* [out] */ int *badGrammarLocation, - /* [out] */ int *badGrammarLength) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithGrammarString( - /* [in] */ BSTR string, - /* [in] */ int location, - /* [in] */ int length, - /* [in] */ BSTR userDescription, - /* [in] */ BSTR *guesses, - /* [in] */ int guessesCount) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithMisspelledWord( - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE showSpellingUI( - /* [in] */ BOOL show) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE spellingUIIsShowing( - /* [retval][out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE guessesForWord( - /* [in] */ BSTR word, - /* [retval][out] */ IEnumSpellingGuesses **guesses) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE closeSpellDocument( - /* [in] */ IWebView *view) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE sharedSpellCheckerExists( - /* [retval][out] */ BOOL *exists) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE preflightChosenSpellServer( void) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateGrammar( void) { return E_NOTIMPL; } - -private: - bool m_acceptsEditing; - ULONG m_refCount; -}; - -#endif // !defined(EditingDelegate_h) diff --git a/Tools/DumpRenderTree/win/EventSender.cpp b/Tools/DumpRenderTree/win/EventSender.cpp deleted file mode 100644 index 5cc73c0b8..000000000 --- a/Tools/DumpRenderTree/win/EventSender.cpp +++ /dev/null @@ -1,809 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2012 Baidu 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 "EventSender.h" - -#include "DRTDataObject.h" -#include "DRTDropSource.h" -#include "DraggingInfo.h" -#include "DumpRenderTree.h" - -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <windows.h> -#include <wtf/ASCIICType.h> -#include <wtf/Assertions.h> -#include <wtf/Platform.h> -#include <wtf/text/WTFString.h> - -#define WM_DRT_SEND_QUEUED_EVENT (WM_APP+1) -#ifndef MAPVK_VK_TO_VSC -#define MAPVK_VK_TO_VSC 0 -#endif - -static bool down; -static bool dragMode = true; -static bool replayingSavedEvents; -static int timeOffset; -static POINT lastMousePosition; - -struct DelayedMessage { - MSG msg; - unsigned delay; -}; - -static DelayedMessage msgQueue[1024]; -static unsigned endOfQueue; -static unsigned startOfQueue; - -static bool didDragEnter; -DraggingInfo* draggingInfo = 0; - -static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - return JSValueMakeBoolean(context, dragMode); -} - -static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) -{ - dragMode = JSValueToBoolean(context, value); - return true; -} - -static JSValueRef getConstantCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - if (JSStringIsEqualToUTF8CString(propertyName, "WM_KEYDOWN")) - return JSValueMakeNumber(context, WM_KEYDOWN); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_KEYUP")) - return JSValueMakeNumber(context, WM_KEYUP); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_CHAR")) - return JSValueMakeNumber(context, WM_CHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_DEADCHAR")) - return JSValueMakeNumber(context, WM_DEADCHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSKEYDOWN")) - return JSValueMakeNumber(context, WM_SYSKEYDOWN); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSKEYUP")) - return JSValueMakeNumber(context, WM_SYSKEYUP); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSCHAR")) - return JSValueMakeNumber(context, WM_SYSCHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSDEADCHAR")) - return JSValueMakeNumber(context, WM_SYSDEADCHAR); - ASSERT_NOT_REACHED(); - return JSValueMakeUndefined(context); -} - -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount > 0) { - msgQueue[endOfQueue].delay = JSValueToNumber(context, arguments[0], exception); - ASSERT(!exception || !*exception); - } - - return JSValueMakeUndefined(context); -} - -static DWORD currentEventTime() -{ - return ::GetTickCount() + timeOffset; -} - -static MSG makeMsg(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - MSG result = {0}; - result.hwnd = hwnd; - result.message = message; - result.wParam = wParam; - result.lParam = lParam; - result.time = currentEventTime(); - result.pt = lastMousePosition; - - return result; -} - -static LRESULT dispatchMessage(const MSG* msg) -{ - ASSERT(msg); - ::TranslateMessage(msg); - return ::DispatchMessage(msg); -} - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - down = true; - MSG msg = makeMsg(webViewWindow, WM_RBUTTONDOWN, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - dispatchMessage(&msg); - down = false; - msg = makeMsg(webViewWindow, WM_RBUTTONUP, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - dispatchMessage(&msg); - - return JSValueMakeUndefined(context); -} - -static WPARAM buildModifierFlags(JSContextRef context, const JSValueRef modifiers) -{ - JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0); - if (!modifiersArray) - return 0; - - WPARAM flags = 0; - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, JSStringCreateWithUTF8CString("length"), 0), 0); - for (int i = 0; i < modifiersCount; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0); - JSStringRef string = JSValueToStringCopy(context, value, 0); - if (JSStringIsEqualToUTF8CString(string, "ctrlKey") - || JSStringIsEqualToUTF8CString(string, "addSelectionKey")) - flags |= MK_CONTROL; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey") - || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey")) - flags |= MK_SHIFT; - // No way to specifiy altKey in a MSG. - - JSStringRelease(string); - } - return flags; -} - -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - down = true; - int mouseType = WM_LBUTTONDOWN; - if (argumentCount >= 1) { - int mouseNumber = JSValueToNumber(context, arguments[0], exception); - switch (mouseNumber) { - case 0: - mouseType = WM_LBUTTONDOWN; - break; - case 1: - mouseType = WM_MBUTTONDOWN; - break; - case 2: - mouseType = WM_RBUTTONDOWN; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button has event.button = 1, so send an WM_BUTTONDOWN - mouseType = WM_MBUTTONDOWN; - break; - default: - mouseType = WM_LBUTTONDOWN; - break; - } - } - - WPARAM wparam = 0; - if (argumentCount >= 2) - wparam |= buildModifierFlags(context, arguments[1]); - - MSG msg = makeMsg(webViewWindow, mouseType, wparam, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - if (!msgQueue[endOfQueue].delay) - dispatchMessage(&msg); - else { - // replaySavedEvents has the required logic to make leapForward delays work - msgQueue[endOfQueue++].msg = msg; - replaySavedEvents(); - } - - return JSValueMakeUndefined(context); -} - -static inline POINTL pointl(const POINT& point) -{ - POINTL result; - result.x = point.x; - result.y = point.y; - return result; -} - -static void doMouseUp(MSG msg, HRESULT* oleDragAndDropReturnValue = 0) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - dispatchMessage(&msg); - down = false; - - if (draggingInfo) { - COMPtr<IWebView> webView; - COMPtr<IDropTarget> webViewDropTarget; - if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { - POINT screenPoint = msg.pt; - DWORD effect = 0; - ::ClientToScreen(webViewWindow, &screenPoint); - if (!didDragEnter) { - webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - didDragEnter = true; - } - HRESULT hr = draggingInfo->dropSource()->QueryContinueDrag(0, 0); - if (oleDragAndDropReturnValue) - *oleDragAndDropReturnValue = hr; - webViewDropTarget->DragOver(0, pointl(screenPoint), &effect); - if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) { - DWORD effect = 0; - webViewDropTarget->Drop(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - draggingInfo->setPerformedDropEffect(effect); - } else - webViewDropTarget->DragLeave(); - - // Reset didDragEnter so that another drag started within the same frame works properly. - didDragEnter = false; - } - } -} - -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int mouseType = WM_LBUTTONUP; - if (argumentCount >= 1) { - int mouseNumber = JSValueToNumber(context, arguments[0], exception); - switch (mouseNumber) { - case 0: - mouseType = WM_LBUTTONUP; - break; - case 1: - mouseType = WM_MBUTTONUP; - break; - case 2: - mouseType = WM_RBUTTONUP; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button has event.button = 1, so send an WM_MBUTTONUP - mouseType = WM_MBUTTONUP; - break; - default: - mouseType = WM_LBUTTONUP; - break; - } - } - - WPARAM wparam = 0; - if (argumentCount >= 2) - wparam |= buildModifierFlags(context, arguments[1]); - - MSG msg = makeMsg(webViewWindow, mouseType, wparam, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - - if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) { - msgQueue[endOfQueue++].msg = msg; - replaySavedEvents(); - } else - doMouseUp(msg); - - return JSValueMakeUndefined(context); -} - -static void doMouseMove(MSG msg) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - dispatchMessage(&msg); - - if (down && draggingInfo) { - POINT screenPoint = msg.pt; - ::ClientToScreen(webViewWindow, &screenPoint); - - IWebView* webView; - COMPtr<IDropTarget> webViewDropTarget; - if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { - DWORD effect = 0; - if (didDragEnter) - webViewDropTarget->DragOver(MK_LBUTTON, pointl(screenPoint), &effect); - else { - webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - didDragEnter = true; - } - draggingInfo->dropSource()->GiveFeedback(effect); - } - } -} - -static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - lastMousePosition.x = (int)JSValueToNumber(context, arguments[0], exception); - ASSERT(!exception || !*exception); - lastMousePosition.y = (int)JSValueToNumber(context, arguments[1], exception); - ASSERT(!exception || !*exception); - - MSG msg = makeMsg(webViewWindow, WM_MOUSEMOVE, down ? MK_LBUTTON : 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - - if (dragMode && down && !replayingSavedEvents) { - msgQueue[endOfQueue++].msg = msg; - return JSValueMakeUndefined(context); - } - - doMouseMove(msg); - - return JSValueMakeUndefined(context); -} - -void replaySavedEvents(HRESULT* oleDragAndDropReturnValue) -{ - replayingSavedEvents = true; - - MSG msg = { 0 }; - - while (startOfQueue < endOfQueue && !msgQueue[startOfQueue].delay) { - msg = msgQueue[startOfQueue++].msg; - switch (msg.message) { - case WM_LBUTTONUP: - case WM_RBUTTONUP: - case WM_MBUTTONUP: - doMouseUp(msg, oleDragAndDropReturnValue); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_MBUTTONDOWN: - dispatchMessage(&msg); - break; - default: - // Not reached - break; - } - } - - int numQueuedMessages = endOfQueue - startOfQueue; - if (!numQueuedMessages) { - startOfQueue = 0; - endOfQueue = 0; - replayingSavedEvents = false; - ASSERT(!down); - return; - } - - if (msgQueue[startOfQueue].delay) { - ::Sleep(msgQueue[startOfQueue].delay); - msgQueue[startOfQueue].delay = 0; - } - - ::PostMessage(webViewWindow, WM_DRT_SEND_QUEUED_EVENT, 0, 0); - while (::GetMessage(&msg, webViewWindow, 0, 0)) { - // FIXME: Why do we get a WM_MOUSELEAVE? it breaks tests - if (msg.message == WM_MOUSELEAVE) - continue; - if (msg.message != WM_DRT_SEND_QUEUED_EVENT) { - dispatchMessage(&msg); - continue; - } - msg = msgQueue[startOfQueue++].msg; - switch (msg.message) { - case WM_LBUTTONUP: - case WM_RBUTTONUP: - case WM_MBUTTONUP: - doMouseUp(msg, oleDragAndDropReturnValue); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_MBUTTONDOWN: - dispatchMessage(&msg); - break; - default: - // Not reached - break; - } - if (startOfQueue >= endOfQueue) - break; - ::Sleep(msgQueue[startOfQueue].delay); - msgQueue[startOfQueue].delay = 0; - ::PostMessage(webViewWindow, WM_DRT_SEND_QUEUED_EVENT, 0, 0); - } - startOfQueue = 0; - endOfQueue = 0; - - replayingSavedEvents = false; -} - -static int makeKeyDataForScanCode(int virtualKeyCode) -{ - unsigned scancode = MapVirtualKey(virtualKeyCode, MAPVK_VK_TO_VSC); - int keyData = scancode & 0xFF; - scancode = scancode >> 8; - if (scancode == 0xe0 || scancode == 0xe1) - keyData += KF_EXTENDED; - return keyData << 16; -} - -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); - - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); - ASSERT(!*exception); - int virtualKeyCode; - int charCode = 0; - int keyData = 1; - bool needsShiftKeyModifier = false; - if (JSStringIsEqualToUTF8CString(character, "leftArrow")) { - virtualKeyCode = VK_LEFT; - keyData += KF_EXTENDED << 16; // In this case, extended means "not keypad". - } else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) { - virtualKeyCode = VK_RIGHT; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "upArrow")) { - virtualKeyCode = VK_UP; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "downArrow")) { - virtualKeyCode = VK_DOWN; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "pageUp")) - virtualKeyCode = VK_PRIOR; - else if (JSStringIsEqualToUTF8CString(character, "pageDown")) - virtualKeyCode = VK_NEXT; - else if (JSStringIsEqualToUTF8CString(character, "home")) - virtualKeyCode = VK_HOME; - else if (JSStringIsEqualToUTF8CString(character, "end")) - virtualKeyCode = VK_END; - else if (JSStringIsEqualToUTF8CString(character, "insert")) - virtualKeyCode = VK_INSERT; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - virtualKeyCode = VK_DELETE; - else if (JSStringIsEqualToUTF8CString(character, "printScreen")) - virtualKeyCode = VK_SNAPSHOT; - else if (JSStringIsEqualToUTF8CString(character, "menu")) - virtualKeyCode = VK_APPS; - else if (JSStringIsEqualToUTF8CString(character, "leftControl")) { - virtualKeyCode = VK_CONTROL; - keyData += makeKeyDataForScanCode(VK_LCONTROL); - } else if (JSStringIsEqualToUTF8CString(character, "leftShift")) { - virtualKeyCode = VK_SHIFT; - keyData += makeKeyDataForScanCode(VK_LSHIFT); - } else if (JSStringIsEqualToUTF8CString(character, "leftAlt")) { - virtualKeyCode = VK_MENU; - keyData += makeKeyDataForScanCode(VK_LMENU); - } else if (JSStringIsEqualToUTF8CString(character, "rightControl")) { - virtualKeyCode = VK_CONTROL; - keyData += makeKeyDataForScanCode(VK_RCONTROL); - } else if (JSStringIsEqualToUTF8CString(character, "rightShift")) { - virtualKeyCode = VK_SHIFT; - keyData += makeKeyDataForScanCode(VK_RSHIFT); - } else if (JSStringIsEqualToUTF8CString(character, "rightAlt")) { - virtualKeyCode = VK_MENU; - keyData += makeKeyDataForScanCode(VK_RMENU); - } else { - charCode = JSStringGetCharactersPtr(character)[0]; - virtualKeyCode = LOBYTE(VkKeyScan(charCode)); - if (WTF::isASCIIUpper(charCode)) - needsShiftKeyModifier = true; - } - JSStringRelease(character); - - BYTE keyState[256]; - if (argumentCount > 1 || needsShiftKeyModifier) { - ::GetKeyboardState(keyState); - - BYTE newKeyState[256]; - memcpy(newKeyState, keyState, sizeof(keyState)); - - if (needsShiftKeyModifier) - newKeyState[VK_SHIFT] = 0x80; - - if (argumentCount > 1) { - JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0); - if (modifiersArray) { - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); - for (int i = 0; i < modifiersCount; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0); - JSStringRef string = JSValueToStringCopy(context, value, 0); - if (JSStringIsEqualToUTF8CString(string, "ctrlKey") || JSStringIsEqualToUTF8CString(string, "addSelectionKey")) - newKeyState[VK_CONTROL] = 0x80; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey") || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey")) - newKeyState[VK_SHIFT] = 0x80; - else if (JSStringIsEqualToUTF8CString(string, "altKey")) - newKeyState[VK_MENU] = 0x80; - - JSStringRelease(string); - } - } - } - - ::SetKeyboardState(newKeyState); - } - - MSG msg = makeMsg(webViewWindow, (::GetKeyState(VK_MENU) & 0x8000) ? WM_SYSKEYDOWN : WM_KEYDOWN, virtualKeyCode, keyData); - if (virtualKeyCode != 255) - dispatchMessage(&msg); - else { - // For characters that do not exist in the active keyboard layout, - // ::Translate will not work, so we post an WM_CHAR event ourselves. - ::PostMessage(webViewWindow, WM_CHAR, charCode, 0); - } - - // Tests expect that all messages are processed by the time keyDown() returns. - if (::PeekMessage(&msg, webViewWindow, WM_CHAR, WM_CHAR, PM_REMOVE) || ::PeekMessage(&msg, webViewWindow, WM_SYSCHAR, WM_SYSCHAR, PM_REMOVE)) - ::DispatchMessage(&msg); - - MSG msgUp = makeMsg(webViewWindow, (::GetKeyState(VK_MENU) & 0x8000) ? WM_SYSKEYUP : WM_KEYUP, virtualKeyCode, keyData); - ::DispatchMessage(&msgUp); - - if (argumentCount > 1 || needsShiftKeyModifier) - ::SetKeyboardState(keyState); - - return JSValueMakeUndefined(context); -} - -// eventSender.dispatchMessage(message, wParam, lParam, time = currentEventTime(), x = lastMousePosition.x, y = lastMousePosition.y) -static JSValueRef dispatchMessageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - MSG msg = {}; - msg.hwnd = webViewWindow; - msg.message = JSValueToNumber(context, arguments[0], exception); - ASSERT(!*exception); - msg.wParam = JSValueToNumber(context, arguments[1], exception); - ASSERT(!*exception); - msg.lParam = static_cast<ULONG_PTR>(JSValueToNumber(context, arguments[2], exception)); - ASSERT(!*exception); - if (argumentCount >= 4) { - msg.time = JSValueToNumber(context, arguments[3], exception); - ASSERT(!*exception); - } - if (!msg.time) - msg.time = currentEventTime(); - if (argumentCount >= 6) { - msg.pt.x = JSValueToNumber(context, arguments[4], exception); - ASSERT(!*exception); - msg.pt.y = JSValueToNumber(context, arguments[5], exception); - ASSERT(!*exception); - } else - msg.pt = lastMousePosition; - - ::DispatchMessage(&msg); - - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->makeTextLarger(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->makeTextSmaller(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->zoomPageIn(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->zoomPageOut(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSObjectRef filesArray = JSValueToObject(context, arguments[0], 0); - - if (!filesArray) - return JSValueMakeUndefined(context); - - JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); - Vector<UChar> files; - int filesCount = JSValueToNumber(context, JSObjectGetProperty(context, filesArray, lengthProperty, 0), 0); - for (int i = 0; i < filesCount; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, filesArray, i, 0); - JSStringRef file = JSValueToStringCopy(context, value, 0); - files.append(JSStringGetCharactersPtr(file), JSStringGetLength(file)); - files.append(0); - JSStringRelease(file); - } - - if (files.isEmpty()) - return JSValueMakeUndefined(context); - - // We should append "0" in the end of |files| so that |DragQueryFileW| retrieved the number of files correctly from Ole Clipboard. - files.append(0); - - STGMEDIUM hDropMedium = {0}; - hDropMedium.tymed = TYMED_HGLOBAL; - SIZE_T dropFilesSize = sizeof(DROPFILES) + (sizeof(WCHAR) * files.size()); - hDropMedium.hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dropFilesSize); - DROPFILES* dropFiles = reinterpret_cast<DROPFILES*>(GlobalLock(hDropMedium.hGlobal)); - memset(dropFiles, 0, sizeof(DROPFILES)); - dropFiles->pFiles = sizeof(DROPFILES); - dropFiles->fWide = TRUE; - - UChar* data = reinterpret_cast<UChar*>(reinterpret_cast<BYTE*>(dropFiles) + sizeof(DROPFILES)); - for (size_t i = 0; i < files.size(); ++i) - data[i] = files[i]; - GlobalUnlock(hDropMedium.hGlobal); - - STGMEDIUM hFileNameMedium = {0}; - hFileNameMedium.tymed = TYMED_HGLOBAL; - SIZE_T hFileNameSize = sizeof(WCHAR) * files.size(); - hFileNameMedium.hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, hFileNameSize); - WCHAR* hFileName = static_cast<WCHAR*>(GlobalLock(hFileNameMedium.hGlobal)); - for (size_t i = 0; i < files.size(); i++) - hFileName[i] = files[i]; - GlobalUnlock(hFileNameMedium.hGlobal); - - if (draggingInfo) { - delete draggingInfo; - draggingInfo = 0; - } - - COMPtr<DRTDataObject> dataObeject; - COMPtr<IDropSource> source; - if (FAILED(DRTDataObject::createInstance(&dataObeject))) - dataObeject = 0; - - if (FAILED(DRTDropSource::createInstance(&source))) - source = 0; - - if (dataObeject && source) { - draggingInfo = new DraggingInfo(dataObeject.get(), source.get()); - draggingInfo->setPerformedDropEffect(DROPEFFECT_COPY); - } - - if (draggingInfo) { - draggingInfo->dataObject()->SetData(cfHDropFormat(), &hDropMedium, FALSE); - draggingInfo->dataObject()->SetData(cfFileNameWFormat(), &hFileNameMedium, FALSE); - draggingInfo->dataObject()->SetData(cfUrlWFormat(), &hFileNameMedium, FALSE); - OleSetClipboard(draggingInfo->dataObject()); - down = true; - } - - JSStringRelease(lengthProperty); - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "dispatchMessage", dispatchMessageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticValues[] = { - { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone }, - { "WM_KEYDOWN", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_KEYUP", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_CHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_DEADCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSKEYDOWN", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSKEYUP", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSDEADCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef eventSenderClass = 0; - - if (!eventSenderClass) { - JSClassDefinition classDefinition = {0}; - classDefinition.staticFunctions = staticFunctions; - classDefinition.staticValues = staticValues; - - eventSenderClass = JSClassCreate(&classDefinition); - } - - return eventSenderClass; -} - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame) -{ - if (isTopFrame) { - down = false; - dragMode = true; - replayingSavedEvents = false; - timeOffset = 0; - lastMousePosition.x = 0; - lastMousePosition.y = 0; - - endOfQueue = 0; - startOfQueue = 0; - - didDragEnter = false; - draggingInfo = 0; - } - return JSObjectMake(context, getClass(context), 0); -} diff --git a/Tools/DumpRenderTree/win/EventSender.h b/Tools/DumpRenderTree/win/EventSender.h deleted file mode 100644 index a0add85eb..000000000 --- a/Tools/DumpRenderTree/win/EventSender.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef EventSender_h -#define EventSender_h - -class DraggingInfo; - -typedef long HRESULT; -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame); -void replaySavedEvents(HRESULT* oleDragAndDropReturnValue = 0); - -extern DraggingInfo* draggingInfo; - -#endif diff --git a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp b/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp deleted file mode 100644 index 0ea40fa17..000000000 --- a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. 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 "FrameLoadDelegate.h" - -#include "AccessibilityController.h" -#include "DumpRenderTree.h" -#include "EventSender.h" -#include "GCController.h" -#include "TestRunner.h" -#include "TextInputController.h" -#include "WebCoreTestSupport.h" -#include "WorkQueueItem.h" -#include "WorkQueue.h" -#include <WebCore/COMPtr.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <stdio.h> -#include <string> -#include <wtf/Assertions.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -using std::string; - -static FrameLoadDelegate* g_delegateWaitingOnTimer; - -string descriptionSuitableForTestResult(IWebFrame* webFrame) -{ - COMPtr<IWebView> webView; - if (FAILED(webFrame->webView(&webView))) - return string(); - - COMPtr<IWebFrame> mainFrame; - if (FAILED(webView->mainFrame(&mainFrame))) - return string(); - - BSTR frameNameBSTR; - if (FAILED(webFrame->name(&frameNameBSTR)) || toUTF8(frameNameBSTR).empty()) - return (webFrame == mainFrame) ? "main frame" : string(); - - string frameName = (webFrame == mainFrame) ? "main frame" : "frame"; - frameName += " \"" + toUTF8(frameNameBSTR) + "\""; - - SysFreeString(frameNameBSTR); - return frameName; -} - -FrameLoadDelegate::FrameLoadDelegate() - : m_refCount(1) - , m_gcController(adoptPtr(new GCController)) - , m_accessibilityController(adoptPtr(new AccessibilityController)) - , m_textInputController(adoptPtr(new TextInputController)) -{ -} - -FrameLoadDelegate::~FrameLoadDelegate() -{ -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate)) - *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate)) - *ppvObject = static_cast<IWebFrameLoadDelegatePrivate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate2)) - *ppvObject = static_cast<IWebFrameLoadDelegatePrivate2*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE FrameLoadDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE FrameLoadDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didStartProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - // Make sure we only set this once per test. If it gets cleared, and then set again, we might - // end up doing two dumps for one test. - if (!topLoadingFrame && !done) - topLoadingFrame = frame; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveServerRedirectForProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFailProvisionalLoadWithError\n", descriptionSuitableForTestResult(frame).c_str()); - - locationChangeDone(error, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didCommitLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - COMPtr<IWebViewPrivate> webViewPrivate; - HRESULT hr = webView->QueryInterface(&webViewPrivate); - if (FAILED(hr)) - return hr; - webViewPrivate->updateFocusedAndActiveState(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didReceiveTitle: %S\n", descriptionSuitableForTestResult(frame).c_str(), title); - - if (::gTestRunner->dumpTitleChanges() && !done) - printf("TITLE CHANGED: '%S'\n", title ? title : L""); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didChangeIcons( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gTestRunner->dumpIconChanges()) - printf("%s - didChangeIcons\n", descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - -void FrameLoadDelegate::processWork() -{ - // if another load started, then wait for it to complete. - if (topLoadingFrame) - return; - - // if we finish all the commands, we're ready to dump state - if (WorkQueue::shared()->processWork() && !::gTestRunner->waitToDump()) - dump(); -} - -void FrameLoadDelegate::resetToConsistentState() -{ - m_accessibilityController->resetToConsistentState(); -} - -typedef Vector<COMPtr<FrameLoadDelegate> > DelegateVector; -static DelegateVector& delegatesWithDelayedWork() -{ - DEFINE_STATIC_LOCAL(DelegateVector, delegates, ()); - return delegates; -} - -static UINT_PTR processWorkTimerID; - -static void CALLBACK processWorkTimer(HWND hwnd, UINT, UINT_PTR id, DWORD) -{ - ASSERT_ARG(id, id == processWorkTimerID); - ::KillTimer(hwnd, id); - processWorkTimerID = 0; - - DelegateVector delegates; - delegates.swap(delegatesWithDelayedWork()); - - for (size_t i = 0; i < delegates.size(); ++i) - delegates[i]->processWork(); -} - -void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame) -{ - if (frame != topLoadingFrame) - return; - - topLoadingFrame = 0; - WorkQueue::shared()->setFrozen(true); - - if (::gTestRunner->waitToDump()) - return; - - if (WorkQueue::shared()->count()) { - if (!processWorkTimerID) - processWorkTimerID = ::SetTimer(0, 0, 0, processWorkTimer); - delegatesWithDelayedWork().append(this); - return; - } - - dump(); -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFinishLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - locationChangeDone(0, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailLoadWithError( - /* [in] */ IWebView* webView, - /* [in] */ IWebError* error, - /* [in] */ IWebFrame* frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFailLoadWithError\n", descriptionSuitableForTestResult(frame).c_str()); - - locationChangeDone(error, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willPerformClientRedirectToURL( - /* [in] */ IWebView *webView, - /* [in] */ BSTR url, - /* [in] */ double delaySeconds, - /* [in] */ DATE fireDate, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - willPerformClientRedirectToURL: %S \n", descriptionSuitableForTestResult(frame).c_str(), - urlSuitableForTestResult(std::wstring(url, ::SysStringLen(url))).c_str()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCancelClientRedirectForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didCancelClientRedirectForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - return E_NOTIMPL; -} - -HRESULT FrameLoadDelegate::didClearWindowObject(IWebView*, JSContextRef, JSObjectRef, IWebFrame*) -{ - return E_NOTIMPL; -} - -HRESULT FrameLoadDelegate::didClearWindowObjectForFrameInScriptWorld(IWebView* webView, IWebFrame* frame, IWebScriptWorld* world) -{ - ASSERT_ARG(webView, webView); - ASSERT_ARG(frame, frame); - ASSERT_ARG(world, world); - if (!webView || !frame || !world) - return E_POINTER; - - COMPtr<IWebScriptWorld> standardWorld; - if (FAILED(world->standardWorld(&standardWorld))) - return S_OK; - - if (world == standardWorld) - didClearWindowObjectForFrameInStandardWorld(frame); - else - didClearWindowObjectForFrameInIsolatedWorld(frame, world); - return S_OK; -} - -void FrameLoadDelegate::didClearWindowObjectForFrameInIsolatedWorld(IWebFrame* frame, IWebScriptWorld* world) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - JSGlobalContextRef ctx = framePrivate->globalContextForScriptWorld(world); - if (!ctx) - return; - - JSObjectRef globalObject = JSContextGetGlobalObject(ctx); - if (!globalObject) - return; - - JSObjectSetProperty(ctx, globalObject, JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString("__worldID")).get(), JSValueMakeNumber(ctx, worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0); - return; -} - -void FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld(IWebFrame* frame) -{ - JSGlobalContextRef context = frame->globalContext(); - JSObjectRef windowObject = JSContextGetGlobalObject(context); - - IWebFrame* parentFrame = 0; - frame->parentFrame(&parentFrame); - - JSValueRef exception = 0; - - ::gTestRunner->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_gcController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_accessibilityController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_textInputController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); - JSValueRef eventSender = makeEventSender(context, !parentFrame); - JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - JSStringRelease(eventSenderStr); - - WebCoreTestSupport::injectInternalsObject(context); -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishDocumentLoadForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didFinishDocumentLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - if (!done) { - COMPtr<IWebFramePrivate> webFramePrivate; - HRESULT hr = frame->QueryInterface(&webFramePrivate); - if (FAILED(hr)) - return hr; - unsigned pendingFrameUnloadEvents; - hr = webFramePrivate->pendingFrameUnloadEventCount(&pendingFrameUnloadEvents); - if (FAILED(hr)) - return hr; - if (pendingFrameUnloadEvents) - printf("%s - has %u onunload handler(s)\n", - descriptionSuitableForTestResult(frame).c_str(), pendingFrameUnloadEvents); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didHandleOnloadEventsForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("%s - didHandleOnloadEventsForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFirstVisuallyNonEmptyLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didDisplayInsecureContent( - /* [in] */ IWebView *sender) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didDisplayInsecureContent\n"); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didRunInsecureContent( - /* [in] */ IWebView *sender, - /* [in] */ IWebSecurityOrigin *origin) -{ - if (!done && gTestRunner->dumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); - - return S_OK; -} - diff --git a/Tools/DumpRenderTree/win/FrameLoadDelegate.h b/Tools/DumpRenderTree/win/FrameLoadDelegate.h deleted file mode 100644 index c842579f1..000000000 --- a/Tools/DumpRenderTree/win/FrameLoadDelegate.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 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. - */ - -#ifndef FrameLoadDelegate_h -#define FrameLoadDelegate_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> - -class AccessibilityController; -class TextInputController; -class GCController; - -class FrameLoadDelegate : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate2 { -public: - FrameLoadDelegate(); - virtual ~FrameLoadDelegate(); - - void processWork(); - - void resetToConsistentState(); - - AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); } - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebFrameLoadDelegate - virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didChangeIcons( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveIcon( - /* [in] */ IWebView *webView, - /* [in] */ OLE_HANDLE image, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *forFrame); - - virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL( - /* [in] */ IWebView *webView, - /* [in] */ BSTR url, - /* [in] */ double delaySeconds, - /* [in] */ DATE fireDate, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( - /* [in] */ IWebView *sender, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; } - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( - /* [in] */ IWebView* webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame); - - // IWebFrameLoadDelegatePrivate - virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - // IWebFrameLoadDelegatePrivate2 - virtual HRESULT STDMETHODCALLTYPE didDisplayInsecureContent( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE didRunInsecureContent( - /* [in] */ IWebView *sender, - /* [in] */ IWebSecurityOrigin *origin); - - virtual HRESULT STDMETHODCALLTYPE didClearWindowObjectForFrameInScriptWorld(IWebView*, IWebFrame*, IWebScriptWorld*); - - virtual HRESULT STDMETHODCALLTYPE didPushStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didReplaceStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didPopStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - -private: - void didClearWindowObjectForFrameInIsolatedWorld(IWebFrame*, IWebScriptWorld*); - void didClearWindowObjectForFrameInStandardWorld(IWebFrame*); - - void locationChangeDone(IWebError*, IWebFrame*); - - ULONG m_refCount; - OwnPtr<GCController> m_gcController; - OwnPtr<AccessibilityController> m_accessibilityController; - OwnPtr<TextInputController> m_textInputController; -}; - -#endif // FrameLoadDelegate_h diff --git a/Tools/DumpRenderTree/win/GCControllerWin.cpp b/Tools/DumpRenderTree/win/GCControllerWin.cpp deleted file mode 100644 index b86725086..000000000 --- a/Tools/DumpRenderTree/win/GCControllerWin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2007 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 "GCController.h" - -#include "DumpRenderTree.h" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> - -void GCController::collect() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collect(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collectOnAlternateThread(waitUntilDone ? TRUE : FALSE); -} - -size_t GCController::getJSObjectCount() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return 0; - UINT objects = 0; - collector->objectCount(&objects); - return objects; -} diff --git a/Tools/DumpRenderTree/win/HistoryDelegate.cpp b/Tools/DumpRenderTree/win/HistoryDelegate.cpp deleted file mode 100644 index ab92b0928..000000000 --- a/Tools/DumpRenderTree/win/HistoryDelegate.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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 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. - */ - -#include "config.h" -#include "HistoryDelegate.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeWin.h" -#include "TestRunner.h" -#include <string> -#include <WebKit/WebKit.h> - -using std::wstring; - -static inline wstring wstringFromBSTR(BSTR str) -{ - return wstring(str, ::SysStringLen(str)); -} - -HistoryDelegate::HistoryDelegate() - : m_refCount(1) -{ -} - -HistoryDelegate::~HistoryDelegate() -{ -} - - // IUnknown -HRESULT HistoryDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebHistoryDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebHistoryDelegate)) - *ppvObject = static_cast<IWebHistoryDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG HistoryDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG HistoryDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -// IWebHistoryDelegate -HRESULT HistoryDelegate::didNavigateWithNavigationData(IWebView* webView, IWebNavigationData* navigationData, IWebFrame* webFrame) -{ - if (!gTestRunner->dumpHistoryDelegateCallbacks()) - return S_OK; - - BSTR urlBSTR; - if (FAILED(navigationData->url(&urlBSTR))) - return E_FAIL; - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - SysFreeString(urlBSTR); - - BSTR titleBSTR; - if (FAILED(navigationData->title(&titleBSTR))) - return E_FAIL; - wstring title; - if (titleBSTR) - title = wstringFromBSTR(titleBSTR); - SysFreeString(titleBSTR); - - COMPtr<IWebURLRequest> request; - if (FAILED(navigationData->originalRequest(&request))) - return E_FAIL; - - BSTR httpMethodBSTR; - if (FAILED(request->HTTPMethod(&httpMethodBSTR))) - return E_FAIL; - wstring httpMethod; - if (httpMethodBSTR) - httpMethod = wstringFromBSTR(httpMethodBSTR); - SysFreeString(httpMethodBSTR); - - COMPtr<IWebURLResponse> response; - if (FAILED(navigationData->response(&response))) - return E_FAIL; - - COMPtr<IWebHTTPURLResponse> httpResponse; - if (FAILED(response->QueryInterface(&httpResponse))) - return E_FAIL; - - int statusCode = 0; - if (FAILED(httpResponse->statusCode(&statusCode))) - return E_FAIL; - - BOOL hasSubstituteData; - if (FAILED(navigationData->hasSubstituteData(&hasSubstituteData))) - return E_FAIL; - - BSTR clientRedirectSourceBSTR; - if (FAILED(navigationData->clientRedirectSource(&clientRedirectSourceBSTR))) - return E_FAIL; - bool hasClientRedirect = clientRedirectSourceBSTR && SysStringLen(clientRedirectSourceBSTR); - wstring redirectSource; - if (clientRedirectSourceBSTR) - redirectSource = urlSuitableForTestResult(wstringFromBSTR(clientRedirectSourceBSTR)); - SysFreeString(clientRedirectSourceBSTR); - - bool wasFailure = hasSubstituteData || (httpResponse && statusCode >= 400); - - printf("WebView navigated to url \"%S\" with title \"%S\" with HTTP equivalent method \"%S\". The navigation was %s and was %s%S.\n", - url.c_str(), - title.c_str(), - httpMethod.c_str(), - wasFailure ? "a failure" : "successful", - hasClientRedirect ? "a client redirect from " : "not a client redirect", - redirectSource.c_str()); - - return S_OK; -} - -HRESULT HistoryDelegate::didPerformClientRedirectFromURL(IWebView*, BSTR sourceURL, BSTR destinationURL, IWebFrame*) -{ - if (!gTestRunner->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring source; - if (sourceURL) - source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); - - wstring destination; - if (destinationURL) - destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); - - printf("WebView performed a client redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::didPerformServerRedirectFromURL(IWebView* webView, BSTR sourceURL, BSTR destinationURL, IWebFrame* webFrame) -{ - if (!gTestRunner->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring source; - if (sourceURL) - source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); - - wstring destination; - if (destinationURL) - destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); - - printf("WebView performed a server redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::updateHistoryTitle(IWebView* webView, BSTR titleBSTR, BSTR urlBSTR) -{ - if (!gTestRunner->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - - wstring title; - if (titleBSTR) - title = wstringFromBSTR(titleBSTR); - - printf("WebView updated the title for history URL \"%S\" to \"%S\".\n", url.c_str(), title.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::populateVisitedLinksForWebView(IWebView* webView) -{ - if (!gTestRunner->dumpHistoryDelegateCallbacks()) - return S_OK; - - BSTR urlBSTR; - if (FAILED(webView->mainFrameURL(&urlBSTR))) - return E_FAIL; - - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - SysFreeString(urlBSTR); - - if (gTestRunner->dumpVisitedLinksCallback()) - printf("Asked to populate visited links for WebView \"%S\"\n", url.c_str()); - - return S_OK; -} diff --git a/Tools/DumpRenderTree/win/HistoryDelegate.h b/Tools/DumpRenderTree/win/HistoryDelegate.h deleted file mode 100644 index 41be670db..000000000 --- a/Tools/DumpRenderTree/win/HistoryDelegate.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 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. - */ - -#ifndef HistoryDelegate_h -#define HistoryDelegate_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> - -class HistoryDelegate : public IWebHistoryDelegate { -public: - HistoryDelegate(); - virtual ~HistoryDelegate(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebHistoryDelegate - virtual HRESULT STDMETHODCALLTYPE didNavigateWithNavigationData( - /* [in] */ IWebView* webView, - /* [in] */ IWebNavigationData* navigationData, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE didPerformClientRedirectFromURL( - /* [in] */ IWebView* webView, - /* [in] */ BSTR sourceURL, - /* [in] */ BSTR destinationURL, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE didPerformServerRedirectFromURL( - /* [in] */ IWebView* webView, - /* [in] */ BSTR sourceURL, - /* [in] */ BSTR destinationURL, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE updateHistoryTitle( - /* [in] */ IWebView* webView, - /* [in] */ BSTR title, - /* [in] */ BSTR url); - - virtual HRESULT STDMETHODCALLTYPE populateVisitedLinksForWebView( - /* [in] */ IWebView* webView); - -private: - ULONG m_refCount; -}; - -#endif // HistoryDelegate_h diff --git a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp b/Tools/DumpRenderTree/win/ImageDiffCairo.cpp deleted file mode 100644 index d5a81b495..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffCairo.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2005, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2005 Ben La Monica <ben.lamonica@gmail.com>. All rights reserved. - * Copyright (C) 2011 Brent Fulgham. 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 THE AUTHOR ``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 AUTHOR 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. - */ - -// FIXME: We need to be able to include these defines from a config.h somewhere. -#define JS_EXPORT_PRIVATE -#define WTF_EXPORT_PRIVATE - -#include <cairo.h> -#include <stdio.h> -#include <wtf/Platform.h> -#include <wtf/RefPtr.h> -#include <wtf/RetainPtr.h> - -#if PLATFORM(WIN) -#include <fcntl.h> -#include <io.h> -#include <windows.h> -#include <wtf/MathExtras.h> -#endif - -using namespace std; - -static const int s_bufferSize = 2048; -static const int s_bytesPerPixel = 4; -static cairo_user_data_key_t s_imageDataKey; - - -#if PLATFORM(WIN) -#undef min -#undef max - -static inline float strtof(const char* inputString, char** endptr) -{ - return strtod(inputString, endptr); -} -#endif - -static cairo_status_t readFromData(void* closure, unsigned char* data, unsigned int length) -{ - CFMutableDataRef dataSource = reinterpret_cast<CFMutableDataRef>(closure); - - CFRange range = CFRangeMake(0, length); - CFDataGetBytes(dataSource, range, data); - CFDataDeleteBytes(dataSource, range); - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_surface_t* createImageFromStdin(int bytesRemaining) -{ - unsigned char buffer[s_bufferSize]; - RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining)); - - while (bytesRemaining > 0) { - size_t bytesToRead = min(bytesRemaining, s_bufferSize); - size_t bytesRead = fread(buffer, 1, bytesToRead, stdin); - CFDataAppendBytes(data.get(), buffer, static_cast<CFIndex>(bytesRead)); - bytesRemaining -= static_cast<int>(bytesRead); - } - - return cairo_image_surface_create_from_png_stream (static_cast<cairo_read_func_t>(readFromData), data.get()); -} - -static void releaseMallocBuffer(void* data) -{ - free(data); -} - -static inline float pixelDifference(float expected, float actual) -{ - return (actual - expected) / max<float>(255 - expected, expected); -} - -static inline void normalizeBuffer(float maxDistance, unsigned char* buffer, size_t length) -{ - if (maxDistance >= 1) - return; - - for (size_t p = 0; p < length; ++p) - buffer[p] /= maxDistance; -} - -static cairo_surface_t* createDifferenceImage(cairo_surface_t* baselineImage, cairo_surface_t* actualImage, float& difference) -{ - size_t width = cairo_image_surface_get_width(baselineImage); - size_t height = cairo_image_surface_get_height(baselineImage); - - unsigned char* baselinePixel = cairo_image_surface_get_data(baselineImage); - unsigned char* actualPixel = cairo_image_surface_get_data(actualImage); - - // Compare the content of the 2 bitmaps - void* diffBuffer = malloc(width * height); - unsigned char* diffPixel = reinterpret_cast<unsigned char*>(diffBuffer); - - float count = 0; - float sum = 0; - float maxDistance = 0; - for (size_t y = 0; y < height; ++y) { - for (size_t x = 0; x < width; ++x) { - float red = pixelDifference(baselinePixel[0], actualPixel[0]); - float green = pixelDifference(baselinePixel[1], actualPixel[1]); - float blue = pixelDifference(baselinePixel[2], actualPixel[2]); - float alpha = pixelDifference(baselinePixel[3], actualPixel[3]); - - float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0; - - *diffPixel++ = static_cast<unsigned char>(distance * 255); - - if (distance >= 1.0 / 255.0) { - ++count; - sum += distance; - if (distance > maxDistance) - maxDistance = distance; - } - - baselinePixel += s_bytesPerPixel; - actualPixel += s_bytesPerPixel; - } - } - - // 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 - if (count > 0) - difference = 100.0f * sum / (height * width); - else - difference = 0; - - if (!difference) { - free(diffBuffer); - return 0; - } - - // Generate a normalized diff image - normalizeBuffer(maxDistance, reinterpret_cast<unsigned char*>(diffBuffer), height * width); - - cairo_surface_t* diffImage = cairo_image_surface_create_for_data(diffPixel, CAIRO_FORMAT_ARGB32, width, height, width * s_bytesPerPixel); - cairo_surface_set_user_data(diffImage, &s_imageDataKey, diffBuffer, releaseMallocBuffer); - - return diffImage; -} - -static inline bool imageHasAlpha(cairo_surface_t* image) -{ - return (cairo_image_surface_get_format(image) == CAIRO_FORMAT_ARGB32); -} - -static cairo_status_t writeToData(void* closure, unsigned char* data, unsigned int length) -{ - CFMutableDataRef dataTarget = reinterpret_cast<CFMutableDataRef>(closure); - - CFDataAppendBytes(dataTarget, data, length); - - return CAIRO_STATUS_SUCCESS; -} - -int main(int argc, const char* argv[]) -{ -#if PLATFORM(WIN) - _setmode(0, _O_BINARY); - _setmode(1, _O_BINARY); -#endif - - float tolerance = 0; - - for (int i = 1; i < argc; ++i) { - if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tolerance")) { - if (i >= argc - 1) - exit(1); - tolerance = strtof(argv[i + 1], 0); - ++i; - continue; - } - } - - char buffer[s_bufferSize]; - cairo_surface_t* actualImage = 0; - cairo_surface_t* baselineImage = 0; - - while (fgets(buffer, sizeof(buffer), stdin)) { - 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 && !actualImage) - actualImage = createImageFromStdin(imageSize); - else if (imageSize > 0 && !baselineImage) - baselineImage = createImageFromStdin(imageSize); - else - fputs("error, image size must be specified.\n", stdout); - } - - if (actualImage && baselineImage) { - cairo_surface_t* diffImage = 0; - float difference = 100.0; - - if ((cairo_image_surface_get_width(actualImage) == cairo_image_surface_get_width(baselineImage)) - && (cairo_image_surface_get_height(actualImage) == cairo_image_surface_get_height(baselineImage)) - && (imageHasAlpha(actualImage) == imageHasAlpha(baselineImage))) { - diffImage = createDifferenceImage(actualImage, baselineImage, difference); // difference is passed by reference - if (difference <= tolerance) - difference = 0; - else { - difference = roundf(difference * 100.0) / 100.0; - difference = max<float>(difference, 0.01); // round to 2 decimal places - } - } else - fputs("error, test and reference image have different properties.\n", stderr); - - if (difference > 0.0) { - if (diffImage) { - 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); - cairo_surface_destroy(diffImage); - diffImage = 0; - } - - fprintf(stdout, "diff: %01.2f%% failed\n", difference); - } else - fprintf(stdout, "diff: %01.2f%% passed\n", difference); - - cairo_surface_destroy(actualImage); - cairo_surface_destroy(baselineImage); - actualImage = 0; - baselineImage = 0; - } - - fflush(stdout); - } - - return 0; -} diff --git a/Tools/DumpRenderTree/win/ImageDiffWin.cpp b/Tools/DumpRenderTree/win/ImageDiffWin.cpp deleted file mode 100644 index 01dfc0b99..000000000 --- a/Tools/DumpRenderTree/win/ImageDiffWin.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - * - * 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 <windows.h> - -int main(int argc, const char* argv[]); - -extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[]) -{ - return main(argc, argv); -} diff --git a/Tools/DumpRenderTree/win/MD5.cpp b/Tools/DumpRenderTree/win/MD5.cpp deleted file mode 100644 index 1bfc9c75f..000000000 --- a/Tools/DumpRenderTree/win/MD5.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007 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 "MD5.h" - -#include <windows.h> - -typedef void (WINAPI*initPtr)(MD5_CTX*); -typedef void (WINAPI*updatePtr)(MD5_CTX*, unsigned char*, unsigned); -typedef void (WINAPI*finalPtr)(MD5_CTX*); - -static HMODULE cryptDLL() -{ - static HMODULE module = LoadLibraryW(L"Cryptdll.dll"); - return module; -} - -static initPtr init() -{ - static initPtr ptr = reinterpret_cast<initPtr>(GetProcAddress(cryptDLL(), "MD5Init")); - return ptr; -} - -static updatePtr update() -{ - static updatePtr ptr = reinterpret_cast<updatePtr>(GetProcAddress(cryptDLL(), "MD5Update")); - return ptr; -} - -static finalPtr final() -{ - static finalPtr ptr = reinterpret_cast<finalPtr>(GetProcAddress(cryptDLL(), "MD5Final")); - return ptr; -} - -void MD5_Init(MD5_CTX* context) -{ - init()(context); -} - -void MD5_Update(MD5_CTX* context, unsigned char* input, unsigned length) -{ - update()(context, input, length); -} - -void MD5_Final(unsigned char hash[16], MD5_CTX* context) -{ - final()(context); - - for (int i = 0; i < 16; ++i) - hash[i] = context->digest[i]; -} diff --git a/Tools/DumpRenderTree/win/MD5.h b/Tools/DumpRenderTree/win/MD5.h deleted file mode 100644 index 326e21d3e..000000000 --- a/Tools/DumpRenderTree/win/MD5.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef MD5_h -#define MD5_h - -typedef unsigned long ULONG; - -struct MD5_CTX { - ULONG i[2]; - ULONG buf[4]; - unsigned char in[64]; - unsigned char digest[16]; -}; - -void MD5_Init(MD5_CTX*); -void MD5_Update(MD5_CTX*, unsigned char* input, unsigned length); -void MD5_Final(unsigned char hash[16], MD5_CTX*); - -#endif // MD5_h diff --git a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp deleted file mode 100644 index f2025c66b..000000000 --- a/Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2007 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" - -#if USE(CG) -#include "PixelDumpSupportCG.h" -#elif USE(CAIRO) -#include "PixelDumpSupportCairo.h" -#endif - -#include "DumpRenderTree.h" - -#if USE(CG) -// Note: Must be included *after* DumpRenderTree.h to avoid compile error. -#include <CoreGraphics/CGBitmapContext.h> -#endif - -#include <wtf/Assertions.h> -#include <wtf/RetainPtr.h> - -static void makeAlphaChannelOpaque(void* argbBits, LONG width, LONG height) -{ - unsigned* pixel = static_cast<unsigned*>(argbBits); - for (LONG row = 0; row < height; ++row) { - for (LONG column = 0; column < width; ++column) - *pixel++ |= 0xff000000; - } -} - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect) -{ - RECT frame; - if (!GetWindowRect(webViewWindow, &frame)) - return 0; - - BITMAPINFO bmp = {0}; - bmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmp.bmiHeader.biWidth = frame.right - frame.left; - bmp.bmiHeader.biHeight = -(frame.bottom - frame.top); - bmp.bmiHeader.biPlanes = 1; - bmp.bmiHeader.biBitCount = 32; - bmp.bmiHeader.biCompression = BI_RGB; - - void* bits = 0; - HBITMAP bitmap = CreateDIBSection(0, &bmp, DIB_RGB_COLORS, &bits, 0, 0); - - HDC memoryDC = CreateCompatibleDC(0); - SelectObject(memoryDC, bitmap); - SendMessage(webViewWindow, WM_PRINT, reinterpret_cast<WPARAM>(memoryDC), PRF_CLIENT | PRF_CHILDREN | PRF_OWNED); - DeleteDC(memoryDC); - - BITMAP info = {0}; - GetObject(bitmap, sizeof(info), &info); - ASSERT(info.bmBitsPixel == 32); - - // We create a context that has an alpha channel below so that the PNGs we generate will also - // have an alpha channel. But WM_PRINT doesn't necessarily write anything into the alpha - // channel, so we set the alpha channel to constant full opacity to make sure the resulting image is opaque. - makeAlphaChannelOpaque(info.bmBits, info.bmWidth, info.bmHeight); - -#if USE(CG) - RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB()); - CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, - info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); -#elif USE(CAIRO) - cairo_surface_t* image = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, CAIRO_FORMAT_ARGB32, - info.bmWidth, info.bmHeight, info.bmWidthBytes); - cairo_t* context = cairo_create(image); - cairo_surface_destroy(image); -#endif - - return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context); -} diff --git a/Tools/DumpRenderTree/win/PolicyDelegate.cpp b/Tools/DumpRenderTree/win/PolicyDelegate.cpp deleted file mode 100644 index 5d7177e53..000000000 --- a/Tools/DumpRenderTree/win/PolicyDelegate.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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 "PolicyDelegate.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <string> - -using std::wstring; - -static wstring dumpPath(IDOMNode* node) -{ - ASSERT(node); - - wstring result; - - BSTR name; - if (FAILED(node->nodeName(&name))) - return result; - result.assign(name, SysStringLen(name)); - SysFreeString(name); - - COMPtr<IDOMNode> parent; - if (SUCCEEDED(node->parentNode(&parent))) - result += TEXT(" > ") + dumpPath(parent.get()); - - return result; -} - -PolicyDelegate::PolicyDelegate() - : m_refCount(1) - , m_permissiveDelegate(false) - , m_controllerToNotifyDone(0) -{ -} - -// IUnknown -HRESULT STDMETHODCALLTYPE PolicyDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebPolicyDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebPolicyDelegate)) - *ppvObject = static_cast<IWebPolicyDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE PolicyDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE PolicyDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete this; - - return newRef; -} - -HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction( - /*[in]*/ IWebView* /*webView*/, - /*[in]*/ IPropertyBag* actionInformation, - /*[in]*/ IWebURLRequest* request, - /*[in]*/ IWebFrame* frame, - /*[in]*/ IWebPolicyDecisionListener* listener) -{ - BSTR url; - request->URL(&url); - wstring wurl = urlSuitableForTestResult(wstring(url, SysStringLen(url))); - - int navType = 0; - VARIANT var; - if (SUCCEEDED(actionInformation->Read(WebActionNavigationTypeKey, &var, 0))) { - V_VT(&var) = VT_I4; - navType = V_I4(&var); - } - - LPCTSTR typeDescription; - switch (navType) { - case WebNavigationTypeLinkClicked: - typeDescription = TEXT("link clicked"); - break; - case WebNavigationTypeFormSubmitted: - typeDescription = TEXT("form submitted"); - break; - case WebNavigationTypeBackForward: - typeDescription = TEXT("back/forward"); - break; - case WebNavigationTypeReload: - typeDescription = TEXT("reload"); - break; - case WebNavigationTypeFormResubmitted: - typeDescription = TEXT("form resubmitted"); - break; - case WebNavigationTypeOther: - typeDescription = TEXT("other"); - break; - default: - typeDescription = TEXT("illegal value"); - } - - wstring message = TEXT("Policy delegate: attempt to load ") + wurl + TEXT(" with navigation type '") + typeDescription + TEXT("'"); - - VARIANT actionElementVar; - if (SUCCEEDED(actionInformation->Read(WebActionElementKey, &actionElementVar, 0))) { - COMPtr<IPropertyBag> actionElement(Query, V_UNKNOWN(&actionElementVar)); - VARIANT originatingNodeVar; - if (SUCCEEDED(actionElement->Read(WebElementDOMNodeKey, &originatingNodeVar, 0))) { - COMPtr<IDOMNode> originatingNode(Query, V_UNKNOWN(&originatingNodeVar)); - message += TEXT(" originating from ") + dumpPath(originatingNode.get()); - } - } - - printf("%S\n", message.c_str()); - - SysFreeString(url); - - if (m_permissiveDelegate) - listener->use(); - else - listener->ignore(); - - if (m_controllerToNotifyDone) { - m_controllerToNotifyDone->notifyDone(); - m_controllerToNotifyDone = 0; - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE PolicyDelegate::unableToImplementPolicyWithError( - /*[in]*/ IWebView* /*webView*/, - /*[in]*/ IWebError* error, - /*[in]*/ IWebFrame* frame) -{ - BSTR domainStr; - error->domain(&domainStr); - wstring domainMessage = domainStr; - - int code; - error->code(&code); - - BSTR frameName; - frame->name(&frameName); - wstring frameNameMessage = frameName; - - printf("Policy delegate: unable to implement policy with error domain '%S', error code %d, in frame '%S'", domainMessage.c_str(), code, frameNameMessage.c_str()); - - SysFreeString(domainStr); - SysFreeString(frameName); - - return S_OK; -} diff --git a/Tools/DumpRenderTree/win/PolicyDelegate.h b/Tools/DumpRenderTree/win/PolicyDelegate.h deleted file mode 100644 index b6036fead..000000000 --- a/Tools/DumpRenderTree/win/PolicyDelegate.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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 PolicyDelegate_h -#define PolicyDelegate_h - -#include <WebKit/WebKit.h> - -class TestRunner; - -class PolicyDelegate : public IWebPolicyDelegate { -public: - PolicyDelegate(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebPolicyDelegate - virtual HRESULT STDMETHODCALLTYPE decidePolicyForNavigationAction( - /* [in] */ IWebView *webView, - /* [in] */ IPropertyBag *actionInformation, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebPolicyDecisionListener *listener); - - virtual HRESULT STDMETHODCALLTYPE decidePolicyForNewWindowAction( - /* [in] */ IWebView *webView, - /* [in] */ IPropertyBag *actionInformation, - /* [in] */ IWebURLRequest *request, - /* [in] */ BSTR frameName, - /* [in] */ IWebPolicyDecisionListener *listener){ return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE decidePolicyForMIMEType( - /* [in] */ IWebView *webView, - /* [in] */ BSTR type, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebPolicyDecisionListener *listener){ return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unableToImplementPolicyWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame); - - // PolicyDelegate - void setPermissive(bool permissive) { m_permissiveDelegate = permissive; } - void setControllerToNotifyDone(TestRunner* controller) { m_controllerToNotifyDone = controller; } - -private: - ULONG m_refCount; - bool m_permissiveDelegate; - TestRunner* m_controllerToNotifyDone; -}; - -#endif // PolicyDelegate_h diff --git a/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp deleted file mode 100644 index 6859780f3..000000000 --- a/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (C) 2007 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 "ResourceLoadDelegate.h" - -#include "DumpRenderTree.h" -#include "TestRunner.h" -#include <WebKit/WebKitCOMAPI.h> -#include <comutil.h> -#include <sstream> -#include <tchar.h> -#include <wtf/Vector.h> - -using namespace std; - -static inline wstring wstringFromBSTR(BSTR str) -{ - return wstring(str, ::SysStringLen(str)); -} - -static inline wstring wstringFromInt(int i) -{ - wostringstream ss; - ss << i; - return ss.str(); -} - -static inline BSTR BSTRFromString(const string& str) -{ - int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0); - BSTR result = ::SysAllocStringLen(0, length); - ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length); - return result; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const -{ - IdentifierMap::const_iterator it = m_urlMap.find(identifier); - - if (it == m_urlMap.end()) - return L"<unknown>"; - - return urlSuitableForTestResult(it->value); -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request) -{ - if (!request) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(request->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - BSTR mainDocumentURLBSTR; - if (FAILED(request->mainDocumentURL(&mainDocumentURLBSTR))) - return wstring(); - - wstring mainDocumentURL = urlSuitableForTestResult(wstringFromBSTR(mainDocumentURLBSTR)); - ::SysFreeString(mainDocumentURLBSTR); - - BSTR httpMethodBSTR; - if (FAILED(request->HTTPMethod(&httpMethodBSTR))) - return wstring(); - - wstring httpMethod = wstringFromBSTR(httpMethodBSTR); - ::SysFreeString(httpMethodBSTR); - - return L"<NSURLRequest URL " + url + L", main document URL " + mainDocumentURL + L", http method " + httpMethod + L">"; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLResponse* response) -{ - if (!response) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(response->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - int statusCode = 0; - COMPtr<IWebHTTPURLResponse> httpResponse; - if (response && SUCCEEDED(response->QueryInterface(&httpResponse))) - httpResponse->statusCode(&statusCode); - - return L"<NSURLResponse " + url + L", http status code " + wstringFromInt(statusCode) + L">"; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) const -{ - wstring result = L"<NSError "; - - BSTR domainSTR; - if (FAILED(error->domain(&domainSTR))) - return wstring(); - - wstring domain = wstringFromBSTR(domainSTR); - ::SysFreeString(domainSTR); - - int code; - if (FAILED(error->code(&code))) - return wstring(); - - if (domain == L"CFURLErrorDomain") { - domain = L"NSURLErrorDomain"; - - // Convert kCFURLErrorUnknown to NSURLErrorUnknown - if (code == -998) - code = -1; - } else if (domain == L"kCFErrorDomainWinSock") { - domain = L"NSURLErrorDomain"; - - // Convert the winsock error code to an NSURLError code. - if (code == WSAEADDRNOTAVAIL) - code = -1004; // NSURLErrorCannotConnectToHose; - } - - result += L"domain " + domain; - result += L", code " + wstringFromInt(code); - - BSTR failingURLSTR; - if (FAILED(error->failingURL(&failingURLSTR))) - return wstring(); - - if (failingURLSTR) { - result += L", failing URL \"" + urlSuitableForTestResult(wstringFromBSTR(failingURLSTR)) + L"\""; - ::SysFreeString(failingURLSTR); - } - - result += L">"; - - return result; -} - -ResourceLoadDelegate::ResourceLoadDelegate() - : m_refCount(1) -{ -} - -ResourceLoadDelegate::~ResourceLoadDelegate() -{ -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebResourceLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegate)) - *ppvObject = static_cast<IWebResourceLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegatePrivate2)) - *ppvObject = static_cast<IWebResourceLoadDelegatePrivate2*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE ResourceLoadDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE ResourceLoadDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::identifierForInitialRequest( - /* [in] */ IWebView* webView, - /* [in] */ IWebURLRequest* request, - /* [in] */ IWebDataSource* dataSource, - /* [in] */ unsigned long identifier) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - BSTR urlStr; - if (FAILED(request->URL(&urlStr))) - return E_FAIL; - - ASSERT(!urlMap().contains(identifier)); - urlMap().set(identifier, wstringFromBSTR(urlStr)); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::removeIdentifierForRequest( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier) -{ - urlMap().remove(identifier); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLRequest* request, - /* [in] */ IWebURLResponse* redirectResponse, - /* [in] */ IWebDataSource* dataSource, - /* [retval][out] */ IWebURLRequest **newRequest) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - printf("%S - willSendRequest %S redirectResponse %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(request).c_str(), - descriptionSuitableForTestResult(redirectResponse).c_str()); - } - - if (!done && !gTestRunner->deferMainResourceDataLoad()) { - COMPtr<IWebDataSourcePrivate> dataSourcePrivate(Query, dataSource); - if (!dataSourcePrivate) - return E_FAIL; - dataSourcePrivate->setDeferMainResourceDataLoad(FALSE); - } - - if (!done && gTestRunner->willSendRequestReturnsNull()) { - *newRequest = 0; - return S_OK; - } - - if (!done && gTestRunner->willSendRequestReturnsNullOnRedirect() && redirectResponse) { - printf("Returning null for this redirect\n"); - *newRequest = 0; - return S_OK; - } - - IWebMutableURLRequest* requestCopy = 0; - request->mutableCopy(&requestCopy); - const set<string>& clearHeaders = gTestRunner->willSendRequestClearHeaders(); - for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { - BSTR bstrHeader = BSTRFromString(*header); - requestCopy->setValue(0, bstrHeader); - SysFreeString(bstrHeader); - } - - *newRequest = requestCopy; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource) -{ - COMPtr<IWebURLAuthenticationChallengeSender> sender; - if (!challenge || FAILED(challenge->sender(&sender))) - return E_FAIL; - - if (!gTestRunner->handlesAuthenticationChallenges()) { - printf("%S - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n", descriptionSuitableForTestResult(identifier).c_str()); - sender->continueWithoutCredentialForAuthenticationChallenge(challenge); - return S_OK; - } - - const char* user = gTestRunner->authenticationUsername().c_str(); - const char* password = gTestRunner->authenticationPassword().c_str(); - - printf("%S - didReceiveAuthenticationChallenge - Responding with %s:%s\n", descriptionSuitableForTestResult(identifier).c_str(), user, password); - - COMPtr<IWebURLCredential> credential; - if (FAILED(WebKitCreateInstance(CLSID_WebURLCredential, 0, IID_IWebURLCredential, (void**)&credential))) - return E_FAIL; - credential->initWithUser(_bstr_t(user), _bstr_t(password), WebURLCredentialPersistenceForSession); - - sender->useCredential(credential.get(), challenge); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLResponse* response, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - printf("%S - didReceiveResponse %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(response).c_str()); - } - if (!done && gTestRunner->dumpResourceResponseMIMETypes()) { - BSTR mimeTypeBSTR; - if (FAILED(response->MIMEType(&mimeTypeBSTR))) - E_FAIL; - - wstring mimeType = wstringFromBSTR(mimeTypeBSTR); - ::SysFreeString(mimeTypeBSTR); - - BSTR urlBSTR; - if (FAILED(response->URL(&urlBSTR))) - E_FAIL; - - wstring url = wstringFromBSTR(urlBSTR); - ::SysFreeString(urlBSTR); - - printf("%S has MIME type %S\n", lastPathComponent(url).c_str(), mimeType.c_str()); - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - printf("%S - didFinishLoading\n", - descriptionSuitableForTestResult(identifier).c_str()); - } - - removeIdentifierForRequest(webView, identifier); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebError* error, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gTestRunner->dumpResourceLoadCallbacks()) { - printf("%S - didFailLoadingWithError: %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(error, identifier).c_str()); - } - - removeIdentifierForRequest(webView, identifier); - - return S_OK; -} diff --git a/Tools/DumpRenderTree/win/ResourceLoadDelegate.h b/Tools/DumpRenderTree/win/ResourceLoadDelegate.h deleted file mode 100644 index 3f20f47c9..000000000 --- a/Tools/DumpRenderTree/win/ResourceLoadDelegate.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ResourceLoadDelegate_h -#define ResourceLoadDelegate_h - -#include <WebKit/WebKit.h> -#include <string> -#include <wtf/HashMap.h> - -class ResourceLoadDelegate : public IWebResourceLoadDelegate, public IWebResourceLoadDelegatePrivate2 { -public: - ResourceLoadDelegate(); - virtual ~ResourceLoadDelegate(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebResourceLoadDelegate - virtual HRESULT STDMETHODCALLTYPE identifierForInitialRequest( - /* [in] */ IWebView *webView, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebDataSource *dataSource, - /* [in] */ unsigned long identifier); - - virtual HRESULT STDMETHODCALLTYPE willSendRequest( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebURLResponse *redirectResponse, - /* [in] */ IWebDataSource *dataSource, - /* [retval][out] */ IWebURLRequest **newRequest); - - virtual HRESULT STDMETHODCALLTYPE didReceiveAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE didCancelAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didReceiveResponse( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLResponse *response, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE didReceiveContentLength( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ UINT length, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didFinishLoadingFromDataSource( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE didFailLoadingWithError( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebError *error, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE plugInFailedWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - // IWebResourceLoadDelegatePrivate2 - virtual HRESULT STDMETHODCALLTYPE removeIdentifierForRequest( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier); - -private: - static std::wstring descriptionSuitableForTestResult(IWebURLRequest*); - static std::wstring descriptionSuitableForTestResult(IWebURLResponse*); - std::wstring descriptionSuitableForTestResult(unsigned long) const; - std::wstring descriptionSuitableForTestResult(IWebError*, unsigned long) const; - - typedef HashMap<unsigned long, std::wstring> IdentifierMap; - IdentifierMap& urlMap() { return m_urlMap; } - IdentifierMap m_urlMap; - - ULONG m_refCount; -}; - -#endif // ResourceLoadDelegate_h diff --git a/Tools/DumpRenderTree/win/TestRunnerWin.cpp b/Tools/DumpRenderTree/win/TestRunnerWin.cpp deleted file mode 100644 index f1a2b2b03..000000000 --- a/Tools/DumpRenderTree/win/TestRunnerWin.cpp +++ /dev/null @@ -1,1214 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 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 "EditingDelegate.h" -#include "PolicyDelegate.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRefBSTR.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> -#include <comutil.h> -#include <shlguid.h> -#include <shlwapi.h> -#include <shobjidl.h> -#include <string> -#include <wtf/Assertions.h> -#include <wtf/Platform.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.h> - -using std::string; -using std::wstring; - -static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath); - -TestRunner::~TestRunner() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - // reset webview-related states back to default values in preparation for next test - - COMPtr<IWebViewPrivate> viewPrivate; - if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) - viewPrivate->setTabKeyCyclesThroughElements(TRUE); - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - COMPtr<IWebEditingDelegate> delegate; - if (FAILED(viewEditing->editingDelegate(&delegate))) - return; - COMPtr<EditingDelegate> editingDelegate(Query, viewEditing.get()); - if (editingDelegate) - editingDelegate->setAcceptsEditing(TRUE); -} - -void TestRunner::addDisallowedURL(JSStringRef url) -{ - // FIXME: Implement! -} - -void TestRunner::clearBackForwardList() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebBackForwardList> backForwardList; - if (FAILED(webView->backForwardList(&backForwardList))) - return; - - COMPtr<IWebHistoryItem> item; - if (FAILED(backForwardList->currentItem(&item))) - return; - - // We clear the history by setting the back/forward list's capacity to 0 - // then restoring it back and adding back the current item. - int capacity; - if (FAILED(backForwardList->capacity(&capacity))) - return; - - backForwardList->setCapacity(0); - backForwardList->setCapacity(capacity); - backForwardList->addItem(item.get()); - backForwardList->goToItem(item.get()); -} - -bool TestRunner::callShouldCloseOnWebView() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return false; - - BOOL result; - viewPrivate->shouldClose(&result); - return result; -} - -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() -{ - displayWebView(); -} - -void TestRunner::keepWebHistory() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(sharedHistory), reinterpret_cast<void**>(&sharedHistory)))) - return; - - history->setOptionalSharedHistory(sharedHistory.get()); -} - -void TestRunner::waitForPolicyDelegate() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - setWaitToDump(true); - policyDelegate->setControllerToNotifyDone(this); - webView->setPolicyDelegate(policyDelegate); -} - -size_t TestRunner::webHistoryItemCount() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return 0; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) - return 0; - - COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; - if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) - return 0; - - int count; - if (FAILED(sharedHistoryPrivate->allItems(&count, 0))) - return 0; - - return count; -} - -JSRetainPtr<JSStringRef> TestRunner::platformName() const -{ - JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("win")); - return platformName; -} - -void TestRunner::notifyDone() -{ - // Same as on mac. This can be shared. - if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) - dump(); - m_waitToDump = false; -} - -JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url) -{ - wstring input(JSStringGetCharactersPtr(url), JSStringGetLength(url)); - - wstring localPath; - if (!resolveCygwinPath(input, localPath)) { - printf("ERROR: Failed to resolve Cygwin path %S\n", input.c_str()); - return 0; - } - - return JSStringCreateWithCharacters(localPath.c_str(), localPath.length()); -} - -static wstring jsStringRefToWString(JSStringRef jsStr) -{ - size_t length = JSStringGetLength(jsStr); - Vector<WCHAR> buffer(length + 1); - memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); - buffer[length] = '\0'; - - return buffer.data(); -} - -void TestRunner::queueLoad(JSStringRef url, JSStringRef target) -{ - COMPtr<IWebDataSource> dataSource; - if (FAILED(frame->dataSource(&dataSource))) - return; - - COMPtr<IWebURLResponse> response; - if (FAILED(dataSource->response(&response)) || !response) - return; - - BSTR responseURLBSTR; - if (FAILED(response->URL(&responseURLBSTR))) - return; - wstring responseURL(responseURLBSTR, SysStringLen(responseURLBSTR)); - SysFreeString(responseURLBSTR); - - // FIXME: We should do real relative URL resolution here. - int lastSlash = responseURL.rfind('/'); - if (lastSlash != -1) - responseURL = responseURL.substr(0, lastSlash); - - wstring wURL = jsStringRefToWString(url); - wstring wAbsoluteURL = responseURL + TEXT("/") + wURL; - JSRetainPtr<JSStringRef> jsAbsoluteURL(Adopt, JSStringCreateWithCharacters(wAbsoluteURL.data(), wAbsoluteURL.length())); - - WorkQueue::shared()->queue(new LoadItem(jsAbsoluteURL.get(), target)); -} - -void TestRunner::setAcceptsEditing(bool acceptsEditing) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - COMPtr<IWebEditingDelegate> delegate; - if (FAILED(viewEditing->editingDelegate(&delegate))) - return; - - EditingDelegate* editingDelegate = (EditingDelegate*)(IWebEditingDelegate*)delegate.get(); - editingDelegate->setAcceptsEditing(acceptsEditing); -} - -void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - if (alwaysAcceptCookies == m_alwaysAcceptCookies) - return; - - if (!::setAlwaysAcceptCookies(alwaysAcceptCookies)) - return; - m_alwaysAcceptCookies = alwaysAcceptCookies; -} - -void TestRunner::setAuthorAndUserStylesEnabled(bool flag) -{ - 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->setAuthorAndUserStylesEnabled(flag); -} - -void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - if (setDelegate) { - policyDelegate->setPermissive(permissive); - webView->setPolicyDelegate(policyDelegate); - } else - webView->setPolicyDelegate(0); -} - -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 message) -{ - // 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) -{ - // See also <rdar://problem/6480108> - COMPtr<IWebIconDatabase> iconDatabase; - COMPtr<IWebIconDatabase> tmpIconDatabase; - if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) - return; - if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) - return; - - iconDatabase->setEnabled(iconDatabaseEnabled); -} - -void TestRunner::setMainFrameIsFirstResponder(bool flag) -{ - // FIXME: Implement! -} - -void TestRunner::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setPrivateBrowsingEnabled(privateBrowsingEnabled); -} - -void TestRunner::setXSSAuditorEnabled(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->setXSSAuditorEnabled(enabled); -} - -void TestRunner::setSpatialNavigationEnabled(bool enabled) -{ - // FIXME: Implement for SpatialNavigation layout tests. -} - -void TestRunner::setAllowUniversalAccessFromFileURLs(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->setAllowUniversalAccessFromFileURLs(enabled); -} - -void TestRunner::setAllowFileAccessFromFileURLs(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->setAllowFileAccessFromFileURLs(enabled); -} - -void TestRunner::setPopupBlockingEnabled(bool enabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setJavaScriptCanOpenWindowsAutomatically(!enabled); -} - -void TestRunner::setPluginsEnabled(bool flag) -{ - // FIXME: Implement -} - -void TestRunner::setJavaScriptCanAccessClipboard(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->setJavaScriptCanAccessClipboard(enabled); -} - -void TestRunner::setTabKeyCyclesThroughElements(bool shouldCycle) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - viewPrivate->setTabKeyCyclesThroughElements(shouldCycle ? TRUE : FALSE); -} - -void TestRunner::setUseDashboardCompatibilityMode(bool flag) -{ - // FIXME: Implement! -} - -void TestRunner::setUserStyleSheetEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setUserStyleSheetEnabled(flag); -} - -bool appendComponentToPath(wstring& path, const wstring& component) -{ - WCHAR buffer[MAX_PATH]; - - if (path.size() + 1 > MAX_PATH) - return false; - - memcpy(buffer, path.data(), path.size() * sizeof(WCHAR)); - buffer[path.size()] = '\0'; - - if (!PathAppendW(buffer, component.c_str())) - return false; - - path = wstring(buffer); - return true; -} - -static bool followShortcuts(wstring& path) -{ - if (PathFileExists(path.c_str())) - return true; - - // Do we have a shortcut? - wstring linkPath = path; - linkPath.append(TEXT(".lnk")); - if (!PathFileExists(linkPath.c_str())) - return true; - - // We have a shortcut, find its target. - COMPtr<IShellLink> shortcut(Create, CLSID_ShellLink); - if (!shortcut) - return false; - COMPtr<IPersistFile> persistFile(Query, shortcut); - if (!shortcut) - return false; - if (FAILED(persistFile->Load(linkPath.c_str(), STGM_READ))) - return false; - if (FAILED(shortcut->Resolve(0, 0))) - return false; - WCHAR targetPath[MAX_PATH]; - DWORD targetPathLen = _countof(targetPath); - if (FAILED(shortcut->GetPath(targetPath, targetPathLen, 0, 0))) - return false; - if (!PathFileExists(targetPath)) - return false; - // Use the target path as the result path instead. - path = wstring(targetPath); - - return true; -} - -static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath) -{ - wstring fileProtocol = L"file://"; - bool isFileProtocol = cygwinPath.find(fileProtocol) != string::npos; - if (cygwinPath[isFileProtocol ? 7 : 0] != '/') // ensure path is absolute - return false; - - // Get the Root path. - WCHAR rootPath[MAX_PATH]; - DWORD rootPathSize = _countof(rootPath); - DWORD keyType; - DWORD result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), &keyType, &rootPath, &rootPathSize); - - if (result != ERROR_SUCCESS || keyType != REG_SZ) { - // Cygwin 1.7 doesn't store Cygwin's root as a mount point anymore, because mount points are now stored in /etc/fstab. - // However, /etc/fstab doesn't contain any information about where / is located as a Windows path, so we need to use Cygwin's - // new registry key that has the root. - result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygwin\\setup"), TEXT("rootdir"), &keyType, &rootPath, &rootPathSize); - if (result != ERROR_SUCCESS || keyType != REG_SZ) - return false; - } - - windowsPath = wstring(rootPath, rootPathSize); - - int oldPos = isFileProtocol ? 8 : 1; - while (1) { - int newPos = cygwinPath.find('/', oldPos); - - if (newPos == -1) { - wstring pathComponent = cygwinPath.substr(oldPos); - - if (!appendComponentToPath(windowsPath, pathComponent)) - return false; - - if (!followShortcuts(windowsPath)) - return false; - - break; - } - - wstring pathComponent = cygwinPath.substr(oldPos, newPos - oldPos); - if (!appendComponentToPath(windowsPath, pathComponent)) - return false; - - if (!followShortcuts(windowsPath)) - return false; - - oldPos = newPos + 1; - } - - if (isFileProtocol) - windowsPath = fileProtocol + windowsPath; - - return true; -} - -void TestRunner::setUserStyleSheetLocation(JSStringRef jsURL) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - 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)); - if (!pathCF) - return; - - wstring path = cfStringRefToWString(pathCF.get()); - - wstring resultPath; - if (!resolveCygwinPath(path, resultPath)) - return; - - // The path has been resolved, now convert it back to a CFURL. - int result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return; - - url = CFURLCreateFromFileSystemRepresentation(0, (const UInt8*)utf8Vector.data(), utf8Vector.size() - 1, false); - if (!url) - return; - - resultPath = cfStringRefToWString(CFURLGetString(url.get())); - - BSTR resultPathBSTR = SysAllocStringLen(resultPath.data(), resultPath.size()); - preferences->setUserStyleSheetLocation(resultPathBSTR); - SysFreeString(resultPathBSTR); -} - -void TestRunner::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return; - - COMPtr<IDOMElement> domElement; - if (FAILED(webViewPrivate->elementFromJS(context, element, &domElement))) - return; - - COMPtr<IDOMHTMLInputElement> domInputElement; - if (FAILED(domElement->QueryInterface(IID_IDOMHTMLInputElement, reinterpret_cast<void**>(&domInputElement)))) - return; - - _bstr_t valueBSTR(JSStringCopyBSTR(value), false); - - domInputElement->setValueForUser(valueBSTR); -} - -void TestRunner::setViewModeMediaFeature(JSStringRef mode) -{ - // FIXME: implement -} - -void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) -{ - RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); - ::setPersistentUserStyleSheetLocation(urlString.get()); -} - -void TestRunner::clearPersistentUserStyleSheet() -{ - ::setPersistentUserStyleSheetLocation(0); -} - -void TestRunner::setWindowIsKey(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - HWND webViewWindow; - if (FAILED(viewPrivate->viewWindow((OLE_HANDLE*)&webViewWindow))) - return; - - ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0); -} - -static const CFTimeInterval waitToDumpWatchdogInterval = 30.0; - -static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD) -{ - gTestRunner->waitToDumpWatchdogTimerFired(); -} - -void TestRunner::setWaitToDump(bool waitUntilDone) -{ - m_waitToDump = waitUntilDone; - if (m_waitToDump && !waitToDumpWatchdog) - waitToDumpWatchdog = SetTimer(0, 0, waitToDumpWatchdogInterval * 1000, waitUntilDoneWatchdogFired); -} - -int TestRunner::windowCount() -{ - return openWindows().size(); -} - -void TestRunner::execCommand(JSStringRef name, JSStringRef value) -{ - wstring wName = jsStringRefToWString(name); - wstring wValue = jsStringRefToWString(value); - - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - BSTR nameBSTR = SysAllocStringLen((OLECHAR*)wName.c_str(), wName.length()); - BSTR valueBSTR = SysAllocStringLen((OLECHAR*)wValue.c_str(), wValue.length()); - viewPrivate->executeCoreCommandByName(nameBSTR, valueBSTR); - - SysFreeString(nameBSTR); - SysFreeString(valueBSTR); -} - -bool TestRunner::findString(JSContextRef /* context */, JSStringRef /* target */, JSObjectRef /* optionsArray */) -{ - // FIXME: Implement - return false; -} - -void TestRunner::setCacheModel(int) -{ - // FIXME: Implement -} - -bool TestRunner::isCommandEnabled(JSStringRef /*name*/) -{ - printf("ERROR: TestRunner::isCommandEnabled() not implemented\n"); - return false; -} - -void TestRunner::clearAllApplicationCaches() -{ - // FIXME: Implement to support application cache quotas. -} - -void TestRunner::clearApplicationCacheForOrigin(JSStringRef origin) -{ - // FIXME: Implement to support deleting all application cache for an origin. -} - -void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota) -{ - // FIXME: Implement to support application cache quotas. -} - -JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) -{ - // FIXME: Implement to get origins that have application caches. - return JSValueMakeUndefined(context); -} - -long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef name) -{ - // FIXME: Implement to get disk usage by all application caches for an origin. - return 0; -} - -void TestRunner::clearAllDatabases() -{ - COMPtr<IWebDatabaseManager> databaseManager; - COMPtr<IWebDatabaseManager> tmpDatabaseManager; - if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) - return; - if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) - return; - - databaseManager->deleteAllDatabases(); -} - -void TestRunner::overridePreference(JSStringRef key, JSStringRef value) -{ - 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; - - BSTR keyBSTR = JSStringCopyBSTR(key); - BSTR valueBSTR = JSStringCopyBSTR(value); - prefsPrivate->setPreferenceForTest(keyBSTR, valueBSTR); - SysFreeString(keyBSTR); - SysFreeString(valueBSTR); -} - -void TestRunner::setDatabaseQuota(unsigned long long quota) -{ - COMPtr<IWebDatabaseManager> databaseManager; - COMPtr<IWebDatabaseManager> tmpDatabaseManager; - - if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) - return; - if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) - return; - - databaseManager->setQuota(TEXT("file:///"), quota); -} - -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 forbidden, JSStringRef scheme) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - BSTR schemeBSTR = JSStringCopyBSTR(scheme); - webView->setDomainRelaxationForbiddenForURLScheme(forbidden, schemeBSTR); - SysFreeString(schemeBSTR); -} - -void TestRunner::setAppCacheMaximumSize(unsigned long long size) -{ - printf("ERROR: TestRunner::setAppCacheMaximumSize() not implemented\n"); -} - -static _bstr_t bstrT(JSStringRef jsString) -{ - // The false parameter tells the _bstr_t constructor to adopt the BSTR we pass it. - return _bstr_t(JSStringCopyBSTR(jsString), false); -} - -void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - webView->addOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); -} - -void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - webView->removeOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); -} - -void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) -{ - // FIXME: implement -} - -void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - COMPtr<IWebScriptWorld> world; - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - - webView->addUserScriptToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), 0, 0, 0, 0, 0, runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd); -} - - -void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - COMPtr<IWebScriptWorld> world; - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - - webView->addUserStyleSheetToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), 0, 0, 0, 0, 0); -} - -void TestRunner::setDeveloperExtrasEnabled(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->setDeveloperExtrasEnabled(enabled); -} - -void TestRunner::showWebInspector() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (SUCCEEDED(viewPrivate->inspector(&inspector))) - inspector->show(); -} - -void TestRunner::closeWebInspector() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - inspector->close(); -} - -void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - COMPtr<IWebInspectorPrivate> inspectorPrivate(Query, inspector); - if (!inspectorPrivate) - return; - - inspectorPrivate->evaluateInFrontend(callId, bstrT(script).GetBSTR()); -} - -typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap; -static WorldMap& worldMap() -{ - static WorldMap& map = *new WorldMap; - return map; -} - -unsigned worldIDForWorld(IWebScriptWorld* world) -{ - WorldMap::const_iterator end = worldMap().end(); - for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { - if (it->value == world) - return it->key; - } - - return 0; -} - -void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - // FIXME: Implement this. -} - -void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world - // that is created once and cached forever. - COMPtr<IWebScriptWorld> world; - if (!worldID) { - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - } else { - COMPtr<IWebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value; - if (!worldSlot && FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(worldSlot), reinterpret_cast<void**>(&worldSlot)))) - return; - world = worldSlot; - } - - BSTR result; - if (FAILED(framePrivate->stringByEvaluatingJavaScriptInScriptWorld(world.get(), globalObject, bstrT(script).GetBSTR(), &result))) - return; - SysFreeString(result); -} - -void TestRunner::removeAllVisitedLinks() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) - return; - - COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; - if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) - return; - - sharedHistoryPrivate->removeAllVisitedLinks(); -} - -void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) -{ - -} - -void TestRunner::apiTestGoToCurrentBackForwardItem() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebBackForwardList> backForwardList; - if (FAILED(webView->backForwardList(&backForwardList))) - return; - - COMPtr<IWebHistoryItem> item; - if (FAILED(backForwardList->currentItem(&item))) - return; - - BOOL success; - webView->goToBackForwardItem(item.get(), &success); -} - -void TestRunner::setWebViewEditable(bool) -{ -} - -void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ -} - -void TestRunner::abortModal() -{ -} - -void TestRunner::setSerializeHTTPLoads(bool) -{ - // FIXME: Implement. -} - -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 JSValueMakeUndefined(context); -} - -long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) -{ - // FIXME: Implement to support getting local storage disk usage for an origin. - return 0; -} - -void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL) -{ - // FIXME: Implement. -} - -void TestRunner::setTextDirection(JSStringRef direction) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - framePrivate->setTextDirection(bstrT(direction).GetBSTR()); -} - -void TestRunner::addChromeInputField() -{ -} - -void TestRunner::removeChromeInputField() -{ -} - -void TestRunner::focusWebView() -{ -} - -void TestRunner::setBackingScaleFactor(double) -{ -} - -void TestRunner::grantWebNotificationPermission(JSStringRef origin) -{ -} - -void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) -{ -} - -void TestRunner::removeAllWebNotificationPermissions() -{ -} - -void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) -{ -} - -void TestRunner::simulateLegacyWebNotificationClick(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::setStorageDatabaseIdleInterval(double) -{ - // FIXME: Implement this. -} - -void TestRunner::closeIdleLocalStorageDatabases() -{ - // FIXME: Implement this. -} diff --git a/Tools/DumpRenderTree/win/TextInputController.cpp b/Tools/DumpRenderTree/win/TextInputController.cpp deleted file mode 100755 index c54dd17de..000000000 --- a/Tools/DumpRenderTree/win/TextInputController.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. - * Copyright (C) 2010 Joone Hur <joone@kldp.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 "TextInputController.h" - -#include <JavaScriptCore/JSRetainPtr.h> -#include <wtf/RefPtr.h> - -// Static Functions - -static JSValueRef setMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> str(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - double from = JSValueToNumber(context, arguments[1], exception); - ASSERT(!*exception); - - double length = JSValueToNumber(context, arguments[2], exception); - ASSERT(!*exception); - - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - - if (controller) - controller->setMarkedText(str.get(), from, length); - - return JSValueMakeUndefined(context); -} - -static JSValueRef hasMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - - if (controller) - return JSValueMakeBoolean(context, controller->hasMarkedText()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef unmarkTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - if (controller) - controller->unmarkText(); - - return JSValueMakeUndefined(context); -} - -static JSValueRef markedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - if (controller) { - vector<int> range = controller->markedRange(); - if (range.size() == 2) { - JSValueRef argumentsArrayValues[] = { JSValueMakeNumber(context, range[0]), JSValueMakeNumber(context, range[1]) }; - JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); - ASSERT(!*exception); - return result; - } - } - - return JSValueMakeUndefined(context); -} - -static JSValueRef insertTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - JSRetainPtr<JSStringRef> str(Adopt, JSValueToStringCopy(context, arguments[0], exception)); - ASSERT(!*exception); - - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - - if (controller) - controller->insertText(str.get()); - - return JSValueMakeUndefined(context); -} - -static JSValueRef firstRectForCharacterRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - double start = JSValueToNumber(context, arguments[0], exception); - ASSERT(!*exception); - - double length = JSValueToNumber(context, arguments[1], exception); - ASSERT(!*exception); - - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - - if (controller) { - vector<int> rect = controller->firstRectForCharacterRange(start, length); - if (rect.size() == 4) { - JSValueRef argumentsArrayValues[] = - { - JSValueMakeNumber(context, rect[0]), - JSValueMakeNumber(context, rect[1]), - JSValueMakeNumber(context, rect[2]), - JSValueMakeNumber(context, rect[3]), - }; - JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); - ASSERT(!*exception); - return result; - } - } - - return JSValueMakeUndefined(context); -} - -static JSValueRef selectedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); - - if (controller) { - vector<int> rect = controller->selectedRange(); - if (rect.size() == 2) { - JSValueRef argumentsArrayValues[] = { - JSValueMakeNumber(context, rect[0]), - JSValueMakeNumber(context, rect[1]), - }; - JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); - ASSERT(!*exception); - return result; - } - } - - return JSValueMakeUndefined(context); -} - -// Object Creation - -void TextInputController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) -{ - JSRetainPtr<JSStringRef> textInputContollerStr(Adopt, JSStringCreateWithUTF8CString("textInputController")); - - JSClassRef classRef = getJSClass(); - JSValueRef textInputContollerObject = JSObjectMake(context, classRef, this); - JSClassRelease(classRef); - - JSObjectSetProperty(context, windowObject, textInputContollerStr.get(), textInputContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); -} - -JSClassRef TextInputController::getJSClass() -{ - static JSStaticValue* staticValues = TextInputController::staticValues(); - static JSStaticFunction* staticFunctions = TextInputController::staticFunctions(); - static JSClassDefinition classDefinition = - { - 0, kJSClassAttributeNone, "TextInputController", 0, staticValues, staticFunctions, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - return JSClassCreate(&classDefinition); -} - -JSStaticValue* TextInputController::staticValues() -{ - static JSStaticValue staticValues[] = - { - { 0, 0, 0, 0 } - }; - return staticValues; -} - -JSStaticFunction* TextInputController::staticFunctions() -{ - static JSStaticFunction staticFunctions[] = { - { "setMarkedText", setMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "hasMarkedText", hasMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "unmarkText", unmarkTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "markedRange", markedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "insertText", insertTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "firstRectForCharacterRange", firstRectForCharacterRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "selectedRange", selectedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } - }; - - return staticFunctions; -} diff --git a/Tools/DumpRenderTree/win/TextInputController.h b/Tools/DumpRenderTree/win/TextInputController.h deleted file mode 100755 index 1c28e60ce..000000000 --- a/Tools/DumpRenderTree/win/TextInputController.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 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. - * 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 TextInputController_h -#define TextInputController_h - -#include <JavaScriptCore/JSContextRef.h> -#include <JavaScriptCore/JSObjectRef.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSValueRef.h> -#include <vector> -#include <wtf/PassRefPtr.h> - -using namespace std; - -class TextInputController { -public: - void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception); - - void setMarkedText(JSStringRef text, unsigned int from, unsigned int length); - bool hasMarkedText(); - void unmarkText(); - vector<int> markedRange(); - void insertText(JSStringRef text); - vector<int> firstRectForCharacterRange(unsigned int start, unsigned int length); - vector<int> selectedRange(); - -private: - static JSClassRef getJSClass(); - static JSStaticValue* staticValues(); - static JSStaticFunction* staticFunctions(); -}; - -#endif // TextInputController_h diff --git a/Tools/DumpRenderTree/win/TextInputControllerWin.cpp b/Tools/DumpRenderTree/win/TextInputControllerWin.cpp deleted file mode 100755 index f4674e5dd..000000000 --- a/Tools/DumpRenderTree/win/TextInputControllerWin.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2010 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 "TextInputController.h" - -#include "DumpRenderTree.h" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <comutil.h> -#include <string> - -using namespace std; - -void TextInputController::setMarkedText(JSStringRef text, unsigned int from, unsigned int length) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - _bstr_t bstr(wstring(JSStringGetCharactersPtr(text), JSStringGetLength(text)).data()); - - viewPrivate->setCompositionForTesting(bstr, from, length); -} - -bool TextInputController::hasMarkedText() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return false; - - BOOL result; - viewPrivate->hasCompositionForTesting(&result); - return result; -} - -void TextInputController::unmarkText() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - _bstr_t empty; - viewPrivate->confirmCompositionForTesting(empty); -} - -vector<int> TextInputController::markedRange() -{ - // empty vector - vector<int> result; - - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return result; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return result; - - unsigned int startPos; - unsigned int length; - if (SUCCEEDED(viewPrivate->compositionRangeForTesting(&startPos, &length))) { - result.resize(2); - result[0] = startPos; - result[1] = length; - } - - return result; -} - -void TextInputController::insertText(JSStringRef text) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - _bstr_t bstr(wstring(JSStringGetCharactersPtr(text), JSStringGetLength(text)).data()); - - viewPrivate->confirmCompositionForTesting(bstr); -} - -vector<int> TextInputController::firstRectForCharacterRange(unsigned int start, unsigned int length) -{ - // empty vector - vector<int> result; - - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return result; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return result; - - RECT resultRECT; - if SUCCEEDED(viewPrivate->firstRectForCharacterRangeForTesting(start, length, &resultRECT)) { - result.resize(4); - result[0] = resultRECT.left; - result[1] = resultRECT.top; - result[2] = resultRECT.right - resultRECT.left; - result[3] = resultRECT.bottom - resultRECT.top; - } - - return result; -} - -vector<int> TextInputController::selectedRange() -{ - // empty vector - vector<int> result; - - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return result; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return result; - - unsigned int startPos; - unsigned int length; - if (SUCCEEDED(viewPrivate->selectedRangeForTesting(&startPos, &length))) { - result.resize(2); - result[0] = startPos; - result[1] = length; - } - - return result; -} diff --git a/Tools/DumpRenderTree/win/UIDelegate.cpp b/Tools/DumpRenderTree/win/UIDelegate.cpp deleted file mode 100644 index c7574883a..000000000 --- a/Tools/DumpRenderTree/win/UIDelegate.cpp +++ /dev/null @@ -1,667 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008 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 "UIDelegate.h" - -#include "DumpRenderTree.h" -#include "DraggingInfo.h" -#include "EventSender.h" -#include "DRTDesktopNotificationPresenter.h" -#include "TestRunner.h" -#include <WebCore/COMPtr.h> -#include <wtf/Assertions.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Platform.h> -#include <wtf/Vector.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <stdio.h> - -using std::wstring; - -class DRTUndoObject { -public: - DRTUndoObject(IWebUndoTarget* target, BSTR actionName, IUnknown* obj) - : m_target(target) - , m_actionName(SysAllocString(actionName)) - , m_obj(obj) - { - } - - ~DRTUndoObject() - { - SysFreeString(m_actionName); - } - - void invoke() - { - m_target->invoke(m_actionName, m_obj.get()); - } - -private: - IWebUndoTarget* m_target; - BSTR m_actionName; - COMPtr<IUnknown> m_obj; -}; - -class DRTUndoStack { -public: - ~DRTUndoStack() { deleteAllValues(m_undoVector); } - - bool isEmpty() const { return m_undoVector.isEmpty(); } - void clear() { deleteAllValues(m_undoVector); m_undoVector.clear(); } - - void push(DRTUndoObject* undoObject) { m_undoVector.append(undoObject); } - DRTUndoObject* pop() { DRTUndoObject* top = m_undoVector.last(); m_undoVector.removeLast(); return top; } - -private: - Vector<DRTUndoObject*> m_undoVector; -}; - -class DRTUndoManager { -public: - DRTUndoManager(); - - void removeAllActions(); - void registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj); - void redo(); - void undo(); - bool canRedo() { return !m_redoStack->isEmpty(); } - bool canUndo() { return !m_undoStack->isEmpty(); } - -private: - OwnPtr<DRTUndoStack> m_redoStack; - OwnPtr<DRTUndoStack> m_undoStack; - bool m_isRedoing; - bool m_isUndoing; -}; - -DRTUndoManager::DRTUndoManager() - : m_redoStack(adoptPtr(new DRTUndoStack)) - , m_undoStack(adoptPtr(new DRTUndoStack)) - , m_isRedoing(false) - , m_isUndoing(false) -{ -} - -void DRTUndoManager::removeAllActions() -{ - m_redoStack->clear(); - m_undoStack->clear(); -} - -void DRTUndoManager::registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj) -{ - if (!m_isUndoing && !m_isRedoing) - m_redoStack->clear(); - - DRTUndoStack* stack = m_isUndoing ? m_redoStack.get() : m_undoStack.get(); - stack->push(new DRTUndoObject(target, actionName, obj)); -} - -void DRTUndoManager::redo() -{ - if (!canRedo()) - return; - - m_isRedoing = true; - - DRTUndoObject* redoObject = m_redoStack->pop(); - redoObject->invoke(); - delete redoObject; - - m_isRedoing = false; -} - -void DRTUndoManager::undo() -{ - if (!canUndo()) - return; - - m_isUndoing = true; - - DRTUndoObject* undoObject = m_undoStack->pop(); - undoObject->invoke(); - delete undoObject; - - m_isUndoing = false; -} - -UIDelegate::UIDelegate() - : m_refCount(1) - , m_undoManager(adoptPtr(new DRTUndoManager)) - , m_desktopNotifications(new DRTDesktopNotificationPresenter) -{ - m_frame.bottom = 0; - m_frame.top = 0; - m_frame.left = 0; - m_frame.right = 0; -} - -void UIDelegate::resetUndoManager() -{ - m_undoManager = adoptPtr(new DRTUndoManager); -} - -HRESULT STDMETHODCALLTYPE UIDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebUIDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegate)) - *ppvObject = static_cast<IWebUIDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegate2)) - *ppvObject = static_cast<IWebUIDelegate2*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate)) - *ppvObject = static_cast<IWebUIDelegatePrivate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate2)) - *ppvObject = static_cast<IWebUIDelegatePrivate2*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate3)) - *ppvObject = static_cast<IWebUIDelegatePrivate3*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE UIDelegate::AddRef() -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE UIDelegate::Release() -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::hasCustomMenuImplementation( - /* [retval][out] */ BOOL *hasCustomMenus) -{ - *hasCustomMenus = TRUE; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::trackCustomPopupMenu( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu, - /* [in] */ LPPOINT point) -{ - // Do nothing - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::registerUndoWithTarget( - /* [in] */ IWebUndoTarget* target, - /* [in] */ BSTR actionName, - /* [in] */ IUnknown* actionArg) -{ - m_undoManager->registerUndoWithTarget(target, actionName, actionArg); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::removeAllActionsWithTarget( - /* [in] */ IWebUndoTarget*) -{ - m_undoManager->removeAllActions(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setActionTitle( - /* [in] */ BSTR actionTitle) -{ - // It is not neccessary to implement this for DRT because there is - // menu to write out the title to. - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::undo() -{ - m_undoManager->undo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::redo() -{ - m_undoManager->redo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canUndo( - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - - *result = m_undoManager->canUndo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canRedo( - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - - *result = m_undoManager->canRedo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::printFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::ftpDirectoryTemplatePath( - /* [in] */ IWebView *webView, - /* [retval][out] */ BSTR *path) -{ - if (!path) - return E_POINTER; - *path = 0; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewHeaderHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result) -{ - if (!result) - return E_POINTER; - *result = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFooterHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result) -{ - if (!result) - return E_POINTER; - *result = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawHeaderInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawFooterInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext, - /* [in] */ UINT pageIndex, - /* [in] */ UINT pageCount) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewPrintingMarginRect( - /* [in] */ IWebView *webView, - /* [retval][out] */ RECT *rect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canRunModal( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *canRunBoolean) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createModalDialog( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runModal( - /* [in] */ IWebView *webView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::isMenuBarVisible( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *visible) -{ - if (!visible) - return E_POINTER; - *visible = false; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setMenuBarVisible( - /* [in] */ IWebView *webView, - /* [in] */ BOOL visible) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runDatabaseSizeLimitPrompt( - /* [in] */ IWebView *webView, - /* [in] */ BSTR displayName, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *allowed) -{ - if (!allowed) - return E_POINTER; - *allowed = false; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollbar( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect, - /* [in] */ WebScrollBarControlSize size, - /* [in] */ WebScrollbarControlState state, - /* [in] */ WebScrollbarControlPart pressedPart, - /* [in] */ BOOL vertical, - /* [in] */ float value, - /* [in] */ float proportion, - /* [in] */ WebScrollbarControlPartMask parts) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollCorner( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setFrame( - /* [in] */ IWebView* /*sender*/, - /* [in] */ RECT* frame) -{ - m_frame = *frame; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFrame( - /* [in] */ IWebView* /*sender*/, - /* [retval][out] */ RECT* frame) -{ - *frame = m_frame; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptAlertPanelWithMessage( - /* [in] */ IWebView* /*sender*/, - /* [in] */ BSTR message) -{ - printf("ALERT: %S\n", message ? message : L""); - fflush(stdout); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptConfirmPanelWithMessage( - /* [in] */ IWebView* sender, - /* [in] */ BSTR message, - /* [retval][out] */ BOOL* result) -{ - printf("CONFIRM: %S\n", message ? message : L""); - *result = TRUE; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptTextInputPanelWithPrompt( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ BSTR defaultText, - /* [retval][out] */ BSTR *result) -{ - printf("PROMPT: %S, default text: %S\n", message ? message : L"", defaultText ? defaultText : L""); - *result = SysAllocString(defaultText); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runBeforeUnloadConfirmPanelWithMessage( - /* [in] */ IWebView* /*sender*/, - /* [in] */ BSTR message, - /* [in] */ IWebFrame* /*initiatedByFrame*/, - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - printf("CONFIRM NAVIGATION: %S\n", message ? message : L""); - *result = !gTestRunner->shouldStayOnPageAfterHandlingBeforeUnload(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewAddMessageToConsole( - /* [in] */ IWebView* sender, - /* [in] */ BSTR message, - /* [in] */ int lineNumber, - /* [in] */ BSTR url, - /* [in] */ BOOL isError) -{ - wstring newMessage; - if (message) { - newMessage = message; - size_t fileProtocol = newMessage.find(L"file://"); - if (fileProtocol != wstring::npos) - newMessage = newMessage.substr(0, fileProtocol) + lastPathComponent(newMessage.substr(fileProtocol)); - } - - printf("CONSOLE MESSAGE: "); - if (lineNumber) - printf("line %d: ", lineNumber); - printf("%s\n", toUTF8(newMessage).c_str()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::doDragDrop( - /* [in] */ IWebView* sender, - /* [in] */ IDataObject* object, - /* [in] */ IDropSource* source, - /* [in] */ DWORD okEffect, - /* [retval][out] */ DWORD* performedEffect) -{ - if (!performedEffect) - return E_POINTER; - - *performedEffect = 0; - - draggingInfo = new DraggingInfo(object, source); - HRESULT oleDragAndDropReturnValue = DRAGDROP_S_CANCEL; - replaySavedEvents(&oleDragAndDropReturnValue); - if (draggingInfo) { - *performedEffect = draggingInfo->performedDropEffect(); - delete draggingInfo; - draggingInfo = 0; - } - return oleDragAndDropReturnValue; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewGetDlgCode( - /* [in] */ IWebView* /*sender*/, - /* [in] */ UINT /*keyCode*/, - /* [retval][out] */ LONG_PTR *code) -{ - if (!code) - return E_POINTER; - *code = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView) -{ - if (!::gTestRunner->canOpenWindows()) - return E_FAIL; - *newWebView = createWebViewAndOffscreenWindow(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose( - /* [in] */ IWebView *sender) -{ - HWND hostWindow; - sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - DestroyWindow(hostWindow); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFocus( - /* [in] */ IWebView *sender) -{ - HWND hostWindow; - sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - SetForegroundWindow(hostWindow); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewUnfocus( - /* [in] */ IWebView *sender) -{ - SetForegroundWindow(GetDesktopWindow()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewPainted( - /* [in] */ IWebView *sender) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebSecurityOrigin *origin, - /* [in] */ BSTR databaseIdentifier) -{ - BSTR protocol; - BSTR host; - unsigned short port; - - origin->protocol(&protocol); - origin->host(&host); - origin->port(&port); - - if (!done && gTestRunner->dumpDatabaseCallbacks()) - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%S, %S, %i} database:%S\n", protocol, host, port, databaseIdentifier); - - SysFreeString(protocol); - SysFreeString(host); - - static const unsigned long long defaultQuota = 5 * 1024 * 1024; - origin->setQuota(defaultQuota); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::embeddedViewWithArguments( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IPropertyBag *arguments, - /* [retval][out] */ IWebEmbeddedView **view) -{ - if (!view) - return E_POINTER; - *view = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewClosing( - /* [in] */ IWebView *sender) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewSetCursor( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE cursor) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewDidInvalidate( - /* [in] */ IWebView *sender) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text) -{ - if (gTestRunner->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text ? toUTF8(text).c_str() : ""); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::desktopNotificationsDelegate(IWebDesktopNotificationsDelegate** result) -{ - m_desktopNotifications.copyRefTo(result); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::didPressMissingPluginButton(IDOMElement* element) -{ - printf("MISSING PLUGIN BUTTON PRESSED\n"); - return S_OK; -} - diff --git a/Tools/DumpRenderTree/win/UIDelegate.h b/Tools/DumpRenderTree/win/UIDelegate.h deleted file mode 100644 index 0c9fdaf63..000000000 --- a/Tools/DumpRenderTree/win/UIDelegate.h +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 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. - */ - -#ifndef UIDelegate_h -#define UIDelegate_h - -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> -#include <windef.h> - -class DRTUndoManager; -class DRTDesktopNotificationPresenter; - -class UIDelegate : public IWebUIDelegate2, IWebUIDelegatePrivate3 { -public: - UIDelegate(); - - void resetUndoManager(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebUIDelegate - virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView); - - virtual HRESULT STDMETHODCALLTYPE webViewShow( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewClose( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewFocus( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewUnfocus( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder( - /* [in] */ IWebView *sender, - /* [retval][out] */ OLE_HANDLE *responder) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE makeFirstResponder( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE responder) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setStatusText( - /* [in] */ IWebView *sender, - /* [in] */ BSTR text); - - virtual HRESULT STDMETHODCALLTYPE webViewStatusText( - /* [in] */ IWebView *sender, - /* [retval][out] */ BSTR *text) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible( - /* [in] */ IWebView *sender, - /* [in] */ BOOL visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible( - /* [in] */ IWebView *sender, - /* [in] */ BOOL visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewIsResizable( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *resizable) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setResizable( - /* [in] */ IWebView *sender, - /* [in] */ BOOL resizable) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setFrame( - /* [in] */ IWebView *sender, - /* [in] */ RECT *frame); - - virtual HRESULT STDMETHODCALLTYPE webViewFrame( - /* [in] */ IWebView *sender, - /* [retval][out] */ RECT *frame); - - virtual HRESULT STDMETHODCALLTYPE setContentRect( - /* [in] */ IWebView *sender, - /* [in] */ RECT *contentRect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewContentRect( - /* [in] */ IWebView *sender, - /* [retval][out] */ RECT *contentRect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message); - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ BSTR defaultText, - /* [retval][out] */ BSTR *result); - - virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener( - /* [in] */ IWebView *sender, - /* [in] */ IWebOpenPanelResultListener *resultListener) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement( - /* [in] */ IWebView *sender, - /* [in] */ IPropertyBag *elementInformation, - /* [in] */ UINT modifierFlags) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement( - /* [in] */ IWebView *sender, - /* [in] */ IPropertyBag *element, - /* [in] */ OLE_HANDLE defaultItems, - /* [retval][out] */ OLE_HANDLE *resultMenu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem( - /* [in] */ IWebView *webView, - /* [in] */ UINT itemCommandID, - /* [in] */ BOOL defaultValidation, - /* [retval][out] */ BOOL *isValid) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE shouldPerformAction( - /* [in] */ IWebView *webView, - /* [in] */ UINT itemCommandID, - /* [in] */ UINT sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo( - /* [in] */ IWebView *webView, - /* [in] */ IDataObject *draggingInfo, - /* [retval][out] */ WebDragDestinationAction *action) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction( - /* [in] */ IWebView *webView, - /* [in] */ WebDragDestinationAction action, - /* [in] */ IDataObject *draggingInfo) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint( - /* [in] */ IWebView *webView, - /* [in] */ LPPOINT point, - /* [retval][out] */ WebDragSourceAction *action) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction( - /* [in] */ IWebView *webView, - /* [in] */ WebDragSourceAction action, - /* [in] */ LPPOINT point, - /* [in] */ IDataObject *pasteboard, - /* [retval][out] */ IDataObject **newPasteboard) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected( - /* [in] */ IWebView *sender, - /* [in] */ void *item, - /* [in] */ IPropertyBag *element) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation( - /* [retval][out] */ BOOL *hasCustomMenus); - - virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu, - /* [in] */ LPPOINT point); - - virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem( - /* [in] */ IWebView *sender, - /* [in] */ void *measureItem) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem( - /* [in] */ IWebView *sender, - /* [in] */ void *drawItem) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE canTakeFocus( - /* [in] */ IWebView *sender, - /* [in] */ BOOL forward, - /* [out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE takeFocus( - /* [in] */ IWebView *sender, - /* [in] */ BOOL forward) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget( - /* [in] */ IWebUndoTarget *target, - /* [in] */ BSTR actionName, - /* [in] */ IUnknown *actionArg); - - virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget( - /* [in] */ IWebUndoTarget *target); - - virtual HRESULT STDMETHODCALLTYPE setActionTitle( - /* [in] */ BSTR actionTitle); - - virtual HRESULT STDMETHODCALLTYPE undo(); - - virtual HRESULT STDMETHODCALLTYPE redo(); - - virtual HRESULT STDMETHODCALLTYPE canUndo( - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE canRedo( - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE printFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE ftpDirectoryTemplatePath( - /* [in] */ IWebView *webView, - /* [retval][out] */ BSTR *path); - - virtual HRESULT STDMETHODCALLTYPE webViewHeaderHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result); - - virtual HRESULT STDMETHODCALLTYPE webViewFooterHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result); - - virtual HRESULT STDMETHODCALLTYPE drawHeaderInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext); - - virtual HRESULT STDMETHODCALLTYPE drawFooterInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext, - /* [in] */ UINT pageIndex, - /* [in] */ UINT pageCount); - - virtual HRESULT STDMETHODCALLTYPE webViewPrintingMarginRect( - /* [in] */ IWebView *webView, - /* [retval][out] */ RECT *rect); - - virtual HRESULT STDMETHODCALLTYPE canRunModal( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *canRunBoolean); - - virtual HRESULT STDMETHODCALLTYPE createModalDialog( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView); - - virtual HRESULT STDMETHODCALLTYPE runModal( - /* [in] */ IWebView *webView); - - virtual HRESULT STDMETHODCALLTYPE isMenuBarVisible( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *visible); - - virtual HRESULT STDMETHODCALLTYPE setMenuBarVisible( - /* [in] */ IWebView *webView, - /* [in] */ BOOL visible); - - virtual HRESULT STDMETHODCALLTYPE runDatabaseSizeLimitPrompt( - /* [in] */ IWebView *webView, - /* [in] */ BSTR displayName, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *allowed); - - virtual HRESULT STDMETHODCALLTYPE paintCustomScrollbar( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect, - /* [in] */ WebScrollBarControlSize size, - /* [in] */ WebScrollbarControlState state, - /* [in] */ WebScrollbarControlPart pressedPart, - /* [in] */ BOOL vertical, - /* [in] */ float value, - /* [in] */ float proportion, - /* [in] */ WebScrollbarControlPartMask parts); - - virtual HRESULT STDMETHODCALLTYPE paintCustomScrollCorner( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect); - - virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView); - - virtual HRESULT STDMETHODCALLTYPE drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect); - - virtual HRESULT STDMETHODCALLTYPE decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener); - - virtual HRESULT STDMETHODCALLTYPE didPressMissingPluginButton(IDOMElement*); - -protected: - // IWebUIDelegatePrivate - - virtual HRESULT STDMETHODCALLTYPE unused1() { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unused2() { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unused3() { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewScrolled( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewAddMessageToConsole( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ int lineNumber, - /* [in] */ BSTR url, - /* [in] */ BOOL isError); - - virtual HRESULT STDMETHODCALLTYPE webViewShouldInterruptJavaScript( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewReceivedFocus( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewLostFocus( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE loseFocusTo) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE doDragDrop( - /* [in] */ IWebView *sender, - /* [in] */ IDataObject *dataObject, - /* [in] */ IDropSource *dropSource, - /* [in] */ DWORD okEffect, - /* [retval][out] */ DWORD *performedEffect); - - virtual HRESULT STDMETHODCALLTYPE webViewGetDlgCode( - /* [in] */ IWebView *sender, - /* [in] */ UINT keyCode, - /* [retval][out] */ LONG_PTR *code); - - virtual HRESULT STDMETHODCALLTYPE webViewPainted( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebSecurityOrigin *origin, - /* [in] */ BSTR databaseIdentifier); - - virtual HRESULT STDMETHODCALLTYPE embeddedViewWithArguments( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IPropertyBag *arguments, - /* [retval][out] */ IWebEmbeddedView **view); - - virtual HRESULT STDMETHODCALLTYPE webViewClosing( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewSetCursor( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE cursor); - - virtual HRESULT STDMETHODCALLTYPE webViewDidInvalidate( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE desktopNotificationsDelegate( - /* [out] */ IWebDesktopNotificationsDelegate** result); - - ULONG m_refCount; - -private: - RECT m_frame; - OwnPtr<DRTUndoManager> m_undoManager; - - COMPtr<IWebDesktopNotificationsDelegate> m_desktopNotifications; -}; - -#endif diff --git a/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp b/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp deleted file mode 100644 index 3225a6520..000000000 --- a/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2007, 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. - * 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" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSStringRefCF.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.h> -#include <string> - -using std::wstring; - -static wstring jsStringRefToWString(JSStringRef jsStr) -{ - size_t length = JSStringGetLength(jsStr); - Vector<WCHAR> buffer(length + 1); - memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); - buffer[length] = '\0'; - - return buffer.data(); -} - -bool LoadItem::invoke() const -{ - wstring targetString = jsStringRefToWString(m_target.get()); - - COMPtr<IWebFrame> targetFrame; - if (targetString.empty()) - targetFrame = frame; - else { - BSTR targetBSTR = SysAllocString(targetString.c_str()); - bool failed = FAILED(frame->findFrameNamed(targetBSTR, &targetFrame)); - SysFreeString(targetBSTR); - if (failed) - return false; - } - - COMPtr<IWebURLRequest> request; - if (FAILED(WebKitCreateInstance(CLSID_WebURLRequest, 0, IID_IWebURLRequest, (void**)&request))) - return false; - - wstring urlString = jsStringRefToWString(m_url.get()); - BSTR urlBSTR = SysAllocString(urlString.c_str()); - bool failed = FAILED(request->initWithURL(urlBSTR, WebURLRequestUseProtocolCachePolicy, 60)); - SysFreeString(urlBSTR); - if (failed) - return false; - - targetFrame->loadRequest(request.get()); - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - wstring content = jsStringRefToWString(m_content.get()); - wstring baseURL = jsStringRefToWString(m_baseURL.get()); - - BSTR contentBSTR = SysAllocString(content.c_str()); - BSTR baseURLBSTR = SysAllocString(baseURL.c_str()); - - if (m_unreachableURL) { - wstring unreachableURL = jsStringRefToWString(m_unreachableURL.get()); - BSTR unreachableURLBSTR = SysAllocString(unreachableURL.c_str()); - frame->loadAlternateHTMLString(contentBSTR, baseURLBSTR, unreachableURLBSTR); - SysFreeString(contentBSTR); - SysFreeString(baseURLBSTR); - SysFreeString(unreachableURLBSTR); - return true; - } - - frame->loadHTMLString(contentBSTR, baseURLBSTR); - - SysFreeString(contentBSTR); - SysFreeString(baseURLBSTR); - - return true; -} - -bool ReloadItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - COMPtr<IWebIBActions> webActions; - if (FAILED(webView->QueryInterface(&webActions))) - return false; - - webActions->reload(0); - return true; -} - -bool ScriptItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - wstring scriptString = jsStringRefToWString(m_script.get()); - - BSTR result; - BSTR scriptBSTR = SysAllocString(scriptString.c_str()); - webView->stringByEvaluatingJavaScriptFromString(scriptBSTR, &result); - SysFreeString(result); - SysFreeString(scriptBSTR); - - return true; -} - -bool BackForwardItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - BOOL result; - if (m_howFar == 1) { - webView->goForward(&result); - return true; - } - - if (m_howFar == -1) { - webView->goBack(&result); - return true; - } - - COMPtr<IWebBackForwardList> bfList; - if (FAILED(webView->backForwardList(&bfList))) - return false; - - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(m_howFar, &item))) - return false; - - webView->goToBackForwardItem(item.get(), &result); - return true; -} |