https://bugs.webkit.org/show_bug.cgi?id=89177
Reviewed by Dimitri Glazkov.
Source/WebCore:
Prevents ComposedShadowTreeWalker from escaping out of an
insertion point (which has distributed nodes) from a non-used
fallback element in the insertion point. Such a fallback element
should be treated as in an orphaned subtree.
ComposedShadowTreeParentWalker will be also fixed in a follow-up patch.
Test: fast/dom/shadow/composed-shadow-tree-walker.html
* dom/ComposedShadowTreeWalker.cpp:
(WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
LayoutTests:
* fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
* fast/dom/shadow/composed-shadow-tree-walker.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121481
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-28 Hayato Ito <hayato@chromium.org>
+
+ CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of InsertionPoint::isActive().
+ https://bugs.webkit.org/show_bug.cgi?id=89177
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
+ * fast/dom/shadow/composed-shadow-tree-walker.html:
+
2012-06-28 Gregg Tavares <gman@google.com>
Add support for DEPTH_STENCIL to WEBGL_depth_texture
DIV id=b
DIV id=a
-Fallback elements should not be used if element selects any elements.
+Fallback elements should not be used if a content element selects an element.
Composed Shadow Tree:
DIV id=a
DIV id=b
DIV id=b
DIV id=a
+Test for traversal, starting with a fallback element which is not used.
+Composed Shadow Tree:
+DIV id=f1
+ DIV id=f2
+
+Traverse in forward.
+DIV id=f1
+DIV id=f2
+Traverse in backward.
+DIV id=f2
+DIV id=f1
+
+Next node of [DIV id=f1] is [DIV id=f2]
+Next node of [DIV id=f2] is [(null)]
+
Test for Nested ShadowRoots.
Composed Shadow Tree:
DIV id=a
function dumpNode(node)
{
+ if (!node)
+ return '(null)'
var output = node.nodeName + "\t";
if (node.id)
output += ' id=' + node.id;
debug('');
}
+function showNextNode(node) {
+ var next = internals.nextNodeByWalker(node);
+ debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']');
+}
+
function testComposedShadowTree(node)
{
var sandbox = document.getElementById('sandbox');
createDOM('div', {'id': 'f2'}))),
createDOM('div', {'id': 'c'})));
-debug('Fallback elements should not be used if <content> element selects any elements.');
+debug('Fallback elements should not be used if a content element selects an element.');
testComposedShadowTree(
createDOM('div', {'id': 'a'},
createShadowRoot(createDOM('div', {'id': 'b'}),
createDOM('content', {'select': '#c'},
- createDOM('div', {'id': 'f1'}),
- createDOM('div', {'id': 'f2'}))),
+ createDOM('div', {'id': 'f1'},
+ createDOM('div', {'id': 'f2'})))),
createDOM('div', {'id': 'c'})));
+debug('Test for traversal, starting with a fallback element which is not used.');
+showComposedShadowTree(getNodeInShadowTreeStack('a/f1'));
+showNextNode(getNodeInShadowTreeStack('a/f1'));
+showNextNode(getNodeInShadowTreeStack('a/f2'));
+debug('');
+
debug('Test for Nested ShadowRoots.');
testComposedShadowTree(
createDOM('div', {'id': 'a'},
+2012-06-28 Hayato Ito <hayato@chromium.org>
+
+ CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of InsertionPoint::isActive().
+ https://bugs.webkit.org/show_bug.cgi?id=89177
+
+ Reviewed by Dimitri Glazkov.
+
+ Prevents ComposedShadowTreeWalker from escaping out of an
+ insertion point (which has distributed nodes) from a non-used
+ fallback element in the insertion point. Such a fallback element
+ should be treated as in an orphaned subtree.
+
+ ComposedShadowTreeParentWalker will be also fixed in a follow-up patch.
+
+ Test: fast/dom/shadow/composed-shadow-tree-walker.html
+
+ * dom/ComposedShadowTreeWalker.cpp:
+ (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
+
2012-06-27 Ryosuke Niwa <rniwa@webkit.org>
Cleanup HTMLFormCollection
Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node) const
{
ASSERT(node);
- if (isActiveInsertionPoint(node))
- return traverseParent(node);
- return const_cast<Node*>(node);
+ if (!isInsertionPoint(node))
+ return const_cast<Node*>(node);
+ const InsertionPoint* insertionPoint = toInsertionPoint(node);
+ return insertionPoint->hasDistribution() ? 0 :
+ insertionPoint->isActive() ? traverseParent(node) : const_cast<Node*>(node);
}
void ComposedShadowTreeWalker::parent()