Changeset 125159 in webkit


Ignore:
Timestamp:
Aug 9, 2012 12:47:55 AM (12 years ago)
Author:
arko@motorola.com
Message:

Microdata: PropertyNodeList cache should be invalidated on id attribute change.
https://bugs.webkit.org/show_bug.cgi?id=93485

Reviewed by Ryosuke Niwa.

Source/WebCore:

Invalidate PropertyNodeList cache when id attribute of an element changed/modified.

Test: fast/dom/MicroData/propertiescollection-on-changing-id-attr.html

  • dom/DynamicNodeList.cpp: Moved ownerNodeHasItemRefAttribute() method to DynamicNodeList.h

(WebCore):

  • dom/DynamicNodeList.h:

(WebCore):
(WebCore::DynamicNodeListCacheBase::isRootedAtDocument): Return true if owner has itemref
attribute specified with root type NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr.
(WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): Return true if
attrName is id attribute in case of InvalidateOnItemAttrChange.
(WebCore::DynamicNodeListCacheBase::ownerNodeHasItemRefAttribute):

LayoutTests:

Added test to verify HTMLPropertiesCollection and PropertyNodeList interfaces
behavior on changing id attribute.

  • fast/dom/MicroData/propertiescollection-on-changing-id-attr-expected.txt: Added.
  • fast/dom/MicroData/propertiescollection-on-changing-id-attr.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125158 r125159  
     12012-08-08  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: PropertyNodeList cache should be invalidated on id attribute change.
     4        https://bugs.webkit.org/show_bug.cgi?id=93485
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added test to verify HTMLPropertiesCollection and PropertyNodeList interfaces
     9        behavior on changing id attribute.
     10
     11        * fast/dom/MicroData/propertiescollection-on-changing-id-attr-expected.txt: Added.
     12        * fast/dom/MicroData/propertiescollection-on-changing-id-attr.html: Added.
     13
    1142012-08-09  Takashi Toyoshima  <toyoshim@chromium.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r125157 r125159  
     12012-08-08  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: PropertyNodeList cache should be invalidated on id attribute change.
     4        https://bugs.webkit.org/show_bug.cgi?id=93485
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Invalidate PropertyNodeList cache when id attribute of an element changed/modified.
     9
     10        Test: fast/dom/MicroData/propertiescollection-on-changing-id-attr.html
     11
     12        * dom/DynamicNodeList.cpp: Moved ownerNodeHasItemRefAttribute() method to DynamicNodeList.h
     13        (WebCore):
     14        * dom/DynamicNodeList.h:
     15        (WebCore):
     16        (WebCore::DynamicNodeListCacheBase::isRootedAtDocument): Return true if owner has itemref
     17        attribute specified with root type NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr.
     18        (WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): Return true if
     19        attrName is id attribute in case of InvalidateOnItemAttrChange.
     20        (WebCore::DynamicNodeListCacheBase::ownerNodeHasItemRefAttribute):
     21
    1222012-08-09  Arko Saha  <arko@motorola.com>
    223
  • trunk/Source/WebCore/dom/DynamicNodeList.cpp

    r125157 r125159  
    4848
    4949    return m_ownerNode.get();
    50 }
    51 
    52 ALWAYS_INLINE bool DynamicNodeListCacheBase::ownerNodeHasItemRefAttribute() const
    53 {
    54 #if ENABLE(MICRODATA)
    55     if (m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr)
    56         return toElement(ownerNode())->fastHasAttribute(HTMLNames::itemrefAttr);
    57 #endif
    58 
    59     return false;
    6050}
    6151
  • trunk/Source/WebCore/dom/DynamicNodeList.h

    r123434 r125159  
    2727#include "CollectionType.h"
    2828#include "Document.h"
     29#include "Element.h"
    2930#include "HTMLNames.h"
    3031#include "NodeList.h"
     
    3334
    3435namespace WebCore {
    35 
    36 class Element;
    37 class Node;
    3836
    3937enum NodeListRootType {
     
    7169
    7270public:
    73     ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument; }
     71    ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootType == NodeListIsRootedAtDocument || ownerNodeHasItemRefAttribute(); }
    7472    ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); }
    7573    ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); }
     
    167165    case InvalidateOnItemAttrChange:
    168166#if ENABLE(MICRODATA)
    169         return attrName == HTMLNames::itemscopeAttr || attrName == HTMLNames::itempropAttr || attrName == HTMLNames::itemtypeAttr || attrName == HTMLNames::itemrefAttr;
     167        return attrName == HTMLNames::itemscopeAttr || attrName == HTMLNames::itempropAttr
     168            || attrName == HTMLNames::itemtypeAttr || attrName == HTMLNames::itemrefAttr || attrName == HTMLNames::idAttr;
    170169#endif // Intentionally fall through
    171170    case DoNotInvalidateOnAttributeChanges:
     
    174173        return true;
    175174    }
     175    return false;
     176}
     177
     178ALWAYS_INLINE bool DynamicNodeListCacheBase::ownerNodeHasItemRefAttribute() const
     179{
     180#if ENABLE(MICRODATA)
     181    if (m_rootType == NodeListIsRootedAtDocumentIfOwnerHasItemrefAttr)
     182        return toElement(ownerNode())->fastHasAttribute(HTMLNames::itemrefAttr);
     183#endif
     184
    176185    return false;
    177186}
Note: See TracChangeset for help on using the changeset viewer.