summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree')
-rw-r--r--WebKitTools/DumpRenderTree/AccessibilityController.cpp70
-rw-r--r--WebKitTools/DumpRenderTree/AccessibilityController.h48
-rw-r--r--WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp303
-rw-r--r--WebKitTools/DumpRenderTree/AccessibilityUIElement.h111
-rw-r--r--WebKitTools/DumpRenderTree/DumpRenderTree.h7
-rw-r--r--WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj55
-rw-r--r--WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h5
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Locker.h1
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/MathExtras.h1
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/PassRefPtr.h1
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefCounted.h1
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefPtr.h1
-rw-r--r--WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Threading.h1
-rw-r--r--WebKitTools/DumpRenderTree/GCController.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp132
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h38
-rw-r--r--WebKitTools/DumpRenderTree/PixelDumpSupport.h14
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp684
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h54
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp94
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h52
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp154
-rw-r--r--WebKitTools/DumpRenderTree/WorkQueue.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp194
-rw-r--r--WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp104
-rw-r--r--WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h51
-rw-r--r--WebKitTools/DumpRenderTree/config.h47
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttfbin0 -> 28512 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttfbin0 -> 28512 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttfbin0 -> 28492 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttfbin0 -> 28440 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttfbin0 -> 28424 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttfbin0 -> 28460 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttfbin0 -> 28384 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttfbin0 -> 28492 bytes
-rw-r--r--WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttfbin0 -> 28492 bytes
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp179
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTree.pro19
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h3
-rw-r--r--WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp1
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp72
-rw-r--r--WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm54
-rw-r--r--WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm425
-rw-r--r--WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig4
-rw-r--r--WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig2
-rw-r--r--WebKitTools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig2
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm383
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h8
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.h3
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m13
-rw-r--r--WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm5
-rw-r--r--WebKitTools/DumpRenderTree/mac/EditingDelegate.mm26
-rw-r--r--WebKitTools/DumpRenderTree/mac/EventSendingController.h2
-rw-r--r--WebKitTools/DumpRenderTree/mac/EventSendingController.mm128
-rw-r--r--WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h2
-rw-r--r--WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm62
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm47
-rw-r--r--WebKitTools/DumpRenderTree/mac/ObjCController.m42
-rw-r--r--WebKitTools/DumpRenderTree/mac/ObjCPlugin.m2
-rw-r--r--WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm267
-rw-r--r--WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm63
-rw-r--r--WebKitTools/DumpRenderTree/mac/UIDelegate.mm37
-rw-r--r--WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp19
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp66
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTree.h3
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro4
-rw-r--r--WebKitTools/DumpRenderTree/qt/jsobjects.cpp13
-rw-r--r--WebKitTools/DumpRenderTree/qt/jsobjects.h3
-rw-r--r--WebKitTools/DumpRenderTree/qt/main.cpp11
-rw-r--r--WebKitTools/DumpRenderTree/qt/testplugin.cpp46
-rw-r--r--WebKitTools/DumpRenderTree/qt/testplugin.h19
-rw-r--r--WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp84
-rw-r--r--WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp266
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp167
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj61
-rw-r--r--WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h19
-rw-r--r--WebKitTools/DumpRenderTree/win/EditingDelegate.cpp31
-rw-r--r--WebKitTools/DumpRenderTree/win/EditingDelegate.h2
-rw-r--r--WebKitTools/DumpRenderTree/win/EventSender.cpp44
-rw-r--r--WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp55
-rw-r--r--WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h5
-rw-r--r--WebKitTools/DumpRenderTree/win/GCControllerWin.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/win/ImageDiff.vcproj8
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp98
-rw-r--r--WebKitTools/DumpRenderTree/win/MD5.cpp1
-rw-r--r--WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp13
-rw-r--r--WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/win/PolicyDelegate.h2
-rw-r--r--WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp11
-rw-r--r--WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h2
-rw-r--r--WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj14
-rw-r--r--WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c52
-rw-r--r--WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp54
-rwxr-xr-xWebKitTools/DumpRenderTree/win/UIDelegate.cpp46
-rwxr-xr-xWebKitTools/DumpRenderTree/win/UIDelegate.h16
-rw-r--r--WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp6
97 files changed, 4044 insertions, 1289 deletions
diff --git a/WebKitTools/DumpRenderTree/AccessibilityController.cpp b/WebKitTools/DumpRenderTree/AccessibilityController.cpp
new file mode 100644
index 0000000..d2ed2a6
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/AccessibilityController.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "AccessibilityController.h"
+
+#include "AccessibilityUIElement.h"
+#include <JavaScriptCore/JSRetainPtr.h>
+
+// Static Value Getters
+
+static JSValueRef getFocusedElementCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, controller->focusedElement());
+}
+
+static JSValueRef getRootElementCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, controller->rootElement());
+}
+
+// Object Creation
+
+void AccessibilityController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> accessibilityControllerStr(Adopt, JSStringCreateWithUTF8CString("accessibilityController"));
+ JSValueRef accessibilityControllerObject = JSObjectMake(context, getJSClass(), this);
+ JSObjectSetProperty(context, windowObject, accessibilityControllerStr.get(), accessibilityControllerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+}
+
+JSClassRef AccessibilityController::getJSClass()
+{
+ static JSStaticValue staticValues[] = {
+ { "focusedElement", getFocusedElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "rootElement", getRootElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { 0, 0, 0, 0 }
+ };
+
+ static JSClassDefinition classDefinition = {
+ 0, kJSClassAttributeNone, "AccessibilityController", 0, staticValues, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ static JSClassRef accessibilityControllerClass = JSClassCreate(&classDefinition);
+ return accessibilityControllerClass;
+}
diff --git a/WebKitTools/DumpRenderTree/AccessibilityController.h b/WebKitTools/DumpRenderTree/AccessibilityController.h
new file mode 100644
index 0000000..0af6613
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/AccessibilityController.h
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+#ifndef AccessibilityController_h
+#define AccessibilityController_h
+
+#include <JavaScriptCore/JSObjectRef.h>
+
+class AccessibilityUIElement;
+
+class AccessibilityController {
+public:
+ AccessibilityController();
+ ~AccessibilityController();
+
+ void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
+
+ // Controller Methods - platform-independent implementations
+ AccessibilityUIElement rootElement();
+ AccessibilityUIElement focusedElement();
+
+private:
+ static JSClassRef getJSClass();
+};
+
+#endif // AccessibilityController_h
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
new file mode 100644
index 0000000..02d2dfa
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -0,0 +1,303 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "AccessibilityUIElement.h"
+
+#include <JavaScriptCore/JSRetainPtr.h>
+
+// Static Functions
+
+static AccessibilityUIElement* toAXElement(JSObjectRef object)
+{
+ // FIXME: We should ASSERT that it is the right class here.
+ return reinterpret_cast<AccessibilityUIElement*>(JSObjectGetPrivate(object));
+}
+
+static JSValueRef allAttributesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributes(Adopt, toAXElement(thisObject)->allAttributes());
+ return JSValueMakeString(context, attributes.get());
+}
+
+static JSValueRef attributesOfLinkedUIElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfLinkedUIElements());
+ return JSValueMakeString(context, linkedUIDescription.get());
+}
+
+static JSValueRef attributesOfDocumentLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfDocumentLinks());
+ return JSValueMakeString(context, linkedUIDescription.get());
+}
+
+static JSValueRef attributesOfChildrenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> childrenDescription(Adopt, toAXElement(thisObject)->attributesOfChildren());
+ return JSValueMakeString(context, childrenDescription.get());
+}
+
+static JSValueRef parameterizedAttributeNamesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> parameterizedAttributeNames(Adopt, toAXElement(thisObject)->parameterizedAttributeNames());
+ return JSValueMakeString(context, parameterizedAttributeNames.get());
+}
+
+static JSValueRef attributesOfColumnHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfColumnHeaders(Adopt, toAXElement(thisObject)->attributesOfColumnHeaders());
+ return JSValueMakeString(context, attributesOfColumnHeaders.get());
+}
+
+static JSValueRef attributesOfRowHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfRowHeaders(Adopt, toAXElement(thisObject)->attributesOfRowHeaders());
+ return JSValueMakeString(context, attributesOfRowHeaders.get());
+}
+
+static JSValueRef attributesOfColumnsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfColumns(Adopt, toAXElement(thisObject)->attributesOfColumns());
+ return JSValueMakeString(context, attributesOfColumns.get());
+}
+
+static JSValueRef attributesOfRowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfRows(Adopt, toAXElement(thisObject)->attributesOfRows());
+ return JSValueMakeString(context, attributesOfRows.get());
+}
+
+static JSValueRef attributesOfVisibleCellsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfVisibleCells(Adopt, toAXElement(thisObject)->attributesOfVisibleCells());
+ return JSValueMakeString(context, attributesOfVisibleCells.get());
+}
+
+static JSValueRef attributesOfHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> attributesOfHeader(Adopt, toAXElement(thisObject)->attributesOfHeader());
+ return JSValueMakeString(context, attributesOfHeader.get());
+}
+
+static JSValueRef indexInTableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->indexInTable());
+}
+
+static JSValueRef rowIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> rowIndexRange(Adopt, toAXElement(thisObject)->rowIndexRange());
+ return JSValueMakeString(context, rowIndexRange.get());
+}
+
+static JSValueRef columnIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> columnIndexRange(Adopt, toAXElement(thisObject)->columnIndexRange());
+ return JSValueMakeString(context, columnIndexRange.get());
+}
+
+static JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ int indexNumber = -1;
+ if (argumentCount == 1)
+ indexNumber = JSValueToNumber(context, arguments[0], exception);
+
+ return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber));
+}
+
+static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned location = UINT_MAX, length = 0;
+ if (argumentCount == 2) {
+ location = JSValueToNumber(context, arguments[0], exception);
+ length = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ JSRetainPtr<JSStringRef> boundsDescription(Adopt, toAXElement(thisObject)->boundsForRange(location, length));
+ return JSValueMakeString(context, boundsDescription.get());
+}
+
+static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ int indexNumber = -1;
+ if (argumentCount == 1)
+ indexNumber = JSValueToNumber(context, arguments[0], exception);
+
+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber));
+}
+
+static JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned column = 0, row = 0;
+ if (argumentCount == 2) {
+ column = JSValueToNumber(context, arguments[0], exception);
+ row = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row));
+}
+
+static JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement());
+}
+
+static JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned location = UINT_MAX, length = 0;
+ if (argumentCount == 2) {
+ location = JSValueToNumber(context, arguments[0], exception);
+ length = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ toAXElement(thisObject)->setSelectedTextRange(location, length);
+ return 0;
+}
+
+// Static Value Getters
+
+static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role());
+ return JSValueMakeString(context, role.get());
+}
+
+static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
+ return JSValueMakeString(context, title.get());
+}
+
+static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
+ return JSValueMakeString(context, description.get());
+}
+
+static JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->width());
+}
+
+static JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->height());
+}
+
+static JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->intValue());
+}
+
+static JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->minValue());
+}
+
+static JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue());
+}
+
+static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber());
+}
+
+static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange());
+ return JSValueMakeString(context, selectedTextRange.get());
+}
+
+static JSValueRef getSupportsPressActionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ return JSValueMakeBoolean(context, toAXElement(thisObject)->supportsPressAction());
+}
+
+// Destruction
+
+static void finalize(JSObjectRef thisObject)
+{
+ delete toAXElement(thisObject);
+}
+
+// Object Creation
+
+JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element)
+{
+ return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element));
+}
+
+JSClassRef AccessibilityUIElement::getJSClass()
+{
+ static JSStaticValue staticValues[] = {
+ { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "supportsPressAction", getSupportsPressActionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { 0, 0, 0, 0 }
+ };
+
+ static JSStaticFunction staticFunctions[] = {
+ { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { 0, 0, 0 }
+ };
+
+ static JSClassDefinition classDefinition = {
+ 0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions,
+ 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition);
+ return accessibilityUIElementClass;
+}
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
new file mode 100644
index 0000000..064829f
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+#ifndef AccessibilityUIElement_h
+#define AccessibilityUIElement_h
+
+#include <JavaScriptCore/JSObjectRef.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+typedef id PlatformUIElement;
+#else
+typedef struct objc_object* PlatformUIElement;
+#endif
+#elif PLATFORM(WIN)
+#undef _WINSOCKAPI_
+#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
+
+#include <oleacc.h>
+#include <WebCore/COMPtr.h>
+
+typedef COMPtr<IAccessible> PlatformUIElement;
+#else
+typedef void* PlatformUIElement;
+#endif
+
+class AccessibilityUIElement {
+public:
+ AccessibilityUIElement(PlatformUIElement);
+ AccessibilityUIElement(const AccessibilityUIElement&);
+ ~AccessibilityUIElement();
+
+ PlatformUIElement platformUIElement() { return m_element; }
+
+ static JSObjectRef makeJSAccessibilityUIElement(JSContextRef, const AccessibilityUIElement&);
+
+ void getLinkedUIElements(Vector<AccessibilityUIElement>&);
+ void getDocumentLinks(Vector<AccessibilityUIElement>&);
+ void getChildren(Vector<AccessibilityUIElement>&);
+ AccessibilityUIElement getChildAtIndex(unsigned);
+ AccessibilityUIElement titleUIElement();
+
+ // Methods - platform-independent implementations
+ JSStringRef allAttributes();
+ JSStringRef attributesOfLinkedUIElements();
+ JSStringRef attributesOfDocumentLinks();
+ JSStringRef attributesOfChildren();
+ JSStringRef parameterizedAttributeNames();
+
+ // Attributes - platform-independent implementations
+ JSStringRef role();
+ JSStringRef title();
+ JSStringRef description();
+ double width();
+ double height();
+ double intValue();
+ double minValue();
+ double maxValue();
+ int insertionPointLineNumber();
+ JSStringRef selectedTextRange();
+ bool supportsPressAction();
+
+ // Table-specific attributes
+ JSStringRef attributesOfColumnHeaders();
+ JSStringRef attributesOfRowHeaders();
+ JSStringRef attributesOfColumns();
+ JSStringRef attributesOfRows();
+ JSStringRef attributesOfVisibleCells();
+ JSStringRef attributesOfHeader();
+ int indexInTable();
+ JSStringRef rowIndexRange();
+ JSStringRef columnIndexRange();
+
+ // Parameterized attributes
+ int lineForIndex(int);
+ JSStringRef boundsForRange(unsigned location, unsigned length);
+ void setSelectedTextRange(unsigned location, unsigned length);
+
+ // Table-specific
+ AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row);
+
+private:
+ static JSClassRef getJSClass();
+
+ PlatformUIElement m_element;
+};
+
+#endif // AccessibilityUIElement_h
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.h b/WebKitTools/DumpRenderTree/DumpRenderTree.h
index e74d4bc..9336a04 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.h
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.h
@@ -29,7 +29,10 @@
#ifndef DumpRenderTree_h
#define DumpRenderTree_h
+// FIXME: Remove this when all platforms are using config.h
+#ifndef Config_H
#include <wtf/Platform.h>
+#endif
#if PLATFORM(MAC)
#include "DumpRenderTreeMac.h"
@@ -46,14 +49,16 @@ extern CFRunLoopTimerRef waitToDumpWatchdog;
#include <string>
+#if !PLATFORM(OPENBSD)
std::wstring urlSuitableForTestResult(const std::wstring& url);
+#endif
class LayoutTestController;
extern volatile bool done;
// FIXME: This is a bad abstraction. We should insted pass this to other controller objects which need access to it.
-extern LayoutTestController* layoutTestController;
+extern LayoutTestController* gLayoutTestController;
void dump();
void displayWebView();
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 1a59f19..ca7bdcd 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -27,13 +27,13 @@
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 */; };
- 141BF44C096A45C800E0753C /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 141BF448096A45C800E0753C /* Info.plist */; };
141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; };
14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; };
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 */; };
+ 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */; };
9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; };
A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; };
@@ -50,6 +50,9 @@
B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A752A108AF5D1F00138E45 /* QuartzCore.framework */; };
BC0131DA0C9772010087317D /* LayoutTestController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0131D80C9772010087317D /* LayoutTestController.cpp */; };
BC0131DB0C9772010087317D /* LayoutTestController.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0131D90C9772010087317D /* LayoutTestController.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 */; };
BC47412A0D038A4C0072B006 /* JavaScriptThreading.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4741290D038A4C0072B006 /* JavaScriptThreading.h */; };
BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */; };
BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */; };
@@ -91,6 +94,8 @@
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 */; };
/* End PBXBuildFile section */
@@ -121,13 +126,23 @@
/* Begin PBXFileReference section */
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.xml; path = Info.plist; sourceTree = "<group>"; };
+ 141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; 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>"; };
+ 23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
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>"; };
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; };
A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; };
@@ -145,13 +160,16 @@
B5A752A108AF5D1F00138E45 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
BC0131D80C9772010087317D /* LayoutTestController.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = LayoutTestController.cpp; sourceTree = "<group>"; };
BC0131D90C9772010087317D /* LayoutTestController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutTestController.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>"; };
BC4741290D038A4C0072B006 /* JavaScriptThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptThreading.h; sourceTree = "<group>"; };
BC4741400D038A570072B006 /* JavaScriptThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaScriptThreadingPthreads.cpp; path = pthreads/JavaScriptThreadingPthreads.cpp; sourceTree = "<group>"; };
BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; 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 /* LayoutTestControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestControllerMac.mm; path = mac/LayoutTestControllerMac.mm; sourceTree = "<group>"; };
+ BCA18B220C9B014B00114369 /* LayoutTestControllerMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestControllerMac.mm; path = mac/LayoutTestControllerMac.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>"; };
@@ -192,6 +210,9 @@
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; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = GCController.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -215,6 +236,7 @@
A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */,
A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */,
9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */,
+ 23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -277,6 +299,12 @@
1422A2690AF6F45200E1A883 /* Controllers */ = {
isa = PBXGroup;
children = (
+ BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */,
+ BCD08A580E10496B00A7D0C1 /* AccessibilityController.h */,
+ BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */,
+ BC0E24DF0E2D9451001B6BC2 /* AccessibilityUIElement.cpp */,
+ BC0E24DE0E2D9451001B6BC2 /* AccessibilityUIElement.h */,
+ BC0E26140E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm */,
BCA18B360C9B021900114369 /* AppleScriptController.h */,
BCA18B370C9B021900114369 /* AppleScriptController.m */,
BCA18B6B0C9B08DB00114369 /* EventSendingController.h */,
@@ -296,6 +324,7 @@
);
name = Controllers;
sourceTree = "<group>";
+ usesTabs = 0;
};
1422A2750AF6F4BD00E1A883 /* Delegates */ = {
isa = PBXGroup;
@@ -327,6 +356,15 @@
9345229B0BD12B2C0086EDA0 /* Resources */ = {
isa = PBXGroup;
children = (
+ 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 */,
AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */,
);
name = Resources;
@@ -341,6 +379,7 @@
A817090308B164D300CCB9FB /* JavaScriptCore.framework */,
B5A752A108AF5D1F00138E45 /* QuartzCore.framework */,
9335435F03D75502008635CE /* WebKit.framework */,
+ 23BCB88F0EA57623003C6289 /* OpenGL.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -433,6 +472,7 @@
BCB284C70CFA83C4007E533E /* PixelDumpSupport.h in Headers */,
BCB284D00CFA83CC007E533E /* PixelDumpSupportCG.h in Headers */,
BC47412A0D038A4C0072B006 /* JavaScriptThreading.h in Headers */,
+ BC0E24E00E2D9451001B6BC2 /* AccessibilityUIElement.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -526,7 +566,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 141BF44C096A45C800E0753C /* Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -573,6 +612,10 @@
BCB284CD0CFA83C8007E533E /* PixelDumpSupportCG.cpp in Sources */,
BCB284D60CFA83D1007E533E /* PixelDumpSupportMac.mm in Sources */,
BC4741410D038A570072B006 /* JavaScriptThreadingPthreads.cpp in Sources */,
+ BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */,
+ BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */,
+ BC0E24E10E2D9451001B6BC2 /* AccessibilityUIElement.cpp in Sources */,
+ BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -653,7 +696,7 @@
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- OPTIMIZATION_CFLAGS = "-O0";
+ GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = All;
@@ -671,7 +714,7 @@
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- OPTIMIZATION_CFLAGS = "-O0";
+ GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = All;
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h b/WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h
index cb40968..1344754 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h
+++ b/WebKitTools/DumpRenderTree/DumpRenderTreePrefix.h
@@ -31,3 +31,8 @@
#import <Foundation/Foundation.h>
#endif
+
+// 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
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Locker.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Locker.h
new file mode 100644
index 0000000..75b0acd
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Locker.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/Locker.h>
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/MathExtras.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/MathExtras.h
new file mode 100644
index 0000000..2955786
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/MathExtras.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/MathExtras.h>
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/PassRefPtr.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/PassRefPtr.h
new file mode 100644
index 0000000..aafd1a2
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/PassRefPtr.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/PassRefPtr.h>
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefCounted.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefCounted.h
new file mode 100644
index 0000000..628a63b
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefCounted.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/RefCounted.h>
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefPtr.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefPtr.h
new file mode 100644
index 0000000..0ff6213
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/RefPtr.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/RefPtr.h>
diff --git a/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Threading.h b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Threading.h
new file mode 100644
index 0000000..17359e5
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/ForwardingHeaders/wtf/Threading.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/Threading.h>
diff --git a/WebKitTools/DumpRenderTree/GCController.cpp b/WebKitTools/DumpRenderTree/GCController.cpp
index 38c45bf..e1a16f2 100644
--- a/WebKitTools/DumpRenderTree/GCController.cpp
+++ b/WebKitTools/DumpRenderTree/GCController.cpp
@@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "GCController.h"
#include <JavaScriptCore/JSObjectRef.h>
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index bda93ce..f450543 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -26,21 +26,25 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "LayoutTestController.h"
#include <JavaScriptCore/JSObjectRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
-LayoutTestController::LayoutTestController(bool testRepaintDefault, bool testRepaintSweepHorizontallyDefault)
+LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash)
: m_dumpAsText(false)
+ , m_dumpAsPDF(false)
, m_dumpBackForwardList(false)
, m_dumpChildFrameScrollPositions(false)
, m_dumpChildFramesAsText(false)
+ , m_dumpDatabaseCallbacks(false)
, m_dumpDOMAsWebArchive(false)
, m_dumpSelectionRect(false)
, m_dumpSourceAsWebArchive(false)
+ , m_dumpStatusCallbacks(false)
, m_dumpTitleChanges(false)
, m_dumpEditingCallbacks(false)
, m_dumpResourceLoadCallbacks(false)
@@ -49,11 +53,15 @@ LayoutTestController::LayoutTestController(bool testRepaintDefault, bool testRep
, m_callCloseOnWebViews(true)
, m_canOpenWindows(false)
, m_closeRemainingWindowsWhenComplete(true)
- , m_testRepaint(testRepaintDefault)
- , m_testRepaintSweepHorizontally(testRepaintSweepHorizontallyDefault)
+ , m_stopProvisionalFrameLoads(false)
+ , m_testOnscreen(false)
+ , m_testRepaint(false)
+ , m_testRepaintSweepHorizontally(false)
, m_waitToDump(false)
, m_windowIsKey(true)
, m_globalFlag(false)
+ , m_testPathOrURL(testPathOrURL)
+ , m_expectedPixelHash(expectedPixelHash)
{
}
@@ -66,6 +74,13 @@ static JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}
+static JSValueRef dumpAsPDFCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setDumpAsPDF(true);
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef dumpBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -87,24 +102,24 @@ static JSValueRef dumpChildFrameScrollPositionsCallback(JSContextRef context, JS
return JSValueMakeUndefined(context);
}
-static JSValueRef dumpDOMAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef dumpDatabaseCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
- controller->setDumpDOMAsWebArchive(true);
+ controller->setDumpDatabaseCallbacks(true);
return JSValueMakeUndefined(context);
}
-static JSValueRef dumpEditingCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef dumpDOMAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
- controller->setDumpEditingCallbacks(true);
+ controller->setDumpDOMAsWebArchive(true);
return JSValueMakeUndefined(context);
}
-static JSValueRef dumpFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef dumpEditingCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
- controller->setDumpFrameLoadCallbacks(true);
+ controller->setDumpEditingCallbacks(true);
return JSValueMakeUndefined(context);
}
@@ -129,6 +144,13 @@ static JSValueRef dumpSourceAsWebArchiveCallback(JSContextRef context, JSObjectR
return JSValueMakeUndefined(context);
}
+static JSValueRef dumpStatusCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setDumpStatusCallbacks(true);
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef dumpTitleChangesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -186,6 +208,13 @@ static JSValueRef setCloseRemainingWindowsWhenCompleteCallback(JSContextRef cont
return JSValueMakeUndefined(context);
}
+static JSValueRef testOnscreenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setTestOnscreen(true);
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef testRepaintCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -215,6 +244,15 @@ static JSValueRef addDisallowedURLCallback(JSContextRef context, JSObjectRef fun
return JSValueMakeUndefined(context);
}
+static JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->clearAllDatabases();
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef clearBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -310,7 +348,6 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function,
// May be able to be made platform independant by using shared WorkQueue
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
controller->notifyDone();
-
return JSValueMakeUndefined(context);
}
@@ -432,6 +469,32 @@ static JSValueRef setCustomPolicyDelegateCallback(JSContextRef context, JSObject
return JSValueMakeUndefined(context);
}
+static JSValueRef setDatabaseQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+
+ double quota = JSValueToNumber(context, arguments[0], NULL);
+ if (!isnan(quota))
+ controller->setDatabaseQuota(static_cast<unsigned long long>(quota));
+
+ return JSValueMakeUndefined(context);
+
+}
+
+static JSValueRef setJavaScriptProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setJavaScriptProfilingEnabled(JSValueToBoolean(context, arguments[0]));
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setMainFrameIsFirstResponderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac implementation
@@ -563,6 +626,33 @@ static JSValueRef setPopupBlockingEnabledCallback(JSContextRef context, JSObject
return JSValueMakeUndefined(context);
}
+static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setSmartInsertDeleteEnabled(JSValueToBoolean(context, arguments[0]));
+ return JSValueMakeUndefined(context);
+}
+
+static JSValueRef setStopProvisionalFrameLoadsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setStopProvisionalFrameLoads(true);
+ return JSValueMakeUndefined(context);
+}
+
+static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+ ASSERT(!*exception);
+
+ bool autoCompletes = controller->elementDoesAutoCompleteForElementWithId(elementId.get());
+
+ return JSValueMakeBoolean(context, autoCompletes);
+}
// Static Values
@@ -579,11 +669,18 @@ static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject,
return true;
}
+static void layoutTestControllerObjectFinalize(JSObjectRef object)
+{
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(object));
+ controller->deref();
+}
+
// Object Creation
void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
{
JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController"));
+ ref();
JSValueRef layoutTestContollerObject = JSObjectMake(context, getJSClass(), this);
JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
}
@@ -597,7 +694,7 @@ JSClassRef LayoutTestController::getJSClass()
JSStaticFunction* staticFunctions = LayoutTestController::staticFunctions();
JSClassDefinition classDefinition = {
0, kJSClassAttributeNone, "LayoutTestController", 0, staticValues, staticFunctions,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, layoutTestControllerObjectFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
layoutTestControllerClass = JSClassCreate(&classDefinition);
@@ -621,20 +718,23 @@ JSStaticFunction* LayoutTestController::staticFunctions()
static JSStaticFunction staticFunctions[] = {
{ "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "addFileToPasteboardOnDrag", addFileToPasteboardOnDragCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "clearAllDatabases", clearAllDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpBackForwardList", dumpBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpChildFramesAsText", dumpChildFramesAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpChildFrameScrollPositions", dumpChildFrameScrollPositionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "dumpDatabaseCallbacks", dumpDatabaseCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpDOMAsWebArchive", dumpDOMAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "dumpFrameLoadCallbacks", dumpFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpResourceLoadCallbacks", dumpResourceLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpSelectionRect", dumpSelectionRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpSourceAsWebArchive", dumpSourceAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "dumpStatusCallbacks", dumpStatusCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpTitleChanges", dumpTitleChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -653,18 +753,24 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "testRepaint", testRepaintCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "waitUntilDone", waitUntilDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "windowCount", windowCountCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 9677ffa..f27c2c6 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -30,16 +30,19 @@
#define LayoutTestController_h
#include <JavaScriptCore/JSObjectRef.h>
+#include <wtf/RefCounted.h>
+#include <string>
-class LayoutTestController {
+class LayoutTestController : public RefCounted<LayoutTestController> {
public:
- LayoutTestController(bool testRepaintDefault, bool testRepaintSweepHorizontallyDefault);
+ LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
~LayoutTestController();
void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
// Controller Methods - platfrom independant implementations
void addDisallowedURL(JSStringRef url);
+ void clearAllDatabases();
void clearBackForwardList();
JSStringRef copyDecodedHostName(JSStringRef name);
JSStringRef copyEncodedHostName(JSStringRef name);
@@ -56,20 +59,28 @@ public:
void setAcceptsEditing(bool acceptsEditing);
void setAuthorAndUserStylesEnabled(bool);
void setCustomPolicyDelegate(bool setDelegate);
+ void setDatabaseQuota(unsigned long long quota);
void setMainFrameIsFirstResponder(bool flag);
void setPrivateBrowsingEnabled(bool flag);
void setPopupBlockingEnabled(bool flag);
void setTabKeyCyclesThroughElements(bool cycles);
+ void setSmartInsertDeleteEnabled(bool flag);
+ void setJavaScriptProfilingEnabled(bool profilingEnabled);
void setUseDashboardCompatibilityMode(bool flag);
void setUserStyleSheetEnabled(bool flag);
void setUserStyleSheetLocation(JSStringRef path);
void setPersistentUserStyleSheetLocation(JSStringRef path);
void clearPersistentUserStyleSheet();
int windowCount();
+
+ bool elementDoesAutoCompleteForElementWithId(JSStringRef id);
bool dumpAsText() const { return m_dumpAsText; }
void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; }
+ bool dumpAsPDF() const { return m_dumpAsPDF; }
+ void setDumpAsPDF(bool dumpAsPDF) { m_dumpAsPDF = dumpAsPDF; }
+
bool dumpBackForwardList() const { return m_dumpBackForwardList; }
void setDumpBackForwardList(bool dumpBackForwardList) { m_dumpBackForwardList = dumpBackForwardList; }
@@ -79,6 +90,12 @@ public:
bool dumpChildFramesAsText() const { return m_dumpChildFramesAsText; }
void setDumpChildFramesAsText(bool dumpChildFramesAsText) { m_dumpChildFramesAsText = dumpChildFramesAsText; }
+ bool dumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
+ void setDumpDatabaseCallbacks(bool dumpDatabaseCallbacks) { m_dumpDatabaseCallbacks = dumpDatabaseCallbacks; }
+
+ bool dumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
+ void setDumpStatusCallbacks(bool dumpStatusCallbacks) { m_dumpStatusCallbacks = dumpStatusCallbacks; }
+
bool dumpDOMAsWebArchive() const { return m_dumpDOMAsWebArchive; }
void setDumpDOMAsWebArchive(bool dumpDOMAsWebArchive) { m_dumpDOMAsWebArchive = dumpDOMAsWebArchive; }
@@ -111,6 +128,12 @@ public:
bool closeRemainingWindowsWhenComplete() const { return m_closeRemainingWindowsWhenComplete; }
void setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete) { m_closeRemainingWindowsWhenComplete = closeRemainingWindowsWhenComplete; }
+
+ bool stopProvisionalFrameLoads() const { return m_stopProvisionalFrameLoads; }
+ void setStopProvisionalFrameLoads(bool stopProvisionalFrameLoads) { m_stopProvisionalFrameLoads = stopProvisionalFrameLoads; }
+
+ bool testOnscreen() const { return m_testOnscreen; }
+ void setTestOnscreen(bool testOnscreen) { m_testOnscreen = testOnscreen; }
bool testRepaint() const { return m_testRepaint; }
void setTestRepaint(bool testRepaint) { m_testRepaint = testRepaint; }
@@ -127,14 +150,20 @@ public:
bool globalFlag() const { return m_globalFlag; }
void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
+ const std::string& testPathOrURL() const { return m_testPathOrURL; }
+ const std::string& expectedPixelHash() const { return m_expectedPixelHash; }
+
private:
bool m_dumpAsText;
+ bool m_dumpAsPDF;
bool m_dumpBackForwardList;
bool m_dumpChildFrameScrollPositions;
bool m_dumpChildFramesAsText;
+ bool m_dumpDatabaseCallbacks;
bool m_dumpDOMAsWebArchive;
bool m_dumpSelectionRect;
bool m_dumpSourceAsWebArchive;
+ bool m_dumpStatusCallbacks;
bool m_dumpTitleChanges;
bool m_dumpEditingCallbacks;
bool m_dumpResourceLoadCallbacks;
@@ -143,6 +172,8 @@ private:
bool m_callCloseOnWebViews;
bool m_canOpenWindows;
bool m_closeRemainingWindowsWhenComplete;
+ bool m_stopProvisionalFrameLoads;
+ bool m_testOnscreen;
bool m_testRepaint;
bool m_testRepaintSweepHorizontally;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
@@ -150,6 +181,9 @@ private:
bool m_globalFlag;
+ std::string m_testPathOrURL;
+ std::string m_expectedPixelHash; // empty string if no hash
+
static JSClassRef getJSClass();
static JSStaticValue* staticValues();
static JSStaticFunction* staticFunctions();
diff --git a/WebKitTools/DumpRenderTree/PixelDumpSupport.h b/WebKitTools/DumpRenderTree/PixelDumpSupport.h
index 3214d04..d4f8948 100644
--- a/WebKitTools/DumpRenderTree/PixelDumpSupport.h
+++ b/WebKitTools/DumpRenderTree/PixelDumpSupport.h
@@ -29,12 +29,18 @@
#ifndef PixelDumpSupport_h
#define PixelDumpSupport_h
-void dumpWebViewAsPixelsAndCompareWithExpected(const char* currentTest, bool forceAllTestsToDumpPixels);
+#include <string>
+
+void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash);
+
+#if PLATFORM(MAC)
// Can be used as a signal handler
-void restoreColorSpace(int ignored);
+void restoreMainDisplayColorProfile(int ignored);
+
+// May change your color space, requiring a call to restoreMainDisplayColorProfile
+void setupMainDisplayColorProfile();
-// May change your color space, requiring a call to restoreColorSpace
-void initializeColorSpaceAndScreeBufferForPixelTests();
+#endif
#endif // PixelDumpSupport_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index 4cd4c04..11fb30d 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
@@ -1,34 +1,26 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * Copyright (C) 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.
+ *
+ * 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 "PluginObject.h"
@@ -37,22 +29,22 @@
#include <assert.h>
#include <stdio.h>
-static void pluginInvalidate(NPObject *obj);
-static bool pluginHasProperty(NPObject *obj, NPIdentifier name);
-static bool pluginHasMethod(NPObject *obj, NPIdentifier name);
-static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
-static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant);
-static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
-static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-static NPObject *pluginAllocate(NPP npp, NPClass *theClass);
-static void pluginDeallocate(NPObject *obj);
+static void pluginInvalidate(NPObject*);
+static bool pluginHasProperty(NPObject*, NPIdentifier name);
+static bool pluginHasMethod(NPObject*, NPIdentifier name);
+static bool pluginGetProperty(NPObject*, NPIdentifier name, NPVariant*);
+static bool pluginSetProperty(NPObject*, NPIdentifier name, const NPVariant*);
+static bool pluginInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
+static bool pluginInvokeDefault(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result);
+static NPObject* pluginAllocate(NPP npp, NPClass*);
+static void pluginDeallocate(NPObject*);
-NPNetscapeFuncs *browser;
+NPNetscapeFuncs* browser;
-static NPClass pluginClass = {
+static NPClass pluginClass = {
NP_CLASS_STRUCT_VERSION,
- pluginAllocate,
- pluginDeallocate,
+ pluginAllocate,
+ pluginDeallocate,
pluginInvalidate,
pluginHasMethod,
pluginInvoke,
@@ -61,7 +53,7 @@ static NPClass pluginClass = {
pluginGetProperty,
pluginSetProperty,
};
-
+
NPClass *getPluginClass(void)
{
return &pluginClass;
@@ -69,12 +61,13 @@ NPClass *getPluginClass(void)
static bool identifiersInitialized = false;
-#define ID_PROPERTY_PROPERTY 0
-#define ID_PROPERTY_EVENT_LOGGING 1
-#define ID_PROPERTY_HAS_STREAM 2
-#define ID_PROPERTY_TEST_OBJECT 3
-#define ID_PROPERTY_LOG_DESTROY 4
-#define NUM_PROPERTY_IDENTIFIERS 5
+#define ID_PROPERTY_PROPERTY 0
+#define ID_PROPERTY_EVENT_LOGGING 1
+#define ID_PROPERTY_HAS_STREAM 2
+#define ID_PROPERTY_TEST_OBJECT 3
+#define ID_PROPERTY_LOG_DESTROY 4
+#define ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM 5
+#define NUM_PROPERTY_IDENTIFIERS 6
static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
@@ -83,6 +76,7 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"hasStream",
"testObject",
"logDestroy",
+ "returnErrorFromNewStream",
};
#define ID_TEST_CALLBACK_METHOD 0
@@ -97,7 +91,11 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
#define ID_TEST_GET_PROPERTY 9
#define ID_TEST_EVALUATE 10
#define ID_TEST_GET_PROPERTY_RETURN_VALUE 11
-#define NUM_METHOD_IDENTIFIERS 12
+#define ID_TEST_IDENTIFIER_TO_STRING 12
+#define ID_TEST_IDENTIFIER_TO_INT 13
+#define ID_TEST_POSTURL_FILE 14
+#define ID_TEST_CONSTRUCT 15
+#define NUM_METHOD_IDENTIFIERS 16
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
@@ -113,9 +111,13 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testGetProperty",
"testEvaluate",
"testGetPropertyReturnValue",
+ "testIdentifierToString",
+ "testIdentifierToInt",
+ "testPostURLFile",
+ "testConstruct",
};
-static NPUTF8* createCStringFromNPVariant(const NPVariant *variant)
+static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
{
size_t length = NPVARIANT_TO_STRING(*variant).UTF8Length;
NPUTF8* result = (NPUTF8*)malloc(length + 1);
@@ -146,46 +148,54 @@ static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
return false;
}
-static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant)
+static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result)
{
+ PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
if (name == pluginPropertyIdentifiers[ID_PROPERTY_PROPERTY]) {
- STRINGZ_TO_NPVARIANT("property", *variant);
+ STRINGZ_TO_NPVARIANT("property", *result);
return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
- BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->eventLogging, *variant);
+ BOOLEAN_TO_NPVARIANT(plugin->eventLogging, *result);
return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) {
- BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->logDestroy, *variant);
- return true;
+ BOOLEAN_TO_NPVARIANT(plugin->logDestroy, *result);
+ return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_HAS_STREAM]) {
- BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->stream != 0, *variant);
+ BOOLEAN_TO_NPVARIANT(plugin->stream != 0, *result);
return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
- NPObject *testObject = ((PluginObject *)obj)->testObject;
+ NPObject* testObject = plugin->testObject;
browser->retainobject(testObject);
- OBJECT_TO_NPVARIANT(testObject, *variant);
+ OBJECT_TO_NPVARIANT(testObject, *result);
+ return true;
+ } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
+ BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result);
return true;
}
return false;
}
-static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant)
+static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* variant)
{
+ PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
- ((PluginObject *)obj)->eventLogging = NPVARIANT_TO_BOOLEAN(*variant);
+ plugin->eventLogging = NPVARIANT_TO_BOOLEAN(*variant);
return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) {
- ((PluginObject *)obj)->logDestroy = NPVARIANT_TO_BOOLEAN(*variant);
+ plugin->logDestroy = NPVARIANT_TO_BOOLEAN(*variant);
+ return true;
+ } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
+ plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant);
return true;
}
-
+
return false;
}
-static void testDOMAccess(PluginObject *obj)
+static bool testDOMAccess(PluginObject* obj, const NPVariant*, uint32_t, NPVariant* result)
{
// Get plug-in's DOM element
- NPObject *elementObject;
+ NPObject* elementObject;
if (browser->getvalue(obj->npp, NPNVPluginElementNPObject, &elementObject) == NPERR_NO_ERROR) {
// Get style
NPVariant styleVariant;
@@ -198,199 +208,386 @@ static void testDOMAccess(PluginObject *obj)
browser->setproperty(obj->npp, NPVARIANT_TO_OBJECT(styleVariant), borderIdentifier, &borderVariant);
browser->releasevariantvalue(&styleVariant);
}
-
+
browser->releaseobject(elementObject);
}
+ VOID_TO_NPVARIANT(*result);
+ return true;
}
-static bool pluginInvoke(NPObject *header, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
+static NPIdentifier stringVariantToIdentifier(NPVariant variant)
{
- PluginObject *obj = (PluginObject *)header;
- if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD]) {
- // call whatever method name we're given
- if (argCount > 0 && NPVARIANT_IS_STRING(args[0])) {
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+ assert(NPVARIANT_IS_STRING(variant));
+ NPUTF8* utf8String = createCStringFromNPVariant(&variant);
+ NPIdentifier identifier = browser->getstringidentifier(utf8String);
+ free(utf8String);
+ return identifier;
+}
- NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- free(callbackString);
+static NPIdentifier int32VariantToIdentifier(NPVariant variant)
+{
+ assert(NPVARIANT_IS_INT32(variant));
+ int32 integer = NPVARIANT_TO_INT32(variant);
+ return browser->getintidentifier(integer);
+}
- NPVariant browserResult;
- browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, 0, 0, &browserResult);
- browser->releasevariantvalue(&browserResult);
+static NPIdentifier doubleVariantToIdentifier(NPVariant variant)
+{
+ assert(NPVARIANT_IS_DOUBLE(variant));
+ double value = NPVARIANT_TO_DOUBLE(variant);
+ // Sadly there is no "getdoubleidentifier"
+ int32 integer = static_cast<int32>(value);
+ return browser->getintidentifier(integer);
+}
- VOID_TO_NPVARIANT(*result);
- return true;
- }
- } else if (name == pluginMethodIdentifiers[ID_TEST_GETURL]) {
- if (argCount == 2 && NPVARIANT_IS_STRING(args[0]) && NPVARIANT_IS_STRING(args[1])) {
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- NPUTF8* targetString = createCStringFromNPVariant(&args[1]);
- browser->geturl(obj->npp, urlString, targetString);
- free(urlString);
- free(targetString);
-
- VOID_TO_NPVARIANT(*result);
- return true;
- } else if (argCount == 1 && NPVARIANT_IS_STRING(args[0])) {
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- browser->geturl(obj->npp, urlString, 0);
- free(urlString);
+static NPIdentifier variantToIdentifier(NPVariant variant)
+{
+ if (NPVARIANT_IS_STRING(variant))
+ return stringVariantToIdentifier(variant);
+ else if (NPVARIANT_IS_INT32(variant))
+ return int32VariantToIdentifier(variant);
+ else if (NPVARIANT_IS_DOUBLE(variant))
+ return doubleVariantToIdentifier(variant);
+ return 0;
+}
- VOID_TO_NPVARIANT(*result);
- return true;
- }
- } else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD]) {
- pluginClass.invokeDefault = 0;
- VOID_TO_NPVARIANT(*result);
+static bool testIdentifierToString(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 1)
+ return false;
+ NPIdentifier identifier = variantToIdentifier(args[0]);
+ if (!identifier)
+ return false;
+ NPUTF8* utf8String = browser->utf8fromidentifier(identifier);
+ if (!utf8String)
+ return false;
+ STRINGZ_TO_NPVARIANT(utf8String, *result);
+ return true;
+}
+
+static bool testIdentifierToInt(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 1)
+ return false;
+ NPIdentifier identifier = variantToIdentifier(args[0]);
+ if (!identifier)
+ return false;
+ int32 integer = browser->intfromidentifier(identifier);
+ INT32_TO_NPVARIANT(integer, *result);
+ return true;
+}
+
+static bool testCallback(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount == 0 || !NPVARIANT_IS_STRING(args[0]))
+ return false;
+
+ NPObject* windowScriptObject;
+ browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
+ NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
+ free(callbackString);
+
+ NPVariant browserResult;
+ browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, 0, 0, &browserResult);
+ browser->releasevariantvalue(&browserResult);
+
+ browser->releaseobject(windowScriptObject);
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+}
+
+static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount == 2 && NPVARIANT_IS_STRING(args[0]) && NPVARIANT_IS_STRING(args[1])) {
+ NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
+ NPUTF8* targetString = createCStringFromNPVariant(&args[1]);
+ NPError npErr = browser->geturl(obj->npp, urlString, targetString);
+ free(urlString);
+ free(targetString);
+
+ INT32_TO_NPVARIANT(npErr, *result);
return true;
- } else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS]) {
- testDOMAccess(obj);
- VOID_TO_NPVARIANT(*result);
+ } else if (argCount == 1 && NPVARIANT_IS_STRING(args[0])) {
+ NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
+ NPError npErr = browser->geturl(obj->npp, urlString, 0);
+ free(urlString);
+
+ INT32_TO_NPVARIANT(npErr, *result);
return true;
- } else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY]) {
- if (argCount == 3
- && NPVARIANT_IS_STRING(args[0])
- && (NPVARIANT_IS_STRING(args[1]) || NPVARIANT_IS_NULL(args[1]))
- && NPVARIANT_IS_STRING(args[2])) {
- NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
- NPUTF8* targetString = (NPVARIANT_IS_STRING(args[1]) ? createCStringFromNPVariant(&args[1]) : NULL);
- NPUTF8* callbackString = createCStringFromNPVariant(&args[2]);
-
- NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
- browser->geturlnotify(obj->npp, urlString, targetString, callbackIdentifier);
-
- free(urlString);
- free(targetString);
- free(callbackString);
-
- VOID_TO_NPVARIANT(*result);
- return true;
- }
- } else if (name == pluginMethodIdentifiers[ID_TEST_INVOKE_DEFAULT] && NPVARIANT_IS_OBJECT(args[0])) {
- NPObject *callback = NPVARIANT_TO_OBJECT(args[0]);
-
- NPVariant args[1];
- NPVariant browserResult;
-
- STRINGZ_TO_NPVARIANT("test", args[0]);
- bool retval = browser->invokeDefault(obj->npp, callback, args, 1, &browserResult);
-
- if (retval)
+ }
+ return false;
+}
+
+static bool removeDefaultMethod(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ pluginClass.invokeDefault = 0;
+ VOID_TO_NPVARIANT(*result);
+ return true;
+}
+
+static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 3 || !NPVARIANT_IS_STRING(args[0])
+ || (!NPVARIANT_IS_STRING(args[1]) && !NPVARIANT_IS_NULL(args[1]))
+ || !NPVARIANT_IS_STRING(args[2]))
+ return false;
+
+ NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
+ NPUTF8* targetString = (NPVARIANT_IS_STRING(args[1]) ? createCStringFromNPVariant(&args[1]) : NULL);
+ NPUTF8* callbackString = createCStringFromNPVariant(&args[2]);
+
+ NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
+ browser->geturlnotify(obj->npp, urlString, targetString, callbackIdentifier);
+
+ free(urlString);
+ free(targetString);
+ free(callbackString);
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+}
+
+static bool testInvokeDefault(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (!NPVARIANT_IS_OBJECT(args[0]))
+ return false;
+
+ NPObject *callback = NPVARIANT_TO_OBJECT(args[0]);
+
+ NPVariant invokeArgs[1];
+ NPVariant browserResult;
+
+ STRINGZ_TO_NPVARIANT("test", invokeArgs[0]);
+ bool retval = browser->invokeDefault(obj->npp, callback, invokeArgs, 1, &browserResult);
+
+ if (retval)
+ browser->releasevariantvalue(&browserResult);
+
+ BOOLEAN_TO_NPVARIANT(retval, *result);
+ return true;
+}
+
+static bool destroyStream(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ NPError npError = browser->destroystream(obj->npp, obj->stream, NPRES_USER_BREAK);
+ INT32_TO_NPVARIANT(npError, *result);
+ return true;
+}
+
+static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_OBJECT(args[1]))
+ return false;
+
+ uint32_t count;
+ NPIdentifier* identifiers;
+ if (browser->enumerate(obj->npp, NPVARIANT_TO_OBJECT(args[0]), &identifiers, &count)) {
+ NPObject* outArray = NPVARIANT_TO_OBJECT(args[1]);
+ NPIdentifier pushIdentifier = browser->getstringidentifier("push");
+
+ for (uint32_t i = 0; i < count; i++) {
+ NPUTF8* string = browser->utf8fromidentifier(identifiers[i]);
+
+ if (!string)
+ continue;
+
+ NPVariant args[1];
+ STRINGZ_TO_NPVARIANT(string, args[0]);
+ NPVariant browserResult;
+ browser->invoke(obj->npp, outArray, pushIdentifier, args, 1, &browserResult);
browser->releasevariantvalue(&browserResult);
-
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
- } else if (name == pluginMethodIdentifiers[ID_TEST_ENUMERATE]) {
- if (argCount == 2 && NPVARIANT_IS_OBJECT(args[0]) && NPVARIANT_IS_OBJECT(args[1])) {
- uint32_t count;
- NPIdentifier* identifiers;
-
- if (browser->enumerate(obj->npp, NPVARIANT_TO_OBJECT(args[0]), &identifiers, &count)) {
- NPObject* outArray = NPVARIANT_TO_OBJECT(args[1]);
- NPIdentifier pushIdentifier = browser->getstringidentifier("push");
-
- for (uint32_t i = 0; i < count; i++) {
- NPUTF8* string = browser->utf8fromidentifier(identifiers[i]);
-
- if (!string)
- continue;
-
- NPVariant args[1];
- STRINGZ_TO_NPVARIANT(string, args[0]);
- NPVariant browserResult;
- browser->invoke(obj->npp, outArray, pushIdentifier, args, 1, &browserResult);
- browser->releasevariantvalue(&browserResult);
- browser->memfree(string);
- }
-
- browser->memfree(identifiers);
- }
-
- VOID_TO_NPVARIANT(*result);
- return true;
- }
- } else if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM]) {
- NPError npError = browser->destroystream(obj->npp, obj->stream, NPRES_USER_BREAK);
- INT32_TO_NPVARIANT(npError, *result);
- return true;
- } else if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER]) {
- if (argCount == 1 && NPVARIANT_IS_DOUBLE(args[0])) {
- NPIdentifier identifier = browser->getintidentifier((int)NPVARIANT_TO_DOUBLE(args[0]));
- INT32_TO_NPVARIANT((int32)identifier, *result);
- return true;
+ browser->memfree(string);
}
- } else if (name == pluginMethodIdentifiers[ID_TEST_EVALUATE] &&
- argCount == 1 && NPVARIANT_IS_STRING(args[0])) {
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString s = NPVARIANT_TO_STRING(args[0]);
-
- bool retval = browser->evaluate(obj->npp, windowScriptObject, &s, result);
- browser->releaseobject(windowScriptObject);
- return retval;
- } else if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY] &&
- argCount > 0) {
- NPObject *object;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &object);
-
- for (uint32_t i = 0; i < argCount; i++) {
- assert(NPVARIANT_IS_STRING(args[i]));
- NPUTF8* propertyString = createCStringFromNPVariant(&args[i]);
- NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
- free(propertyString);
-
- NPVariant variant;
- bool retval = browser->getproperty(obj->npp, object, propertyIdentifier, &variant);
- browser->releaseobject(object);
-
- if (!retval)
- break;
-
- if (i + 1 < argCount) {
- assert(NPVARIANT_IS_OBJECT(variant));
- object = NPVARIANT_TO_OBJECT(variant);
- } else {
- *result = variant;
- return true;
- }
- }
-
- VOID_TO_NPVARIANT(*result);
+
+ browser->memfree(identifiers);
+ }
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+}
+
+static bool testGetIntIdentifier(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 1 || !NPVARIANT_IS_DOUBLE(args[0]))
return false;
- } else if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE] &&
- argCount == 2 && NPVARIANT_IS_OBJECT(args[0]) && NPVARIANT_IS_STRING(args[1])) {
- NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
+
+ NPIdentifier identifier = browser->getintidentifier((int)NPVARIANT_TO_DOUBLE(args[0]));
+ INT32_TO_NPVARIANT((int32)(long long)identifier, *result);
+ return true;
+}
+
+static bool testGetProperty(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount == 0)
+ return false;
+
+ NPObject *object;
+ browser->getvalue(obj->npp, NPNVWindowNPObject, &object);
+
+ for (uint32_t i = 0; i < argCount; i++) {
+ assert(NPVARIANT_IS_STRING(args[i]));
+ NPUTF8* propertyString = createCStringFromNPVariant(&args[i]);
NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
free(propertyString);
NPVariant variant;
- bool retval = browser->getproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier, &variant);
- if (retval)
- browser->releasevariantvalue(&variant);
+ bool retval = browser->getproperty(obj->npp, object, propertyIdentifier, &variant);
+ browser->releaseobject(object);
- BOOLEAN_TO_NPVARIANT(retval, *result);
- return true;
+ if (!retval)
+ break;
+
+ if (i + 1 < argCount) {
+ assert(NPVARIANT_IS_OBJECT(variant));
+ object = NPVARIANT_TO_OBJECT(variant);
+ } else {
+ *result = variant;
+ return true;
+ }
}
+
+ VOID_TO_NPVARIANT(*result);
+ return false;
+}
+
+static bool testEvaluate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 1 || !NPVARIANT_IS_STRING(args[0]))
+ return false;
+ NPObject* windowScriptObject;
+ browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPString s = NPVARIANT_TO_STRING(args[0]);
+
+ bool retval = browser->evaluate(obj->npp, windowScriptObject, &s, result);
+ browser->releaseobject(windowScriptObject);
+ return retval;
+}
+
+static bool testGetPropertyReturnValue(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
+ return false;
+
+ NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
+ NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
+ free(propertyString);
+
+ NPVariant variant;
+ bool retval = browser->getproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier, &variant);
+ if (retval)
+ browser->releasevariantvalue(&variant);
+
+ BOOLEAN_TO_NPVARIANT(retval, *result);
+ return true;
+}
+
+static char* toCString(const NPString& string)
+{
+ char* result = static_cast<char*>(malloc(string.UTF8Length + 1));
+ memcpy(result, string.UTF8Characters, string.UTF8Length);
+ result[string.UTF8Length] = '\0';
+
+ return result;
+}
+
+static bool testPostURLFile(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 4 || !NPVARIANT_IS_STRING(args[0]) || !NPVARIANT_IS_STRING(args[1]) || !NPVARIANT_IS_STRING(args[2]) || !NPVARIANT_IS_STRING(args[3]))
+ return false;
+
+ NPString urlString = NPVARIANT_TO_STRING(args[0]);
+ char* url = toCString(urlString);
+
+ NPString targetString = NPVARIANT_TO_STRING(args[1]);
+ char* target = toCString(targetString);
+
+ NPString pathString = NPVARIANT_TO_STRING(args[2]);
+ char* path = toCString(pathString);
+
+ NPString contentsString = NPVARIANT_TO_STRING(args[3]);
+
+ FILE* tempFile = fopen(path, "w");
+ if (!tempFile)
+ return false;
+
+ fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile);
+ fclose(tempFile);
+
+ NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Length, path, TRUE);
+
+ free(path);
+ free(target);
+ free(url);
+
+ BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result);
+ return true;
+}
+
+static bool testConstruct(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (!argCount || !NPVARIANT_IS_OBJECT(args[0]))
+ return false;
+
+ return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result);
+}
+
+static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
+ if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD])
+ return testCallback(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_GETURL])
+ return getURL(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD])
+ return removeDefaultMethod(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS])
+ return testDOMAccess(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY])
+ return getURLNotify(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_INVOKE_DEFAULT])
+ return testInvokeDefault(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_ENUMERATE])
+ return testEnumerate(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM])
+ return destroyStream(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER])
+ return testGetIntIdentifier(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_EVALUATE])
+ return testEvaluate(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY])
+ return testGetProperty(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE])
+ return testGetPropertyReturnValue(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_STRING])
+ return testIdentifierToString(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_INT])
+ return testIdentifierToInt(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_POSTURL_FILE])
+ return testPostURLFile(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT])
+ return testConstruct(plugin, args, argCount, result);
+
return false;
}
-static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result)
+static bool pluginInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
INT32_TO_NPVARIANT(1, *result);
return true;
}
-static void pluginInvalidate(NPObject *obj)
+static void pluginInvalidate(NPObject* obj)
{
}
static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
{
- PluginObject *newInstance = (PluginObject*)malloc(sizeof(PluginObject));
-
+ PluginObject* newInstance = (PluginObject*)malloc(sizeof(PluginObject));
+
if (!identifiersInitialized) {
identifiersInitialized = true;
initializeIdentifiers();
@@ -399,42 +596,43 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
newInstance->npp = npp;
newInstance->testObject = browser->createobject(npp, getTestClass());
newInstance->eventLogging = FALSE;
+ newInstance->onStreamLoad = 0;
+ newInstance->onStreamDestroy = 0;
+ newInstance->onURLNotify = 0;
newInstance->logDestroy = FALSE;
newInstance->logSetWindow = FALSE;
newInstance->returnErrorFromNewStream = FALSE;
newInstance->stream = 0;
-
+
newInstance->firstUrl = NULL;
newInstance->firstHeaders = NULL;
newInstance->lastUrl = NULL;
newInstance->lastHeaders = NULL;
-
- return (NPObject *)newInstance;
+
+ return (NPObject*)newInstance;
}
-static void pluginDeallocate(NPObject *header)
+static void pluginDeallocate(NPObject* header)
{
- PluginObject* obj = (PluginObject*)header;
-
- browser->releaseobject(obj->testObject);
-
- free(obj->firstUrl);
- free(obj->firstHeaders);
- free(obj->lastUrl);
- free(obj->lastHeaders);
-
- free(obj);
+ PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
+ browser->releaseobject(plugin->testObject);
+
+ free(plugin->firstUrl);
+ free(plugin->firstHeaders);
+ free(plugin->lastUrl);
+ free(plugin->lastHeaders);
+ free(plugin);
}
void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData)
{
assert(object);
-
+
NPVariant args[2];
-
+
NPObject *windowScriptObject;
browser->getvalue(object->npp, NPNVWindowNPObject, &windowScriptObject);
-
+
NPIdentifier callbackIdentifier = notifyData;
INT32_TO_NPVARIANT(reason, args[0]);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
index 95abbf9..a5441d8 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
@@ -1,34 +1,26 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
+ *
+ * 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 <WebKit/npfunctions.h>
@@ -45,6 +37,8 @@ typedef struct {
NPObject* testObject;
NPStream* stream;
char* onStreamLoad;
+ char* onStreamDestroy;
+ char* onURLNotify;
char* firstUrl;
char* firstHeaders;
char* lastUrl;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp
index 6b6206e..3e85e2c 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp
@@ -1,34 +1,26 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
+ *
+ * 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 "TestObject.h"
@@ -36,8 +28,10 @@
static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
static bool testHasProperty(NPObject *obj, NPIdentifier name);
+static bool testGetProperty(NPObject*, NPIdentifier name, NPVariant*);
static NPObject *testAllocate(NPP npp, NPClass *theClass);
static void testDeallocate(NPObject *obj);
+static bool testConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static NPClass testClass = {
NP_CLASS_STRUCT_VERSION,
@@ -48,10 +42,11 @@ static NPClass testClass = {
0,
0,
testHasProperty,
+ testGetProperty,
0,
0,
- 0,
- testEnumerate
+ testEnumerate,
+ testConstruct
};
NPClass *getTestClass(void)
@@ -61,12 +56,16 @@ NPClass *getTestClass(void)
static bool identifiersInitialized = false;
-#define NUM_TEST_IDENTIFIERS 2
+#define ID_OBJECT_POINTER 2
+
+#define NUM_ENUMERATABLE_TEST_IDENTIFIERS 2
+#define NUM_TEST_IDENTIFIERS 3
static NPIdentifier testIdentifiers[NUM_TEST_IDENTIFIERS];
static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = {
"foo",
- "bar"
+ "bar",
+ "objectPointer",
};
static void initializeIdentifiers(void)
@@ -76,7 +75,7 @@ static void initializeIdentifiers(void)
static NPObject *testAllocate(NPP npp, NPClass *theClass)
{
- NPObject *newInstance = (NPObject*)malloc(sizeof(NPObject));
+ NPObject *newInstance = static_cast<NPObject*>(malloc(sizeof(NPObject)));
if (!identifiersInitialized) {
identifiersInitialized = true;
@@ -101,14 +100,35 @@ static bool testHasProperty(NPObject *obj, NPIdentifier name)
return false;
}
+static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result)
+{
+ if (name == testIdentifiers[ID_OBJECT_POINTER]) {
+ int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long>(npobj));
+
+ INT32_TO_NPVARIANT(objectPointer, *result);
+ return true;
+ }
+
+ return false;
+}
+
static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
{
*count = NUM_TEST_IDENTIFIERS;
- *value = (NPIdentifier*)browser->memalloc(NUM_TEST_IDENTIFIERS * sizeof(NPIdentifier));
- memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_TEST_IDENTIFIERS);
+ *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERATABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier));
+ memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERATABLE_TEST_IDENTIFIERS);
+
+ return true;
+}
+
+static bool testConstruct(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ browser->retainobject(npobj);
+ // Just return the same object.
+ OBJECT_TO_NPVARIANT(npobj, *result);
return true;
}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h
index f27aea6..1295fb7 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h
@@ -1,34 +1,26 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
+ *
+ * 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 <WebKit/npapi.h>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
index fb6a6ca..bb98ba2 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
@@ -1,38 +1,34 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
+ *
+ * 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 "PluginObject.h"
+#if __LP64__
+#define USE_COCOA_EVENT_MODEL 1
+#endif
+
// Mach-o entry points
extern "C" {
NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
@@ -74,14 +70,28 @@ void NP_Shutdown(void)
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
+#if USE_COCOA_EVENT_MODEL
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
+#endif
+
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-
- obj->onStreamLoad = NULL;
-
+
for (int i = 0; i < argc; i++) {
if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
+ else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
+ obj->onStreamDestroy = strdup(argv[i]);
+ else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
+ obj->onURLNotify = strdup(argv[i]);
else if (strcasecmp(argn[i], "src") == 0 &&
strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0)
obj->returnErrorFromNewStream = TRUE;
@@ -101,6 +111,12 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
if (obj) {
if (obj->onStreamLoad)
free(obj->onStreamLoad);
+
+ if (obj->onStreamDestroy)
+ free(obj->onStreamDestroy);
+
+ if (obj->onURLNotify)
+ free(obj->onURLNotify);
if (obj->logDestroy)
printf("PLUGIN: NPP_Destroy\n");
@@ -124,6 +140,20 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
return NPERR_NO_ERROR;
}
+static void executeScript(const PluginObject* obj, const char* script)
+{
+ NPObject *windowScriptObject;
+ browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPString npScript;
+ npScript.UTF8Characters = script;
+ npScript.UTF8Length = strlen(script);
+
+ NPVariant browserResult;
+ browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
+ browser->releasevariantvalue(&browserResult);
+}
+
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
@@ -136,24 +166,19 @@ NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool se
if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS)
notifyStream(obj, stream->url, stream->headers);
- if (obj->onStreamLoad) {
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString script;
- script.UTF8Characters = obj->onStreamLoad;
- script.UTF8Length = strlen(obj->onStreamLoad);
-
- NPVariant browserResult;
- browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult);
- browser->releasevariantvalue(&browserResult);
- }
-
+ if (obj->onStreamLoad)
+ executeScript(obj, obj->onStreamLoad);
+
return NPERR_NO_ERROR;
}
NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
{
+ PluginObject* obj = (PluginObject*)instance->pdata;
+
+ if (obj->onStreamDestroy)
+ executeScript(obj, obj->onStreamDestroy);
+
return NPERR_NO_ERROR;
}
@@ -180,7 +205,35 @@ int16 NPP_HandleEvent(NPP instance, void *event)
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (!obj->eventLogging)
return 0;
-
+
+#if USE_COCOA_EVENT_MODEL
+ // FIXME: Generate output that will match the Carbon event model
+ // so that the layout tests using this plug-in will work in either model.
+ NPCocoaEvent *cocoaEvent = static_cast<NPCocoaEvent*>(event);
+ switch (cocoaEvent->type) {
+ case NPCocoaEventWindowFocusChanged:
+ case NPCocoaEventFocusChanged:
+ return 1;
+
+ case NPCocoaEventDrawRect:
+ return 1;
+
+ case NPCocoaEventKeyDown:
+ case NPCocoaEventKeyUp:
+ case NPCocoaEventFlagsChanged:
+ return 1;
+
+ case NPCocoaEventMouseDown:
+ case NPCocoaEventMouseUp:
+
+ case NPCocoaEventMouseMoved:
+ case NPCocoaEventMouseEntered:
+ case NPCocoaEventMouseExited:
+ case NPCocoaEventMouseDragged:
+ case NPCocoaEventScrollWheel:
+ return 1;
+ }
+#else
EventRecord* evt = static_cast<EventRecord*>(event);
Point pt = { evt->where.v, evt->where.h };
switch (evt->what) {
@@ -242,14 +295,17 @@ int16 NPP_HandleEvent(NPP instance, void *event)
default:
printf("PLUGIN: event %d\n", evt->what);
}
-
+#endif
return 0;
}
void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
+
+ if (obj->onURLNotify)
+ executeScript(obj, obj->onURLNotify);
+
handleCallback(obj, url, reason, notifyData);
}
diff --git a/WebKitTools/DumpRenderTree/WorkQueue.cpp b/WebKitTools/DumpRenderTree/WorkQueue.cpp
index 87c7af5..0891b9c 100644
--- a/WebKitTools/DumpRenderTree/WorkQueue.cpp
+++ b/WebKitTools/DumpRenderTree/WorkQueue.cpp
@@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "WorkQueue.h"
#include "WorkQueueItem.h"
diff --git a/WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp b/WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp
index 068f73d..1e55e78 100644
--- a/WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp
+++ b/WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp
@@ -36,6 +36,7 @@
#if PLATFORM(WIN)
#include <fcntl.h>
#include <io.h>
+#include <wtf/MathExtras.h>
#endif
#if PLATFORM(MAC)
@@ -54,6 +55,10 @@ typedef float CGFloat;
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
@@ -72,85 +77,99 @@ static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining)
return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateWithPNGDataProvider(dataProvider.get(), 0, false, kCGRenderingIntentDefault));
}
-static RetainPtr<CGContextRef> getDifferenceBitmap(CGImageRef testBitmap, CGImageRef referenceBitmap)
+static void releaseMallocBuffer(void* info, const void* data, size_t size)
{
- // we must have both images to take diff
- if (!testBitmap || !referenceBitmap)
- return 0;
-
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- unsigned char* data = new unsigned char[CGImageGetHeight(testBitmap) * CGImageGetBytesPerRow(testBitmap)];
- RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(data, CGImageGetWidth(testBitmap), CGImageGetHeight(testBitmap),
- CGImageGetBitsPerComponent(testBitmap), CGImageGetBytesPerRow(testBitmap), colorSpace.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
-
- CGContextSetBlendMode(context.get(), kCGBlendModeNormal);
- CGContextDrawImage(context.get(), CGRectMake(0, 0, static_cast<CGFloat>(CGImageGetWidth(testBitmap)), static_cast<CGFloat>(CGImageGetHeight(testBitmap))), testBitmap);
- CGContextSetBlendMode(context.get(), kCGBlendModeDifference);
- CGContextDrawImage(context.get(), CGRectMake(0, 0, static_cast<CGFloat>(CGImageGetWidth(referenceBitmap)), static_cast<CGFloat>(CGImageGetHeight(referenceBitmap))), referenceBitmap);
-
- return context;
+ free((void*)data);
}
-/**
- * Counts the number of non-black pixels, and returns the percentage
- * of non-black pixels to total pixels in the image.
- */
-static float computePercentageDifferent(CGContextRef diffBitmap, unsigned threshold)
+static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImageRef testImage, float& difference)
{
- // if diffBiatmap is nil, then there was an error, and it didn't match.
- if (!diffBitmap)
- return 100.0f;
-
- size_t pixelsHigh = CGBitmapContextGetHeight(diffBitmap);
- size_t pixelsWide = CGBitmapContextGetWidth(diffBitmap);
- size_t bytesPerRow = CGBitmapContextGetBytesPerRow(diffBitmap);
- unsigned char* pixelRowData = static_cast<unsigned char*>(CGBitmapContextGetData(diffBitmap));
- unsigned differences = 0;
-
- // NOTE: This may not be safe when switching between ENDIAN types
- for (unsigned row = 0; row < pixelsHigh; row++) {
- for (unsigned col = 0; col < (pixelsWide * 4); col += 4) {
- unsigned char* red = pixelRowData + col;
- unsigned char* green = red + 1;
- unsigned char* blue = red + 2;
- unsigned distance = *red + *green + *blue;
- if (distance > threshold) {
- differences++;
- // shift the pixels towards white to make them more visible
- *red = static_cast<unsigned char>(min(UCHAR_MAX, *red + 100));
- *green = static_cast<unsigned char>(min(UCHAR_MAX, *green + 100));
- *blue = static_cast<unsigned char>(min(UCHAR_MAX, *blue + 100));
+ static RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGImageRef> diffImage;
+
+ 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);
+ CGContextRef baseContext = CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+ CGContextDrawImage(baseContext, CGRectMake(0, 0, width, height), baseImage);
+ CGContextRelease(baseContext);
+
+ // Draw test image in bitmap context
+ void* buffer = calloc(height, rowBytes);
+ CGContextRef context = CGBitmapContextCreate(buffer, width, height, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
+ CGContextDrawImage(context, CGRectMake(0, 0, width, height), testImage);
+ CGContextRelease(context);
+
+ // 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;
}
- pixelRowData += bytesPerRow;
}
-
- float totalPixels = static_cast<float>(pixelsHigh * pixelsWide);
- return (differences * 100.f) / totalPixels;
+
+ // 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;
+
+ // 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;
+ }
+
+ CGDataProviderRef provider = CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer);
+ CGColorSpaceRef diffColorspace = CGColorSpaceCreateDeviceGray();
+ diffImage.adoptCF(CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider, 0, false, kCGRenderingIntentDefault));
+ CGColorSpaceRelease(diffColorspace);
+ CGDataProviderRelease(provider);
+ }
+ else
+ free(diffBuffer);
+
+ // Destroy drawing buffers
+ if (buffer)
+ free(buffer);
+ if (baseBuffer)
+ free(baseBuffer);
+
+ return diffImage;
}
-static void compareImages(CGImageRef actualBitmap, CGImageRef baselineBitmap, unsigned threshold)
+static inline bool imageHasAlpha(CGImageRef image)
{
- // prepare the difference blend to check for pixel variations
- RetainPtr<CGContextRef> diffBitmap = getDifferenceBitmap(actualBitmap, baselineBitmap);
-
- float percentage = computePercentageDifferent(diffBitmap.get(), threshold);
-
- percentage = (float)((int)(percentage * 100.0f)) / 100.0f; // round to 2 decimal places
-
- // send message to let them know if an image was wrong
- if (percentage > 0.0f) {
- // since the diff might actually show something, send it to stdout
- RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(diffBitmap.get()));
- RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0));
- RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
- CGImageDestinationAddImage(imageDest.get(), image.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", percentage);
- } else
- fprintf(stdout, "diff: %01.2f%% passed\n", percentage);
+ CGImageAlphaInfo info = CGImageGetAlphaInfo(image);
+
+ return (info >= kCGImageAlphaPremultipliedLast) && (info <= kCGImageAlphaFirst);
}
int main(int argc, const char* argv[])
@@ -160,13 +179,13 @@ int main(int argc, const char* argv[])
_setmode(1, _O_BINARY);
#endif
- unsigned threshold = 0;
+ float tolerance = 0.0f;
for (int i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--threshold")) {
+ if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--tolerance")) {
if (i >= argc - 1)
exit(1);
- threshold = strtol(argv[i + 1], 0, 0);
+ tolerance = strtof(argv[i + 1], 0);
++i;
continue;
}
@@ -182,7 +201,7 @@ int main(int argc, const char* argv[])
if (newLineCharacter)
*newLineCharacter = '\0';
- if (!strncmp("Content-length: ", buffer, 16)) {
+ if (!strncmp("Content-Length: ", buffer, 16)) {
strtok(buffer, " ");
int imageSize = strtol(strtok(0, " "), 0, 10);
@@ -195,7 +214,34 @@ int main(int argc, const char* argv[])
}
if (actualImage && baselineImage) {
- compareImages(actualImage.get(), baselineImage.get(), threshold);
+ 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
+ fputs("error, test and reference image have different properties.\n", stderr);
+
+ 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;
}
diff --git a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp
index e2e790c..2320e19 100644
--- a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp
+++ b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp
@@ -28,12 +28,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "PixelDumpSupportCG.h"
+#include "DumpRenderTree.h"
#include "LayoutTestController.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>
@@ -55,72 +59,76 @@ static void printPNG(CGImageRef image)
RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
CGImageDestinationAddImage(imageDest.get(), image, 0);
CGImageDestinationFinalize(imageDest.get());
- printf("Content-length: %lu\n", CFDataGetLength(imageData.get()));
+
+ printf("Content-Type: %s\n", "image/png");
+ printf("Content-Length: %lu\n", CFDataGetLength(imageData.get()));
+
fwrite(CFDataGetBytePtr(imageData.get()), 1, CFDataGetLength(imageData.get()), stdout);
}
-static void getMD5HashStringForBitmap(CGContextRef bitmap, char string[33])
+static void computeMD5HashStringForBitmapContext(CGContextRef bitmapContext, char hashString[33])
{
- MD5_CTX md5Context;
- unsigned char hash[16];
-
- size_t bitsPerPixel = CGBitmapContextGetBitsPerPixel(bitmap);
- ASSERT(bitsPerPixel == 32); // ImageDiff assumes 32 bit RGBA, we must as well.
- size_t bytesPerPixel = bitsPerPixel / 8;
- size_t pixelsHigh = CGBitmapContextGetHeight(bitmap);
- size_t pixelsWide = CGBitmapContextGetWidth(bitmap);
- size_t bytesPerRow = CGBitmapContextGetBytesPerRow(bitmap);
- ASSERT(bytesPerRow >= (pixelsWide * bytesPerPixel));
+ 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(bitmap));
- for (unsigned row = 0; row < pixelsHigh; row++) {
- MD5_Update(&md5Context, bitmapData, static_cast<unsigned>(pixelsWide * bytesPerPixel));
- bitmapData += bytesPerRow;
+ 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);
- string[0] = '\0';
+ hashString[0] = '\0';
for (int i = 0; i < 16; i++)
- snprintf(string, 33, "%s%02x", string, hash[i]);
+ snprintf(hashString, 33, "%s%02x", hashString, hash[i]);
}
-void drawSelectionRect(CGContextRef context, const CGRect& rect)
+void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash)
{
- CGContextSaveGState(context);
- CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);
- CGContextStrokeRect(context, rect);
- CGContextRestoreGState(context);
-}
-
-void dumpWebViewAsPixelsAndCompareWithExpected(const char* /*currentTest*/, bool /*forceAllTestsToDumpPixels*/)
-{
- RetainPtr<CGContextRef> context = getBitmapContextFromWebView();
-
+ RefPtr<BitmapContext> context;
+
#if PLATFORM(MAC)
- if (layoutTestController->testRepaint())
- repaintWebView(context.get(), layoutTestController->testRepaintSweepHorizontally());
- else
- paintWebView(context.get());
-
- if (layoutTestController->dumpSelectionRect())
- drawSelectionRect(context.get(), getSelectionRect());
+ context = createBitmapContextFromWebView(gLayoutTestController->testOnscreen(), gLayoutTestController->testRepaint(), gLayoutTestController->testRepaintSweepHorizontally(), gLayoutTestController->dumpSelectionRect());
#endif
-
- // Compute the actual hash to compare to the expected image's hash.
+ ASSERT(context);
+
+ // Compute the hash of the bitmap context pixels
char actualHash[33];
- getMD5HashStringForBitmap(context.get(), actualHash);
+ computeMD5HashStringForBitmapContext(context->cgContext(), actualHash);
printf("\nActualHash: %s\n", actualHash);
-
- // FIXME: We should compare the actualHash to the expected hash here and
- // only set dumpImage to true if they don't match, but DRT doesn't have
- // enough information currently to find the expected checksum file.
+
+ // Check the computed hash against the expected one and dump image on mismatch
bool dumpImage = true;
-
+ if (expectedHash.length() > 0) {
+ ASSERT(expectedHash.length() == 32);
+
+ printf("\nExpectedHash: %s\n", expectedHash.c_str());
+
+ if (expectedHash == actualHash) // FIXME: do case insensitive compare
+ dumpImage = false;
+ }
+
if (dumpImage) {
- RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(context.get()));
+ RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(context->cgContext()));
printPNG(image.get());
}
-
- printf("#EOF\n");
}
diff --git a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h
index 0abdea6..84350e8 100644
--- a/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h
+++ b/WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h
@@ -31,25 +31,50 @@
#ifndef PixelDumpSupportCG_h
#define PixelDumpSupportCG_h
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
-#ifndef CGFLOAT_DEFINED
-#ifdef __LP64__
-typedef double CGFloat;
-#else
-typedef float CGFloat;
+typedef struct CGContext* CGContextRef;
+
+#if PLATFORM(MAC)
+typedef void* PlatformBitmapBuffer;
+#elif PLATFORM(WIN)
+typedef HBITMAP PlatformBitmapBuffer;
#endif
-#define CGFLOAT_DEFINED 1
+
+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
+ }
-typedef struct CGContext* CGContextRef;
-struct CGRect;
+ 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;
-RetainPtr<CGContextRef> getBitmapContextFromWebView();
-CGRect getSelectionRect();
+};
-void paintWebView(CGContextRef);
-void repaintWebView(CGContextRef context, bool horizontal);
-void drawSelectionRect(CGContextRef, const CGRect&);
+PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect);
#endif // PixelDumpSupportCG_h
diff --git a/WebKitTools/DumpRenderTree/config.h b/WebKitTools/DumpRenderTree/config.h
new file mode 100644
index 0000000..4775ae2
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/config.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ *
+ * 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.
+ *
+ */
+
+#define Config_H
+
+#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
+#include "autotoolsconfig.h"
+#endif
+
+#include <wtf/Platform.h>
+
+#if PLATFORM(WIN)
+#define WTF_PLATFORM_CF 1
+
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+
+#undef WINVER
+#define WINVER 0x0500
+
+// 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
+
+#undef _WINSOCKAPI_
+#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
+#endif // PLATFORM(WIN)
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf
new file mode 100644
index 0000000..22b00de
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf
new file mode 100644
index 0000000..1ccadba
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf
new file mode 100644
index 0000000..ab5563d
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf
new file mode 100644
index 0000000..56d279e
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf
new file mode 100644
index 0000000..d827d7d
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf
new file mode 100644
index 0000000..9141596
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf
new file mode 100644
index 0000000..a2d0505
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf
new file mode 100644
index 0000000..d0f354b
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf
new file mode 100644
index 0000000..6b895ca
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index 271da15..13b914d 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Alp Toker <alp@nuanti.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,18 +27,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+#include "DumpRenderTree.h"
+
#include "LayoutTestController.h"
#include "WorkQueue.h"
#include "WorkQueueItem.h"
#include <gtk/gtk.h>
#include <webkit/webkit.h>
-
-#include <JavaScriptCore/JSBase.h>
-#include <JavaScriptCore/JSContextRef.h>
-#include <JavaScriptCore/JSObjectRef.h>
-#include <JavaScriptCore/JSStringRef.h>
-#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/JavaScript.h>
#include <wtf/Assertions.h>
@@ -46,21 +45,21 @@
#include <stdlib.h>
#include <string.h>
+using namespace std;
+
extern "C" {
// This API is not yet public.
extern GSList* webkit_web_frame_get_children(WebKitWebFrame* frame);
extern gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame);
+extern gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame);
}
volatile bool done;
static bool printSeparators;
-static int testRepaintDefault;
-static int repaintSweepHorizontallyDefault;
static int dumpPixels;
static int dumpTree = 1;
-static gchar* currentTest;
-LayoutTestController* layoutTestController = 0;
+LayoutTestController* gLayoutTestController = 0;
static WebKitWebView* webView;
WebKitWebFrame* mainFrame = 0;
WebKitWebFrame* topLoadingFrame = 0;
@@ -109,34 +108,25 @@ static gchar* dumpFramesAsText(WebKitWebFrame* frame)
// Add header for all but the main frame.
bool isMainFrame = (webkit_web_view_get_main_frame(webView) == frame);
- if (isMainFrame) {
- gchar* innerText = webkit_web_frame_get_inner_text(frame);
+ gchar* innerText = webkit_web_frame_get_inner_text(frame);
+ if (isMainFrame)
result = g_strdup_printf("%s\n", innerText);
- g_free(innerText);
- } else {
+ else {
const gchar* frameName = webkit_web_frame_get_name(frame);
- gchar* innerText = webkit_web_frame_get_inner_text(frame);
-
result = g_strdup_printf("\n--------\nFrame: '%s'\n--------\n%s\n", frameName, innerText);
-
- g_free(innerText);
}
+ g_free(innerText);
- if (layoutTestController->dumpChildFramesAsText()) {
+ if (gLayoutTestController->dumpChildFramesAsText()) {
GSList* children = webkit_web_frame_get_children(frame);
- for (;children; children = g_slist_next(children))
+ for (GSList* child = children; child; child = g_slist_next(child))
appendString(result, dumpFramesAsText((WebKitWebFrame*)children->data));
+ g_slist_free(children);
}
return result;
}
-static gchar* dumpRenderTreeAsText(WebKitWebFrame* frame)
-{
- // FIXME: this will require new WebKitGtk SPI
- return strdup("foo");
-}
-
static void invalidateAnyPreviousWaitToDumpWatchdog()
{
if (waitToDumpWatchdog) {
@@ -151,27 +141,28 @@ void dump()
if (dumpTree) {
char* result = 0;
- bool dumpAsText = layoutTestController->dumpAsText();
+ bool dumpAsText = gLayoutTestController->dumpAsText();
// FIXME: Also dump text resuls as text.
- layoutTestController->setDumpAsText(dumpAsText);
- if (layoutTestController->dumpAsText())
+ gLayoutTestController->setDumpAsText(dumpAsText);
+ if (gLayoutTestController->dumpAsText())
result = dumpFramesAsText(mainFrame);
else {
- bool isSVGW3CTest = (g_strrstr(currentTest, "svg/W3C-SVG-1.1"));
- if (isSVGW3CTest)
- gtk_widget_set_size_request(GTK_WIDGET(webView), 480, 360);
- else
- gtk_widget_set_size_request(GTK_WIDGET(webView), maxViewWidth, maxViewHeight);
- result = dumpRenderTreeAsText(mainFrame);
+ bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos);
+ GtkAllocation size;
+ size.width = isSVGW3CTest ? 480 : maxViewWidth;
+ size.height = isSVGW3CTest ? 360 : maxViewHeight;
+ gtk_widget_size_allocate(GTK_WIDGET(webView), &size);
+
+ result = webkit_web_frame_dump_render_tree(mainFrame);
}
if (!result) {
const char* errorMessage;
- if (layoutTestController->dumpAsText())
+ if (gLayoutTestController->dumpAsText())
errorMessage = "[documentElement innerText]";
- else if (layoutTestController->dumpDOMAsWebArchive())
+ else if (gLayoutTestController->dumpDOMAsWebArchive())
errorMessage = "[[mainFrame DOMDocument] webArchive]";
- else if (layoutTestController->dumpSourceAsWebArchive())
+ else if (gLayoutTestController->dumpSourceAsWebArchive())
errorMessage = "[[mainFrame dataSource] webArchive]";
else
errorMessage = "[mainFrame renderTreeAsExternalRepresentation]";
@@ -179,59 +170,93 @@ void dump()
} else {
printf("%s", result);
g_free(result);
- if (!layoutTestController->dumpAsText() && !layoutTestController->dumpDOMAsWebArchive() && !layoutTestController->dumpSourceAsWebArchive())
+ if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive())
dumpFrameScrollPosition(mainFrame);
}
- if (layoutTestController->dumpBackForwardList()) {
+ if (gLayoutTestController->dumpBackForwardList()) {
// FIXME: not implemented
}
- if (printSeparators)
- puts("#EOF");
+ if (printSeparators) {
+ puts("#EOF"); // terminate the content block
+ fputs("#EOF\n", stderr);
+ fflush(stdout);
+ fflush(stderr);
+ }
}
if (dumpPixels) {
- if (!layoutTestController->dumpAsText() && !layoutTestController->dumpDOMAsWebArchive() && !layoutTestController->dumpSourceAsWebArchive()) {
+ if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive()) {
// FIXME: Add support for dumping pixels
}
}
- fflush(stdout);
-
// FIXME: call displayWebView here when we support --paint
+ puts("#EOF"); // terminate the (possibly empty) pixels block
+
+ fflush(stdout);
+ fflush(stderr);
+
done = true;
}
-static void runTest(const char* pathOrURL)
+static void setDefaultsToConsistentStateValuesForTesting()
+{
+ WebKitWebSettings *settings = webkit_web_view_get_settings(webView);
+
+ g_object_set(G_OBJECT(settings),
+ "default-font-family", "Times",
+ "monospace-font-family", "Courier",
+ "serif-font-family", "Times",
+ "sans-serif-font-family", "Helvetica",
+ "default-font-size", 16,
+ "default-monospace-font-size", 13,
+ "minimum-font-size", 1,
+ NULL);
+}
+
+static void runTest(const string& testPathOrURL)
{
- gchar* url = autocorrectURL(pathOrURL);
+ ASSERT(!testPathOrURL.empty());
- layoutTestController = new LayoutTestController(testRepaintDefault, repaintSweepHorizontallyDefault);
+ // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
+ string pathOrURL(testPathOrURL);
+ string expectedPixelHash;
- done = false;
- topLoadingFrame = 0;
+ size_t separatorPos = pathOrURL.find("'");
+ if (separatorPos != string::npos) {
+ pathOrURL = string(testPathOrURL, 0, separatorPos);
+ expectedPixelHash = string(testPathOrURL, separatorPos + 1);
+ }
- if (shouldLogFrameLoadDelegates(pathOrURL))
- layoutTestController->setDumpFrameLoadCallbacks(true);
+ gchar* url = autocorrectURL(pathOrURL.c_str());
+ const string testURL(url);
- if (currentTest)
- g_free(currentTest);
- currentTest = url;
+ gLayoutTestController = new LayoutTestController(testURL, expectedPixelHash);
+ topLoadingFrame = 0;
+ done = false;
+
+ if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
+ gLayoutTestController->setDumpFrameLoadCallbacks(true);
WorkQueue::shared()->clear();
WorkQueue::shared()->setFrozen(false);
webkit_web_view_open(webView, url);
+ g_free(url);
+ url = NULL;
+
while (!done)
- g_main_context_iteration(NULL, true);
+ g_main_context_iteration(NULL, TRUE);
- WorkQueue::shared()->clear();
+ // A blank load seems to be necessary to reset state after certain tests.
+ webkit_web_view_open(webView, "about:blank");
- delete layoutTestController;
- layoutTestController = 0;
+ gLayoutTestController->deref();
+ gLayoutTestController = 0;
}
void webViewLoadStarted(WebKitWebView* view, WebKitWebFrame* frame, void*)
@@ -253,20 +278,20 @@ static gboolean processWork(void* data)
}
// if we didn't start a new load, then we finished all the commands, so we're ready to dump state
- if (!topLoadingFrame && !layoutTestController->waitToDump())
+ if (!topLoadingFrame && !gLayoutTestController->waitToDump())
dump();
return FALSE;
}
-void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
+static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
{
if (frame != topLoadingFrame)
return;
topLoadingFrame = 0;
WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
- if (layoutTestController->waitToDump())
+ if (gLayoutTestController->waitToDump())
return;
if (WorkQueue::shared()->count())
@@ -275,49 +300,56 @@ void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
dump();
}
-void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef globalObject)
+static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef windowObject, gpointer data)
{
JSValueRef exception = 0;
- assert(layoutTestController);
- layoutTestController->makeWindowObject(context, globalObject, &exception);
+ assert(gLayoutTestController);
+
+ gLayoutTestController->makeWindowObject(context, windowObject, &exception);
assert(!exception);
}
-gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId)
+static gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId, gpointer data)
{
fprintf(stdout, "CONSOLE MESSAGE: line %d: %s\n", line, message);
return TRUE;
}
-gboolean webViewScriptAlert(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message)
+static gboolean webViewScriptAlert(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gpointer data)
{
fprintf(stdout, "ALERT: %s\n", message);
return TRUE;
}
-gboolean webViewScriptPrompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value)
+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;
}
-gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm)
+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 (gLayoutTestController->dumpTitleChanges() && !done)
+ printf("TITLE CHANGED: %s\n", title ? title : "");
+}
int main(int argc, char* argv[])
{
+ g_thread_init(NULL);
+ gtk_init(&argc, &argv);
+
struct option options[] = {
- {"horizontal-sweep", no_argument, &repaintSweepHorizontallyDefault, true},
{"notree", no_argument, &dumpTree, false},
{"pixel-tests", no_argument, &dumpPixels, true},
- {"repaint", no_argument, &testRepaintDefault, true},
{"tree", no_argument, &dumpTree, true},
{NULL, 0, NULL, 0}
};
@@ -331,8 +363,6 @@ int main(int argc, char* argv[])
break;
}
- gtk_init(&argc, &argv);
-
GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP);
GtkContainer* container = GTK_CONTAINER(gtk_fixed_new());
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(container));
@@ -350,6 +380,9 @@ int main(int argc, char* argv[])
g_signal_connect(G_OBJECT(webView), "script-alert", G_CALLBACK(webViewScriptAlert), 0);
g_signal_connect(G_OBJECT(webView), "script-prompt", G_CALLBACK(webViewScriptPrompt), 0);
g_signal_connect(G_OBJECT(webView), "script-confirm", G_CALLBACK(webViewScriptConfirm), 0);
+ g_signal_connect(G_OBJECT(webView), "title-changed", G_CALLBACK(webViewTitleChanged), 0);
+
+ setDefaultsToConsistentStateValuesForTesting();
if (argc == optind+1 && strcmp(argv[optind], "-") == 0) {
char filenameBuffer[2048];
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.pro
deleted file mode 100644
index 51fdd65..0000000
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-SOURCES += DumpRenderTree.cpp \
- ../LayoutTestController.cpp \
- ../GCController.cpp \
- ../WorkQueue.cpp \
- GCControllerGtk.cpp \
- LayoutTestControllerGtk.cpp \
- WorkQueueItemGtk.cpp
-
-CONFIG -= app_bundle
-
-BASE_DIR = $$PWD/../../..
-
-include(../../../WebKit.pri)
-
-INCLUDEPATH += \
- $$BASE_DIR/WebKitTools/DumpRenderTree
-
-QMAKE_RPATHDIR += $$OUTPUT_DIR/lib
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h b/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h
index 7be651a..1d2f179 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h
@@ -30,9 +30,12 @@
#define DumpRenderTreeGtk_h
#include <webkit/webkitdefines.h>
+#include <JavaScriptCore/JSBase.h>
extern WebKitWebFrame* mainFrame;
extern WebKitWebFrame* topLoadingFrame;
extern guint waitToDumpWatchdog;
+gchar* JSStringCopyUTF8CString(JSStringRef jsString);
+
#endif // DumpRenderTreeGtk_h
diff --git a/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp
index b3e6ad3..35f1685 100644
--- a/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "GCController.h"
void GCController::collect() const
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index fead119..3a01e60 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Nuanti Ltd.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,6 +28,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "LayoutTestController.h"
#include "DumpRenderTree.h"
@@ -36,6 +38,7 @@
#include <JavaScriptCore/JSStringRef.h>
#include <glib.h>
+#include <webkit/webkit.h>
LayoutTestController::~LayoutTestController()
{
@@ -49,7 +52,20 @@ void LayoutTestController::addDisallowedURL(JSStringRef url)
void LayoutTestController::clearBackForwardList()
{
- // FIXME: implement
+ 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);
+ // FIXME: implement add_item()
+ //webkit_web_back_forward_list_add_item(list, item);
+ webkit_web_back_forward_list_go_to_item(list, item);
+ g_object_unref(item);
}
JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name)
@@ -84,7 +100,7 @@ void LayoutTestController::notifyDone()
JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
{
// Function introduced in r28690. This may need special-casing on Windows.
- return url; // Do nothing on Unix.
+ return JSStringRetain(url); // Do nothing on Unix.
}
void LayoutTestController::queueBackNavigation(int howFarBack)
@@ -113,9 +129,10 @@ void LayoutTestController::queueScript(JSStringRef script)
WorkQueue::shared()->queue(new ScriptItem(script));
}
-void LayoutTestController::setAcceptsEditing(bool newAcceptsEditing)
+void LayoutTestController::setAcceptsEditing(bool acceptsEditing)
{
- // FIXME: implement
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ webkit_web_view_set_editable(webView, acceptsEditing);
}
void LayoutTestController::setCustomPolicyDelegate(bool setDelegate)
@@ -138,14 +155,27 @@ void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
// FIXME: implement
}
+static gchar* userStyleSheet = NULL;
+static gboolean userStyleSheetEnabled = TRUE;
+
void LayoutTestController::setUserStyleSheetEnabled(bool flag)
{
- // FIXME: implement
+ 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 LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
{
- // FIXME: implement
+ g_free(userStyleSheet);
+ userStyleSheet = JSStringCopyUTF8CString(path);
+ if (userStyleSheetEnabled)
+ setUserStyleSheetEnabled(true);
}
void LayoutTestController::setWindowIsKey(bool windowIsKey)
@@ -153,11 +183,17 @@ void LayoutTestController::setWindowIsKey(bool windowIsKey)
// FIXME: implement
}
+void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
+{
+ // FIXME: implement
+}
+
static gboolean waitToDumpWatchdogFired(void*)
{
const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
fprintf(stderr, "%s", message);
fprintf(stdout, "%s", message);
+ waitToDumpWatchdog = 0;
dump();
return FALSE;
}
@@ -178,7 +214,7 @@ void LayoutTestController::setWaitToDump(bool waitUntilDone)
int LayoutTestController::windowCount()
{
// FIXME: implement
- return 0;
+ return 1;
}
void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
@@ -191,11 +227,22 @@ void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
// FIXME: implement
}
+void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
{
// FIXME: implement
}
+bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
+{
+ // FIXME: implement
+ return false;
+}
+
void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
{
// FIXME: implement
@@ -210,3 +257,14 @@ void LayoutTestController::clearPersistentUserStyleSheet()
{
// FIXME: implement
}
+
+void LayoutTestController::clearAllDatabases()
+{
+ // FIXME: implement
+}
+
+void LayoutTestController::setDatabaseQuota(unsigned long long quota)
+{
+ // FIXME: implement
+}
+
diff --git a/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp b/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
index ee77683..5526667 100644
--- a/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
@@ -17,14 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include "WorkQueueItem.h"
+
#include "DumpRenderTree.h"
#include <JavaScriptCore/JSStringRef.h>
#include <webkit/webkit.h>
+#include <string.h>
// Returns a newly allocated UTF-8 character buffer which must be freed with g_free()
-static gchar* JSStringCopyUTF8CString(JSStringRef jsString)
+gchar* JSStringCopyUTF8CString(JSStringRef jsString)
{
size_t dataSize = JSStringGetMaximumUTF8CStringSize(jsString);
gchar* utf8 = (gchar*)g_malloc(dataSize);
@@ -60,7 +63,6 @@ void ScriptItem::invoke() const
{
WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
gchar* scriptString = JSStringCopyUTF8CString(script());
- // TODO: does this return something we need to free? If not, why not?
webkit_web_view_execute_script(webView, scriptString);
g_free(scriptString);
}
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
new file mode 100644
index 0000000..482c4f3
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
@@ -0,0 +1,54 @@
+/*
+ * 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 "DumpRenderTree.h"
+#import "AccessibilityController.h"
+
+#import "AccessibilityUIElement.h"
+#import <Foundation/Foundation.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebHTMLView.h>
+
+AccessibilityController::AccessibilityController()
+{
+}
+
+AccessibilityController::~AccessibilityController()
+{
+}
+
+AccessibilityUIElement AccessibilityController::focusedElement()
+{
+ // FIXME: we could do some caching here.
+ id accessibilityObject = [[[mainFrame frameView] documentView] accessibilityFocusedUIElement];
+ return AccessibilityUIElement(accessibilityObject);
+}
+
+AccessibilityUIElement AccessibilityController::rootElement()
+{
+ // FIXME: we could do some caching here.
+ id accessibilityObject = [[mainFrame frameView] documentView];
+ return AccessibilityUIElement(accessibilityObject);
+}
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
new file mode 100644
index 0000000..81edd99
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
@@ -0,0 +1,425 @@
+/*
+ * 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 "DumpRenderTree.h"
+#import "AccessibilityUIElement.h"
+
+#import <Foundation/Foundation.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>
+
+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 NSString (JSStringRefAdditions)
+- (JSStringRef)createJSStringRef;
+@end
+
+@implementation NSString (JSStringRefAdditions)
+
+- (JSStringRef)createJSStringRef
+{
+ return JSStringCreateWithCFString((CFStringRef)self);
+}
+
+@end
+
+static NSString* descriptionOfValue(id valueObject, id focusedAccessibilityObject)
+{
+ if (!valueObject)
+ return NULL;
+
+ if ([valueObject isKindOfClass:[NSArray class]])
+ return [NSString stringWithFormat:@"<array of size %d>", [(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:@"AXRole"];
+ NSString* title = [focusedAccessibilityObject accessibilityAttributeValue:@"AXTitle"];
+ 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;
+
+ id valueObject = [accessibilityObject accessibilityAttributeValue:attribute];
+ NSString* value = descriptionOfValue(valueObject, accessibilityObject);
+ [attributesString appendFormat:@"%@: %@\n", attribute, value];
+ }
+
+ 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.append(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)
+{
+ NSArray* linkedElements = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute];
+ convertNSArrayToVector(linkedElements, elementVector);
+}
+
+void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>& elementVector)
+{
+ NSArray* linkElements = [m_element accessibilityAttributeValue:@"AXLinkUIElements"];
+ convertNSArrayToVector(linkElements, elementVector);
+}
+
+void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& elementVector)
+{
+ NSArray* children = [m_element accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
+ convertNSArrayToVector(children, elementVector);
+}
+
+AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
+{
+ Vector<AccessibilityUIElement> children;
+ getChildren(children);
+
+ if (index < children.size())
+ return children[index];
+ return nil;
+}
+
+AccessibilityUIElement AccessibilityUIElement::titleUIElement()
+{
+ id accessibilityObject = [m_element accessibilityAttributeValue:NSAccessibilityTitleUIElementAttribute];
+ if (accessibilityObject)
+ return AccessibilityUIElement(accessibilityObject);
+
+ return nil;
+}
+
+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::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()
+{
+ NSString* role = descriptionOfValue([m_element accessibilityAttributeValue:@"AXRole"], m_element);
+ return concatenateAttributeAndValue(@"AXRole", role);
+}
+
+JSStringRef AccessibilityUIElement::title()
+{
+ NSString* title = descriptionOfValue([m_element accessibilityAttributeValue:@"AXTitle"], m_element);
+ return concatenateAttributeAndValue(@"AXTitle", title);
+}
+
+JSStringRef AccessibilityUIElement::description()
+{
+ id description = descriptionOfValue([m_element accessibilityAttributeValue:@"AXDescription"], m_element);
+ return concatenateAttributeAndValue(@"AXDescription", description);
+}
+
+double AccessibilityUIElement::width()
+{
+ NSValue* sizeValue = [m_element accessibilityAttributeValue:@"AXSize"];
+ return static_cast<double>([sizeValue sizeValue].width);
+}
+
+double AccessibilityUIElement::height()
+{
+ NSValue* sizeValue = [m_element accessibilityAttributeValue:@"AXSize"];
+ return static_cast<double>([sizeValue sizeValue].height);
+}
+
+double AccessibilityUIElement::intValue()
+{
+ id value = [m_element accessibilityAttributeValue:@"AXValue"];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [(NSNumber*)value doubleValue];
+ return 0.0f;
+}
+
+double AccessibilityUIElement::minValue()
+{
+ id value = [m_element accessibilityAttributeValue:@"AXMinValue"];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [(NSNumber*)value doubleValue];
+ return 0.0f;
+}
+
+double AccessibilityUIElement::maxValue()
+{
+ id value = [m_element accessibilityAttributeValue:@"AXMaxValue"];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [(NSNumber*)value doubleValue];
+ return 0.0;
+}
+
+int AccessibilityUIElement::insertionPointLineNumber()
+{
+ id value = [m_element accessibilityAttributeValue:@"AXInsertionPointLineNumber"];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [(NSNumber *)value intValue];
+ return -1;
+}
+
+bool AccessibilityUIElement::supportsPressAction()
+{
+ NSArray* actions = [m_element accessibilityActionNames];
+ return [actions containsObject:@"AXPress"];
+}
+
+// parameterized attributes
+int AccessibilityUIElement::lineForIndex(int index)
+{
+ id value = [m_element accessibilityAttributeValue:@"AXLineForIndex" forParameter:[NSNumber numberWithInt:index]];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [(NSNumber *)value intValue];
+ return -1;
+}
+
+JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
+{
+ NSRange range = NSMakeRange(location, length);
+ 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];
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
+{
+ // not yet defined in AppKit... odd
+ NSArray* columnHeadersArray = [m_element accessibilityAttributeValue:@"AXColumnHeaderUIElements"];
+ Vector<AccessibilityUIElement> columnHeadersVector;
+ convertNSArrayToVector(columnHeadersArray, columnHeadersVector);
+ return descriptionOfElements(columnHeadersVector);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
+{
+ NSArray* rowHeadersArray = [m_element accessibilityAttributeValue:@"AXRowHeaderUIElements"];
+ Vector<AccessibilityUIElement> rowHeadersVector;
+ convertNSArrayToVector(rowHeadersArray, rowHeadersVector);
+ return descriptionOfElements(rowHeadersVector);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumns()
+{
+ NSArray* columnsArray = [m_element accessibilityAttributeValue:NSAccessibilityColumnsAttribute];
+ Vector<AccessibilityUIElement> columnsVector;
+ convertNSArrayToVector(columnsArray, columnsVector);
+ return descriptionOfElements(columnsVector);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRows()
+{
+ NSArray* rowsArray = [m_element accessibilityAttributeValue:NSAccessibilityRowsAttribute];
+ Vector<AccessibilityUIElement> rowsVector;
+ convertNSArrayToVector(rowsArray, rowsVector);
+ return descriptionOfElements(rowsVector);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
+{
+ NSArray* cellsArray = [m_element accessibilityAttributeValue:@"AXVisibleCells"];
+ Vector<AccessibilityUIElement> cellsVector;
+ convertNSArrayToVector(cellsArray, cellsVector);
+ return descriptionOfElements(cellsVector);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfHeader()
+{
+ id headerObject = [m_element accessibilityAttributeValue:NSAccessibilityHeaderAttribute];
+ if (!headerObject)
+ return [@"" createJSStringRef];
+
+ Vector<AccessibilityUIElement> headerVector;
+ headerVector.append(headerObject);
+ return descriptionOfElements(headerVector);
+}
+
+int AccessibilityUIElement::indexInTable()
+{
+ NSNumber* indexNumber = [m_element accessibilityAttributeValue:NSAccessibilityIndexAttribute];
+ if (!indexNumber)
+ return -1;
+ return [indexNumber intValue];
+}
+
+JSStringRef AccessibilityUIElement::rowIndexRange()
+{
+ NSValue* indexRange = [m_element accessibilityAttributeValue:@"AXRowIndexRange"];
+ NSRange range = indexRange ? [indexRange rangeValue] : NSMakeRange(0,0);
+ NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%d, %d}",range.location, range.length];
+ return [rangeDescription createJSStringRef];
+}
+
+JSStringRef AccessibilityUIElement::columnIndexRange()
+{
+ NSNumber* indexRange = [m_element accessibilityAttributeValue:@"AXColumnIndexRange"];
+ NSRange range = indexRange ? [indexRange rangeValue] : NSMakeRange(0,0);
+ NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%d, %d}",range.location, range.length];
+ return [rangeDescription createJSStringRef];
+}
+
+AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned col, unsigned row)
+{
+ NSArray *colRowArray = [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:col], [NSNumber numberWithUnsignedInt:row], nil];
+ return [m_element accessibilityAttributeValue:@"AXCellForColumnAndRow" forParameter:colRowArray];
+}
+
+JSStringRef AccessibilityUIElement::selectedTextRange()
+{
+ NSNumber *indexRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextRangeAttribute];
+ NSRange range = indexRange ? [indexRange rangeValue] : NSMakeRange(0,0);
+ NSMutableString *rangeDescription = [NSMutableString stringWithFormat:@"{%d, %d}",range.location, range.length];
+ return [rangeDescription createJSStringRef];
+}
+
+void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
+{
+ NSRange textRange = NSMakeRange(location, length);
+ NSValue *textRangeValue = [NSValue valueWithRange:textRange];
+ [m_element accessibilitySetValue:textRangeValue forAttribute:NSAccessibilitySelectedTextRangeAttribute];
+}
diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig
index bd5b1e0..de9d67f 100644
--- a/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig
+++ b/WebKitTools/DumpRenderTree/mac/Configurations/Base.xcconfig
@@ -3,6 +3,8 @@ FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(MAC_OS_X_VERSION_MAJOR));
FRAMEWORK_SEARCH_PATHS_ = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks
FRAMEWORK_SEARCH_PATHS_1040 = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks
FRAMEWORK_SEARCH_PATHS_1050 = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks
+FRAMEWORK_SEARCH_PATHS_1060 = $(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;
DEBUG_INFORMATION_FORMAT = dwarf
PREBINDING = NO
GCC_C_LANGUAGE_STANDARD = gnu99
@@ -12,4 +14,4 @@ GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
WARNING_CFLAGS = -Wall -W -Wno-unused-parameter
-VALID_ARCHS = ppc7400 ppc970 i386 ppc
+LINKER_DISPLAYS_MANGLED_NAMES = YES;
diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig
index e17439e..e272da2 100644
--- a/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig
+++ b/WebKitTools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig
@@ -1,4 +1,6 @@
#include "Base.xcconfig"
+ARCHS = $(NATIVE_ARCH);
+
MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(MAC_OS_X_VERSION_MAJOR))
MACOSX_DEPLOYMENT_TARGET_ = 10.4
MACOSX_DEPLOYMENT_TARGET_1040 = 10.4
diff --git a/WebKitTools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig b/WebKitTools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig
index c8a7bdc..b977225 100644
--- a/WebKitTools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig
+++ b/WebKitTools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig
@@ -1,4 +1,4 @@
-OTHER_LDFLAGS = -sectcreate __DATA Ahem qt/fonts/AHEM____.TTF
+OTHER_LDFLAGS = -sectcreate __DATA Ahem qt/fonts/AHEM____.TTF -sectcreate __DATA WeightWatcher100 fonts/WebKitWeightWatcher100.ttf -sectcreate __DATA WeightWatcher200 fonts/WebKitWeightWatcher200.ttf -sectcreate __DATA WeightWatcher300 fonts/WebKitWeightWatcher300.ttf -sectcreate __DATA WeightWatcher400 fonts/WebKitWeightWatcher400.ttf -sectcreate __DATA WeightWatcher500 fonts/WebKitWeightWatcher500.ttf -sectcreate __DATA WeightWatcher600 fonts/WebKitWeightWatcher600.ttf -sectcreate __DATA WeightWatcher700 fonts/WebKitWeightWatcher700.ttf -sectcreate __DATA WeightWatcher800 fonts/WebKitWeightWatcher800.ttf -sectcreate __DATA WeightWatcher900 fonts/WebKitWeightWatcher900.ttf
PRODUCT_NAME = DumpRenderTree
GCC_ENABLE_OBJC_EXCEPTIONS = YES
GCC_PREFIX_HEADER = DumpRenderTreePrefix.h
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 6df150d..203c6b2 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -29,6 +29,7 @@
#import "DumpRenderTree.h"
+#import "AccessibilityController.h"
#import "CheckedMalloc.h"
#import "DumpRenderTreePasteboard.h"
#import "DumpRenderTreeWindow.h"
@@ -46,34 +47,42 @@
#import "UIDelegate.h"
#import "WorkQueue.h"
#import "WorkQueueItem.h"
+#import <Carbon/Carbon.h>
#import <CoreFoundation/CoreFoundation.h>
#import <WebKit/DOMElementPrivate.h>
#import <WebKit/DOMExtensions.h>
#import <WebKit/DOMRange.h>
#import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebCache.h>
#import <WebKit/WebCoreStatistics.h>
-#import <WebKit/WebDatabaseManagerPrivate.h>
#import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDatabaseManagerPrivate.h>
#import <WebKit/WebDocumentPrivate.h>
#import <WebKit/WebEditingDelegate.h>
#import <WebKit/WebFrameView.h>
+#import <WebKit/WebHTMLRepresentationInternal.h>
#import <WebKit/WebHistory.h>
#import <WebKit/WebHistoryItemPrivate.h>
+#import <WebKit/WebInspector.h>
#import <WebKit/WebPluginDatabase.h>
#import <WebKit/WebPreferences.h>
#import <WebKit/WebPreferencesPrivate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebTypesInternal.h>
#import <WebKit/WebViewPrivate.h>
#import <getopt.h>
#import <mach-o/getsect.h>
#import <objc/objc-runtime.h>
#import <wtf/Assertions.h>
#import <wtf/RetainPtr.h>
+#import <wtf/OwnPtr.h>
+
+using namespace std;
@interface DumpRenderTreeEvent : NSEvent
@end
-static void runTest(const char *pathOrURL);
+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
@@ -84,8 +93,8 @@ static void runTest(const char *pathOrURL);
volatile bool done;
-NavigationController* navigationController = 0;
-LayoutTestController* layoutTestController = 0;
+NavigationController* gNavigationController = 0;
+LayoutTestController* gLayoutTestController = 0;
WebFrame *mainFrame = 0;
// This is the topmost frame that is loading, during a given load, or nil when no load is
@@ -106,13 +115,10 @@ static ResourceLoadDelegate *resourceLoadDelegate;
PolicyDelegate *policyDelegate;
static int dumpPixels;
-static int dumpAllPixels;
static int threaded;
-static int testRepaintDefault;
-static int repaintSweepHorizontallyDefault;
static int dumpTree = YES;
+static int forceComplexText;
static BOOL printSeparators;
-static NSString *currentTest = nil;
static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test
@@ -120,43 +126,109 @@ static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of
const unsigned maxViewHeight = 600;
const unsigned maxViewWidth = 800;
+#if __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(originalMethods[i]), method_getTypeEncoding(originalMethods[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);
+
+#if !__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(CFStringRef URLString)
+static bool shouldIgnoreWebCoreNodeLeaks(const string& URLString)
{
- static CFStringRef const ignoreSet[] = {
+ static char* const ignoreSet[] = {
// Keeping this infrastructure around in case we ever need it again.
};
- static const int ignoreSetCount = sizeof(ignoreSet) / sizeof(CFStringRef);
+ static const int ignoreSetCount = sizeof(ignoreSet) / sizeof(char*);
for (int i = 0; i < ignoreSetCount; i++) {
- CFStringRef ignoreString = ignoreSet[i];
- CFRange range = CFRangeMake(0, CFStringGetLength(URLString));
- CFOptionFlags flags = kCFCompareAnchored | kCFCompareBackwards | kCFCompareCaseInsensitive;
- if (CFStringFindWithOptions(URLString, ignoreString, range, flags, NULL))
- return YES;
+ // 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 NO;
+ return false;
}
-static void activateAhemFont()
-{
- unsigned long fontDataLength;
- char* fontData = getsectdata("__DATA", "Ahem", &fontDataLength);
- if (!fontData) {
- fprintf(stderr, "Failed to locate the Ahem font.\n");
- exit(1);
- }
+static void activateFonts()
+{
+ static const char* fontSectionNames[] = {
+ "Ahem",
+ "WeightWatcher100",
+ "WeightWatcher200",
+ "WeightWatcher300",
+ "WeightWatcher400",
+ "WeightWatcher500",
+ "WeightWatcher600",
+ "WeightWatcher700",
+ "WeightWatcher800",
+ "WeightWatcher900",
+ 0
+ };
+
+ for (unsigned i = 0; fontSectionNames[i]; ++i) {
+ unsigned long fontDataLength;
+ char* fontData = getsectdata("__DATA", fontSectionNames[i], &fontDataLength);
+ if (!fontData) {
+ fprintf(stderr, "Failed to locate the %s font.\n", fontSectionNames[i]);
+ exit(1);
+ }
- ATSFontContainerRef fontContainer;
- OSStatus status = ATSFontActivateFromMemory(fontData, fontDataLength, kATSFontContextLocal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &fontContainer);
+ ATSFontContainerRef fontContainer;
+ OSStatus status = ATSFontActivateFromMemory(fontData, fontDataLength, kATSFontContextLocal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &fontContainer);
- if (status != noErr) {
- fprintf(stderr, "Failed to activate the Ahem font.\n");
- exit(1);
+ if (status != noErr) {
+ fprintf(stderr, "Failed to activate the %s font.\n", fontSectionNames[i]);
+ exit(1);
+ }
}
}
@@ -235,18 +307,26 @@ void testStringByEvaluatingJavaScriptFromString()
static void setDefaultsToConsistentValuesForTesting()
{
// Give some clear to undocumented defaults values
- static const int MediumFontSmoothing = 2;
+ static const int NoFontSmoothing = 0;
static const int BlueTintedAppearance = 1;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"];
[defaults setInteger:4 forKey:@"AppleAntiAliasingThreshold"]; // smallest font size to CG should perform antialiasing on
- [defaults setInteger:MediumFontSmoothing forKey:@"AppleFontSmoothing"];
+ [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"];
+ // 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);
+ ThemeScrollBarArrowStyle style;
+ GetThemeScrollBarArrowStyle(&style); // Force HIToolbox to read from CFPreferences
+ if (initialValue)
+ CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), initialValue.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
NSString *libraryPath = [@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath];
[defaults setObject:[libraryPath stringByAppendingPathComponent:@"Databases"] forKey:WebDatabaseDirectoryDefaultsKey];
@@ -265,6 +345,8 @@ static void setDefaultsToConsistentValuesForTesting()
[preferences setEditableLinkBehavior:WebKitEditableLinkOnlyLiveWithShiftKey];
[preferences setTabsToLinks:NO];
[preferences setDOMPasteAllowed:YES];
+ [preferences setFullDocumentTeardownEnabled:YES];
+ [preferences setShouldPrintBackgrounds:YES];
// 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.
@@ -273,8 +355,10 @@ static void setDefaultsToConsistentValuesForTesting()
static void crashHandler(int sig)
{
- fprintf(stderr, "%s\n", strsignal(sig));
- restoreColorSpace(0);
+ char *signalName = strsignal(sig);
+ write(STDERR_FILENO, signalName, strlen(signalName));
+ write(STDERR_FILENO, "\n", 1);
+ restoreMainDisplayColorProfile(0);
exit(128 + sig);
}
@@ -295,7 +379,7 @@ static void installSignalHandlers()
static void allocateGlobalControllers()
{
// FIXME: We should remove these and move to the ObjC standard [Foo sharedInstance] model
- navigationController = [[NavigationController alloc] init];
+ gNavigationController = [[NavigationController alloc] init];
frameLoadDelegate = [[FrameLoadDelegate alloc] init];
uiDelegate = [[UIDelegate alloc] init];
editingDelegate = [[EditingDelegate alloc] init];
@@ -312,7 +396,7 @@ static inline void releaseAndZero(NSObject** object)
static void releaseGlobalControllers()
{
- releaseAndZero(&navigationController);
+ releaseAndZero(&gNavigationController);
releaseAndZero(&frameLoadDelegate);
releaseAndZero(&editingDelegate);
releaseAndZero(&resourceLoadDelegate);
@@ -323,13 +407,11 @@ static void releaseGlobalControllers()
static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[])
{
struct option options[] = {
- {"dump-all-pixels", no_argument, &dumpAllPixels, YES},
- {"horizontal-sweep", no_argument, &repaintSweepHorizontallyDefault, YES},
{"notree", no_argument, &dumpTree, NO},
{"pixel-tests", no_argument, &dumpPixels, YES},
- {"repaint", no_argument, &testRepaintDefault, YES},
{"tree", no_argument, &dumpTree, YES},
{"threaded", no_argument, &threaded, YES},
+ {"complex-text", no_argument, &forceComplexText, YES},
{NULL, 0, NULL, 0}
};
@@ -376,14 +458,14 @@ static void runTestingServerLoop()
static void prepareConsistentTestingEnvironment()
{
- class_poseAs(objc_getClass("DumpRenderTreePasteboard"), objc_getClass("NSPasteboard"));
- class_poseAs(objc_getClass("DumpRenderTreeEvent"), objc_getClass("NSEvent"));
+ poseAsClass("DumpRenderTreePasteboard", "NSPasteboard");
+ poseAsClass("DumpRenderTreeEvent", "NSEvent");
setDefaultsToConsistentValuesForTesting();
- activateAhemFont();
+ activateFonts();
if (dumpPixels)
- initializeColorSpaceAndScreeBufferForPixelTests();
+ setupMainDisplayColorProfile();
allocateGlobalControllers();
makeLargeMallocFailSilently();
@@ -396,12 +478,17 @@ void dumpRenderTree(int argc, const char *argv[])
addTestPluginsToPluginSearchPath(argv[0]);
if (dumpPixels)
installSignalHandlers();
-
+
+ if (forceComplexText)
+ [WebView _setAlwaysUsesComplexTextCodePath:YES];
+
WebView *webView = createWebViewAndOffscreenWindow();
mainFrame = [webView mainFrame];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
+ [WebCache empty];
+
// <rdar://problem/5222911>
testStringByEvaluatingJavaScriptFromString();
@@ -420,7 +507,6 @@ void dumpRenderTree(int argc, const char *argv[])
if (threaded)
stopJavaScriptThreads();
- [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts
[webView close];
mainFrame = nil;
@@ -445,7 +531,7 @@ void dumpRenderTree(int argc, const char *argv[])
}
if (dumpPixels)
- restoreColorSpace(0);
+ restoreMainDisplayColorProfile(0);
}
int main(int argc, const char *argv[])
@@ -454,11 +540,12 @@ int main(int argc, const char *argv[])
[NSApplication sharedApplication]; // Force AppKit to init itself
dumpRenderTree(argc, argv);
[WebCoreStatistics garbageCollectJavaScriptObjects];
+ [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts
[pool release];
return 0;
}
-static int compareHistoryItems(id item1, id item2, void *context)
+static NSInteger compareHistoryItems(id item1, id item2, void *context)
{
return [[item1 target] caseInsensitiveCompare:[item2 target]];
}
@@ -497,7 +584,7 @@ static void dumpFrameScrollPosition(WebFrame *f)
printf("scrolled to %.f,%.f\n", scrollPosition.x, scrollPosition.y);
}
- if (layoutTestController->dumpChildFrameScrollPositions()) {
+ if (gLayoutTestController->dumpChildFrameScrollPositions()) {
NSArray *kids = [f childFrames];
if (kids)
for (unsigned i = 0; i < [kids count]; i++)
@@ -521,7 +608,7 @@ static NSString *dumpFramesAsText(WebFrame *frame)
[result appendFormat:@"%@\n", [documentElement innerText]];
- if (layoutTestController->dumpChildFramesAsText()) {
+ if (gLayoutTestController->dumpChildFramesAsText()) {
NSArray *kids = [frame childFrames];
if (kids) {
for (unsigned i = 0; i < [kids count]; i++)
@@ -532,8 +619,47 @@ static NSString *dumpFramesAsText(WebFrame *frame)
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 = @"/tmp/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 convertMIMEType(NSMutableString *mimeType)
{
+#ifdef BUILDING_ON_LEOPARD
+ // Workaround for <rdar://problem/5539824> on Leopard
+ if ([mimeType isEqualToString:@"text/xml"])
+ [mimeType setString:@"application/xml"];
+#endif
+ // Workaround for <rdar://problem/6234318> with Dashcode 2.0
if ([mimeType isEqualToString:@"application/x-javascript"])
[mimeType setString:@"text/javascript"];
}
@@ -543,22 +669,24 @@ static void convertWebResourceDataToString(NSMutableDictionary *resource)
NSMutableString *mimeType = [resource objectForKey:@"WebResourceMIMEType"];
convertMIMEType(mimeType);
- if ([mimeType hasPrefix:@"text/"]) {
+ if ([mimeType hasPrefix:@"text/"] || [[WebHTMLRepresentation supportedNonImageMIMETypes] containsObject:mimeType]) {
NSData *data = [resource objectForKey:@"WebResourceData"];
NSString *dataAsString = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
[resource setObject:dataAsString forKey:@"WebResourceData"];
}
}
-static void normalizeWebResourceURL(NSMutableString *webResourceURL, NSString *oldURLBase)
+static void normalizeWebResourceURL(NSMutableString *webResourceURL)
{
- [webResourceURL replaceOccurrencesOfString:oldURLBase
- withString:@"file://"
- options:NSLiteralSearch
- range:NSMakeRange(0, [webResourceURL length])];
+ static int fileUrlLength = [(NSString *)@"file://" length];
+ NSRange layoutTestsWebArchivePathRange = [webResourceURL rangeOfString:@"/LayoutTests/" options:NSBackwardsSearch];
+ if (layoutTestsWebArchivePathRange.location == NSNotFound)
+ return;
+ NSRange currentWorkingDirectoryRange = NSMakeRange(fileUrlLength, layoutTestsWebArchivePathRange.location - fileUrlLength);
+ [webResourceURL replaceCharactersInRange:currentWorkingDirectoryRange withString:@""];
}
-static void convertWebResourceResponseToDictionary(NSMutableDictionary *propertyList, NSString *oldURLBase)
+static void convertWebResourceResponseToDictionary(NSMutableDictionary *propertyList)
{
NSURLResponse *response = nil;
NSData *responseData = [propertyList objectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
@@ -573,7 +701,7 @@ static void convertWebResourceResponseToDictionary(NSMutableDictionary *property
NSMutableDictionary *responseDictionary = [[NSMutableDictionary alloc] init];
NSMutableString *urlString = [[[response URL] description] mutableCopy];
- normalizeWebResourceURL(urlString, oldURLBase);
+ normalizeWebResourceURL(urlString);
[responseDictionary setObject:urlString forKey:@"URL"];
[urlString release];
@@ -598,6 +726,14 @@ static void convertWebResourceResponseToDictionary(NSMutableDictionary *property
[responseDictionary release];
}
+static NSInteger compareResourceURLs(id resource1, id resource2, void *context)
+{
+ NSString *url1 = [resource1 objectForKey:@"WebResourceURL"];
+ NSString *url2 = [resource2 objectForKey:@"WebResourceURL"];
+
+ return [url1 compare:url2];
+}
+
static NSString *serializeWebArchiveToXML(WebArchive *webArchive)
{
NSString *errorString;
@@ -608,9 +744,6 @@ static NSString *serializeWebArchiveToXML(WebArchive *webArchive)
if (!propertyList)
return errorString;
- // Normalize WebResourceResponse and WebResourceURL values in plist for testing
- NSString *cwdURL = [@"file://" stringByAppendingString:[[[NSFileManager defaultManager] currentDirectoryPath] stringByExpandingTildeInPath]];
-
NSMutableArray *resources = [NSMutableArray arrayWithCapacity:1];
[resources addObject:propertyList];
@@ -619,7 +752,7 @@ static NSString *serializeWebArchiveToXML(WebArchive *webArchive)
[resources removeObjectAtIndex:0];
NSMutableDictionary *mainResource = [resourcePropertyList objectForKey:@"WebMainResource"];
- normalizeWebResourceURL([mainResource objectForKey:@"WebResourceURL"], cwdURL);
+ normalizeWebResourceURL([mainResource objectForKey:@"WebResourceURL"]);
convertWebResourceDataToString(mainResource);
// Add subframeArchives to list for processing
@@ -631,10 +764,14 @@ static NSString *serializeWebArchiveToXML(WebArchive *webArchive)
NSEnumerator *enumerator = [subresources objectEnumerator];
NSMutableDictionary *subresourcePropertyList;
while ((subresourcePropertyList = [enumerator nextObject])) {
- normalizeWebResourceURL([subresourcePropertyList objectForKey:@"WebResourceURL"], cwdURL);
- convertWebResourceResponseToDictionary(subresourcePropertyList, cwdURL);
+ normalizeWebResourceURL([subresourcePropertyList objectForKey:@"WebResourceURL"]);
+ convertWebResourceResponseToDictionary(subresourcePropertyList);
convertWebResourceDataToString(subresourcePropertyList);
}
+
+ // Sort the subresources so they're always in a predictable order for the dump
+ if (NSArray *sortedSubresources = [subresources sortedArrayUsingFunction:compareResourceURLs context:nil])
+ [resourcePropertyList setObject:sortedSubresources forKey:@"WebSubresources"];
}
NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:propertyList
@@ -689,7 +826,7 @@ static void dumpBackForwardListForWebView(WebView *view)
static void sizeWebViewForCurrentTest()
{
// W3C SVG tests expect to be 480x360
- bool isSVGW3CTest = ([currentTest rangeOfString:@"svg/W3C-SVG-1.1"].length);
+ bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos);
if (isSVGW3CTest)
[[mainFrame webView] setFrameSize:NSMakeSize(480, 360)];
else
@@ -699,11 +836,11 @@ static void sizeWebViewForCurrentTest()
static const char *methodNameStringForFailedTest()
{
const char *errorMessage;
- if (layoutTestController->dumpAsText())
+ if (gLayoutTestController->dumpAsText())
errorMessage = "[documentElement innerText]";
- else if (layoutTestController->dumpDOMAsWebArchive())
+ else if (gLayoutTestController->dumpDOMAsWebArchive())
errorMessage = "[[mainFrame DOMDocument] webArchive]";
- else if (layoutTestController->dumpSourceAsWebArchive())
+ else if (gLayoutTestController->dumpSourceAsWebArchive())
errorMessage = "[[mainFrame dataSource] webArchive]";
else
errorMessage = "[mainFrame renderTreeAsExternalRepresentation]";
@@ -735,21 +872,27 @@ void dump()
{
invalidateAnyPreviousWaitToDumpWatchdog();
+ bool dumpAsText = gLayoutTestController->dumpAsText();
if (dumpTree) {
NSString *resultString = nil;
NSData *resultData = nil;
+ NSString *resultMimeType = @"text/plain";
- bool dumpAsText = layoutTestController->dumpAsText();
dumpAsText |= [[[mainFrame dataSource] _responseMIMEType] isEqualToString:@"text/plain"];
- layoutTestController->setDumpAsText(dumpAsText);
- if (layoutTestController->dumpAsText()) {
+ gLayoutTestController->setDumpAsText(dumpAsText);
+ if (gLayoutTestController->dumpAsText()) {
resultString = dumpFramesAsText(mainFrame);
- } else if (layoutTestController->dumpDOMAsWebArchive()) {
+ } else if (gLayoutTestController->dumpAsPDF()) {
+ resultData = dumpFrameAsPDF(mainFrame);
+ resultMimeType = @"application/pdf";
+ } else if (gLayoutTestController->dumpDOMAsWebArchive()) {
WebArchive *webArchive = [[mainFrame DOMDocument] webArchive];
resultString = serializeWebArchiveToXML(webArchive);
- } else if (layoutTestController->dumpSourceAsWebArchive()) {
+ resultMimeType = @"application/x-webarchive";
+ } else if (gLayoutTestController->dumpSourceAsWebArchive()) {
WebArchive *webArchive = [[mainFrame dataSource] webArchive];
resultString = serializeWebArchiveToXML(webArchive);
+ resultMimeType = @"application/x-webarchive";
} else {
sizeWebViewForCurrentTest();
resultString = [mainFrame renderTreeAsExternalRepresentation];
@@ -758,25 +901,32 @@ void dump()
if (resultString && !resultData)
resultData = [resultString dataUsingEncoding:NSUTF8StringEncoding];
+ printf("Content-Type: %s\n", [resultMimeType UTF8String]);
+
if (resultData) {
fwrite([resultData bytes], 1, [resultData length], stdout);
- if (!layoutTestController->dumpAsText() && !layoutTestController->dumpDOMAsWebArchive() && !layoutTestController->dumpSourceAsWebArchive())
+ if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive())
dumpFrameScrollPosition(mainFrame);
- if (layoutTestController->dumpBackForwardList())
+ if (gLayoutTestController->dumpBackForwardList())
dumpBackForwardListForAllWindows();
} else
printf("ERROR: nil result from %s", methodNameStringForFailedTest());
- if (printSeparators)
- puts("#EOF");
+ if (printSeparators) {
+ puts("#EOF"); // terminate the content block
+ fputs("#EOF\n", stderr);
+ }
}
- if (dumpPixels)
- dumpWebViewAsPixelsAndCompareWithExpected([currentTest UTF8String], dumpAllPixels);
+ if (dumpPixels && !dumpAsText)
+ dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
+
+ puts("#EOF"); // terminate the (possibly empty) pixels block
fflush(stdout);
+ fflush(stderr);
done = YES;
}
@@ -786,29 +936,24 @@ static bool shouldLogFrameLoadDelegates(const char *pathOrURL)
return strstr(pathOrURL, "loading/");
}
-static CFURLRef createCFURLFromPathOrURL(CFStringRef pathOrURLString)
-{
- CFURLRef URL;
- if (CFStringHasPrefix(pathOrURLString, CFSTR("http://")) || CFStringHasPrefix(pathOrURLString, CFSTR("https://")))
- URL = CFURLCreateWithString(NULL, pathOrURLString, NULL);
- else
- URL = CFURLCreateWithFileSystemPath(NULL, pathOrURLString, kCFURLPOSIXPathStyle, FALSE);
- return URL;
-}
-
static void resetWebViewToConsistentStateBeforeTesting()
{
WebView *webView = [mainFrame webView];
[(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES];
[webView makeTextStandardSize:nil];
- [webView setTabKeyCyclesThroughElements: YES];
+ [webView resetPageZoom:nil];
+ [webView setTabKeyCyclesThroughElements:YES];
[webView setPolicyDelegate:nil];
[webView _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO];
+ [webView _clearMainFrameName];
WebPreferences *preferences = [webView preferences];
[preferences setPrivateBrowsingEnabled:NO];
[preferences setAuthorAndUserStylesEnabled:YES];
[preferences setJavaScriptCanOpenWindowsAutomatically:YES];
+ [preferences setOfflineWebApplicationCacheEnabled:YES];
+ [preferences setFullDocumentTeardownEnabled:YES];
+ [preferences setDeveloperExtrasEnabled:NO];
if (persistentUserStyleSheetLocation) {
[preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
@@ -816,56 +961,72 @@ static void resetWebViewToConsistentStateBeforeTesting()
} else
[preferences setUserStyleSheetEnabled:NO];
+ [[mainFrame webView] setSmartInsertDeleteEnabled:YES];
+ [[[mainFrame webView] inspector] setJavaScriptProfilingEnabled:NO];
+
[WebView _setUsesTestModeFocusRingColor:YES];
}
-static void runTest(const char *pathOrURL)
+static void runTest(const string& testPathOrURL)
{
- CFStringRef pathOrURLString = CFStringCreateWithCString(NULL, pathOrURL, kCFStringEncodingUTF8);
+ ASSERT(!testPathOrURL.empty());
+
+ // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
+ string pathOrURL(testPathOrURL);
+ string expectedPixelHash;
+
+ size_t separatorPos = pathOrURL.find("'");
+ if (separatorPos != string::npos) {
+ pathOrURL = string(testPathOrURL, 0, separatorPos);
+ expectedPixelHash = string(testPathOrURL, separatorPos + 1);
+ }
+
+ NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()];
if (!pathOrURLString) {
- fprintf(stderr, "Failed to parse filename as UTF-8: %s\n", pathOrURL);
+ fprintf(stderr, "Failed to parse \"%s\" as UTF-8\n", pathOrURL.c_str());
return;
}
- CFURLRef URL = createCFURLFromPathOrURL(pathOrURLString);
- if (!URL) {
- CFRelease(pathOrURLString);
- fprintf(stderr, "Can't turn %s into a CFURL\n", pathOrURL);
+ NSURL *url;
+ if ([pathOrURLString hasPrefix:@"http://"] || [pathOrURLString hasPrefix:@"https://"])
+ 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();
- layoutTestController = new LayoutTestController(testRepaintDefault, repaintSweepHorizontallyDefault);
+ gLayoutTestController = new LayoutTestController(testURL, expectedPixelHash);
topLoadingFrame = nil;
done = NO;
if (disallowedURLs)
CFSetRemoveAllValues(disallowedURLs);
- if (shouldLogFrameLoadDelegates(pathOrURL))
- layoutTestController->setDumpFrameLoadCallbacks(true);
+ if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
+ gLayoutTestController->setDumpFrameLoadCallbacks(true);
if ([WebHistory optionalSharedHistory])
[WebHistory setOptionalSharedHistory:nil];
lastMousePosition = NSZeroPoint;
lastClickPosition = NSZeroPoint;
- if (currentTest != nil)
- CFRelease(currentTest);
- currentTest = (NSString *)pathOrURLString;
[prevTestBFItem release];
prevTestBFItem = [[[[mainFrame webView] backForwardList] currentItem] retain];
WorkQueue::shared()->clear();
WorkQueue::shared()->setFrozen(false);
- BOOL _shouldIgnoreWebCoreNodeLeaks = shouldIgnoreWebCoreNodeLeaks(CFURLGetString(URL));
- if (_shouldIgnoreWebCoreNodeLeaks)
+ bool ignoreWebCoreNodeLeaks = shouldIgnoreWebCoreNodeLeaks(testURL);
+ if (ignoreWebCoreNodeLeaks)
[WebCoreStatistics startIgnoringWebCoreNodeLeaks];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- [mainFrame loadRequest:[NSURLRequest requestWithURL:(NSURL *)URL]];
- CFRelease(URL);
+ [mainFrame loadRequest:[NSURLRequest requestWithURL:url]];
[pool release];
while (!done) {
pool = [[NSAutoreleasePool alloc] init];
@@ -878,7 +1039,7 @@ static void runTest(const char *pathOrURL)
WorkQueue::shared()->clear();
- if (layoutTestController->closeRemainingWindowsWhenComplete()) {
+ if (gLayoutTestController->closeRemainingWindowsWhenComplete()) {
NSArray* array = [DumpRenderTreeWindow openWindows];
unsigned count = [array count];
@@ -905,10 +1066,10 @@ static void runTest(const char *pathOrURL)
ASSERT(CFArrayGetCount(openWindowsRef) == 1);
ASSERT(CFArrayGetValueAtIndex(openWindowsRef, 0) == [[mainFrame webView] window]);
- delete layoutTestController;
- layoutTestController = 0;
+ gLayoutTestController->deref();
+ gLayoutTestController = 0;
- if (_shouldIgnoreWebCoreNodeLeaks)
+ if (ignoreWebCoreNodeLeaks)
[WebCoreStatistics stopIgnoringWebCoreNodeLeaks];
}
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h
index c4c7573..03d354d 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h
@@ -32,6 +32,12 @@
// FIXME: we should add a config.h file for DumpRenderTree.
#define WTF_PLATFORM_CF 1
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
+#define BUILDING_ON_TIGER 1
+#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+#define BUILDING_ON_LEOPARD 1
+#endif
+
@class DumpRenderTreeDraggingInfo;
@class NavigationController;
@class PolicyDelegate;
@@ -45,7 +51,7 @@ extern CFMutableSetRef disallowedURLs;
extern WebFrame* mainFrame;
extern WebFrame* topLoadingFrame;
extern DumpRenderTreeDraggingInfo *draggingInfo;
-extern NavigationController* navigationController;
+extern NavigationController* gNavigationController;
extern PolicyDelegate* policyDelegate;
extern const unsigned maxViewHeight;
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.h b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.h
index 6a01a42..ba2754b 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.h
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.h
@@ -29,9 +29,10 @@
*/
#import <AppKit/AppKit.h>
+#import <WebKit/WebTypesInternal.h>
@interface DumpRenderTreePasteboard : NSPasteboard
-- (int)declareType:(NSString *)type owner:(id)newOwner;
+- (NSInteger)declareType:(NSString *)type owner:(id)newOwner;
+ (void)releaseLocalPasteboards;
@end
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m
index b5a9b7a..a797b5c 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreePasteboard.m
@@ -28,14 +28,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "DumpRenderTreeMac.h"
#import "DumpRenderTreePasteboard.h"
+#import <WebKit/WebTypesInternal.h>
+
@interface LocalPasteboard : NSPasteboard
{
NSMutableArray *typesArray;
NSMutableSet *typesSet;
NSMutableDictionary *dataByType;
- int changeCount;
+ NSInteger changeCount;
}
@end
@@ -68,7 +71,7 @@ static NSMutableDictionary *localPasteboards;
// 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
-- (int)declareType:(NSString *)type owner:(id)newOwner
+- (NSInteger)declareType:(NSString *)type owner:(id)newOwner
{
return [self declareTypes:[NSArray arrayWithObject:type] owner:newOwner];
}
@@ -107,7 +110,7 @@ static NSMutableDictionary *localPasteboards;
{
}
-- (int)declareTypes:(NSArray *)newTypes owner:(id)newOwner
+- (NSInteger)declareTypes:(NSArray *)newTypes owner:(id)newOwner
{
[typesArray removeAllObjects];
[typesSet removeAllObjects];
@@ -115,7 +118,7 @@ static NSMutableDictionary *localPasteboards;
return [self addTypes:newTypes owner:newOwner];
}
-- (int)addTypes:(NSArray *)newTypes owner:(id)newOwner
+- (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner
{
unsigned count = [newTypes count];
unsigned i;
@@ -134,7 +137,7 @@ static NSMutableDictionary *localPasteboards;
return ++changeCount;
}
-- (int)changeCount
+- (NSInteger)changeCount
{
return changeCount;
}
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
index 9e5e104..b3fc5a7 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
@@ -34,6 +34,7 @@
// FIXME: This file is ObjC++ only because of this include. :(
#import "LayoutTestController.h"
+#import <WebKit/WebTypesInternal.h>
CFMutableArrayRef openWindowsRef = 0;
@@ -52,7 +53,7 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = {
return [[(NSArray *)openWindowsRef copy] autorelease];
}
-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
if (!openWindowsRef)
openWindowsRef = CFArrayCreateMutable(NULL, 0, &NonRetainingArrayCallbacks);
@@ -73,7 +74,7 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = {
- (BOOL)isKeyWindow
{
- return layoutTestController ? layoutTestController->windowIsKey() : YES;
+ return gLayoutTestController ? gLayoutTestController->windowIsKey() : YES;
}
- (void)keyDown:(id)sender
diff --git a/WebKitTools/DumpRenderTree/mac/EditingDelegate.mm b/WebKitTools/DumpRenderTree/mac/EditingDelegate.mm
index a8f0815..cf4026b 100644
--- a/WebKitTools/DumpRenderTree/mac/EditingDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/EditingDelegate.mm
@@ -73,14 +73,14 @@
- (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", [[range dump] UTF8String]);
return acceptsEditing;
}
- (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", [[range dump] UTF8String]);
return acceptsEditing;
}
@@ -93,7 +93,7 @@
"WebViewInsertActionDropped",
};
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", [[node dumpPath] UTF8String], [[range dump] UTF8String], insertactionstring[action]);
return acceptsEditing;
}
@@ -106,14 +106,14 @@
"WebViewInsertActionDropped",
};
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->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 && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", [[range dump] UTF8String]);
return acceptsEditing;
}
@@ -134,52 +134,52 @@
"TRUE"
};
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->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 && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->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 && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", [[currentStyle description] UTF8String], [[proposedStyle description] UTF8String]);
return acceptsEditing;
}
- (void)webViewDidBeginEditing:(NSNotification *)notification
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: webViewDidBeginEditing:%s\n", [[notification name] UTF8String]);
}
- (void)webViewDidChange:(NSNotification *)notification
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: webViewDidChange:%s\n", [[notification name] UTF8String]);
}
- (void)webViewDidEndEditing:(NSNotification *)notification
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: webViewDidEndEditing:%s\n", [[notification name] UTF8String]);
}
- (void)webViewDidChangeTypingStyle:(NSNotification *)notification
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n", [[notification name] UTF8String]);
}
- (void)webViewDidChangeSelection:(NSNotification *)notification
{
- if (!done && layoutTestController->dumpEditingCallbacks())
+ if (!done && gLayoutTestController->dumpEditingCallbacks())
printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", [[notification name] UTF8String]);
}
diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.h b/WebKitTools/DumpRenderTree/mac/EventSendingController.h
index 28d0385..deee848 100644
--- a/WebKitTools/DumpRenderTree/mac/EventSendingController.h
+++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.h
@@ -31,7 +31,7 @@
@interface EventSendingController : NSObject <DOMEventListener>
{
- BOOL down;
+ BOOL leftMouseButtonDown;
BOOL dragMode;
int clickCount;
NSTimeInterval lastClick;
diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
index 8e9be38..8be05e7 100644
--- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
+++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
@@ -35,13 +35,29 @@
#import "DumpRenderTreeDraggingInfo.h"
#import <Carbon/Carbon.h> // for GetCurrentEventTime()
-#import <WebKit/WebKit.h>
#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
+};
+
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;
@@ -102,8 +118,8 @@ BOOL replayingSavedEvents;
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
- if (aSelector == @selector(mouseDown)
- || aSelector == @selector(mouseUp)
+ if (aSelector == @selector(mouseDown:)
+ || aSelector == @selector(mouseUp:)
|| aSelector == @selector(contextClick)
|| aSelector == @selector(mouseMoveToX:Y:)
|| aSelector == @selector(leapForward:)
@@ -112,7 +128,9 @@ BOOL replayingSavedEvents;
|| aSelector == @selector(fireKeyboardEventsToElement:)
|| aSelector == @selector(clearKillRing)
|| aSelector == @selector(textZoomIn)
- || aSelector == @selector(textZoomOut))
+ || aSelector == @selector(textZoomOut)
+ || aSelector == @selector(zoomPageIn)
+ || aSelector == @selector(zoomPageOut))
return NO;
return YES;
}
@@ -126,6 +144,10 @@ BOOL replayingSavedEvents;
+ (NSString *)webScriptNameForSelector:(SEL)aSelector
{
+ if (aSelector == @selector(mouseDown:))
+ return @"mouseDown";
+ if (aSelector == @selector(mouseUp:))
+ return @"mouseUp";
if (aSelector == @selector(mouseMoveToX:Y:))
return @"mouseMoveTo";
if (aSelector == @selector(leapForward:))
@@ -161,7 +183,7 @@ BOOL replayingSavedEvents;
- (void)leapForward:(int)milliseconds
{
- if (dragMode && down && !replayingSavedEvents) {
+ if (dragMode && leftMouseButtonDown && !replayingSavedEvents) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(leapForward:)]];
[invocation setTarget:self];
[invocation setSelector:@selector(leapForward:)];
@@ -180,15 +202,59 @@ BOOL replayingSavedEvents;
_NSNewKillRingSequence();
}
-- (void)mouseDown
+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)updateClickCountForButton:(int)buttonNumber
{
- [[[mainFrame frameView] documentView] layout];
if (([self currentEventTime] - lastClick >= 1) ||
- !NSEqualPoints(lastMousePosition, lastClickPosition))
+ !NSEqualPoints(lastMousePosition, lastClickPosition) ||
+ lastClickButton != buttonNumber) {
clickCount = 1;
- else
+ lastClickButton = buttonNumber;
+ } else
clickCount++;
- NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown
+}
+
+- (void)mouseDown:(int)buttonNumber
+{
+ [[[mainFrame frameView] documentView] layout];
+ [self updateClickCountForButton:buttonNumber];
+
+ NSEventType eventType = eventTypeForMouseButtonAndAction(buttonNumber, MouseDown);
+ NSEvent *event = [NSEvent mouseEventWithType:eventType
location:lastMousePosition
modifierFlags:0
timestamp:[self currentEventTime]
@@ -201,7 +267,8 @@ BOOL replayingSavedEvents;
NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]];
if (subView) {
[subView mouseDown:event];
- down = YES;
+ if (buttonNumber == LeftMouseButton)
+ leftMouseButtonDown = YES;
}
}
@@ -215,12 +282,23 @@ BOOL replayingSavedEvents;
[[mainFrame webView] makeTextSmaller:self];
}
-- (void)mouseUp
+- (void)zoomPageIn
+{
+ [[mainFrame webView] zoomPageIn:self];
+}
+
+- (void)zoomPageOut
+{
+ [[mainFrame webView] zoomPageOut:self];
+}
+
+- (void)mouseUp:(int)buttonNumber
{
if (dragMode && !replayingSavedEvents) {
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseUp)]];
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseUp:)]];
[invocation setTarget:self];
- [invocation setSelector:@selector(mouseUp)];
+ [invocation setSelector:@selector(mouseUp:)];
+ [invocation setArgument:&buttonNumber atIndex:2];
[EventSendingController saveEvent:invocation];
[EventSendingController replaySavedEvents];
@@ -229,7 +307,8 @@ BOOL replayingSavedEvents;
}
[[[mainFrame frameView] documentView] layout];
- NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp
+ NSEventType eventType = eventTypeForMouseButtonAndAction(buttonNumber, MouseUp);
+ NSEvent *event = [NSEvent mouseEventWithType:eventType
location:lastMousePosition
modifierFlags:0
timestamp:[self currentEventTime]
@@ -246,7 +325,8 @@ BOOL replayingSavedEvents;
targetView = targetView ? targetView : [[mainFrame frameView] documentView];
assert(targetView);
[targetView mouseUp:event];
- down = NO;
+ if (buttonNumber == LeftMouseButton)
+ leftMouseButtonDown = NO;
lastClick = [event timestamp];
lastClickPosition = lastMousePosition;
if (draggingInfo) {
@@ -266,7 +346,7 @@ BOOL replayingSavedEvents;
- (void)mouseMoveToX:(int)x Y:(int)y
{
- if (dragMode && down && !replayingSavedEvents) {
+ if (dragMode && leftMouseButtonDown && !replayingSavedEvents) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseMoveToX:Y:)]];
[invocation setTarget:self];
[invocation setSelector:@selector(mouseMoveToX:Y:)];
@@ -280,19 +360,19 @@ BOOL replayingSavedEvents;
NSView *view = [mainFrame webView];
lastMousePosition = [view convertPoint:NSMakePoint(x, [view frame].size.height - y) toView:nil];
- NSEvent *event = [NSEvent mouseEventWithType:(down ? NSLeftMouseDragged : NSMouseMoved)
+ NSEvent *event = [NSEvent mouseEventWithType:(leftMouseButtonDown ? NSLeftMouseDragged : NSMouseMoved)
location:lastMousePosition
modifierFlags:0
timestamp:[self currentEventTime]
windowNumber:[[view window] windowNumber]
context:[NSGraphicsContext currentContext]
eventNumber:++eventNumber
- clickCount:(down ? clickCount : 0)
+ clickCount:(leftMouseButtonDown ? clickCount : 0)
pressure:0.0];
NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]];
if (subView) {
- if (down) {
+ if (leftMouseButtonDown) {
[subView mouseDragged:event];
if (draggingInfo) {
[[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] movedTo:lastMousePosition];
@@ -306,11 +386,9 @@ BOOL replayingSavedEvents;
- (void)contextClick
{
[[[mainFrame frameView] documentView] layout];
- if ([self currentEventTime] - lastClick >= 1)
- clickCount = 1;
- else
- clickCount++;
- NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown
+ [self updateClickCountForButton:RightMouseButton];
+
+ NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown
location:lastMousePosition
modifierFlags:0
timestamp:[self currentEventTime]
diff --git a/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h
index 3b86fdf..6c3cbdb 100644
--- a/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h
+++ b/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.h
@@ -28,10 +28,12 @@
#import <Foundation/Foundation.h>
+class AccessibilityController;
class GCController;
@interface FrameLoadDelegate : NSObject
{
+ AccessibilityController* accessibilityController;
GCController* gcController;
}
@end
diff --git a/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm b/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
index 98b6bac..3d7f8b4 100644
--- a/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
@@ -29,6 +29,7 @@
#import "DumpRenderTree.h"
#import "FrameLoadDelegate.h"
+#import "AccessibilityController.h"
#import "AppleScriptController.h"
#import "EventSendingController.h"
#import "GCController.h"
@@ -94,8 +95,10 @@
- (id)init
{
- if ((self = [super init]))
+ if ((self = [super init])) {
gcController = new GCController;
+ accessibilityController = new AccessibilityController;
+ }
return self;
}
@@ -117,7 +120,7 @@
}
// if we didn't start a new load, then we finished all the commands, so we're ready to dump state
- if (!topLoadingFrame && !layoutTestController->waitToDump())
+ if (!topLoadingFrame && !gLayoutTestController->waitToDump())
dump();
}
@@ -126,7 +129,7 @@
if ([dataSource webFrame] == topLoadingFrame) {
topLoadingFrame = nil;
WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
- if (!layoutTestController->waitToDump()) {
+ if (!gLayoutTestController->waitToDump()) {
if (WorkQueue::shared()->count())
[self performSelector:@selector(processWork:) withObject:nil afterDelay:0];
else
@@ -137,7 +140,7 @@
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didStartProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -147,11 +150,17 @@
// end up doing two dumps for one test.
if (!topLoadingFrame && !done)
topLoadingFrame = frame;
+
+ if (!done && gLayoutTestController->stopProvisionalFrameLoads()) {
+ NSString *string = [NSString stringWithFormat:@"%@ - stopping load in didStartProvisionalLoadForFrame callback", [frame _drt_descriptionSuitableForTestResult]];
+ printf ("%s\n", [string UTF8String]);
+ [frame stopLoading];
+ }
}
- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didCommitLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -159,7 +168,7 @@
ASSERT(![frame provisionalDataSource]);
ASSERT([frame dataSource]);
- layoutTestController->setWindowIsKey(true);
+ gLayoutTestController->setWindowIsKey(true);
NSView *documentView = [[mainFrame frameView] documentView];
[[[mainFrame webView] window] makeFirstResponder:documentView];
if ([documentView isKindOfClass:[WebHTMLView class]])
@@ -168,7 +177,7 @@
- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didFailProvisionalLoadWithError", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -189,7 +198,7 @@
ASSERT([frame dataSource]);
ASSERT(frame == [[frame dataSource] webFrame]);
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -200,12 +209,12 @@
if ([[sender mainFrame] isEqual:frame])
[sender displayIfNeeded];
[self webView:sender locationChangeDone:nil forDataSource:[frame dataSource]];
- [navigationController webView:sender didFinishLoadForFrame:frame];
+ [gNavigationController webView:sender didFinishLoadForFrame:frame];
}
- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadWithError", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -218,7 +227,7 @@
- (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject;
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"?? - windowScriptObjectAvailable"];
printf ("%s\n", [string UTF8String]);
}
@@ -236,13 +245,16 @@
JSObjectRef globalObject = JSContextGetGlobalObject(context);
JSValueRef exception = 0;
- ASSERT(layoutTestController);
- layoutTestController->makeWindowObject(context, globalObject, &exception);
+ ASSERT(gLayoutTestController);
+ gLayoutTestController->makeWindowObject(context, globalObject, &exception);
ASSERT(!exception);
gcController->makeWindowObject(context, globalObject, &exception);
ASSERT(!exception);
+ accessibilityController->makeWindowObject(context, globalObject, &exception);
+ ASSERT(!exception);
+
// Make Old-Style controllers
EventSendingController *esc = [[EventSendingController alloc] init];
[obj setValue:esc forKey:@"eventSender"];
@@ -260,7 +272,7 @@
[obj setValue:occ forKey:@"objCController"];
[occ release];
- [obj setValue:navigationController forKey:@"navigationController"];
+ [obj setValue:gNavigationController forKey:@"navigationController"];
ObjCPlugin *plugin = [[ObjCPlugin alloc] init];
[obj setValue:plugin forKey:@"objCPlugin"];
@@ -273,18 +285,18 @@
- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didReceiveTitle: %@", [frame _drt_descriptionSuitableForTestResult], title];
printf ("%s\n", [string UTF8String]);
}
- if (layoutTestController->dumpTitleChanges())
+ if (gLayoutTestController->dumpTitleChanges())
printf("TITLE CHANGED: %s\n", [title UTF8String]);
}
- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didReceiveServerRedirectForProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -292,7 +304,7 @@
- (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didChangeLocationWithinPageForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -300,7 +312,7 @@
- (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - willPerformClientRedirectToURL: %@ ", [frame _drt_descriptionSuitableForTestResult], [URL _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -308,7 +320,7 @@
- (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didCancelClientRedirectForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
@@ -316,15 +328,21 @@
- (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame;
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->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 && layoutTestController->dumpFrameLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didHandleOnloadEventsForFrame", [frame _drt_descriptionSuitableForTestResult]];
printf ("%s\n", [string UTF8String]);
}
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index b321319..2200c27 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -36,13 +36,19 @@
#import <JavaScriptCore/JSRetainPtr.h>
#import <JavaScriptCore/JSStringRef.h>
#import <JavaScriptCore/JSStringRefCF.h>
+#import <WebKit/DOMDocument.h>
#import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebDatabaseManagerPrivate.h>
+#import <WebKit/WebDataSource.h>
#import <WebKit/WebFrame.h>
+#import <WebKit/WebHTMLRepresentation.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebHistory.h>
+#import <WebKit/WebInspector.h>
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebPreferences.h>
#import <WebKit/WebPreferencesPrivate.h>
+#import <WebKit/WebSecurityOriginPrivate.h>
#import <WebKit/WebView.h>
#import <WebKit/WebViewPrivate.h>
#import <wtf/RetainPtr.h>
@@ -65,6 +71,11 @@ void LayoutTestController::addDisallowedURL(JSStringRef url)
CFSetAddValue(disallowedURLs, [request URL]);
}
+void LayoutTestController::clearAllDatabases()
+{
+ [[WebDatabaseManager sharedWebDatabaseManager] deleteAllDatabases];
+}
+
void LayoutTestController::clearBackForwardList()
{
WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList];
@@ -170,6 +181,13 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate)
[[mainFrame webView] setPolicyDelegate:nil];
}
+void LayoutTestController::setDatabaseQuota(unsigned long long quota)
+{
+ WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:@"file:///"]];
+ [origin setQuota:quota];
+ [origin release];
+}
+
void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
{
NSView *documentView = [[mainFrame frameView] documentView];
@@ -232,13 +250,24 @@ void LayoutTestController::setWindowIsKey(bool windowIsKey)
[(WebHTMLView *)documentView _updateFocusedAndActiveState];
}
+void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
+{
+ [[mainFrame webView] setSmartInsertDeleteEnabled:flag];
+}
+
+void LayoutTestController::setJavaScriptProfilingEnabled(bool profilingEnabled)
+{
+ [[[mainFrame webView] preferences] setDeveloperExtrasEnabled:profilingEnabled];
+ [[[mainFrame webView] inspector] setJavaScriptProfilingEnabled:profilingEnabled];
+}
+
static const CFTimeInterval waitToDumpWatchdogInterval = 10.0;
static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info)
{
const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
- fprintf(stderr, message);
- fprintf(stdout, message);
+ fprintf(stderr, "%s", message);
+ fprintf(stdout, "%s", message);
dump();
}
@@ -256,6 +285,20 @@ int LayoutTestController::windowCount()
return CFArrayGetCount(openWindowsRef);
}
+bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
+{
+ RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, id));
+ NSString *idNS = (NSString *)idCF.get();
+
+ DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS];
+ id rep = [[mainFrame dataSource] representation];
+
+ if ([rep class] == [WebHTMLRepresentation class])
+ return [(WebHTMLRepresentation *)rep elementDoesAutoComplete:element];
+
+ return false;
+}
+
void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
{
RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
diff --git a/WebKitTools/DumpRenderTree/mac/ObjCController.m b/WebKitTools/DumpRenderTree/mac/ObjCController.m
index 1b9abb7..ec1ed38 100644
--- a/WebKitTools/DumpRenderTree/mac/ObjCController.m
+++ b/WebKitTools/DumpRenderTree/mac/ObjCController.m
@@ -28,11 +28,28 @@
#import "ObjCController.h"
+#import <JavaScriptCore/JavaScriptCore.h>
#import <WebKit/DOMAbstractView.h>
#import <WebKit/WebScriptObject.h>
#import <WebKit/WebView.h>
+#import <pthread.h>
#import <wtf/Assertions.h>
+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
@@ -46,6 +63,8 @@
|| aSelector == @selector(testWrapperRoundTripping:)
|| aSelector == @selector(accessStoredWebScriptObject)
|| aSelector == @selector(storeWebScriptObject:)
+ || aSelector == @selector(testValueForKey)
+ || aSelector == @selector(testArray)
)
return NO;
return YES;
@@ -67,6 +86,10 @@
return @"testWrapperRoundTripping";
if (aSelector == @selector(storeWebScriptObject:))
return @"storeWebScriptObject";
+ if (aSelector == @selector(testValueForKey))
+ return @"testValueForKey";
+ if (aSelector == @selector(testArray))
+ return @"testArray";
return nil;
}
@@ -115,6 +138,20 @@
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)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
{
JSObjectRef jsObject = [webScriptObject JSObject];
@@ -182,6 +219,11 @@
storedWebScriptObject = [webScriptObject retain];
}
+- (NSArray *)testArray
+{
+ return [NSArray array];
+}
+
- (void)dealloc
{
[storedWebScriptObject release];
diff --git a/WebKitTools/DumpRenderTree/mac/ObjCPlugin.m b/WebKitTools/DumpRenderTree/mac/ObjCPlugin.m
index 18b174c..3ec3e74 100644
--- a/WebKitTools/DumpRenderTree/mac/ObjCPlugin.m
+++ b/WebKitTools/DumpRenderTree/mac/ObjCPlugin.m
@@ -110,7 +110,7 @@ static BOOL _allowsScriptsFullAccess = NO;
- (void)log:(NSString *)message
{
- NSLog(message);
+ NSLog(@"%@", message);
}
- (id)retainObject:(id)obj
diff --git a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
index 5a19164..f4191e5 100644
--- a/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm
@@ -34,129 +34,208 @@
#include "LayoutTestController.h"
#include <CoreGraphics/CGBitmapContext.h>
+#ifndef BUILDING_ON_LEOPARD
+#include <OpenGL/OpenGL.h>
+#include <OpenGL/CGLMacro.h>
+#endif
#include <wtf/Assertions.h>
-#include <wtf/RetainPtr.h>
+#include <wtf/RefPtr.h>
#import <WebKit/WebDocumentPrivate.h>
#import <WebKit/WebKit.h>
-static unsigned char* screenCaptureBuffer;
+// To ensure pixel tests consistency, we need to always render in the same colorspace.
+// Unfortunately, because of AppKit / WebKit constraints, we can't render directly in the colorspace of our choice.
+// This implies we have to temporarily change the profile of the main display to the colorspace we want to render into.
+// We also need to make sure the CGBitmapContext we return is in that same colorspace.
-static CMProfileRef currentColorProfile = 0;
-static CGColorSpaceRef sharedColorSpace;
+#define PROFILE_PATH "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc" // FIXME: This cannot be more than CS_MAX_PATH (256 characters)
-void restoreColorSpace(int ignored)
+static CMProfileLocation sInitialProfileLocation; // The locType field is initialized to 0 which is the same as cmNoProfileBase
+
+void restoreMainDisplayColorProfile(int ignored)
{
// 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 (currentColorProfile) {
- // This call is deprecated in Leopard, but there appears to be no replacement.
- int error = CMSetDefaultProfileByUse(cmDisplayUse, currentColorProfile);
+ if (sInitialProfileLocation.locType != cmNoProfileBase) {
+ const CMDeviceScope scope = { kCFPreferencesCurrentUser, kCFPreferencesCurrentHost };
+ int error = CMSetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)kCGDirectMainDisplay, &scope, cmDefaultProfileID, &sInitialProfileLocation);
if (error)
- fprintf(stderr, "Failed to retore previous color profile! You may need to open System Preferences : Displays : Color and manually restore your color settings. (Error: %i)", error);
- currentColorProfile = 0;
+ fprintf(stderr, "Failed to restore initial color profile for main display! Open System Preferences > Displays > Color and manually re-select the profile. (Error: %i)", error);
+ sInitialProfileLocation.locType = cmNoProfileBase;
}
}
-static void setDefaultColorProfileToRGB()
+void setupMainDisplayColorProfile()
{
- CMProfileRef genericProfile = (CMProfileRef)[[NSColorSpace genericRGBColorSpace] colorSyncProfile];
- CMProfileRef previousProfile;
- int error = CMGetDefaultProfileByUse(cmDisplayUse, &previousProfile);
+ const CMDeviceScope scope = { kCFPreferencesCurrentUser, kCFPreferencesCurrentHost };
+ int error;
+
+ CMProfileRef profile = 0;
+ error = CMGetProfileByAVID((CMDisplayIDType)kCGDirectMainDisplay, &profile);
+ if (!error) {
+ UInt32 size = sizeof(CMProfileLocation);
+ error = NCMGetProfileLocation(profile, &sInitialProfileLocation, &size);
+ CMCloseProfile(profile);
+ }
if (error) {
- fprintf(stderr, "Failed to get current color profile. I will not be able to restore your current profile, thus I'm not changing it. Many pixel tests may fail as a result. (Error: %i)\n", error);
+ fprintf(stderr, "Failed to retrieve current color profile for main display, thus it won't be changed. Many pixel tests may fail as a result. (Error: %i)", error);
+ sInitialProfileLocation.locType = cmNoProfileBase;
return;
}
- if (previousProfile == genericProfile)
- return;
- CFStringRef previousProfileName;
- CFStringRef genericProfileName;
- char previousProfileNameString[1024];
- char genericProfileNameString[1024];
- CMCopyProfileDescriptionString(previousProfile, &previousProfileName);
- CMCopyProfileDescriptionString(genericProfile, &genericProfileName);
- CFStringGetCString(previousProfileName, previousProfileNameString, sizeof(previousProfileNameString), kCFStringEncodingUTF8);
- CFStringGetCString(genericProfileName, genericProfileNameString, sizeof(previousProfileNameString), kCFStringEncodingUTF8);
- CFRelease(previousProfileName);
- CFRelease(genericProfileName);
-
- fprintf(stderr, "\n\nWARNING: Temporarily changing your system color profile from \"%s\" to \"%s\".\n", previousProfileNameString, genericProfileNameString);
- fprintf(stderr, "This allows the WebKit pixel-based regression tests to have consistent color values across all machines.\n");
- fprintf(stderr, "The colors on your screen will change for the duration of the testing.\n\n");
- if ((error = CMSetDefaultProfileByUse(cmDisplayUse, genericProfile))) {
- fprintf(stderr, "Failed to set color profile to \"%s\"! Many pixel tests will fail as a result. (Error: %i)",
- genericProfileNameString, error);
- } else {
- currentColorProfile = previousProfile;
- signal(SIGINT, restoreColorSpace);
- signal(SIGHUP, restoreColorSpace);
- signal(SIGTERM, restoreColorSpace);
+ CMProfileLocation location;
+ location.locType = cmPathBasedProfile;
+ strcpy(location.u.pathLoc.path, PROFILE_PATH);
+ error = CMSetDeviceProfile(cmDisplayDeviceClass, (CMDeviceID)kCGDirectMainDisplay, &scope, cmDefaultProfileID, &location);
+ if (error) {
+ fprintf(stderr, "Failed to set color profile for main display! Many pixel tests may fail as a result. (Error: %i)", error);
+ sInitialProfileLocation.locType = cmNoProfileBase;
+ return;
}
+
+ // Other signals are handled in installSignalHandlers() which also calls restoreMainDisplayColorProfile()
+ signal(SIGINT, restoreMainDisplayColorProfile);
+ signal(SIGHUP, restoreMainDisplayColorProfile);
+ signal(SIGTERM, restoreMainDisplayColorProfile);
+
+ fprintf(stderr, "\n\nWARNING: Temporarily changing the main display color profile to \"%s\": the colors on your screen will change for the duration of the testing.\n", PROFILE_PATH);
+ fprintf(stderr, "This allows the WebKit pixel-based regression tests to have consistent color values across all machines.\n");
}
-void initializeColorSpaceAndScreeBufferForPixelTests()
-{
- setDefaultColorProfileToRGB();
- screenCaptureBuffer = (unsigned char *)malloc(maxViewHeight * maxViewWidth * 4);
- sharedColorSpace = CGColorSpaceCreateDeviceRGB();
-}
-
-// Declared in PixelDumpSupportCG.h
-
-RetainPtr<CGContextRef> getBitmapContextFromWebView()
-{
- NSSize webViewSize = [[mainFrame webView] frame].size;
- return RetainPtr<CGContextRef>(AdoptCF, CGBitmapContextCreate(screenCaptureBuffer, static_cast<size_t>(webViewSize.width), static_cast<size_t>(webViewSize.height), 8, static_cast<size_t>(webViewSize.width) * 4, sharedColorSpace, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedLast));
-}
-
-void paintWebView(CGContextRef context)
+PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
{
- RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
-
- NSGraphicsContext* nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
- [NSGraphicsContext setCurrentContext:nsContext];
-
WebView* view = [mainFrame webView];
- [view displayIfNeeded];
- [view lockFocus];
- NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]];
- [view unlockFocus];
- [imageRep draw];
- [imageRep release];
-
- [NSGraphicsContext setCurrentContext:savedContext.get()];
-}
-
-void repaintWebView(CGContextRef context, bool horizontal)
-{
- RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
-
- NSGraphicsContext* nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
- [NSGraphicsContext setCurrentContext:nsContext];
-
- WebView *view = [mainFrame webView];
NSSize webViewSize = [view frame].size;
+ size_t pixelsWide = static_cast<size_t>(webViewSize.width);
+ size_t pixelsHigh = static_cast<size_t>(webViewSize.height);
+ size_t rowBytes = (4 * pixelsWide + 63) & ~63; // Use a multiple of 64 bytes to improve CG performance
- if (horizontal) {
- 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];
+ void *buffer = calloc(pixelsHigh, rowBytes);
+ if (!buffer)
+ return 0;
+
+ static CGColorSpaceRef colorSpace = 0;
+ if (!colorSpace) {
+ CMProfileLocation location;
+ location.locType = cmPathBasedProfile;
+ strcpy(location.u.pathLoc.path, PROFILE_PATH);
+ CMProfileRef profile;
+ if (CMOpenProfile(&profile, &location) == noErr) {
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(profile);
+ CMCloseProfile(profile);
+ }
+ }
+
+ CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); // Use ARGB8 on PPC or BGRA8 on X86 to improve CG performance
+ if (!context) {
+ free(buffer);
+ return 0;
}
- [NSGraphicsContext setCurrentContext:savedContext.get()];
-}
+ // The BitmapContext keeps the CGContextRef and the pixel buffer alive
+ RefPtr<BitmapContext> bitmapContext = BitmapContext::createByAdoptingBitmapAndContext(buffer, context);
+
+ 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 (onscreen) {
+#ifdef BUILDING_ON_LEOPARD
+ // 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);
+#else
+ // On 10.4 and earlier, we have to move the window temporarily "onscreen" and read directly from the display framebuffer using OpenGL
+ // In this code path, we need to ensure the window is above any other window or captured result will be corrupted
+
+ NSWindow *window = [view window];
+ int oldLevel = [window level];
+ NSRect oldFrame = [window frame];
+
+ NSRect newFrame = [[[NSScreen screens] objectAtIndex:0] frame];
+ newFrame = NSMakeRect(newFrame.origin.x + (newFrame.size.width - oldFrame.size.width) / 2, newFrame.origin.y + (newFrame.size.height - oldFrame.size.height) / 2, oldFrame.size.width, oldFrame.size.height);
+ [window setLevel:NSScreenSaverWindowLevel];
+ [window setFrame:newFrame display:NO animate:NO];
+
+ CGRect rect = CGRectMake(newFrame.origin.x, newFrame.origin.y, webViewSize.width, webViewSize.height);
+ CGDirectDisplayID displayID;
+ CGDisplayCount count;
+ if (CGGetDisplaysWithRect(rect, 1, &displayID, &count) == kCGErrorSuccess) {
+ CGRect bounds = CGDisplayBounds(displayID);
+ rect.origin.x -= bounds.origin.x;
+ rect.origin.y -= bounds.origin.y;
+
+ CGLPixelFormatAttribute attributes[] = {kCGLPFAAccelerated, kCGLPFANoRecovery, kCGLPFAFullScreen, kCGLPFADisplayMask, (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(displayID), (CGLPixelFormatAttribute)0};
+ CGLPixelFormatObj pixelFormat;
+ GLint num;
+ if (CGLChoosePixelFormat(attributes, &pixelFormat, &num) == kCGLNoError) {
+ CGLContextObj cgl_ctx;
+ if (CGLCreateContext(pixelFormat, 0, &cgl_ctx) == kCGLNoError) {
+ if (CGLSetFullScreen(cgl_ctx) == kCGLNoError) {
+ void *flipBuffer = calloc(pixelsHigh, rowBytes);
+ if (flipBuffer) {
+ glPixelStorei(GL_PACK_ROW_LENGTH, rowBytes / 4);
+ glPixelStorei(GL_PACK_ALIGNMENT, 4);
+#if __BIG_ENDIAN__
+ glReadPixels(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, flipBuffer);
+#else
+ glReadPixels(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, flipBuffer);
+#endif
+ if (!glGetError()) {
+ for(size_t i = 0; i < pixelsHigh; ++i)
+ bcopy((char*)flipBuffer + rowBytes * i, (char*)buffer + rowBytes * (pixelsHigh - i - 1), pixelsWide * 4);
+ }
+
+ free(flipBuffer);
+ }
+ }
+ CGLDestroyContext(cgl_ctx);
+ }
+ CGLDestroyPixelFormat(pixelFormat);
+ }
+ }
+
+ [window setFrame:oldFrame display:NO animate:NO];
+ [window setLevel:oldLevel];
+#endif
+ } else {
+ // 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 displayIfNeeded];
+ [view lockFocus];
+ NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]] autorelease];
+ [view unlockFocus];
+
+ RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
+ [NSGraphicsContext setCurrentContext:nsContext];
+ [imageRep draw];
+ [NSGraphicsContext setCurrentContext:savedContext.get()];
+ }
+ }
-CGRect getSelectionRect()
-{
- NSView *documentView = [[mainFrame frameView] documentView];
- if ([documentView conformsToProtocol:@protocol(WebDocumentSelection)]) {
+ if (drawSelectionRect) {
+ NSView *documentView = [[mainFrame frameView] documentView];
+ ASSERT([documentView conformsToProtocol:@protocol(WebDocumentSelection)]);
NSRect rect = [documentView convertRect:[(id <WebDocumentSelection>)documentView selectionRect] fromView:nil];
- return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+ 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);
}
-
- ASSERT_NOT_REACHED();
- return CGRectZero;
+
+ return bitmapContext.release();
}
diff --git a/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
index cc0eb4a..5d2e2b4 100644
--- a/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/ResourceLoadDelegate.mm
@@ -31,6 +31,7 @@
#import "DumpRenderTree.h"
#import "LayoutTestController.h"
#import <WebKit/WebKit.h>
+#import <WebKit/WebTypesInternal.h>
#import <wtf/Assertions.h>
@interface NSURL (DRTExtras)
@@ -54,12 +55,12 @@
{
NSString *str = [NSString stringWithFormat:@"<NSError domain %@, code %d", [self domain], [self code]];
NSURL *failingURL;
-
+
if ((failingURL = [[self userInfo] objectForKey:@"NSErrorFailingURLKey"]))
str = [str stringByAppendingFormat:@", failing URL \"%@\"", [failingURL _drt_descriptionSuitableForTestResult]];
-
+
str = [str stringByAppendingFormat:@">"];
-
+
return str;
}
@@ -75,9 +76,9 @@
WebDataSource *dataSource = [mainFrame dataSource];
if (!dataSource)
dataSource = [mainFrame provisionalDataSource];
-
+
NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent];
-
+
return [[self path] substringFromIndex:[basePath length] + 1];
}
@@ -106,24 +107,35 @@
- webView: (WebView *)wv identifierForInitialRequest: (NSURLRequest *)request fromDataSource: (WebDataSource *)dataSource
{
ASSERT([[dataSource webFrame] dataSource] || [[dataSource webFrame] provisionalDataSource]);
-
- if (!done && layoutTestController->dumpResourceLoadCallbacks())
+
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks())
return [[request URL] _drt_descriptionSuitableForTestResult];
-
+
return @"<unknown>";
}
-(NSURLRequest *)webView: (WebView *)wv resource:identifier willSendRequest: (NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - willSendRequest %@ redirectResponse %@", identifier, [newRequest _drt_descriptionSuitableForTestResult],
[redirectResponse _drt_descriptionSuitableForTestResult]];
- printf ("%s\n", [string UTF8String]);
- }
-
- if (disallowedURLs && CFSetContainsValue(disallowedURLs, [newRequest URL]))
+ printf("%s\n", [string UTF8String]);
+ }
+
+ NSURL *url = [newRequest URL];
+ NSString *host = [url host];
+ if (host
+ && (NSOrderedSame == [[url scheme] caseInsensitiveCompare:@"http"] || NSOrderedSame == [[url scheme] caseInsensitiveCompare:@"https"])
+ && NSOrderedSame != [host compare:@"127.0.0.1"]
+ && NSOrderedSame != [host compare:@"255.255.255.255"] // used in some tests that expect to get back an error
+ && NSOrderedSame != [host caseInsensitiveCompare:@"localhost"]) {
+ printf("Blocked access to external URL %s\n", [[url absoluteString] cStringUsingEncoding:NSUTF8StringEncoding]);
return nil;
-
+ }
+
+ if (disallowedURLs && CFSetContainsValue(disallowedURLs, url))
+ return nil;
+
return newRequest;
}
@@ -137,41 +149,44 @@
-(void)webView: (WebView *)wv resource:identifier didReceiveResponse: (NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didReceiveResponse %@", identifier, [response _drt_descriptionSuitableForTestResult]];
- printf ("%s\n", [string UTF8String]);
- }
+ printf("%s\n", [string UTF8String]);
+ }
}
--(void)webView: (WebView *)wv resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
+-(void)webView: (WebView *)wv resource:identifier didReceiveContentLength: (NSInteger)length fromDataSource:(WebDataSource *)dataSource
{
}
-(void)webView: (WebView *)wv resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoading", identifier];
- printf ("%s\n", [string UTF8String]);
+ printf("%s\n", [string UTF8String]);
}
}
-(void)webView: (WebView *)wv resource:identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadingWithError: %@", identifier, [error _drt_descriptionSuitableForTestResult]];
- printf ("%s\n", [string UTF8String]);
+ 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 && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
NSString *string = [NSString stringWithFormat:@"%@ - willCacheResponse: called", identifier];
- printf ("%s\n", [string UTF8String]);
+ printf("%s\n", [string UTF8String]);
}
return response;
}
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
index 29f3ddd..0c5a93c 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
@@ -84,10 +84,18 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
return defaultText;
}
+- (BOOL)webView:(WebView *)c runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
+{
+ if (!done)
+ printf("CONFIRM NAVIGATION: %s\n", [message UTF8String]);
+ return YES;
+}
+
+
- (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);
- if (layoutTestController->addFileToPasteboardOnDrag()) {
+ if (gLayoutTestController->addFileToPasteboardOnDrag()) {
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
[pboard setPropertyList:[NSArray arrayWithObject:@"DRTFakeFile"] forType:NSFilenamesPboardType];
}
@@ -97,19 +105,21 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
- (void)webViewFocus:(WebView *)webView
{
- layoutTestController->setWindowIsKey(true);
- NSView *documentView = [[mainFrame frameView] documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]])
- [(WebHTMLView *)documentView _updateFocusedAndActiveState];
+ gLayoutTestController->setWindowIsKey(true);
+}
+
+- (void)webViewUnfocus:(WebView *)webView
+{
+ gLayoutTestController->setWindowIsKey(false);
}
- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
{
- if (!layoutTestController->canOpenWindows())
+ if (!gLayoutTestController->canOpenWindows())
return nil;
// Make sure that waitUntilDone has been called.
- ASSERT(layoutTestController->waitToDump());
+ ASSERT(gLayoutTestController->waitToDump());
WebView *webView = createWebViewAndOffscreenWindow();
@@ -120,7 +130,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
{
NSWindow* window = [sender window];
- if (layoutTestController->callCloseOnWebViews())
+ if (gLayoutTestController->callCloseOnWebViews())
[sender close];
[window close];
@@ -128,10 +138,19 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier
{
- static const unsigned long long defaultQuota = 5 * 1024 * 1024;
+ if (!done && gLayoutTestController->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 setQuota:defaultQuota];
}
+- (void)webView:(WebView *)sender setStatusText:(NSString *)text
+{
+ if (gLayoutTestController->dumpStatusCallbacks())
+ printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", [text UTF8String]);
+}
- (void)dealloc
{
diff --git a/WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp b/WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp
index a305414..3ac257d 100644
--- a/WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp
+++ b/WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp
@@ -65,18 +65,20 @@ void* runJavaScriptThread(void* arg)
JSStringRef scriptRef = JSStringCreateWithUTF8CString(script);
JSValueRef exception = 0;
- JSEvaluateScript(ctx, scriptRef, 0, 0, 0, &exception);
+ JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception);
ASSERT(!exception);
+ JSGarbageCollect(ctx);
JSGlobalContextRelease(ctx);
JSStringRelease(scriptRef);
- JSGarbageCollect(ctx);
+ JSGarbageCollect(0);
pthread_mutex_lock(&javaScriptThreadsMutex);
// Check for cancellation.
if (javaScriptThreadsShouldTerminate) {
+ javaScriptThreads()->remove(pthread_self());
pthread_mutex_unlock(&javaScriptThreadsMutex);
return 0;
}
@@ -122,9 +124,14 @@ void stopJavaScriptThreads()
pthread_mutex_unlock(&javaScriptThreadsMutex);
- ThreadSet::iterator end = javaScriptThreads()->end();
- for (ThreadSet::iterator it = javaScriptThreads()->begin(); it != end; ++it) {
- pthread_t pthread = *it;
- pthread_join(pthread, 0);
+ while (true) {
+ pthread_mutex_lock(&javaScriptThreadsMutex);
+ int threadCount = javaScriptThreads()->size();
+ pthread_mutex_unlock(&javaScriptThreadsMutex);
+
+ if (!threadCount)
+ break;
+
+ usleep(1000);
}
}
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp
index 5df8a38..07075ba 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +30,7 @@
#include "DumpRenderTree.h"
#include "jsobjects.h"
+#include "testplugin.h"
#include <QDir>
#include <QFile>
@@ -46,8 +48,10 @@
#include <unistd.h>
#include <qdebug.h>
+
extern void qt_drt_run(bool b);
extern void qt_dump_set_accepts_editing(bool b);
+extern void qt_dump_frame_loader(bool b);
namespace WebCore {
@@ -61,10 +65,10 @@ class WebPage : public QWebPage {
public:
WebPage(QWidget *parent, DumpRenderTree *drt);
- QWebPage *createWindow();
+ QWebPage *createWindow(QWebPage::WebWindowType);
void javaScriptAlert(QWebFrame *frame, const QString& message);
- void javaScriptConsoleMessage(const QString& message, unsigned int lineNumber, const QString& sourceID);
+ void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID);
bool javaScriptConfirm(QWebFrame *frame, const QString& msg);
bool javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result);
@@ -85,11 +89,13 @@ WebPage::WebPage(QWidget *parent, DumpRenderTree *drt)
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
settings()->setAttribute(QWebSettings::LinksIncludedInFocusChain, false);
- connect(this, SIGNAL(geometryChangeRequest(const QRect &)),
+ connect(this, SIGNAL(geometryChangeRequested(const QRect &)),
this, SLOT(setViewGeometry(const QRect & )));
+
+ setPluginFactory(new TestPlugin(this));
}
-QWebPage *WebPage::createWindow()
+QWebPage *WebPage::createWindow(QWebPage::WebWindowType)
{
return m_drt->createWindow();
}
@@ -99,7 +105,7 @@ void WebPage::javaScriptAlert(QWebFrame *frame, const QString& message)
fprintf(stdout, "ALERT: %s\n", message.toUtf8().constData());
}
-void WebPage::javaScriptConsoleMessage(const QString& message, unsigned int lineNumber, const QString&)
+void WebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString&)
{
fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData());
}
@@ -130,9 +136,11 @@ DumpRenderTree::DumpRenderTree()
view->setPage(m_page);
connect(m_page, SIGNAL(frameCreated(QWebFrame *)), this, SLOT(connectFrame(QWebFrame *)));
connectFrame(m_page->mainFrame());
-
- m_page->mainFrame()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- m_page->mainFrame()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ connect(m_page, SIGNAL(loadFinished(bool)), m_controller, SLOT(maybeDump(bool)));
+
+ m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+ m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString&)),
SLOT(titleChanged(const QString&)));
@@ -168,7 +176,16 @@ void DumpRenderTree::open()
void DumpRenderTree::open(const QUrl& url)
{
+ // W3C SVG tests expect to be 480x360
+ bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1");
+ int width = isW3CTest ? 480 : maxViewWidth;
+ int height = isW3CTest ? 360 : maxViewHeight;
+ m_page->view()->resize(QSize(width, height));
+ m_page->setViewportSize(QSize(width, height));
+
resetJSObjects();
+
+ qt_dump_frame_loader(url.toString().contains("loading/"));
m_page->mainFrame()->load(url);
}
@@ -181,8 +198,14 @@ void DumpRenderTree::readStdin(int /* socket */)
//fprintf(stderr, "\n opening %s\n", line.constData());
if (line.isEmpty())
quit();
- QFileInfo fi(line);
- open(QUrl::fromLocalFile(fi.absoluteFilePath()));
+
+ if (line.startsWith("http:") || line.startsWith("https:"))
+ open(QUrl(line));
+ else {
+ QFileInfo fi(line);
+ open(QUrl::fromLocalFile(fi.absoluteFilePath()));
+ }
+
fflush(stdout);
}
@@ -198,9 +221,9 @@ void DumpRenderTree::initJSObjects()
{
QWebFrame *frame = qobject_cast<QWebFrame*>(sender());
Q_ASSERT(frame);
- frame->addToJSWindowObject(QLatin1String("layoutTestController"), m_controller);
- frame->addToJSWindowObject(QLatin1String("eventSender"), m_eventSender);
- frame->addToJSWindowObject(QLatin1String("textInputController"), m_textInputController);
+ frame->addToJavaScriptWindowObject(QLatin1String("layoutTestController"), m_controller);
+ frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender);
+ frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController);
}
@@ -213,11 +236,11 @@ QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame)
QWebFrame *parent = qobject_cast<QWebFrame *>(frame->parent());
if (parent) {
result.append(QLatin1String("\n--------\nFrame: '"));
- result.append(frame->name());
+ result.append(frame->frameName());
result.append(QLatin1String("'\n--------\n"));
}
- result.append(frame->innerText());
+ result.append(frame->toPlainText());
result.append(QLatin1String("\n"));
if (m_controller->shouldDumpChildrenAsText()) {
@@ -236,7 +259,7 @@ void DumpRenderTree::dump()
//fprintf(stderr, " Dumping\n");
if (!m_notifier) {
// Dump markup in single file mode...
- QString markup = frame->markup();
+ QString markup = frame->toHtml();
fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData());
}
@@ -257,6 +280,10 @@ void DumpRenderTree::dump()
fflush(stdout);
+ fprintf(stderr, "#EOF\n");
+
+ fflush(stderr);
+
if (!m_notifier) {
// Exit now in single file mode...
quit();
@@ -271,14 +298,9 @@ void DumpRenderTree::titleChanged(const QString &s)
void DumpRenderTree::connectFrame(QWebFrame *frame)
{
- connect(frame, SIGNAL(cleared()), this, SLOT(initJSObjects()));
+ connect(frame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(initJSObjects()));
connect(frame, SIGNAL(provisionalLoad()),
layoutTestController(), SLOT(provisionalLoad()));
-
- if (frame == m_page->mainFrame()) {
- connect(frame, SIGNAL(loadDone(bool)),
- layoutTestController(), SLOT(maybeDump(bool)));
- }
}
QWebPage *DumpRenderTree::createWindow()
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h
index b939fad..a46cccb 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h
@@ -33,8 +33,11 @@
#include <QObject>
#include <QTextStream>
#include <QSocketNotifier>
+
+QT_BEGIN_NAMESPACE
class QUrl;
class QFile;
+QT_END_NAMESPACE
class QWebPage;
class QWebFrame;
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
index 8c3dbbf..08f1ab7 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
@@ -16,3 +16,7 @@ SOURCES = DumpRenderTree.cpp main.cpp jsobjects.cpp testplugin.cpp
unix:!mac {
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
}
+
+qt-port:lessThan(QT_MINOR_VERSION, 4) {
+ DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
+}
diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp b/WebKitTools/DumpRenderTree/qt/jsobjects.cpp
index 78a93fe..98603ad 100644
--- a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp
+++ b/WebKitTools/DumpRenderTree/qt/jsobjects.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,6 +35,7 @@
#include "DumpRenderTree.h"
extern void qt_dump_editing_callbacks(bool b);
+extern void qt_dump_resource_load_callbacks(bool b);
LayoutTestController::LayoutTestController(WebCore::DumpRenderTree *drt)
: QObject()
@@ -58,14 +59,11 @@ void LayoutTestController::reset()
}
m_topLoadingFrame = 0;
qt_dump_editing_callbacks(false);
+ qt_dump_resource_load_callbacks(false);
}
void LayoutTestController::maybeDump(bool ok)
{
- QWebFrame *frame = qobject_cast<QWebFrame*>(sender());
- if (frame != m_topLoadingFrame)
- return;
-
m_topLoadingFrame = 0;
if (!shouldWaitUntilDone()) {
@@ -109,6 +107,11 @@ void LayoutTestController::dumpEditingCallbacks()
qt_dump_editing_callbacks(true);
}
+void LayoutTestController::dumpResourceLoadCallbacks()
+{
+ qt_dump_resource_load_callbacks(true);
+}
+
void LayoutTestController::queueReload()
{
//qDebug() << ">>>queueReload";
diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.h b/WebKitTools/DumpRenderTree/qt/jsobjects.h
index 511e857..4ee6439 100644
--- a/WebKitTools/DumpRenderTree/qt/jsobjects.h
+++ b/WebKitTools/DumpRenderTree/qt/jsobjects.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -68,6 +68,7 @@ public slots:
void waitUntilDone();
void notifyDone();
void dumpEditingCallbacks();
+ void dumpResourceLoadCallbacks();
void queueReload();
void provisionalLoad();
void setCloseRemainingWindowsWhenComplete(bool=false) {}
diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp
index dd4c0e9..8c4bc9c 100644
--- a/WebKitTools/DumpRenderTree/qt/main.cpp
+++ b/WebKitTools/DumpRenderTree/qt/main.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,7 +28,6 @@
*/
#include "DumpRenderTree.h"
-#include "testplugin.h"
#include <qstringlist.h>
#include <qapplication.h>
@@ -49,10 +48,6 @@
#include <execinfo.h>
#endif
-#if QT_VERSION < 0x040400
-Q_IMPORT_PLUGIN(testplugin)
-#endif
-
void messageHandler(QtMsgType type, const char *message)
{
if (type == QtCriticalMsg) {
@@ -162,7 +157,9 @@ int main(int argc, char* argv[])
dumper.open();
} else {
if (!args.last().startsWith("/")
- && !args.last().startsWith("file:")) {
+ && !args.last().startsWith("file:")
+ && !args.last().startsWith("http:")
+ && !args.last().startsWith("https:")) {
QString path = QDir::currentPath();
if (!path.endsWith('/'))
path.append('/');
diff --git a/WebKitTools/DumpRenderTree/qt/testplugin.cpp b/WebKitTools/DumpRenderTree/qt/testplugin.cpp
index 27558c9..54431e9 100644
--- a/WebKitTools/DumpRenderTree/qt/testplugin.cpp
+++ b/WebKitTools/DumpRenderTree/qt/testplugin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +27,8 @@
*/
#include "testplugin.h"
-#if QT_VERSION < 0x040400
-
TestPlugin::TestPlugin(QObject *parent)
- : QWebObjectPlugin(parent)
+ : QWebPluginFactory(parent)
{
}
@@ -38,34 +36,32 @@ TestPlugin::~TestPlugin()
{
}
-QStringList TestPlugin::keys() const
+QList<QWebPluginFactory::Plugin> TestPlugin::plugins() const
{
- return QStringList(QLatin1String("testplugin"));
-}
+ QWebPluginFactory::Plugin plugin;
-QString TestPlugin::descriptionForKey(const QString &) const
-{
- return QLatin1String("testdescription");
-}
+ plugin.name = "testplugin";
+ plugin.description = "testdescription";
+ MimeType mimeType;
+ mimeType.name = "testtype";
+ mimeType.fileExtensions.append("testsuffixes");
+ plugin.mimeTypes.append(mimeType);
-QStringList TestPlugin::mimetypesForKey(const QString &) const
-{
- return QStringList(QLatin1String("testtype"));
-}
+ plugin.name = "testplugin2";
+ plugin.description = "testdescription2";
+ mimeType.name = "testtype2";
+ mimeType.fileExtensions.append("testsuffixes2");
+ mimeType.fileExtensions.append("testsuffixes3");
+ plugin.mimeTypes.append(mimeType);
-QStringList TestPlugin::extensionsForMimetype(const QString &) const
-{
- return QStringList(QLatin1String("testsuffixes"));
+ return QList<QWebPluginFactory::Plugin>() << plugin;
}
-QObject *TestPlugin::create(QWebObjectPluginConnector *,
- const QUrl &,
- const QString &,
- const QStringList &,
- const QStringList &) const
+QObject *TestPlugin::create(const QString &mimeType,
+ const QUrl &url,
+ const QStringList &argumentNames,
+ const QStringList &argumentValues) const
{
return 0;
}
-Q_EXPORT_PLUGIN2(testplugin, TestPlugin)
-#endif
diff --git a/WebKitTools/DumpRenderTree/qt/testplugin.h b/WebKitTools/DumpRenderTree/qt/testplugin.h
index e305069..3d8a28c 100644
--- a/WebKitTools/DumpRenderTree/qt/testplugin.h
+++ b/WebKitTools/DumpRenderTree/qt/testplugin.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,28 +25,21 @@
* (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 <qglobal.h>
-#if QT_VERSION < 0x040400
-#define QT_STATICPLUGIN
-#include <qwebobjectplugin.h>
+#include <qwebpluginfactory.h>
-class TestPlugin : public QWebObjectPlugin
+class TestPlugin : public QWebPluginFactory
{
public:
explicit TestPlugin(QObject *parent = 0);
virtual ~TestPlugin();
- virtual QStringList keys() const;
+ virtual QList<Plugin> plugins() const;
- virtual QString descriptionForKey(const QString &key) const;
- virtual QStringList mimetypesForKey(const QString &key) const;
- virtual QStringList extensionsForMimetype(const QString &mimeType) const;
- virtual QObject *create(QWebObjectPluginConnector *connector,
+ virtual QObject *create(const QString &mimeType,
const QUrl &url,
- const QString &mimeType,
const QStringList &argumentNames,
const QStringList &argumentValues) const;
+
};
-#endif
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
new file mode 100644
index 0000000..b6e45f2
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "AccessibilityController.h"
+
+#include "AccessibilityUIElement.h"
+#include "DumpRenderTree.h"
+#include <JavaScriptCore/Assertions.h>
+#include <WebCore/COMPtr.h>
+#include <WebKit/WebKit.h>
+#include <oleacc.h>
+
+AccessibilityController::AccessibilityController()
+{
+}
+
+AccessibilityController::~AccessibilityController()
+{
+}
+
+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;
+}
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
new file mode 100644
index 0000000..d835bb3
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
@@ -0,0 +1,266 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "AccessibilityUIElement.h"
+
+#include <JavaScriptCore/JSStringRef.h>
+#include <tchar.h>
+#include <string>
+
+using std::wstring;
+
+AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
+ : m_element(element)
+{
+}
+
+AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
+ : m_element(other.m_element)
+{
+}
+
+AccessibilityUIElement::~AccessibilityUIElement()
+{
+}
+
+void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>&)
+{
+}
+
+void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
+{
+}
+
+void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
+{
+ long childCount;
+ if (FAILED(m_element->get_accChildCount(&childCount)))
+ return;
+ for (long i = 0; i < childCount; ++i)
+ children.append(getChildAtIndex(i));
+}
+
+AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
+{
+ 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);
+}
+
+JSStringRef AccessibilityUIElement::allAttributes()
+{
+ return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
+{
+ return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
+{
+ return JSStringCreateWithCharacters(0, 0);
+}
+AccessibilityUIElement AccessibilityUIElement::titleUIElement()
+{
+ return 0;
+}
+
+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()
+{
+ VARIANT vRole;
+ if (FAILED(m_element->get_accRole(self(), &vRole)))
+ return JSStringCreateWithCharacters(0, 0);
+ ASSERT(V_VT(&vRole) == VT_I4);
+ TCHAR roleText[64] = {0};
+ ::GetRoleText(V_I4(&vRole), roleText, ARRAYSIZE(roleText));
+ return JSStringCreateWithCharacters(roleText, _tcslen(roleText));
+}
+
+JSStringRef AccessibilityUIElement::title()
+{
+ 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()
+{
+ BSTR descriptionBSTR;
+ if (FAILED(m_element->get_accName(self(), &descriptionBSTR)) || !descriptionBSTR)
+ return JSStringCreateWithCharacters(0, 0);
+ wstring description(descriptionBSTR, SysStringLen(descriptionBSTR));
+ ::SysFreeString(descriptionBSTR);
+ return JSStringCreateWithCharacters(description.data(), description.length());
+}
+
+double AccessibilityUIElement::width()
+{
+ long x, y, width, height;
+ if (FAILED(m_element->accLocation(&x, &y, &width, &height, self())))
+ return 0;
+ return width;
+}
+
+double AccessibilityUIElement::height()
+{
+ long x, y, width, height;
+ if (FAILED(m_element->accLocation(&x, &y, &width, &height, self())))
+ return 0;
+ return height;
+}
+
+double AccessibilityUIElement::intValue()
+{
+ 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::supportsPressAction()
+{
+ 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);
+}
+
+AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
+{
+ return 0;
+}
+
+JSStringRef AccessibilityUIElement::selectedTextRange()
+{
+ return JSStringCreateWithCharacters(0, 0);
+}
+
+void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
+{
+}
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index c0d0577..b3b73a9 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DumpRenderTree.h"
#include "EditingDelegate.h"
@@ -37,31 +38,26 @@
#include "UIDelegate.h"
#include "WorkQueueItem.h"
#include "WorkQueue.h"
+
+#include <fcntl.h>
+#include <io.h>
+#include <math.h>
+#include <pthread.h>
+#include <shlwapi.h>
+#include <stdio.h>
+#include <string.h>
+#include <tchar.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
-#include <WebCore/COMPtr.h>
-#include <CoreFoundation/CoreFoundation.h>
+#include <windows.h>
#include <CFNetwork/CFURLCachePriv.h>
+#include <CoreFoundation/CoreFoundation.h>
#include <JavaScriptCore/JavaScriptCore.h>
-#include <math.h>
-#include <pthread.h>
-#include <string>
-#include <tchar.h>
-#include <WebKit/DOMPrivate.h>
-#include <WebKit/IWebFramePrivate.h>
-#include <WebKit/IWebHistoryItem.h>
-#include <WebKit/IWebHistoryItemPrivate.h>
-#include <WebKit/IWebPreferencesPrivate.h>
-#include <WebKit/IWebURLResponse.h>
-#include <WebKit/IWebViewPrivate.h>
+#include <WebCore/COMPtr.h>
+#include <WebKit/ForEachCoClass.h>
#include <WebKit/WebKit.h>
-#include <fcntl.h>
-#include <io.h>
-#include <windows.h>
-#include <stdio.h>
-#include <shlwapi.h>
-using std::wstring;
+using namespace std;
#ifndef NDEBUG
const LPWSTR TestPluginDir = L"TestNetscapePlugin_Debug";
@@ -79,12 +75,10 @@ static bool dumpPixels;
static bool dumpAllPixels;
static bool printSeparators;
static bool leakChecking = false;
-static bool timedOut = false;
static bool threaded = false;
+static bool forceComplexText = false;
static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
-static const char* currentTest;
-
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
@@ -101,12 +95,9 @@ COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate;
IWebFrame* frame;
HWND webViewWindow;
-LayoutTestController* layoutTestController = 0;
+LayoutTestController* gLayoutTestController = 0;
CFRunLoopTimerRef waitToDumpWatchdog = 0;
-static const unsigned timeoutValue = 60000;
-static const unsigned timeoutId = 10;
-
const unsigned maxViewWidth = 800;
const unsigned maxViewHeight = 600;
@@ -126,12 +117,6 @@ wstring urlSuitableForTestResult(const wstring& url)
static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_TIMER:
- // The test ran long enough to time out
- timedOut = true;
- PostQuitMessage(0);
- return 0;
- break;
case WM_DESTROY:
for (unsigned i = openWindows().size() - 1; i >= 0; --i) {
if (openWindows()[i] == hWnd) {
@@ -230,7 +215,16 @@ static void initialize()
TEXT("Times Bold.ttf"),
TEXT("Times Italic.ttf"),
TEXT("Times Roman.ttf"),
- TEXT("WebKit Layout Tests.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();
@@ -293,7 +287,7 @@ void dumpFrameScrollPosition(IWebFrame* frame)
printf("scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy);
}
- if (::layoutTestController->dumpChildFrameScrollPositions()) {
+ if (::gLayoutTestController->dumpChildFrameScrollPositions()) {
COMPtr<IEnumVARIANT> enumKids;
if (FAILED(frame->childFrames(&enumKids)))
return;
@@ -350,7 +344,7 @@ static wstring dumpFramesAsText(IWebFrame* frame)
SysFreeString(innerText);
- if (::layoutTestController->dumpChildFramesAsText()) {
+ if (::gLayoutTestController->dumpChildFramesAsText()) {
COMPtr<IEnumVARIANT> enumKids;
if (FAILED(frame->childFrames(&enumKids)))
return L"";
@@ -553,7 +547,7 @@ void dump()
if (SUCCEEDED(dataSource->response(&response)) && response) {
BSTR mimeType;
if (SUCCEEDED(response->MIMEType(&mimeType)))
- ::layoutTestController->setDumpAsText(::layoutTestController->dumpAsText() | !_tcscmp(mimeType, TEXT("text/plain")));
+ ::gLayoutTestController->setDumpAsText(::gLayoutTestController->dumpAsText() | !_tcscmp(mimeType, TEXT("text/plain")));
SysFreeString(mimeType);
}
}
@@ -561,13 +555,13 @@ void dump()
BSTR resultString = 0;
if (dumpTree) {
- if (::layoutTestController->dumpAsText()) {
+ if (::gLayoutTestController->dumpAsText()) {
::InvalidateRect(webViewWindow, 0, TRUE);
::SendMessage(webViewWindow, WM_PAINT, 0, 0);
wstring result = dumpFramesAsText(frame);
resultString = SysAllocStringLen(result.data(), result.size());
} else {
- bool isSVGW3CTest = strstr(currentTest, "svg\\W3C-SVG-1.1");
+ bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg\\W3C-SVG-1.1") != string::npos);
unsigned width;
unsigned height;
if (isSVGW3CTest) {
@@ -589,7 +583,7 @@ void dump()
}
if (!resultString)
- printf("ERROR: nil result from %s", ::layoutTestController->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation");
+ printf("ERROR: nil result from %s", ::gLayoutTestController->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation");
else {
unsigned stringLength = SysStringLen(resultString);
int bufferSize = ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, 0, 0, 0, 0);
@@ -597,23 +591,28 @@ void dump()
::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, buffer, bufferSize + 1, 0, 0);
fwrite(buffer, 1, bufferSize, stdout);
free(buffer);
- if (!::layoutTestController->dumpAsText())
+ if (!::gLayoutTestController->dumpAsText())
dumpFrameScrollPosition(frame);
}
- if (::layoutTestController->dumpBackForwardList())
+ if (::gLayoutTestController->dumpBackForwardList())
dumpBackForwardListForAllWindows();
}
- if (printSeparators)
- puts("#EOF");
+ if (printSeparators) {
+ puts("#EOF"); // terminate the content block
+ fputs("#EOF\n", stderr);
+ fflush(stdout);
+ fflush(stderr);
+ }
if (dumpPixels) {
- if (layoutTestController->dumpAsText() || layoutTestController->dumpDOMAsWebArchive() || layoutTestController->dumpSourceAsWebArchive())
- printf("#EOF\n");
- else
- dumpWebViewAsPixelsAndCompareWithExpected(currentTest, dumpAllPixels);
+ if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive())
+ dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
}
+ printf("#EOF\n"); // terminate the (possibly empty) pixels block
+ fflush(stdout);
+
fail:
SysFreeString(resultString);
// This will exit from our message loop
@@ -635,8 +634,10 @@ static void resetWebViewToConsistentStateBeforeTesting()
webView->setPolicyDelegate(0);
COMPtr<IWebIBActions> webIBActions(Query, webView);
- if (webIBActions)
+ if (webIBActions) {
webIBActions->makeTextStandardSize(0);
+ webIBActions->resetPageZoom(0);
+ }
COMPtr<IWebPreferences> preferences;
if (SUCCEEDED(webView->preferences(&preferences))) {
@@ -654,26 +655,48 @@ static void resetWebViewToConsistentStateBeforeTesting()
preferences->setUserStyleSheetEnabled(FALSE);
COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
- if (prefsPrivate)
+ if (prefsPrivate) {
prefsPrivate->setAuthorAndUserStylesEnabled(TRUE);
+ prefsPrivate->setDeveloperExtrasEnabled(FALSE);
+ }
}
+ COMPtr<IWebViewEditing> viewEditing;
+ if (SUCCEEDED(webView->QueryInterface(&viewEditing)))
+ viewEditing->setSmartInsertDeleteEnabled(TRUE);
+
COMPtr<IWebViewPrivate> webViewPrivate(Query, webView);
if (!webViewPrivate)
return;
+ COMPtr<IWebInspector> inspector;
+ if (SUCCEEDED(webViewPrivate->inspector(&inspector)))
+ inspector->setJavaScriptProfilingEnabled(FALSE);
+
HWND viewWindow;
if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow)
SetFocus(viewWindow);
+
+ webViewPrivate->clearMainFrameName();
}
-static void runTest(const char* pathOrURL)
+static void runTest(const string& testPathOrURL)
{
static BSTR methodBStr = SysAllocString(TEXT("GET"));
+ // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
+ string pathOrURL(testPathOrURL);
+ string expectedPixelHash;
+
+ size_t separatorPos = pathOrURL.find("'");
+ if (separatorPos != string::npos) {
+ pathOrURL = string(testPathOrURL, 0, separatorPos);
+ expectedPixelHash = string(testPathOrURL, separatorPos + 1);
+ }
+
BSTR urlBStr;
- CFStringRef str = CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingWindowsLatin1);
+ CFStringRef str = CFStringCreateWithCString(0, pathOrURL.c_str(), kCFStringEncodingWindowsLatin1);
CFURLRef url = CFURLCreateWithString(0, str, 0);
if (!url)
@@ -692,15 +715,12 @@ static void runTest(const char* pathOrURL)
CFRelease(url);
- currentTest = pathOrURL;
-
- ::layoutTestController = new LayoutTestController(false, false);
+ ::gLayoutTestController = new LayoutTestController(pathOrURL, expectedPixelHash);
done = false;
topLoadingFrame = 0;
- timedOut = false;
- if (shouldLogFrameLoadDelegates(pathOrURL))
- layoutTestController->setDumpFrameLoadCallbacks(true);
+ if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
+ gLayoutTestController->setDumpFrameLoadCallbacks(true);
COMPtr<IWebHistory> history(Create, CLSID_WebHistory);
if (history)
@@ -723,15 +743,12 @@ static void runTest(const char* pathOrURL)
HWND hostWindow;
webView->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow));
- // Set the test timeout timer
- SetTimer(hostWindow, timeoutId, timeoutValue, 0);
-
COMPtr<IWebMutableURLRequest> request;
HRESULT hr = CoCreateInstance(CLSID_WebMutableURLRequest, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request);
if (FAILED(hr))
goto exit;
- request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 0);
+ request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 60);
request->setHTTPMethod(methodBStr);
frame->loadRequest(request.get());
@@ -746,19 +763,10 @@ static void runTest(const char* pathOrURL)
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- KillTimer(hostWindow, timeoutId);
-
- if (timedOut) {
- fprintf(stderr, "ERROR: Timed out running %s\n", pathOrURL);
- printf("ERROR: Timed out loading page\n");
-
- if (printSeparators)
- puts("#EOF");
- }
frame->stopLoading();
- if (::layoutTestController->closeRemainingWindowsWhenComplete()) {
+ if (::gLayoutTestController->closeRemainingWindowsWhenComplete()) {
Vector<HWND> windows = openWindows();
unsigned size = windows.size();
for (unsigned i = 0; i < size; i++) {
@@ -774,7 +782,8 @@ static void runTest(const char* pathOrURL)
exit:
SysFreeString(urlBStr);
- delete ::layoutTestController;
+ ::gLayoutTestController->deref();
+ ::gLayoutTestController = 0;
return;
}
@@ -854,7 +863,7 @@ void* runJavaScriptThread(void* arg)
JSStringRef scriptRef = JSStringCreateWithUTF8CString(script);
JSValueRef exception = 0;
- JSEvaluateScript(ctx, scriptRef, 0, 0, 0, &exception);
+ JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception);
assert(!exception);
JSGlobalContextRelease(ctx);
@@ -963,11 +972,12 @@ IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow)
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->addAdditionalPluginPath(pluginPath));
+ failed = FAILED(viewPrivate->addAdditionalPluginDirectory(pluginPath));
SysFreeString(pluginPath);
if (failed)
return 0;
@@ -1016,6 +1026,7 @@ int main(int argc, char* argv[])
leakChecking = false;
_setmode(1, _O_BINARY);
+ _setmode(2, _O_BINARY);
initialize();
@@ -1037,6 +1048,11 @@ int main(int argc, char* argv[])
continue;
}
+ if (!stricmp(argv[i], "--complex-text")) {
+ forceComplexText = true;
+ continue;
+ }
+
tests.append(argv[i]);
}
@@ -1083,7 +1099,6 @@ int main(int argc, char* argv[])
continue;
runTest(filenameBuffer);
- fflush(stdout);
}
} else {
printSeparators = tests.size() > 1;
@@ -1106,5 +1121,7 @@ int main(int argc, char* argv[])
}
#endif
+ shutDownWebKit();
+
return 0;
}
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj
index a357f29..e094bde 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj
@@ -23,7 +23,7 @@
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -39,9 +39,10 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_CONSOLE"
DisableSpecificWarnings="4146"
+ ForcedIncludeFiles="DumpRenderTreePrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -54,7 +55,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
AdditionalLibraryDirectories=""
DelayLoadDLLs=""
SubSystem="1"
@@ -65,6 +66,8 @@
/>
<Tool
Name="VCManifestTool"
+ TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
+ ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
/>
<Tool
Name="VCXDCMakeTool"
@@ -83,7 +86,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="&#x0D;&#x0A;"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;if &quot;$(ARCHIVE_BUILD)&quot;==&quot;&quot; (if not &quot;$(PRODUCTION)&quot;==&quot;&quot; exit /b)&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; exit /b&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CFNetwork.resources&quot; &quot;$(WebKitOutputDir)\bin\CFNetwork.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CharacterSets&quot; &quot;$(WebKitOutputDir)\bin\CharacterSets&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\dnssd.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -95,7 +98,7 @@
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -111,9 +114,10 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_CONSOLE"
DisableSpecificWarnings="4146"
+ ForcedIncludeFiles="DumpRenderTreePrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -126,7 +130,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
AdditionalLibraryDirectories=""
DelayLoadDLLs=""
SubSystem="1"
@@ -137,6 +141,8 @@
/>
<Tool
Name="VCManifestTool"
+ TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
+ ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
/>
<Tool
Name="VCXDCMakeTool"
@@ -155,7 +161,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="&#x0D;&#x0A;"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;if &quot;$(ARCHIVE_BUILD)&quot;==&quot;&quot; (if not &quot;$(PRODUCTION)&quot;==&quot;&quot; exit /b)&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; exit /b&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CFNetwork.resources&quot; &quot;$(WebKitOutputDir)\bin\CFNetwork.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CharacterSets&quot; &quot;$(WebKitOutputDir)\bin\CharacterSets&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\dnssd.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -166,7 +172,7 @@
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -182,9 +188,10 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\.&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)\..\cg&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_CONSOLE;DEBUG_WEBKIT_HAS_SUFFIX"
DisableSpecificWarnings="4146"
+ ForcedIncludeFiles="DumpRenderTreePrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -197,7 +204,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
AdditionalLibraryDirectories=""
DelayLoadDLLs=""
SubSystem="1"
@@ -207,6 +214,8 @@
/>
<Tool
Name="VCManifestTool"
+ TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
+ ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
/>
<Tool
Name="VCXDCMakeTool"
@@ -225,7 +234,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="&#x0D;&#x0A;"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;if &quot;$(ARCHIVE_BUILD)&quot;==&quot;&quot; (if not &quot;$(PRODUCTION)&quot;==&quot;&quot; exit /b)&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; exit /b&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CFNetwork.resources&quot; &quot;$(WebKitOutputDir)\bin\CFNetwork.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CharacterSets&quot; &quot;$(WebKitOutputDir)\bin\CharacterSets&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\dnssd.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
@@ -236,6 +245,18 @@
Name="Controllers"
>
<File
+ RelativePath="..\AccessibilityController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\AccessibilityController.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AccessibilityControllerWin.cpp"
+ >
+ </File>
+ <File
RelativePath=".\EventSender.cpp"
>
</File>
@@ -313,6 +334,18 @@
</File>
</Filter>
<File
+ RelativePath="..\AccessibilityUIElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\AccessibilityUIElement.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AccessibilityUIElementWin.cpp"
+ >
+ </File>
+ <File
RelativePath=".\DraggingInfo.h"
>
</File>
@@ -325,6 +358,10 @@
>
</File>
<File
+ RelativePath="..\DumpRenderTreePrefix.h"
+ >
+ </File>
+ <File
RelativePath=".\DumpRenderTreeWin.h"
>
</File>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h
index 54dc697..45ce0dc 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h
@@ -29,25 +29,6 @@
#ifndef DumpRenderTreeWin_h
#define DumpRenderTreeWin_h
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-
-#undef WINVER
-#define WINVER 0x0500
-
-// 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
-
-#undef _WINSOCKAPI_
-#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
-
-// FIXME: we should add a config.h file for DumpRenderTree.
-#define WTF_PLATFORM_CF 1
-
struct IWebFrame;
struct IWebPolicyDelegate;
struct IWebView;
diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp b/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp
index 7add64e..32c02bd 100644
--- a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp
@@ -26,9 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "EditingDelegate.h"
+#include "DumpRenderTree.h"
#include "LayoutTestController.h"
#include <WebCore/COMPtr.h>
#include <wtf/Platform.h>
@@ -127,7 +128,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldBeginEditingInDOMRange(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n"), dump(range));
*result = m_acceptsEditing;
@@ -144,7 +145,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldEndEditingInDOMRange(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n"), dump(range));
*result = m_acceptsEditing;
@@ -163,7 +164,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertNode(
TEXT("WebViewInsertActionDropped"),
};
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n"), dumpPath(node), dump(range), insertactionstring[action]);
return S_OK;
@@ -187,7 +188,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertText(
TEXT("WebViewInsertActionDropped"),
};
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n"), text ? text : TEXT(""), dump(range), insertactionstring[action]);
*result = m_acceptsEditing;
@@ -204,7 +205,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldDeleteDOMRange(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldDeleteDOMRange:%s\n"), dump(range));
*result = m_acceptsEditing;
@@ -233,7 +234,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeSelectedDOMRange(
TEXT("TRUE")
};
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->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;
@@ -251,7 +252,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldApplyStyle(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n"), TEXT("'style description'")/*[[style description] UTF8String]*/, dump(range));
*result = m_acceptsEditing;
@@ -269,7 +270,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeTypingStyle(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n"), TEXT("'currentStyle description'"), TEXT("'proposedStyle description'"));
*result = m_acceptsEditing;
@@ -286,7 +287,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::doPlatformCommand(
return E_POINTER;
}
- if (::layoutTestController->dumpEditingCallbacks() && !done)
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done)
_tprintf(TEXT("EDITING DELEGATE: doPlatformCommand:%s\n"), command ? command : TEXT(""));
*result = m_acceptsEditing;
@@ -296,7 +297,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::doPlatformCommand(
HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidBeginEditing(
/* [in] */ IWebNotification* notification)
{
- if (::layoutTestController->dumpEditingCallbacks() && !done) {
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done) {
BSTR name;
notification->name(&name);
_tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT(""));
@@ -308,7 +309,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidBeginEditing(
HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChange(
/* [in] */ IWebNotification *notification)
{
- if (::layoutTestController->dumpEditingCallbacks() && !done) {
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done) {
BSTR name;
notification->name(&name);
_tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT(""));
@@ -320,7 +321,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChange(
HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidEndEditing(
/* [in] */ IWebNotification *notification)
{
- if (::layoutTestController->dumpEditingCallbacks() && !done) {
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done) {
BSTR name;
notification->name(&name);
_tprintf(TEXT("EDITING DELEGATE: webViewDidEndEditing:%s\n"), name ? name : TEXT(""));
@@ -332,7 +333,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidEndEditing(
HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeTypingStyle(
/* [in] */ IWebNotification *notification)
{
- if (::layoutTestController->dumpEditingCallbacks() && !done) {
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done) {
BSTR name;
notification->name(&name);
_tprintf(TEXT("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n"), name ? name : TEXT(""));
@@ -344,7 +345,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeTypingStyle(
HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeSelection(
/* [in] */ IWebNotification *notification)
{
- if (::layoutTestController->dumpEditingCallbacks() && !done) {
+ if (::gLayoutTestController->dumpEditingCallbacks() && !done) {
BSTR name;
notification->name(&name);
_tprintf(TEXT("EDITING DELEGATE: webViewDidChangeSelection:%s\n"), name ? name : TEXT(""));
diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.h b/WebKitTools/DumpRenderTree/win/EditingDelegate.h
index 4ed74b2..6dba675 100644
--- a/WebKitTools/DumpRenderTree/win/EditingDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/EditingDelegate.h
@@ -29,7 +29,7 @@
#ifndef EditingDelegate_h
#define EditingDelegate_h
-#include <WebKit/IWebEditingDelegate.h>
+#include <WebKit/WebKit.h>
class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate {
public:
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp
index 66d8772..efecc03 100644
--- a/WebKitTools/DumpRenderTree/win/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp
@@ -26,18 +26,18 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "EventSender.h"
#include "DraggingInfo.h"
+#include "DumpRenderTree.h"
#include <WebCore/COMPtr.h>
#include <wtf/ASCIICType.h>
#include <wtf/Platform.h>
#include <JavaScriptCore/JavaScriptCore.h>
#include <JavaScriptCore/Assertions.h>
-#include <WebKit/IWebFrame.h>
-#include <WebKit/IWebFramePrivate.h>
+#include <WebKit/WebKit.h>
#include <windows.h>
#define WM_DRT_SEND_QUEUED_EVENT (WM_APP+1)
@@ -485,8 +485,8 @@ static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function,
if (FAILED(frame->webView(&webView)))
return JSValueMakeUndefined(context);
- COMPtr<IWebIBActions> webIBActions;
- if (FAILED(webView->QueryInterface(IID_IWebIBActions, (void**)&webIBActions)))
+ COMPtr<IWebIBActions> webIBActions(Query, webView);
+ if (!webIBActions)
return JSValueMakeUndefined(context);
webIBActions->makeTextLarger(0);
@@ -499,14 +499,42 @@ static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function
if (FAILED(frame->webView(&webView)))
return JSValueMakeUndefined(context);
- COMPtr<IWebIBActions> webIBActions;
- if (FAILED(webView->QueryInterface(IID_IWebIBActions, (void**)&webIBActions)))
+ 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 JSStaticFunction staticFunctions[] = {
{ "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -517,6 +545,8 @@ static JSStaticFunction staticFunctions[] = {
{ "dispatchMessage", dispatchMessageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
index b436352..b18b961 100644
--- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp
@@ -26,9 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "FrameLoadDelegate.h"
+#include "AccessibilityController.h"
+#include "DumpRenderTree.h"
#include "EventSender.h"
#include "GCController.h"
#include "LayoutTestController.h"
@@ -37,8 +39,7 @@
#include <WebCore/COMPtr.h>
#include <JavaScriptCore/Assertions.h>
#include <JavaScriptCore/JavaScriptCore.h>
-#include <WebKit/IWebFramePrivate.h>
-#include <WebKit/IWebViewPrivate.h>
+#include <WebKit/WebKit.h>
#include <wtf/Vector.h>
#include <stdio.h>
#include <string>
@@ -68,14 +69,13 @@ string descriptionSuitableForTestResult(IWebFrame* webFrame)
if (FAILED(webView->mainFrame(&mainFrame)))
return string();
- if (webFrame == mainFrame)
- return "main frame";
-
BSTR frameNameBSTR;
- if (FAILED(webFrame->name(&frameNameBSTR)))
- return string();
+ if (FAILED(webFrame->name(&frameNameBSTR)) || BSTRtoString(frameNameBSTR).empty() )
+ return (webFrame == mainFrame) ? "main frame" : string();
+
+ string frameName = (webFrame == mainFrame) ? "main frame" : "frame";
+ frameName += " \"" + BSTRtoString(frameNameBSTR) + "\"";
- string frameName = "frame \"" + BSTRtoString(frameNameBSTR) + "\"";
SysFreeString(frameNameBSTR);
return frameName;
@@ -84,6 +84,7 @@ string descriptionSuitableForTestResult(IWebFrame* webFrame)
FrameLoadDelegate::FrameLoadDelegate()
: m_refCount(1)
, m_gcController(new GCController)
+ , m_accessibilityController(new AccessibilityController)
{
}
@@ -128,7 +129,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame(
/* [in] */ IWebView* webView,
/* [in] */ IWebFrame* frame)
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didStartProvisionalLoadForFrame\n",
descriptionSuitableForTestResult(frame).c_str());
@@ -145,7 +146,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError(
/* [in] */ IWebError *error,
/* [in] */ IWebFrame *frame)
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didFailProvisionalLoadWithError\n",
descriptionSuitableForTestResult(frame).c_str());
@@ -162,7 +163,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame(
return hr;
webViewPrivate->updateFocusedAndActiveState();
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didCommitLoadForFrame\n",
descriptionSuitableForTestResult(frame).c_str());
@@ -175,7 +176,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle(
/* [in] */ BSTR title,
/* [in] */ IWebFrame *frame)
{
- if (::layoutTestController->dumpTitleChanges() && !done)
+ if (::gLayoutTestController->dumpTitleChanges() && !done)
printf("TITLE CHANGED: %S\n", title ? title : L"");
return S_OK;
}
@@ -190,7 +191,7 @@ void FrameLoadDelegate::processWork()
}
// if we didn't start a new load, then we finished all the commands, so we're ready to dump state
- if (!topLoadingFrame && !::layoutTestController->waitToDump())
+ if (!topLoadingFrame && !::gLayoutTestController->waitToDump())
dump();
}
@@ -210,7 +211,7 @@ void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame)
topLoadingFrame = 0;
WorkQueue::shared()->setFrozen(true);
- if (::layoutTestController->waitToDump())
+ if (::gLayoutTestController->waitToDump())
return;
if (WorkQueue::shared()->count()) {
@@ -227,7 +228,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame(
/* [in] */ IWebView* webView,
/* [in] */ IWebFrame* frame)
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didFinishLoadForFrame\n",
descriptionSuitableForTestResult(frame).c_str());
@@ -259,12 +260,15 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didClearWindowObject(
{
JSValueRef exception = 0;
- ::layoutTestController->makeWindowObject(context, windowObject, &exception);
+ ::gLayoutTestController->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);
@@ -277,9 +281,22 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishDocumentLoadForFrame(
/* [in] */ IWebView *sender,
/* [in] */ IWebFrame *frame)
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->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;
}
@@ -288,7 +305,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didHandleOnloadEventsForFrame(
/* [in] */ IWebView *sender,
/* [in] */ IWebFrame *frame)
{
- if (!done && layoutTestController->dumpFrameLoadCallbacks())
+ if (!done && gLayoutTestController->dumpFrameLoadCallbacks())
printf("%s - didHandleOnloadEventsForFrame\n",
descriptionSuitableForTestResult(frame).c_str());
diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h
index 8e694be..1a134fc 100644
--- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h
@@ -29,10 +29,10 @@
#ifndef FrameLoadDelegate_h
#define FrameLoadDelegate_h
-#include <WebKit/IWebFrameLoadDelegate.h>
-#include <WebKit/IWebFrameLoadDelegatePrivate.h>
+#include <WebKit/WebKit.h>
#include <wtf/OwnPtr.h>
+class AccessibilityController;
class GCController;
class FrameLoadDelegate : public IWebFrameLoadDelegate2, public IWebFrameLoadDelegatePrivate {
@@ -133,6 +133,7 @@ protected:
ULONG m_refCount;
OwnPtr<GCController> m_gcController;
+ OwnPtr<AccessibilityController> m_accessibilityController;
};
#endif // FrameLoadDelegate_h
diff --git a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp b/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp
index 8c41556..547aabc 100644
--- a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp
@@ -26,11 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "GCController.h"
+#include "DumpRenderTree.h"
#include <WebCore/COMPtr.h>
-#include <WebKit/IWebJavaScriptCollector.h>
#include <WebKit/WebKit.h>
void GCController::collect() const
diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj
index 2dc17c5..9da1a56 100644
--- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj
+++ b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj
@@ -22,6 +22,7 @@
>
<Tool
Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -37,7 +38,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -77,6 +78,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;&#x0D;&#x0A;if &quot;$(ARCHIVE_BUILD)&quot;==&quot;&quot; (if not &quot;$(PRODUCTION)&quot;==&quot;&quot; exit /b)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; exit /b&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CharacterSets&quot; &quot;$(WebKitOutputDir)\bin\CharacterSets&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt38.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -88,6 +90,7 @@
>
<Tool
Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -103,7 +106,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -143,6 +146,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;&#x0D;&#x0A;if &quot;$(ARCHIVE_BUILD)&quot;==&quot;&quot; (if not &quot;$(PRODUCTION)&quot;==&quot;&quot; exit /b)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; exit /b&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CharacterSets&quot; &quot;$(WebKitOutputDir)\bin\CharacterSets&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt38.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 5469cd4..275fcd3 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -6,13 +6,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 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.
+ * 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
@@ -26,9 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "LayoutTestController.h"
+#include "DumpRenderTree.h"
#include "EditingDelegate.h"
#include "PolicyDelegate.h"
#include "WorkQueue.h"
@@ -40,9 +41,6 @@
#include <JavaScriptCore/Assertions.h>
#include <JavaScriptCore/JavaScriptCore.h>
#include <JavaScriptCore/JSRetainPtr.h>
-#include <WebKit/IWebHistory.h>
-#include <WebKit/IWebPreferencesPrivate.h>
-#include <WebKit/IWebViewPrivate.h>
#include <WebKit/WebKit.h>
#include <string>
#include <CoreFoundation/CoreFoundation.h>
@@ -352,9 +350,10 @@ static bool followShortcuts(wstring& path)
return true;
// Do we have a shortcut?
- path.append(TEXT(".lnk"));
- if (!PathFileExists(path.c_str()))
- return false;
+ 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);
@@ -363,7 +362,7 @@ static bool followShortcuts(wstring& path)
COMPtr<IPersistFile> persistFile(Query, shortcut);
if (!shortcut)
return false;
- if (FAILED(persistFile->Load(path.c_str(), STGM_READ)))
+ if (FAILED(persistFile->Load(linkPath.c_str(), STGM_READ)))
return false;
if (FAILED(shortcut->Resolve(0, 0)))
return false;
@@ -391,7 +390,7 @@ static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath)
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)
return false;
@@ -509,6 +508,45 @@ void LayoutTestController::setWindowIsKey(bool flag)
::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0);
}
+void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebViewEditing> viewEditing;
+ if (FAILED(webView->QueryInterface(&viewEditing)))
+ return;
+
+ viewEditing->setSmartInsertDeleteEnabled(flag ? TRUE : FALSE);
+}
+
+void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebViewPrivate> viewPrivate;
+ if (FAILED(webView->QueryInterface(&viewPrivate)))
+ return;
+
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(webView->preferences(&preferences)))
+ return;
+
+ COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+ if (!prefsPrivate)
+ return;
+
+ COMPtr<IWebInspector> inspector;
+ if (FAILED(viewPrivate->inspector(&inspector)))
+ return;
+
+ prefsPrivate->setDeveloperExtrasEnabled(flag);
+ inspector->setJavaScriptProfilingEnabled(flag);
+}
+
static const CFTimeInterval waitToDumpWatchdogInterval = 10.0;
static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info)
@@ -534,6 +572,32 @@ int LayoutTestController::windowCount()
return openWindows().size();
}
+bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
+{
+ COMPtr<IDOMDocument> document;
+ if (FAILED(frame->DOMDocument(&document)))
+ return false;
+
+ wstring idWstring = jsStringRefToWString(id);
+ BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length());
+ COMPtr<IDOMElement> element;
+ HRESULT result = document->getElementById(idBSTR, &element);
+ SysFreeString(idBSTR);
+
+ if (FAILED(result))
+ return false;
+
+ COMPtr<IWebFramePrivate> framePrivate(Query, frame);
+ if (!framePrivate)
+ return false;
+
+ BOOL autoCompletes;
+ if (FAILED(framePrivate->elementDoesAutoComplete(element.get(), &autoCompletes)))
+ return false;
+
+ return autoCompletes;
+}
+
void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
{
wstring wName = jsStringRefToWString(name);
@@ -554,3 +618,13 @@ void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
SysFreeString(nameBSTR);
SysFreeString(valueBSTR);
}
+
+void LayoutTestController::clearAllDatabases()
+{
+ printf("ERROR: LayoutTestController::clearAllDatabases() not implemented\n");
+}
+
+void LayoutTestController::setDatabaseQuota(unsigned long long quota)
+{
+ printf("ERROR: LayoutTestController::setDatabaseQuota() not implemented\n");
+}
diff --git a/WebKitTools/DumpRenderTree/win/MD5.cpp b/WebKitTools/DumpRenderTree/win/MD5.cpp
index 4d4c848..1bfc9c7 100644
--- a/WebKitTools/DumpRenderTree/win/MD5.cpp
+++ b/WebKitTools/DumpRenderTree/win/MD5.cpp
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "MD5.h"
#include <windows.h>
diff --git a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp
index f6dd82d..d0b79e1 100644
--- a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp
@@ -26,14 +26,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "PixelDumpSupportCG.h"
+#include "DumpRenderTree.h"
#include <CoreGraphics/CGBitmapContext.h>
#include <wtf/Assertions.h>
#include <wtf/RetainPtr.h>
-RetainPtr<CGContextRef> getBitmapContextFromWebView()
+PassRefPtr<BitmapContext> getBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
{
RECT frame;
if (!GetWindowRect(webViewWindow, &frame))
@@ -47,8 +48,6 @@ RetainPtr<CGContextRef> getBitmapContextFromWebView()
bmp.bmiHeader.biBitCount = 32;
bmp.bmiHeader.biCompression = BI_RGB;
- // FIXME: Currently we leak this HBITMAP because we don't have a good way
- // to destroy it when the CGBitmapContext gets destroyed.
void* bits = 0;
HBITMAP bitmap = CreateDIBSection(0, &bmp, DIB_RGB_COLORS, &bits, 0, 0);
@@ -62,6 +61,8 @@ RetainPtr<CGContextRef> getBitmapContextFromWebView()
ASSERT(info.bmBitsPixel == 32);
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- return RetainPtr<CGContextRef>(AdoptCF, CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
- info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
+ CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
+ info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
+
+ return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context);
}
diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp
index c6a9fb0..99a1fd7 100644
--- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp
@@ -26,9 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "PolicyDelegate.h"
+#include "DumpRenderTree.h"
+
#include <string>
using std::wstring;
diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h
index d59dd9d..b9844f4 100644
--- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h
@@ -29,7 +29,7 @@
#ifndef PolicyDelegate_h
#define PolicyDelegate_h
-#include <WebKit/IWebPolicyDelegate.h>
+#include <WebKit/WebKit.h>
class PolicyDelegate : public IWebPolicyDelegate {
public:
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
index 0f15648..1e77eda 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
@@ -26,9 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "ResourceLoadDelegate.h"
+#include "DumpRenderTree.h"
#include "LayoutTestController.h"
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
@@ -194,7 +195,7 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::identifierForInitialRequest(
/* [in] */ IWebDataSource* dataSource,
/* [in] */ unsigned long identifier)
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
BSTR urlStr;
if (FAILED(request->URL(&urlStr)))
return E_FAIL;
@@ -213,7 +214,7 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest(
/* [in] */ IWebDataSource* dataSource,
/* [retval][out] */ IWebURLRequest **newRequest)
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
printf("%S - willSendRequest %S redirectResponse %S\n",
descriptionSuitableForTestResult(identifier).c_str(),
descriptionSuitableForTestResult(request).c_str(),
@@ -230,7 +231,7 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource(
/* [in] */ unsigned long identifier,
/* [in] */ IWebDataSource* dataSource)
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
printf("%S - didFinishLoading\n",
descriptionSuitableForTestResult(identifier).c_str()),
urlMap().remove(identifier);
@@ -245,7 +246,7 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError(
/* [in] */ IWebError* error,
/* [in] */ IWebDataSource* dataSource)
{
- if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
printf("%S - didFailLoadingWithError: %S\n",
descriptionSuitableForTestResult(identifier).c_str(),
descriptionSuitableForTestResult(error, identifier).c_str());
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
index 519ee64..e259adc 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h
@@ -29,7 +29,7 @@
#ifndef ResourceLoadDelegate_h
#define ResourceLoadDelegate_h
-#include <WebKit/IWebResourceLoadDelegate.h>
+#include <WebKit/WebKit.h>
class ResourceLoadDelegate : public IWebResourceLoadDelegate {
public:
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj
index 0bc77f6..eced57e 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="TestNetscapePlugin"
ProjectGUID="{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
RootNamespace="TestNetscapePlugin"
@@ -23,6 +23,7 @@
>
<Tool
Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -38,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
/>
<Tool
@@ -79,6 +80,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
/>
</Configuration>
<Configuration
@@ -90,6 +92,7 @@
>
<Tool
Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -105,7 +108,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
/>
<Tool
@@ -146,6 +149,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
/>
</Configuration>
<Configuration
@@ -156,6 +160,7 @@
>
<Tool
Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;if exist &quot;$(WebKitOutputDir)\buildfailed&quot; grep XX$(ProjectName)XX &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;if errorlevel 1 exit 1&#x0D;&#x0A;echo XX$(ProjectName)XX &gt; &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
@@ -171,7 +176,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
/>
@@ -213,6 +218,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;"
/>
</Configuration>
</Configurations>
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c
index 8c542ed..829a32c 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c
@@ -1,34 +1,26 @@
/*
- IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
- the Apple Software without specific prior written permission from Apple. Except as expressly
- stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
- USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
- OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
+ *
+ * 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 "PluginObject.h"
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
index 8c542ed..ab54872 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
@@ -76,12 +76,14 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
{
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-
- obj->onStreamLoad = NULL;
for (int16 i = 0; i < argc; i++) {
if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = _strdup(argv[i]);
+ else if (_stricmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
+ obj->onStreamDestroy = _strdup(argv[i]);
+ else if (_stricmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
+ obj->onURLNotify = _strdup(argv[i]);
}
instance->pdata = obj;
@@ -96,7 +98,13 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
if (obj) {
if (obj->onStreamLoad)
free(obj->onStreamLoad);
-
+
+ if (obj->onURLNotify)
+ free(obj->onURLNotify);
+
+ if (obj->onStreamDestroy)
+ free(obj->onStreamDestroy);
+
if (obj->logDestroy)
printf("PLUGIN: NPP_Destroy\n");
@@ -110,30 +118,43 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
return NPERR_NO_ERROR;
}
+static void executeScript(const PluginObject* obj, const char* script)
+{
+ NPObject *windowScriptObject;
+ browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPString npScript;
+ npScript.UTF8Characters = script;
+ npScript.UTF8Length = strlen(script);
+
+ NPVariant browserResult;
+ browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
+ browser->releasevariantvalue(&browserResult);
+}
+
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
PluginObject* obj = (PluginObject*)instance->pdata;
+
+ if (obj->returnErrorFromNewStream)
+ return NPERR_GENERIC_ERROR;
+
obj->stream = stream;
*stype = NP_ASFILEONLY;
- if (obj->onStreamLoad) {
- NPObject *windowScriptObject;
- browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
- NPString script;
- script.UTF8Characters = obj->onStreamLoad;
- script.UTF8Length = strlen(obj->onStreamLoad);
-
- NPVariant browserResult;
- browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult);
- browser->releasevariantvalue(&browserResult);
- }
+ if (obj->onStreamLoad)
+ executeScript(obj, obj->onStreamLoad);
return NPERR_NO_ERROR;
}
NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
{
+ PluginObject* obj = (PluginObject*)instance->pdata;
+
+ if (obj->onStreamDestroy)
+ executeScript(obj, obj->onStreamDestroy);
+
return NPERR_NO_ERROR;
}
@@ -168,6 +189,9 @@ int16 NPP_HandleEvent(NPP instance, void *event)
void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
{
PluginObject *obj = (PluginObject*)instance->pdata;
+
+ if (obj->onURLNotify)
+ executeScript(obj, obj->onURLNotify);
handleCallback(obj, url, reason, notifyData);
}
diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp
index 750e67a..a2532a5 100755
--- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp
@@ -26,9 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "UIDelegate.h"
+#include "DumpRenderTree.h"
#include "DraggingInfo.h"
#include "EventSender.h"
#include "LayoutTestController.h"
@@ -38,8 +39,7 @@
#include <wtf/Vector.h>
#include <JavaScriptCore/Assertions.h>
#include <JavaScriptCore/JavaScriptCore.h>
-#include <WebKit/IWebFramePrivate.h>
-#include <WebKit/IWebViewPrivate.h>
+#include <WebKit/WebKit.h>
#include <stdio.h>
using std::wstring;
@@ -322,6 +322,18 @@ HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptTextInputPanelWithPrompt(
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;
+ *result = TRUE;
+ return E_NOTIMPL;
+}
+
HRESULT STDMETHODCALLTYPE UIDelegate::webViewAddMessageToConsole(
/* [in] */ IWebView* sender,
/* [in] */ BSTR message,
@@ -374,13 +386,13 @@ HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest(
/* [in] */ IWebURLRequest *request,
/* [retval][out] */ IWebView **newWebView)
{
- if (!::layoutTestController->canOpenWindows())
+ if (!::gLayoutTestController->canOpenWindows())
return E_FAIL;
*newWebView = createWebViewAndOffscreenWindow();
return S_OK;
}
-HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose(
+HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose(
/* [in] */ IWebView *sender)
{
HWND hostWindow;
@@ -389,6 +401,22 @@ HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose(
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)
{
@@ -406,3 +434,11 @@ HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota(
return S_OK;
}
+
+
+HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text)
+{
+ if (gLayoutTestController->dumpStatusCallbacks())
+ printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", text ? text : L"");
+ return S_OK;
+}
diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.h b/WebKitTools/DumpRenderTree/win/UIDelegate.h
index 1699c33..2113957 100755
--- a/WebKitTools/DumpRenderTree/win/UIDelegate.h
+++ b/WebKitTools/DumpRenderTree/win/UIDelegate.h
@@ -29,8 +29,7 @@
#ifndef UIDelegate_h
#define UIDelegate_h
-#include <WebKit/IWebUIDelegate.h>
-#include <WebKit/IWebUIDelegatePrivate.h>
+#include <WebKit/WebKit.h>
#include <wtf/OwnPtr.h>
#include <windef.h>
@@ -60,10 +59,10 @@ public:
/* [in] */ IWebView *sender);
virtual HRESULT STDMETHODCALLTYPE webViewFocus(
- /* [in] */ IWebView *sender) { return E_NOTIMPL; }
+ /* [in] */ IWebView *sender);
virtual HRESULT STDMETHODCALLTYPE webViewUnfocus(
- /* [in] */ IWebView *sender) { return E_NOTIMPL; }
+ /* [in] */ IWebView *sender);
virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder(
/* [in] */ IWebView *sender,
@@ -75,7 +74,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE setStatusText(
/* [in] */ IWebView *sender,
- /* [in] */ BSTR text) { return E_NOTIMPL; }
+ /* [in] */ BSTR text);
virtual HRESULT STDMETHODCALLTYPE webViewStatusText(
/* [in] */ IWebView *sender,
@@ -140,7 +139,7 @@ public:
/* [in] */ IWebView *sender,
/* [in] */ BSTR message,
/* [in] */ IWebFrame *initiatedByFrame,
- /* [retval][out] */ BOOL *result) { return E_NOTIMPL; }
+ /* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener(
/* [in] */ IWebView *sender,
@@ -254,6 +253,11 @@ protected:
virtual HRESULT STDMETHODCALLTYPE webViewResizerRect(
/* [in] */ IWebView *sender,
/* [retval][out] */ RECT *rect) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewSendResizeMessage(
+ /* [in] */ UINT uMsg,
+ /* [in] */ WPARAM wParam,
+ /* [in] */ LPARAM lParam) { return E_NOTIMPL; }
virtual HRESULT STDMETHODCALLTYPE webViewDrawResizer(
/* [in] */ IWebView *sender,
diff --git a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp
index 1a2924f..a489498 100644
--- a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp
@@ -26,13 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "DumpRenderTree.h"
+#include "config.h"
#include "WorkQueueItem.h"
+#include "DumpRenderTree.h"
#include <WebCore/COMPtr.h>
-#include <WebKit/IWebFrame.h>
-#include <WebKit/IWebURLRequest.h>
-#include <WebKit/IWebView.h>
#include <WebKit/WebKit.h>
#include <JavaScriptCore/JSStringRef.h>
#include <JavaScriptCore/JSStringRefCF.h>