<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170700] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170700">170700</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-02 00:04:23 -0700 (Wed, 02 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] XPathNSResolver should be exposed as an interface instead of as a class
https://bugs.webkit.org/show_bug.cgi?id=134028
Reviewed by Gustavo Noronha Silva.
Source/WebCore:
Add custom implementation of WebKitDOMXPathNSResolver to expose it
as an interface instead of a class. It also includes an internal
default implementation of the interface to support methods that
create a XPathNSResolver using the native implementation.
* PlatformGTK.cmake: Add new files to compilation.
* bindings/gobject/GObjectXPathNSResolver.cpp: Added.
(WebCore::GObjectXPathNSResolver::~GObjectXPathNSResolver):
(WebCore::GObjectXPathNSResolver::lookupNamespaceURI): Call
webkit_dom_xpath_ns_resolver_lookup_namespace_uri().
* bindings/gobject/GObjectXPathNSResolver.h: Added.
(WebCore::GObjectXPathNSResolver::create):
(WebCore::GObjectXPathNSResolver::GObjectXPathNSResolver): Create
a new GObjectXPathNSResolver for the given WebKitDOMXPathNSResolver.
* bindings/gobject/WebKitDOMXPathNSResolver.cpp: Added.
(webkit_dom_xpath_ns_resolver_default_init):
(webkit_dom_xpath_ns_resolver_lookup_namespace_uri):
(webkitDOMNativeXPathNSResolverFinalize):
(webkitDOMNativeXPathNSResolverConstructor):
(webkit_dom_native_xpath_ns_resolver_init):
(webkit_dom_native_xpath_ns_resolver_class_init):
(webkitDOMNativeXPathNSResolverLookupNamespaceURI):
(webkitDOMXPathNSResolverIfaceInit):
(WebKit::core): Return the native XPathNSResolver when using the
internal implementation or create a custom XPathNSResolver when
using a user provided WebKitDOMXPathNSResolver.
(WebKit::kit):
* bindings/gobject/WebKitDOMXPathNSResolver.h: Added.
* bindings/gobject/WebKitDOMXPathNSResolverPrivate.h: Added.
* bindings/scripts/CodeGeneratorGObject.pm:
(GenerateFunction): Add exceptions for XPathNSResolver since
the core method returns a PassRefPtr.
Tools:
Add unit tests to check WebKitDOMXPathNSResolver API when using the
native one and a user provided one.
* Scripts/webkitpy/style/checker.py: Add WebKitDOMXPathNSResolver
to the list of GTK+ public API exceptions.
* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt: Add new files to compilation.
* TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp: Added.
(webkitXPathNSResolverLookupNamespaceURI):
(webkitXPathNSResolverDOMXPathNSResolverIfaceInit):
(webkit_xpath_ns_resolver_init):
(webkit_xpath_ns_resolver_class_init):
(WebKitDOMXPathNSResolverTest::create):
(WebKitDOMXPathNSResolverTest::webPageFromArgs):
(WebKitDOMXPathNSResolverTest::evaluateFooChildTextAndCheckResult):
(WebKitDOMXPathNSResolverTest::testXPathNSResolverNative):
(WebKitDOMXPathNSResolverTest::testXPathNSResolverCustom):
(WebKitDOMXPathNSResolverTest::runTest):
(registerTests):
* TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp: Added.
(runTest):
(testWebKitDOMXPathNSResolverNative):
(testWebKitDOMXPathNSResolverCustom):
(serverCallback):
(beforeAll):
(afterAll):
* gtk/webkitdom.py:
(WebKitDOMDocGeneratorSections.write_section): Add
WebKitDOMXPathNSResolver to the list of interfaces.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorGObjectpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpystylecheckerpy">trunk/Tools/Scripts/webkitpy/style/checker.py</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt</a></li>
<li><a href="#trunkToolsgtkwebkitdompy">trunk/Tools/gtk/webkitdom.py</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsgobjectGObjectXPathNSResolvercpp">trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsgobjectGObjectXPathNSResolverh">trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.h</a></li>
<li><a href="#trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolvercpp">trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolverh">trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.h</a></li>
<li><a href="#trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolverPrivateh">trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolverPrivate.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkDOMXPathNSResolverTestcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMXPathNSResolvercpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Source/WebCore/ChangeLog        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-07-01 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] XPathNSResolver should be exposed as an interface instead of as a class
+ https://bugs.webkit.org/show_bug.cgi?id=134028
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Add custom implementation of WebKitDOMXPathNSResolver to expose it
+ as an interface instead of a class. It also includes an internal
+ default implementation of the interface to support methods that
+ create a XPathNSResolver using the native implementation.
+
+ * PlatformGTK.cmake: Add new files to compilation.
+ * bindings/gobject/GObjectXPathNSResolver.cpp: Added.
+ (WebCore::GObjectXPathNSResolver::~GObjectXPathNSResolver):
+ (WebCore::GObjectXPathNSResolver::lookupNamespaceURI): Call
+ webkit_dom_xpath_ns_resolver_lookup_namespace_uri().
+ * bindings/gobject/GObjectXPathNSResolver.h: Added.
+ (WebCore::GObjectXPathNSResolver::create):
+ (WebCore::GObjectXPathNSResolver::GObjectXPathNSResolver): Create
+ a new GObjectXPathNSResolver for the given WebKitDOMXPathNSResolver.
+ * bindings/gobject/WebKitDOMXPathNSResolver.cpp: Added.
+ (webkit_dom_xpath_ns_resolver_default_init):
+ (webkit_dom_xpath_ns_resolver_lookup_namespace_uri):
+ (webkitDOMNativeXPathNSResolverFinalize):
+ (webkitDOMNativeXPathNSResolverConstructor):
+ (webkit_dom_native_xpath_ns_resolver_init):
+ (webkit_dom_native_xpath_ns_resolver_class_init):
+ (webkitDOMNativeXPathNSResolverLookupNamespaceURI):
+ (webkitDOMXPathNSResolverIfaceInit):
+ (WebKit::core): Return the native XPathNSResolver when using the
+ internal implementation or create a custom XPathNSResolver when
+ using a user provided WebKitDOMXPathNSResolver.
+ (WebKit::kit):
+ * bindings/gobject/WebKitDOMXPathNSResolver.h: Added.
+ * bindings/gobject/WebKitDOMXPathNSResolverPrivate.h: Added.
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (GenerateFunction): Add exceptions for XPathNSResolver since
+ the core method returns a PassRefPtr.
+
</ins><span class="cx"> 2014-07-01 Frédéric Wang <fred.wang@free.fr>
</span><span class="cx">
</span><span class="cx"> The OpenType MATH table is not read on Mac
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -436,12 +436,14 @@
</span><span class="cx"> bindings/gobject/DOMObjectCache.cpp
</span><span class="cx"> bindings/gobject/GObjectEventListener.cpp
</span><span class="cx"> bindings/gobject/GObjectNodeFilterCondition.cpp
</span><ins>+ bindings/gobject/GObjectXPathNSResolver.cpp
</ins><span class="cx"> bindings/gobject/WebKitDOMCustom.cpp
</span><span class="cx"> bindings/gobject/WebKitDOMEventTarget.cpp
</span><span class="cx"> bindings/gobject/WebKitDOMHTMLPrivate.cpp
</span><span class="cx"> bindings/gobject/WebKitDOMNodeFilter.cpp
</span><span class="cx"> bindings/gobject/WebKitDOMObject.cpp
</span><span class="cx"> bindings/gobject/WebKitDOMPrivate.cpp
</span><ins>+ bindings/gobject/WebKitDOMXPathNSResolver.cpp
</ins><span class="cx"> ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
</span><span class="cx"> ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines-unstable.h
</span><span class="cx"> ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
</span><span class="lines">@@ -547,7 +549,6 @@
</span><span class="cx"> page/DOMWindow.idl
</span><span class="cx">
</span><span class="cx"> xml/XPathExpression.idl
</span><del>- xml/XPathNSResolver.idl
</del><span class="cx"> xml/XPathResult.idl
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -649,7 +650,7 @@
</span><span class="cx"> )
</span><span class="cx"> endif ()
</span><span class="cx">
</span><del>-set(GObjectDOMBindingsStable_CLASS_LIST Custom EventTarget NodeFilter Object)
</del><ins>+set(GObjectDOMBindingsStable_CLASS_LIST Custom EventTarget NodeFilter Object XPathNSResolver)
</ins><span class="cx"> set(GObjectDOMBindingsStable_INSTALLED_HEADERS
</span><span class="cx"> ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
</span><span class="cx"> ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
</span><span class="lines">@@ -657,6 +658,7 @@
</span><span class="cx"> ${WEBCORE_DIR}/bindings/gobject/WebKitDOMEventTarget.h
</span><span class="cx"> ${WEBCORE_DIR}/bindings/gobject/WebKitDOMNodeFilter.h
</span><span class="cx"> ${WEBCORE_DIR}/bindings/gobject/WebKitDOMObject.h
</span><ins>+ ${WEBCORE_DIR}/bindings/gobject/WebKitDOMXPathNSResolver.h
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> set(GObjectDOMBindingsUnstable_INSTALLED_HEADERS
</span><span class="lines">@@ -755,6 +757,7 @@
</span><span class="cx"> bindings/gobject/WebKitDOMEventTarget.h
</span><span class="cx"> bindings/gobject/WebKitDOMNodeFilter.h
</span><span class="cx"> bindings/gobject/WebKitDOMObject.h
</span><ins>+ bindings/gobject/WebKitDOMXPathNSResolver.h
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # Propagate this variable to the parent scope, so that it can be used in other parts of the build.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgobjectGObjectXPathNSResolvercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.cpp (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.cpp         (rev 0)
+++ trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.cpp        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GObjectXPathNSResolver.h"
+
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+GObjectXPathNSResolver::~GObjectXPathNSResolver()
+{
+}
+
+String GObjectXPathNSResolver::lookupNamespaceURI(const String& prefix)
+{
+ return String::fromUTF8(webkit_dom_xpath_ns_resolver_lookup_namespace_uri(m_resolver.get(), prefix.utf8().data()));
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsgobjectGObjectXPathNSResolverh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.h (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.h         (rev 0)
+++ trunk/Source/WebCore/bindings/gobject/GObjectXPathNSResolver.h        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GObjectXPathNSResolver_h
+#define GObjectXPathNSResolver_h
+
+#include "WebKitDOMXPathNSResolver.h"
+#include "XPathNSResolver.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+
+namespace WebCore {
+
+class GObjectXPathNSResolver : public XPathNSResolver {
+public:
+
+ static PassRefPtr<GObjectXPathNSResolver> create(WebKitDOMXPathNSResolver* resolver)
+ {
+ return adoptRef(new GObjectXPathNSResolver(resolver));
+ }
+
+ virtual ~GObjectXPathNSResolver();
+ virtual String lookupNamespaceURI(const String& prefix);
+
+private:
+ GObjectXPathNSResolver(WebKitDOMXPathNSResolver* resolver)
+ : m_resolver(resolver)
+ {
+ }
+
+ GRefPtr<WebKitDOMXPathNSResolver> m_resolver;
+};
+
+} // namespace WebCore
+
+#endif // GObjectXPathNSResolver_h
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolvercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.cpp (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.cpp         (rev 0)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.cpp        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "WebKitDOMXPathNSResolver.h"
+
+#include "DOMObjectCache.h"
+#include "GObjectXPathNSResolver.h"
+#include "JSMainThreadExecState.h"
+#include "WebKitDOMObject.h"
+#include "WebKitDOMXPathNSResolverPrivate.h"
+#include "gobject/ConvertToUTF8String.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+typedef WebKitDOMXPathNSResolverIface WebKitDOMXPathNSResolverInterface;
+
+G_DEFINE_INTERFACE(WebKitDOMXPathNSResolver, webkit_dom_xpath_ns_resolver, G_TYPE_OBJECT)
+
+static void webkit_dom_xpath_ns_resolver_default_init(WebKitDOMXPathNSResolverIface*)
+{
+}
+
+char* webkit_dom_xpath_ns_resolver_lookup_namespace_uri(WebKitDOMXPathNSResolver* resolver, const char* prefix)
+{
+ g_return_val_if_fail(WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver), nullptr);
+ g_return_val_if_fail(prefix, nullptr);
+
+ return WEBKIT_DOM_XPATH_NS_RESOLVER_GET_IFACE(resolver)->lookup_namespace_uri(resolver, prefix);
+}
+
+// WebKitDOMNativeXPathNSResolver.
+struct _WebKitDOMNativeXPathNSResolver {
+ WebKitDOMObject parent;
+};
+
+struct _WebKitDOMNativeXPathNSResolverClass {
+ WebKitDOMObjectClass parentClass;
+};
+
+typedef struct _WebKitDOMNativeXPathNSResolverPrivate {
+ RefPtr<WebCore::XPathNSResolver> coreObject;
+} WebKitDOMNativeXPathNSResolverPrivate;
+
+#define WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER, WebKitDOMNativeXPathNSResolverPrivate)
+
+static void webkitDOMXPathNSResolverIfaceInit(WebKitDOMXPathNSResolverIface*);
+
+G_DEFINE_TYPE_WITH_CODE(WebKitDOMNativeXPathNSResolver, webkit_dom_native_xpath_ns_resolver, WEBKIT_DOM_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER, webkitDOMXPathNSResolverIfaceInit))
+
+static void webkitDOMNativeXPathNSResolverFinalize(GObject* object)
+{
+ WebKitDOMNativeXPathNSResolverPrivate* priv = WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_GET_PRIVATE(object);
+ priv->~WebKitDOMNativeXPathNSResolverPrivate();
+ G_OBJECT_CLASS(webkit_dom_native_xpath_ns_resolver_parent_class)->finalize(object);
+}
+
+static GObject* webkitDOMNativeXPathNSResolverConstructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
+{
+ GObject* object = G_OBJECT_CLASS(webkit_dom_native_xpath_ns_resolver_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
+ WebKitDOMNativeXPathNSResolverPrivate* priv = WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_GET_PRIVATE(object);
+ priv->coreObject = static_cast<WebCore::XPathNSResolver*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+ WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+ return object;
+}
+
+static void webkit_dom_native_xpath_ns_resolver_init(WebKitDOMNativeXPathNSResolver* resolver)
+{
+ WebKitDOMNativeXPathNSResolverPrivate* priv = WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_GET_PRIVATE(resolver);
+ new (priv) WebKitDOMNativeXPathNSResolverPrivate();
+}
+
+static void webkit_dom_native_xpath_ns_resolver_class_init(WebKitDOMNativeXPathNSResolverClass* klass)
+{
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
+ g_type_class_add_private(gobjectClass, sizeof(WebKitDOMNativeXPathNSResolverPrivate));
+ gobjectClass->constructor = webkitDOMNativeXPathNSResolverConstructor;
+ gobjectClass->finalize = webkitDOMNativeXPathNSResolverFinalize;
+}
+
+static char* webkitDOMNativeXPathNSResolverLookupNamespaceURI(WebKitDOMXPathNSResolver* resolver, const char* prefix)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_NATIVE_XPATH_NS_RESOLVER(resolver), nullptr);
+
+ return convertToUTF8String(WebKit::core(resolver)->lookupNamespaceURI(WTF::String::fromUTF8(prefix)));
+}
+
+static void webkitDOMXPathNSResolverIfaceInit(WebKitDOMXPathNSResolverIface* iface)
+{
+ iface->lookup_namespace_uri = webkitDOMNativeXPathNSResolverLookupNamespaceURI;
+}
+
+namespace WebKit {
+
+PassRefPtr<WebCore::XPathNSResolver> core(WebKitDOMXPathNSResolver* xPathNSResolver)
+{
+ if (!xPathNSResolver)
+ return nullptr;
+
+ RefPtr<WebCore::XPathNSResolver> coreResolver;
+ if (WEBKIT_DOM_IS_NATIVE_XPATH_NS_RESOLVER(xPathNSResolver))
+ coreResolver = core(WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER(xPathNSResolver));
+ else
+ coreResolver = WebCore::GObjectXPathNSResolver::create(xPathNSResolver);
+ return coreResolver.release();
+}
+
+WebKitDOMXPathNSResolver* kit(WebCore::XPathNSResolver* coreXPathNSResolver)
+{
+ if (!coreXPathNSResolver)
+ return nullptr;
+
+ if (gpointer ret = DOMObjectCache::get(coreXPathNSResolver))
+ return WEBKIT_DOM_XPATH_NS_RESOLVER(ret);
+
+ return WEBKIT_DOM_XPATH_NS_RESOLVER(g_object_new(WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER, "core-object", coreXPathNSResolver, nullptr));
+}
+
+WebCore::XPathNSResolver* core(WebKitDOMNativeXPathNSResolver* xPathNSResolver)
+{
+ return xPathNSResolver ? static_cast<WebCore::XPathNSResolver*>(WEBKIT_DOM_OBJECT(xPathNSResolver)->coreObject) : nullptr;
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolverh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.h (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.h         (rev 0)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.h        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef WebKitDOMXPathNSResolver_h
+#define WebKitDOMXPathNSResolver_h
+
+#include <glib-object.h>
+#include <webkitdom/webkitdomdefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER (webkit_dom_xpath_ns_resolver_get_type ())
+#define WEBKIT_DOM_XPATH_NS_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER, WebKitDOMXPathNSResolver))
+#define WEBKIT_DOM_XPATH_NS_RESOLVER_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER, WebKitDOMXPathNSResolverIface))
+#define WEBKIT_DOM_IS_XPATH_NS_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER))
+#define WEBKIT_DOM_XPATH_NS_RESOLVER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER, WebKitDOMXPathNSResolverIface))
+
+typedef struct _WebKitDOMXPathNSResolverIface WebKitDOMXPathNSResolverIface;
+
+struct _WebKitDOMXPathNSResolverIface {
+ GTypeInterface gIface;
+
+ /* virtual table */
+ gchar *(* lookup_namespace_uri)(WebKitDOMXPathNSResolver *resolver,
+ const gchar *prefix);
+
+ void (*_webkitdom_reserved0) (void);
+ void (*_webkitdom_reserved1) (void);
+ void (*_webkitdom_reserved2) (void);
+ void (*_webkitdom_reserved3) (void);
+};
+
+
+WEBKIT_API GType webkit_dom_xpath_ns_resolver_get_type(void) G_GNUC_CONST;
+
+/**
+ * webkit_dom_xpath_ns_resolver_lookup_namespace_uri:
+ * @resolver: A #WebKitDOMXPathNSResolver
+ * @prefix: The prefix to lookup
+ *
+ * Returns: (transfer full): a #gchar
+ */
+WEBKIT_API gchar *webkit_dom_xpath_ns_resolver_lookup_namespace_uri(WebKitDOMXPathNSResolver *resolver,
+ const gchar *prefix);
+
+G_END_DECLS
+
+#endif /* WebKitDOMXPathNSResolver_h */
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsgobjectWebKitDOMXPathNSResolverPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolverPrivate.h (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolverPrivate.h         (rev 0)
+++ trunk/Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolverPrivate.h        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * 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 WebKitDOMXPathNSResolverPrivate_h
+#define WebKitDOMXPathNSResolverPrivate_h
+
+#include "XPathNSResolver.h"
+#include <webkitdom/WebKitDOMXPathNSResolver.h>
+#include <wtf/PassRefPtr.h>
+
+#define WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER (webkit_dom_native_xpath_ns_resolver_get_type())
+#define WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER, WebKitDOMNativeXPathNSResolver))
+#define WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER, WebKitDOMNativeXPathNSResolverClass)
+#define WEBKIT_DOM_IS_NATIVE_XPATH_NS_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER))
+#define WEBKIT_DOM_IS_NATIVE_XPATH_NS_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER))
+#define WEBKIT_DOM_NATIVE_XPATH_NS_RESOLVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_NATIVE_XPATH_NS_RESOLVER, WebKitDOMNativeXPathNSResolverClass))
+
+typedef struct _WebKitDOMNativeXPathNSResolver WebKitDOMNativeXPathNSResolver;
+typedef struct _WebKitDOMNativeXPathNSResolverClass WebKitDOMNativeXPathNSResolverClass;
+
+namespace WebKit {
+PassRefPtr<WebCore::XPathNSResolver> core(WebKitDOMXPathNSResolver*);
+WebKitDOMXPathNSResolver* kit(WebCore::XPathNSResolver*);
+WebCore::XPathNSResolver* core(WebKitDOMNativeXPathNSResolver*);
+} // namespace WebKit
+
+#endif /* WebKitDOMXPathNSResolverPrivate_h */
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorGObjectpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -984,7 +984,7 @@
</span><span class="cx"> if ($paramIsGDOMType || ($paramIDLType eq "DOMString") || ($paramIDLType eq "CompareHow")) {
</span><span class="cx"> $paramName = "converted" . $codeGenerator->WK_ucfirst($paramName);
</span><span class="cx"> }
</span><del>- if ($paramIDLType eq "NodeFilter") {
</del><ins>+ if ($paramIDLType eq "NodeFilter" || $paramIDLType eq "XPathNSResolver") {
</ins><span class="cx"> $paramName = "WTF::getPtr(" . $paramName . ")";
</span><span class="cx"> }
</span><span class="cx"> push(@callImplParams, $paramName);
</span><span class="lines">@@ -1088,7 +1088,7 @@
</span><span class="cx"> push(@cBody, " WTF::String ${convertedParamName} = WTF::String::fromUTF8($paramName);\n");
</span><span class="cx"> } elsif ($paramIDLType eq "CompareHow") {
</span><span class="cx"> push(@cBody, " WebCore::Range::CompareHow ${convertedParamName} = static_cast<WebCore::Range::CompareHow>($paramName);\n");
</span><del>- } elsif ($paramIDLType eq "NodeFilter") {
</del><ins>+ } elsif ($paramIDLType eq "NodeFilter" || $paramIDLType eq "XPathNSResolver") {
</ins><span class="cx"> push(@cBody, " RefPtr<WebCore::$paramIDLType> ${convertedParamName} = WebKit::core($paramName);\n");
</span><span class="cx"> } elsif ($paramIsGDOMType) {
</span><span class="cx"> push(@cBody, " WebCore::${paramIDLType}* ${convertedParamName} = WebKit::core($paramName);\n");
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Tools/ChangeLog        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-07-01 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] XPathNSResolver should be exposed as an interface instead of as a class
+ https://bugs.webkit.org/show_bug.cgi?id=134028
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Add unit tests to check WebKitDOMXPathNSResolver API when using the
+ native one and a user provided one.
+
+ * Scripts/webkitpy/style/checker.py: Add WebKitDOMXPathNSResolver
+ to the list of GTK+ public API exceptions.
+ * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt: Add new files to compilation.
+ * TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp: Added.
+ (webkitXPathNSResolverLookupNamespaceURI):
+ (webkitXPathNSResolverDOMXPathNSResolverIfaceInit):
+ (webkit_xpath_ns_resolver_init):
+ (webkit_xpath_ns_resolver_class_init):
+ (WebKitDOMXPathNSResolverTest::create):
+ (WebKitDOMXPathNSResolverTest::webPageFromArgs):
+ (WebKitDOMXPathNSResolverTest::evaluateFooChildTextAndCheckResult):
+ (WebKitDOMXPathNSResolverTest::testXPathNSResolverNative):
+ (WebKitDOMXPathNSResolverTest::testXPathNSResolverCustom):
+ (WebKitDOMXPathNSResolverTest::runTest):
+ (registerTests):
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp: Added.
+ (runTest):
+ (testWebKitDOMXPathNSResolverNative):
+ (testWebKitDOMXPathNSResolverCustom):
+ (serverCallback):
+ (beforeAll):
+ (afterAll):
+ * gtk/webkitdom.py:
+ (WebKitDOMDocGeneratorSections.write_section): Add
+ WebKitDOMXPathNSResolver to the list of interfaces.
+
</ins><span class="cx"> 2014-07-01 Gyuyoung Kim <gyuyoung.kim@samsung.com>
</span><span class="cx">
</span><span class="cx"> Fix build break on EFL and GTK ports since r170683
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpystylecheckerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/style/checker.py (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/style/checker.py        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Tools/Scripts/webkitpy/style/checker.py        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -154,6 +154,7 @@
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMDeprecated.h",
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h",
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMNodeFilter.h",
</span><ins>+ "Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.h",
</ins><span class="cx"> "Source/WebCore/bindings/scripts/test/GObject",
</span><span class="cx"> "Source/WebKit/gtk/webkit/",
</span><span class="cx"> "Tools/DumpRenderTree/gtk/"],
</span><span class="lines">@@ -225,6 +226,7 @@
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMDeprecated.cpp",
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp",
</span><span class="cx"> "Source/WebCore/bindings/gobject/WebKitDOMNodeFilter.cpp",
</span><ins>+ "Source/WebCore/bindings/gobject/WebKitDOMXPathNSResolver.cpp",
</ins><span class="cx"> "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer1.cpp",
</span><span class="cx"> "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp",
</span><span class="cx"> "Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp",
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> endmacro()
</span><span class="cx">
</span><span class="cx"> ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
</span><del>-ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp DOMNodeFilterTest.cpp FrameTest.cpp WebProcessTest.cpp)
</del><ins>+ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp)
</ins><span class="cx">
</span><span class="cx"> ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestAuthentication TestAuthentication.cpp)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestDOMNodeFilter TestDOMNodeFilter.cpp)
</span><ins>+ADD_WK2_TEST(TestDOMXPathNSResolver TestDOMXPathNSResolver.cpp)
</ins><span class="cx"> ADD_WK2_TEST(TestDownloads TestDownloads.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitFaviconDatabase TestWebKitFaviconDatabase.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitFindController TestWebKitFindController.cpp)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkDOMXPathNSResolverTestcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMXPathNSResolverTest.cpp        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+
+#include "config.h"
+
+#include "WebProcessTest.h"
+#include <gio/gio.h>
+#include <webkit2/webkit-web-extension.h>
+#include <wtf/gobject/GUniquePtr.h>
+
+typedef struct _WebKitXPathNSResolver {
+ GObject parent;
+} WebKitXPathNSResolver;
+
+typedef struct _WebKitXPathNSResolverClass {
+ GObjectClass parentClass;
+} WebKitXPathNSResolverClass;
+
+static char* webkitXPathNSResolverLookupNamespaceURI(WebKitDOMXPathNSResolver* resolver, const char* prefix)
+{
+ if (!g_strcmp0(prefix, "foo"))
+ return g_strdup("http://www.example.com");
+
+ return nullptr;
+}
+
+static void webkitXPathNSResolverDOMXPathNSResolverIfaceInit(WebKitDOMXPathNSResolverIface* iface)
+{
+ iface->lookup_namespace_uri = webkitXPathNSResolverLookupNamespaceURI;
+}
+
+G_DEFINE_TYPE_WITH_CODE(WebKitXPathNSResolver, webkit_xpath_ns_resolver, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_XPATH_NS_RESOLVER, webkitXPathNSResolverDOMXPathNSResolverIfaceInit))
+
+static void webkit_xpath_ns_resolver_init(WebKitXPathNSResolver*)
+{
+}
+
+static void webkit_xpath_ns_resolver_class_init(WebKitXPathNSResolverClass*)
+{
+}
+
+class WebKitDOMXPathNSResolverTest : public WebProcessTest {
+public:
+ static PassOwnPtr<WebProcessTest> create() { return adoptPtr(new WebKitDOMXPathNSResolverTest()); }
+
+private:
+ guint64 webPageFromArgs(GVariant* args)
+ {
+ GVariantIter iter;
+ g_variant_iter_init(&iter, args);
+
+ const char* key;
+ GVariant* value;
+ while (g_variant_iter_loop(&iter, "{&sv}", &key, &value)) {
+ if (!strcmp(key, "pageID") && g_variant_classify(value) == G_VARIANT_CLASS_UINT64)
+ return g_variant_get_uint64(value);
+ }
+
+ g_assert_not_reached();
+ return 0;
+ }
+
+ void evaluateFooChildTextAndCheckResult(WebKitDOMDocument* document, WebKitDOMXPathNSResolver* resolver)
+ {
+ WebKitDOMElement* documentElement = webkit_dom_document_get_document_element(document);
+ g_assert(WEBKIT_DOM_IS_ELEMENT(documentElement));
+
+ WebKitDOMXPathResult* result = webkit_dom_document_evaluate(document, "foo:child/text()", WEBKIT_DOM_NODE(documentElement), resolver, WEBKIT_DOM_XPATH_RESULT_ORDERED_NODE_ITERATOR_TYPE, nullptr, nullptr);
+ g_assert(WEBKIT_DOM_IS_XPATH_RESULT(result));
+
+ WebKitDOMNode* nodeResult = webkit_dom_xpath_result_iterate_next(result, nullptr);
+ g_assert(WEBKIT_DOM_IS_NODE(nodeResult));
+
+ GUniquePtr<char> nodeValue(webkit_dom_node_get_node_value(nodeResult));
+ g_assert_cmpstr(nodeValue.get(), ==, "SUCCESS");
+ }
+
+ bool testXPathNSResolverNative(WebKitWebExtension* extension, GVariant* args)
+ {
+ WebKitWebPage* page = webkit_web_extension_get_page(extension, webPageFromArgs(args));
+ g_assert(WEBKIT_IS_WEB_PAGE(page));
+ WebKitDOMDocument* document = webkit_web_page_get_dom_document(page);
+ g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+
+ WebKitDOMXPathNSResolver* resolver = webkit_dom_document_create_ns_resolver(document, WEBKIT_DOM_NODE(webkit_dom_document_get_document_element(document)));
+ g_assert(WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver));
+ evaluateFooChildTextAndCheckResult(document, resolver);
+
+ return true;
+ }
+
+ bool testXPathNSResolverCustom(WebKitWebExtension* extension, GVariant* args)
+ {
+ WebKitWebPage* page = webkit_web_extension_get_page(extension, webPageFromArgs(args));
+ g_assert(WEBKIT_IS_WEB_PAGE(page));
+ WebKitDOMDocument* document = webkit_web_page_get_dom_document(page);
+ g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+
+ GRefPtr<WebKitDOMXPathNSResolver> resolver = adoptGRef(WEBKIT_DOM_XPATH_NS_RESOLVER(g_object_new(webkit_xpath_ns_resolver_get_type(), nullptr)));
+ evaluateFooChildTextAndCheckResult(document, resolver.get());
+
+ return true;
+ }
+
+ virtual bool runTest(const char* testName, WebKitWebExtension* extension, GVariant* args)
+ {
+ if (!strcmp(testName, "native"))
+ return testXPathNSResolverNative(extension, args);
+ if (!strcmp(testName, "custom"))
+ return testXPathNSResolverCustom(extension, args);
+
+ g_assert_not_reached();
+ return false;
+ }
+};
+
+static void __attribute__((constructor)) registerTests()
+{
+ REGISTER_TEST(WebKitDOMXPathNSResolverTest, "WebKitDOMXPathNSResolver/native");
+ REGISTER_TEST(WebKitDOMXPathNSResolverTest, "WebKitDOMXPathNSResolver/custom");
+}
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMXPathNSResolvercpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp (0 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 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 "WebKitTestServer.h"
+#include "WebProcessTestRunner.h"
+#include "WebViewTest.h"
+#include <gtk/gtk.h>
+#include <webkit2/webkit2.h>
+
+static WebProcessTestRunner* testRunner;
+static WebKitTestServer* kServer;
+
+static void runTest(WebViewTest* test, const char* name)
+{
+ GVariantBuilder builder;
+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_add(&builder, "{sv}", "pageID", g_variant_new_uint64(webkit_web_view_get_page_id(test->m_webView)));
+ g_assert(testRunner->runTest("WebKitDOMXPathNSResolver", name, g_variant_builder_end(&builder)));
+}
+
+static void testWebKitDOMXPathNSResolverNative(WebViewTest* test, gconstpointer)
+{
+ test->loadURI(kServer->getURIForPath("/native").data());
+ test->waitUntilLoadFinished();
+ runTest(test, "native");
+}
+
+static void testWebKitDOMXPathNSResolverCustom(WebViewTest* test, gconstpointer)
+{
+ test->loadURI(kServer->getURIForPath("/custom").data());
+ test->waitUntilLoadFinished();
+ runTest(test, "custom");
+}
+
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+ if (message->method != SOUP_METHOD_GET) {
+ soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+ return;
+ }
+
+ if (g_str_equal(path, "/native")) {
+ soup_message_set_status(message, SOUP_STATUS_OK);
+ soup_message_headers_append(message->response_headers, "Content-Type", "text/xml");
+ static const char* nativeXML = "<root xmlns:foo='http://www.example.org'><foo:child>SUCCESS</foo:child></root>";
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, nativeXML, strlen(nativeXML));
+ soup_message_body_complete(message->response_body);
+ } else if (g_str_equal(path, "/custom")) {
+ soup_message_set_status(message, SOUP_STATUS_OK);
+ soup_message_headers_append(message->response_headers, "Content-Type", "text/xml");
+ static const char* customXML = "<root xmlns='http://www.example.com'><child>SUCCESS</child></root>";
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, customXML, strlen(customXML));
+ soup_message_body_complete(message->response_body);
+ } else
+ soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+}
+
+void beforeAll()
+{
+ kServer = new WebKitTestServer();
+ kServer->run(serverCallback);
+
+ testRunner = new WebProcessTestRunner();
+ webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);
+
+ WebViewTest::add("WebKitDOMXPathNSResolver", "native", testWebKitDOMXPathNSResolverNative);
+ WebViewTest::add("WebKitDOMXPathNSResolver", "custom", testWebKitDOMXPathNSResolverCustom);
+}
+
+void afterAll()
+{
+ delete testRunner;
+ delete kServer;
+}
</ins></span></pre></div>
<a id="trunkToolsgtkwebkitdompy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/gtk/webkitdom.py (170699 => 170700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/gtk/webkitdom.py        2014-07-02 06:44:05 UTC (rev 170699)
+++ trunk/Tools/gtk/webkitdom.py        2014-07-02 07:04:23 UTC (rev 170700)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx"> def write_section(self, symbol_file):
</span><span class="cx"> class_name = os.path.basename(symbol_file).replace(".symbols", "")
</span><span class="cx"> is_custom = class_name == 'WebKitDOMCustom'
</span><del>- is_interface = class_name in ['WebKitDOMEventTarget', 'WebKitDOMNodeFilter']
</del><ins>+ is_interface = class_name in ['WebKitDOMEventTarget', 'WebKitDOMNodeFilter', 'WebKitDOMXPathNSResolver']
</ins><span class="cx"> is_object = class_name == 'WebKitDOMObject'
</span><span class="cx"> self.write('<SECTION>\n')
</span><span class="cx"> self.write('<FILE>%s</FILE>\n<TITLE>%s</TITLE>\n' % (class_name, class_name))
</span></span></pre>
</div>
</div>
</body>
</html>