Fixes issue #579: DOM getAbsolute*() methods behave differently
across browsers.
http://code.google.com/p/google-web-toolkit/issues/detail?id=579
Makes a logical change to getAbsoluteLeft and getAbsoluteTop to
not take into account the body's scroll offset when the element
in question is the child of a top level absolutely positioned
element.
Reviewed by: jgw
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.3@286 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/impl/DOMImplSafari.java b/user/src/com/google/gwt/user/client/impl/DOMImplSafari.java
index a754120..c32e2ee 100644
--- a/user/src/com/google/gwt/user/client/impl/DOMImplSafari.java
+++ b/user/src/com/google/gwt/user/client/impl/DOMImplSafari.java
@@ -31,8 +31,10 @@
// body's offset position already.
var parent = elem.offsetParent;
if (parent && (parent.tagName == 'BODY') &&
- (elem.style.position == 'absolute'))
- break;
+ (elem.style.position == 'absolute')) {
+ return left;
+ }
+
elem = parent;
}
return left + $doc.body.scrollLeft;
@@ -47,8 +49,10 @@
// body's offset position already.
var parent = elem.offsetParent;
if (parent && (parent.tagName == 'BODY') &&
- (elem.style.position == 'absolute'))
- break;
+ (elem.style.position == 'absolute')) {
+ return top;
+ }
+
elem = parent;
}
return top + $doc.body.scrollTop;