[epiphany] 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] web-extension: use proper number format for position dom properties
- Date: Tue, 16 Jun 2015 10:45:14 +0000 (UTC)
commit 8a3c7df10f653cd99c5325e37b5e9232ae191396
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 | 8 ++++----
3 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 730aa5b..0b76249 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -600,16 +600,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);
@@ -620,13 +621,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 2a75da8..6c7769c 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 c2cc9a5..6ff4853 100644
--- a/lib/ephy-web-dom-utils.h
+++ b/lib/ephy-web-dom-utils.h
@@ -44,12 +44,12 @@ 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);
char *ephy_web_dom_utils_get_selection_as_string (WebKitDOMDOMSelection *selection);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]