Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js b/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| index 54800d471f4d22ba8fafd586a48a8bbd6c5e3fdf..f2fa63264e8bb225006065a2219a4ea7859b0e25 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| @@ -1,3 +1,36 @@ |
| +// TODO(yuzus): These two functions below need cleaning up. |
|
hayato
2016/03/08 04:36:46
Could you clarify that these functions are copied
yuzuchan
2016/03/08 06:48:07
Done.
|
| +function getOrCreateTestElement(id, tagName) |
| +{ |
| + var element = document.getElementById(id); |
| + if (element) |
| + return element; |
| + |
| + element = document.createElement(tagName); |
| + element.id = id; |
| + var refNode; |
| + var parent = document.body || document.documentElement; |
| + if (id == "description") |
| + refNode = getOrCreateTestElement("console", "div"); |
| + else |
| + refNode = parent.firstChild; |
| + |
| + parent.insertBefore(element, refNode); |
| + return element; |
| +} |
| + |
| +function debug(msg) |
| +{ |
| + if (self._lazyTestResults) { |
| + self._lazyTestResults.push(msg); |
| + } else { |
| + var span = document.createElement("span"); |
| + // insert it first so XHTML knows the namespace; |
| + getOrCreateTestElement("console", "div").appendChild(span); |
| + span.innerHTML = msg + '<br />'; |
| + }; |
| +} |
| + |
| + |
| function createShadowRoot() |
| { |
| var children = Array.prototype.slice.call(arguments); |
| @@ -227,6 +260,7 @@ function shouldNavigateFocus(from, to, direction) |
| debug('PASS'); |
| else |
| debug('FAIL'); |
| + return isInnermostActiveElement(to); |
| } |
| function navigateFocusForward() |