Title: [188854] trunk/Source/WebCore
Revision
188854
Author
carlo...@webkit.org
Date
2015-08-24 03:19:39 -0700 (Mon, 24 Aug 2015)

Log Message

Unreviewed. Fix GTK+ build after r188809.

document.getElementsByTagName returns an HTMLCollection since
r188809. So, rename it as
webkit_dom_document_get_elements_by_tag_name_as_html_collection,
and deprecate the old methods returning a NodeList.

* bindings/gobject/WebKitDOMDeprecated.cpp:
(webkit_dom_document_get_elements_by_tag_name): Use the
implementation returning a NodeList.
(webkit_dom_document_get_elements_by_tag_name_ns): Ditto.
* bindings/gobject/WebKitDOMDeprecated.h:
* bindings/gobject/WebKitDOMDeprecated.symbols: Add new symbols.
* bindings/gobject/webkitdom.symbols: Ditto.
* bindings/scripts/CodeGeneratorGObject.pm:
(GetEffectiveFunctionName): Bring back this method, now that we
have deprecated API again and add the checks for
getElementsByTagName methods.
(GenerateFunction): Use GetEffectiveFunctionName().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (188853 => 188854)


--- trunk/Source/WebCore/ChangeLog	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/ChangeLog	2015-08-24 10:19:39 UTC (rev 188854)
@@ -1,3 +1,25 @@
+2015-08-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Unreviewed. Fix GTK+ build after r188809.
+
+        document.getElementsByTagName returns an HTMLCollection since
+        r188809. So, rename it as
+        webkit_dom_document_get_elements_by_tag_name_as_html_collection,
+        and deprecate the old methods returning a NodeList.
+
+        * bindings/gobject/WebKitDOMDeprecated.cpp:
+        (webkit_dom_document_get_elements_by_tag_name): Use the
+        implementation returning a NodeList.
+        (webkit_dom_document_get_elements_by_tag_name_ns): Ditto.
+        * bindings/gobject/WebKitDOMDeprecated.h:
+        * bindings/gobject/WebKitDOMDeprecated.symbols: Add new symbols.
+        * bindings/gobject/webkitdom.symbols: Ditto.
+        * bindings/scripts/CodeGeneratorGObject.pm:
+        (GetEffectiveFunctionName): Bring back this method, now that we
+        have deprecated API again and add the checks for
+        getElementsByTagName methods.
+        (GenerateFunction): Use GetEffectiveFunctionName().
+
 2015-08-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         @font-face related cleanup

Modified: trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp (188853 => 188854)


--- trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp	2015-08-24 10:19:39 UTC (rev 188854)
@@ -19,7 +19,14 @@
 #include "config.h"
 #include "WebKitDOMDeprecated.h"
 
+#include "Document.h"
+#include "JSMainThreadExecState.h"
+#include "WebKitDOMDocumentPrivate.h"
 #include "WebKitDOMHTMLElement.h"
+#include "WebKitDOMNodeListPrivate.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
 
 gchar* webkit_dom_html_element_get_inner_html(WebKitDOMHTMLElement* self)
 {
@@ -50,3 +57,26 @@
     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_ELEMENT(self), nullptr);
     return webkit_dom_element_get_children(WEBKIT_DOM_ELEMENT(self));
 }
+
+WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument* self, const gchar* tagName)
+{
+    g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), nullptr);
+    g_return_val_if_fail(tagName, nullptr);
+
+    WebCore::JSMainThreadNullState state;
+    WebCore::Document* document = WebKit::core(self);
+    RefPtr<WebCore::NodeList> nodeList = WTF::getPtr(document->getElementsByTagNameForObjC(String::fromUTF8(tagName)));
+    return WebKit::kit(nodeList.get());
+}
+
+WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument* self, const gchar* namespaceURI, const gchar* tagName)
+{
+    g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), nullptr);
+    g_return_val_if_fail(namespaceURI, nullptr);
+    g_return_val_if_fail(tagName, nullptr);
+
+    WebCore::JSMainThreadNullState state;
+    WebCore::Document* document = WebKit::core(self);
+    RefPtr<WebCore::NodeList> nodeList = WTF::getPtr(document->getElementsByTagNameNSForObjC(String::fromUTF8(namespaceURI), String::fromUTF8(tagName)));
+    return WebKit::kit(nodeList.get());
+}

Modified: trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h (188853 => 188854)


--- trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h	2015-08-24 10:19:39 UTC (rev 188854)
@@ -81,6 +81,31 @@
 WEBKIT_DEPRECATED_FOR(webkit_dom_element_get_children) WebKitDOMHTMLCollection*
 webkit_dom_html_element_get_children(WebKitDOMHTMLElement* self);
 
+/**
+ * webkit_dom_document_get_elements_by_tag_name:
+ * @self: A #WebKitDOMDocument
+ * @tag_name: a #gchar with the tag name
+ *
+ * Returns: (transfer full): a #WebKitDOMNodeList
+ *
+ * Deprecated: 2.12: Use webkit_dom_document_get_elements_by_tag_name_as_html_collection() instead.
+ */
+WEBKIT_DEPRECATED_FOR(webkit_dom_document_get_elements_by_tag_name_as_html_collection) WebKitDOMNodeList*
+webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument* self, const gchar* tag_name);
+
+/**
+ * webkit_dom_document_get_elements_by_tag_name_ns:
+ * @self: A #WebKitDOMDocument
+ * @namespace_uri: a #gchar with the namespace URI
+ * @tag_name: a #gchar with the tag name
+ *
+ * Returns: (transfer full): a #WebKitDOMNodeList
+ *
+ * Deprecated: 2.12: Use webkit_dom_document_get_elements_by_tag_name_ns_as_html_collection() instead.
+ */
+WEBKIT_DEPRECATED_FOR(webkit_dom_document_get_elements_by_tag_name_as_html_collection) WebKitDOMNodeList*
+webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument* self, const gchar* namespace_uri, const gchar* tag_name);
+
 G_END_DECLS
 
 #endif /* WEBKIT_DISABLE_DEPRECATED */

Modified: trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.symbols (188853 => 188854)


--- trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.symbols	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.symbols	2015-08-24 10:19:39 UTC (rev 188854)
@@ -3,3 +3,5 @@
 gchar* webkit_dom_html_element_get_inner_html(WebKitDOMHTMLElement*)
 void webkit_dom_html_element_set_outer_html(WebKitDOMHTMLElement*, const gchar*, GError**)
 WebKitDOMHTMLCollection* webkit_dom_html_element_get_children(WebKitDOMHTMLElement*)
+WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument*, const gchar*)
+WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument*, const gchar*, const gchar*)

Modified: trunk/Source/WebCore/bindings/gobject/webkitdom.symbols (188853 => 188854)


--- trunk/Source/WebCore/bindings/gobject/webkitdom.symbols	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/bindings/gobject/webkitdom.symbols	2015-08-24 10:19:39 UTC (rev 188854)
@@ -85,7 +85,9 @@
 WebKitDOMElement* webkit_dom_document_get_element_by_id(WebKitDOMDocument*, const gchar*)
 WebKitDOMNodeList* webkit_dom_document_get_elements_by_name(WebKitDOMDocument*, const gchar*)
 WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument*, const gchar*)
+WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_as_html_collection(WebKitDOMDocument*, const gchar*)@2.12
 WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument*, const gchar*, const gchar*)
+WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_ns_as_html_collection(WebKitDOMDocument*, const gchar*, const gchar*)@2.12
 WebKitDOMNodeList* webkit_dom_document_get_elements_by_class_name(WebKitDOMDocument*, const gchar*)
 WebKitDOMElement* webkit_dom_document_element_from_point(WebKitDOMDocument*, glong, glong)
 WebKitDOMCSSStyleDeclaration* webkit_dom_document_get_override_style(WebKitDOMDocument*, WebKitDOMElement*, const gchar*)

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (188853 => 188854)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2015-08-24 08:06:00 UTC (rev 188853)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2015-08-24 10:19:39 UTC (rev 188854)
@@ -993,6 +993,19 @@
     return "none";
 }
 
+sub GetEffectiveFunctionName {
+    my $functionName = shift;
+
+    # Rename webkit_dom_document_get_elements_by_tag_name* functions since they were changed to return a
+    # WebKitDOMHTMLCollection instead of a WebKitDOMNodeList in r188809. The old methods are now manually
+    # added as deprecated.
+    if ($functionName eq "webkit_dom_document_get_elements_by_tag_name" || $functionName eq "webkit_dom_document_get_elements_by_tag_name_ns") {
+        return $functionName . "_as_html_collection";
+    }
+
+    return $functionName;
+}
+
 sub GenerateFunction {
     my ($object, $interfaceName, $function, $prefix, $parentNode) = @_;
 
@@ -1004,7 +1017,7 @@
 
     my $functionSigType = $prefix eq "set_" ? "void" : $function->signature->type;
     my $functionSigName = GetFunctionSignatureName($interfaceName, $function);
-    my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . $functionSigName;
+    my $functionName = GetEffectiveFunctionName("webkit_dom_" . $decamelize . "_" . $prefix . $functionSigName);
     my $returnType = GetGlibTypeName($functionSigType);
     my $returnValueIsGDOMType = IsGDOMClassType($functionSigType);
     my $raisesException = $function->signature->extendedAttributes->{"RaisesException"};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to