diff options
author | Gustavo Noronha Silva <gns@gnome.org> | 2013-06-10 06:43:54 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2013-08-28 07:29:02 +0800 |
commit | 1d8b0fec9dd1e0aa14baa66745617892ed3cd976 (patch) | |
tree | cf6b621b8f7d1c77710202417ef1f6342fa3a55c /lib | |
parent | 87c3c84bc9803944a75bbd20391b82b677df52f5 (diff) | |
download | gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar.gz gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar.bz2 gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar.lz gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar.xz gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.tar.zst gsoc2013-epiphany-1d8b0fec9dd1e0aa14baa66745617892ed3cd976.zip |
Show a box with a list of available users for a login form
If the login input is clicked, or focused the list of available
users is shown, and one can be chosen by clicking or using the
arrow keys.
https://bugzilla.gnome.org/show_bug.cgi?id=675060
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-web-dom-utils.c | 62 | ||||
-rw-r--r-- | lib/ephy-web-dom-utils.h | 7 |
2 files changed, 69 insertions, 0 deletions
diff --git a/lib/ephy-web-dom-utils.c b/lib/ephy-web-dom-utils.c index 1224c5621..acf0fd23d 100644 --- a/lib/ephy-web-dom-utils.c +++ b/lib/ephy-web-dom-utils.c @@ -414,3 +414,65 @@ ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *form, return FALSE; } + +/** + * ephy_web_dom_utils_get_absolute_position_for_element: + * @element: the #WebKitDOMElement. + * @x: return address for the x coordinate. + * @y: return address for the y coordinate. + * + * Obtains the coordinate for the top-left of the #WebKitDOMElement, relative + * to the origin of the page. + **/ +void +ephy_web_dom_utils_get_absolute_position_for_element (WebKitDOMElement *element, + glong *x, + glong *y) +{ + WebKitDOMElement *parent; + long offset_top, offset_left; + long parent_x, parent_y; + + g_object_get (element, + "offset-left", &offset_left, + "offset-top", &offset_top, + "offset-parent", &parent, + NULL); + + *x = offset_left; + *y = offset_top; + + if (!parent) + return; + + /* If there's a parent, we keep going. */ + ephy_web_dom_utils_get_absolute_position_for_element (parent, &parent_x, &parent_y); + + *x += parent_x; + *y += parent_y; +} + +/** + * ephy_web_dom_utils_get_absolute_bottom_for_element: + * @element: the #WebKitDOMElement. + * @x: return address for the x coordinate. + * @y: return address for the y coordinate. + * + * Obtains the coordinate for the bottom-left of the #WebKitDOMElement, relative + * to the origin of the page. + **/ +void +ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element, + long *x, + long *y) +{ + long offset_height; + + ephy_web_dom_utils_get_absolute_position_for_element (element, x, y); + + g_object_get (element, + "offset-height", &offset_height, + NULL); + + *y += offset_height; +} diff --git a/lib/ephy-web-dom-utils.h b/lib/ephy-web-dom-utils.h index aa052d26e..caa822813 100644 --- a/lib/ephy-web-dom-utils.h +++ b/lib/ephy-web-dom-utils.h @@ -41,6 +41,13 @@ gboolean ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *f WebKitDOMNode **username, WebKitDOMNode **password); +void ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element, + long *x, + long *y); + +void ephy_web_dom_utils_get_absolute_position_for_element(WebKitDOMElement *element, + long *x, + long *y); G_END_DECLS #endif |