Changeset 188854 in webkit


Ignore:
Timestamp:
Aug 24, 2015 3:19:39 AM (9 years ago)
Author:
Carlos Garcia Campos
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().

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r188853 r188854  
     12015-08-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Unreviewed. Fix GTK+ build after r188809.
     4
     5        document.getElementsByTagName returns an HTMLCollection since
     6        r188809. So, rename it as
     7        webkit_dom_document_get_elements_by_tag_name_as_html_collection,
     8        and deprecate the old methods returning a NodeList.
     9
     10        * bindings/gobject/WebKitDOMDeprecated.cpp:
     11        (webkit_dom_document_get_elements_by_tag_name): Use the
     12        implementation returning a NodeList.
     13        (webkit_dom_document_get_elements_by_tag_name_ns): Ditto.
     14        * bindings/gobject/WebKitDOMDeprecated.h:
     15        * bindings/gobject/WebKitDOMDeprecated.symbols: Add new symbols.
     16        * bindings/gobject/webkitdom.symbols: Ditto.
     17        * bindings/scripts/CodeGeneratorGObject.pm:
     18        (GetEffectiveFunctionName): Bring back this method, now that we
     19        have deprecated API again and add the checks for
     20        getElementsByTagName methods.
     21        (GenerateFunction): Use GetEffectiveFunctionName().
     22
    1232015-08-24  Myles C. Maxfield  <mmaxfield@apple.com>
    224
  • trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp

    r184623 r188854  
    2020#include "WebKitDOMDeprecated.h"
    2121
     22#include "Document.h"
     23#include "JSMainThreadExecState.h"
     24#include "WebKitDOMDocumentPrivate.h"
    2225#include "WebKitDOMHTMLElement.h"
     26#include "WebKitDOMNodeListPrivate.h"
     27#include <wtf/GetPtr.h>
     28#include <wtf/RefPtr.h>
     29#include <wtf/text/WTFString.h>
    2330
    2431gchar* webkit_dom_html_element_get_inner_html(WebKitDOMHTMLElement* self)
     
    5158    return webkit_dom_element_get_children(WEBKIT_DOM_ELEMENT(self));
    5259}
     60
     61WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument* self, const gchar* tagName)
     62{
     63    g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), nullptr);
     64    g_return_val_if_fail(tagName, nullptr);
     65
     66    WebCore::JSMainThreadNullState state;
     67    WebCore::Document* document = WebKit::core(self);
     68    RefPtr<WebCore::NodeList> nodeList = WTF::getPtr(document->getElementsByTagNameForObjC(String::fromUTF8(tagName)));
     69    return WebKit::kit(nodeList.get());
     70}
     71
     72WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument* self, const gchar* namespaceURI, const gchar* tagName)
     73{
     74    g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), nullptr);
     75    g_return_val_if_fail(namespaceURI, nullptr);
     76    g_return_val_if_fail(tagName, nullptr);
     77
     78    WebCore::JSMainThreadNullState state;
     79    WebCore::Document* document = WebKit::core(self);
     80    RefPtr<WebCore::NodeList> nodeList = WTF::getPtr(document->getElementsByTagNameNSForObjC(String::fromUTF8(namespaceURI), String::fromUTF8(tagName)));
     81    return WebKit::kit(nodeList.get());
     82}
  • trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h

    r184623 r188854  
    8282webkit_dom_html_element_get_children(WebKitDOMHTMLElement* self);
    8383
     84/**
     85 * webkit_dom_document_get_elements_by_tag_name:
     86 * @self: A #WebKitDOMDocument
     87 * @tag_name: a #gchar with the tag name
     88 *
     89 * Returns: (transfer full): a #WebKitDOMNodeList
     90 *
     91 * Deprecated: 2.12: Use webkit_dom_document_get_elements_by_tag_name_as_html_collection() instead.
     92 */
     93WEBKIT_DEPRECATED_FOR(webkit_dom_document_get_elements_by_tag_name_as_html_collection) WebKitDOMNodeList*
     94webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument* self, const gchar* tag_name);
     95
     96/**
     97 * webkit_dom_document_get_elements_by_tag_name_ns:
     98 * @self: A #WebKitDOMDocument
     99 * @namespace_uri: a #gchar with the namespace URI
     100 * @tag_name: a #gchar with the tag name
     101 *
     102 * Returns: (transfer full): a #WebKitDOMNodeList
     103 *
     104 * Deprecated: 2.12: Use webkit_dom_document_get_elements_by_tag_name_ns_as_html_collection() instead.
     105 */
     106WEBKIT_DEPRECATED_FOR(webkit_dom_document_get_elements_by_tag_name_as_html_collection) WebKitDOMNodeList*
     107webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument* self, const gchar* namespace_uri, const gchar* tag_name);
     108
    84109G_END_DECLS
    85110
  • trunk/Source/WebCore/bindings/gobject/WebKitDOMDeprecated.symbols

    r184623 r188854  
    44void webkit_dom_html_element_set_outer_html(WebKitDOMHTMLElement*, const gchar*, GError**)
    55WebKitDOMHTMLCollection* webkit_dom_html_element_get_children(WebKitDOMHTMLElement*)
     6WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument*, const gchar*)
     7WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument*, const gchar*, const gchar*)
  • trunk/Source/WebCore/bindings/gobject/webkitdom.symbols

    r184623 r188854  
    8686WebKitDOMNodeList* webkit_dom_document_get_elements_by_name(WebKitDOMDocument*, const gchar*)
    8787WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name(WebKitDOMDocument*, const gchar*)
     88WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_as_html_collection(WebKitDOMDocument*, const gchar*)@2.12
    8889WebKitDOMNodeList* webkit_dom_document_get_elements_by_tag_name_ns(WebKitDOMDocument*, const gchar*, const gchar*)
     90WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_ns_as_html_collection(WebKitDOMDocument*, const gchar*, const gchar*)@2.12
    8991WebKitDOMNodeList* webkit_dom_document_get_elements_by_class_name(WebKitDOMDocument*, const gchar*)
    9092WebKitDOMElement* webkit_dom_document_element_from_point(WebKitDOMDocument*, glong, glong)
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm

    r188119 r188854  
    994994}
    995995
     996sub GetEffectiveFunctionName {
     997    my $functionName = shift;
     998
     999    # Rename webkit_dom_document_get_elements_by_tag_name* functions since they were changed to return a
     1000    # WebKitDOMHTMLCollection instead of a WebKitDOMNodeList in r188809. The old methods are now manually
     1001    # added as deprecated.
     1002    if ($functionName eq "webkit_dom_document_get_elements_by_tag_name" || $functionName eq "webkit_dom_document_get_elements_by_tag_name_ns") {
     1003        return $functionName . "_as_html_collection";
     1004    }
     1005
     1006    return $functionName;
     1007}
     1008
    9961009sub GenerateFunction {
    9971010    my ($object, $interfaceName, $function, $prefix, $parentNode) = @_;
     
    10051018    my $functionSigType = $prefix eq "set_" ? "void" : $function->signature->type;
    10061019    my $functionSigName = GetFunctionSignatureName($interfaceName, $function);
    1007     my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . $functionSigName;
     1020    my $functionName = GetEffectiveFunctionName("webkit_dom_" . $decamelize . "_" . $prefix . $functionSigName);
    10081021    my $returnType = GetGlibTypeName($functionSigType);
    10091022    my $returnValueIsGDOMType = IsGDOMClassType($functionSigType);
Note: See TracChangeset for help on using the changeset viewer.