Index: LayoutTests/accessibility/scroll-to-make-visible-nested-2.html |
diff --git a/LayoutTests/accessibility/scroll-to-make-visible-nested-2.html b/LayoutTests/accessibility/scroll-to-make-visible-nested-2.html |
index be9c96a593abfcb0a41b6ee978720ccb77987eab..9f5c402621ba5d4560aba7ddc60f3863571fb567 100644 |
--- a/LayoutTests/accessibility/scroll-to-make-visible-nested-2.html |
+++ b/LayoutTests/accessibility/scroll-to-make-visible-nested-2.html |
@@ -8,7 +8,9 @@ |
<div id="container" style="width: 100px; overflow: scroll"> |
<div style="border: 1px solid #000; width: 1000px; height: 5000px;">5000-pixel box</div> |
- <button id="target">Target</button> |
+ <button id="target1">Target</button> |
+ <button id="target2">Target</button> |
+ <button id="target3">Target</button> |
<div style="border: 1px solid #000; width: 1000px; height: 5000px;">5000-pixel box</div> |
</div> |
@@ -19,11 +21,17 @@ description("Tests that scrolling to make an element visible works when the inne |
function runTest() { |
window.container = document.getElementById("container"); |
- window.target = document.getElementById("target"); |
+ window.target1 = document.getElementById("target1"); |
+ window.target2 = document.getElementById("target2"); |
+ window.target3 = document.getElementById("target3"); |
if (window.accessibilityController) { |
- target.focus(); |
- var targetAccessibleObject = accessibilityController.focusedElement; |
+ target1.focus(); |
+ var target1AccessibleObject = accessibilityController.focusedElement; |
+ target2.focus(); |
+ var target2AccessibleObject = accessibilityController.focusedElement; |
+ target3.focus(); |
+ var target3AccessibleObject = accessibilityController.focusedElement; |
} |
// Reset the initial scroll positions (since calling focus() can scroll the page too). |
@@ -31,15 +39,25 @@ function runTest() { |
container.scrollTop = 0; |
shouldBe("window.pageYOffset", "0"); |
shouldBe("container.scrollTop", "0"); |
- shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "5000"); |
+ shouldBeGreaterThanOrEqual("target1.getBoundingClientRect().top", "5000"); |
- // Scroll to make target visible. |
+ // Scroll to make the middle target visible. |
if (window.accessibilityController) |
- targetAccessibleObject.scrollToMakeVisible(); |
+ target2AccessibleObject.scrollToMakeVisible(); |
// Instead of testing the exact scroll offsets of the two containers, just test that |
// the new absolute position of the target is on-screen. |
- shouldBeGreaterThanOrEqual("window.innerHeight", "target.getBoundingClientRect().bottom"); |
+ shouldBeGreaterThanOrEqual("window.innerHeight", "target2.getBoundingClientRect().bottom"); |
+ |
+ // Make sure that calling scrollToMakeVisible on target1 and target3 don't result in any |
+ // scrolling, because they should already be within the viewport. |
+ window.target2top = target2.getBoundingClientRect().top; |
+ if (window.accessibilityController) |
+ target1AccessibleObject.scrollToMakeVisible(); |
+ shouldBe("target2top", "target2.getBoundingClientRect().top"); |
+ if (window.accessibilityController) |
+ target3AccessibleObject.scrollToMakeVisible(); |
+ shouldBe("target2top", "target2.getBoundingClientRect().top"); |
finishJSTest(); |
} |