Title: [151489] trunk/Source
Revision
151489
Author
[email protected]
Date
2013-06-12 01:09:47 -0700 (Wed, 12 Jun 2013)

Log Message

[GTK] Parameter 'pseudoElement' from function 'webkit_dom_dom_window_get_computed_style' should be allowed to be NULL
https://bugs.webkit.org/show_bug.cgi?id=117332

Patch by Diego Pino Garcia <[email protected]> on 2013-06-12
Reviewed by Xan Lopez.

Source/WebCore:

Add parameter 'pseudoElement' to the list of parameters that are allowed to
be NULL.

* bindings/scripts/CodeGeneratorGObject.pm:
(GetGReturnMacro):

Source/WebKit/gtk:

Add test for function 'webkit_dom_dom_window_get_computed_style'.

* tests/testdomdomwindow.c:
(dom_dom_window_fixture_setup): Test setup for function
'dom_dom_window_get_computed_style'.
(dom_dom_window_fixture_teardown): Test teardown for function
'dom_dom_window_get_computed_style'.
(loadedCallback):
(test_dom_dom_window_get_computed_style): Checks function
'dom_dom_window_get_computed_style'.
(main):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151488 => 151489)


--- trunk/Source/WebCore/ChangeLog	2013-06-12 07:20:20 UTC (rev 151488)
+++ trunk/Source/WebCore/ChangeLog	2013-06-12 08:09:47 UTC (rev 151489)
@@ -1,3 +1,16 @@
+2013-06-12  Diego Pino Garcia  <[email protected]>
+
+        [GTK] Parameter 'pseudoElement' from function 'webkit_dom_dom_window_get_computed_style' should be allowed to be NULL
+        https://bugs.webkit.org/show_bug.cgi?id=117332
+
+        Reviewed by Xan Lopez.
+
+        Add parameter 'pseudoElement' to the list of parameters that are allowed to
+        be NULL.
+
+        * bindings/scripts/CodeGeneratorGObject.pm:
+        (GetGReturnMacro):
+
 2013-06-12  Sergio Villar Senin  <[email protected]>
 
         Add CSS parsing recovery to functions

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (151488 => 151489)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2013-06-12 07:20:20 UTC (rev 151488)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2013-06-12 08:09:47 UTC (rev 151489)
@@ -48,7 +48,8 @@
 # List of function parameters that are allowed to be NULL
 my $canBeNullParams = {
     'webkit_dom_document_evaluate' => ['inResult', 'resolver'],
-    'webkit_dom_node_insert_before' => ['refChild']
+    'webkit_dom_node_insert_before' => ['refChild'],
+    'webkit_dom_dom_window_get_computed_style' => ['pseudoElement']
 };
 
 # Default constructor
@@ -865,6 +866,9 @@
             $condition = "!$paramName || $condition";
         }
     } else {
+        if (ParamCanBeNull($functionName, $paramName)) {
+            return;
+        }
         $condition = "$paramName";
     }
 

Modified: trunk/Source/WebKit/gtk/ChangeLog (151488 => 151489)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-06-12 07:20:20 UTC (rev 151488)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-06-12 08:09:47 UTC (rev 151489)
@@ -1,3 +1,22 @@
+2013-06-12  Diego Pino Garcia  <[email protected]>
+
+        [GTK] Parameter 'pseudoElement' from function 'webkit_dom_dom_window_get_computed_style' should be allowed to be NULL
+        https://bugs.webkit.org/show_bug.cgi?id=117332
+
+        Reviewed by Xan Lopez.
+
+        Add test for function 'webkit_dom_dom_window_get_computed_style'.
+
+        * tests/testdomdomwindow.c:
+        (dom_dom_window_fixture_setup): Test setup for function
+        'dom_dom_window_get_computed_style'.
+        (dom_dom_window_fixture_teardown): Test teardown for function
+        'dom_dom_window_get_computed_style'.
+        (loadedCallback):
+        (test_dom_dom_window_get_computed_style): Checks function
+        'dom_dom_window_get_computed_style'.
+        (main):
+
 2013-06-10  Iago Toral Quiroga  <[email protected]>
 
         Use Cairo implementation of the WidgetBackingStore instead of X11 when running on Wayland

Modified: trunk/Source/WebKit/gtk/tests/testdomdomwindow.c (151488 => 151489)


--- trunk/Source/WebKit/gtk/tests/testdomdomwindow.c	2013-06-12 07:20:20 UTC (rev 151488)
+++ trunk/Source/WebKit/gtk/tests/testdomdomwindow.c	2013-06-12 08:09:47 UTC (rev 151489)
@@ -25,7 +25,7 @@
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
 
-#define HTML_DOCUMENT "<html><head><title>This is the title</title></head><body><p id='test'>test</p></body></html>"
+#define HTML_DOCUMENT "<html><head><title></title></head><style type='text/css'>#test { font-size: 16px; }</style><body><p id='test'>test</p></body></html>"
 
 typedef struct {
     GtkWidget* webView;
@@ -62,6 +62,26 @@
     g_main_loop_unref(fixture->loop);
 }
 
+static void dom_dom_window_fixture_setup(DomDomviewFixture* fixture, gconstpointer data)
+{
+    fixture->loop = g_main_loop_new(NULL, TRUE);
+    fixture->webView = webkit_web_view_new();
+    g_object_ref_sink(fixture->webView);
+
+    if (data != NULL)
+        webkit_web_view_load_string(WEBKIT_WEB_VIEW (fixture->webView), (const char*) data, NULL, NULL, NULL);
+
+    g_idle_add((GSourceFunc)finish_loading, fixture);
+    g_main_loop_run(fixture->loop);
+}
+
+static void dom_dom_window_fixture_teardown(DomDomviewFixture* fixture, gconstpointer data)
+{
+    if (fixture->webView)
+        g_object_unref(fixture->webView);
+    g_main_loop_unref(fixture->loop);
+}
+
 static gboolean loadedCallback(WebKitDOMDOMWindow* view, WebKitDOMEvent* event, DomDomviewFixture* fixture)
 {
     g_assert(fixture->loaded == FALSE);
@@ -194,6 +214,21 @@
     g_assert(fixture->clicked);
 }
 
+static void test_dom_dom_window_get_computed_style(DomDomviewFixture* fixture, gconstpointer data)
+{
+    WebKitDOMDocument* document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView));
+    g_assert(document);
+    WebKitDOMDOMWindow* domWindow = webkit_dom_document_get_default_view(document);
+    g_assert(domWindow);
+
+    WebKitDOMElement*  element = webkit_dom_document_get_element_by_id(document, "test");
+    g_assert(element);
+    g_assert(WEBKIT_DOM_IS_ELEMENT(element));
+    WebKitDOMCSSStyleDeclaration* cssStyle = webkit_dom_dom_window_get_computed_style(domWindow, element, NULL);
+    gchar* fontSize = webkit_dom_css_style_declaration_get_property_value(cssStyle, "font-size");
+    g_assert_cmpstr(fontSize, ==, "16px");
+}
+
 int main(int argc, char** argv)
 {
     gtk_test_init(&argc, &argv, NULL);
@@ -212,6 +247,12 @@
                test_dom_domview_dispatch_event,
                dom_domview_fixture_teardown);
 
+    g_test_add("/webkit/domdomwindow/get_computed_style",
+               DomDomviewFixture, HTML_DOCUMENT,
+               dom_dom_window_fixture_setup,
+               test_dom_dom_window_get_computed_style,
+               dom_dom_window_fixture_teardown);
+
     return g_test_run();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to