From 7d2b954422b5d23e4869f379a2bf55d06d07f8be Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Sat, 23 Jun 2007 07:39:05 +0000 Subject: [PATCH] Fix offsetLeft/Top regression for rel.pos. elements with a table(cell) offset parent. b=384419 r+sr=roc git-svn-id: svn://10.0.0.236/trunk@228622 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsGenericHTMLElement.cpp | 9 ++- mozilla/content/html/content/test/Makefile.in | 1 + .../html/content/test/test_bug384419.html | 57 +++++++++++++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 mozilla/content/html/content/test/test_bug384419.html 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 + + +