Changeset 121481 in webkit


Ignore:
Timestamp:
Jun 28, 2012 4:05:59 PM (12 years ago)
Author:
hayato@chromium.org
Message:

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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121474 r121481  
     12012-06-28  Hayato Ito  <hayato@chromium.org>
     2
     3        CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of InsertionPoint::isActive().
     4        https://bugs.webkit.org/show_bug.cgi?id=89177
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        * fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
     9        * fast/dom/shadow/composed-shadow-tree-walker.html:
     10
    1112012-06-28  Gregg Tavares  <gman@google.com>
    212
  • trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt

    r119069 r121481  
    8888DIV      id=a
    8989
    90 Fallback elements should not be used if  element selects any elements.
    91 Composed Shadow Tree:
    92 DIV      id=a
    93         DIV      id=b
    94         DIV      id=c
    95 
    96 Traverse in forward.
    97 DIV      id=a
    98 DIV      id=b
    99 DIV      id=c
    100 Traverse in backward.
    101 DIV      id=c
    102 DIV      id=b
    103 DIV      id=a
     90Fallback elements should not be used if a content element selects an element.
     91Composed Shadow Tree:
     92DIV      id=a
     93        DIV      id=b
     94        DIV      id=c
     95
     96Traverse in forward.
     97DIV      id=a
     98DIV      id=b
     99DIV      id=c
     100Traverse in backward.
     101DIV      id=c
     102DIV      id=b
     103DIV      id=a
     104
     105Test for traversal, starting with a fallback element which is not used.
     106Composed Shadow Tree:
     107DIV      id=f1
     108        DIV      id=f2
     109
     110Traverse in forward.
     111DIV      id=f1
     112DIV      id=f2
     113Traverse in backward.
     114DIV      id=f2
     115DIV      id=f1
     116
     117Next node of [DIV        id=f1] is [DIV  id=f2]
     118Next node of [DIV        id=f2] is [(null)]
    104119
    105120Test for Nested ShadowRoots.
  • trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html

    r120792 r121481  
    1616function dumpNode(node)
    1717{
     18    if (!node)
     19        return '(null)'
    1820    var output = node.nodeName + "\t";
    1921    if (node.id)
     
    7981}
    8082
     83function showNextNode(node) {
     84    var next = internals.nextNodeByWalker(node);
     85    debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']');
     86}
     87
    8188function testComposedShadowTree(node)
    8289{
     
    130137              createDOM('div', {'id': 'c'})));
    131138
    132 debug('Fallback elements should not be used if <content> element selects any elements.');
     139debug('Fallback elements should not be used if a content element selects an element.');
    133140testComposedShadowTree(
    134141    createDOM('div', {'id': 'a'},
    135142              createShadowRoot(createDOM('div', {'id': 'b'}),
    136143                               createDOM('content', {'select': '#c'},
    137                                          createDOM('div', {'id': 'f1'}),
    138                                          createDOM('div', {'id': 'f2'}))),
     144                                         createDOM('div', {'id': 'f1'},
     145                                                   createDOM('div', {'id': 'f2'})))),
    139146              createDOM('div', {'id': 'c'})));
     147
     148debug('Test for traversal, starting with a fallback element which is not used.');
     149showComposedShadowTree(getNodeInShadowTreeStack('a/f1'));
     150showNextNode(getNodeInShadowTreeStack('a/f1'));
     151showNextNode(getNodeInShadowTreeStack('a/f2'));
     152debug('');
    140153
    141154debug('Test for Nested ShadowRoots.');
  • trunk/Source/WebCore/ChangeLog

    r121479 r121481  
     12012-06-28  Hayato Ito  <hayato@chromium.org>
     2
     3        CompositeShadowTreeWalker should use InsertionPoint::hasDistribution() instead of InsertionPoint::isActive().
     4        https://bugs.webkit.org/show_bug.cgi?id=89177
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Prevents ComposedShadowTreeWalker from escaping out of an
     9        insertion point (which has distributed nodes) from a non-used
     10        fallback element in the insertion point.  Such a fallback element
     11        should be treated as in an orphaned subtree.
     12
     13        ComposedShadowTreeParentWalker will be also fixed in a follow-up patch.
     14
     15        Test: fast/dom/shadow/composed-shadow-tree-walker.html
     16
     17        * dom/ComposedShadowTreeWalker.cpp:
     18        (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
     19
    1202012-06-27  Ryosuke Niwa  <rniwa@webkit.org>
    221
  • trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp

    r119365 r121481  
    189189{
    190190    ASSERT(node);
    191     if (isActiveInsertionPoint(node))
    192         return traverseParent(node);
    193     return const_cast<Node*>(node);
     191    if (!isInsertionPoint(node))
     192        return const_cast<Node*>(node);
     193    const InsertionPoint* insertionPoint = toInsertionPoint(node);
     194    return insertionPoint->hasDistribution() ? 0 :
     195        insertionPoint->isActive() ? traverseParent(node) : const_cast<Node*>(node);
    194196}
    195197
Note: See TracChangeset for help on using the changeset viewer.