From: hayato@chromium.org Date: Thu, 28 Jun 2012 23:05:59 +0000 (+0000) Subject: CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of... X-Git-Tag: 070512121124~408 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e19c44e856a5880a7216ec220b365ed69cce0c3;p=profile%2Fivi%2Fwebkit-efl.git CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of InsertionPoint::isActive(). 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 --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 2184252..edaccc8 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2012-06-28 Hayato Ito + + 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 Add support for DEPTH_STENCIL to WEBGL_depth_texture diff --git a/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt b/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt index b5fe9e5..5fe303a 100644 --- a/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt +++ b/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt @@ -87,7 +87,7 @@ DIV id=f1 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 @@ -102,6 +102,21 @@ DIV id=c 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 diff --git a/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html b/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html index 3e035eb..44a32fd 100644 --- a/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html +++ b/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html @@ -15,6 +15,8 @@ if (window.testRunner) function dumpNode(node) { + if (!node) + return '(null)' var output = node.nodeName + "\t"; if (node.id) output += ' id=' + node.id; @@ -78,6 +80,11 @@ function showComposedShadowTree(node) 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'); @@ -129,15 +136,21 @@ testComposedShadowTree( createDOM('div', {'id': 'f2'}))), createDOM('div', {'id': 'c'}))); -debug('Fallback elements should not be used if 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'}, diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 2fac9f3..96bab0a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2012-06-28 Hayato Ito + + 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 Cleanup HTMLFormCollection diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index a48345a..7faaf8a 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -188,9 +188,11 @@ Node* ComposedShadowTreeWalker::escapeFallbackContentElement(const Node* node, T Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node) const { ASSERT(node); - if (isActiveInsertionPoint(node)) - return traverseParent(node); - return const_cast(node); + if (!isInsertionPoint(node)) + return const_cast(node); + const InsertionPoint* insertionPoint = toInsertionPoint(node); + return insertionPoint->hasDistribution() ? 0 : + insertionPoint->isActive() ? traverseParent(node) : const_cast(node); } void ComposedShadowTreeWalker::parent()