Changeset 140745 in webkit


Ignore:
Timestamp:
Jan 24, 2013 4:00:45 PM (11 years ago)
Author:
arko@motorola.com
Message:

Microdata: itemtype attribute must update correctly on adding or removing tokens
https://bugs.webkit.org/show_bug.cgi?id=106616

Reviewed by Ryosuke Niwa.

Source/WebCore:

Added a new class MicroDataAttributeTokenList, it overrides setValue() method of
DOMSettableTokenList. setValue() is responsible to set the new attribute value for
a given element.

Tests: fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html

fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html
fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Node.cpp:

(WebCore::Node::itemProp):
(WebCore::Node::setItemProp):
(WebCore::Node::itemRef):
(WebCore::Node::setItemRef):
(WebCore::Node::itemType):
(WebCore::Node::setItemType):

  • dom/NodeRareData.h:

(WebCore::NodeMicroDataTokenLists::itemProp):
(WebCore::NodeMicroDataTokenLists::itemRef):
(WebCore::NodeMicroDataTokenLists::itemType):
(NodeMicroDataTokenLists):

  • html/DOMSettableTokenList.h: Made the constructor as protected, so that we can

override setValue() method.
(DOMSettableTokenList):

  • html/MicroDataAttributeTokenList.cpp: Added.

(WebCore):
(WebCore::MicroDataAttributeTokenList::MicroDataAttributeTokenList):
(WebCore::MicroDataAttributeTokenList::setValueInternal):
(WebCore::MicroDataAttributeTokenList::setValue): It calls
DOMSettableTokenList::setValue to set internal tokens and value.

  • html/MicroDataAttributeTokenList.h: Added.

(WebCore):
(MicroDataAttributeTokenList):
(WebCore::MicroDataAttributeTokenList::create):

LayoutTests:

Added tests to ensure that itemtype, itemprop, itemref attributes must update
correctly when tokens have been added or removed.

  • fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt: Added.
  • fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html: Added.
  • fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt: Added.
  • fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html: Added.
  • fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt: Added.
  • fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html: Added.
Location:
trunk
Files:
8 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140742 r140745  
     12013-01-24  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: itemtype attribute must update correctly on adding or removing tokens
     4        https://bugs.webkit.org/show_bug.cgi?id=106616
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added tests to ensure that itemtype, itemprop, itemref attributes must update
     9        correctly when tokens have been added or removed.
     10
     11        * fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt: Added.
     12        * fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html: Added.
     13        * fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt: Added.
     14        * fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html: Added.
     15        * fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt: Added.
     16        * fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html: Added.
     17
    1182013-01-24  Emil A Eklund  <eae@chromium.org>
    219
  • trunk/Source/WebCore/CMakeLists.txt

    r140741 r140745  
    14691469    html/MediaDocument.cpp
    14701470    html/MediaFragmentURIParser.cpp
     1471    html/MicroDataAttributeTokenList.cpp
    14711472    html/MicroDataItemValue.cpp
    14721473    html/MonthInputType.cpp
  • trunk/Source/WebCore/ChangeLog

    r140741 r140745  
     12013-01-24  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: itemtype attribute must update correctly on adding or removing tokens
     4        https://bugs.webkit.org/show_bug.cgi?id=106616
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added a new class MicroDataAttributeTokenList, it overrides setValue() method of
     9        DOMSettableTokenList. setValue() is responsible to set the new attribute value for
     10        a given element.
     11
     12        Tests: fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html
     13               fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html
     14               fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html
     15
     16        * CMakeLists.txt:
     17        * GNUmakefile.list.am:
     18        * Target.pri:
     19        * WebCore.gypi:
     20        * WebCore.vcproj/WebCore.vcproj:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * dom/Node.cpp:
     23        (WebCore::Node::itemProp):
     24        (WebCore::Node::setItemProp):
     25        (WebCore::Node::itemRef):
     26        (WebCore::Node::setItemRef):
     27        (WebCore::Node::itemType):
     28        (WebCore::Node::setItemType):
     29        * dom/NodeRareData.h:
     30        (WebCore::NodeMicroDataTokenLists::itemProp):
     31        (WebCore::NodeMicroDataTokenLists::itemRef):
     32        (WebCore::NodeMicroDataTokenLists::itemType):
     33        (NodeMicroDataTokenLists):
     34        * html/DOMSettableTokenList.h: Made the constructor as protected, so that we can
     35        override setValue() method.
     36        (DOMSettableTokenList):
     37        * html/MicroDataAttributeTokenList.cpp: Added.
     38        (WebCore):
     39        (WebCore::MicroDataAttributeTokenList::MicroDataAttributeTokenList):
     40        (WebCore::MicroDataAttributeTokenList::setValueInternal):
     41        (WebCore::MicroDataAttributeTokenList::setValue): It calls
     42        DOMSettableTokenList::setValue to set internal tokens and value.
     43        * html/MicroDataAttributeTokenList.h: Added.
     44        (WebCore):
     45        (MicroDataAttributeTokenList):
     46        (WebCore::MicroDataAttributeTokenList::create):
     47
    1482013-01-24  Joshua Bell  <jsbell@chromium.org>
    249
  • trunk/Source/WebCore/GNUmakefile.list.am

    r140741 r140745  
    35293529        Source/WebCore/html/MediaFragmentURIParser.cpp \
    35303530        Source/WebCore/html/MediaFragmentURIParser.h \
     3531        Source/WebCore/html/MicroDataAttributeTokenList.cpp \
     3532        Source/WebCore/html/MicroDataAttributeTokenList.h \
    35313533        Source/WebCore/html/MicroDataItemValue.cpp \
    35323534        Source/WebCore/html/MicroDataItemValue.h \
  • trunk/Source/WebCore/Target.pri

    r140683 r140745  
    681681    html/LinkRelAttribute.cpp \
    682682    html/MediaDocument.cpp \
     683    html/MicroDataAttributeTokenList.cpp \
    683684    html/MicroDataItemValue.cpp \
    684685    html/MonthInputType.cpp \
     
    18771878    html/MediaDocument.h \
    18781879    html/MediaFragmentURIParser.h \
     1880    html/MicroDataAttributeTokenList.h \
    18791881    html/MicroDataItemValue.h \
    18801882    html/PluginDocument.h \
  • trunk/Source/WebCore/WebCore.gypi

    r140741 r140745  
    32173217            'html/MediaKeyEvent.cpp',
    32183218            'html/MediaKeyEvent.h',
     3219            'html/MicroDataAttributeTokenList.cpp',
     3220            'html/MicroDataAttributeTokenList.h',
    32193221            'html/MicroDataItemValue.cpp',
    32203222            'html/MicroDataItemValue.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r140718 r140745  
    6459164591                        </File>
    6459264592                        <File
     64593                                RelativePath="..\html\MicroDataAttributeTokenList.cpp"
     64594                                >
     64595                        </File>
     64596                        <File
     64597                                RelativePath="..\html\MicroDataAttributeTokenList.h"
     64598                                >
     64599                        </File>
     64600                        <File
    6459364601                                RelativePath="..\html\MicroDataItemValue.cpp"
    6459464602                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r140712 r140745  
    801801                2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
    802802                2DF2E9D5166E39750035BEF2 /* ConsoleAPITypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DF2E9D4166E39740035BEF2 /* ConsoleAPITypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
     803                2E07753116B1BD13004D9936 /* MicroDataAttributeTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E07753016B1BD13004D9936 /* MicroDataAttributeTokenList.cpp */; };
     804                2E07753416B1BD4C004D9936 /* MicroDataAttributeTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E07753316B1BD4C004D9936 /* MicroDataAttributeTokenList.h */; };
    803805                2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; };
    804806                2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; };
     
    80788080                2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */ = {isa = PBXFileReference; lastKnownFileType = file; path = linearSRGB.icc; sourceTree = "<group>"; };
    80798081                2DF2E9D4166E39740035BEF2 /* ConsoleAPITypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleAPITypes.h; sourceTree = "<group>"; };
     8082                2E07753016B1BD13004D9936 /* MicroDataAttributeTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroDataAttributeTokenList.cpp; sourceTree = "<group>"; };
     8083                2E07753316B1BD4C004D9936 /* MicroDataAttributeTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MicroDataAttributeTokenList.h; sourceTree = "<group>"; };
    80808084                2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = "<group>"; };
    80818085                2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = "<group>"; };
     
    1811218116                                CDB859F5160D489900E5B07F /* MediaKeyEvent.h */,
    1811318117                                CDB859F6160D489900E5B07F /* MediaKeyEvent.idl */,
     18118                                2E07753016B1BD13004D9936 /* MicroDataAttributeTokenList.cpp */,
     18119                                2E07753316B1BD4C004D9936 /* MicroDataAttributeTokenList.h */,
    1811418120                                9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */,
    1811518121                                9B2F7CF814562120007F8B50 /* MicroDataItemValue.h */,
     
    2627226278                                FB91392616AE4C2F001FE682 /* CanvasPathMethods.h in Headers */,
    2627326279                                FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */,
     26280                                2E07753416B1BD4C004D9936 /* MicroDataAttributeTokenList.h in Headers */,
    2627426281                        );
    2627526282                        runOnlyForDeploymentPostprocessing = 0;
     
    2942229429                                FB91392716AE4C34001FE682 /* CanvasPathMethods.cpp in Sources */,
    2942329430                                FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */,
     29431                                2E07753116B1BD13004D9936 /* MicroDataAttributeTokenList.cpp in Sources */,
    2942429432                        );
    2942529433                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/dom/Node.cpp

    r140546 r140745  
    25292529DOMSettableTokenList* Node::itemProp()
    25302530{
    2531     return ensureRareData()->ensureMicroDataTokenLists()->itemProp();
     2531    return ensureRareData()->ensureMicroDataTokenLists()->itemProp(this);
    25322532}
    25332533
    25342534void Node::setItemProp(const String& value)
    25352535{
    2536     ensureRareData()->ensureMicroDataTokenLists()->itemProp()->setValue(value);
     2536    ensureRareData()->ensureMicroDataTokenLists()->itemProp(this)->setValueInternal(value);
    25372537}
    25382538
    25392539DOMSettableTokenList* Node::itemRef()
    25402540{
    2541     return ensureRareData()->ensureMicroDataTokenLists()->itemRef();
     2541    return ensureRareData()->ensureMicroDataTokenLists()->itemRef(this);
    25422542}
    25432543
    25442544void Node::setItemRef(const String& value)
    25452545{
    2546     ensureRareData()->ensureMicroDataTokenLists()->itemRef()->setValue(value);
     2546    ensureRareData()->ensureMicroDataTokenLists()->itemRef(this)->setValueInternal(value);
    25472547}
    25482548
    25492549DOMSettableTokenList* Node::itemType()
    25502550{
    2551     return ensureRareData()->ensureMicroDataTokenLists()->itemType();
     2551    return ensureRareData()->ensureMicroDataTokenLists()->itemType(this);
    25522552}
    25532553
    25542554void Node::setItemType(const String& value)
    25552555{
    2556     ensureRareData()->ensureMicroDataTokenLists()->itemType()->setValue(value);
     2556    ensureRareData()->ensureMicroDataTokenLists()->itemType(this)->setValueInternal(value);
    25572557}
    25582558
  • trunk/Source/WebCore/dom/NodeRareData.h

    r140700 r140745  
    2525#include "ChildNodeList.h"
    2626#include "DOMSettableTokenList.h"
     27#include "HTMLNames.h"
    2728#include "LiveNodeList.h"
    2829#include "MutationObserver.h"
     
    4243#if ENABLE(MICRODATA)
    4344#include "HTMLPropertiesCollection.h"
     45#include "MicroDataAttributeTokenList.h"
    4446#include "MicroDataItemList.h"
    4547#endif
     
    261263    static PassOwnPtr<NodeMicroDataTokenLists> create() { return adoptPtr(new NodeMicroDataTokenLists); }
    262264
    263     DOMSettableTokenList* itemProp() const
     265    MicroDataAttributeTokenList* itemProp(Node* node) const
    264266    {
    265267        if (!m_itemProp)
    266             m_itemProp = DOMSettableTokenList::create();
     268            m_itemProp = MicroDataAttributeTokenList::create(toElement(node), HTMLNames::itempropAttr);
    267269        return m_itemProp.get();
    268270    }
    269271
    270     DOMSettableTokenList* itemRef() const
     272    MicroDataAttributeTokenList* itemRef(Node* node) const
    271273    {
    272274        if (!m_itemRef)
    273             m_itemRef = DOMSettableTokenList::create();
     275            m_itemRef = MicroDataAttributeTokenList::create(toElement(node), HTMLNames::itemrefAttr);
    274276        return m_itemRef.get();
    275277    }
    276278
    277     DOMSettableTokenList* itemType() const
     279    MicroDataAttributeTokenList* itemType(Node* node) const
    278280    {
    279281        if (!m_itemType)
    280             m_itemType = DOMSettableTokenList::create();
     282            m_itemType = MicroDataAttributeTokenList::create(toElement(node), HTMLNames::itemtypeAttr);
    281283        return m_itemType.get();
    282284    }
     
    285287    NodeMicroDataTokenLists() { }
    286288
    287     mutable RefPtr<DOMSettableTokenList> m_itemProp;
    288     mutable RefPtr<DOMSettableTokenList> m_itemRef;
    289     mutable RefPtr<DOMSettableTokenList> m_itemType;
     289    mutable RefPtr<MicroDataAttributeTokenList> m_itemProp;
     290    mutable RefPtr<MicroDataAttributeTokenList> m_itemRef;
     291    mutable RefPtr<MicroDataAttributeTokenList> m_itemType;
    290292};
    291293#endif
  • trunk/Source/WebCore/html/DOMSettableTokenList.h

    r129779 r140745  
    5959    const SpaceSplitString& tokens() const { return m_tokens; }
    6060
    61 private:
     61protected:
    6262    DOMSettableTokenList();
    6363
     64private:
    6465    virtual void addInternal(const AtomicString&) OVERRIDE;
    6566    virtual bool containsInternal(const AtomicString&) const OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.