[Pkg-mozext-commits] [wot] 09/226: #1 Popup positioning bug in gmail
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository wot.
commit edd35561449aea3f728e74dad25b48e4b7ad91cd
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Mon Feb 6 14:54:27 2012 +0200
#1 Popup positioning bug in gmail
---
content/config.js | 4 ++--
content/popup.js | 53 ++++++++++++++---------------------------------------
2 files changed, 16 insertions(+), 41 deletions(-)
diff --git a/content/config.js b/content/config.js
index 06b80d8..7cf6790 100644
--- a/content/config.js
+++ b/content/config.js
@@ -1,6 +1,6 @@
/*
config.js
- Copyright © 2005-2012 WOT Services Oy <info at mywot.com>
+ Copyright © 2005 - 2012 WOT Services Oy <info at mywot.com>
This file is part of WOT.
@@ -19,7 +19,7 @@
*/
const WOT_PLATFORM = "firefox";
-const WOT_VERSION = "20120205";
+const WOT_VERSION = "20120206";
/*
* Constants
diff --git a/content/popup.js b/content/popup.js
index 1a234b4..1de3fae 100644
--- a/content/popup.js
+++ b/content/popup.js
@@ -1,6 +1,6 @@
/*
popup.js
- Copyright © 2006, 2007, 2009 WOT Services Oy <info at mywot.com>
+ Copyright © 2006 - 2012 WOT Services Oy <info at mywot.com>
This file is part of WOT.
@@ -157,42 +157,6 @@ var wot_popup =
return false;
},
- elem_pos_x: function(elem)
- {
- var curtop = 0;
- try {
- if (elem.offsetParent) {
- while (elem.offsetParent) {
- curtop += elem.offsetLeft;
- elem = elem.offsetParent;
- }
- } else if (elem.x) {
- curtop += elem.x;
- }
- } catch (e) {
- dump("wot_popup.elem_pos_x: failed with " + e + "\n");
- }
- return curtop;
- },
-
- elem_pos_y: function(elem)
- {
- var curtop = 0;
- try {
- if (elem.offsetParent) {
- while (elem.offsetParent) {
- curtop += elem.offsetTop;
- elem = elem.offsetParent;
- }
- } else if (elem.y) {
- curtop += elem.y;
- }
- } catch (e) {
- dump("wot_popup.elem_pos_x: failed with " + e + "\n");
- }
- return curtop;
- },
-
loadlayer: function(content, layer, target)
{
try {
@@ -420,8 +384,19 @@ var wot_popup =
var vscroll = event.view.pageYOffset;
var hscroll = event.view.pageXOffset;
- var y = wot_popup.elem_pos_y(wot_popup.target);
- var x = wot_popup.elem_pos_x(wot_popup.target);
+ // more accurate way to calc position
+ // got from http://javascript.ru/ui/offset
+ var elem = wot_popup.target;
+ var box = elem.getBoundingClientRect();
+
+ var docElem = content.documentElement;
+ var body = content.body;
+ var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
+ var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
+ var clientTop = docElem.clientTop || body.clientTop || 0;
+ var clientLeft = docElem.clientLeft || body.clientLeft || 0;
+ var y = box.top + scrollTop - clientTop;
+ var x = box.left + scrollLeft - clientLeft;
var posy = wot_popup.offsety + y + wot_popup.target.offsetHeight;
var posx = wot_popup.offsetx + x + wot_popup.target.offsetWidth;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git
More information about the Pkg-mozext-commits
mailing list