Rename getElementInShadowTreeStack to getNodeInShadowTreeStack
[WebKit-https.git] / LayoutTests / fast / dom / shadow / access-key.html
index 77ac73cb04284e3fb3b5f3711506cab70993a444..6c198bc791f8873f23d5b47043b1856efe1b1205 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <script src="../../js/resources/js-test-pre.js"></script>
-<script src="resources/create-dom.js"></script>
+<script src="resources/shadow-dom.js"></script>
 </head>
 <body>
 <p id="description"></p>
@@ -44,33 +44,24 @@ function recordEvent(event)
     eventRecords[eventType].push(event.target.id);
 }
 
-function getElementInShadow(path)
-{
-    var ids = path.split('/');
-    var element = document.getElementById(ids[0]);
-    for (var i = 1; element != null && i < ids.length; ++i) {
-        var shadowRoot = internals.shadowRoot(element);
-        element = internals.getElementByIdInShadowRoot(shadowRoot, ids[i]);
-    }
-    return element;
-}
-
-function prepareDomTree(parent)
+function prepareDOMTree(parent)
 {
     parent.appendChild(
-        createDom('div', {'id': 'divA'},
-                  createDom('input', {'id': 'inputB'}),
-                  createShadow('div', {'id': 'shadowC', 'tabindex': 0},
-                               createDom('input', {'id': 'inputD'}),
-                               createDom('input', {'id': 'inputE', 'accesskey': 'a'}),
-                               createShadow('div', {'id': 'shadowF', 'tabindex': 0},
-                                            createDom('input', {'id': 'inputG'})))));
+        createDOM('div', {'id': 'divA'},
+                  createDOM('input', {'id': 'inputB'}),
+                  createDOM('div', {'id': 'shadowC', 'tabindex': 0},
+                            createShadowRoot(
+                                createDOM('input', {'id': 'inputD'}),
+                                createDOM('input', {'id': 'inputE', 'accesskey': 'a'}),
+                                createDOM('div', {'id': 'shadowF', 'tabindex': 0},
+                                          createShadowRoot(
+                                              createDOM('input', {'id': 'inputG'})))))));
 
     var ids = ['inputB',
                'shadowC/inputD', 'shadowC/inputE',
                'shadowC/shadowF/inputG'];
     for (var i = 0; i < ids.length; ++i) {
-        var element = getElementInShadow(ids[i]);
+        var element = getNodeInShadowTreeStack(ids[i]);
         element.addEventListener('focus', recordEvent, false);
     }
 }
@@ -80,7 +71,7 @@ function test()
     if (window.layoutTestController)
         layoutTestController.dumpAsText();
 
-    prepareDomTree(document.getElementById('sandbox'));
+    prepareDOMTree(document.getElementById('sandbox'));
 
     // Please see the discussion of https://bugs.webkit.org/show_bug.cgi?id=67096.
     // We don't have a clear idea how accesskey should work in regard to shadow DOM.
@@ -91,12 +82,12 @@ function test()
     pressAccessKey('a');
     shouldBe('dispatchedEvent("focus")', '["inputE"]');
 
-    getElementInShadow('shadowC/inputD').focus();
+    getNodeInShadowTreeStack('shadowC/inputD').focus();
     clearEventRecords();
     pressAccessKey('a');
     shouldBe('dispatchedEvent("focus")', '["inputE"]');
 
-    getElementInShadow('shadowC/shadowF/inputG').focus();
+    getNodeInShadowTreeStack('shadowC/shadowF/inputG').focus();
     clearEventRecords();
     pressAccessKey('a');
     shouldBe('dispatchedEvent("focus")', '["inputE"]');