Changeset 98353 in webkit


Ignore:
Timestamp:
Oct 25, 2011 9:53:52 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: Microdata: itemtype attribute should be space-separated list to allow multiple types.
https://bugs.webkit.org/show_bug.cgi?id=70501

Patch by Arko Saha <arko@motorola.com> on 2011-10-25
Reviewed by Ryosuke Niwa.

Tests: fast/dom/MicroData/getitems-multiple-itemtypes.html

fast/dom/MicroData/itemtype-add-remove-tokens.html
fast/dom/MicroData/itemtype-attribute-test.html

  • dom/MicroDataItemList.cpp:

(WebCore::MicroDataItemList::nodeMatches):

  • html/DOMSettableTokenList.h:

(WebCore::DOMSettableTokenList::tokens):

  • html/HTMLElement.cpp:

(WebCore::HTMLElement::parseMappedAttribute):
(WebCore::HTMLElement::setItemValueText):
(WebCore::HTMLElement::itemType):
(WebCore::HTMLElement::setItemType):

  • html/HTMLElement.h:
  • html/HTMLElement.idl:

LayoutTests: Microdata: itemtype attribute should be space-separated list to allow multiple types
https://bugs.webkit.org/show_bug.cgi?id=70501

Patch by Arko Saha <arko@motorola.com> on 2011-10-25
Reviewed by Ryosuke Niwa.

  • fast/dom/MicroData/006.html:
  • fast/dom/MicroData/007.html:
  • fast/dom/MicroData/getitems-multiple-itemtypes-expected.txt: Added.
  • fast/dom/MicroData/getitems-multiple-itemtypes.html: Added.
  • fast/dom/MicroData/itemtype-add-remove-tokens-expected.txt: Added.
  • fast/dom/MicroData/itemtype-add-remove-tokens.html: Added.
  • fast/dom/MicroData/itemtype-attribute-test-expected.txt: Added.
  • fast/dom/MicroData/itemtype-attribute-test.html: Added.
Location:
trunk
Files:
6 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r98349 r98353  
     12011-10-25  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: itemtype attribute should be space-separated list to allow multiple types
     4        https://bugs.webkit.org/show_bug.cgi?id=70501
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/dom/MicroData/006.html:
     9        * fast/dom/MicroData/007.html:
     10        * fast/dom/MicroData/getitems-multiple-itemtypes-expected.txt: Added.
     11        * fast/dom/MicroData/getitems-multiple-itemtypes.html: Added.
     12        * fast/dom/MicroData/itemtype-add-remove-tokens-expected.txt: Added.
     13        * fast/dom/MicroData/itemtype-add-remove-tokens.html: Added.
     14        * fast/dom/MicroData/itemtype-attribute-test-expected.txt: Added.
     15        * fast/dom/MicroData/itemtype-attribute-test.html: Added.
     16
    1172011-10-25  Cary Clark  <caryclark@google.com>
    218
  • trunk/LayoutTests/fast/dom/MicroData/006.html

    r97471 r98353  
    88<br>This test also ensure that document.getItems must ignore duplicated tokens.
    99</p>
    10 <div itemscope itemtype="http://example.com/foo"></div>
    11 <div itemscope itemtype="http://example.com/bar">
    12 <div itemscope itemtype="data:text/plain"></div>
     10<div itemscope itemtype="http://example.com/foo http://example.com/bar data:text/plain"></div>
     11<div itemscope itemtype="http://example.com/bar http://example.com/foo">
     12<div itemscope itemtype="data:text/plain http://example.com/foo"></div>
    1313</div>
    1414<div id="console"></div>
  • trunk/LayoutTests/fast/dom/MicroData/007.html

    r97471 r98353  
    1515<div id="console"></div>
    1616<script>
    17 var nodeList = document.getItems('http://example.com/bar data:text/plain, http://example.com/foo');
     17var nodeList = document.getItems();
    1818
    1919shouldBe("nodeList[0].id", "'one'");
  • trunk/Source/WebCore/ChangeLog

    r98350 r98353  
     12011-10-25  Arko Saha  <arko@motorola.com>
     2
     3        Microdata: itemtype attribute should be space-separated list to allow multiple types.
     4        https://bugs.webkit.org/show_bug.cgi?id=70501
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Tests: fast/dom/MicroData/getitems-multiple-itemtypes.html
     9               fast/dom/MicroData/itemtype-add-remove-tokens.html
     10               fast/dom/MicroData/itemtype-attribute-test.html
     11
     12        * dom/MicroDataItemList.cpp:
     13        (WebCore::MicroDataItemList::nodeMatches):
     14        * html/DOMSettableTokenList.h:
     15        (WebCore::DOMSettableTokenList::tokens):
     16        * html/HTMLElement.cpp:
     17        (WebCore::HTMLElement::parseMappedAttribute):
     18        (WebCore::HTMLElement::setItemValueText):
     19        (WebCore::HTMLElement::itemType):
     20        (WebCore::HTMLElement::setItemType):
     21        * html/HTMLElement.h:
     22        * html/HTMLElement.idl:
     23
    1242011-10-25  Dan Bernstein  <mitz@apple.com>
    225
  • trunk/Source/WebCore/dom/MicroDataItemList.cpp

    r98300 r98353  
    6161        return true;
    6262
    63     return m_typeNames.contains(testElement->fastGetAttribute(itemtypeAttr));
     63    return testElement->itemType()->tokens().containsAll(m_typeNames);
    6464}
    6565
  • trunk/Source/WebCore/html/DOMSettableTokenList.h

    r95901 r98353  
    5656
    5757    String value() const { return m_value; }
     58    const SpaceSplitString& tokens() const { return m_tokens; }
    5859    void setValue(const String&);
    5960
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r98300 r98353  
    208208        setItemRef(attr->value());
    209209    } else if (attr->name() == itemtypeAttr) {
     210        setItemType(attr->value());
    210211        itemTypeAttributeChanged();
    211212#endif
     
    10571058    setTextContent(value, ec);
    10581059}
     1060
     1061PassRefPtr<DOMSettableTokenList> HTMLElement::itemType() const
     1062{
     1063    if (!m_itemType)
     1064        m_itemType = DOMSettableTokenList::create();
     1065
     1066    return m_itemType;
     1067}
     1068
     1069void HTMLElement::setItemType(const String& value)
     1070{
     1071    if (!m_itemType)
     1072        m_itemType = DOMSettableTokenList::create();
     1073
     1074    m_itemType->setValue(value);
     1075}
    10591076#endif
    10601077
  • trunk/Source/WebCore/html/HTMLElement.h

    r98300 r98353  
    9393    PassRefPtr<DOMSettableTokenList> itemRef() const;
    9494    PassRefPtr<DOMSettableTokenList> itemProp() const;
     95    PassRefPtr<DOMSettableTokenList> itemType() const;
    9596
    9697    void setItemValue(const String&, ExceptionCode&);
     
    128129    void setItemProp(const String&);
    129130    void setItemRef(const String&);
     131    void setItemType(const String&);
    130132
    131133    virtual String itemValueText() const;
     
    134136    mutable RefPtr<DOMSettableTokenList> m_itemProp;
    135137    mutable RefPtr<DOMSettableTokenList> m_itemRef;
     138    mutable RefPtr<DOMSettableTokenList> m_itemType;
    136139#endif
    137140};
  • trunk/Source/WebCore/html/HTMLElement.idl

    r98300 r98353  
    6868
    6969                 attribute [Conditional=MICRODATA, Reflect] boolean itemScope;
    70                  attribute [Conditional=MICRODATA, Reflect] DOMString itemType;
     70        readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemType;
    7171                 attribute [Conditional=MICRODATA, Reflect] DOMString itemId;
    7272
Note: See TracChangeset for help on using the changeset viewer.