Changeset 159389 in webkit


Ignore:
Timestamp:
Nov 17, 2013 1:37:25 PM (10 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r158774): Iteration over element children is broken
https://bugs.webkit.org/show_bug.cgi?id=124145

Source/WebCore:

Reviewed by Anders Carlsson.

Mutation during traversal invalidates the position cache. After the mid-point we start
traversing backwards as it the shortest path. However backward traversal of children-only
HTMLCollection was wrong and would end up going to descendants.

Reduction by yannick.poirier@inverto.tv.

Test: fast/dom/htmlcollection-children-mutation.html

  • html/HTMLCollection.cpp:

(WebCore::HTMLCollection::collectionTraverseBackward):

Traverse direct children only when m_shouldOnlyIncludeDirectChildren bit is set.

LayoutTests:

Reviewed by Anders Carlsson.

  • fast/dom/htmlcollection-children-mutation-expected.txt: Added.
  • fast/dom/htmlcollection-children-mutation.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159385 r159389  
     12013-11-17  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r158774): Iteration over element children is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=124145
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * fast/dom/htmlcollection-children-mutation-expected.txt: Added.
     9        * fast/dom/htmlcollection-children-mutation.html: Added.
     10
    1112013-11-17  Antti Koivisto  <antti@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r159386 r159389  
     12013-11-17  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r158774): Iteration over element children is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=124145
     5
     6        Reviewed by Anders Carlsson.
     7       
     8        Mutation during traversal invalidates the position cache. After the mid-point we start
     9        traversing backwards as it the shortest path. However backward traversal of children-only
     10        HTMLCollection was wrong and would end up going to descendants.
     11       
     12        Reduction by yannick.poirier@inverto.tv.
     13
     14        Test: fast/dom/htmlcollection-children-mutation.html
     15
     16        * html/HTMLCollection.cpp:
     17        (WebCore::HTMLCollection::collectionTraverseBackward):
     18       
     19            Traverse direct children only when m_shouldOnlyIncludeDirectChildren bit is set.
     20
    1212013-11-17  Zoltan Horvath  <zoltan@webkit.org>
    222
  • trunk/Source/WebCore/html/HTMLCollection.cpp

    r158774 r159389  
    355355    auto& root = rootNode();
    356356    Element* element = &current;
     357    if (m_shouldOnlyIncludeDirectChildren) {
     358        for (; count && element ; --count)
     359            element = iterateForPreviousElement(ElementTraversal::previousSibling(element));
     360        return element;
     361    }
    357362    for (; count && element ; --count)
    358363        element = iterateForPreviousElement(ElementTraversal::previous(element, &root));
Note: See TracChangeset for help on using the changeset viewer.