[epiphany/gnome-3-16] web-extension: use proper number format for position dom properties
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-16] web-extension: use proper number format for position dom properties
- Date: Tue, 23 Jun 2015 13:06:12 +0000 (UTC)
commit 643b0da823577fc41ea00163b3fe30635db7886c
Author: Claudio Saavedra <csaavedra igalia com>
Date: Fri Jun 12 14:26:15 2015 +0300
web-extension: use proper number format for position dom properties
DOM bindings use double, not long. This fixes the form filler
popup not showing up. Use the proper DOM bindings API instead
of g_object_get() to avoid this happening again.
https://bugzilla.gnome.org/show_bug.cgi?id=750842
embed/web-extension/ephy-web-extension.c | 11 ++++++-----
lib/ephy-web-dom-utils.c | 26 +++++++++++---------------
lib/ephy-web-dom-utils.h | 9 +++++----
3 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index c101986..179bc5d 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -598,16 +598,17 @@ show_user_choices (WebKitDOMDocument *document,
GSList *iter;
GSList *auth_data_list;
gboolean username_node_ever_edited;
- long x, y;
- long input_width;
+ double x, y;
+ double input_width;
char *style_attribute;
char* username;
g_object_get (username_node,
"value", &username,
- "offset-width", &input_width,
NULL);
+ input_width = webkit_dom_element_get_offset_width (WEBKIT_DOM_ELEMENT (username_node));
+
main_div = webkit_dom_document_create_element (document, "div", NULL);
webkit_dom_element_set_attribute (main_div, "id", "ephy-user-choices-container", NULL);
@@ -618,13 +619,13 @@ show_user_choices (WebKitDOMDocument *document,
*/
style_attribute = g_strdup_printf ("position: absolute; z-index: 2147483647;"
"cursor: default;"
- "width: %ldpx;"
+ "width: %lfpx;"
"background-color: white;"
"box-shadow: 5px 5px 5px black;"
"border-top: 0;"
"border-radius: 8px;"
"-webkit-user-modify: read-only ! important;"
- "left: %ldpx; top: %ldpx;",
+ "left: %lfpx; top: %lfpx;",
input_width, x, y);
webkit_dom_element_set_attribute (main_div, "style", style_attribute, NULL);
diff --git a/lib/ephy-web-dom-utils.c b/lib/ephy-web-dom-utils.c
index 75c586c..785b1e3 100644
--- a/lib/ephy-web-dom-utils.c
+++ b/lib/ephy-web-dom-utils.c
@@ -442,18 +442,16 @@ ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *form,
**/
void
ephy_web_dom_utils_get_absolute_position_for_element (WebKitDOMElement *element,
- glong *x,
- glong *y)
+ double *x,
+ double *y)
{
WebKitDOMElement *parent;
- long offset_top, offset_left;
- long parent_x, parent_y;
+ double offset_top, offset_left;
+ double parent_x, parent_y;
- g_object_get (element,
- "offset-left", &offset_left,
- "offset-top", &offset_top,
- "offset-parent", &parent,
- NULL);
+ offset_top = webkit_dom_element_get_offset_top (element);
+ offset_left = webkit_dom_element_get_offset_left (element);
+ parent = webkit_dom_element_get_offset_parent (element);
*x = offset_left;
*y = offset_top;
@@ -479,16 +477,14 @@ ephy_web_dom_utils_get_absolute_position_for_element (WebKitDOMElement *element,
**/
void
ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element,
- long *x,
- long *y)
+ double *x,
+ double *y)
{
- long offset_height;
+ double offset_height;
ephy_web_dom_utils_get_absolute_position_for_element (element, x, y);
- g_object_get (element,
- "offset-height", &offset_height,
- NULL);
+ offset_height = webkit_dom_element_get_offset_height (element);
*y += offset_height;
}
diff --git a/lib/ephy-web-dom-utils.h b/lib/ephy-web-dom-utils.h
index caa8228..42c2e26 100644
--- a/lib/ephy-web-dom-utils.h
+++ b/lib/ephy-web-dom-utils.h
@@ -42,12 +42,13 @@ gboolean ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *f
WebKitDOMNode **password);
void ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element,
- long *x,
- long *y);
+ double *x,
+ double *y);
void ephy_web_dom_utils_get_absolute_position_for_element(WebKitDOMElement *element,
- long *x,
- long *y);
+ double *x,
+ double *y);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]