Changeset 109191 in webkit
- Timestamp:
- Feb 28, 2012 10:09:22 PM (12 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109187 r109191 1 2012-02-28 Hayato Ito <hayato@chromium.org> 2 3 [Shadow DOM] Make createDOM() function used in testing Shadow DOM more flexible. 4 https://bugs.webkit.org/show_bug.cgi?id=79745 5 6 Reviewed by Dimitri Glazkov. 7 8 Replaces createDom and createShadow function defined in 9 LayoutTests/fast/dom/shadow/create-dom.js with more flexible 10 one. Now we can represent a shadow host which has both light 11 children and ShadowRoots in one expression. 12 13 * fast/dom/shadow/access-key.html: 14 * fast/dom/shadow/get-element-by-id-in-shadow-root.html: 15 * fast/dom/shadow/resources/create-dom.js: 16 (createShadowRoot): 17 (createDOM): 18 * fast/dom/shadow/shadow-boundary-events.html: 19 1 20 2012-02-28 Kenichi Ishibashi <bashi@chromium.org> 2 21 -
trunk/LayoutTests/fast/dom/shadow/access-key.html
r98407 r109191 56 56 } 57 57 58 function prepareD omTree(parent)58 function prepareDOMTree(parent) 59 59 { 60 60 parent.appendChild( 61 createDom('div', {'id': 'divA'}, 62 createDom('input', {'id': 'inputB'}), 63 createShadow('div', {'id': 'shadowC', 'tabindex': 0}, 64 createDom('input', {'id': 'inputD'}), 65 createDom('input', {'id': 'inputE', 'accesskey': 'a'}), 66 createShadow('div', {'id': 'shadowF', 'tabindex': 0}, 67 createDom('input', {'id': 'inputG'}))))); 61 createDOM('div', {'id': 'divA'}, 62 createDOM('input', {'id': 'inputB'}), 63 createDOM('div', {'id': 'shadowC', 'tabindex': 0}, 64 createShadowRoot( 65 createDOM('input', {'id': 'inputD'}), 66 createDOM('input', {'id': 'inputE', 'accesskey': 'a'}), 67 createDOM('div', {'id': 'shadowF', 'tabindex': 0}, 68 createShadowRoot( 69 createDOM('input', {'id': 'inputG'}))))))); 68 70 69 71 var ids = ['inputB', … … 81 83 layoutTestController.dumpAsText(); 82 84 83 prepareD omTree(document.getElementById('sandbox'));85 prepareDOMTree(document.getElementById('sandbox')); 84 86 85 87 // Please see the discussion of https://bugs.webkit.org/show_bug.cgi?id=67096. -
trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html
r98407 r109191 23 23 { 24 24 parent.appendChild( 25 createShadow('div', {'id': 'divA'}, 26 createDom('input', {'id': 'inputB'}), 27 createShadow('div', {'id': 'divC'}, 28 createDom('input', {'id': 'inputD'})))); 25 createDOM('div', {'id': 'divA'}, 26 createShadowRoot( 27 createDOM('input', {'id': 'inputB'}), 28 createDOM('div', {'id': 'divC'}, 29 createShadowRoot( 30 createDOM('input', {'id': 'inputD'})))))); 29 31 } 30 32 -
trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js
r92124 r109191 1 // This function can take optional child elements as arguments[2:]. 2 function createShadow(tagName, attributes) 1 function createShadowRoot() 3 2 { 4 var element = document.createElement(tagName); 5 for (var name in attributes) 6 element.setAttribute(name, attributes[name]); 7 var shadow = internals.ensureShadowRoot(element); 8 var childElements = Array.prototype.slice.call(arguments, 2); 9 for (var i = 0; i < childElements.length; ++i) 10 shadow.appendChild(childElements[i]); 11 return element; 3 return {'isShadowRoot': true, 4 'children': Array.prototype.slice.call(arguments)}; 12 5 } 13 6 14 // This function can take optional child elements as arguments[2:].15 function createD om(tagName, attributes)7 // This function can take optional child elements, which might be a result of createShadowRoot(), as arguments[2:]. 8 function createDOM(tagName, attributes) 16 9 { 17 10 var element = document.createElement(tagName); … … 19 12 element.setAttribute(name, attributes[name]); 20 13 var childElements = Array.prototype.slice.call(arguments, 2); 21 for (var i = 0; i < childElements.length; ++i) 22 element.appendChild(childElements[i]); 14 for (var i = 0; i < childElements.length; ++i) { 15 var child = childElements[i]; 16 if (child.isShadowRoot) { 17 var shadowRoot; 18 if (window.WebKitShadowRoot) 19 shadowRoot = new WebKitShadowRoot(element); 20 else 21 shadowRoot = new internals.ensureShadowRoot(element); 22 for (var j = 0; j < child.children.length; ++j) 23 shadowRoot.appendChild(child.children[j]); 24 } else 25 element.appendChild(child); 26 } 23 27 return element; 24 28 } -
trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html
r108034 r109191 76 76 } 77 77 78 function prepareD omTree(parent)78 function prepareDOMTree(parent) 79 79 { 80 80 parent.appendChild( 81 createDom('div', {'id': 'divA', 'style': 'padding-top: 40px'}, 82 createDom('div', {'id': 'divB', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 83 createDom('div', {'id': 'divC', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 84 createShadow('div', {'id': 'shadowD', 'style': 'padding-top: 40px'}, 85 createDom('div', {'id': 'divE', 'style': 'padding-top: 40px'}, 86 createShadow('div', {'id': 'shadowF', 'style': 'padding-top: 40px'}, 87 createShadow('div', {'id': 'shadowG', 'style': 'padding-top: 40px'}, 88 createDom('div', {'id': 'divH', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 89 createDom('div', {'id': 'divI', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))), 90 createDom('div', {'id': 'divJ', 'style': 'padding-top: 40px'}, 91 createShadow('div', {'id': 'shadowK', 'style': 'padding-top: 40px'}, 92 createDom('div', {'id': 'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))); 81 createDOM('div', {'id': 'divA', 'style': 'padding-top: 40px'}, 82 createDOM('div', {'id': 'divB', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 83 createDOM('div', {'id': 'divC', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 84 createDOM('div', {'id': 'shadowD', 'style': 'padding-top: 40px'}, 85 createShadowRoot( 86 createDOM('div', {'id': 'divE', 'style': 'padding-top: 40px'}, 87 createDOM('div', {'id': 'shadowF', 'style': 'padding-top: 40px'}, 88 createShadowRoot( 89 createDOM('div', {'id': 'shadowG', 'style': 'padding-top: 40px'}, 90 createShadowRoot( 91 createDOM('div', {'id': 'divH', 'style': 'width: 40px; height: 40px', 'tabindex': 0}), 92 createDOM('div', {'id': 'divI', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))), 93 createDOM('div', {'id': 'divJ', 'style': 'padding-top: 40px'}, 94 createDOM('div', {'id': 'shadowK', 'style': 'padding-top: 40px'}, 95 createShadowRoot( 96 createDOM('div', {'id': 'divL', 'style': 'width: 40px; height: 40px', 'tabindex': 0})))))))); 93 97 94 98 var ids = ['divA', 'divB', 'divC', … … 127 131 if (window.layoutTestController) 128 132 layoutTestController.dumpAsText(); 129 prepareD omTree(document.getElementById('sandbox'));133 prepareDOMTree(document.getElementById('sandbox')); 130 134 131 135 // Test for mouseover/mouseout events.
Note: See TracChangeset
for help on using the changeset viewer.