diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 5600256e2ca..21a7f9fe51c 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -581,7 +581,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent) // Add the parent's origin to our own to get to the // right coordinate system. - PRBool isOffsetParent = IsOffsetParent(parent); + const PRBool isOffsetParent = !isPositioned && IsOffsetParent(parent); if (!isAbsolutelyPositioned && !isOffsetParent) { origin += parent->GetPositionIgnoringScrolling(); } @@ -592,10 +592,9 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent) break; } - // If the tag of this frame is a offset parent tag and this - // element is *not* positioned, break here. Also break if we - // hit the body element. - if ((!isPositioned && isOffsetParent) || IsBody(content)) { + // Break if the ancestor frame type makes it suitable as offset parent + // and this element is *not* positioned or if we found the body element. + if (isOffsetParent || IsBody(content)) { *aOffsetParent = content; NS_ADDREF(*aOffsetParent); break; diff --git a/mozilla/content/html/content/test/Makefile.in b/mozilla/content/html/content/test/Makefile.in index e5c266b4dcb..fd6141e2dc8 100644 --- a/mozilla/content/html/content/test/Makefile.in +++ b/mozilla/content/html/content/test/Makefile.in @@ -75,6 +75,7 @@ _TEST_FILES = test_bug589.html \ test_bug372098.html \ test_bug375003-1.html \ test_bug375003-2.html \ + test_bug384419.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/mozilla/content/html/content/test/test_bug384419.html b/mozilla/content/html/content/test/test_bug384419.html new file mode 100644 index 00000000000..b6f4b1c5d39 --- /dev/null +++ b/mozilla/content/html/content/test/test_bug384419.html @@ -0,0 +1,57 @@ + + + + + + Test for bug 384419 + + + + + + + + + + + + + +
X
relative
+
X
absolute
+
X
fixed
+ + +
+
+
+ +bug 384419 + + +