Title: [214215] trunk
Revision
214215
Author
commit-qu...@webkit.org
Date
2017-03-21 02:11:05 -0700 (Tue, 21 Mar 2017)

Log Message

[GTK] Add function webkit_dom_element_get_bounding_client_rect
https://bugs.webkit.org/show_bug.cgi?id=163892

Patch by Aidan Holm <aidanholm+web...@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:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (214214 => 214215)


--- 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)
@@ -1,3 +1,51 @@
+2017-03-21  Aidan Holm  <aidanholm+web...@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:
+
 2017-03-20  Alex Christensen  <achristen...@webkit.org>
 
         WebPageProxy DecidePolicyForNavigationAction and DecidePolicyForResponseSync should be Delayed reply messages

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (214214 => 214215)


--- 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)
@@ -359,6 +359,8 @@
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp
+    WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp
+    WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp
     WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp
@@ -604,6 +606,8 @@
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h
@@ -715,6 +719,8 @@
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp (0 => 214215)


--- 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)
@@ -0,0 +1,243 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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();
+}

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h (0 => 214215)


--- 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)
@@ -0,0 +1,131 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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 */

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp (0 => 214215)


--- 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)
@@ -0,0 +1,148 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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();
+}

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h (0 => 214215)


--- 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)
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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 */

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectListPrivate.h (0 => 214215)


--- 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)
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectPrivate.h (0 => 214215)


--- 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)
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 2017 Aidan Holm <aidanh...@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

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp (214214 => 214215)


--- 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)
@@ -22,6 +22,8 @@
 
 #include <WebCore/CSSImportRule.h>
 #include "DOMObjectCache.h"
+#include <WebCore/ClientRect.h>
+#include <WebCore/ClientRectList.h>
 #include <WebCore/Document.h>
 #include <WebCore/ExceptionCode.h>
 #include <WebCore/ExceptionCodeDescription.h>
@@ -30,6 +32,8 @@
 #include <WebCore/JSMainThreadExecState.h>
 #include "WebKitDOMAttrPrivate.h"
 #include "WebKitDOMCSSStyleDeclarationPrivate.h"
+#include "WebKitDOMClientRectListPrivate.h"
+#include "WebKitDOMClientRectPrivate.h"
 #include "WebKitDOMDOMTokenListPrivate.h"
 #include "WebKitDOMElementPrivate.h"
 #include "WebKitDOMEventPrivate.h"
@@ -1221,6 +1225,24 @@
     return result;
 }
 
+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());
+}
+
 WebKitDOMElement* webkit_dom_element_get_offset_parent(WebKitDOMElement* self)
 {
     WebCore::JSMainThreadNullState state;

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h (214214 => 214215)


--- 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)
@@ -516,6 +516,34 @@
 webkit_dom_element_get_scroll_height(WebKitDOMElement* self);
 
 /**
+ * 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);
+
+/**
  * webkit_dom_element_get_offset_parent:
  * @self: A #WebKitDOMElement
  *

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt (214214 => 214215)


--- 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)
@@ -647,6 +647,8 @@
 webkit_dom_element_set_scroll_top
 webkit_dom_element_get_scroll_width
 webkit_dom_element_get_scroll_height
+webkit_dom_element_get_bounding_client_rect
+webkit_dom_element_get_client_rects
 webkit_dom_element_get_offset_parent
 webkit_dom_element_get_inner_html
 webkit_dom_element_set_inner_html
@@ -3201,3 +3203,48 @@
 WEBKIT_DEPRECATED_FOR
 </SECTION>
 
+<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>

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdom.h (214214 => 214215)


--- 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)
@@ -30,6 +30,8 @@
 #include <webkitdom/WebKitDOMCSSStyleSheet.h>
 #include <webkitdom/WebKitDOMCSSValue.h>
 #include <webkitdom/WebKitDOMCharacterData.h>
+#include <webkitdom/WebKitDOMClientRect.h>
+#include <webkitdom/WebKitDOMClientRectList.h>
 #include <webkitdom/WebKitDOMComment.h>
 #include <webkitdom/WebKitDOMCustom.h>
 #include <webkitdom/WebKitDOMDOMImplementation.h>

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomautocleanups.h (214214 => 214215)


--- 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)
@@ -33,6 +33,8 @@
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCSSStyleSheet, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCSSValue, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMCharacterData, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMClientRect, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMClientRectList, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMComment, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMDOMImplementation, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOMDOMWindow, g_object_unref)

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/webkitdomdefines.h (214214 => 214215)


--- 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)
@@ -64,6 +64,12 @@
 typedef struct _WebKitDOMCharacterData WebKitDOMCharacterData;
 typedef struct _WebKitDOMCharacterDataClass WebKitDOMCharacterDataClass;
 
+typedef struct _WebKitDOMClientRect WebKitDOMClientRect;
+typedef struct _WebKitDOMClientRectClass WebKitDOMClientRectClass;
+
+typedef struct _WebKitDOMClientRectList WebKitDOMClientRectList;
+typedef struct _WebKitDOMClientRectListClass WebKitDOMClientRectListClass;
+
 typedef struct _WebKitDOMComment WebKitDOMComment;
 typedef struct _WebKitDOMCommentClass WebKitDOMCommentClass;
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (214214 => 214215)


--- 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)
@@ -93,7 +93,7 @@
 endmacro()
 
 ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
-ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest AutocleanupsTest.cpp DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.cpp)
+ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest AutocleanupsTest.cpp DOMClientRectTest.cpp DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.cpp)
 
 ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
 ADD_WK2_TEST(TestAuthentication TestAuthentication.cpp)
@@ -101,6 +101,7 @@
 ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
 ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
 ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
+ADD_WK2_TEST(TestDOMClientRect TestDOMClientRect.cpp)
 ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
 ADD_WK2_TEST(TestDOMNodeFilter TestDOMNodeFilter.cpp)
 ADD_WK2_TEST(TestDOMXPathNSResolver TestDOMXPathNSResolver.cpp)

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMClientRectTest.cpp (0 => 214215)


--- 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)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 Aidan Holm <aidanh...@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");
+}

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMClientRect.cpp (0 => 214215)


--- 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)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 Aidan Holm <aidanh...@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()
+{
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to