diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
index 584094332df..5600256e2ca 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
@@ -522,15 +522,17 @@ IsBody(nsIContent *aContent)
aContent->IsNodeOfType(nsINode::eHTML));
}
-static PRBool
-IsOffsetParent(nsIContent *aContent)
-{
- nsINodeInfo *ni = aContent->NodeInfo();
+static PRBool IS_TABLE_CELL(nsIAtom* frameType) {
+ return nsGkAtoms::tableCellFrame == frameType ||
+ nsGkAtoms::bcTableCellFrame == frameType;
+}
- return ((ni->Equals(nsGkAtoms::td) ||
- ni->Equals(nsGkAtoms::table) ||
- ni->Equals(nsGkAtoms::th)) &&
- aContent->IsNodeOfType(nsINode::eHTML));
+static PRBool
+IsOffsetParent(nsIFrame* aFrame)
+{
+ nsIAtom* frameType = aFrame->GetType();
+ return (IS_TABLE_CELL(frameType) ||
+ frameType == nsGkAtoms::tableFrame);
}
void
@@ -579,7 +581,8 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
// Add the parent's origin to our own to get to the
// right coordinate system.
- if (!isAbsolutelyPositioned) {
+ PRBool isOffsetParent = IsOffsetParent(parent);
+ if (!isAbsolutelyPositioned && !isOffsetParent) {
origin += parent->GetPositionIgnoringScrolling();
}
@@ -592,7 +595,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
// 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(content)) || IsBody(content)) {
+ if ((!isPositioned && isOffsetParent) || IsBody(content)) {
*aOffsetParent = content;
NS_ADDREF(*aOffsetParent);
break;
@@ -1009,7 +1012,7 @@ nsGenericHTMLElement::GetClientAreaRect()
frame->IsFrameOfType(nsIFrame::eReplaced))) {
// Special case code to make client area work even when there isn't
// a scroll view, see bug 180552, bug 227567.
- return frame->GetPaddingRect();
+ return frame->GetPaddingRect() - frame->GetPositionIgnoringScrolling();
}
return nsRect(0, 0, 0, 0);
diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h
index 57435c00e86..c7fa8fc3d9e 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.h
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h
@@ -185,8 +185,10 @@ public:
nsIFrame **aFrame = nsnull);
/**
- * Get this element's client area rect in app units.
- * @return the frame's client area
+ * Get this element's client area dimensions in app units.
+ * The rect x, y, width, height are the clientLeft, clientTop, clientWidth,
+ * clientHeight values.
+ * @return the frame's client dimensions
*/
nsRect GetClientAreaRect();
diff --git a/mozilla/content/html/content/test/Makefile.in b/mozilla/content/html/content/test/Makefile.in
index 74ea7dc60e2..e5c266b4dcb 100644
--- a/mozilla/content/html/content/test/Makefile.in
+++ b/mozilla/content/html/content/test/Makefile.in
@@ -73,6 +73,8 @@ _TEST_FILES = test_bug589.html \
test_bug373589.html \
bug372098-link-target.html \
test_bug372098.html \
+ test_bug375003-1.html \
+ test_bug375003-2.html \
$(NULL)
libs:: $(_TEST_FILES)
diff --git a/mozilla/content/html/content/test/test_bug375003-1.html b/mozilla/content/html/content/test/test_bug375003-1.html
new file mode 100755
index 00000000000..850c0544443
--- /dev/null
+++ b/mozilla/content/html/content/test/test_bug375003-1.html
@@ -0,0 +1,157 @@
+
+
+
+
+
+ Test 1 for bug 375003
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Mozilla Bug 375003
+
+
+
+
+
+
+
diff --git a/mozilla/content/html/content/test/test_bug375003-2.html b/mozilla/content/html/content/test/test_bug375003-2.html
new file mode 100644
index 00000000000..2b88d056fee
--- /dev/null
+++ b/mozilla/content/html/content/test/test_bug375003-2.html
@@ -0,0 +1,108 @@
+
+
+
+
+
+ Test 2 for bug 375003
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file