[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

xan at webkit.org xan at webkit.org
Wed Dec 22 11:41:02 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit eacf20d736509e85801ba99ed8be41c5275bc0bc
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 3 19:41:18 2010 +0000

    2010-08-03  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha.
    
            [GTK] Fix DOM event dispatch
            https://bugs.webkit.org/show_bug.cgi?id=40847
    
            Add new files to the build.
    
            * GNUmakefile.am:
    
    WebCore:
    
    2010-08-03  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha.
    
            [GTK] Fix DOM event dispatch
            https://bugs.webkit.org/show_bug.cgi?id=40847
    
            Bind UI and Mouse events and add ad-hoc kit method for WebCore
            Events.
    
            * GNUmakefile.am:
            * bindings/gobject/WebKitDOMBinding.cpp:
            (WebKit::kit):
            * bindings/gobject/WebKitDOMBinding.h:
            * bindings/gobject/WebKitDOMEventTarget.cpp:
            (WebKit::core):
            * bindings/gobject/WebKitDOMEventTargetPrivate.h: Added.
            * bindings/scripts/CodeGeneratorGObject.pm:
    
    WebKit/gtk:
    
    2010-08-03  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha.
    
            [GTK] Fix DOM event dispatch
            https://bugs.webkit.org/show_bug.cgi?id=40847
    
            Test DOM event dispatch.
    
            * tests/testdomdomwindow.c:
            (load_event_callback):
            (test_dom_domview_signals):
            (clicked_cb):
            (load_status_callback):
            (test_dom_domview_dispatch_event):
            (main):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/ChangeLog b/ChangeLog
index 46e053f..f4ab548 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,17 @@
 
         Reviewed by Gustavo Noronha.
 
+        [GTK] Fix DOM event dispatch
+        https://bugs.webkit.org/show_bug.cgi?id=40847
+
+        Add new files to the build.
+
+        * GNUmakefile.am:
+
+2010-08-03  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
         Silence JSCore gir "creation".
 
         * GNUmakefile.am:
diff --git a/GNUmakefile.am b/GNUmakefile.am
index aacfa3c..7caaa93 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -359,6 +359,7 @@ webkitgtk_built_h_api += \
 	DerivedSources/webkit/WebKitDOMEntityReference.h \
 	DerivedSources/webkit/WebKitDOMEvent.h \
 	DerivedSources/webkit/WebKitDOMMessagePort.h \
+	DerivedSources/webkit/WebKitDOMMouseEvent.h \
 	DerivedSources/webkit/WebKitDOMNamedNodeMap.h \
 	DerivedSources/webkit/WebKitDOMNode.h \
 	DerivedSources/webkit/WebKitDOMNodeFilter.h \
@@ -368,6 +369,7 @@ webkitgtk_built_h_api += \
 	DerivedSources/webkit/WebKitDOMRange.h \
 	DerivedSources/webkit/WebKitDOMText.h \
 	DerivedSources/webkit/WebKitDOMTreeWalker.h \
+	DerivedSources/webkit/WebKitDOMUIEvent.h \
 	DerivedSources/webkit/WebKitDOMBlob.h \
 	DerivedSources/webkit/WebKitDOMFile.h \
 	DerivedSources/webkit/WebKitDOMFileList.h \
@@ -525,6 +527,7 @@ webkitgtk_gdom_built_sources += \
 	DerivedSources/webkit/WebKitDOMEntityReferencePrivate.h \
 	DerivedSources/webkit/WebKitDOMEvent.cpp \
 	DerivedSources/webkit/WebKitDOMEventPrivate.h \
+	DerivedSources/webkit/WebKitDOMEventTargetPrivate.h \
 	DerivedSources/webkit/WebKitDOMFile.cpp \
 	DerivedSources/webkit/WebKitDOMFileList.cpp \
 	DerivedSources/webkit/WebKitDOMFileListPrivate.h \
@@ -665,6 +668,8 @@ webkitgtk_gdom_built_sources += \
 	DerivedSources/webkit/WebKitDOMMemoryInfoPrivate.h \
 	DerivedSources/webkit/WebKitDOMMessagePort.cpp \
 	DerivedSources/webkit/WebKitDOMMessagePortPrivate.h \
+	DerivedSources/webkit/WebKitDOMMouseEvent.cpp \
+	DerivedSources/webkit/WebKitDOMMouseEventPrivate.h \
 	DerivedSources/webkit/WebKitDOMNamedNodeMap.cpp \
 	DerivedSources/webkit/WebKitDOMNamedNodeMapPrivate.h \
 	DerivedSources/webkit/WebKitDOMNavigator.cpp \
@@ -697,6 +702,8 @@ webkitgtk_gdom_built_sources += \
 	DerivedSources/webkit/WebKitDOMTimeRangesPrivate.h \
 	DerivedSources/webkit/WebKitDOMTreeWalker.cpp \
 	DerivedSources/webkit/WebKitDOMTreeWalkerPrivate.h \
+	DerivedSources/webkit/WebKitDOMUIEvent.cpp \
+	DerivedSources/webkit/WebKitDOMUIEventPrivate.h \
 	DerivedSources/webkit/WebKitDOMValidityState.cpp \
 	DerivedSources/webkit/WebKitDOMValidityStatePrivate.h \
 	DerivedSources/webkit/WebKitDOMWebKitPoint.cpp \
@@ -789,6 +796,9 @@ $(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h: $(WebCore)/bindings/gob
 $(top_builddir)/DerivedSources/webkit/WebKitDOMEventTarget.h: $(WebCore)/bindings/gobject/WebKitDOMEventTarget.h
 	$(AM_V_GEN)cp -f $< $@
 
+$(top_builddir)/DerivedSources/webkit/WebKitDOMEventTargetPrivate.h: $(WebCore)/bindings/gobject/WebKitDOMEventTargetPrivate.h
+	$(AM_V_GEN)cp -f $< $@
+
 # Filter out SVG for now
 gdom_feature_defines := $(filter-out ENABLE-SVG%, $(FEATURE_DEFINES))
 DerivedSources/webkit/WebKitDOM%.cpp DerivedSources/webkit/WebKitDOM%.h DerivedSources/webkit/WebKitDOM%Private.h:: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorGObject.pm
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 958fcc3..4002195 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-03  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Fix DOM event dispatch
+        https://bugs.webkit.org/show_bug.cgi?id=40847
+
+        Bind UI and Mouse events and add ad-hoc kit method for WebCore
+        Events.
+
+        * GNUmakefile.am:
+        * bindings/gobject/WebKitDOMBinding.cpp:
+        (WebKit::kit):
+        * bindings/gobject/WebKitDOMBinding.h:
+        * bindings/gobject/WebKitDOMEventTarget.cpp:
+        (WebKit::core):
+        * bindings/gobject/WebKitDOMEventTargetPrivate.h: Added.
+        * bindings/scripts/CodeGeneratorGObject.pm:
+
 2010-08-03  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 73474af..919a354 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -564,6 +564,7 @@ webcoregtk_dom_sources = \
 	WebCore/bindings/gobject/WebKitDOMBinding.h \
 	WebCore/bindings/gobject/WebKitDOMEventTarget.cpp \
 	WebCore/bindings/gobject/WebKitDOMEventTarget.h \
+	WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h \
 	WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \
 	WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \
 	WebCore/bindings/gobject/WebKitDOMObject.cpp \
diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/WebCore/bindings/gobject/WebKitDOMBinding.cpp
index aa4610b..6d862b0 100644
--- a/WebCore/bindings/gobject/WebKitDOMBinding.cpp
+++ b/WebCore/bindings/gobject/WebKitDOMBinding.cpp
@@ -27,11 +27,15 @@
 #include "Event.h"
 #include "EventException.h"
 #include "HTMLNames.h"
+#include "MouseEvent.h"
+#include "UIEvent.h"
 #include "WebKitDOMDOMWindowPrivate.h"
 #include "WebKitDOMElementPrivate.h"
 #include "WebKitDOMNode.h"
 #include "WebKitDOMNodePrivate.h"
 #include "WebKitHTMLElementWrapperFactory.h"
+#include "webkit/WebKitDOMMouseEventPrivate.h"
+#include "webkit/WebKitDOMUIEventPrivate.h"
 
 namespace WebKit {
 
@@ -119,6 +123,27 @@ gpointer kit(Element* element)
     return DOMObjectCache::put(element, wrappedElement);
 }
 
+gpointer kit(Event* event)
+{
+    if (!event)
+        return 0;
+
+    gpointer kitEvent = DOMObjectCache::get(event);
+    if (kitEvent)
+        return kitEvent;
+
+    gpointer wrappedEvent;
+
+    if (event->isMouseEvent())
+        wrappedEvent = wrapMouseEvent(static_cast<MouseEvent*>(event));
+    else if (event->isUIEvent())
+        wrappedEvent = wrapUIEvent(static_cast<UIEvent*>(event));
+    else
+        wrappedEvent = 0;
+
+    return DOMObjectCache::put(event, wrappedEvent);
+}
+
 static gpointer wrapEventTarget(EventTarget* target)
 {
     ASSERT(target);
diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.h b/WebCore/bindings/gobject/WebKitDOMBinding.h
index 236c450..2248f78 100644
--- a/WebCore/bindings/gobject/WebKitDOMBinding.h
+++ b/WebCore/bindings/gobject/WebKitDOMBinding.h
@@ -29,12 +29,14 @@
 namespace WebCore {
 class Node;
 class Element;
+class Event;
 class EventTarget;
 } // namespace WebCore
 
 namespace WebKit {
 gpointer kit(WebCore::Node* node);
 gpointer kit(WebCore::Element* element);
+gpointer kit(WebCore::Event* event);
 gpointer kit(WebCore::EventTarget* target);
 
 class DOMObjectCache {
diff --git a/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp b/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp
index 2d2a31a..f2b1a94 100644
--- a/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp
+++ b/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "WebKitDOMEventTarget.h"
 
+#include "EventTarget.h"
 #include "WebKitDOMEvent.h"
 
 typedef WebKitDOMEventTargetIface WebKitDOMEventTargetInterface;
@@ -75,3 +76,18 @@ void webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget* target, WebKit
     if (iface->dispatch_event)
         iface->dispatch_event(target, event, error);
 }
+
+namespace WebKit {
+
+WebCore::EventTarget* core(WebKitDOMEventTarget* request)
+{
+    g_return_val_if_fail(request, 0);
+
+    WebCore::EventTarget* coreObject = static_cast<WebCore::EventTarget*>(WEBKIT_DOM_OBJECT(request)->coreObject);
+    g_return_val_if_fail(coreObject, 0);
+
+    return coreObject;
+}
+
+} // namespace WebKit
+
diff --git a/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h b/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h
new file mode 100644
index 0000000..4741409
--- /dev/null
+++ b/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WebKitDOMEventTargetPrivate_h
+#define WebKitDOMEventTargetPrivate_h
+
+#include "EventTarget.h"
+#include <glib-object.h>
+#include <webkit/WebKitDOMEventTarget.h>
+
+namespace WebKit {
+WebCore::EventTarget*
+core(WebKitDOMEventTarget *request);
+} // namespace WebKit
+
+#endif /* WebKitDOMEventTargetPrivate_h */
diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
index 97bebb6..f6a9419 100644
--- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
@@ -126,6 +126,7 @@ sub ClassNameToGObjectType {
     $CLASS_NAME =~ s/DOMCDATA/DOM_CDATA/;
     $CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/;
     $CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/;
+    $CLASS_NAME =~ s/DOMUI/DOM_UI/;
     return $CLASS_NAME;
 }
 
@@ -1223,7 +1224,7 @@ EOF
 sub UsesManualKitImplementation {
     my $type = shift;
 
-    return 1 if $type eq "Node" or $type eq "Element";
+    return 1 if $type eq "Node" or $type eq "Element" or $type eq "Event";
     return 0;
 }
 
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index e88ab91..d75a6d5 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-03  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Fix DOM event dispatch
+        https://bugs.webkit.org/show_bug.cgi?id=40847
+
+        Test DOM event dispatch.
+
+        * tests/testdomdomwindow.c:
+        (load_event_callback):
+        (test_dom_domview_signals):
+        (clicked_cb):
+        (load_status_callback):
+        (test_dom_domview_dispatch_event):
+        (main):
+
 2010-08-03  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/tests/testdomdomwindow.c b/WebKit/gtk/tests/testdomdomwindow.c
index 1796057..a52bca5 100644
--- a/WebKit/gtk/tests/testdomdomwindow.c
+++ b/WebKit/gtk/tests/testdomdomwindow.c
@@ -26,7 +26,7 @@
 
 #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
 
-#define HTML_DOCUMENT "<html><head><title>This is the title</title></head><body></body></html>"
+#define HTML_DOCUMENT "<html><head><title>This is the title</title></head><body><p id='test'>test</p></body></html>"
 
 typedef struct {
     GtkWidget* webView;
@@ -108,7 +108,7 @@ static void load_event_callback(WebKitWebView* webView, GParamSpec* spec, DomDom
         g_signal_connect(fixture->domWindow, "click-event", G_CALLBACK(clickedCallback), fixture);
 
         g_assert(fixture->clicked == FALSE);
-        gtk_test_widget_click (GTK_WIDGET(fixture->webView), 1, 0);
+        gtk_test_widget_click(GTK_WIDGET(fixture->webView), 1, 0);
     }
 
 }
@@ -132,12 +132,69 @@ static void test_dom_domview_signals(DomDomviewFixture* fixture, gconstpointer d
     gtk_widget_show_all(fixture->window);
     gtk_window_present(GTK_WINDOW(fixture->window));
 
-    g_main_loop_run (fixture->loop);
+    g_main_loop_run(fixture->loop);
 
     g_assert(fixture->loaded);
     g_assert(fixture->clicked);
 }
 
+static gboolean
+clicked_cb(WebKitDOMEventTarget* target, WebKitDOMEvent* event, DomDomviewFixture* fixture)
+{
+    g_assert(fixture->clicked == FALSE);
+    fixture->clicked = TRUE;
+    finish_loading(fixture);
+    return FALSE;
+}
+
+static void load_status_callback(WebKitWebView* webView, GParamSpec* spec, DomDomviewFixture* fixture)
+{
+    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
+    if (status == WEBKIT_LOAD_FINISHED) {
+        WebKitDOMDocument* document;
+        WebKitDOMDOMWindow* domWindow;
+        WebKitDOMElement* element;
+        WebKitDOMEvent* event;
+        glong clientX, clientY;
+
+        document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView));
+        g_assert(document);
+        domWindow = webkit_dom_document_get_default_view(document);
+        g_assert(domWindow);
+        fixture->domWindow = domWindow;
+
+        element = webkit_dom_document_get_element_by_id(document, "test");
+        g_assert(element);
+        event = webkit_dom_document_create_event(document, "MouseEvent", NULL);
+        g_assert(event);
+        g_assert(WEBKIT_DOM_IS_EVENT(event));
+        g_assert(WEBKIT_DOM_IS_MOUSE_EVENT(event));
+        clientX = webkit_dom_element_get_client_left(element);
+        clientY = webkit_dom_element_get_client_top(element);
+        webkit_dom_mouse_event_init_mouse_event(WEBKIT_DOM_MOUSE_EVENT(event),
+                                                "click", TRUE, TRUE,
+                                                fixture->domWindow, 0, 0, 0, clientX, clientY,
+                                                FALSE, FALSE, FALSE, FALSE,
+                                                1, WEBKIT_DOM_EVENT_TARGET(element));
+        g_signal_connect(element, "click-event", G_CALLBACK(clicked_cb), fixture);
+        g_assert(fixture->clicked == FALSE);
+        webkit_dom_event_target_dispatch_event(WEBKIT_DOM_EVENT_TARGET(element), event, NULL);
+    }
+
+}
+
+static void test_dom_domview_dispatch_event(DomDomviewFixture* fixture, gconstpointer data)
+{
+    g_signal_connect(fixture->window, "map-event", G_CALLBACK(map_event_cb), fixture);
+    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_status_callback), fixture);
+
+    gtk_widget_show_all(fixture->window);
+    gtk_window_present(GTK_WINDOW(fixture->window));
+
+    g_main_loop_run (fixture->loop);
+    g_assert(fixture->clicked);
+}
+
 int main(int argc, char** argv)
 {
     if (!g_thread_supported())
@@ -153,6 +210,12 @@ int main(int argc, char** argv)
                test_dom_domview_signals,
                dom_domview_fixture_teardown);
 
+    g_test_add("/webkit/domdomview/dispatch_event",
+               DomDomviewFixture, HTML_DOCUMENT,
+               dom_domview_fixture_setup,
+               test_dom_domview_dispatch_event,
+               dom_domview_fixture_teardown);
+
     return g_test_run();
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list