Changeset 118111 in webkit


Ignore:
Timestamp:
May 22, 2012 8:36:39 PM (12 years ago)
Author:
hayato@chromium.org
Message:

Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
https://bugs.webkit.org/show_bug.cgi?id=86830

Reviewed by Dimitri Glazkov.

Source/WebCore:

Fixed InsertionPoint::isActive() issue, which may return true
wrongly even if the insertion point is not in Shadow DOM subtree.
Now ComposedShadowTreeWalker can traverse inactive insertion
points correctly using InsertionPoint::isActive().

Test: fast/dom/shadow/composed-shadow-tree-walker.html

  • dom/ComposedShadowTreeWalker.cpp:

(WebCore::ComposedShadowTreeWalker::traverseNode):
(WebCore::ComposedShadowTreeWalker::escapeFallbackContentElement):
(WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::isActive):

  • html/shadow/InsertionPoint.h:

(WebCore::isActiveInsertionPoint):
(WebCore):

LayoutTests:

  • fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
  • fast/dom/shadow/composed-shadow-tree-walker.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118107 r118111  
     12012-05-22  Hayato Ito  <hayato@chromium.org>
     2
     3        Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
     4        https://bugs.webkit.org/show_bug.cgi?id=86830
     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-05-22  Stephanie Lewis  <slewis@apple.com>
    212
  • trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt

    r112845 r118111  
    151151DIV      id=a
    152152
     153Test for inactive insertion points.
     154Composed Shadow Tree:
     155DIV      id=a
     156        CONTENT  id=b
     157                CONTENT  id=c
     158
     159Traverse in forward.
     160DIV      id=a
     161CONTENT  id=b
     162CONTENT  id=c
     163Traverse in backward.
     164CONTENT  id=c
     165CONTENT  id=b
     166DIV      id=a
     167
    153168PASS successfullyParsed is true
    154169
  • trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html

    r112845 r118111  
    157157              createDOM('div', {'id': 'f'})));
    158158
     159debug('Test for inactive insertion points.');
     160showComposedShadowTree(
     161    createDOM('div', {'id': 'a'},
     162              createDOM('content', {'id': 'b'},
     163                        createDOM('content', {'id': 'c'}))));
     164
    159165</script>
    160166<script src="../../js/resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r118110 r118111  
     12012-05-22  Hayato Ito  <hayato@chromium.org>
     2
     3        Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
     4        https://bugs.webkit.org/show_bug.cgi?id=86830
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Fixed InsertionPoint::isActive() issue, which may return true
     9        wrongly even if the insertion point is not in Shadow DOM subtree.
     10        Now ComposedShadowTreeWalker can traverse inactive insertion
     11        points correctly using InsertionPoint::isActive().
     12
     13        Test: fast/dom/shadow/composed-shadow-tree-walker.html
     14
     15        * dom/ComposedShadowTreeWalker.cpp:
     16        (WebCore::ComposedShadowTreeWalker::traverseNode):
     17        (WebCore::ComposedShadowTreeWalker::escapeFallbackContentElement):
     18        (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
     19        * html/shadow/InsertionPoint.cpp:
     20        (WebCore::InsertionPoint::isActive):
     21        * html/shadow/InsertionPoint.h:
     22        (WebCore::isActiveInsertionPoint):
     23        (WebCore):
     24
    1252012-05-22  Mark Pilgrim  <pilgrim@chromium.org>
    226
  • trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp

    r117394 r118111  
    113113{
    114114    ASSERT(node);
    115     if (isInsertionPoint(node)) {
    116         const InsertionPoint* insertionPoint = toInsertionPoint(node);
    117         if (Node* next = (direction == TraversalDirectionForward ? insertionPoint->first() : insertionPoint->last()))
    118             return traverseNode(next, direction);
    119         return traverseLightChildren(node, direction);
    120     }
    121     return const_cast<Node*>(node);
     115    if (!isInsertionPoint(node))
     116        return const_cast<Node*>(node);
     117    const InsertionPoint* insertionPoint = toInsertionPoint(node);
     118    if (!insertionPoint->isActive())
     119        return const_cast<Node*>(node);
     120    if (Node* next = (direction == TraversalDirectionForward ? insertionPoint->first() : insertionPoint->last()))
     121        return traverseNode(next, direction);
     122    return traverseLightChildren(node, direction);
    122123}
    123124
     
    177178{
    178179    ASSERT(node);
    179     if (node->parentNode() && isInsertionPoint(node->parentNode()))
     180    if (node->parentNode() && isActiveInsertionPoint(node->parentNode()))
    180181        return traverseSiblingOrBackToInsertionPoint(node->parentNode(), direction);
    181182    return 0;
     
    185186{
    186187    ASSERT(node);
    187     if (isInsertionPoint(node))
     188    if (isActiveInsertionPoint(node))
    188189        return traverseParent(node);
    189190    return const_cast<Node*>(node);
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r117210 r118111  
    102102bool InsertionPoint::isActive() const
    103103{
     104    if (!shadowRoot())
     105        return false;
    104106    const Node* node = parentNode();
    105107    while (node) {
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r117033 r118111  
    103103}
    104104
     105inline bool isActiveInsertionPoint(const Node* node)
     106{
     107    return isInsertionPoint(node) && toInsertionPoint(node)->isActive();
     108}
     109
    105110inline bool isShadowBoundary(Node* node)
    106111{
Note: See TracChangeset for help on using the changeset viewer.