Bug 717819 - Remove the special casing of getting the offset parent for children of tables now that bug 10209 has been fixed; r=bzbarsky

This commit is contained in:
Ehsan Akhgari 2012-01-13 13:44:06 -05:00
parent 74f49bd9e3
commit c2e2c79b82
4 changed files with 41 additions and 3 deletions

View File

@ -503,7 +503,8 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
nsIFrame* parent = frame->GetParent();
nsPoint origin(0, 0);
if (parent && parent->GetType() == nsGkAtoms::tableOuterFrame) {
if (parent && parent->GetType() == nsGkAtoms::tableOuterFrame &&
frame->GetType() == nsGkAtoms::tableFrame) {
origin = parent->GetPositionIgnoringScrolling();
parent = parent->GetParent();
}

View File

@ -282,6 +282,7 @@ _TEST_FILES = \
test_bug677658.html \
test_bug677463.html \
test_bug682886.html \
test_bug717819.html \
file_fullscreen-api.html \
file_fullscreen-api-keys.html \
test_fullscreen-api.html \

View File

@ -76,8 +76,7 @@ function run_test() {
t3('span9' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,24,24],'table9');
t3('tr9' ,[0,0,24,24],[15,15,24,24],[0,0,24,22],'table9');
// t3('span10' ,[0,0,20,20],[3,30,20,20],[0,0,20,20],'table9');
t3('span10' ,[0,0,20,20],[27,450,20,20],[0,0,20,20],'body'); // bug: 'body' should be 'table9'
t3('span10' ,[0,0,20,20],[17,43,20,20],[0,0,20,20],'table9');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,54,50],'body');
t3('div9',[10,10,-1,0],[0,397,-1,20],[0,0,-1,70],'body');

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=717819
-->
<head>
<title>Test for Bug 717819</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717819">Mozilla Bug 717819</a>
<p id="display"></p>
<div id="content">
<table style="position: relative; top: 100px;">
<tr>
<td>
<div id="test" style="position: absolute; top: 50px;"></div>
</td>
</tr>
</table>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 717819 **/
var div = document.getElementById("test");
is(div.offsetTop, 50, "The offsetTop must be calculated correctly");
is(div.offsetParent, document.querySelector("table"),
"The offset should be calculated off of the correct parent");
</script>
</pre>
</body>
</html>