summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/gtk
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-05 14:36:32 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:30 +0100
commitf05b935882198ccf7d81675736e3aeb089c5113a (patch)
tree4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/DumpRenderTree/gtk
parent60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff)
downloadexternal_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk')
-rw-r--r--WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp93
-rw-r--r--WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp707
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp1112
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h45
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EditingCallbacks.cpp206
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EditingCallbacks.h35
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EventSender.cpp764
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EventSender.h42
-rw-r--r--WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp54
-rw-r--r--WebKitTools/DumpRenderTree/gtk/ImageDiff.cpp239
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp829
-rw-r--r--WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp59
-rw-r--r--WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp96
-rw-r--r--WebKitTools/DumpRenderTree/gtk/fonts/AHEM____.TTFbin12480 -> 0 bytes
-rw-r--r--WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf390
15 files changed, 0 insertions, 4671 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
deleted file mode 100644
index ab9f021..0000000
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
- * Copyright (C) 2009 Jan Michael Alonzo
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "AccessibilityController.h"
-
-#include "AccessibilityUIElement.h"
-#include "DumpRenderTree.h"
-
-#include <atk/atk.h>
-#include <gtk/gtk.h>
-#include <webkit/webkit.h>
-
-extern "C" {
-extern AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame*);
-}
-
-AccessibilityController::AccessibilityController()
-{
-}
-
-AccessibilityController::~AccessibilityController()
-{
-}
-
-AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
-{
- // FIXME: implement
- return 0;
-}
-
-AccessibilityUIElement AccessibilityController::focusedElement()
-{
- AtkObject* accessible = webkit_web_frame_get_focused_accessible_element(mainFrame);
- if (!accessible)
- return 0;
-
- return AccessibilityUIElement(accessible);
-}
-
-AccessibilityUIElement AccessibilityController::rootElement()
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
-
- // The presumed, desired rootElement is the parent of the web view.
- GtkWidget* webViewParent = gtk_widget_get_parent(GTK_WIDGET(view));
- AtkObject* axObject = gtk_widget_get_accessible(webViewParent);
-
- return AccessibilityUIElement(axObject);
-}
-
-void AccessibilityController::setLogFocusEvents(bool)
-{
-}
-
-void AccessibilityController::setLogScrollingStartEvents(bool)
-{
-}
-
-void AccessibilityController::setLogValueChangeEvents(bool)
-{
-}
-
-void AccessibilityController::addNotificationListener(PlatformUIElement, JSObjectRef)
-{
-}
-
-void AccessibilityController::notificationReceived(PlatformUIElement, const std::string&)
-{
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
deleted file mode 100644
index e09de33..0000000
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2009 Jan Michael Alonzo
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "AccessibilityUIElement.h"
-#include "GOwnPtr.h"
-#include "GRefPtr.h"
-
-#include <JavaScriptCore/JSStringRef.h>
-#include <wtf/Assertions.h>
-
-#include <atk/atk.h>
-#include <gtk/gtk.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>& elements)
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
-{
- int count = childrenCount();
- for (int i = 0; i < count; i++) {
- AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
- children.append(AccessibilityUIElement(child));
- }
-}
-
-void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end)
-{
- for (unsigned i = start; i < end; i++) {
- AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
- elementVector.append(AccessibilityUIElement(child));
- }
-}
-
-int AccessibilityUIElement::rowCount()
-{
- if (!m_element)
- return 0;
-
- ASSERT(ATK_IS_TABLE(m_element));
-
- return atk_table_get_n_rows(ATK_TABLE(m_element));
-}
-
-int AccessibilityUIElement::columnCount()
-{
- if (!m_element)
- return 0;
-
- ASSERT(ATK_IS_TABLE(m_element));
-
- return atk_table_get_n_columns(ATK_TABLE(m_element));
-}
-
-int AccessibilityUIElement::childrenCount()
-{
- if (!m_element)
- return 0;
-
- ASSERT(ATK_IS_OBJECT(m_element));
-
- return atk_object_get_n_accessible_children(ATK_OBJECT(m_element));
-}
-
-AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
-{
- // FIXME: implement
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
-{
- // FIXME: implement
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
-{
- Vector<AccessibilityUIElement> children;
- getChildrenWithRange(children, index, index + 1);
-
- if (children.size() == 1)
- return children.at(0);
-
- return 0;
-}
-
-unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element)
-{
- // FIXME: implement
- return 0;
-}
-
-gchar* attributeSetToString(AtkAttributeSet* attributeSet)
-{
- GString* str = g_string_new(0);
- for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
- AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
- g_string_append(str, g_strconcat(attribute->name, ":", attribute->value, NULL));
- if (attributes->next)
- g_string_append(str, ", ");
- }
-
- return g_string_free(str, FALSE);
-}
-
-JSStringRef AccessibilityUIElement::allAttributes()
-{
- if (!m_element)
- return JSStringCreateWithCharacters(0, 0);
-
- ASSERT(ATK_IS_OBJECT(m_element));
- return JSStringCreateWithUTF8CString(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element))));
-}
-
-JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-AccessibilityUIElement AccessibilityUIElement::titleUIElement()
-{
- // FIXME: implement
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::parentElement()
-{
- if (!m_element)
- return 0;
-
- ASSERT(ATK_IS_OBJECT(m_element));
-
- AtkObject* parent = atk_object_get_parent(ATK_OBJECT(m_element));
- return parent ? AccessibilityUIElement(parent) : 0;
-}
-
-JSStringRef AccessibilityUIElement::attributesOfChildren()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::role()
-{
- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
-
- if (!role)
- return JSStringCreateWithCharacters(0, 0);
-
- const gchar* roleName = atk_role_get_name(role);
- GOwnPtr<gchar> axRole(g_strdup_printf("AXRole: %s", roleName));
-
- return JSStringCreateWithUTF8CString(axRole.get());
-}
-
-JSStringRef AccessibilityUIElement::subrole()
-{
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::roleDescription()
-{
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::title()
-{
- const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
-
- if (!name)
- return JSStringCreateWithCharacters(0, 0);
-
- GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name));
-
- return JSStringCreateWithUTF8CString(axTitle.get());
-}
-
-JSStringRef AccessibilityUIElement::description()
-{
- const gchar* description = atk_object_get_description(ATK_OBJECT(m_element));
-
- if (!description)
- return JSStringCreateWithCharacters(0, 0);
-
- GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description));
-
- return JSStringCreateWithUTF8CString(axDesc.get());
-}
-
-JSStringRef AccessibilityUIElement::stringValue()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::language()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::helpText() const
-{
- return 0;
-}
-
-double AccessibilityUIElement::x()
-{
- int x, y;
-
- atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
-
- return x;
-}
-
-double AccessibilityUIElement::y()
-{
- int x, y;
-
- atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
-
- return y;
-}
-
-double AccessibilityUIElement::width()
-{
- int width, height;
-
- atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
-
- return width;
-}
-
-double AccessibilityUIElement::height()
-{
- int width, height;
-
- atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
-
- return height;
-}
-
-double AccessibilityUIElement::clickPointX()
-{
- return 0.f;
-}
-
-double AccessibilityUIElement::clickPointY()
-{
- return 0.f;
-}
-
-JSStringRef AccessibilityUIElement::orientation() const
-{
- return 0;
-}
-
-double AccessibilityUIElement::intValue() const
-{
- GValue value = { 0, { { 0 } } };
-
- if (!ATK_IS_VALUE(m_element))
- return 0.0f;
-
- atk_value_get_current_value(ATK_VALUE(m_element), &value);
-
- if (G_VALUE_HOLDS_DOUBLE(&value))
- return g_value_get_double(&value);
- else if (G_VALUE_HOLDS_INT(&value))
- return static_cast<double>(g_value_get_int(&value));
- else
- return 0.0f;
-}
-
-double AccessibilityUIElement::minValue()
-{
- GValue value = { 0, { { 0 } } };
-
- if (!ATK_IS_VALUE(m_element))
- return 0.0f;
-
- atk_value_get_minimum_value(ATK_VALUE(m_element), &value);
-
- if (G_VALUE_HOLDS_DOUBLE(&value))
- return g_value_get_double(&value);
- else if (G_VALUE_HOLDS_INT(&value))
- return static_cast<double>(g_value_get_int(&value));
- else
- return 0.0f;
-}
-
-double AccessibilityUIElement::maxValue()
-{
- GValue value = { 0, { { 0 } } };
-
- if (!ATK_IS_VALUE(m_element))
- return 0.0f;
-
- atk_value_get_maximum_value(ATK_VALUE(m_element), &value);
-
- if (G_VALUE_HOLDS_DOUBLE(&value))
- return g_value_get_double(&value);
- else if (G_VALUE_HOLDS_INT(&value))
- return static_cast<double>(g_value_get_int(&value));
- else
- return 0.0f;
-}
-
-JSStringRef AccessibilityUIElement::valueDescription()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-bool AccessibilityUIElement::isEnabled()
-{
- // FIXME: implement
- return false;
-}
-
-
-int AccessibilityUIElement::insertionPointLineNumber()
-{
- // FIXME: implement
- return 0;
-}
-
-bool AccessibilityUIElement::isActionSupported(JSStringRef action)
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isRequired() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isSelected() const
-{
- if (!ATK_IS_OBJECT(m_element))
- return false;
-
- PlatformRefPtr<AtkStateSet> stateSet = adoptPlatformRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
- gboolean isSelected = atk_state_set_contains_state(stateSet.get(), ATK_STATE_SELECTED);
-
- return isSelected;
-}
-
-int AccessibilityUIElement::hierarchicalLevel() const
-{
- // FIXME: implement
- return 0;
-}
-
-bool AccessibilityUIElement::ariaIsGrabbed() const
-{
- return false;
-}
-
-JSStringRef AccessibilityUIElement::ariaDropEffects() const
-{
- return 0;
-}
-
-bool AccessibilityUIElement::isExpanded() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isChecked() const
-{
- return intValue();
-}
-
-JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfColumns()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfRows()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributesOfHeader()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-int AccessibilityUIElement::indexInTable()
-{
- // FIXME: implement
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::rowIndexRange()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::columnIndexRange()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-int AccessibilityUIElement::lineForIndex(int)
-{
- // FIXME: implement
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned)
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
-{
- // FIXME: implement
- return false;
-}
-
-AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
-{
- // FIXME: implement
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::selectedTextRange()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
-{
- // FIXME: implement
-}
-
-JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
-{
- return false;
-}
-
-void AccessibilityUIElement::increment()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::decrement()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::press()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::showMenu()
-{
- // FIXME: implement
-}
-
-AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
-{
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
-{
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
-{
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
-{
- return 0;
-}
-
-AccessibilityUIElement AccessibilityUIElement::disclosedByRow()
-{
- return 0;
-}
-
-JSStringRef AccessibilityUIElement::accessibilityValue() const
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-JSStringRef AccessibilityUIElement::documentEncoding()
-{
- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
- if (role != ATK_ROLE_DOCUMENT_FRAME)
- return JSStringCreateWithCharacters(0, 0);
-
- return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding"));
-}
-
-JSStringRef AccessibilityUIElement::documentURI()
-{
- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
- if (role != ATK_ROLE_DOCUMENT_FRAME)
- return JSStringCreateWithCharacters(0, 0);
-
- return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI"));
-}
-
-JSStringRef AccessibilityUIElement::url()
-{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
-}
-
-bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback)
-{
- // FIXME: implement
- return false;
-}
-
-void AccessibilityUIElement::removeNotificationListener()
-{
- // FIXME: implement
-}
-
-bool AccessibilityUIElement::isSelectable() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isMultiSelectable() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isVisible() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isOffScreen() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isCollapsed() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::isIgnored() const
-{
- // FIXME: implement
- return false;
-}
-
-bool AccessibilityUIElement::hasPopup() const
-{
- // FIXME: implement
- return false;
-}
-
-void AccessibilityUIElement::takeFocus()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::takeSelection()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::addSelection()
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::removeSelection()
-{
- // FIXME: implement
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
deleted file mode 100644
index a1fcbc8..0000000
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ /dev/null
@@ -1,1112 +0,0 @@
-/*
- * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- * Copyright (C) 2008 Alp Toker <alp@nuanti.com>
- * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com>
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DumpRenderTree.h"
-
-#include "AccessibilityController.h"
-#include "EditingCallbacks.h"
-#include "EventSender.h"
-#include "GCController.h"
-#include "GOwnPtr.h"
-#include "LayoutTestController.h"
-#include "PixelDumpSupport.h"
-#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
-#include "WorkQueue.h"
-#include "WorkQueueItem.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <cassert>
-#include <cstdlib>
-#include <cstring>
-#include <getopt.h>
-#include <gtk/gtk.h>
-#include <webkit/webkit.h>
-#include <wtf/Assertions.h>
-
-#if PLATFORM(X11)
-#include <fontconfig/fontconfig.h>
-#endif
-
-
-using namespace std;
-
-extern "C" {
-// This API is not yet public.
-extern G_CONST_RETURN gchar* webkit_web_history_item_get_target(WebKitWebHistoryItem*);
-extern gboolean webkit_web_history_item_is_target_item(WebKitWebHistoryItem*);
-extern GList* webkit_web_history_item_get_children(WebKitWebHistoryItem*);
-extern 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);
-extern guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
-extern void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* view, const gchar* directory);
-extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame);
-extern void webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
-extern void webkit_reset_origin_access_white_lists();
-}
-
-volatile bool done;
-static bool printSeparators;
-static int dumpPixels;
-static int dumpTree = 1;
-
-AccessibilityController* axController = 0;
-RefPtr<LayoutTestController> gLayoutTestController;
-static GCController* gcController = 0;
-static WebKitWebView* webView;
-static GtkWidget* window;
-static GtkWidget* container;
-static GtkWidget* webInspectorWindow;
-WebKitWebFrame* mainFrame = 0;
-WebKitWebFrame* topLoadingFrame = 0;
-guint waitToDumpWatchdog = 0;
-bool waitForPolicy = false;
-
-// This is a list of opened webviews
-GSList* webViewList = 0;
-
-// current b/f item at the end of the previous test
-static WebKitWebHistoryItem* prevTestBFItem = NULL;
-
-const unsigned historyItemIndent = 8;
-
-static void runTest(const string& testPathOrURL);
-
-static bool shouldLogFrameLoadDelegates(const string& pathOrURL)
-{
- return pathOrURL.find("loading/") != string::npos;
-}
-
-static bool shouldOpenWebInspector(const string& pathOrURL)
-{
- return pathOrURL.find("inspector/") != string::npos;
-}
-
-static bool shouldEnableDeveloperExtras(const string& pathOrURL)
-{
- return true;
-}
-
-void dumpFrameScrollPosition(WebKitWebFrame* frame)
-{
-
-}
-
-void displayWebView()
-{
- gtk_widget_queue_draw(GTK_WIDGET(webView));
-}
-
-static void appendString(gchar*& target, gchar* string)
-{
- gchar* oldString = target;
- target = g_strconcat(target, string, NULL);
- g_free(oldString);
-}
-
-static void initializeGtkFontSettings(const char* testURL)
-{
- GtkSettings* settings = gtk_settings_get_default();
- if (!settings)
- return;
- g_object_set(settings, "gtk-xft-antialias", 1,
- "gtk-xft-hinting", 0,
- "gtk-font-name", "Liberation Sans 16", NULL);
-
- // One test needs subpixel anti-aliasing turned on, but generally we
- // want all text in other tests to use to grayscale anti-aliasing.
- if (testURL && strstr(testURL, "xsettings_antialias_settings.html"))
- g_object_set(settings, "gtk-xft-rgba", "rgb", NULL);
- else
- g_object_set(settings, "gtk-xft-rgba", "none", NULL);
-}
-
-static void initializeFonts(const char* testURL = 0)
-{
-#if PLATFORM(X11)
- initializeGtkFontSettings(testURL);
-
- FcInit();
-
- // If a test resulted a font being added or removed via the @font-face rule, then
- // we want to reset the FontConfig configuration to prevent it from affecting other tests.
- static int numFonts = 0;
- FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
- if (appFontSet && numFonts && appFontSet->nfont == numFonts)
- return;
-
- // Load our configuration file, which sets up proper aliases for family
- // names like sans, serif and monospace.
- FcConfig* config = FcConfigCreate();
- GOwnPtr<gchar> fontConfigFilename(g_build_filename(FONTS_CONF_DIR, "fonts.conf", NULL));
- if (!FcConfigParseAndLoad(config, reinterpret_cast<FcChar8*>(fontConfigFilename.get()), true))
- g_error("Couldn't load font configuration file from: %s", fontConfigFilename.get());
-
- static const char *const fontPaths[][2] = {
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationMono-BoldItalic.ttf",
- "/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationMono-Bold.ttf",
- "/usr/share/fonts/liberation/LiberationMono-Bold.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationMono-Italic.ttf",
- "/usr/share/fonts/liberation/LiberationMono-Italic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationMono-Regular.ttf",
- "/usr/share/fonts/liberation/LiberationMono-Regular.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSans-BoldItalic.ttf",
- "/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Bold.ttf",
- "/usr/share/fonts/liberation/LiberationSans-Bold.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Italic.ttf",
- "/usr/share/fonts/liberation/LiberationSans-Italic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf",
- "/usr/share/fonts/liberation/LiberationSans-Regular.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-BoldItalic.ttf",
- "/usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Bold.ttf",
- "/usr/share/fonts/liberation/LiberationSerif-Bold.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Italic.ttf",
- "/usr/share/fonts/liberation/LiberationSerif-Italic.ttf", },
- { "/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Regular.ttf",
- "/usr/share/fonts/liberation/LiberationSerif-Regular.ttf", },
- { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
- "/usr/share/fonts/dejavu/DejaVuSans.ttf", },
- { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf",
- "/usr/share/fonts/dejavu/DejaVuSerif.ttf", },
-
- // MathML tests require the STIX fonts.
- { "/usr/share/fonts/opentype/stix/STIXGeneral.otf",
- "/usr/share/fonts/stix/STIXGeneral.otf" },
- { "/usr/share/fonts/opentype/stix/STIXGeneralBolIta.otf",
- "/usr/share/fonts/stix/STIXGeneralBolIta.otf" },
- { "/usr/share/fonts/opentype/stix/STIXGeneralBol.otf",
- "/usr/share/fonts/stix/STIXGeneralBol.otf" },
- { "/usr/share/fonts/opentype/stix/STIXGeneralItalic.otf",
- "/usr/share/fonts/stix/STIXGeneralItalic.otf" }
- };
-
- // TODO: Some tests use Lucida. We should load these as well, once it becomes
- // clear how to install these fonts easily on Fedora.
- for (size_t font = 0; font < G_N_ELEMENTS(fontPaths); font++) {
- bool found = false;
- for (size_t path = 0; path < 2; path++) {
-
- if (g_file_test(fontPaths[font][path], G_FILE_TEST_EXISTS)) {
- found = true;
- if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(fontPaths[font][path])))
- g_error("Could not load font at %s!", fontPaths[font][path]);
- else
- break;
- }
- }
-
- if (!found)
- g_error("Could not find font at %s. Either install this font or file a bug "
- "at http://bugs.webkit.org if it is installed in another location.",
- fontPaths[font][0]);
- }
-
- // Ahem is used by many layout tests.
- GOwnPtr<gchar> ahemFontFilename(g_build_filename(FONTS_CONF_DIR, "AHEM____.TTF", NULL));
- if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(ahemFontFilename.get())))
- g_error("Could not load font at %s!", ahemFontFilename.get());
-
- if (!FcConfigSetCurrent(config))
- g_error("Could not set the current font configuration!");
-
- numFonts = FcConfigGetFonts(config, FcSetApplication)->nfont;
-#endif
-}
-
-static gchar* dumpFramesAsText(WebKitWebFrame* frame)
-{
- gchar* result = 0;
-
- // Add header for all but the main frame.
- bool isMainFrame = (webkit_web_view_get_main_frame(webView) == frame);
-
- gchar* innerText = webkit_web_frame_get_inner_text(frame);
- if (isMainFrame)
- result = g_strdup_printf("%s\n", innerText);
- else {
- const gchar* frameName = webkit_web_frame_get_name(frame);
- result = g_strdup_printf("\n--------\nFrame: '%s'\n--------\n%s\n", frameName, innerText);
- }
- g_free(innerText);
-
- if (gLayoutTestController->dumpChildFramesAsText()) {
- GSList* children = webkit_web_frame_get_children(frame);
- for (GSList* child = children; child; child = g_slist_next(child))
- appendString(result, dumpFramesAsText(static_cast<WebKitWebFrame* >(child->data)));
- g_slist_free(children);
- }
-
- return result;
-}
-
-static gint compareHistoryItems(gpointer* item1, gpointer* item2)
-{
- return g_ascii_strcasecmp(webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item1)),
- webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item2)));
-}
-
-static void dumpHistoryItem(WebKitWebHistoryItem* item, int indent, bool current)
-{
- ASSERT(item != NULL);
- int start = 0;
- g_object_ref(item);
- if (current) {
- printf("curr->");
- start = 6;
- }
- for (int i = start; i < indent; i++)
- putchar(' ');
-
- // normalize file URLs.
- const gchar* uri = webkit_web_history_item_get_uri(item);
- gchar* uriScheme = g_uri_parse_scheme(uri);
- if (g_strcmp0(uriScheme, "file") == 0) {
- gchar* pos = g_strstr_len(uri, -1, "/LayoutTests/");
- if (!pos)
- return;
-
- GString* result = g_string_sized_new(strlen(uri));
- result = g_string_append(result, "(file test):");
- result = g_string_append(result, pos + strlen("/LayoutTests/"));
- printf("%s", result->str);
- g_string_free(result, TRUE);
- } else
- printf("%s", uri);
-
- g_free(uriScheme);
-
- const gchar* target = webkit_web_history_item_get_target(item);
- if (target && strlen(target) > 0)
- printf(" (in frame \"%s\")", target);
- if (webkit_web_history_item_is_target_item(item))
- printf(" **nav target**");
- putchar('\n');
- GList* kids = webkit_web_history_item_get_children(item);
- if (kids) {
- // must sort to eliminate arbitrary result ordering which defeats reproducible testing
- kids = g_list_sort(kids, (GCompareFunc) compareHistoryItems);
- for (unsigned i = 0; i < g_list_length(kids); i++)
- dumpHistoryItem(WEBKIT_WEB_HISTORY_ITEM(g_list_nth_data(kids, i)), indent+4, FALSE);
- }
- g_object_unref(item);
-}
-
-static void dumpBackForwardListForWebView(WebKitWebView* view)
-{
- printf("\n============== Back Forward List ==============\n");
- WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(view);
-
- // Print out all items in the list after prevTestBFItem, which was from the previous test
- // Gather items from the end of the list, the print them out from oldest to newest
- GList* itemsToPrint = NULL;
- gint forwardListCount = webkit_web_back_forward_list_get_forward_length(bfList);
- for (int i = forwardListCount; i > 0; i--) {
- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i);
- // something is wrong if the item from the last test is in the forward part of the b/f list
- ASSERT(item != prevTestBFItem);
- g_object_ref(item);
- itemsToPrint = g_list_append(itemsToPrint, item);
- }
-
- WebKitWebHistoryItem* currentItem = webkit_web_back_forward_list_get_current_item(bfList);
-
- g_object_ref(currentItem);
- itemsToPrint = g_list_append(itemsToPrint, currentItem);
-
- gint currentItemIndex = g_list_length(itemsToPrint) - 1;
- gint backListCount = webkit_web_back_forward_list_get_back_length(bfList);
- for (int i = -1; i >= -(backListCount); i--) {
- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i);
- if (item == prevTestBFItem)
- break;
- g_object_ref(item);
- itemsToPrint = g_list_append(itemsToPrint, item);
- }
-
- for (int i = g_list_length(itemsToPrint) - 1; i >= 0; i--) {
- WebKitWebHistoryItem* item = WEBKIT_WEB_HISTORY_ITEM(g_list_nth_data(itemsToPrint, i));
- dumpHistoryItem(item, historyItemIndent, i == currentItemIndex);
- g_object_unref(item);
- }
- g_list_free(itemsToPrint);
- printf("===============================================\n");
-}
-
-static void dumpBackForwardListForAllWebViews()
-{
- // Dump the back forward list of the main WebView first
- dumpBackForwardListForWebView(webView);
-
- // The view list is prepended. Reverse the list so we get the order right.
- GSList* viewList = g_slist_reverse(webViewList);
- for (unsigned i = 0; i < g_slist_length(viewList); ++i)
- dumpBackForwardListForWebView(WEBKIT_WEB_VIEW(g_slist_nth_data(viewList, i)));
-}
-
-static void invalidateAnyPreviousWaitToDumpWatchdog()
-{
- if (waitToDumpWatchdog) {
- g_source_remove(waitToDumpWatchdog);
- waitToDumpWatchdog = 0;
- }
-
- waitForPolicy = false;
-}
-
-static void resetDefaultsToConsistentValues()
-{
- WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
- g_object_set(G_OBJECT(settings),
- "enable-private-browsing", FALSE,
- "enable-developer-extras", FALSE,
- "enable-spell-checking", TRUE,
- "enable-html5-database", TRUE,
- "enable-html5-local-storage", TRUE,
- "enable-xss-auditor", FALSE,
- "enable-spatial-navigation", FALSE,
- "enable-frame-flattening", FALSE,
- "javascript-can-access-clipboard", TRUE,
- "javascript-can-open-windows-automatically", TRUE,
- "enable-offline-web-application-cache", TRUE,
- "enable-universal-access-from-file-uris", TRUE,
- "enable-scripts", TRUE,
- "enable-dom-paste", TRUE,
- "default-font-family", "Times",
- "monospace-font-family", "Courier",
- "serif-font-family", "Times",
- "sans-serif-font-family", "Helvetica",
- "cursive-font-family", "cursive",
- "fantasy-font-family", "fantasy",
- "default-font-size", 16,
- "default-monospace-font-size", 13,
- "minimum-font-size", 1,
- "enable-caret-browsing", FALSE,
- "enable-page-cache", FALSE,
- "auto-resize-window", TRUE,
- "enable-java-applet", FALSE,
- "enable-plugins", TRUE,
- "enable-hyperlink-auditing", FALSE,
- "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC,
- NULL);
-
- webkit_web_frame_clear_main_frame_name(mainFrame);
-
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
- g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL);
-
- webkit_web_view_set_zoom_level(webView, 1.0);
-
- webkit_reset_origin_access_white_lists();
-
- WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView);
- webkit_web_back_forward_list_clear(list);
-
-#ifdef HAVE_LIBSOUP_2_29_90
- SoupSession* session = webkit_get_default_session();
- SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
-
- // We only create the jar when the soup backend needs to do
- // HTTP. Should we initialize it earlier, perhaps?
- if (jar)
- g_object_set(G_OBJECT(jar), SOUP_COOKIE_JAR_ACCEPT_POLICY, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, NULL);
-#endif
-
- setlocale(LC_ALL, "");
-
- DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true);
-}
-
-static bool useLongRunningServerMode(int argc, char *argv[])
-{
- // This assumes you've already called getopt_long
- return (argc == optind+1 && !strcmp(argv[optind], "-"));
-}
-
-static void runTestingServerLoop()
-{
- // When DumpRenderTree runs in server mode, we just wait around for file names
- // to be passed to us and read each in turn, passing the results back to the client
- char filenameBuffer[2048];
- while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) {
- char* newLineCharacter = strchr(filenameBuffer, '\n');
- if (newLineCharacter)
- *newLineCharacter = '\0';
-
- if (!strlen(filenameBuffer))
- continue;
-
- runTest(filenameBuffer);
- }
-}
-
-static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[])
-{
- struct option options[] = {
- {"notree", no_argument, &dumpTree, false},
- {"pixel-tests", no_argument, &dumpPixels, true},
- {"tree", no_argument, &dumpTree, true},
- {NULL, 0, NULL, 0}
- };
-
- int option;
- while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1) {
- switch (option) {
- case '?': // unknown or ambiguous option
- case ':': // missing argument
- exit(1);
- break;
- }
- }
-}
-
-
-void dump()
-{
- invalidateAnyPreviousWaitToDumpWatchdog();
-
- if (dumpTree) {
- char* result = 0;
- gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame);
-
- if (g_str_equal(responseMimeType, "text/plain")) {
- gLayoutTestController->setDumpAsText(true);
- gLayoutTestController->setGeneratePixelResults(false);
- }
- g_free(responseMimeType);
-
- if (gLayoutTestController->dumpAsText())
- result = dumpFramesAsText(mainFrame);
- else {
- // Widget resizing is done asynchronously in GTK+. We pump the main
- // loop here, to flush any pending resize requests. This prevents
- // timing issues which affect the size of elements in the output.
- // We only enable this workaround for tests that print the render tree
- // because this seems to break some dumpAsText tests: see bug 39988
- // After fixing that test, we should apply this approach to all dumps.
- while (gtk_events_pending())
- gtk_main_iteration();
-
- result = webkit_web_frame_dump_render_tree(mainFrame);
- }
-
- if (!result) {
- const char* errorMessage;
- if (gLayoutTestController->dumpAsText())
- errorMessage = "[documentElement innerText]";
- else if (gLayoutTestController->dumpDOMAsWebArchive())
- errorMessage = "[[mainFrame DOMDocument] webArchive]";
- else if (gLayoutTestController->dumpSourceAsWebArchive())
- errorMessage = "[[mainFrame dataSource] webArchive]";
- else
- errorMessage = "[mainFrame renderTreeAsExternalRepresentation]";
- printf("ERROR: nil result from %s", errorMessage);
- } else {
- printf("%s", result);
- g_free(result);
- if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive())
- dumpFrameScrollPosition(mainFrame);
-
- if (gLayoutTestController->dumpBackForwardList())
- dumpBackForwardListForAllWebViews();
- }
-
- if (printSeparators) {
- puts("#EOF"); // terminate the content block
- fputs("#EOF\n", stderr);
- fflush(stdout);
- fflush(stderr);
- }
- }
-
- if (dumpPixels
- && gLayoutTestController->generatePixelResults()
- && !gLayoutTestController->dumpDOMAsWebArchive()
- && !gLayoutTestController->dumpSourceAsWebArchive())
- dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
-
- // FIXME: call displayWebView here when we support --paint
-
- done = true;
- gtk_main_quit();
-}
-
-static void setDefaultsToConsistentStateValuesForTesting()
-{
- gdk_screen_set_resolution(gdk_screen_get_default(), 72.0);
-
- resetDefaultsToConsistentValues();
-
- /* Disable the default auth dialog for testing */
- SoupSession* session = webkit_get_default_session();
- soup_session_remove_feature_by_type(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG);
-
-#if PLATFORM(X11)
- webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR);
-#endif
-
- gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL);
- webkit_set_web_database_directory_path(databaseDirectory);
- g_free(databaseDirectory);
-}
-
-static void sendPixelResultsEOF()
-{
- puts("#EOF");
-
- fflush(stdout);
- fflush(stderr);
-}
-
-static void runTest(const string& testPathOrURL)
-{
- ASSERT(!testPathOrURL.empty());
-
- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
- string testURL(testPathOrURL);
- string expectedPixelHash;
- size_t separatorPos = testURL.find("'");
- if (separatorPos != string::npos) {
- testURL = string(testPathOrURL, 0, separatorPos);
- expectedPixelHash = string(testPathOrURL, separatorPos + 1);
- }
-
- // Convert the path into a full file URL if it does not look
- // like an HTTP/S URL (doesn't start with http:// or https://).
- if (testURL.find("http://") && testURL.find("https://")) {
- GFile* testFile = g_file_new_for_path(testURL.c_str());
- gchar* testURLCString = g_file_get_uri(testFile);
- testURL = testURLCString;
- g_free(testURLCString);
- g_object_unref(testFile);
- }
-
- resetDefaultsToConsistentValues();
-
- gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash);
- topLoadingFrame = 0;
- done = false;
-
- gLayoutTestController->setIconDatabaseEnabled(false);
-
- if (shouldLogFrameLoadDelegates(testURL))
- gLayoutTestController->setDumpFrameLoadCallbacks(true);
-
- if (shouldEnableDeveloperExtras(testURL)) {
- gLayoutTestController->setDeveloperExtrasEnabled(true);
- if (shouldOpenWebInspector(testURL))
- gLayoutTestController->showWebInspector();
- }
-
- WorkQueue::shared()->clear();
- WorkQueue::shared()->setFrozen(false);
-
- bool isSVGW3CTest = (testURL.find("svg/W3C-SVG-1.1") != string::npos);
- GtkAllocation size;
- size.x = size.y = 0;
- size.width = isSVGW3CTest ? 480 : LayoutTestController::maxViewWidth;
- size.height = isSVGW3CTest ? 360 : LayoutTestController::maxViewHeight;
- gtk_window_resize(GTK_WINDOW(window), size.width, size.height);
- gtk_widget_size_allocate(container, &size);
-
- if (prevTestBFItem)
- g_object_unref(prevTestBFItem);
- WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(webView);
- prevTestBFItem = webkit_web_back_forward_list_get_current_item(bfList);
- if (prevTestBFItem)
- g_object_ref(prevTestBFItem);
-
- initializeFonts(testURL.c_str());
-
- // Focus the web view before loading the test to avoid focusing problems
- gtk_widget_grab_focus(GTK_WIDGET(webView));
- webkit_web_view_open(webView, testURL.c_str());
-
- gtk_main();
-
- // If developer extras enabled Web Inspector may have been open by the test.
- if (shouldEnableDeveloperExtras(testURL)) {
- gLayoutTestController->closeWebInspector();
- gLayoutTestController->setDeveloperExtrasEnabled(false);
- }
-
- // Also check if we still have opened webViews and free them.
- if (gLayoutTestController->closeRemainingWindowsWhenComplete() || webViewList) {
- while (webViewList) {
- g_object_unref(WEBKIT_WEB_VIEW(webViewList->data));
- webViewList = g_slist_next(webViewList);
- }
- g_slist_free(webViewList);
- webViewList = 0;
- }
-
- // A blank load seems to be necessary to reset state after certain tests.
- webkit_web_view_open(webView, "about:blank");
-
- gLayoutTestController.clear();
-
- // terminate the (possibly empty) pixels block after all the state reset
- sendPixelResultsEOF();
-}
-
-void webViewLoadStarted(WebKitWebView* view, WebKitWebFrame* frame, void*)
-{
- // Make sure we only set this once per test. If it gets cleared, and then set again, we might
- // end up doing two dumps for one test.
- if (!topLoadingFrame && !done)
- topLoadingFrame = frame;
-}
-
-static gboolean processWork(void* data)
-{
- // if we finish all the commands, we're ready to dump state
- if (WorkQueue::shared()->processWork() && !gLayoutTestController->waitToDump())
- dump();
-
- return FALSE;
-}
-
-static char* getFrameNameSuitableForTestResult(WebKitWebView* view, WebKitWebFrame* frame)
-{
- char* frameName = g_strdup(webkit_web_frame_get_name(frame));
-
- if (frame == webkit_web_view_get_main_frame(view)) {
- // This is a bit strange. Shouldn't web_frame_get_name return NULL?
- if (frameName && (frameName[0] != '\0')) {
- char* tmp = g_strdup_printf("main frame \"%s\"", frameName);
- g_free(frameName);
- frameName = tmp;
- } else {
- g_free(frameName);
- frameName = g_strdup("main frame");
- }
- } else if (!frameName || (frameName[0] == '\0')) {
- g_free(frameName);
- frameName = g_strdup("frame (anonymous)");
- } else {
- char* tmp = g_strdup_printf("frame \"%s\"", frameName);
- g_free(frameName);
- frameName = tmp;
- }
-
- return frameName;
-}
-
-static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
-{
- if (frame != topLoadingFrame)
- return;
-
- topLoadingFrame = 0;
- WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
- if (gLayoutTestController->waitToDump())
- return;
-
- if (WorkQueue::shared()->count())
- g_timeout_add(0, processWork, 0);
- else
- dump();
-}
-
-static void webViewDocumentLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
-{
- if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
- char* frameName = getFrameNameSuitableForTestResult(view, frame);
- printf("%s - didFinishDocumentLoadForFrame\n", frameName);
- g_free(frameName);
- } else if (!done) {
- guint pendingFrameUnloadEvents = webkit_web_frame_get_pending_unload_event_count(frame);
- if (pendingFrameUnloadEvents) {
- char* frameName = getFrameNameSuitableForTestResult(view, frame);
- printf("%s - has %u onunload handler(s)\n", frameName, pendingFrameUnloadEvents);
- g_free(frameName);
- }
- }
-}
-
-static void webViewOnloadEvent(WebKitWebView* view, WebKitWebFrame* frame, void*)
-{
- if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
- char* frameName = getFrameNameSuitableForTestResult(view, frame);
- printf("%s - didHandleOnloadEventsForFrame\n", frameName);
- g_free(frameName);
- }
-}
-
-static void webViewWindowObjectCleared(WebKitWebView* view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef windowObject, gpointer data)
-{
- JSValueRef exception = 0;
- ASSERT(gLayoutTestController);
-
- gLayoutTestController->makeWindowObject(context, windowObject, &exception);
- ASSERT(!exception);
-
- gcController->makeWindowObject(context, windowObject, &exception);
- ASSERT(!exception);
-
- axController->makeWindowObject(context, windowObject, &exception);
- ASSERT(!exception);
-
- JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender");
- JSValueRef eventSender = makeEventSender(context, !webkit_web_frame_get_parent(frame));
- JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
- JSStringRelease(eventSenderStr);
-}
-
-static gboolean webViewConsoleMessage(WebKitWebView* view, const gchar* message, unsigned int line, const gchar* sourceId, gpointer data)
-{
- gchar* testMessage = 0;
- const gchar* uriScheme;
-
- // Tests expect only the filename part of local URIs
- uriScheme = g_strstr_len(message, -1, "file://");
- if (uriScheme) {
- GString* tempString = g_string_sized_new(strlen(message));
- gchar* filename = g_strrstr(uriScheme, G_DIR_SEPARATOR_S);
-
- if (filename) {
- filename += strlen(G_DIR_SEPARATOR_S);
- tempString = g_string_append_len(tempString, message, (uriScheme - message));
- tempString = g_string_append_len(tempString, filename, strlen(filename));
- testMessage = g_string_free(tempString, FALSE);
- }
- }
-
- fprintf(stdout, "CONSOLE MESSAGE: line %d: %s\n", line, testMessage ? testMessage : message);
- g_free(testMessage);
-
- return TRUE;
-}
-
-
-static gboolean webViewScriptAlert(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gpointer data)
-{
- fprintf(stdout, "ALERT: %s\n", message);
- return TRUE;
-}
-
-static gboolean webViewScriptPrompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value, gpointer data)
-{
- fprintf(stdout, "PROMPT: %s, default text: %s\n", message, defaultValue);
- *value = g_strdup(defaultValue);
- return TRUE;
-}
-
-static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm, gpointer data)
-{
- fprintf(stdout, "CONFIRM: %s\n", message);
- *didConfirm = TRUE;
- return TRUE;
-}
-
-static void webViewTitleChanged(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, gpointer data)
-{
- if (gLayoutTestController->dumpTitleChanges() && !done)
- printf("TITLE CHANGED: %s\n", title ? title : "");
-}
-
-static bool webViewNavigationPolicyDecisionRequested(WebKitWebView* view, WebKitWebFrame* frame,
- WebKitNetworkRequest* request,
- WebKitWebNavigationAction* navAction,
- WebKitWebPolicyDecision* policyDecision)
-{
- // Use the default handler if we're not waiting for policy,
- // i.e., LayoutTestController::waitForPolicyDelegate
- if (!waitForPolicy)
- return FALSE;
-
- gchar* typeDescription;
- WebKitWebNavigationReason reason;
- g_object_get(G_OBJECT(navAction), "reason", &reason, NULL);
-
- switch(reason) {
- case WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED:
- typeDescription = g_strdup("link clicked");
- break;
- case WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED:
- typeDescription = g_strdup("form submitted");
- break;
- case WEBKIT_WEB_NAVIGATION_REASON_BACK_FORWARD:
- typeDescription = g_strdup("back/forward");
- break;
- case WEBKIT_WEB_NAVIGATION_REASON_RELOAD:
- typeDescription = g_strdup("reload");
- break;
- case WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED:
- typeDescription = g_strdup("form resubmitted");
- break;
- case WEBKIT_WEB_NAVIGATION_REASON_OTHER:
- typeDescription = g_strdup("other");
- break;
- default:
- typeDescription = g_strdup("illegal value");
- }
-
- printf("Policy delegate: attempt to load %s with navigation type '%s'\n", webkit_network_request_get_uri(request), typeDescription);
- g_free(typeDescription);
-
- webkit_web_policy_decision_ignore(policyDecision);
- gLayoutTestController->notifyDone();
-
- return TRUE;
-}
-
-static void webViewStatusBarTextChanged(WebKitWebView* view, const gchar* message, gpointer data)
-{
- // Are we doing anything wrong? One test that does not call
- // dumpStatusCallbacks gets true here
- if (gLayoutTestController->dumpStatusCallbacks()) {
- if (message && strcmp(message, ""))
- printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", message);
- }
-}
-
-static gboolean webViewClose(WebKitWebView* view)
-{
- ASSERT(view);
-
- webViewList = g_slist_remove(webViewList, view);
- g_object_unref(view);
-
- return TRUE;
-}
-
-static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, WebKitWebDatabase *database)
-{
- ASSERT(view);
- ASSERT(frame);
- ASSERT(database);
-
- WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin(database);
- if (gLayoutTestController->dumpDatabaseCallbacks()) {
- printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%s\n",
- webkit_security_origin_get_protocol(origin),
- webkit_security_origin_get_host(origin),
- webkit_security_origin_get_port(origin),
- webkit_web_database_get_name(database));
- }
- webkit_security_origin_set_web_database_quota(origin, 5 * 1024 * 1024);
-}
-
-static bool
-geolocationPolicyDecisionRequested(WebKitWebView*, WebKitWebFrame*, WebKitGeolocationPolicyDecision* decision)
-{
- if (!gLayoutTestController->isGeolocationPermissionSet())
- return FALSE;
- if (gLayoutTestController->geolocationPermission())
- webkit_geolocation_policy_allow(decision);
- else
- webkit_geolocation_policy_deny(decision);
-
- return TRUE;
-}
-
-
-static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*);
-
-static gboolean webInspectorShowWindow(WebKitWebInspector*, gpointer data)
-{
- gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), 800, 600);
- gtk_widget_show_all(webInspectorWindow);
- return TRUE;
-}
-
-static gboolean webInspectorCloseWindow(WebKitWebInspector*, gpointer data)
-{
- gtk_widget_destroy(webInspectorWindow);
- webInspectorWindow = 0;
- return TRUE;
-}
-
-static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer data)
-{
- webInspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-
- GtkWidget* webView = webkit_web_view_new();
- gtk_container_add(GTK_CONTAINER(webInspectorWindow),
- webView);
-
- return WEBKIT_WEB_VIEW(webView);
-}
-
-static void webFrameLoadStatusNotified(WebKitWebFrame* frame, gpointer user_data)
-{
- WebKitLoadStatus loadStatus = webkit_web_frame_get_load_status(frame);
-
- if (gLayoutTestController->dumpFrameLoadCallbacks()) {
- GOwnPtr<char> frameName(getFrameNameSuitableForTestResult(webkit_web_frame_get_web_view(frame), frame));
-
- switch (loadStatus) {
- case WEBKIT_LOAD_PROVISIONAL:
- if (!done)
- printf("%s - didStartProvisionalLoadForFrame\n", frameName.get());
- break;
- case WEBKIT_LOAD_COMMITTED:
- if (!done)
- printf("%s - didCommitLoadForFrame\n", frameName.get());
- break;
- case WEBKIT_LOAD_FINISHED:
- if (frame != topLoadingFrame || !done)
- printf("%s - didFinishLoadForFrame\n", frameName.get());
- break;
- default:
- break;
- }
- }
-}
-
-static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, gpointer user_data)
-{
- g_signal_connect(webFrame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL);
-}
-
-static WebKitWebView* createWebView()
-{
- WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
-
- DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled(true);
-
- g_object_connect(G_OBJECT(view),
- "signal::load-started", webViewLoadStarted, 0,
- "signal::load-finished", webViewLoadFinished, 0,
- "signal::window-object-cleared", webViewWindowObjectCleared, 0,
- "signal::console-message", webViewConsoleMessage, 0,
- "signal::script-alert", webViewScriptAlert, 0,
- "signal::script-prompt", webViewScriptPrompt, 0,
- "signal::script-confirm", webViewScriptConfirm, 0,
- "signal::title-changed", webViewTitleChanged, 0,
- "signal::navigation-policy-decision-requested", webViewNavigationPolicyDecisionRequested, 0,
- "signal::status-bar-text-changed", webViewStatusBarTextChanged, 0,
- "signal::create-web-view", webViewCreate, 0,
- "signal::close-web-view", webViewClose, 0,
- "signal::database-quota-exceeded", databaseQuotaExceeded, 0,
- "signal::document-load-finished", webViewDocumentLoadFinished, 0,
- "signal::geolocation-policy-decision-requested", geolocationPolicyDecisionRequested, 0,
- "signal::onload-event", webViewOnloadEvent, 0,
- "signal::drag-begin", dragBeginCallback, 0,
- "signal::drag-end", dragEndCallback, 0,
- "signal::drag-failed", dragFailedCallback, 0,
- "signal::frame-created", frameCreatedCallback, 0,
-
- NULL);
- connectEditingCallbacks(view);
-
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
- g_object_connect(G_OBJECT(inspector),
- "signal::inspect-web-view", webInspectorInspectWebView, 0,
- "signal::show-window", webInspectorShowWindow, 0,
- "signal::close-window", webInspectorCloseWindow, 0,
- NULL);
-
- if (webView) {
- WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
- webkit_web_view_set_settings(view, settings);
- }
-
- // frame-created is not issued for main frame. That's why we must do this here
- WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
- g_signal_connect(frame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL);
-
- return view;
-}
-
-static WebKitWebView* webViewCreate(WebKitWebView* view, WebKitWebFrame* frame)
-{
- if (!gLayoutTestController->canOpenWindows())
- return 0;
-
- // Make sure that waitUntilDone has been called.
- ASSERT(gLayoutTestController->waitToDump());
-
- WebKitWebView* newWebView = createWebView();
- g_object_ref_sink(G_OBJECT(newWebView));
- webViewList = g_slist_prepend(webViewList, newWebView);
- return newWebView;
-}
-
-static void logHandler(const gchar* domain, GLogLevelFlags level, const gchar* message, gpointer data)
-{
- if (level < G_LOG_LEVEL_DEBUG)
- fprintf(stderr, "%s\n", message);
-}
-
-int main(int argc, char* argv[])
-{
- g_thread_init(NULL);
- gtk_init(&argc, &argv);
-
- // Some plugins might try to use the GLib logger for printing debug
- // messages. This will cause tests to fail because of unexpected output.
- // We squelch all debug messages sent to the logger.
- g_log_set_default_handler(logHandler, 0);
-
- initializeGlobalsFromCommandLineOptions(argc, argv);
- initializeFonts();
-
- window = gtk_window_new(GTK_WINDOW_POPUP);
- container = GTK_WIDGET(gtk_scrolled_window_new(NULL, NULL));
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(container), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add(GTK_CONTAINER(window), container);
- gtk_widget_show_all(window);
-
- webView = createWebView();
- gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(webView));
- gtk_widget_realize(GTK_WIDGET(webView));
- gtk_widget_show_all(container);
- gtk_widget_grab_focus(GTK_WIDGET(webView));
- mainFrame = webkit_web_view_get_main_frame(webView);
-
- setDefaultsToConsistentStateValuesForTesting();
-
- gcController = new GCController();
- axController = new AccessibilityController();
-
- if (useLongRunningServerMode(argc, argv)) {
- printSeparators = true;
- runTestingServerLoop();
- } else {
- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
- for (int i = optind; i != argc; ++i)
- runTest(argv[i]);
- }
-
- delete gcController;
- gcController = 0;
-
- delete axController;
- axController = 0;
-
- gtk_widget_destroy(window);
-
- return 0;
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h b/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h
deleted file mode 100644
index 7a5a4cf..0000000
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTreeGtk.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DumpRenderTreeGtk_h
-#define DumpRenderTreeGtk_h
-
-#include <webkit/webkitdefines.h>
-#include <JavaScriptCore/JSBase.h>
-
-#include <glib.h>
-
-extern WebKitWebFrame* mainFrame;
-extern WebKitWebFrame* topLoadingFrame;
-extern guint waitToDumpWatchdog;
-extern bool waitForPolicy;
-extern GSList* webViewList;
-
-gchar* JSStringCopyUTF8CString(JSStringRef jsString);
-
-#endif // DumpRenderTreeGtk_h
diff --git a/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.cpp b/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.cpp
deleted file mode 100644
index 2586611..0000000
--- a/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "EditingCallbacks.h"
-
-#include "CString.h"
-#include "DumpRenderTree.h"
-#include "GOwnPtr.h"
-#include "LayoutTestController.h"
-#include <gtk/gtk.h>
-#include <webkit/webkit.h>
-
-static CString dumpNodePath(WebKitDOMNode* node)
-{
- GOwnPtr<gchar> nodeName(webkit_dom_node_get_node_name(node));
- GString* path = g_string_new(nodeName.get());
-
- WebKitDOMNode* parent = webkit_dom_node_get_parent_node(node);
- while (parent) {
- GOwnPtr<gchar> parentName(webkit_dom_node_get_node_name(parent));
-
- g_string_append(path, " > ");
- g_string_append(path, parentName.get());
- parent = webkit_dom_node_get_parent_node(parent);
- }
-
- GOwnPtr<gchar> pathBuffer(g_string_free(path, FALSE));
- return pathBuffer.get();
-}
-
-static CString dumpRange(WebKitDOMRange* range)
-{
- if (!range)
- return "(null)";
-
- GOwnPtr<GError> error1;
- GOwnPtr<GError> error2;
- GOwnPtr<GError> error3;
- GOwnPtr<GError> error4;
- GOwnPtr<gchar> dump(g_strdup_printf("range from %li of %s to %li of %s",
- webkit_dom_range_get_start_offset(range, &error1.outPtr()),
- dumpNodePath(webkit_dom_range_get_start_container(range, &error2.outPtr())).data(),
- webkit_dom_range_get_end_offset(range, &error3.outPtr()),
- dumpNodePath(webkit_dom_range_get_end_container(range, &error4.outPtr())).data()));
- return dump.get();
-}
-
-static const char* insertActionString(WebKitInsertAction action)
-{
- switch (action) {
- case WEBKIT_INSERT_ACTION_TYPED:
- return "WebViewInsertActionTyped";
- case WEBKIT_INSERT_ACTION_PASTED:
- return "WebViewInsertActionPasted";
- case WEBKIT_INSERT_ACTION_DROPPED:
- return "WebViewInsertActionDropped";
- }
- ASSERT_NOT_REACHED();
- return "WebViewInsertActionTyped";
-}
-
-static const char* selectionAffinityString(WebKitSelectionAffinity affinity)
-{
- switch (affinity) {
- case WEBKIT_SELECTION_AFFINITY_UPSTREAM:
- return "NSSelectionAffinityUpstream";
- case WEBKIT_SELECTION_AFFINITY_DOWNSTREAM:
- return "NSSelectionAffinityDownstream";
- }
- ASSERT_NOT_REACHED();
- return "NSSelectionAffinityUpstream";
-}
-
-gboolean shouldBeginEditing(WebKitWebView* webView, WebKitDOMRange* range)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dumpRange(range).data());
- return TRUE;
-}
-
-gboolean shouldEndEditing(WebKitWebView* webView, WebKitDOMRange* range)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dumpRange(range).data());
- return TRUE;
-}
-
-gboolean shouldInsertNode(WebKitWebView* webView, WebKitDOMNode* node, WebKitDOMRange* range, WebKitInsertAction action)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n",
- dumpNodePath(node).data(), dumpRange(range).data(), insertActionString(action));
- }
- return TRUE;
-}
-
-gboolean shouldInsertText(WebKitWebView* webView, const gchar* text, WebKitDOMRange* range, WebKitInsertAction action)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n",
- text, dumpRange(range).data(), insertActionString(action));
- }
- return TRUE;
-}
-
-gboolean shouldDeleteRange(WebKitWebView* webView, WebKitDOMRange* range)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dumpRange(range).data());
- return TRUE;
-}
-
-gboolean shouldShowDeleteInterfaceForElement(WebKitWebView* webView, WebKitDOMHTMLElement* element)
-{
- GOwnPtr<gchar> elementClassName(webkit_dom_html_element_get_class_name(element));
- return g_str_equal(elementClassName.get(), "needsDeletionUI");
-}
-
-gboolean shouldChangeSelectedRange(WebKitWebView* webView, WebKitDOMRange* fromRange, WebKitDOMRange* toRange, WebKitSelectionAffinity affinity, gboolean stillSelecting)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n",
- dumpRange(fromRange).data(), dumpRange(toRange).data(), selectionAffinityString(affinity),
- stillSelecting ? "TRUE" : "FALSE");
- }
- return TRUE;
-}
-
-gboolean shouldApplyStyle(WebKitWebView* webView, WebKitDOMCSSStyleDeclaration* style, WebKitDOMRange* range)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks()) {
- GOwnPtr<gchar> styleText(webkit_dom_css_style_declaration_get_css_text(style));
- printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
- styleText.get(), dumpRange(range).data());
- }
- return TRUE;
-}
-
-void editingBegan(WebKitWebView*)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n");
-}
-
-void userChangedContents(WebKitWebView*)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n");
-}
-
-void editingEnded(WebKitWebView*)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n");
-}
-
-void selectionChanged(WebKitWebView*)
-{
- if (!done && gLayoutTestController->dumpEditingCallbacks())
- printf("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n");
-}
-
-void connectEditingCallbacks(WebKitWebView* webView)
-{
- g_object_connect(G_OBJECT(webView),
- "signal::should-begin-editing", shouldBeginEditing, 0,
- "signal::should-end-editing", shouldEndEditing, 0,
- "signal::should-insert-node", shouldInsertNode, 0,
- "signal::should-insert-text", shouldInsertText, 0,
- "signal::should-delete-range", shouldDeleteRange, 0,
- "signal::should-show-delete-interface-for-element", shouldShowDeleteInterfaceForElement, 0,
- "signal::should-change-selected-range", shouldChangeSelectedRange, 0,
- "signal::should-apply-style", shouldApplyStyle, 0,
- "signal::editing-began", editingBegan, 0,
- "signal::user-changed-contents", userChangedContents, 0,
- "signal::editing-ended", editingEnded, 0,
- "signal::selection-changed", selectionChanged, 0,
- NULL);
-}
-
diff --git a/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.h b/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.h
deleted file mode 100644
index 7a95149..0000000
--- a/WebKitTools/DumpRenderTree/gtk/EditingCallbacks.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EditingCallbacks_h
-#define EditingCallbacks_h
-
-typedef struct _WebKitWebView WebKitWebView;
-void connectEditingCallbacks(WebKitWebView*);
-
-#endif
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
deleted file mode 100644
index 6e5fa5f..0000000
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com>
- * Copyright (C) 2009 Holger Hans Peter Freyther
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "EventSender.h"
-
-#include "DumpRenderTree.h"
-
-#include <GtkVersioning.h>
-#include <JavaScriptCore/JSObjectRef.h>
-#include <JavaScriptCore/JSRetainPtr.h>
-#include <JavaScriptCore/JSStringRef.h>
-#include <webkit/webkitwebframe.h>
-#include <webkit/webkitwebview.h>
-#include <wtf/ASCIICType.h>
-#include <wtf/Platform.h>
-#include <wtf/text/CString.h>
-
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-#include <string.h>
-
-extern "C" {
- extern void webkit_web_frame_layout(WebKitWebFrame* frame);
- extern GtkMenu* webkit_web_view_get_context_menu(WebKitWebView*);
-}
-
-static bool dragMode;
-static int timeOffset = 0;
-
-static int lastMousePositionX;
-static int lastMousePositionY;
-static int lastClickPositionX;
-static int lastClickPositionY;
-static int lastClickTimeOffset;
-static int lastClickButton;
-static int buttonCurrentlyDown;
-static int clickCount;
-GdkDragContext* currentDragSourceContext;
-
-struct DelayedMessage {
- GdkEvent* event;
- gulong delay;
-};
-
-static DelayedMessage msgQueue[1024];
-
-static unsigned endOfQueue;
-static unsigned startOfQueue;
-
-static const float zoomMultiplierRatio = 1.2f;
-
-// Key event location code defined in DOM Level 3.
-enum KeyLocationCode {
- DOM_KEY_LOCATION_STANDARD = 0x00,
- DOM_KEY_LOCATION_LEFT = 0x01,
- DOM_KEY_LOCATION_RIGHT = 0x02,
- DOM_KEY_LOCATION_NUMPAD = 0x03
-};
-
-static void sendOrQueueEvent(GdkEvent*, bool = true);
-static void dispatchEvent(GdkEvent* event);
-static guint getStateFlags();
-
-static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
-{
- return JSValueMakeBoolean(context, dragMode);
-}
-
-static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
-{
- dragMode = JSValueToBoolean(context, value);
- return true;
-}
-
-static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- if (argumentCount > 0) {
- msgQueue[endOfQueue].delay = JSValueToNumber(context, arguments[0], exception);
- timeOffset += msgQueue[endOfQueue].delay;
- ASSERT(!exception || !*exception);
- }
-
- return JSValueMakeUndefined(context);
-}
-
-bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber, guint modifiers)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return false;
-
- // The logic for mapping EventSender button numbers to GDK button
- // numbers originates from the Windows EventSender.
- int gdkButtonNumber = 3;
- if (eventSenderButtonNumber >= 0 && eventSenderButtonNumber <= 2)
- gdkButtonNumber = eventSenderButtonNumber + 1;
-
- // fast/events/mouse-click-events expects the 4th button
- // to be event->button = 1, so send a middle-button event.
- else if (eventSenderButtonNumber == 3)
- gdkButtonNumber = 2;
-
- event->button.button = gdkButtonNumber;
- event->button.x = lastMousePositionX;
- event->button.y = lastMousePositionY;
- event->button.window = gtk_widget_get_window(GTK_WIDGET(view));
- g_object_ref(event->button.window);
- event->button.device = getDefaultGDKPointerDevice(event->button.window);
- event->button.state = modifiers | getStateFlags();
- event->button.time = GDK_CURRENT_TIME;
- event->button.axes = 0;
-
- int xRoot, yRoot;
- gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot);
- event->button.x_root = xRoot;
- event->button.y_root = yRoot;
-
- return true;
-}
-
-static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
-{
- GtkWidget* widget = GTK_WIDGET(JSObjectGetPrivate(object));
- CString label;
- if (GTK_IS_SEPARATOR_MENU_ITEM(widget))
- label = "<separator>";
- else
- label = gtk_menu_item_get_label(GTK_MENU_ITEM(widget));
-
- return JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data()));
-}
-
-static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
-{
- return true;
-}
-
-static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- GtkMenuItem* item = GTK_MENU_ITEM(JSObjectGetPrivate(thisObject));
- gtk_menu_item_activate(item);
- return JSValueMakeUndefined(context);
-}
-
-static JSStaticFunction staticMenuItemFunctions[] = {
- { "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-static JSStaticValue staticMenuItemValues[] = {
- { "title", getMenuItemTitleCallback, setMenuItemTitleCallback, kJSPropertyAttributeNone },
- { 0, 0, 0, 0 }
-};
-
-static JSClassRef getMenuItemClass()
-{
- static JSClassRef menuItemClass = 0;
-
- if (!menuItemClass) {
- JSClassDefinition classDefinition = {
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- classDefinition.staticFunctions = staticMenuItemFunctions;
- classDefinition.staticValues = staticMenuItemValues;
-
- menuItemClass = JSClassCreate(&classDefinition);
- }
-
- return menuItemClass;
-}
-
-
-static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS);
-
- if (!prepareMouseButtonEvent(pressEvent, 2, 0))
- return JSObjectMakeArray(context, 0, 0, 0);
-
- GdkEvent* releaseEvent = gdk_event_copy(pressEvent);
- sendOrQueueEvent(pressEvent);
-
- JSValueRef valueRef = JSObjectMakeArray(context, 0, 0, 0);
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- GtkMenu* gtkMenu = webkit_web_view_get_context_menu(view);
- if (gtkMenu) {
- GList* items = gtk_container_get_children(GTK_CONTAINER(gtkMenu));
- JSValueRef arrayValues[g_list_length(items)];
- int index = 0;
- for (GList* item = g_list_first(items); item; item = g_list_next(item)) {
- arrayValues[index] = JSObjectMake(context, getMenuItemClass(), item->data);
- index++;
- }
- if (index)
- valueRef = JSObjectMakeArray(context, index - 1, arrayValues, 0);
- }
-
- releaseEvent->type = GDK_BUTTON_RELEASE;
- sendOrQueueEvent(releaseEvent);
- return valueRef;
-}
-
-static void updateClickCount(int button)
-{
- if (lastClickPositionX != lastMousePositionX
- || lastClickPositionY != lastMousePositionY
- || lastClickButton != button
- || timeOffset - lastClickTimeOffset >= 1)
- clickCount = 1;
- else
- clickCount++;
-}
-
-static guint gdkModifersFromJSValue(JSContextRef context, const JSValueRef modifiers)
-{
- JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0);
- if (!modifiersArray)
- return 0;
-
- guint gdkModifiers = 0;
- int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, JSStringCreateWithUTF8CString("length"), 0), 0);
- for (int i = 0; i < modifiersCount; ++i) {
- JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0);
- JSStringRef string = JSValueToStringCopy(context, value, 0);
- if (JSStringIsEqualToUTF8CString(string, "ctrlKey")
- || JSStringIsEqualToUTF8CString(string, "addSelectionKey"))
- gdkModifiers |= GDK_CONTROL_MASK;
- else if (JSStringIsEqualToUTF8CString(string, "shiftKey")
- || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey"))
- gdkModifiers |= GDK_SHIFT_MASK;
- else if (JSStringIsEqualToUTF8CString(string, "altKey"))
- gdkModifiers |= GDK_MOD1_MASK;
-
- // Currently the metaKey as defined in WebCore/platform/gtk/MouseEventGtk.cpp
- // is GDK_MOD2_MASK. This code must be kept in sync with that file.
- else if (JSStringIsEqualToUTF8CString(string, "metaKey"))
- gdkModifiers |= GDK_MOD2_MASK;
-
- JSStringRelease(string);
- }
- return gdkModifiers;
-}
-
-static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- int button = 0;
- if (argumentCount == 1) {
- button = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
- }
- guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0;
-
- GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
- if (!prepareMouseButtonEvent(event, button, modifiers))
- return JSValueMakeUndefined(context);
-
- buttonCurrentlyDown = event->button.button;
-
- // Normally GDK will send both GDK_BUTTON_PRESS and GDK_2BUTTON_PRESS for
- // the second button press during double-clicks. WebKit GTK+ selectively
- // ignores the first GDK_BUTTON_PRESS of that pair using gdk_event_peek.
- // Since our events aren't ever going onto the GDK event queue, WebKit won't
- // be able to filter out the first GDK_BUTTON_PRESS, so we just don't send
- // it here. Eventually this code should probably figure out a way to get all
- // appropriate events onto the event queue and this work-around should be
- // removed.
- updateClickCount(event->button.button);
- if (clickCount == 2)
- event->type = GDK_2BUTTON_PRESS;
- else if (clickCount == 3)
- event->type = GDK_3BUTTON_PRESS;
-
- sendOrQueueEvent(event);
- return JSValueMakeUndefined(context);
-}
-
-static guint getStateFlags()
-{
- if (buttonCurrentlyDown == 1)
- return GDK_BUTTON1_MASK;
- if (buttonCurrentlyDown == 2)
- return GDK_BUTTON2_MASK;
- if (buttonCurrentlyDown == 3)
- return GDK_BUTTON3_MASK;
- return 0;
-}
-
-static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- int button = 0;
- if (argumentCount == 1) {
- button = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
- }
- guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0;
-
- GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE);
- if (!prepareMouseButtonEvent(event, button, modifiers))
- return JSValueMakeUndefined(context);
-
- lastClickPositionX = lastMousePositionX;
- lastClickPositionY = lastMousePositionY;
- lastClickButton = buttonCurrentlyDown;
- lastClickTimeOffset = timeOffset;
- buttonCurrentlyDown = 0;
-
- sendOrQueueEvent(event);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return JSValueMakeUndefined(context);
-
- if (argumentCount < 2)
- return JSValueMakeUndefined(context);
-
- lastMousePositionX = (int)JSValueToNumber(context, arguments[0], exception);
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
- lastMousePositionY = (int)JSValueToNumber(context, arguments[1], exception);
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
-
- GdkEvent* event = gdk_event_new(GDK_MOTION_NOTIFY);
- event->motion.x = lastMousePositionX;
- event->motion.y = lastMousePositionY;
-
- event->motion.time = GDK_CURRENT_TIME;
- event->motion.window = gtk_widget_get_window(GTK_WIDGET(view));
- g_object_ref(event->motion.window);
- event->button.device = getDefaultGDKPointerDevice(event->motion.window);
- event->motion.state = getStateFlags();
- event->motion.axes = 0;
-
- int xRoot, yRoot;
- gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot);
- event->motion.x_root = xRoot;
- event->motion.y_root = yRoot;
-
- sendOrQueueEvent(event, false);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef mouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return JSValueMakeUndefined(context);
-
- if (argumentCount < 2)
- return JSValueMakeUndefined(context);
-
- int horizontal = (int)JSValueToNumber(context, arguments[0], exception);
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
- int vertical = (int)JSValueToNumber(context, arguments[1], exception);
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
-
- // GTK+ doesn't support multiple direction scrolls in the same event!
- g_return_val_if_fail((!vertical || !horizontal), JSValueMakeUndefined(context));
-
- GdkEvent* event = gdk_event_new(GDK_SCROLL);
- event->scroll.x = lastMousePositionX;
- event->scroll.y = lastMousePositionY;
- event->scroll.time = GDK_CURRENT_TIME;
- event->scroll.window = gtk_widget_get_window(GTK_WIDGET(view));
- g_object_ref(event->scroll.window);
-
- if (horizontal < 0)
- event->scroll.direction = GDK_SCROLL_RIGHT;
- else if (horizontal > 0)
- event->scroll.direction = GDK_SCROLL_LEFT;
- else if (vertical < 0)
- event->scroll.direction = GDK_SCROLL_DOWN;
- else if (vertical > 0)
- event->scroll.direction = GDK_SCROLL_UP;
- else
- g_assert_not_reached();
-
- sendOrQueueEvent(event);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- // GTK doesn't support continuous scroll events.
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- if (argumentCount < 1)
- return JSValueMakeUndefined(context);
-
- // FIXME: Implement this completely once WebCore has complete drag and drop support
- return JSValueMakeUndefined(context);
-}
-
-static void sendOrQueueEvent(GdkEvent* event, bool shouldReplaySavedEvents)
-{
- // Mouse move events are queued if the previous event was queued or if a
- // delay was set up by leapForward().
- if ((dragMode && buttonCurrentlyDown) || endOfQueue != startOfQueue || msgQueue[endOfQueue].delay) {
- msgQueue[endOfQueue++].event = event;
-
- if (shouldReplaySavedEvents)
- replaySavedEvents();
-
- return;
- }
-
- dispatchEvent(event);
-}
-
-static void dispatchEvent(GdkEvent* event)
-{
- webkit_web_frame_layout(mainFrame);
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view) {
- gdk_event_free(event);
- return;
- }
-
- gtk_main_do_event(event);
-
- if (!currentDragSourceContext) {
- gdk_event_free(event);
- return;
- }
-
- if (event->type == GDK_MOTION_NOTIFY) {
- // WebKit has called gtk_drag_start(), but because the main loop isn't
- // running GDK internals don't know that the drag has started yet. Pump
- // the main loop a little bit so that GDK is in the correct state.
- while (gtk_events_pending())
- gtk_main_iteration();
-
- // Simulate a drag motion on the top-level GDK window.
- GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view));
- GdkWindow* parentWidgetWindow = gtk_widget_get_window(parentWidget);
- gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND,
- event->motion.x_root, event->motion.y_root,
- gdk_drag_context_get_selected_action(currentDragSourceContext),
- gdk_drag_context_get_actions(currentDragSourceContext),
- GDK_CURRENT_TIME);
-
- } else if (currentDragSourceContext && event->type == GDK_BUTTON_RELEASE) {
- // We've released the mouse button, we should just be able to spin the
- // event loop here and have GTK+ send the appropriate notifications for
- // the end of the drag.
- while (gtk_events_pending())
- gtk_main_iteration();
- }
-
- gdk_event_free(event);
-}
-
-void replaySavedEvents()
-{
- // First send all the events that are ready to be sent
- while (startOfQueue < endOfQueue) {
- if (msgQueue[startOfQueue].delay) {
- g_usleep(msgQueue[startOfQueue].delay * 1000);
- msgQueue[startOfQueue].delay = 0;
- }
-
- dispatchEvent(msgQueue[startOfQueue++].event);
- }
-
- startOfQueue = 0;
- endOfQueue = 0;
-}
-
-static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- if (argumentCount < 1)
- return JSValueMakeUndefined(context);
- guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0;
-
- // handle location argument.
- int location = DOM_KEY_LOCATION_STANDARD;
- if (argumentCount > 2)
- location = (int)JSValueToNumber(context, arguments[2], exception);
-
- JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
- g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
- int gdkKeySym = GDK_VoidSymbol;
- if (location == DOM_KEY_LOCATION_NUMPAD) {
- if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
- gdkKeySym = GDK_KP_Left;
- else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
- gdkKeySym = GDK_KP_Right;
- else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
- gdkKeySym = GDK_KP_Up;
- else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
- gdkKeySym = GDK_KP_Down;
- else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
- gdkKeySym = GDK_KP_Page_Up;
- else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
- gdkKeySym = GDK_KP_Page_Down;
- else if (JSStringIsEqualToUTF8CString(character, "home"))
- gdkKeySym = GDK_KP_Home;
- else if (JSStringIsEqualToUTF8CString(character, "end"))
- gdkKeySym = GDK_KP_End;
- else if (JSStringIsEqualToUTF8CString(character, "insert"))
- gdkKeySym = GDK_KP_Insert;
- else if (JSStringIsEqualToUTF8CString(character, "delete"))
- gdkKeySym = GDK_KP_Delete;
- else
- // If we get some other key specified with the numpad location,
- // crash here, so we add it sooner rather than later.
- g_assert_not_reached();
- } else {
- if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
- gdkKeySym = GDK_Left;
- else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
- gdkKeySym = GDK_Right;
- else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
- gdkKeySym = GDK_Up;
- else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
- gdkKeySym = GDK_Down;
- else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
- gdkKeySym = GDK_Page_Up;
- else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
- gdkKeySym = GDK_Page_Down;
- else if (JSStringIsEqualToUTF8CString(character, "home"))
- gdkKeySym = GDK_Home;
- else if (JSStringIsEqualToUTF8CString(character, "end"))
- gdkKeySym = GDK_End;
- else if (JSStringIsEqualToUTF8CString(character, "insert"))
- gdkKeySym = GDK_Insert;
- else if (JSStringIsEqualToUTF8CString(character, "delete"))
- gdkKeySym = GDK_Delete;
- else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
- gdkKeySym = GDK_Print;
- else if (JSStringIsEqualToUTF8CString(character, "F1"))
- gdkKeySym = GDK_F1;
- else if (JSStringIsEqualToUTF8CString(character, "F2"))
- gdkKeySym = GDK_F2;
- else if (JSStringIsEqualToUTF8CString(character, "F3"))
- gdkKeySym = GDK_F3;
- else if (JSStringIsEqualToUTF8CString(character, "F4"))
- gdkKeySym = GDK_F4;
- else if (JSStringIsEqualToUTF8CString(character, "F5"))
- gdkKeySym = GDK_F5;
- else if (JSStringIsEqualToUTF8CString(character, "F6"))
- gdkKeySym = GDK_F6;
- else if (JSStringIsEqualToUTF8CString(character, "F7"))
- gdkKeySym = GDK_F7;
- else if (JSStringIsEqualToUTF8CString(character, "F8"))
- gdkKeySym = GDK_F8;
- else if (JSStringIsEqualToUTF8CString(character, "F9"))
- gdkKeySym = GDK_F9;
- else if (JSStringIsEqualToUTF8CString(character, "F10"))
- gdkKeySym = GDK_F10;
- else if (JSStringIsEqualToUTF8CString(character, "F11"))
- gdkKeySym = GDK_F11;
- else if (JSStringIsEqualToUTF8CString(character, "F12"))
- gdkKeySym = GDK_F12;
- else {
- int charCode = JSStringGetCharactersPtr(character)[0];
- if (charCode == '\n' || charCode == '\r')
- gdkKeySym = GDK_Return;
- else if (charCode == '\t')
- gdkKeySym = GDK_Tab;
- else if (charCode == '\x8')
- gdkKeySym = GDK_BackSpace;
- else {
- gdkKeySym = gdk_unicode_to_keyval(charCode);
- if (WTF::isASCIIUpper(charCode))
- modifiers |= GDK_SHIFT_MASK;
- }
- }
- }
- JSStringRelease(character);
-
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return JSValueMakeUndefined(context);
-
- // create and send the event
- GdkEvent* pressEvent = gdk_event_new(GDK_KEY_PRESS);
- pressEvent->key.keyval = gdkKeySym;
- pressEvent->key.state = modifiers;
- pressEvent->key.window = gtk_widget_get_window(GTK_WIDGET(view));
- g_object_ref(pressEvent->key.window);
-#ifndef GTK_API_VERSION_2
- gdk_event_set_device(pressEvent, getDefaultGDKPointerDevice(pressEvent->key.window));
-#endif
-
- // When synthesizing an event, an invalid hardware_keycode value
- // can cause it to be badly processed by Gtk+.
- GdkKeymapKey* keys;
- gint n_keys;
- if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), gdkKeySym, &keys, &n_keys)) {
- pressEvent->key.hardware_keycode = keys[0].keycode;
- g_free(keys);
- }
-
- GdkEvent* releaseEvent = gdk_event_copy(pressEvent);
- dispatchEvent(pressEvent);
- releaseEvent->key.type = GDK_KEY_RELEASE;
- dispatchEvent(releaseEvent);
-
- return JSValueMakeUndefined(context);
-}
-
-static void zoomIn(gboolean fullContentsZoom)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return;
-
- webkit_web_view_set_full_content_zoom(view, fullContentsZoom);
- gfloat currentZoom = webkit_web_view_get_zoom_level(view);
- webkit_web_view_set_zoom_level(view, currentZoom * zoomMultiplierRatio);
-}
-
-static void zoomOut(gboolean fullContentsZoom)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- if (!view)
- return;
-
- webkit_web_view_set_full_content_zoom(view, fullContentsZoom);
- gfloat currentZoom = webkit_web_view_get_zoom_level(view);
- webkit_web_view_set_zoom_level(view, currentZoom / zoomMultiplierRatio);
-}
-
-static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- zoomIn(FALSE);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- zoomOut(FALSE);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- zoomIn(TRUE);
- return JSValueMakeUndefined(context);
-}
-
-static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- zoomOut(TRUE);
- return JSValueMakeUndefined(context);
-}
-
-static JSStaticFunction staticFunctions[] = {
- { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "beginDragWithFiles", beginDragWithFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-static JSStaticValue staticValues[] = {
- { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone },
- { 0, 0, 0, 0 }
-};
-
-static JSClassRef getClass(JSContextRef context)
-{
- static JSClassRef eventSenderClass = 0;
-
- if (!eventSenderClass) {
- JSClassDefinition classDefinition = {
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- classDefinition.staticFunctions = staticFunctions;
- classDefinition.staticValues = staticValues;
-
- eventSenderClass = JSClassCreate(&classDefinition);
- }
-
- return eventSenderClass;
-}
-
-JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame)
-{
- if (isTopFrame) {
- dragMode = true;
-
- // Fly forward in time one second when the main frame loads. This will
- // ensure that when a test begins clicking in the same location as
- // a previous test, those clicks won't be interpreted as continuations
- // of the previous test's click sequences.
- timeOffset += 1000;
-
- lastMousePositionX = lastMousePositionY = 0;
- lastClickPositionX = lastClickPositionY = 0;
- lastClickTimeOffset = 0;
- lastClickButton = 0;
- buttonCurrentlyDown = 0;
- clickCount = 0;
-
- endOfQueue = 0;
- startOfQueue = 0;
-
- currentDragSourceContext = 0;
- }
-
- return JSObjectMake(context, getClass(context), 0);
-}
-
-void dragBeginCallback(GtkWidget*, GdkDragContext* context, gpointer)
-{
- currentDragSourceContext = context;
-}
-
-void dragEndCallback(GtkWidget*, GdkDragContext* context, gpointer)
-{
- currentDragSourceContext = 0;
-}
-
-gboolean dragFailedCallback(GtkWidget*, GdkDragContext* context, gpointer)
-{
- // Return TRUE here to disable the stupid GTK+ drag failed animation,
- // which introduces asynchronous behavior into our drags.
- return TRUE;
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.h b/WebKitTools/DumpRenderTree/gtk/EventSender.h
deleted file mode 100644
index f440f0d..0000000
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Holger Hans Peter Freyther
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EventSender_h
-#define EventSender_h
-
-typedef const struct OpaqueJSContext* JSContextRef;
-typedef struct OpaqueJSValue* JSObjectRef;
-
-JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame);
-void replaySavedEvents();
-void dragBeginCallback(GtkWidget*, GdkDragContext*, gpointer);
-void dragEndCallback(GtkWidget*, GdkDragContext*, gpointer);
-gboolean dragFailedCallback(GtkWidget*, GdkDragContext*, gpointer);
-
-#endif
diff --git a/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp
deleted file mode 100644
index 87eb413..0000000
--- a/WebKitTools/DumpRenderTree/gtk/GCControllerGtk.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GCController.h"
-
-#include <glib.h>
-#include <webkit/webkit.h>
-
-extern "C" {
-extern void webkit_gc_collect_javascript_objects();
-extern void webkit_gc_collect_javascript_objects_on_alternate_thread(gboolean waitUntilDone);
-extern gsize webkit_gc_count_javascript_objects();
-}
-
-void GCController::collect() const
-{
- webkit_gc_collect_javascript_objects();
-}
-
-void GCController::collectOnAlternateThread(bool waitUntilDone) const
-{
- webkit_gc_collect_javascript_objects_on_alternate_thread(waitUntilDone);
-}
-
-size_t GCController::getJSObjectCount() const
-{
- return webkit_gc_count_javascript_objects();
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/ImageDiff.cpp b/WebKitTools/DumpRenderTree/gtk/ImageDiff.cpp
deleted file mode 100644
index 7e2744a..0000000
--- a/WebKitTools/DumpRenderTree/gtk/ImageDiff.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com>
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <algorithm>
-#include <cmath>
-#include <cstdio>
-#include <cstring>
-#include <gdk/gdk.h>
-
-using namespace std;
-
-static double tolerance = 0;
-static GOptionEntry commandLineOptionEntries[] =
-{
- { "tolerance", 0, 0, G_OPTION_ARG_DOUBLE, &tolerance, "Percentage difference between images before considering them different", "T" },
- { 0, 0, 0, G_OPTION_ARG_NONE, 0, 0, 0 },
-};
-
-GdkPixbuf* readPixbufFromStdin(long imageSize)
-{
- unsigned char imageBuffer[2048];
- GdkPixbufLoader* loader = gdk_pixbuf_loader_new_with_type("png", 0);
- GError* error = 0;
-
- while (imageSize > 0) {
- size_t bytesToRead = min<int>(imageSize, 2048);
- size_t bytesRead = fread(imageBuffer, 1, bytesToRead, stdin);
-
- if (!gdk_pixbuf_loader_write(loader, reinterpret_cast<const guchar*>(imageBuffer), bytesRead, &error)) {
- g_error_free(error);
- gdk_pixbuf_loader_close(loader, 0);
- g_object_unref(loader);
- return 0;
- }
-
- imageSize -= static_cast<int>(bytesRead);
- }
-
- gdk_pixbuf_loader_close(loader, 0);
- GdkPixbuf* decodedImage = gdk_pixbuf_loader_get_pixbuf(loader);
- g_object_ref(decodedImage);
- return decodedImage;
-}
-
-GdkPixbuf* differenceImageFromDifferenceBuffer(unsigned char* buffer, int width, int height)
-{
- GdkPixbuf* image = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- if (!image)
- return image;
-
- int rowStride = gdk_pixbuf_get_rowstride(image);
- unsigned char* diffPixels = gdk_pixbuf_get_pixels(image);
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- unsigned char* diffPixel = diffPixels + (y * rowStride) + (x * 3);
- diffPixel[0] = diffPixel[1] = diffPixel[2] = *buffer++;
- }
- }
-
- return image;
-}
-
-float calculateDifference(GdkPixbuf* baselineImage, GdkPixbuf* actualImage, GdkPixbuf** differenceImage)
-{
- int width = gdk_pixbuf_get_width(actualImage);
- int height = gdk_pixbuf_get_height(actualImage);
- int numberOfChannels = gdk_pixbuf_get_n_channels(actualImage);
- if ((width != gdk_pixbuf_get_width(baselineImage))
- || (height != gdk_pixbuf_get_height(baselineImage))
- || (numberOfChannels != gdk_pixbuf_get_n_channels(baselineImage))
- || (gdk_pixbuf_get_has_alpha(actualImage) != gdk_pixbuf_get_has_alpha(baselineImage))) {
- fprintf(stderr, "Error, test and reference image have different properties.\n");
- return 100; // Completely different.
- }
-
- unsigned char* diffBuffer = static_cast<unsigned char*>(malloc(width * height));
- float count = 0;
- float sum = 0;
- float maxDistance = 0;
- int actualRowStride = gdk_pixbuf_get_rowstride(actualImage);
- int baseRowStride = gdk_pixbuf_get_rowstride(baselineImage);
- unsigned char* actualPixels = gdk_pixbuf_get_pixels(actualImage);
- unsigned char* basePixels = gdk_pixbuf_get_pixels(baselineImage);
- unsigned char* currentDiffPixel = diffBuffer;
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- unsigned char* actualPixel = actualPixels + (y * actualRowStride) + (x * numberOfChannels);
- unsigned char* basePixel = basePixels + (y * baseRowStride) + (x * numberOfChannels);
-
- float red = (actualPixel[0] - basePixel[0]) / max<float>(255 - basePixel[0], basePixel[0]);
- float green = (actualPixel[1] - basePixel[1]) / max<float>(255 - basePixel[1], basePixel[1]);
- float blue = (actualPixel[2] - basePixel[2]) / max<float>(255 - basePixel[2], basePixel[2]);
- float alpha = (actualPixel[3] - basePixel[3]) / max<float>(255 - basePixel[3], basePixel[3]);
- float distance = sqrtf(red * red + green * green + blue * blue + alpha * alpha) / 2.0f;
-
- *currentDiffPixel++ = (unsigned char)(distance * 255.0f);
-
- if (distance >= 1.0f / 255.0f) {
- count += 1.0f;
- sum += distance;
- maxDistance = max<float>(maxDistance, distance);
- }
- }
- }
-
- // Compute the difference as a percentage combining both the number of
- // different pixels and their difference amount i.e. the average distance
- // over the entire image
- float difference = 0;
- if (count > 0.0f)
- difference = 100.0f * sum / (height * width);
- if (difference <= tolerance)
- difference = 0;
- else {
- difference = roundf(difference * 100.0f) / 100.0f;
- difference = max(difference, 0.01f); // round to 2 decimal places
- *differenceImage = differenceImageFromDifferenceBuffer(diffBuffer, width, height);
- }
-
- free(diffBuffer);
- return difference;
-}
-
-void printImage(GdkPixbuf* image)
-{
- char* buffer;
- gsize bufferSize;
- GError* error = 0;
- if (!gdk_pixbuf_save_to_buffer(image, &buffer, &bufferSize, "png", &error, NULL)) {
- g_error_free(error);
- return; // Don't bail out, as we can still use the percentage output.
- }
-
- printf("Content-Length: %"G_GSIZE_FORMAT"\n", bufferSize);
- fwrite(buffer, 1, bufferSize, stdout);
-}
-
-void printImageDifferences(GdkPixbuf* baselineImage, GdkPixbuf* actualImage)
-{
- GdkPixbuf* differenceImage = 0;
- float difference = calculateDifference(baselineImage, actualImage, &differenceImage);
- if (difference > 0.0f) {
- if (differenceImage) {
- printImage(differenceImage);
- g_object_unref(differenceImage);
- }
- printf("diff: %01.2f%% failed\n", difference);
- } else {
- printf("diff: %01.2f%% passed\n", difference);
- }
-}
-
-int main(int argc, char* argv[])
-{
- gdk_init(&argc, &argv);
-
- GError* error = 0;
- GOptionContext* context = g_option_context_new("- compare two image files, printing their percentage difference and the difference image to stdout");
- g_option_context_add_main_entries(context, commandLineOptionEntries, 0);
- if (!g_option_context_parse(context, &argc, &argv, &error)) {
- printf("Option parsing failed: %s\n", error->message);
- g_error_free(error);
- return 1;
- }
-
- GdkPixbuf* actualImage = 0;
- GdkPixbuf* baselineImage = 0;
- char buffer[2048];
- while (fgets(buffer, sizeof(buffer), stdin)) {
- // Convert the first newline into a NUL character so that strtok doesn't produce it.
- char* newLineCharacter = strchr(buffer, '\n');
- if (newLineCharacter)
- *newLineCharacter = '\0';
-
- if (!strncmp("Content-Length: ", buffer, 16)) {
- gchar** tokens = g_strsplit(buffer, " ", 0);
- if (!tokens[1]) {
- g_strfreev(tokens);
- printf("Error, image size must be specified..\n");
- return 1;
- }
-
- long imageSize = strtol(tokens[1], 0, 10);
- g_strfreev(tokens);
- if (imageSize > 0 && !actualImage) {
- if (!(actualImage = readPixbufFromStdin(imageSize))) {
- printf("Error, could not read actual image.\n");
- return 1;
- }
- } else if (imageSize > 0 && !baselineImage) {
- if (!(baselineImage = readPixbufFromStdin(imageSize))) {
- printf("Error, could not read baseline image.\n");
- return 1;
- }
- } else {
- printf("Error, image size must be specified..\n");
- return 1;
- }
- }
-
- if (actualImage && baselineImage) {
- printImageDifferences(baselineImage, actualImage);
- g_object_unref(actualImage);
- g_object_unref(baselineImage);
- actualImage = 0;
- baselineImage = 0;
- }
-
- fflush(stdout);
- }
-
- return 0;
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
deleted file mode 100644
index 9c3ede0..0000000
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
- * Copyright (C) 2008 Nuanti Ltd.
- * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
- * Copyright (C) 2009 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayoutTestController.h"
-
-#include "DumpRenderTree.h"
-#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
-#include "WorkQueue.h"
-#include "WorkQueueItem.h"
-#include <JavaScriptCore/JSRetainPtr.h>
-#include <JavaScriptCore/JSStringRef.h>
-#include <cstring>
-#include <iostream>
-#include <sstream>
-#include <stdio.h>
-#include <glib.h>
-#include <libsoup/soup.h>
-#include <webkit/webkit.h>
-#include <wtf/gobject/GOwnPtr.h>
-
-extern "C" {
-bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
-void webkit_web_frame_suspend_animations(WebKitWebFrame* frame);
-void webkit_web_frame_resume_animations(WebKitWebFrame* frame);
-void webkit_application_cache_set_maximum_size(unsigned long long size);
-unsigned int webkit_worker_thread_count(void);
-void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
-gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
-int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
-int webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight);
-void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
-gchar* webkit_web_frame_marker_text_for_list_item(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject);
-void webkit_web_view_execute_core_command_by_name(WebKitWebView* webView, const gchar* name, const gchar* value);
-gboolean webkit_web_view_is_command_enabled(WebKitWebView* webView, const gchar* name);
-}
-
-LayoutTestController::~LayoutTestController()
-{
- // FIXME: implement
-}
-
-void LayoutTestController::addDisallowedURL(JSStringRef url)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::clearBackForwardList()
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView);
- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_current_item(list);
- g_object_ref(item);
-
- // We clear the history by setting the back/forward list's capacity to 0
- // then restoring it back and adding back the current item.
- gint limit = webkit_web_back_forward_list_get_limit(list);
- webkit_web_back_forward_list_set_limit(list, 0);
- webkit_web_back_forward_list_set_limit(list, limit);
- webkit_web_back_forward_list_add_item(list, item);
- webkit_web_back_forward_list_go_to_item(list, item);
- g_object_unref(item);
-}
-
-JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name)
-{
- // FIXME: implement
- return 0;
-}
-
-JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name)
-{
- // FIXME: implement
- return 0;
-}
-
-void LayoutTestController::dispatchPendingLoadRequests()
-{
- // FIXME: Implement for testing fix for 6727495
-}
-
-void LayoutTestController::display()
-{
- displayWebView();
-}
-
-JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
-{
- gchar* idGChar = JSStringCopyUTF8CString(id);
- gchar* counterValueGChar = webkit_web_frame_counter_value_for_element_by_id(mainFrame, idGChar);
- g_free(idGChar);
- if (!counterValueGChar)
- return 0;
- JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar));
- return counterValue;
-}
-
-void LayoutTestController::keepWebHistory()
-{
- // FIXME: implement
-}
-
-JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
-{
- // FIXME: Implement this.
- return JSValueMakeUndefined(context);
-}
-
-JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
-{
- return DumpRenderTreeSupportGtk::nodesFromRect(context, value, x, y, top, right, bottom, left, ignoreClipping);
-}
-
-JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
-{
- // FIXME: implement
- JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithUTF8CString(""));
- return string;
-}
-
-int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidth, float pageHeight)
-{
- gchar* idGChar = JSStringCopyUTF8CString(id);
- int pageNumber = webkit_web_frame_page_number_for_element_by_id(mainFrame, idGChar, pageWidth, pageHeight);
- g_free(idGChar);
- return pageNumber;
-}
-
-int LayoutTestController::numberOfPages(float pageWidth, float pageHeight)
-{
- return webkit_web_frame_number_of_pages(mainFrame, pageWidth, pageHeight);
-}
-
-JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
-{
- // FIXME: implement
- return JSRetainPtr<JSStringRef>();
-}
-
-bool LayoutTestController::isPageBoxVisible(int pageNumber) const
-{
- // FIXME: implement
- return false;
-}
-
-JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const
-{
- // FIXME: implement
- return JSRetainPtr<JSStringRef>();
-}
-
-size_t LayoutTestController::webHistoryItemCount()
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView);
-
- if (!list)
- return -1;
-
- // We do not add the current page to the total count as it's not
- // considered in DRT tests
- return webkit_web_back_forward_list_get_back_length(list) +
- webkit_web_back_forward_list_get_forward_length(list);
-}
-
-unsigned LayoutTestController::workerThreadCount() const
-{
- return webkit_worker_thread_count();
-}
-
-void LayoutTestController::notifyDone()
-{
- if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count())
- dump();
- m_waitToDump = false;
- waitForPolicy = false;
-}
-
-JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
-{
- // Function introduced in r28690. This may need special-casing on Windows.
- return JSStringRetain(url); // Do nothing on Unix.
-}
-
-void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
-{
- gchar* relativeURL = JSStringCopyUTF8CString(url);
- SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame));
-
- SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL);
- soup_uri_free(baseURI);
- g_free(relativeURL);
-
- gchar* absoluteCString;
- if (absoluteURI) {
- absoluteCString = soup_uri_to_string(absoluteURI, FALSE);
- soup_uri_free(absoluteURI);
- } else
- absoluteCString = JSStringCopyUTF8CString(url);
-
- JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteCString));
- g_free(absoluteCString);
-
- WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
-}
-
-void LayoutTestController::setAcceptsEditing(bool acceptsEditing)
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- webkit_web_view_set_editable(webView, acceptsEditing);
-}
-
-void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies)
-{
-#ifdef HAVE_LIBSOUP_2_29_90
- SoupSession* session = webkit_get_default_session();
- SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
-
- /* If the jar was not created - we create it on demand, i.e, just
- in case we have HTTP requests - then we must create it here in
- order to set the proper accept policy */
- if (!jar) {
- jar = soup_cookie_jar_new();
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar));
- g_object_unref(jar);
- }
-
- SoupCookieJarAcceptPolicy policy;
-
- if (alwaysAcceptCookies)
- policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
- else
- policy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
-
- g_object_set(G_OBJECT(jar), SOUP_COOKIE_JAR_ACCEPT_POLICY, policy, NULL);
-#endif
-}
-
-void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::waitForPolicyDelegate()
-{
- waitForPolicy = true;
- setWaitToDump(true);
-}
-
-void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains)
-{
- gchar* sourceOriginGChar = JSStringCopyUTF8CString(sourceOrigin);
- gchar* protocolGChar = JSStringCopyUTF8CString(protocol);
- gchar* hostGChar = JSStringCopyUTF8CString(host);
- webkit_white_list_access_from_origin(sourceOriginGChar, protocolGChar, hostGChar, includeSubdomains);
- g_free(sourceOriginGChar);
- g_free(protocolGChar);
- g_free(hostGChar);
-}
-
-void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
- g_object_set(G_OBJECT(settings), "tab-key-cycles-through-elements", cycles, NULL);
-}
-
-void LayoutTestController::setTimelineProfilingEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
- g_object_set(G_OBJECT(inspector), "timeline-profiling-enabled", flag, NULL);
-}
-
-void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
-{
- // FIXME: implement
-}
-
-static gchar* userStyleSheet = NULL;
-static gboolean userStyleSheetEnabled = TRUE;
-
-void LayoutTestController::setUserStyleSheetEnabled(bool flag)
-{
- userStyleSheetEnabled = flag;
-
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
- if (flag && userStyleSheet)
- g_object_set(G_OBJECT(settings), "user-stylesheet-uri", userStyleSheet, NULL);
- else
- g_object_set(G_OBJECT(settings), "user-stylesheet-uri", "", NULL);
-}
-
-void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
-{
- g_free(userStyleSheet);
- userStyleSheet = JSStringCopyUTF8CString(path);
- if (userStyleSheetEnabled)
- setUserStyleSheetEnabled(true);
-}
-
-void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- char* viewMode = JSStringCopyUTF8CString(mode);
-
- if (!g_strcmp0(viewMode, "windowed"))
- webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED);
- else if (!g_strcmp0(viewMode, "floating"))
- webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_FLOATING);
- else if (!g_strcmp0(viewMode, "fullscreen"))
- webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_FULLSCREEN);
- else if (!g_strcmp0(viewMode, "maximized"))
- webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_MAXIMIZED);
- else if (!g_strcmp0(viewMode, "minimized"))
- webkit_web_view_set_view_mode(view, WEBKIT_WEB_VIEW_VIEW_MODE_MINIMIZED);
-
- g_free(viewMode);
-}
-
-void LayoutTestController::setWindowIsKey(bool windowIsKey)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
-{
- // FIXME: implement
-}
-
-static gboolean waitToDumpWatchdogFired(void*)
-{
- waitToDumpWatchdog = 0;
- gLayoutTestController->waitToDumpWatchdogTimerFired();
- return FALSE;
-}
-
-void LayoutTestController::setWaitToDump(bool waitUntilDone)
-{
- static const int timeoutSeconds = 30;
-
- m_waitToDump = waitUntilDone;
- if (m_waitToDump && !waitToDumpWatchdog)
- waitToDumpWatchdog = g_timeout_add_seconds(timeoutSeconds, waitToDumpWatchdogFired, 0);
-}
-
-int LayoutTestController::windowCount()
-{
- // +1 -> including the main view
- return g_slist_length(webViewList) + 1;
-}
-
-void LayoutTestController::setPrivateBrowsingEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-private-browsing", flag, NULL);
-}
-
-void LayoutTestController::setJavaScriptCanAccessClipboard(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "javascript-can-access-clipboard", flag, NULL);
-}
-
-void LayoutTestController::setXSSAuditorEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-xss-auditor", flag, NULL);
-}
-
-void LayoutTestController::setFrameFlatteningEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-frame-flattening", flag, NULL);
-}
-
-void LayoutTestController::setSpatialNavigationEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-spatial-navigation", flag, NULL);
-}
-
-void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-universal-access-from-file-uris", flag, NULL);
-}
-
-void LayoutTestController::setAllowFileAccessFromFileURLs(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "enable-file-access-from-file-uris", flag, NULL);
-}
-
-void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::disableImageLoading()
-{
- // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896
- // Also need to make sure image loading is re-enabled for each new test.
-}
-
-void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
-{
- // FIXME: Implement for DeviceOrientation layout tests.
- // See https://bugs.webkit.org/show_bug.cgi?id=30335.
-}
-
-void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
-{
- // FIXME: Implement for Geolocation layout tests.
- // See https://bugs.webkit.org/show_bug.cgi?id=28264.
-}
-
-void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
-{
- // FIXME: Implement for Geolocation layout tests.
- // See https://bugs.webkit.org/show_bug.cgi?id=28264.
-}
-
-void LayoutTestController::setGeolocationPermission(bool allow)
-{
- // FIXME: Implement for Geolocation layout tests.
- setGeolocationPermissionCommon(allow);
-}
-
-void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
-{
- // FIXME: Implement for speech input layout tests.
- // See https://bugs.webkit.org/show_bug.cgi?id=39485.
-}
-
-void LayoutTestController::setIconDatabaseEnabled(bool flag)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- setDeveloperExtrasEnabled(flag);
-
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
- g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", flag, NULL);
-}
-
-void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setPopupBlockingEnabled(bool flag)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- g_object_set(G_OBJECT(settings), "javascript-can-open-windows-automatically", !flag, NULL);
-
-}
-
-void LayoutTestController::setPluginsEnabled(bool flag)
-{
- // FIXME: Implement
-}
-
-bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
-{
- // FIXME: implement
- return false;
-}
-
-void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- gchar* cName = JSStringCopyUTF8CString(name);
- gchar* cValue = JSStringCopyUTF8CString(value);
- webkit_web_view_execute_core_command_by_name(view, cName, cValue);
- g_free(cName);
- g_free(cValue);
-}
-
-bool LayoutTestController::isCommandEnabled(JSStringRef name)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- gchar* cName = JSStringCopyUTF8CString(name);
- gboolean result = webkit_web_view_is_command_enabled(view, cName);
- g_free(cName);
- return result;
-}
-
-void LayoutTestController::setCacheModel(int)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::clearPersistentUserStyleSheet()
-{
- // FIXME: implement
-}
-
-void LayoutTestController::clearAllApplicationCaches()
-{
- // FIXME: implement to support Application Cache quotas.
-}
-
-void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota)
-{
- // FIXME: implement to support Application Cache quotas.
-}
-
-void LayoutTestController::clearAllDatabases()
-{
- webkit_remove_all_web_databases();
-}
-
-void LayoutTestController::setDatabaseQuota(unsigned long long quota)
-{
- WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(mainFrame);
- webkit_security_origin_set_web_database_quota(origin, quota);
-}
-
-void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef)
-{
- // FIXME: implement
-}
-
-void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
-{
- webkit_application_cache_set_maximum_size(size);
-}
-
-bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
-{
- gchar* name = JSStringCopyUTF8CString(animationName);
- gchar* element = JSStringCopyUTF8CString(elementId);
- bool returnValue = webkit_web_frame_pause_animation(mainFrame, name, time, element);
- g_free(name);
- g_free(element);
- return returnValue;
-}
-
-bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
-{
- gchar* name = JSStringCopyUTF8CString(propertyName);
- gchar* element = JSStringCopyUTF8CString(elementId);
- bool returnValue = webkit_web_frame_pause_transition(mainFrame, name, time, element);
- g_free(name);
- g_free(element);
- return returnValue;
-}
-
-bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
-{
- gchar* name = JSStringCopyUTF8CString(animationId);
- gchar* element = JSStringCopyUTF8CString(elementId);
- bool returnValue = webkit_web_frame_pause_svg_animation(mainFrame, name, time, element);
- g_free(name);
- g_free(element);
- return returnValue;
-}
-
-unsigned LayoutTestController::numberOfActiveAnimations() const
-{
- return webkit_web_frame_number_of_active_animations(mainFrame);
-}
-
-void LayoutTestController::suspendAnimations() const
-{
- webkit_web_frame_suspend_animations(mainFrame);
-}
-
-void LayoutTestController::resumeAnimations() const
-{
- webkit_web_frame_resume_animations(mainFrame);
-}
-
-void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value)
-{
- GOwnPtr<gchar> originalName(JSStringCopyUTF8CString(key));
- GOwnPtr<gchar> valueAsString(JSStringCopyUTF8CString(value));
-
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- ASSERT(view);
-
- // This transformation could be handled by a hash table (and it once was), but
- // having it prominent, makes it easier for people from other ports to keep the
- // list up to date.
- const gchar* propertyName = 0;
- if (g_str_equal(originalName.get(), "WebKitJavaScriptEnabled"))
- propertyName = "enable-scripts";
- else if (g_str_equal(originalName.get(), "WebKitDefaultFontSize"))
- propertyName = "default-font-size";
- else if (g_str_equal(originalName.get(), "WebKitEnableCaretBrowsing"))
- propertyName = "enable-caret-browsing";
- else if (g_str_equal(originalName.get(), "WebKitUsesPageCachePreferenceKey"))
- propertyName = "enable-page-cache";
- else if (g_str_equal(originalName.get(), "WebKitPluginsEnabled"))
- propertyName = "enable-plugins";
- else if (g_str_equal(originalName.get(), "WebKitHyperlinkAuditingEnabled"))
- propertyName = "enable-hyperlink-auditing";
- else if (g_str_equal(originalName.get(), "WebKitTabToLinksPreferenceKey")) {
- DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(!g_ascii_strcasecmp(valueAsString.get(), "true") || !g_ascii_strcasecmp(valueAsString.get(), "1"));
- return;
- } else {
- fprintf(stderr, "LayoutTestController::overridePreference tried to override "
- "unknown preference '%s'.\n", originalName.get());
- return;
- }
-
- WebKitWebSettings* settings = webkit_web_view_get_settings(view);
- GParamSpec* pspec = g_object_class_find_property(G_OBJECT_CLASS(
- WEBKIT_WEB_SETTINGS_GET_CLASS(settings)), propertyName);
- GValue currentPropertyValue = { 0, { { 0 } } };
- g_value_init(&currentPropertyValue, pspec->value_type);
-
- if (G_VALUE_HOLDS_STRING(&currentPropertyValue))
- g_object_set(settings, propertyName, valueAsString.get(), NULL);
- else if (G_VALUE_HOLDS_BOOLEAN(&currentPropertyValue))
- g_object_set(G_OBJECT(settings), propertyName, !g_ascii_strcasecmp(valueAsString.get(), "true")
- || !g_ascii_strcasecmp(valueAsString.get(), "1"), NULL);
- else if (G_VALUE_HOLDS_INT(&currentPropertyValue))
- g_object_set(G_OBJECT(settings), propertyName, atoi(valueAsString.get()), NULL);
- else if (G_VALUE_HOLDS_FLOAT(&currentPropertyValue)) {
- gfloat newValue = g_ascii_strtod(valueAsString.get(), 0);
- g_object_set(G_OBJECT(settings), propertyName, newValue, NULL);
- } else
- fprintf(stderr, "LayoutTestController::overridePreference failed to override "
- "preference '%s'.\n", originalName.get());
-}
-
-void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
-{
- printf("LayoutTestController::addUserScript not implemented.\n");
-}
-
-void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
-{
- printf("LayoutTestController::addUserStyleSheet not implemented.\n");
-}
-
-void LayoutTestController::setDeveloperExtrasEnabled(bool enabled)
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView);
-
- g_object_set(webSettings, "enable-developer-extras", enabled, NULL);
-}
-
-void LayoutTestController::showWebInspector()
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
-
- webkit_web_inspector_show(inspector);
-}
-
-void LayoutTestController::closeWebInspector()
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
-
- webkit_web_inspector_close(inspector);
-}
-
-void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
- char* scriptString = JSStringCopyUTF8CString(script);
-
- webkit_web_inspector_execute_script(inspector, callId, scriptString);
- g_free(scriptString);
-}
-
-void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
-{
- // FIXME: Implement this.
-}
-
-void LayoutTestController::removeAllVisitedLinks()
-{
- // FIXME: Implement this.
-}
-
-bool LayoutTestController::callShouldCloseOnWebView()
-{
- // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27481
- return false;
-}
-
-void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL)
-{
-
-}
-
-void LayoutTestController::apiTestGoToCurrentBackForwardItem()
-{
-
-}
-
-void LayoutTestController::setWebViewEditable(bool)
-{
-}
-
-JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
-{
- gchar* markerTextGChar = webkit_web_frame_marker_text_for_list_item(mainFrame, context, nodeObject);
- if (!markerTextGChar)
- return 0;
-
- JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextGChar));
- g_free(markerTextGChar);
- return markerText;
-}
-
-void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
-{
-}
-
-void LayoutTestController::setEditingBehavior(const char* editingBehavior)
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
-
- if (!strcmp(editingBehavior, "win"))
- g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_WINDOWS, NULL);
- else if (!strcmp(editingBehavior, "mac"))
- g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC, NULL);
- else if (!strcmp(editingBehavior, "unix"))
- g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_UNIX, NULL);
-}
-
-void LayoutTestController::abortModal()
-{
-}
-
-bool LayoutTestController::hasSpellingMarker(int, int)
-{
- // FIXME: Implement this.
- return false;
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp b/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp
deleted file mode 100644
index 4073403..0000000
--- a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 Zan Dobersek <zandobersek@gmail.com>
- * Copyright (C) 2010 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "DumpRenderTree.h"
-#include "PixelDumpSupportCairo.h"
-#include <webkit/webkit.h>
-
-PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool)
-{
- WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
- gint width, height;
-#ifdef GTK_API_VERSION_2
- GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0);
- gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height);
-#else
- width = gtk_widget_get_allocated_width(GTK_WIDGET(view));
- height = gtk_widget_get_allocated_height(GTK_WIDGET(view));
-#endif
-
- cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
- cairo_t* context = cairo_create(imageSurface);
-#ifdef GTK_API_VERSION_2
- gdk_cairo_set_source_pixmap(context, pixmap, 0, 0);
- cairo_paint(context);
- g_object_unref(pixmap);
-#else
- gtk_widget_draw(GTK_WIDGET(view), context);
-#endif
-
- return BitmapContext::createByAdoptingBitmapAndContext(0, context);
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp b/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
deleted file mode 100644
index 0f44f54..0000000
--- a/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WorkQueueItem.h"
-
-#include "DumpRenderTree.h"
-
-#include <GOwnPtr.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()
-gchar* JSStringCopyUTF8CString(JSStringRef jsString)
-{
- size_t dataSize = JSStringGetMaximumUTF8CStringSize(jsString);
- gchar* utf8 = (gchar*)g_malloc(dataSize);
- JSStringGetUTF8CString(jsString, utf8, dataSize);
-
- return utf8;
-}
-
-bool LoadItem::invoke() const
-{
- gchar* targetString = JSStringCopyUTF8CString(m_target.get());
-
- WebKitWebFrame* targetFrame;
- if (!strlen(targetString))
- targetFrame = mainFrame;
- else
- targetFrame = webkit_web_frame_find_frame(mainFrame, targetString);
- g_free(targetString);
-
- gchar* urlString = JSStringCopyUTF8CString(m_url.get());
- WebKitNetworkRequest* request = webkit_network_request_new(urlString);
- g_free(urlString);
- webkit_web_frame_load_request(targetFrame, request);
- g_object_unref(request);
-
- return true;
-}
-
-bool LoadHTMLStringItem::invoke() const
-{
- GOwnPtr<gchar> content(JSStringCopyUTF8CString(m_content.get()));
- GOwnPtr<gchar> baseURL(JSStringCopyUTF8CString(m_baseURL.get()));
- webkit_web_frame_load_string(mainFrame, content.get(), 0, 0, baseURL.get());
- return true;
-}
-
-bool ReloadItem::invoke() const
-{
- webkit_web_frame_reload(mainFrame);
- return true;
-}
-
-bool ScriptItem::invoke() const
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- gchar* scriptString = JSStringCopyUTF8CString(m_script.get());
- webkit_web_view_execute_script(webView, scriptString);
- g_free(scriptString);
- return true;
-}
-
-bool BackForwardItem::invoke() const
-{
- WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
- if (m_howFar == 1)
- webkit_web_view_go_forward(webView);
- else if (m_howFar == -1)
- webkit_web_view_go_back(webView);
- else {
- WebKitWebBackForwardList* webBackForwardList = webkit_web_view_get_back_forward_list(webView);
- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(webBackForwardList, m_howFar);
- webkit_web_view_go_to_back_forward_item(webView, item);
- }
- return true;
-}
diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/AHEM____.TTF b/WebKitTools/DumpRenderTree/gtk/fonts/AHEM____.TTF
deleted file mode 100644
index ac81cb0..0000000
--- a/WebKitTools/DumpRenderTree/gtk/fonts/AHEM____.TTF
+++ /dev/null
Binary files differ
diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf
deleted file mode 100644
index 2d9af17..0000000
--- a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf
+++ /dev/null
@@ -1,390 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<fontconfig>
-
- <!-- Due to patent (http://freetype.sourceforge.net/patents.html)
- issues hinting gives different results depending on the
- freetype version of the linux distribution, avoiding hinting
- gives more consistent results. When all the distributions
- release freetype the 2.4, which enables by default the
- hinting method that was patented, we could undo this change
- and try the hinting again. -->
- <match target="font">
- <edit name="hinting" mode="assign">
- <bool>false</bool>
- </edit>
- </match>
-
- <!-- The sans-serif font should be Liberation Serif -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>serif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Times</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Times New Roman</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- </match>
-
- <!-- Until we find good fonts to use for cursive and fantasy
- just use our serif font. -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>cursive</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>fantasy</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- </match>
-
- <!-- The sans-serif font should be Liberation Sans -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>sans serif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>sans</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- </match>
- <!-- We need to ensure that layout tests that use "Helvetica" don't
- fall back to the default serif font -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>Helvetica</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Arial</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Lucida Grande</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- </match>
-
- <!-- The Monospace font should be Liberation Mono -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>monospace</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Mono</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>mono</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Mono</string>
- </edit>
- </match>
- <!-- We need to ensure that layout tests that use "Courier", "Courier New",
- and "Monaco" (all monospace fonts) don't fall back to the default
- serif font -->
- <match target="pattern">
- <test qual="any" name="family">
- <string>Courier</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Mono</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Courier New</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Mono</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>Monaco</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Mono</string>
- </edit>
- </match>
-
- <!-- The following hinting specializations are adapted from those in the
- Chromium test_shell. We try to duplicate their incredibly thorough
- testing here -->
- <match target="pattern">
- <test name="family" compare="eq">
- <string>NonAntiAliasedSans</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- <edit name="antialias" mode="assign">
- <bool>false</bool>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>SlightHintedSerif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- <edit name="hinting" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="hintstyle" mode="assign">
- <const>hintslight</const>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>NonHintedSans</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- <!-- These deliberately contradict each other. The 'hinting' preference
- should take priority -->
- <edit name="hintstyle" mode="assign">
- <const>hintfull</const>
- </edit>
- <edit name="hinting" mode="assign">
- <bool>false</bool>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>AutohintedSerif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- <edit name="hinting" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="autohint" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="hintstyle" mode="assign">
- <const>hintmedium</const>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>HintedSerif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- <edit name="hinting" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="autohint" mode="assign">
- <bool>false</bool>
- </edit>
- <edit name="hintstyle" mode="assign">
- <const>hintmedium</const>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>FullAndAutoHintedSerif</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Serif</string>
- </edit>
- <edit name="hinting" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="autohint" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="hintstyle" mode="assign">
- <const>hintfull</const>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>SubpixelEnabledSans</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- <edit name="rgba" mode="assign">
- <const>rgb</const>
- </edit>
- </match>
-
- <match target="pattern">
- <test name="family" compare="eq">
- <string>SubpixelDisabledSans</string>
- </test>
- <edit name="family" mode="assign">
- <string>Liberation Sans</string>
- </edit>
- <edit name="rgba" mode="assign">
- <const>none</const>
- </edit>
- </match>
-
- <!-- We need to enable simulated bold to for DejaVu Serif to ensure that we interpret
- this property correctly in: platform/gtk/fonts/fontconfig-synthetic-bold.html -->
- <match target="font">
- <test qual="any" name="family">
- <string>DejaVu Serif</string>
- </test>
- <test name="weight" compare="less_eq">
- <const>medium</const>
- </test>
- <test target="pattern" name="weight" compare="more">
- <const>medium</const>
- </test>
- <edit name="embolden" mode="assign">
- <bool>true</bool>
- </edit>
- <edit name="weight" mode="assign">
- <const>bold</const>
- </edit>
- </match>
-
- <!-- We need to enable simulated oblique to for DejaVu Serif to ensure that we interpret
- this property correctly in: platform/gtk/fonts/fontconfig-synthetic-oblique.html -->
- <match target="font">
- <test qual="any" name="family">
- <string>DejaVu Serif</string>
- </test>
- <test name="slant">
- <const>roman</const>
- </test>
- <test target="pattern" name="slant" compare="not_eq">
- <const>roman</const>
- </test>
- <edit name="matrix" mode="assign">
- <times>
- <name>matrix</name>
- <matrix><double>1</double><double>0.2</double>
- <double>0</double><double>1</double>
- </matrix>
- </times>
- </edit>
- <edit name="slant" mode="assign">
- <const>oblique</const>
- </edit>
- <edit name="embeddedbitmap" mode="assign">
- <bool>false</bool>
- </edit>
- </match>
-
- <config>
- <!-- These are the default Unicode chars that are expected to be blank
- in fonts. All other blank chars are assumed to be broken and won't
- appear in the resulting charsets -->
- <blank>
- <int>0x0020</int> <!-- SPACE -->
- <int>0x00A0</int> <!-- NO-BREAK SPACE -->
- <int>0x00AD</int> <!-- SOFT HYPHEN -->
- <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
- <int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
- <int>0x0601</int> <!-- ARABIC SIGN SANAH -->
- <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
- <int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
- <int>0x06DD</int> <!-- ARABIC END OF AYAH -->
- <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
- <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
- <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
- <int>0x1680</int> <!-- OGHAM SPACE MARK -->
- <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
- <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
- <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
- <int>0x2000</int> <!-- EN QUAD -->
- <int>0x2001</int> <!-- EM QUAD -->
- <int>0x2002</int> <!-- EN SPACE -->
- <int>0x2003</int> <!-- EM SPACE -->
- <int>0x2004</int> <!-- THREE-PER-EM SPACE -->
- <int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
- <int>0x2006</int> <!-- SIX-PER-EM SPACE -->
- <int>0x2007</int> <!-- FIGURE SPACE -->
- <int>0x2008</int> <!-- PUNCTUATION SPACE -->
- <int>0x2009</int> <!-- THIN SPACE -->
- <int>0x200A</int> <!-- HAIR SPACE -->
- <int>0x200B</int> <!-- ZERO WIDTH SPACE -->
- <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
- <int>0x200D</int> <!-- ZERO WIDTH JOINER -->
- <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
- <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
- <int>0x2028</int> <!-- LINE SEPARATOR -->
- <int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
- <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
- <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
- <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
- <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
- <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
- <int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
- <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
- <int>0x2060</int> <!-- WORD JOINER -->
- <int>0x2061</int> <!-- FUNCTION APPLICATION -->
- <int>0x2062</int> <!-- INVISIBLE TIMES -->
- <int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
- <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
- <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
- <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
- <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
- <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
- <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
- <int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
- <int>0x3164</int> <!-- HANGUL FILLER -->
- <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
- <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
- <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
- <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
- <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
- </blank>
- </config>
-</fontconfig>