Changeset 139958 in webkit


Ignore:
Timestamp:
Jan 16, 2013 8:22:41 PM (11 years ago)
Author:
morrita@google.com
Message:

Attr.ownerDocument should change if its parent's owner did
https://bugs.webkit.org/show_bug.cgi?id=97644

Reviewed by Darin Adler.

Source/WebCore:

moveTreeToNewScope() didn't traverse its Attr instances. But it should.

Test: fast/dom/Attr/parent-adopt-node.html

  • dom/ElementAttributeData.cpp:

(WebCore::ElementAttributeData::getExistingAttrs):
(WebCore):

  • dom/ElementAttributeData.h:

(ElementAttributeData):

  • dom/TreeScopeAdopter.cpp:

(WebCore::TreeScopeAdopter::moveTreeToNewScope):

LayoutTests:

  • fast/dom/Attr/parent-adopt-node-expected.txt: Added.
  • fast/dom/Attr/parent-adopt-node.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139932 r139958  
     12013-01-16  MORITA Hajime  <morrita@google.com>
     2
     3        Attr.ownerDocument should change if its parent's owner did
     4        https://bugs.webkit.org/show_bug.cgi?id=97644
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/dom/Attr/parent-adopt-node-expected.txt: Added.
     9        * fast/dom/Attr/parent-adopt-node.html: Added.
     10
    1112013-01-16  Victor Carbune  <vcarbune@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r139954 r139958  
     12013-01-16  MORITA Hajime  <morrita@google.com>
     2
     3        Attr.ownerDocument should change if its parent's owner did
     4        https://bugs.webkit.org/show_bug.cgi?id=97644
     5
     6        Reviewed by Darin Adler.
     7
     8        moveTreeToNewScope() didn't traverse its Attr instances. But it should.
     9
     10        Test: fast/dom/Attr/parent-adopt-node.html
     11
     12        * dom/ElementAttributeData.cpp:
     13        (WebCore::ElementAttributeData::getExistingAttrs):
     14        (WebCore):
     15        * dom/ElementAttributeData.h:
     16        (ElementAttributeData):
     17        * dom/TreeScopeAdopter.cpp:
     18        (WebCore::TreeScopeAdopter::moveTreeToNewScope):
     19
    1202013-01-16  Adam Barth  <abarth@webkit.org>
    221
  • trunk/Source/WebCore/dom/Element.cpp

    r139839 r139958  
    16431643#endif
    16441644
     1645const Vector<RefPtr<Attr> >& Element::attrNodeList()
     1646{
     1647    ASSERT(hasSyntheticAttrChildNodes());
     1648    return *attrNodeListForElement(this);
     1649}
     1650
    16451651PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec)
    16461652{
  • trunk/Source/WebCore/dom/Element.h

    r139839 r139958  
    3838namespace WebCore {
    3939
     40class Attr;
    4041class Attribute;
    4142class ClientRect;
     
    229230    PassRefPtr<Attr> attrIfExists(const QualifiedName&);
    230231    PassRefPtr<Attr> ensureAttr(const QualifiedName&);
    231    
     232
     233    const Vector<RefPtr<Attr> >& attrNodeList();
     234
    232235    virtual CSSStyleDeclaration* style();
    233236
  • trunk/Source/WebCore/dom/TreeScopeAdopter.cpp

    r138735 r139958  
    2626#include "TreeScopeAdopter.h"
    2727
     28#include "Attr.h"
    2829#include "Document.h"
    2930#include "ElementRareData.h"
     
    6162        if (willMoveToNewDocument)
    6263            moveNodeToNewDocument(node, oldDocument, newDocument);
     64
     65        if (!node->isElementNode())
     66            continue;
     67
     68        if (node->hasSyntheticAttrChildNodes()) {
     69            const Vector<RefPtr<Attr> >& attrs = toElement(node)->attrNodeList();
     70            for (unsigned i = 0; i < attrs.size(); ++i)
     71                moveTreeToNewScope(attrs[i].get());
     72        }
    6373
    6474        for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
Note: See TracChangeset for help on using the changeset viewer.