Modified: trunk/LayoutTests/fast/dom/shadow/access-key.html (109190 => 109191)
--- trunk/LayoutTests/fast/dom/shadow/access-key.html 2012-02-29 06:06:55 UTC (rev 109190)
+++ trunk/LayoutTests/fast/dom/shadow/access-key.html 2012-02-29 06:09:22 UTC (rev 109191)
@@ -55,16 +55,18 @@
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',
@@ -80,7 +82,7 @@
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.
Modified: trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html (109190 => 109191)
--- trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html 2012-02-29 06:06:55 UTC (rev 109190)
+++ trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html 2012-02-29 06:09:22 UTC (rev 109191)
@@ -22,10 +22,12 @@
function prepareDomTree(parent)
{
parent.appendChild(
- createShadow('div', {'id': 'divA'},
- createDom('input', {'id': 'inputB'}),
- createShadow('div', {'id': 'divC'},
- createDom('input', {'id': 'inputD'}))));
+ createDOM('div', {'id': 'divA'},
+ createShadowRoot(
+ createDOM('input', {'id': 'inputB'}),
+ createDOM('div', {'id': 'divC'},
+ createShadowRoot(
+ createDOM('input', {'id': 'inputD'}))))));
}
function test()
Modified: trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js (109190 => 109191)
--- trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js 2012-02-29 06:06:55 UTC (rev 109190)
+++ trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js 2012-02-29 06:09:22 UTC (rev 109191)
@@ -1,24 +1,28 @@
-// This function can take optional child elements as arguments[2:].
-function createShadow(tagName, attributes)
+function createShadowRoot()
{
- var element = document.createElement(tagName);
- for (var name in attributes)
- element.setAttribute(name, attributes[name]);
- var shadow = internals.ensureShadowRoot(element);
- var childElements = Array.prototype.slice.call(arguments, 2);
- for (var i = 0; i < childElements.length; ++i)
- shadow.appendChild(childElements[i]);
- return element;
+ return {'isShadowRoot': true,
+ 'children': Array.prototype.slice.call(arguments)};
}
-// This function can take optional child elements as arguments[2:].
-function createDom(tagName, attributes)
+// This function can take optional child elements, which might be a result of createShadowRoot(), as arguments[2:].
+function createDOM(tagName, attributes)
{
var element = document.createElement(tagName);
for (var name in attributes)
element.setAttribute(name, attributes[name]);
var childElements = Array.prototype.slice.call(arguments, 2);
- for (var i = 0; i < childElements.length; ++i)
- element.appendChild(childElements[i]);
+ for (var i = 0; i < childElements.length; ++i) {
+ var child = childElements[i];
+ if (child.isShadowRoot) {
+ var shadowRoot;
+ if (window.WebKitShadowRoot)
+ shadowRoot = new WebKitShadowRoot(element);
+ else
+ shadowRoot = new internals.ensureShadowRoot(element);
+ for (var j = 0; j < child.children.length; ++j)
+ shadowRoot.appendChild(child.children[j]);
+ } else
+ element.appendChild(child);
+ }
return element;
}
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html (109190 => 109191)
--- trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html 2012-02-29 06:06:55 UTC (rev 109190)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html 2012-02-29 06:09:22 UTC (rev 109191)
@@ -75,21 +75,25 @@
return element;
}
-function prepareDomTree(parent)
+function prepareDOMTree(parent)
{
parent.appendChild(
- createDom('div', {'id': 'divA', 'style': 'padding-top: 40px'},
- createDom('div', {'id': 'divB', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
- createDom('div', {'id': 'divC', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
- createShadow('div', {'id': 'shadowD', 'style': 'padding-top: 40px'},
- createDom('div', {'id': 'divE', 'style': 'padding-top: 40px'},
- createShadow('div', {'id': 'shadowF', 'style': 'padding-top: 40px'},
- createShadow('div', {'id': 'shadowG', 'style': 'padding-top: 40px'},
- createDom('div', {'id': 'divH', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
- createDom('div', {'id': 'divI', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))),
- createDom('div', {'id': 'divJ', 'style': 'padding-top: 40px'},
- createShadow('div', {'id': 'shadowK', 'style': 'padding-top: 40px'},
- createDom('div', {'id': 'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0}))))));
+ createDOM('div', {'id': 'divA', 'style': 'padding-top: 40px'},
+ createDOM('div', {'id': 'divB', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
+ createDOM('div', {'id': 'divC', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
+ createDOM('div', {'id': 'shadowD', 'style': 'padding-top: 40px'},
+ createShadowRoot(
+ createDOM('div', {'id': 'divE', 'style': 'padding-top: 40px'},
+ createDOM('div', {'id': 'shadowF', 'style': 'padding-top: 40px'},
+ createShadowRoot(
+ createDOM('div', {'id': 'shadowG', 'style': 'padding-top: 40px'},
+ createShadowRoot(
+ createDOM('div', {'id': 'divH', 'style': 'width: 40px; height: 40px', 'tabindex': 0}),
+ createDOM('div', {'id': 'divI', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))),
+ createDOM('div', {'id': 'divJ', 'style': 'padding-top: 40px'},
+ createDOM('div', {'id': 'shadowK', 'style': 'padding-top: 40px'},
+ createShadowRoot(
+ createDOM('div', {'id': 'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0}))))))));
var ids = ['divA', 'divB', 'divC',
'shadowD', 'shadowD/divE', 'shadowD/shadowF', 'shadowD/shadowF/shadowG',
@@ -126,7 +130,7 @@
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
- prepareDomTree(document.getElementById('sandbox'));
+ prepareDOMTree(document.getElementById('sandbox'));
// Test for mouseover/mouseout events.
moveMouse('divB', 'divC',