Skip to content

Commit

Permalink
patch from khiraly for getboundingclientrect off-by-one bug
Browse files Browse the repository at this point in the history
git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@569 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information
lkcl committed Apr 30, 2009
1 parent 685fce9 commit 4fe00ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changes made to Pyjamas since 0.5p1
-----------------------------------

* Fixed getBoundingClientRect off-by-one bug (firefox 3 returns an
inaccurate float, not an int) thanks to khiraly

* Added ToggleButton, PushButton and CustomButton (thanks to khiraly)

* Added means to return and call functions from another function call
Expand Down
8 changes: 6 additions & 2 deletions library/pyjamas/platform/DOMMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def getAbsoluteLeft(elem):
JS("""
try {
// Firefox 3 expects getBoundingClientRect
var left = elem.getBoundingClientRect().left;
// getBoundingClientRect can be float: 73.1 instead of 74, see
// gwt's workaround at user/src/com/google/gwt/dom/client/DOMImplMozilla.java:47
// Please note, their implementation has 1px offset.
var left = Math.ceil(elem.getBoundingClientRect().left);
} catch (e) {
var left = $doc.getBoxObjectFor(elem).x;
}
Expand Down Expand Up @@ -91,7 +95,7 @@ def getAbsoluteTop(elem):
JS("""
try {
// Firefox 3 expects getBoundingClientRect
var top = elem.getBoundingClientRect().top;
var top = Math.ceil(elem.getBoundingClientRect().top);
} catch (e) {
var top = $doc.getBoxObjectFor(elem).y;
}
Expand Down

0 comments on commit 4fe00ee

Please sign in to comment.