Bug 489127. Fix and reenable tests.

This commit is contained in:
Felipe Gomes 2010-05-13 12:56:10 +12:00
parent 220c34d2b2
commit 9023fab06f
2 changed files with 60 additions and 49 deletions

View File

@ -18,12 +18,12 @@
.getInterface(Components.interfaces.nsIDOMWindowUtils);
/*
nsIDOMNodeList nodesFromRect(in long aX,
in long aY,
in long aTopSize,
in long aRightSize,
in long aBottomSize,
in long aLeftSize,
nsIDOMNodeList nodesFromRect(in float aX,
in float aY,
in float aTopSize,
in float aRightSize,
in float aBottomSize,
in float aLeftSize,
in boolean aIgnoreRootScrollFrame,
in boolean aFlushLayout);
@ -64,6 +64,8 @@
e[a] = document.getElementById(a);
});
window.scrollTo(0, 0);
// Top, Right, Bottom, Left directions:
check(53, 71, 0, 0, 0, 0, []);
check(53, 71, 10, 0, 0, 0, [e.h1]);
@ -72,9 +74,6 @@
check(152, 105, 0, 0, 0, 10, [e.d1]);
check(152, 105, 10, 10, 10, 10, [e.p4, e.p3, e.d1]);
// Including text nodes:
check(53,71,30,30,30,30, [e.p3.firstChild, e.p3, e.d1.firstChild, e.h1.firstChild, e.d1, e.h1]);
// e.p1 is invisible and shouldn't appear:
check(153,193,0,0,0,0,[e.p5]);
check(153,193,0,20,0,20, [e.p5, e.d2]);
@ -97,33 +96,43 @@
check(39, 212, 10, 5, 30, 0, [e.span, e.d2, e.p2]);
check(39, 212, 10, 15, 30, 0, [e.p5, e.span, e.d2, e.p2]);
// Area with links and text nodes:
check(45, 343, 0,0, 17, 0, [e.a3.firstChild, e.a3, e.a1.firstChild, e.a1, e.p6]);
check(45, 343, 0,0, 0, 0, [e.a1.firstChild, e.a1, e.p6]);
check(45, 343, 0,25, 0, 0, [e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
check(45, 343, 0,35, 0, 0, [e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
check(45, 343, 0,35, 17, 0, [e.a3.firstChild, e.a3, e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
check(45, 343, 0,65, 17, 0, [e.a3.firstChild, e.a3, e.p6.childNodes[3], e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
// 2d transform:
check(61, 426, 0, 0, 0, 0, []);
check(61, 426, 0, 30, 0, 10, [e.transf]);
check(61, 426, 0, 30, 80, 10, [e.transf.firstChild, e.transf]);
// Decimal CSS pixels
check(18, 330, 0, 0, 0, 0, []);
check(18, 330, 0, 0.5, 0, 0, []);
check(18, 330, 0, 0, 0.5, 0, []);
check(18, 330, 0, 0.25, 0.5, 0, []);
check(18, 330, 0, 0.5, 0.5, 0, [e.decimal]);
check(144, 330.5, 0, 0, 0, 0, [e.decimal]);
check(144.5, 330.5, 0, 0, 0, 0, []);
check(144.5, 330.5, 0, 0, 0, 0.1, [e.decimal]);
// Elements inside iframe shouldn't be returned:
check(25, 536, 0, 30, 100, 0, [e.iframe1]);
check(15, 410, 0, 30, 50, 0, [e.iframe1]);
// Decimal CSS pixels
check(18, 726, 0, 0, 0, 0, []);
check(18, 726, 0, 0.5, 0, 0, []);
check(18, 726, 0, 0, 0.5, 0, []);
check(18, 726, 0, 0.25, 0.5, 0, []);
check(18, 726, 0, 0.5, 0.5, 0, [e.decimal]);
check(144, 726.5, 0, 0, 0, 0, [e.decimal]);
check(144.5, 726.5, 0, 0, 0, 0, []);
check(144.5, 726.5, 0, 0, 0, 0.1, [e.decimal]);
// Area with links and text nodes:
let [x1, y1] = getCenterFor(e.a1);
let [x2, y2] = getCenterFor(e.a2);
let [x3, y3] = getCenterFor(e.a3);
let [xt, yt] = [(x2 + x1) / 2, y1]; //text node between a1 and a2
check(x1, y1, 0, 0, 0, 0, [e.a1.firstChild, e.a1, e.p6]);
check(x1, y1, 0, 0, y3 - y1, 0, [e.a3.firstChild, e.a3, e.a1.firstChild, e.a1, e.p6]);
check(x1, y1, 0, xt - x1, 0, 0, [e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
check(x1, y1, 0, x2 - x1, 0, 0, [e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
check(x1, y1, 0, x2 - x1, y3 - y1, 0, [e.a3.firstChild, e.a3, e.a2.firstChild, e.a2, e.p6.childNodes[1], e.a1.firstChild, e.a1, e.p6]);
// 2d transform:
check(61, 671, 0, 0, 0, 0, []);
check(61, 671, 0, 30, 0, 10, [e.transf]);
check(61, 671, 0, 30, 90, 10, [e.transf.firstChild, e.transf]);
done();
}
function getCenterFor(element) {
let rect = element.getBoundingClientRect();
return [(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2];
}
addLoadEvent(doTest);
@ -149,54 +158,56 @@ span {
display: inline-block;
}
h1:hover, div:hover, p:hover, span:hover {
background-color: yellow;
#iframe1 {
height: 100px;
margin-top: 60px;
}
#p6, #iframe1 {
height: auto;
margin-top: 50px;
font-weight: bold;
#p6 {
height: 50px;
margin-top: 30px;
}
#transf {
margin-top: 3em;
margin-top: 60px;
-moz-transform: rotate(-45deg);
}
#decimal {
position: relative;
left: 0.5px;
top: 0.5px;
top: 50.5px;
}
</style>
</head>
<body id="body">
<h1 id="h1">h1</h1>
<div id="d1">div</div>
<h1 id="h1"></h1>
<div id="d1"></div>
<!-- floated element -->
<div id="d2" style="float: left"></div>
<!-- hidden element -->
<p id="p1" style="float: left; visibility: hidden"></p>
<p id="p2" style="clear: left"><span id="span"></span></p>
<!-- absolute position -->
<p id="p3" style="position:absolute; top: 10px; left:50px; height:50px;">p</p>
<p id="p3" style="position:absolute; top: 10px; left:50px; height:50px;"></p>
<!-- fixed position -->
<p id="p4" style="position: fixed; top: 30px; left: 150px; height: 50px; background-color: blue;"></p>
<!-- relative position -->
<p id="p5" style="position:relative; top: -100px; left: 30px; margin-bottom: -70px; background-color: green"></p>
<p id="p6"><a href="#" id="a1">Link</a> / <a href="#" id="a2">Link</a> / <a href="#" id="a3">Link</a></p>
<div id="transf">text</div>
<iframe id="iframe1" src="data:text/html,<div>div</div><p>p</p>"></iframe>
<!-- decimal CSS pixels -->
<div id="decimal"></div>
<iframe id="iframe1" src="data:text/html,<div>div</div><p>p</p>"></iframe>
<p id="p6"><a href="#" id="a1">A</a> / <a href="#" id="a2">A</a><br/><a href="#" id="a3">A</a></p>
<div id="transf">text</div>
</body>
</html>

View File

@ -58,7 +58,7 @@ _TEST_FILES = \
test_windowProperties.html \
test_clipboard_events.html \
test_focusrings.xul \
$(warning test_nodesFromRect.html temporarily disabled) \
test_nodesFromRect.html \
$(NULL)
libs:: $(_TEST_FILES)