blob: eb75b5c608e02f18312102ed2989ac4749bb0ce9 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style>
input {
background-color: white;
}
:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown) {
background-color: rgb(1, 2, 3);
}
</style>
</head>
<body>
<div style="display:none">
<!-- 20 empty -->
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input id="target1" type="text" placeholder="WebKit" class="placeholder-not-shown" value="Not Shown!">
<!-- 19 empty -->
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input id="target2" type="text" placeholder="WebKit" class="placeholder-not-shown" value="Not Shown!">
<!-- 19 empty -->
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input type="text" placeholder="WebKit" class="placeholder-shown">
<input id="target3" type="text" placeholder="WebKit" class="placeholder-not-shown" value="Not Shown!">
</div>
</body>
<script>
description('Test backtracking of a long chain of :placeholder-shown siblings to catch any issue with register allocation.');
shouldBe('document.querySelectorAll(":placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)").length', '3');
shouldBe('document.querySelectorAll(":placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)")[0]', 'document.getElementById("target1")');
shouldBe('document.querySelectorAll(":placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)")[1]', 'document.getElementById("target2")');
shouldBe('document.querySelectorAll(":placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)")[2]', 'document.getElementById("target3")');
shouldBe('document.querySelectorAll("input").length', '61')
var allTestCases = document.querySelectorAll("input");
for (var i = 0; i < 61; ++i)
shouldBeEqualToString('getComputedStyle(document.querySelectorAll("input")[' + i + ']).backgroundColor', allTestCases[i].classList.contains('placeholder-shown') ? 'rgb(255, 255, 255)' : 'rgb(1, 2, 3)');
</script>
<script src="../../resources/js-test-post.js"></script>
</html>