<!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>[214215] 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/214215">214215</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-03-21 02:11:05 -0700 (Tue, 21 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Add function webkit_dom_element_get_bounding_client_rect
https://bugs.webkit.org/show_bug.cgi?id=163892
Patch by Aidan Holm <aidanholm+webkit@gmail.com> on 2017-03-21
Reviewed by Carlos Garcia Campos.
Wrap WebCore::ClientRect as WebKitDOMClientRect.
Wrap WebCore::ClientRectList as WebKitDOMClientRectList.
Implement webkit_dom_element_get_bounding_client_rect().
Implement webkit_dom_element_get_client_rects().
* PlatformGTK.cmake:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp: Added.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp: Added.
(WebKit::kit):
(WebKit::core):
(WebKit::wrapClientRect):
(webkit_dom_client_rect_finalize):
(webkit_dom_client_rect_get_property):
(webkit_dom_client_rect_constructed):
(webkit_dom_client_rect_class_init):
(webkit_dom_client_rect_init):
(webkit_dom_client_rect_get_top):
(webkit_dom_client_rect_get_right):
(webkit_dom_client_rect_get_bottom):
(webkit_dom_client_rect_get_left):
(webkit_dom_client_rect_get_width):
(webkit_dom_client_rect_get_height):
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h: Added.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h: Added.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h: Added.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h: Added.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
(webkit_dom_element_get_property):
(webkit_dom_element_class_init):
(webkit_dom_element_get_scroll_height):
(webkit_dom_element_get_bounding_client_rect):
(webkit_dom_element_get_client_rects):
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
(WebKit::wrap):
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.h:
* WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt:
* WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h:
* WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h:
* WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMElementcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMElementh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMdocswebkitdomgtk40sectionstxt">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomautocleanupsh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomdefinesh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRecth">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListPrivateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectPrivateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkDOMClientRectTestcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMClientRectTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMClientRectcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMClientRect.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2017-03-21 Aidan Holm <aidanholm+webkit@gmail.com>
+
+ [GTK] Add function webkit_dom_element_get_bounding_client_rect
+ https://bugs.webkit.org/show_bug.cgi?id=163892
+
+ Reviewed by Carlos Garcia Campos.
+
+ Wrap WebCore::ClientRect as WebKitDOMClientRect.
+ Wrap WebCore::ClientRectList as WebKitDOMClientRectList.
+ Implement webkit_dom_element_get_bounding_client_rect().
+ Implement webkit_dom_element_get_client_rects().
+
+ * PlatformGTK.cmake:
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp: Added.
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp: Added.
+ (WebKit::kit):
+ (WebKit::core):
+ (WebKit::wrapClientRect):
+ (webkit_dom_client_rect_finalize):
+ (webkit_dom_client_rect_get_property):
+ (webkit_dom_client_rect_constructed):
+ (webkit_dom_client_rect_class_init):
+ (webkit_dom_client_rect_init):
+ (webkit_dom_client_rect_get_top):
+ (webkit_dom_client_rect_get_right):
+ (webkit_dom_client_rect_get_bottom):
+ (webkit_dom_client_rect_get_left):
+ (webkit_dom_client_rect_get_width):
+ (webkit_dom_client_rect_get_height):
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h: Added.
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h: Added.
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h: Added.
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h: Added.
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
+ (webkit_dom_element_get_property):
+ (webkit_dom_element_class_init):
+ (webkit_dom_element_get_scroll_height):
+ (webkit_dom_element_get_bounding_client_rect):
+ (webkit_dom_element_get_client_rects):
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h:
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
+ (WebKit::wrap):
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.h:
+ * WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt:
+ * WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h:
+ * WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h:
+ * WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h:
+
</ins><span class="cx"> 2017-03-20 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> WebPageProxy DecidePolicyForNavigationAction and DecidePolicyForResponseSync should be Delayed reply messages
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -359,6 +359,8 @@
</span><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp
</span><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp
</span><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp
</span><ins>+ WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp
+ WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp
</ins><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp
</span><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp
</span><span class="cx"> WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp
</span><span class="lines">@@ -604,6 +606,8 @@
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h
</span><ins>+ ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h
+ ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h
</ins><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h
</span><span class="lines">@@ -715,6 +719,8 @@
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h
</span><ins>+ ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h
+ ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h
</ins><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,243 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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 "WebKitDOMClientRect.h"
+
+#include "ConvertToUTF8String.h"
+#include "DOMObjectCache.h"
+#include "WebKitDOMClientRectPrivate.h"
+#include "WebKitDOMPrivate.h"
+#include <WebCore/CSSImportRule.h>
+#include <WebCore/Document.h>
+#include <WebCore/ExceptionCodeDescription.h>
+#include <WebCore/ExceptionCode.h>
+#include <WebCore/JSMainThreadExecState.h>
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_CLIENT_RECT_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_CLIENT_RECT, WebKitDOMClientRectPrivate)
+
+typedef struct _WebKitDOMClientRectPrivate {
+ RefPtr<WebCore::ClientRect> coreObject;
+} WebKitDOMClientRectPrivate;
+
+namespace WebKit {
+
+WebKitDOMClientRect* kit(WebCore::ClientRect* obj)
+{
+ if (!obj)
+ return nullptr;
+
+ if (gpointer ret = DOMObjectCache::get(obj))
+ return WEBKIT_DOM_CLIENT_RECT(ret);
+
+ return wrapClientRect(obj);
+}
+
+WebCore::ClientRect* core(WebKitDOMClientRect* request)
+{
+ return request ? static_cast<WebCore::ClientRect*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
+}
+
+WebKitDOMClientRect* wrapClientRect(WebCore::ClientRect* coreObject)
+{
+ ASSERT(coreObject);
+ return WEBKIT_DOM_CLIENT_RECT(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+G_DEFINE_TYPE(WebKitDOMClientRect, webkit_dom_client_rect, WEBKIT_DOM_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_TOP,
+ PROP_RIGHT,
+ PROP_BOTTOM,
+ PROP_LEFT,
+ PROP_WIDTH,
+ PROP_HEIGHT,
+};
+
+static void webkit_dom_client_rect_finalize(GObject* object)
+{
+ WebKitDOMClientRectPrivate* priv = WEBKIT_DOM_CLIENT_RECT_GET_PRIVATE(object);
+
+ WebKit::DOMObjectCache::forget(priv->coreObject.get());
+
+ priv->~WebKitDOMClientRectPrivate();
+ G_OBJECT_CLASS(webkit_dom_client_rect_parent_class)->finalize(object);
+}
+
+static void webkit_dom_client_rect_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
+{
+ WebKitDOMClientRect* self = WEBKIT_DOM_CLIENT_RECT(object);
+
+ switch (propertyId) {
+ case PROP_TOP:
+ g_value_set_float(value, webkit_dom_client_rect_get_top(self));
+ break;
+ case PROP_RIGHT:
+ g_value_set_float(value, webkit_dom_client_rect_get_right(self));
+ break;
+ case PROP_BOTTOM:
+ g_value_set_float(value, webkit_dom_client_rect_get_bottom(self));
+ break;
+ case PROP_LEFT:
+ g_value_set_float(value, webkit_dom_client_rect_get_left(self));
+ break;
+ case PROP_WIDTH:
+ g_value_set_float(value, webkit_dom_client_rect_get_width(self));
+ break;
+ case PROP_HEIGHT:
+ g_value_set_float(value, webkit_dom_client_rect_get_height(self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
+ break;
+ }
+}
+
+static void webkit_dom_client_rect_constructed(GObject* object)
+{
+ G_OBJECT_CLASS(webkit_dom_client_rect_parent_class)->constructed(object);
+
+ WebKitDOMClientRectPrivate* priv = WEBKIT_DOM_CLIENT_RECT_GET_PRIVATE(object);
+ priv->coreObject = static_cast<WebCore::ClientRect*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+ WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+}
+
+static void webkit_dom_client_rect_class_init(WebKitDOMClientRectClass* requestClass)
+{
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+ g_type_class_add_private(gobjectClass, sizeof(WebKitDOMClientRectPrivate));
+ gobjectClass->constructed = webkit_dom_client_rect_constructed;
+ gobjectClass->finalize = webkit_dom_client_rect_finalize;
+ gobjectClass->get_property = webkit_dom_client_rect_get_property;
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_TOP,
+ g_param_spec_float(
+ "top",
+ "ClientRect:top",
+ "read-only gfloat ClientRect:top",
+ -G_MAXFLOAT, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_RIGHT,
+ g_param_spec_float(
+ "right",
+ "ClientRect:right",
+ "read-only gfloat ClientRect:right",
+ -G_MAXFLOAT, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_BOTTOM,
+ g_param_spec_float(
+ "bottom",
+ "ClientRect:bottom",
+ "read-only gfloat ClientRect:bottom",
+ -G_MAXFLOAT, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_LEFT,
+ g_param_spec_float(
+ "left",
+ "ClientRect:left",
+ "read-only gfloat ClientRect:left",
+ -G_MAXFLOAT, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_WIDTH,
+ g_param_spec_float(
+ "width",
+ "ClientRect:width",
+ "read-only gfloat ClientRect:width",
+ 0, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_HEIGHT,
+ g_param_spec_float(
+ "height",
+ "ClientRect:height",
+ "read-only gfloat ClientRect:height",
+ 0, G_MAXFLOAT, 0,
+ WEBKIT_PARAM_READABLE));
+
+}
+
+static void webkit_dom_client_rect_init(WebKitDOMClientRect* request)
+{
+ WebKitDOMClientRectPrivate* priv = WEBKIT_DOM_CLIENT_RECT_GET_PRIVATE(request);
+ new (priv) WebKitDOMClientRectPrivate();
+}
+
+gfloat webkit_dom_client_rect_get_top(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->top();
+}
+
+gfloat webkit_dom_client_rect_get_right(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->right();
+}
+
+gfloat webkit_dom_client_rect_get_bottom(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->bottom();
+}
+
+gfloat webkit_dom_client_rect_get_left(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->left();
+}
+
+gfloat webkit_dom_client_rect_get_width(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->width();
+}
+
+gfloat webkit_dom_client_rect_get_height(WebKitDOMClientRect* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT(self), 0);
+ return WebKit::core(self)->height();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRecth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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.
+ */
+
+#if !defined(__WEBKITDOM_H_INSIDE__) && !defined(BUILDING_WEBKIT)
+#error "Only <webkitdom/webkitdom.h> can be included directly."
+#endif
+
+#ifndef WebKitDOMClientRect_h
+#define WebKitDOMClientRect_h
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_CLIENT_RECT (webkit_dom_client_rect_get_type())
+#define WEBKIT_DOM_CLIENT_RECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_CLIENT_RECT, WebKitDOMClientRect))
+#define WEBKIT_DOM_CLIENT_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_DOM_TYPE_CLIENT_RECT, WebKitDOMClientRectClass)
+#define WEBKIT_DOM_IS_CLIENT_RECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_CLIENT_RECT))
+#define WEBKIT_DOM_IS_CLIENT_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_CLIENT_RECT))
+#define WEBKIT_DOM_CLIENT_RECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_CLIENT_RECT, WebKitDOMClientRectClass))
+
+struct _WebKitDOMClientRect {
+ WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMClientRectClass {
+ WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_client_rect_get_type(void);
+
+/**
+ * webkit_dom_client_rect_get_top:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the top coordinate of @self, relative to the viewport.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_top(WebKitDOMClientRect* self);
+
+/**
+ * webkit_dom_client_rect_get_right:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the right coordinate of @self, relative to the viewport.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_right(WebKitDOMClientRect* self);
+
+/**
+ * webkit_dom_client_rect_get_bottom:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the bottom coordinate of @self, relative to the viewport.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_bottom(WebKitDOMClientRect* self);
+
+/**
+ * webkit_dom_client_rect_get_left:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the left coordinate of @self, relative to the viewport.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_left(WebKitDOMClientRect* self);
+
+/**
+ * webkit_dom_client_rect_get_width:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the width of @self.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_width(WebKitDOMClientRect* self);
+
+/**
+ * webkit_dom_client_rect_get_height:
+ * @self: A #WebKitDOMClientRect
+ *
+ * Returns the height of @self.
+ *
+ * Returns: A #gfloat
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gfloat
+webkit_dom_client_rect_get_height(WebKitDOMClientRect* self);
+
+G_END_DECLS
+
+#endif /* WebKitDOMClientRect_h */
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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 "WebKitDOMClientRectList.h"
+
+#include "ConvertToUTF8String.h"
+#include "DOMObjectCache.h"
+#include "WebKitDOMClientRectListPrivate.h"
+#include "WebKitDOMClientRectPrivate.h"
+#include "WebKitDOMPrivate.h"
+#include <WebCore/CSSImportRule.h>
+#include <WebCore/Document.h>
+#include <WebCore/ExceptionCodeDescription.h>
+#include <WebCore/ExceptionCode.h>
+#include <WebCore/JSMainThreadExecState.h>
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectListPrivate)
+
+typedef struct _WebKitDOMClientRectListPrivate {
+ RefPtr<WebCore::ClientRectList> coreObject;
+} WebKitDOMClientRectListPrivate;
+
+namespace WebKit {
+
+WebKitDOMClientRectList* kit(WebCore::ClientRectList* obj)
+{
+ if (!obj)
+ return nullptr;
+
+ if (gpointer ret = DOMObjectCache::get(obj))
+ return WEBKIT_DOM_CLIENT_RECT_LIST(ret);
+
+ return wrapClientRectList(obj);
+}
+
+WebCore::ClientRectList* core(WebKitDOMClientRectList* request)
+{
+ return request ? static_cast<WebCore::ClientRectList*>(WEBKIT_DOM_OBJECT(request)->coreObject) : nullptr;
+}
+
+WebKitDOMClientRectList* wrapClientRectList(WebCore::ClientRectList* coreObject)
+{
+ ASSERT(coreObject);
+ return WEBKIT_DOM_CLIENT_RECT_LIST(g_object_new(WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+G_DEFINE_TYPE(WebKitDOMClientRectList, webkit_dom_client_rect_list, WEBKIT_DOM_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_LENGTH,
+};
+
+static void webkit_dom_client_rect_list_finalize(GObject* object)
+{
+ WebKitDOMClientRectListPrivate* priv = WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(object);
+
+ WebKit::DOMObjectCache::forget(priv->coreObject.get());
+
+ priv->~WebKitDOMClientRectListPrivate();
+ G_OBJECT_CLASS(webkit_dom_client_rect_list_parent_class)->finalize(object);
+}
+
+static void webkit_dom_client_rect_list_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
+{
+ WebKitDOMClientRectList* self = WEBKIT_DOM_CLIENT_RECT_LIST(object);
+
+ switch (propertyId) {
+ case PROP_LENGTH:
+ g_value_set_ulong(value, webkit_dom_client_rect_list_get_length(self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
+ break;
+ }
+}
+
+static void webkit_dom_client_rect_list_constructed(GObject* object)
+{
+ G_OBJECT_CLASS(webkit_dom_client_rect_list_parent_class)->constructed(object);
+
+ WebKitDOMClientRectListPrivate* priv = WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(object);
+ priv->coreObject = static_cast<WebCore::ClientRectList*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+ WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+}
+
+static void webkit_dom_client_rect_list_class_init(WebKitDOMClientRectListClass* requestClass)
+{
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+ g_type_class_add_private(gobjectClass, sizeof(WebKitDOMClientRectListPrivate));
+ gobjectClass->constructed = webkit_dom_client_rect_list_constructed;
+ gobjectClass->finalize = webkit_dom_client_rect_list_finalize;
+ gobjectClass->get_property = webkit_dom_client_rect_list_get_property;
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_LENGTH,
+ g_param_spec_ulong(
+ "length",
+ "ClientRectList:length",
+ "read-only gulong ClientRectList:length",
+ 0, G_MAXULONG, 0,
+ WEBKIT_PARAM_READABLE));
+
+}
+
+static void webkit_dom_client_rect_list_init(WebKitDOMClientRectList* request)
+{
+ WebKitDOMClientRectListPrivate* priv = WEBKIT_DOM_CLIENT_RECT_LIST_GET_PRIVATE(request);
+ new (priv) WebKitDOMClientRectListPrivate();
+}
+
+WebKitDOMClientRect* webkit_dom_client_rect_list_item(WebKitDOMClientRectList* self, gulong index)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), nullptr);
+ WebCore::ClientRectList* item = WebKit::core(self);
+ RefPtr<WebCore::ClientRect> gobjectResult = WTF::getPtr(item->item(index));
+ return WebKit::kit(gobjectResult.get());
+}
+
+gulong webkit_dom_client_rect_list_get_length(WebKitDOMClientRectList* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_CLIENT_RECT_LIST(self), 0);
+ return WebKit::core(self)->length();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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.
+ */
+
+#if !defined(__WEBKITDOM_H_INSIDE__) && !defined(BUILDING_WEBKIT)
+#error "Only <webkitdom/webkitdom.h> can be included directly."
+#endif
+
+#ifndef WebKitDOMClientRectList_h
+#define WebKitDOMClientRectList_h
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_CLIENT_RECT_LIST (webkit_dom_client_rect_list_get_type())
+#define WEBKIT_DOM_CLIENT_RECT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectList))
+#define WEBKIT_DOM_CLIENT_RECT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectListClass)
+#define WEBKIT_DOM_IS_CLIENT_RECT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_CLIENT_RECT_LIST))
+#define WEBKIT_DOM_IS_CLIENT_RECT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_CLIENT_RECT_LIST))
+#define WEBKIT_DOM_CLIENT_RECT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_CLIENT_RECT_LIST, WebKitDOMClientRectListClass))
+
+struct _WebKitDOMClientRectList {
+ WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMClientRectListClass {
+ WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_client_rect_list_get_type(void);
+
+/**
+ * webkit_dom_client_rect_list_get_length:
+ * @self: A #WebKitDOMClientRectList
+ *
+ * Returns the number of #WebKitDOMClientRect objects that @self contains.
+ *
+ * Returns: A #gulong
+ *
+ * Since: 2.18
+**/
+WEBKIT_API gulong
+webkit_dom_client_rect_list_get_length(WebKitDOMClientRectList* self);
+
+/**
+ * webkit_dom_client_rect_list_item:
+ * @self: A #WebKitDOMClientRectList
+ * @index: A #gulong
+ *
+ * Returns the #WebKitDOMClientRect object that @self contains at @index.
+ *
+ * Returns: (transfer none): A #WebKitDOMClientRect
+ *
+ * Since: 2.18
+**/
+WEBKIT_API WebKitDOMClientRect* webkit_dom_client_rect_list_item(WebKitDOMClientRectList* self, gulong index);
+
+G_END_DECLS
+
+#endif /* WebKitDOMClientRectList_h */
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectListPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <WebCore/ClientRectList.h>
+#include <webkitdom/WebKitDOMClientRectList.h>
+
+namespace WebKit {
+WebKitDOMClientRectList* wrapClientRectList(WebCore::ClientRectList*);
+WebKitDOMClientRectList* kit(WebCore::ClientRectList*);
+WebCore::ClientRectList* core(WebKitDOMClientRectList*);
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMClientRectPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <WebCore/ClientRect.h>
+#include <webkitdom/WebKitDOMClientRect.h>
+
+namespace WebKit {
+WebKitDOMClientRect* wrapClientRect(WebCore::ClientRect*);
+WebKitDOMClientRect* kit(WebCore::ClientRect*);
+WebCore::ClientRect* core(WebKitDOMClientRect*);
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -22,6 +22,8 @@
</span><span class="cx">
</span><span class="cx"> #include <WebCore/CSSImportRule.h>
</span><span class="cx"> #include "DOMObjectCache.h"
</span><ins>+#include <WebCore/ClientRect.h>
+#include <WebCore/ClientRectList.h>
</ins><span class="cx"> #include <WebCore/Document.h>
</span><span class="cx"> #include <WebCore/ExceptionCode.h>
</span><span class="cx"> #include <WebCore/ExceptionCodeDescription.h>
</span><span class="lines">@@ -30,6 +32,8 @@
</span><span class="cx"> #include <WebCore/JSMainThreadExecState.h>
</span><span class="cx"> #include "WebKitDOMAttrPrivate.h"
</span><span class="cx"> #include "WebKitDOMCSSStyleDeclarationPrivate.h"
</span><ins>+#include "WebKitDOMClientRectListPrivate.h"
+#include "WebKitDOMClientRectPrivate.h"
</ins><span class="cx"> #include "WebKitDOMDOMTokenListPrivate.h"
</span><span class="cx"> #include "WebKitDOMElementPrivate.h"
</span><span class="cx"> #include "WebKitDOMEventPrivate.h"
</span><span class="lines">@@ -1221,6 +1225,24 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+WebKitDOMClientRect* webkit_dom_element_get_bounding_client_rect(WebKitDOMElement* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
+ WebCore::Element* item = WebKit::core(self);
+ auto clientRect = item->getBoundingClientRect();
+ return WebKit::kit(clientRect.ptr());
+}
+
+WebKitDOMClientRectList* webkit_dom_element_get_client_rects(WebKitDOMElement* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
+ WebCore::Element* item = WebKit::core(self);
+ auto clientRects = item->getClientRects();
+ return WebKit::kit(clientRects.ptr());
+}
+
</ins><span class="cx"> WebKitDOMElement* webkit_dom_element_get_offset_parent(WebKitDOMElement* self)
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -516,6 +516,34 @@
</span><span class="cx"> webkit_dom_element_get_scroll_height(WebKitDOMElement* self);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_element_get_bounding_client_rect:
+ * @self: A #WebKitDOMElement
+ *
+ * Returns a #WebKitDOMClientRect representing the size and position of @self
+ * relative to the viewport.
+ *
+ * Returns: (transfer full): A #WebKitDOMClientRect
+ *
+ * Since: 2.18
+**/
+WEBKIT_API WebKitDOMClientRect*
+webkit_dom_element_get_bounding_client_rect(WebKitDOMElement* self);
+
+/**
+ * webkit_dom_element_get_client_rects:
+ * @self: A #WebKitDOMElement
+ *
+ * Returns a collection of #WebKitDOMClientRect objects, each of which describe
+ * the size and position of a CSS border box relative to the viewport.
+ *
+ * Returns: (transfer full): A #WebKitDOMClientRectList
+ *
+ * Since: 2.18
+**/
+WEBKIT_API WebKitDOMClientRectList*
+webkit_dom_element_get_client_rects(WebKitDOMElement* self);
+
+/**
</ins><span class="cx"> * webkit_dom_element_get_offset_parent:
</span><span class="cx"> * @self: A #WebKitDOMElement
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMdocswebkitdomgtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -647,6 +647,8 @@
</span><span class="cx"> webkit_dom_element_set_scroll_top
</span><span class="cx"> webkit_dom_element_get_scroll_width
</span><span class="cx"> webkit_dom_element_get_scroll_height
</span><ins>+webkit_dom_element_get_bounding_client_rect
+webkit_dom_element_get_client_rects
</ins><span class="cx"> webkit_dom_element_get_offset_parent
</span><span class="cx"> webkit_dom_element_get_inner_html
</span><span class="cx"> webkit_dom_element_set_inner_html
</span><span class="lines">@@ -3201,3 +3203,48 @@
</span><span class="cx"> WEBKIT_DEPRECATED_FOR
</span><span class="cx"> </SECTION>
</span><span class="cx">
</span><ins>+<SECTION>
+<FILE>WebKitDOMClientRect</FILE>
+<TITLE>WebKitDOMClientRect</TITLE>
+WebKitDOMClientRect
+
+webkit_dom_client_rect_get_top
+webkit_dom_client_rect_get_right
+webkit_dom_client_rect_get_bottom
+webkit_dom_client_rect_get_left
+webkit_dom_client_rect_get_width
+webkit_dom_client_rect_get_height
+
+<SUBSECTION Standard>
+WebKitDOMClientRectClass
+WEBKIT_DOM_TYPE_CLIENT_RECT
+WEBKIT_DOM_CLIENT_RECT
+WEBKIT_DOM_IS_CLIENT_RECT
+WEBKIT_DOM_CLIENT_RECT_CLASS
+WEBKIT_DOM_IS_CLIENT_RECT_CLASS
+WEBKIT_DOM_CLIENT_RECT_GET_CLASS
+
+<SUBSECTION Private>
+webkit_dom_client_rect_get_type
+</SECTION>
+
+<SECTION>
+<FILE>WebKitDOMClientRectList</FILE>
+<TITLE>WebKitDOMClientRectList</TITLE>
+WebKitDOMClientRectList
+
+webkit_dom_client_rect_list_item
+webkit_dom_client_rect_list_get_length
+
+<SUBSECTION Standard>
+WebKitDOMClientRectClass
+WEBKIT_DOM_TYPE_CLIENT_RECT_LIST
+WEBKIT_DOM_CLIENT_RECT_LIST
+WEBKIT_DOM_IS_CLIENT_RECT_LIST
+WEBKIT_DOM_CLIENT_RECT_LIST_CLASS
+WEBKIT_DOM_IS_CLIENT_RECT_LIST_CLASS
+WEBKIT_DOM_CLIENT_RECT_LIST_GET_CLASS
+
+<SUBSECTION Private>
+webkit_dom_client_rect_list_get_type
+</SECTION>
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx"> #include <webkitdom/WebKitDOMCSSStyleSheet.h>
</span><span class="cx"> #include <webkitdom/WebKitDOMCSSValue.h>
</span><span class="cx"> #include <webkitdom/WebKitDOMCharacterData.h>
</span><ins>+#include <webkitdom/WebKitDOMClientRect.h>
+#include <webkitdom/WebKitDOMClientRectList.h>
</ins><span class="cx"> #include <webkitdom/WebKitDOMComment.h>
</span><span class="cx"> #include <webkitdom/WebKitDOMCustom.h>
</span><span class="cx"> #include <webkitdom/WebKitDOMDOMImplementation.h>
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomautocleanupsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCSSStyleSheet, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCSSValue, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCharacterData, g_object_unref)
</span><ins>+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMClientRect, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMClientRectList, g_object_unref)
</ins><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMComment, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMDOMImplementation, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMDOMWindow, g_object_unref)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMwebkitdomdefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -64,6 +64,12 @@
</span><span class="cx"> typedef struct _WebKitDOMCharacterData WebKitDOMCharacterData;
</span><span class="cx"> typedef struct _WebKitDOMCharacterDataClass WebKitDOMCharacterDataClass;
</span><span class="cx">
</span><ins>+typedef struct _WebKitDOMClientRect WebKitDOMClientRect;
+typedef struct _WebKitDOMClientRectClass WebKitDOMClientRectClass;
+
+typedef struct _WebKitDOMClientRectList WebKitDOMClientRectList;
+typedef struct _WebKitDOMClientRectListClass WebKitDOMClientRectListClass;
+
</ins><span class="cx"> typedef struct _WebKitDOMComment WebKitDOMComment;
</span><span class="cx"> typedef struct _WebKitDOMCommentClass WebKitDOMCommentClass;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (214214 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2017-03-21 08:59:27 UTC (rev 214214)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -93,7 +93,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 AutocleanupsTest.cpp DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.cpp)
</del><ins>+ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest AutocleanupsTest.cpp DOMClientRectTest.cpp DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.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">@@ -101,6 +101,7 @@
</span><span class="cx"> ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
</span><ins>+ADD_WK2_TEST(TestDOMClientRect TestDOMClientRect.cpp)
</ins><span class="cx"> ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestDOMNodeFilter TestDOMNodeFilter.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestDOMXPathNSResolver TestDOMXPathNSResolver.cpp)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkDOMClientRectTestcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMClientRectTest.cpp (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMClientRectTest.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMClientRectTest.cpp        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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>
+
+class WebKitDOMClientRectTest : public WebProcessTest {
+public:
+ static std::unique_ptr<WebProcessTest> create() { return std::unique_ptr<WebKitDOMClientRectTest>(new WebKitDOMClientRectTest()); }
+
+private:
+ static void checkClientRectPosition(WebKitDOMClientRect* clientRect)
+ {
+ // Expected values correspond to CSS in TestDOMClientRect.cpp
+ g_assert_cmpfloat(webkit_dom_client_rect_get_top(clientRect), ==, -25);
+ g_assert_cmpfloat(webkit_dom_client_rect_get_right(clientRect), ==, 50);
+ g_assert_cmpfloat(webkit_dom_client_rect_get_bottom(clientRect), ==, 175);
+ g_assert_cmpfloat(webkit_dom_client_rect_get_left(clientRect), ==, -50);
+ g_assert_cmpfloat(webkit_dom_client_rect_get_width(clientRect), ==, 100);
+ g_assert_cmpfloat(webkit_dom_client_rect_get_height(clientRect), ==, 200);
+ }
+
+
+ bool testDivBoundingClientRectPosition(WebKitWebPage* page)
+ {
+ WebKitDOMDocument* document = webkit_web_page_get_dom_document(page);
+ g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(document));
+
+ WebKitDOMElement* div = webkit_dom_document_get_element_by_id(document, "rect");
+ g_assert(WEBKIT_DOM_IS_HTML_ELEMENT(div));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(div));
+
+ GRefPtr<WebKitDOMClientRect> clientRect = adoptGRef(webkit_dom_element_get_bounding_client_rect(div));
+ g_assert(WEBKIT_DOM_IS_CLIENT_RECT(clientRect.get()));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(clientRect.get()));
+ checkClientRectPosition(clientRect.get());
+
+ return true;
+ }
+
+ bool testDivClientRectsPositionAndLength(WebKitWebPage* page)
+ {
+ WebKitDOMDocument* document = webkit_web_page_get_dom_document(page);
+ g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(document));
+
+ WebKitDOMElement* div = webkit_dom_document_get_element_by_id(document, "rect");
+ g_assert(WEBKIT_DOM_IS_HTML_ELEMENT(div));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(div));
+
+ GRefPtr<WebKitDOMClientRectList> clientRectList = adoptGRef(webkit_dom_element_get_client_rects(div));
+ g_assert(WEBKIT_DOM_IS_CLIENT_RECT_LIST(clientRectList.get()));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(clientRectList.get()));
+
+ g_assert_cmpuint(webkit_dom_client_rect_list_get_length(clientRectList.get()), ==, 1);
+
+ WebKitDOMClientRect* clientRect = webkit_dom_client_rect_list_item(clientRectList.get(), 0);
+ g_assert(WEBKIT_DOM_IS_CLIENT_RECT(clientRect));
+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(clientRect));
+ checkClientRectPosition(clientRect);
+
+ // Getting the clientRect twice should return the same pointer.
+ g_assert(webkit_dom_client_rect_list_item(clientRectList.get(), 0) == webkit_dom_client_rect_list_item(clientRectList.get(), 0));
+
+ return true;
+ }
+
+ bool runTest(const char* testName, WebKitWebPage* page) override
+ {
+ if (!strcmp(testName, "div-bounding-client-rect-position"))
+ return testDivBoundingClientRectPosition(page);
+ if (!strcmp(testName, "div-client-rects-position-and-length"))
+ return testDivClientRectsPositionAndLength(page);
+
+ g_assert_not_reached();
+ return false;
+ }
+};
+
+static void __attribute__((constructor)) registerTests()
+{
+ REGISTER_TEST(WebKitDOMClientRectTest, "WebKitDOMClientRect/div-bounding-client-rect-position");
+ REGISTER_TEST(WebKitDOMClientRectTest, "WebKitDOMClientRect/div-client-rects-position-and-length");
+}
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMClientRectcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMClientRect.cpp (0 => 214215)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMClientRect.cpp         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMClientRect.cpp        2017-03-21 09:11:05 UTC (rev 214215)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2017 Aidan Holm <aidanholm@gmail.com>
+ *
+ * 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 "WebViewTest.h"
+#include <webkit2/webkit2.h>
+
+static void prepareDOMForClientRectPositionTests(WebViewTest* test)
+{
+ static const char* testHTML = "<html><head></head><body>"
+ "<style>"
+ " #rect { position: fixed; top: -25px; left: -50px; width: 100px; height: 200px; }"
+ "</style>"
+ "<div id=rect></div></body></html>";
+ test->loadHtml(testHTML, nullptr);
+ test->waitUntilLoadFinished();
+}
+
+static void testWebKitDOMClientRectDivBoundingClientRectPosition(WebViewTest* test, gconstpointer)
+{
+ prepareDOMForClientRectPositionTests(test);
+ g_assert(test->runWebProcessTest("WebKitDOMClientRect", "div-bounding-client-rect-position"));
+}
+
+static void testWebKitDOMClientRectDivClientRectsPositionAndLength(WebViewTest* test, gconstpointer)
+{
+ prepareDOMForClientRectPositionTests(test);
+ g_assert(test->runWebProcessTest("WebKitDOMClientRect", "div-client-rects-position-and-length"));
+}
+
+void beforeAll()
+{
+ WebViewTest::add("WebKitDOMClientRect", "div-bounding-client-rect-position", testWebKitDOMClientRectDivBoundingClientRectPosition);
+ WebViewTest::add("WebKitDOMClientRect", "div-client-rects-position-and-length", testWebKitDOMClientRectDivClientRectsPositionAndLength);
+}
+
+void afterAll()
+{
+}
</ins></span></pre>
</div>
</div>
</body>
</html>