1
+2
+3
+4
+7
+8
+9
+diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 3b60b7375477..fd349a83e7f2 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -379,8 +379,18 @@ static bool IsOffsetParent(nsIFrame* aFrame) { nsIAtom* frameType = aFrame->GetType(); - return (IS_TABLE_CELL(frameType) || - frameType == nsGkAtoms::tableFrame); + + if (IS_TABLE_CELL(frameType) || frameType == nsGkAtoms::tableFrame) { + // Per the IDL for Element, only td, th, and table are acceptable offsetParents + // apart from body or positioned elements; we need to check the content type as + // well as the frame type so we ignore anonymous tables created by an element + // with display: table-cell with no actual table + nsIContent* content = aFrame->GetContent(); + + return content->IsHTML(nsGkAtoms::table) || content->IsHTML(nsGkAtoms::td) + || content->IsHTML(nsGkAtoms::th); + } + return false; } Element* diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 4b3ad3e7fb58..ad67d2e9f68d 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -270,6 +270,7 @@ MOCHITEST_FILES = \ test_bug786564.html \ test_bug797113.html \ test_bug787134.html \ + test_bug803677.html \ test_iframe_sandbox_inheritance.html \ file_iframe_sandbox_a_if1.html \ file_iframe_sandbox_a_if2.html \ diff --git a/content/html/content/test/test_bug803677.html b/content/html/content/test/test_bug803677.html new file mode 100644 index 000000000000..fd754ba001bd --- /dev/null +++ b/content/html/content/test/test_bug803677.html @@ -0,0 +1,50 @@ + + + +
+ +1
+2
+3
+4
+7
+8
+9
++ ++ +