[BlackBerry] Upstream DumpRenderTreeBlackBerry
authorrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 21:37:31 +0000 (21:37 +0000)
committerrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 21:37:31 +0000 (21:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78042

Reviewed by Antonio Gomes.

Upstream more parts of our DRT implementation.

* DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp: Added.
* DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp: Added.
* DumpRenderTree/blackberry/EventSender.cpp: Added.
* DumpRenderTree/blackberry/EventSender.h: Added.
* DumpRenderTree/blackberry/GCControllerBlackBerry.cpp: Added.
* DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107129 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp [new file with mode: 0644]
Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp [new file with mode: 0644]
Tools/DumpRenderTree/blackberry/EventSender.cpp [new file with mode: 0644]
Tools/DumpRenderTree/blackberry/EventSender.h [new file with mode: 0644]
Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp [new file with mode: 0644]
Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp [new file with mode: 0644]

index b778ed9..3b86224 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-08  Rob Buis  <rbuis@rim.com>
+
+        [BlackBerry] Upstream DumpRenderTreeBlackBerry
+        https://bugs.webkit.org/show_bug.cgi?id=78042
+
+        Reviewed by Antonio Gomes.
+
+        Upstream more parts of our DRT implementation.
+
+        * DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp: Added.
+        * DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp: Added.
+        * DumpRenderTree/blackberry/EventSender.cpp: Added.
+        * DumpRenderTree/blackberry/EventSender.h: Added.
+        * DumpRenderTree/blackberry/GCControllerBlackBerry.cpp: Added.
+        * DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp: Added.
+
 2012-02-08  Dirk Pranke  <dpranke@chromium.org>
 
         check-webkit-style failing with "Path does not exist."
diff --git a/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/AccessibilityControllerBlackBerry.cpp
new file mode 100644 (file)
index 0000000..1fe2ea8
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "AccessibilityController.h"
+
+#include "AccessibilityUIElement.h"
+#include "NotImplemented.h"
+
+AccessibilityController::AccessibilityController()
+{
+}
+
+AccessibilityController::~AccessibilityController()
+{
+}
+
+AccessibilityUIElement AccessibilityController::focusedElement()
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityController::rootElement()
+{
+    notImplemented();
+    return 0;
+}
+
+void AccessibilityController::setLogFocusEvents(bool)
+{
+    notImplemented();
+}
+
+void AccessibilityController::setLogScrollingStartEvents(bool)
+{
+    notImplemented();
+}
+
+void AccessibilityController::setLogValueChangeEvents(bool)
+{
+    notImplemented();
+}
+
+AccessibilityUIElement AccessibilityController::elementAtPoint(int, int)
+{
+    notImplemented();
+    return 0;
+}
+
+void AccessibilityController::setLogAccessibilityEvents(bool)
+{
+    notImplemented();
+}
+
+void AccessibilityController::addNotificationListener(PlatformUIElement, JSObjectRef)
+{
+    notImplemented();
+}
+
+void AccessibilityController::notificationReceived(PlatformUIElement, const std::string&)
+{
+    notImplemented();
+}
+
diff --git a/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp
new file mode 100644 (file)
index 0000000..d363e79
--- /dev/null
@@ -0,0 +1,612 @@
+/*
+ * Copyright (C) 2010, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "AccessibilityUIElement.h"
+
+#include "NotImplemented.h"
+
+AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
+    : m_element(element)
+{
+}
+
+AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
+    : m_element(other.m_element)
+{
+}
+
+AccessibilityUIElement::~AccessibilityUIElement()
+{
+}
+
+void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>&)
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>&)
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>&, unsigned, unsigned)
+{
+    notImplemented();
+}
+
+int AccessibilityUIElement::childrenCount()
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int, int)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::allAttributes()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::titleUIElement()
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::parentElement()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfChildren()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::role()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::subrole()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::roleDescription()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::title()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::description()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::stringValue()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::language()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::x()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::y()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::width()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::height()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::clickPointX()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::clickPointY()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::orientation() const
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::minValue()
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::maxValue()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::valueDescription()
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isEnabled()
+{
+    notImplemented();
+    return 0;
+}
+
+int AccessibilityUIElement::insertionPointLineNumber()
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isActionSupported(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isRequired() const
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isSelected() const
+{
+    notImplemented();
+    return 0;
+}
+
+int AccessibilityUIElement::hierarchicalLevel() const
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::ariaIsGrabbed() const
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::ariaDropEffects() const
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isExpanded() const
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfColumns()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfRows()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributesOfHeader()
+{
+    notImplemented();
+    return 0;
+}
+
+int AccessibilityUIElement::indexInTable()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::rowIndexRange()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::columnIndexRange()
+{
+    notImplemented();
+    return 0;
+}
+
+int AccessibilityUIElement::lineForIndex(int)
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::boundsForRange(unsigned, unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement*, bool, JSStringRef, JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned, unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::selectedTextRange()
+{
+    notImplemented();
+    return 0;
+}
+
+void AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned)
+{
+    notImplemented();
+}
+
+bool AccessibilityUIElement::isAttributeSettable(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isAttributeSupported(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+void AccessibilityUIElement::increment()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::decrement()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::showMenu()
+{
+    notImplemented();
+}
+
+AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::disclosedByRow()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::accessibilityValue() const
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::documentEncoding()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::documentURI()
+{
+    notImplemented();
+    return 0;
+}
+
+unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement*)
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::numberAttributeValue(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::boolAttributeValue(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef)
+{
+    notImplemented();
+    return 0;
+}
+
+double AccessibilityUIElement::intValue() const
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isChecked() const
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::url()
+{
+    notImplemented();
+    return 0;
+}
+
+
+bool AccessibilityUIElement::addNotificationListener(JSObjectRef)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isSelectable() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isMultiSelectable() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isVisible() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isOffScreen() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isCollapsed() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::hasPopup() const
+{
+    notImplemented();
+    return false;
+}
+
+void AccessibilityUIElement::takeFocus()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::takeSelection()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::addSelection()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::removeSelection()
+{
+    notImplemented();
+}
+
+int AccessibilityUIElement::columnCount()
+{
+    notImplemented();
+    return 0;
+}
+
+void AccessibilityUIElement::removeNotificationListener()
+{
+    notImplemented();
+}
+
+void AccessibilityUIElement::press()
+{
+    notImplemented();
+}
+
+int AccessibilityUIElement::rowCount()
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::helpText() const
+{
+    notImplemented();
+    return 0;
+}
+
+JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned)
+{
+    notImplemented();
+    return 0;
+}
+
+bool AccessibilityUIElement::isIgnored() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isFocused() const
+{
+    notImplemented();
+    return false;
+}
+
+bool AccessibilityUIElement::isFocusable() const
+{
+    notImplemented();
+    return false;
+}
+
diff --git a/Tools/DumpRenderTree/blackberry/EventSender.cpp b/Tools/DumpRenderTree/blackberry/EventSender.cpp
new file mode 100644 (file)
index 0000000..1d5f0fe
--- /dev/null
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
+ * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "EventSender.h"
+
+#include "DumpRenderTreeBlackBerry.h"
+#include "DumpRenderTreeSupport.h"
+#include "IntPoint.h"
+#include "NotImplemented.h"
+#include "WebPage.h"
+
+#include <BlackBerryPlatformKeyboardEvent.h>
+#include <BlackBerryPlatformMouseEvent.h>
+#include <BlackBerryPlatformTouchEvent.h>
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSStringRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+static IntPoint lastMousePosition;
+static Vector<BlackBerry::Platform::TouchPoint> touches;
+static bool touchActive = false;
+
+void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type);
+
+// Callbacks
+
+static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef*    exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef*    exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
+    page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, 0, lastMousePosition, IntPoint::zero(), 0, 0));
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
+    page->mouseEvent(BlackBerry::Platform::MouseEvent(0, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0));
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 2)
+        return JSValueMakeUndefined(context);
+
+    int x = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
+    ASSERT(!exception || !*exception);
+    int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
+    ASSERT(!exception || !*exception);
+
+    lastMousePosition = IntPoint(x, y);
+    BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
+    page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0));
+
+
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
+    ASSERT(!*exception);
+    short charCode = 0;
+    bool needsShiftKeyModifier = false;
+    if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
+        charCode = KEYCODE_LEFT;
+    else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
+        charCode = KEYCODE_RIGHT;
+    else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
+        charCode = KEYCODE_UP;
+    else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
+        charCode = KEYCODE_DOWN;
+    else if (JSStringIsEqualToUTF8CString(character, "pageUp")
+             || JSStringIsEqualToUTF8CString(character, "pageDown")
+             || JSStringIsEqualToUTF8CString(character, "home")
+             || JSStringIsEqualToUTF8CString(character, "end"))
+         return JSValueMakeUndefined(context);
+    else if (JSStringIsEqualToUTF8CString(character, "delete"))
+        charCode = KEYCODE_BACKSPACE;
+    else {
+        charCode = JSStringGetCharactersPtr(character)[0];
+        if (WTF::isASCIIUpper(charCode))
+            needsShiftKeyModifier = true;
+    }
+    JSStringRelease(character);
+
+    static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length");
+    bool needsAltKeyModifier = false;
+    if (argumentCount > 1) {
+        if (JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0)) {
+            int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0);
+            for (int i = 0; i < modifiersCount; ++i) {
+                JSStringRef string = JSValueToStringCopy(context, JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0), 0);
+                if (JSStringIsEqualToUTF8CString(string, "shiftKey"))
+                    needsShiftKeyModifier = true;
+                else if (JSStringIsEqualToUTF8CString(string, "altKey"))
+                    needsAltKeyModifier = true;
+                JSStringRelease(string);
+            }
+        }
+    }
+
+    BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
+
+    unsigned modifiers = 0;
+    if (needsShiftKeyModifier)
+        modifiers |= KEYMOD_SHIFT;
+    if (needsAltKeyModifier)
+        modifiers |= KEYMOD_ALT;
+
+    page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyChar, modifiers));
+
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 2)
+        return JSValueMakeUndefined(context);
+
+    int x = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
+    ASSERT(!exception || !*exception);
+    int y = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
+    ASSERT(!exception || !*exception);
+
+    BlackBerry::Platform::TouchPoint touch;
+    touch.m_id = touches.isEmpty() ? 0 : touches.last().m_id + 1;
+    IntPoint pos(x, y);
+    touch.m_pos = pos;
+    touch.m_screenPos = pos;
+    touch.m_state = BlackBerry::Platform::TouchPoint::TouchPressed;
+
+    touches.append(touch);
+
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef updateTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 3)
+        return JSValueMakeUndefined(context);
+
+    int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
+    ASSERT(!exception || !*exception);
+    int x = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
+    ASSERT(!exception || !*exception);
+    int y = static_cast<int>(JSValueToNumber(context, arguments[2], exception));
+    ASSERT(!exception || !*exception);
+
+    if (index < 0 || index >= (int)touches.size())
+        return JSValueMakeUndefined(context);
+
+    BlackBerry::Platform::TouchPoint& touch = touches[index];
+    IntPoint pos(x, y);
+    touch.m_pos = pos;
+    touch.m_screenPos = pos;
+    touch.m_state = BlackBerry::Platform::TouchPoint::TouchMoved;
+
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef setTouchModifierCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef touchStartCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (!touchActive) {
+        sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchStart);
+        touchActive = true;
+    } else
+        sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove);
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef touchCancelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef touchMoveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove);
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef touchEndCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    for (unsigned i = 0; i < touches.size(); ++i)
+        if (touches[i].m_state != BlackBerry::Platform::TouchPoint::TouchReleased) {
+            sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchMove);
+            return JSValueMakeUndefined(context);
+        }
+    sendTouchEvent(BlackBerry::Platform::TouchEvent::TouchEnd);
+    touchActive = false;
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef clearTouchPointsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    touches.clear();
+    touchActive = false;
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef cancelTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    notImplemented();
+    return JSValueMakeUndefined(context);
+}
+
+static JSValueRef releaseTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    int index = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
+    ASSERT(!exception || !*exception);
+    if (index < 0 || index >= (int)touches.size())
+        return JSValueMakeUndefined(context);
+
+    touches[index].m_state = BlackBerry::Platform::TouchPoint::TouchReleased;
+    return JSValueMakeUndefined(context);
+}
+
+void sendTouchEvent(BlackBerry::Platform::TouchEvent::Type type)
+{
+    BlackBerry::Platform::TouchEvent event;
+    event.m_type = type;
+    event.m_points.assign(touches.begin(), touches.end());
+    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->touchEvent(event);
+
+    Vector<BlackBerry::Platform::TouchPoint> t;
+
+    for (Vector<BlackBerry::Platform::TouchPoint>::iterator it = touches.begin(); it != touches.end(); ++it) {
+        if (it->m_state != BlackBerry::Platform::TouchPoint::TouchReleased) {
+            it->m_state = BlackBerry::Platform::TouchPoint::TouchStationary;
+            t.append(*it);
+        }
+    }
+    touches = t;
+}
+
+static JSValueRef scalePageByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 3)
+        return JSValueMakeUndefined(context);
+
+    float scaleFactor = JSValueToNumber(context, arguments[0], exception);
+    float x = JSValueToNumber(context, arguments[1], exception);
+    float y = JSValueToNumber(context, arguments[2], exception);
+
+    BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
+    if (!page)
+        return JSValueMakeUndefined(context);
+
+    DumpRenderTreeSupport::scalePageBy(page, scaleFactor, x, y);
+
+    return JSValueMakeUndefined(context);
+}
+
+static JSStaticFunction staticFunctions[] = {
+    { "mouseWheelTo", mouseWheelToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "addTouchPoint", addTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "cancelTouchPoint", cancelTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "clearTouchPoints", clearTouchPointsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "releaseTouchPoint", releaseTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "setTouchModifier", setTouchModifierCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "touchCancel", touchCancelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "touchEnd", touchEndCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "touchMove", touchMoveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "touchStart", touchStartCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "updateTouchPoint", updateTouchPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { 0, 0, 0 }
+};
+
+static JSStaticValue staticValues[] = {
+    { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone },
+    { 0, 0, 0, 0 }
+};
+
+static JSClassRef getClass(JSContextRef context)
+{
+    static JSClassRef eventSenderClass = 0;
+
+    if (!eventSenderClass) {
+        JSClassDefinition classDefinition = {
+                0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        classDefinition.staticFunctions = staticFunctions;
+        classDefinition.staticValues = staticValues;
+
+        eventSenderClass = JSClassCreate(&classDefinition);
+    }
+
+    return eventSenderClass;
+}
+
+void replaySavedEvents()
+{
+    notImplemented();
+}
+
+JSObjectRef makeEventSender(JSContextRef context)
+{
+    return JSObjectMake(context, getClass(context), 0);
+}
+
diff --git a/Tools/DumpRenderTree/blackberry/EventSender.h b/Tools/DumpRenderTree/blackberry/EventSender.h
new file mode 100644 (file)
index 0000000..66f7196
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef EventSender_h
+#define EventSender_h
+
+typedef const struct OpaqueJSContext* JSContextRef;
+typedef struct OpaqueJSValue* JSObjectRef;
+
+JSObjectRef makeEventSender(JSContextRef);
+void replaySavedEvents();
+
+#endif
diff --git a/Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/GCControllerBlackBerry.cpp
new file mode 100644 (file)
index 0000000..8e8bd96
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "DumpRenderTree/GCController.h"
+
+#include "DumpRenderTreeSupport.h"
+
+void GCController::collect() const
+{
+    DumpRenderTreeSupport::garbageCollectorCollect();
+}
+
+void GCController::collectOnAlternateThread(bool waitUntilDone) const
+{
+    DumpRenderTreeSupport::garbageCollectorCollectOnAlternateThread(waitUntilDone);
+}
+
+size_t GCController::getJSObjectCount() const
+{
+    return DumpRenderTreeSupport::javaScriptObjectsCount();
+}
+
diff --git a/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp
new file mode 100644 (file)
index 0000000..4c80bfb
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "WorkQueueItem.h"
+
+#include "DumpRenderTreeBlackBerry.h"
+#include "Frame.h"
+#include "KURL.h"
+#include "OwnArrayPtr.h"
+#include "WebPage.h"
+
+using namespace WebCore;
+
+bool LoadItem::invoke() const
+{
+    size_t targetArrSize = JSStringGetMaximumUTF8CStringSize(m_target.get());
+    size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(m_url.get());
+    OwnArrayPtr<char> target = adoptArrayPtr(new char[targetArrSize]);
+    OwnArrayPtr<char> url = adoptArrayPtr(new char[urlArrSize]);
+    size_t targetLen = JSStringGetUTF8CString(m_target.get(), target.get(), targetArrSize) - 1;
+    JSStringGetUTF8CString(m_url.get(), url.get(), urlArrSize);
+
+    Frame* frame;
+    if (target && targetLen)
+        frame = mainFrame->tree()->find(target.get());
+    else
+        frame = mainFrame;
+
+    if (!frame)
+        return false;
+
+    KURL kurl = KURL(KURL(), url.get());
+    frame->loader()->load(kurl, false);
+    return true;
+}
+
+bool LoadHTMLStringItem::invoke() const
+{
+    size_t contentSize = JSStringGetMaximumUTF8CStringSize(m_content.get());
+    size_t baseURLSize = JSStringGetMaximumUTF8CStringSize(m_baseURL.get());
+    size_t unreachableURLSize = JSStringGetMaximumUTF8CStringSize(m_unreachableURL.get());
+    OwnArrayPtr<char> content = adoptArrayPtr(new char[contentSize]);
+    OwnArrayPtr<char> baseURL = adoptArrayPtr(new char[baseURLSize]);
+    OwnArrayPtr<char> unreachableURL = adoptArrayPtr(new char[unreachableURLSize]);
+    JSStringGetUTF8CString(m_content.get(), content.get(), contentSize);
+    JSStringGetUTF8CString(m_baseURL.get(), baseURL.get(), baseURLSize);
+    JSStringGetUTF8CString(m_unreachableURL.get(), unreachableURL.get(), unreachableURLSize);
+    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : 0);
+    return true;
+}
+
+bool ReloadItem::invoke() const
+{
+    mainFrame->loader()->reload(true);
+    return true;
+}
+
+bool ScriptItem::invoke() const
+{
+    BlackBerry::WebKit::JavaScriptDataType type;
+    BlackBerry::WebKit::WebString result;
+    size_t scriptArrSize = JSStringGetMaximumUTF8CStringSize(m_script.get());
+    OwnArrayPtr<char> script = adoptArrayPtr(new char[scriptArrSize]);
+    JSStringGetUTF8CString(m_script.get(), script.get(), scriptArrSize);
+    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(script.get(), type, result);
+    return true;
+}
+
+bool BackForwardItem::invoke() const
+{
+    return BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->goBackOrForward(m_howFar);
+}
+