Microdata: Add itemprop, itemref, itemvalue attributes.
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 00:13:34 +0000 (00:13 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 00:13:34 +0000 (00:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69839

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

Source/WebCore:

Tests: fast/dom/MicroData/itemprop-add-remove-tokens.html
       fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html
       fast/dom/MicroData/itemprop-must-be-read-only.html
       fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html
       fast/dom/MicroData/itemref-add-remove-tokens.html
       fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html
       fast/dom/MicroData/itemref-for-an-element-must-be-correct.html
       fast/dom/MicroData/itemref-must-be-read-only.html
       fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html
       fast/dom/MicroData/itemvalue-reflects-href-attr.html
       fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html
       fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html
       fast/dom/MicroData/itemvalue-reflects-the-src-attr.html
       fast/dom/MicroData/itemvalue-returns-element-itself.html
       fast/dom/MicroData/itemvalue-returns-null.html
       fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html
       fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::toJS):
(WebCore::JSHTMLElement::itemValue):
(WebCore::JSHTMLElement::setItemValue):
* bindings/v8/custom/V8HTMLElementCustom.cpp:
(WebCore::toV8Object):
(WebCore::V8HTMLElement::itemValueAccessorGetter):
(WebCore::V8HTMLElement::itemValueAccessorSetter):
* dom/MicroDataItemList.cpp:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::itemValueText):
(WebCore::HTMLAnchorElement::setItemValueText):
* html/HTMLAnchorElement.h:
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::itemValueText):
(WebCore::HTMLAreaElement::setItemValueText):
* html/HTMLAreaElement.h:
* html/HTMLAttributeNames.in:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseMappedAttribute):
(WebCore::HTMLElement::itemProp): Returns element's itemprop content attribute.
(WebCore::HTMLElement::setItemProp): Sets itemprop value on changing elemet's
itemprop attribute.
(WebCore::HTMLElement::itemRef): Returns element's itemref content attribute.
(WebCore::HTMLElement::setItemRef): Sets itemref value on changing elemet's
itemref attribute.
(WebCore::HTMLElement::setItemValue): Sets element's itemvalue. If the element has no
itemprop attribute or if element has an itemscope attribute, it throws INVALID_ACCESS_ERR
exception.
(WebCore::HTMLElement::itemValue): Returns the elements itemvalue.

If the element has no itemprop attribute it returns null.
If the element has an itemscope attribute, it returns the element itself.
If the element is a meta element: It acts as it would if it was reflecting the element's
content content attribute.
If the element is an audio, embed, iframe, img, source, track, or video element: It acts
as it would if it was reflecting the element's src content attribute.
If the element is an a, area, or link element: It act as it would if it was reflecting the
href content attribute.
If the element is an object element: It acts as  it would if it was reflecting the element's
data content attribute.

(WebCore::HTMLElement::itemValueText):
(WebCore::HTMLElement::setItemValueText):
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::itemValueText):
(WebCore::HTMLEmbedElement::setItemValueText):
* html/HTMLEmbedElement.h:
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::itemValueText):
(WebCore::HTMLIFrameElement::setItemValueText):
* html/HTMLIFrameElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::itemValueText):
(WebCore::HTMLImageElement::setItemValueText):
* html/HTMLImageElement.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::itemValueText):
(WebCore::HTMLLinkElement::setItemValueText):
* html/HTMLLinkElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::itemValueText):
(WebCore::HTMLMediaElement::setItemValueText):
* html/HTMLMediaElement.h:
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::itemValueText):
(WebCore::HTMLMetaElement::setItemValueText):
* html/HTMLMetaElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::itemValueText):
(WebCore::HTMLObjectElement::setItemValueText):
* html/HTMLObjectElement.h:
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::itemValueText):
(WebCore::HTMLSourceElement::setItemValueText):
* html/HTMLSourceElement.h:
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::itemValueText):
(WebCore::HTMLTrackElement::setItemValueText):
* html/HTMLTrackElement.h:
* html/MicroDataItemValue.cpp: Added.
(WebCore::MicroDataItemValue::MicroDataItemValue):
(WebCore::MicroDataItemValue::createFromString):
(WebCore::MicroDataItemValue::createFromNode):
* html/MicroDataItemValue.h: Added.
(WebCore::MicroDataItemValue::isNode):
(WebCore::MicroDataItemValue::getNode):
(WebCore::MicroDataItemValue::getString):

LayoutTests:

Added test-cases for Microdata itemprop, itemref, itemvalue attributes.

* fast/dom/MicroData/002-expected.txt:
* fast/dom/MicroData/002.html:
* fast/dom/MicroData/003-expected.txt:
* fast/dom/MicroData/003.html:
* fast/dom/MicroData/005-expected.txt:
* fast/dom/MicroData/005.html:
* fast/dom/MicroData/006-expected.txt:
* fast/dom/MicroData/009.html:
* fast/dom/MicroData/itemprop-add-remove-tokens-expected.txt: Added.
* fast/dom/MicroData/itemprop-add-remove-tokens.html: Added.
* fast/dom/MicroData/itemprop-for-an-element-must-be-correct-expected.txt: Added.
* fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html: Added.
* fast/dom/MicroData/itemprop-must-be-read-only-expected.txt: Added.
* fast/dom/MicroData/itemprop-must-be-read-only.html: Added.
* fast/dom/MicroData/itemprop-reflected-by-itemProp-property-expected.txt: Added.
* fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html: Added.
* fast/dom/MicroData/itemref-add-remove-tokens-expected.txt: Added.
* fast/dom/MicroData/itemref-add-remove-tokens.html: Added.
* fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property-expected.txt: Added.
* fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html: Added.
* fast/dom/MicroData/itemref-for-an-element-must-be-correct-expected.txt: Added.
* fast/dom/MicroData/itemref-for-an-element-must-be-correct.html: Added.
* fast/dom/MicroData/itemref-must-be-read-only-expected.txt: Added.
* fast/dom/MicroData/itemref-must-be-read-only.html: Added.
* fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element-expected.txt: Added.
* fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html: Added.
* fast/dom/MicroData/itemvalue-reflects-href-attr-expected.txt: Added.
* fast/dom/MicroData/itemvalue-reflects-href-attr.html: Added.
* fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element-expected.txt: Added.
* fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html: Added.
* fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element-expected.txt: Added.
* fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html: Added.
* fast/dom/MicroData/itemvalue-reflects-the-src-attr-expected.txt: Added.
* fast/dom/MicroData/itemvalue-reflects-the-src-attr.html: Added.
* fast/dom/MicroData/itemvalue-returns-element-itself-expected.txt: Added.
* fast/dom/MicroData/itemvalue-returns-element-itself.html: Added.
* fast/dom/MicroData/itemvalue-returns-null-expected.txt: Added.
* fast/dom/MicroData/itemvalue-returns-null.html: Added.
* fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001-expected.txt: Added.
* fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html: Added.
* fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002-expected.txt: Added.
* fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html: Added.
* fast/dom/MicroData/resources/microdata-common.js:
(createElement):
(runTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98300 268f45cc-cd09-0410-ab3c-d52691b4dbfc

82 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/MicroData/002-expected.txt
LayoutTests/fast/dom/MicroData/002.html
LayoutTests/fast/dom/MicroData/003-expected.txt
LayoutTests/fast/dom/MicroData/003.html
LayoutTests/fast/dom/MicroData/005-expected.txt
LayoutTests/fast/dom/MicroData/005.html
LayoutTests/fast/dom/MicroData/006-expected.txt
LayoutTests/fast/dom/MicroData/009.html
LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-must-be-read-only-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemref-must-be-read-only.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-returns-null-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-returns-null.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html [new file with mode: 0644]
LayoutTests/fast/dom/MicroData/resources/microdata-common.js
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp
Source/WebCore/dom/MicroDataItemList.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAnchorElement.h
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/html/HTMLAreaElement.h
Source/WebCore/html/HTMLAttributeNames.in
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLElement.h
Source/WebCore/html/HTMLElement.idl
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLEmbedElement.h
Source/WebCore/html/HTMLIFrameElement.cpp
Source/WebCore/html/HTMLIFrameElement.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMetaElement.cpp
Source/WebCore/html/HTMLMetaElement.h
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLObjectElement.h
Source/WebCore/html/HTMLSourceElement.cpp
Source/WebCore/html/HTMLSourceElement.h
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/html/MicroDataItemValue.cpp [new file with mode: 0644]
Source/WebCore/html/MicroDataItemValue.h [new file with mode: 0644]

index 5820510..1362879 100644 (file)
@@ -1,3 +1,58 @@
+2011-10-24  Arko Saha  <arko@motorola.com>
+
+        Microdata: Add itemprop, itemref, itemvalue attributes.
+        https://bugs.webkit.org/show_bug.cgi?id=69839
+
+        Reviewed by Ryosuke Niwa.
+
+        Added test-cases for Microdata itemprop, itemref, itemvalue attributes.
+
+        * fast/dom/MicroData/002-expected.txt:
+        * fast/dom/MicroData/002.html:
+        * fast/dom/MicroData/003-expected.txt:
+        * fast/dom/MicroData/003.html:
+        * fast/dom/MicroData/005-expected.txt:
+        * fast/dom/MicroData/005.html:
+        * fast/dom/MicroData/006-expected.txt:
+        * fast/dom/MicroData/009.html:
+        * fast/dom/MicroData/itemprop-add-remove-tokens-expected.txt: Added.
+        * fast/dom/MicroData/itemprop-add-remove-tokens.html: Added.
+        * fast/dom/MicroData/itemprop-for-an-element-must-be-correct-expected.txt: Added.
+        * fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html: Added.
+        * fast/dom/MicroData/itemprop-must-be-read-only-expected.txt: Added.
+        * fast/dom/MicroData/itemprop-must-be-read-only.html: Added.
+        * fast/dom/MicroData/itemprop-reflected-by-itemProp-property-expected.txt: Added.
+        * fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html: Added.
+        * fast/dom/MicroData/itemref-add-remove-tokens-expected.txt: Added.
+        * fast/dom/MicroData/itemref-add-remove-tokens.html: Added.
+        * fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property-expected.txt: Added.
+        * fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html: Added.
+        * fast/dom/MicroData/itemref-for-an-element-must-be-correct-expected.txt: Added.
+        * fast/dom/MicroData/itemref-for-an-element-must-be-correct.html: Added.
+        * fast/dom/MicroData/itemref-must-be-read-only-expected.txt: Added.
+        * fast/dom/MicroData/itemref-must-be-read-only.html: Added.
+        * fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html: Added.
+        * fast/dom/MicroData/itemvalue-reflects-href-attr-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-reflects-href-attr.html: Added.
+        * fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html: Added.
+        * fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html: Added.
+        * fast/dom/MicroData/itemvalue-reflects-the-src-attr-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-reflects-the-src-attr.html: Added.
+        * fast/dom/MicroData/itemvalue-returns-element-itself-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-returns-element-itself.html: Added.
+        * fast/dom/MicroData/itemvalue-returns-null-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-returns-null.html: Added.
+        * fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html: Added.
+        * fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002-expected.txt: Added.
+        * fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html: Added.
+        * fast/dom/MicroData/resources/microdata-common.js:
+        (createElement):
+        (runTest):
+
 2011-10-24  Filip Pizlo  <fpizlo@apple.com>
 
         Object-or-other branch speculation may corrupt the state for OSR if the child of the
index 5bb0e3d..366cb58 100644 (file)
@@ -6,7 +6,11 @@ document.getItems() with empty string in the aurgument: PASS
 document.getItems() with 'http://example.com/foo' itemtype in the aurgument: PASS
 document.getItems() with 'http://example.com/bar' itemtype in the aurgument: PASS
 document.getItems() with 'http://example.com/f1' itemtype in the aurgument: PASS
+Created element of type: div
+Set attribute: itemscope, value: itemscope
 Newly appended item should be noticed in the NodeList: PASS
 Removing item should be noticed in the NodeList: PASS
+PASS successfullyParsed is true
 
 TEST COMPLETE
+
index 9fac14d..f07df2a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
 <head>
+<script src="../../js/resources/js-test-pre.js"></script>
 <script src="resources/microdata-common.js"></script>
 </head>
 <body>
@@ -13,7 +14,7 @@
 <div itemscope itemtype="http://example.com/foo" id="three">
 <div itemscope itemtype="http://example.com/f1" id="four"></div>
 </div>
-
+<div id="console"></div>
 <script>
 var one = document.getElementById('one');
 var two = document.getElementById('two');
@@ -26,7 +27,7 @@ runTest(document.getItems('http://example.com/foo'), [one, three], "document.get
 runTest(document.getItems('http://example.com/bar'), [two], "document.getItems() with 'http://example.com/bar' itemtype in the aurgument");
 runTest(document.getItems('http://example.com/f1'), [four], "document.getItems() with 'http://example.com/f1' itemtype in the aurgument");
 
-var element = createElem('div', {itemscope:'itemscope'});
+var element = createElement('div', {itemscope:'itemscope'});
 
 // Append newly created item to body
 document.body.appendChild(element);
@@ -36,7 +37,8 @@ runTest(document.getItems(), [one, two, three, four, element], "Newly appended i
 document.body.removeChild(element);
 runTest(document.getItems(), [one, two, three, four], "Removing item should be noticed in the NodeList");
 
-document.write("<br>TEST COMPLETE");
+var successfullyParsed = true;
 </script>
+<script src="../../js/resources/js-test-post.js"></script>
 </body>
 </html>
index c4db885..c217101 100644 (file)
@@ -5,5 +5,7 @@ Removing itemscope attribute should reflect in the NodeList: PASS
 Set itemscope attribute should reflect in the NodeList: PASS
 Set element.itemScope to false should notice in the NodeList: PASS
 Set element.itemScope to true should notice in the NodeList: PASS
+PASS successfullyParsed is true
 
 TEST COMPLETE
+
index 6c3a74d..0dc17d2 100644 (file)
@@ -1,12 +1,14 @@
 <!DOCTYPE html>
 <html>
 <head>
+<script src="../../js/resources/js-test-pre.js"></script>
 <script src="resources/microdata-common.js"></script>
 </head>
 <body>
 <p>This test ensures that live NodeList must notice when itemscope attribute changes.</p>
 <div itemscope itemtype="http://example.com/foo" id="one"></div>
 <div itemscope itemtype="http://example.com/bar" id="two"></div>
+<div id="console"></div>
 <script>
 var one = document.getElementById('one');
 var two = document.getElementById('two');
@@ -29,7 +31,8 @@ runTest(document.getItems(), [one], "Set element.itemScope to false should notic
 two.itemScope = true;
 runTest(document.getItems(), [one, two], "Set element.itemScope to true should notice in the NodeList");
 
-document.write("<br>TEST COMPLETE");
+var successfullyParsed = true;
 </script>
+<script src="../../js/resources/js-test-post.js"></script>
 </body>
 </html>
index b84e5f8..5eaea99 100644 (file)
@@ -3,5 +3,7 @@ This tests that live NodeList must notice when itemtype changes.
 This test page contain two microdata items: PASS
 NodeList must notice on remove attribute itemtype: PASS
 NodeList must notice on set attribute itemtype: PASS
+PASS successfullyParsed is true
 
 TEST COMPLETE
+
index effe147..3362d1d 100644 (file)
@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <html>
 <head>
+<script src="../../js/resources/js-test-pre.js"></script>
 <script src="resources/microdata-common.js"></script>
 </head>
 <body>
 <p>This tests that live NodeList must notice when itemtype changes.</p>
 <div itemscope itemtype="http://example.com/foo" id="one"></div>
 <div itemscope itemtype="http://example.com/foo" id="two"></div>
-
+<div id="console"></div>
 <script>
 var one = document.getElementById('one');
 var two = document.getElementById('two');
@@ -22,7 +23,8 @@ runTest(document.getItems('http://example.com/foo'), [two], "NodeList must notic
 one.setAttribute('itemtype','http://example.com/foo');
 runTest(document.getItems('http://example.com/foo'), [one, two], "NodeList must notice on set attribute itemtype");
 
-document.write("<br>TEST COMPLETE");
+var successfullyParsed = true;
 </script>
+<script src="../../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 4c8ec04..d6b8b6a 100644 (file)
@@ -2,8 +2,8 @@ This tests that document.getItems must locate items when parameters are separate
 This test also ensure that document.getItems must ignore duplicated tokens.
 
 PASS document.getItems(' http://example.com/foo http://example.com/bar ').length == 2 is true
-PASS document.getItems(' http://example.com/foo data:text/plain ').length == 2 is true
-PASS document.getItems(' http://example.com/foo data:text/plain http://example.com/foo').length == 2 is true
+PASS document.getItems(' http://example.com/foo  data:text/plain  ').length == 2 is true
+PASS document.getItems('  http://example.com/foo  data:text/plain  http://example.com/foo').length == 2 is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index f5d4d39..a1ec4fb 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../../js/resources/js-test-pre.js"></script>
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens-expected.txt b/LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens-expected.txt
new file mode 100644 (file)
index 0000000..ed4e0bd
--- /dev/null
@@ -0,0 +1,31 @@
+This tests that itemProp attribute must update correctly when token have been added or removed.
+
+Created element of type: div
+itemProp.add must reflect correctly.
+PASS element.itemProp.length == 2 is true
+PASS element.itemProp.toString() == 'foo FOO' is true
+PASS element.itemProp[0] is 'foo'
+PASS element.itemProp[1] is 'FOO'
+
+itemProp.add must not make any changes if an existing token is added.
+PASS element.itemProp.length == 2 is true
+PASS element.itemProp.toString() == 'foo FOO' is true
+
+itemProp.remove must reflect correctly.
+PASS element.itemProp.length == 1 is true
+PASS element.itemProp.contains('foo') is false
+PASS element.itemProp.toString() == 'FOO' is true
+
+itemProp.remove must not make any changes if a non-existing token is removed.
+PASS element.itemProp.length == 1 is true
+PASS element.itemProp.contains('foo') is false
+PASS element.itemProp.toString() == 'FOO' is true
+
+itemProp.length must be 0 when all tokens are removed.
+PASS element.itemProp.length == 0 is true
+PASS element.itemProp.contains('foo') is false
+PASS element.itemProp.contains('FOO') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens.html b/LayoutTests/fast/dom/MicroData/itemprop-add-remove-tokens.html
new file mode 100644 (file)
index 0000000..1f68fb2
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This tests that itemProp attribute must update correctly when token have been added or removed.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {});
+
+debug("itemProp.add must reflect correctly.");
+element.itemProp.add('foo');
+element.itemProp.add('FOO');
+shouldBeTrue("element.itemProp.length == 2");
+shouldBeTrue("element.itemProp.toString() == 'foo FOO'");
+shouldBe("element.itemProp[0]", "'foo'");
+shouldBe("element.itemProp[1]", "'FOO'");
+
+debug("<br>itemProp.add must not make any changes if an existing token is added.");
+element.itemProp.add('foo');
+shouldBeTrue("element.itemProp.length == 2");
+shouldBeTrue("element.itemProp.toString() == 'foo FOO'");
+
+debug("<br>itemProp.remove must reflect correctly.");
+element.itemProp.remove('foo');
+shouldBeTrue("element.itemProp.length == 1");
+shouldBeFalse("element.itemProp.contains('foo')")
+shouldBeTrue("element.itemProp.toString() == 'FOO'");
+
+debug("<br>itemProp.remove must not make any changes if a non-existing token is removed.");
+element.itemProp.remove('foo');
+shouldBeTrue("element.itemProp.length == 1");
+shouldBeFalse("element.itemProp.contains('foo')");
+shouldBeTrue("element.itemProp.toString() == 'FOO'");
+
+debug("<br>itemProp.length must be 0 when all tokens are removed.");
+element.itemProp.remove('FOO');
+shouldBeTrue("element.itemProp.length == 0");
+shouldBeFalse("element.itemProp.contains('foo')");
+shouldBeFalse("element.itemProp.contains('FOO')");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct-expected.txt b/LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct-expected.txt
new file mode 100644 (file)
index 0000000..abdf57f
--- /dev/null
@@ -0,0 +1,29 @@
+This test that the itemProp should be correct for an element that has itemProp attribute.
+
+Created element of type: div
+Set attribute: itemprop, value: foo bar FOO FOo
+PASS element.itemProp.length == 4 is true
+PASS element.itemProp.toString() == 'foo bar FOO FOo' is true
+PASS element.itemProp.item(0) == 'foo' is true
+PASS element.itemProp.item(1) == 'bar' is true
+PASS element.itemProp[0] == 'foo' is true
+PASS element.itemProp[1] == 'bar' is true
+PASS element.itemProp.contains('bar') is true
+
+itemProp should return case-sensitive strings.
+PASS element.itemProp.item(2) == 'FOO' is true
+PASS element.itemProp[2] == 'FOO' is true
+PASS element.itemProp.item(3) == 'FOo' is true
+FAIL element.itemProp[2] == 'FOo' should be true. Was false.
+
+itemProp should not contain an undefined token.
+PASS element.itemProp.contains('test') is false
+
+itemProp.length should be 0 if element doesn't have any tokens.
+Created element of type: div
+Set attribute: itemprop, value: 
+PASS element1.itemProp.length == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html b/LayoutTests/fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html
new file mode 100644 (file)
index 0000000..ee6cfab
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test that the itemProp should be correct for an element that has itemProp attribute.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemprop: 'foo bar FOO FOo'});
+
+shouldBeTrue("element.itemProp.length == 4");
+shouldBeTrue("element.itemProp.toString() == 'foo bar FOO FOo'");
+shouldBeTrue("element.itemProp.item(0) == 'foo'");
+shouldBeTrue("element.itemProp.item(1) == 'bar'");
+shouldBeTrue("element.itemProp[0] == 'foo'");
+shouldBeTrue("element.itemProp[1] == 'bar'");
+shouldBeTrue("element.itemProp.contains('bar')");
+
+debug("<br>itemProp should return case-sensitive strings.");
+shouldBeTrue("element.itemProp.item(2) == 'FOO'");
+shouldBeTrue("element.itemProp[2] == 'FOO'");
+shouldBeTrue("element.itemProp.item(3) == 'FOo'");
+shouldBeTrue("element.itemProp[2] == 'FOo'");
+
+debug("<br>itemProp should not contain an undefined token.");
+shouldBeFalse("element.itemProp.contains('test')");
+
+debug("<br>itemProp.length should be 0 if element doesn't have any tokens.");
+var element1 = createElement('div', {itemprop: ''});
+shouldBeTrue("element1.itemProp.length == 0");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only-expected.txt b/LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only-expected.txt
new file mode 100644 (file)
index 0000000..478aa47
--- /dev/null
@@ -0,0 +1,11 @@
+This tests that itemProp and itemProp.length must be read-only.
+
+Created element of type: div
+Set attribute: itemprop, value: foo
+PASS element.itemProp = 'test'; element.itemProp.toString() == 'foo' is true
+PASS element.itemProp.contains('test') is false
+PASS element.itemProp.length = 0; element.itemProp.length == 1 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only.html b/LayoutTests/fast/dom/MicroData/itemprop-must-be-read-only.html
new file mode 100644 (file)
index 0000000..ad81e4e
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This tests that itemProp and itemProp.length must be read-only.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemprop: 'foo'});
+shouldBeTrue("element.itemProp = 'test'; element.itemProp.toString() == 'foo'");
+shouldBeFalse("element.itemProp.contains('test')");
+
+shouldBeTrue("element.itemProp.length = 0; element.itemProp.length == 1");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property-expected.txt b/LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property-expected.txt
new file mode 100644 (file)
index 0000000..a18e781
--- /dev/null
@@ -0,0 +1,11 @@
+This test ensures that the itemprop attribute must be reflected by the .itemProp property.
+
+Created element of type: div
+Set attribute: itemprop, value: http://example.com/foo
+PASS element.itemProp is defined.
+PASS element.itemProp.toString() is 'http://example.com/foo'
+PASS element.itemProp.toString() is ''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html b/LayoutTests/fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html
new file mode 100644 (file)
index 0000000..929c807
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that the itemprop attribute must be reflected by the .itemProp property.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemprop: 'http://example.com/foo'});
+
+shouldBeDefined("element.itemProp");
+shouldBe("element.itemProp.toString()", "'http://example.com/foo'");
+
+element.removeAttribute('itemProp');
+shouldBe("element.itemProp.toString()", "''");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens-expected.txt b/LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens-expected.txt
new file mode 100644 (file)
index 0000000..7484a56
--- /dev/null
@@ -0,0 +1,31 @@
+This tests that itemRef attribute must update correctly when token have been added or removed.
+
+Created element of type: div
+itemRef.add must reflect correctly.
+PASS element.itemRef.length == 2 is true
+PASS element.itemRef.toString() is 'foo FOO'
+PASS element.itemRef[0] is 'foo'
+PASS element.itemRef[1] is 'FOO'
+
+itemRef.add must not make any changes if an existing token is added.
+PASS element.itemRef.length == 2 is true
+PASS element.itemRef.toString() is 'foo FOO'
+
+itemRef.remove must reflect correctly.
+PASS element.itemRef.length == 1 is true
+PASS element.itemRef.toString() is 'FOO'
+PASS element.itemRef.contains('foo') is false
+
+itemRef.remove must not make any changes if a non-existing token is removed.
+PASS element.itemRef.length == 1 is true
+PASS element.itemRef.toString() is 'FOO'
+PASS element.itemRef.contains('foo') is false
+
+itemRef.length must be 0 when all tokens are removed.
+PASS element.itemRef.length == 0 is true
+PASS element.itemRef.contains('foo') is false
+PASS element.itemRef.contains('FOO') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens.html b/LayoutTests/fast/dom/MicroData/itemref-add-remove-tokens.html
new file mode 100644 (file)
index 0000000..822b4fb
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This tests that itemRef attribute must update correctly when token have been added or removed.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {});
+
+debug("itemRef.add must reflect correctly.");
+element.itemRef.add('foo');
+element.itemRef.add('FOO');
+shouldBeTrue("element.itemRef.length == 2");
+shouldBe("element.itemRef.toString()", "'foo FOO'");
+shouldBe("element.itemRef[0]", "'foo'");
+shouldBe("element.itemRef[1]", "'FOO'");
+
+debug("<br>itemRef.add must not make any changes if an existing token is added.");
+element.itemRef.add('foo');
+shouldBeTrue("element.itemRef.length == 2");
+shouldBe("element.itemRef.toString()", "'foo FOO'");
+
+debug("<br>itemRef.remove must reflect correctly.");
+element.itemRef.remove('foo');
+shouldBeTrue("element.itemRef.length == 1");
+shouldBe("element.itemRef.toString()", "'FOO'");
+shouldBeFalse("element.itemRef.contains('foo')");
+
+debug("<br>itemRef.remove must not make any changes if a non-existing token is removed.");
+element.itemRef.remove('foo');
+shouldBeTrue("element.itemRef.length == 1");
+shouldBe("element.itemRef.toString()", "'FOO'");
+shouldBeFalse("element.itemRef.contains('foo')");
+
+debug("<br>itemRef.length must be 0 when all tokens are removed.");
+element.itemRef.remove('FOO');
+shouldBeTrue("element.itemRef.length == 0");
+shouldBeFalse("element.itemRef.contains('foo')");
+shouldBeFalse("element.itemRef.contains('FOO')");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property-expected.txt b/LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property-expected.txt
new file mode 100644 (file)
index 0000000..135f3e8
--- /dev/null
@@ -0,0 +1,12 @@
+This test ensures that the itemref attribute must be reflected by the .itemRef property.
+
+Created element of type: div
+Set attribute: itemref, value: foo bar
+PASS element.itemRef is defined.
+PASS element.itemRef.length == 2 is true
+PASS element.itemRef.toString() == 'foo bar' is true
+PASS element.itemRef.toString() == '' is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html b/LayoutTests/fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html
new file mode 100644 (file)
index 0000000..14b7480
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that the itemref attribute must be reflected by the .itemRef property.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemref: 'foo bar'});
+shouldBeDefined("element.itemRef");
+
+shouldBeTrue("element.itemRef.length == 2");
+shouldBeTrue("element.itemRef.toString() == 'foo bar'");
+
+element.removeAttribute('itemref');
+shouldBeTrue("element.itemRef.toString() == ''");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct-expected.txt b/LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct-expected.txt
new file mode 100644 (file)
index 0000000..e8281a4
--- /dev/null
@@ -0,0 +1,30 @@
+This test that the itemRef should be correct for an element that has itemRef attribute.
+
+Created element of type: div
+Set attribute: itemref, value: foo bar FOO FOo
+PASS element.itemRef.length == 4 is true
+PASS element.itemRef.toString() == 'foo bar FOO FOo' is true
+PASS element.itemRef.item(0) == 'foo' is true
+PASS element.itemRef.item(1) == 'bar' is true
+PASS element.itemRef[0] == 'foo' is true
+PASS element.itemRef[1] == 'bar' is true
+PASS element.itemRef.contains('bar') is true
+PASS element.itemRef.contains('foo') is true
+
+itemRef should return case-sensitive strings.
+PASS element.itemRef.item(2) == 'FOO' is true
+PASS element.itemRef[2] == 'FOO' is true
+PASS element.itemRef.item(3) == 'FOo' is true
+PASS element.itemRef[3] == 'FOo' is true
+
+itemRef should not contain an undefined token.
+PASS element.itemRef.contains('test') is false
+
+itemRef.length should be 0 if element has not tokens.
+Created element of type: div
+Set attribute: itemRef, value: 
+PASS element1.itemRef.length == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct.html b/LayoutTests/fast/dom/MicroData/itemref-for-an-element-must-be-correct.html
new file mode 100644 (file)
index 0000000..66164af
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test that the itemRef should be correct for an element that has itemRef attribute.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemref: 'foo bar FOO FOo'});
+
+shouldBeTrue("element.itemRef.length == 4");
+shouldBeTrue("element.itemRef.toString() == 'foo bar FOO FOo'");
+shouldBeTrue("element.itemRef.item(0) == 'foo'");
+shouldBeTrue("element.itemRef.item(1) == 'bar'");
+shouldBeTrue("element.itemRef[0] == 'foo'");
+shouldBeTrue("element.itemRef[1] == 'bar'");
+shouldBeTrue("element.itemRef.contains('bar')");
+shouldBeTrue("element.itemRef.contains('foo')");
+
+debug("<br>itemRef should return case-sensitive strings.");
+shouldBeTrue("element.itemRef.item(2) == 'FOO'");
+shouldBeTrue("element.itemRef[2] == 'FOO'");
+shouldBeTrue("element.itemRef.item(3) == 'FOo'");
+shouldBeTrue("element.itemRef[3] == 'FOo'");
+
+debug("<br>itemRef should not contain an undefined token.");
+shouldBeFalse("element.itemRef.contains('test')");
+
+debug("<br>itemRef.length should be 0 if element has not tokens.");
+var element1 = createElement('div', {itemRef: ''});
+shouldBeTrue("element1.itemRef.length == 0");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemref-must-be-read-only-expected.txt b/LayoutTests/fast/dom/MicroData/itemref-must-be-read-only-expected.txt
new file mode 100644 (file)
index 0000000..5e95821
--- /dev/null
@@ -0,0 +1,11 @@
+This tests that itemRef and itemRef.length must be read-only.
+
+Created element of type: div
+Set attribute: itemref, value: foo
+PASS element.itemref = 'test'; element.itemRef.toString() == 'foo' is true
+PASS element.itemRef.contains('test') is false
+PASS element.itemRef.length = 0; element.itemRef.length == 1 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemref-must-be-read-only.html b/LayoutTests/fast/dom/MicroData/itemref-must-be-read-only.html
new file mode 100644 (file)
index 0000000..0f5d234
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This tests that itemRef and itemRef.length must be read-only.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemref: 'foo'});
+shouldBeTrue("element.itemref = 'test'; element.itemRef.toString() == 'foo'");
+shouldBeFalse("element.itemRef.contains('test')");
+
+shouldBeTrue("element.itemRef.length = 0; element.itemRef.length == 1");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element-expected.txt
new file mode 100644 (file)
index 0000000..59de36e
--- /dev/null
@@ -0,0 +1,12 @@
+This test ensures that itemValue must reflect the data attribute on object element.
+
+Created element of type: object
+Set attribute: itemprop, value: foo
+Set attribute: data, value: http://example.org/
+PASS objectElement.itemValue is 'http://example.org/'
+PASS objectElement.itemValue is 'http://example.net/'
+PASS objectElement.data is 'http://example.com/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html
new file mode 100644 (file)
index 0000000..e6155d0
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must reflect the data attribute on object element.</p>
+<div id="console"></div>
+<script>
+var objectElement = createElement('object', {itemprop: 'foo', data: 'http://example.org/'});
+shouldBe('objectElement.itemValue', "'http://example.org/'");
+objectElement.data = 'http://example.net/';
+shouldBe('objectElement.itemValue', "'http://example.net/'");
+objectElement.itemValue = 'http://example.com/';
+shouldBe('objectElement.data', "'http://example.com/'");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr-expected.txt
new file mode 100644 (file)
index 0000000..b365e5a
--- /dev/null
@@ -0,0 +1,30 @@
+This test ensures that itemValue must reflect the href attribute if the element is an a, area, or link element.
+
+Testing 'a' element's behavior.
+Created element of type: a
+Set attribute: itemprop, value: foo
+Set attribute: href, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.href is 'http://example.com/'
+
+Testing 'area' element's behavior.
+Created element of type: area
+Set attribute: itemprop, value: foo
+Set attribute: href, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.href is 'http://example.com/'
+
+Testing 'link' element's behavior.
+Created element of type: link
+Set attribute: itemprop, value: foo
+Set attribute: href, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.href is 'http://example.com/'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr.html b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-href-attr.html
new file mode 100644 (file)
index 0000000..a3295b9
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must reflect the href attribute if the element is an a, area, or link element.</p>
+<div id="console"></div>
+<script>
+var testElement;
+function runTest(tagName)
+{
+    debug("Testing '" + tagName + "' element's behavior.");
+    testElement = createElement(tagName, {itemprop: 'foo', href: 'http://example.org/'});
+    shouldBe("testElement.itemValue", "'http://example.org/'");
+    testElement.href = 'http://example.net/';
+    shouldBe("testElement.itemValue", "'http://example.net/'");
+    testElement.itemValue = 'http://example.com/';
+    shouldBe("testElement.href", "'http://example.com/'");
+    debug('');
+}
+
+runTest('a');
+runTest('area');
+runTest('link');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element-expected.txt
new file mode 100644 (file)
index 0000000..7cfabd5
--- /dev/null
@@ -0,0 +1,12 @@
+This test ensures that itemValue must reflect the src attribute on img element.
+
+Created element of type: img
+Set attribute: itemprop, value: foo
+Set attribute: src, value: green.jpg
+PASS imgElement.itemValue is imgElement.src
+PASS imgElement.itemValue is imgElement.src
+PASS imgElement.src is imgElement.itemValue
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html
new file mode 100644 (file)
index 0000000..94c1025
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must reflect the src attribute on img element.</p>
+<div id="console"></div>
+<script>
+var imgElement = createElement('img', {itemprop: 'foo', src: 'green.jpg'});
+shouldBe('imgElement.itemValue', 'imgElement.src');
+imgElement.src = 'red.jpg';
+shouldBe('imgElement.itemValue', "imgElement.src");
+imgElement.itemValue = 'blue.jpeg';
+shouldBe('imgElement.src', "imgElement.itemValue");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element-expected.txt
new file mode 100644 (file)
index 0000000..58d987a
--- /dev/null
@@ -0,0 +1,12 @@
+This test ensures that itemValue must reflect the content attribute on meta element.
+
+Created element of type: meta
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS metaElement.itemValue is 'test'
+PASS metaElement.itemValue is 'retest'
+PASS metaElement.content is 'bar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html
new file mode 100644 (file)
index 0000000..6940cd1
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must reflect the content attribute on meta element.</p>
+<div id="console"></div>
+<script>
+var metaElement = createElement('meta', {itemprop: 'foo',content: 'test'});
+shouldBe('metaElement.itemValue', "'test'");
+metaElement.content = 'retest';
+shouldBe('metaElement.itemValue', "'retest'");
+metaElement.itemValue = 'bar';
+shouldBe('metaElement.content', "'bar'");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr-expected.txt
new file mode 100644 (file)
index 0000000..270eef0
--- /dev/null
@@ -0,0 +1,54 @@
+This test ensures that itemValue must reflect the src attribute if the element is an audio, embed, iframe, source, track, or video element.
+
+Testing 'audio' element's behavior.
+Created element of type: audio
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+Testing 'embed' element's behavior.
+Created element of type: embed
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+Testing 'iframe' element's behavior.
+Created element of type: iframe
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+Testing 'source' element's behavior.
+Created element of type: source
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+Testing 'track' element's behavior.
+Created element of type: track
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+Testing 'video' element's behavior.
+Created element of type: video
+Set attribute: itemprop, value: foo
+Set attribute: src, value: http://example.org/
+PASS testElement.itemValue is 'http://example.org/'
+PASS testElement.itemValue is 'http://example.net/'
+PASS testElement.src is 'http://example.com/'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr.html b/LayoutTests/fast/dom/MicroData/itemvalue-reflects-the-src-attr.html
new file mode 100644 (file)
index 0000000..e9dea8e
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must reflect the src attribute if the element is an audio, embed, iframe, source, track, or video element.</p>
+<div id="console"></div>
+<script>
+var testElement;
+function runTest(tagName)
+{
+    debug("Testing '" + tagName + "' element's behavior.");
+    testElement = createElement(tagName, {itemprop: 'foo', src: 'http://example.org/'});
+    shouldBe("testElement.itemValue", "'http://example.org/'");
+    testElement.src = 'http://example.net/';
+    shouldBe("testElement.itemValue", "'http://example.net/'");
+    testElement.itemValue = 'http://example.com/';
+    shouldBe("testElement.src", "'http://example.com/'");
+    debug('');
+}
+
+runTest('audio');
+runTest('embed');
+runTest('iframe');
+runTest('source');
+runTest('track');
+runTest('video');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself-expected.txt
new file mode 100644 (file)
index 0000000..c38be70
--- /dev/null
@@ -0,0 +1,97 @@
+This test ensures that itemValue must return the element itself if the element has an itemscope attribute
+
+Testing 'meta' element's behavior.
+Created element of type: meta
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'audio' element's behavior.
+Created element of type: audio
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'embed' element's behavior.
+Created element of type: embed
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'iframe' element's behavior.
+Created element of type: iframe
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'img' element's behavior.
+Created element of type: img
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'source' element's behavior.
+Created element of type: source
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'track' element's behavior.
+Created element of type: track
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'video' element's behavior.
+Created element of type: video
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'a' element's behavior.
+Created element of type: a
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'area' element's behavior.
+Created element of type: area
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'link' element's behavior.
+Created element of type: link
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'object' element's behavior.
+Created element of type: object
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+Testing 'div' element's behavior.
+Created element of type: div
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+PASS testElement.itemValue is testElement
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself.html b/LayoutTests/fast/dom/MicroData/itemvalue-returns-element-itself.html
new file mode 100644 (file)
index 0000000..42092c4
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that itemValue must return the element itself if the element has an itemscope attribute</p>
+<div id="console"></div>
+<script>
+var testElement;
+function runTest(tagName) {
+    debug("Testing '" + tagName + "' element's behavior.");
+    testElement = createElement(tagName, {itemscope: 'itemscope', itemprop: 'foo', content: 'test'});
+    shouldBe("testElement.itemValue", "testElement");
+    debug('');
+}
+
+runTest('meta');
+runTest('audio');
+runTest('embed');
+runTest('iframe');
+runTest('img');
+runTest('source');
+runTest('track');
+runTest('video');
+runTest('a');
+runTest('area');
+runTest('link');
+runTest('object');
+runTest('div');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-returns-null-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-returns-null-expected.txt
new file mode 100644 (file)
index 0000000..a55acc5
--- /dev/null
@@ -0,0 +1,66 @@
+This tests that itemValue must be null if the element does not have an itemprop attribute
+
+Created element of type: meta
+Set attribute: content, value: test
+PASS createElement('meta', {content: 'test'}).itemValue == null is true
+
+Created element of type: audio
+Set attribute: src, value: test
+PASS createElement('audio', {src: 'test'}).itemValue == null is true
+
+Created element of type: embed
+Set attribute: src, value: test
+PASS createElement('embed', {src: 'test'}).itemValue == null is true
+
+Created element of type: iframe
+Set attribute: src, value: test
+PASS createElement('iframe', {src: 'test'}).itemValue == null is true
+
+Created element of type: img
+Set attribute: src, value: test
+PASS createElement('img', {src: 'test'}).itemValue == null is true
+
+Created element of type: source
+Set attribute: src, value: test
+PASS createElement('source', {src: 'test'}).itemValue == null is true
+
+Created element of type: track
+Set attribute: src, value: test
+PASS createElement('track', {src: 'test'}).itemValue == null is true
+
+Created element of type: video
+Set attribute: src, value: test
+PASS createElement('video', {src: 'test'}).itemValue == null is true
+
+Created element of type: a
+Set attribute: href, value: test
+PASS createElement('a', {href: 'test'}).itemValue == null is true
+
+Created element of type: area
+Set attribute: href, value: test
+PASS createElement('area', {href: 'test'}).itemValue == null is true
+
+Created element of type: link
+Set attribute: href, value: test
+PASS createElement('link', {href: 'test'}).itemValue == null is true
+
+Created element of type: object
+Set attribute: data, value: test
+PASS createElement('object', {data: 'test'}).itemValue == null is true
+
+Created element of type: time
+PASS createElement('time', {}).itemValue == null is true
+
+Created element of type: time
+Set attribute: datetime, value: test
+PASS createElement('time', {datetime: 'test'}).itemValue == null is true
+
+Created element of type: div
+PASS createElement('div', {}, 'test').itemValue == null is true
+
+Created element of type: madeuponthespot
+PASS createElement('madeuponthespot', {}, 'test').itemValue == null is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-returns-null.html b/LayoutTests/fast/dom/MicroData/itemvalue-returns-null.html
new file mode 100644 (file)
index 0000000..ef89161
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This tests that itemValue must be null if the element does not have an itemprop attribute</p>
+<div id="console"></div>
+<script>
+shouldBeTrue("createElement('meta', {content: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('audio', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('embed', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('iframe', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('img', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('source', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('track', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('video', {src: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('a', {href: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('area', {href: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('link', {href: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('object', {data: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('time', {}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('time', {datetime: 'test'}).itemValue == null");
+debug('');
+shouldBeTrue("createElement('div', {}, 'test').itemValue == null");
+debug('');
+shouldBeTrue("createElement('madeuponthespot', {}, 'test').itemValue == null");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001-expected.txt
new file mode 100644 (file)
index 0000000..01f4752
--- /dev/null
@@ -0,0 +1,97 @@
+This test ensures that writing to itemValue must throw an INVALID_ACCESS_ERR error if the element has an itemscope attribute.
+
+Testing 'meta' element's behavior.
+Created element of type: meta
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'audio' element's behavior.
+Created element of type: audio
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'embed' element's behavior.
+Created element of type: embed
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'iframe' element's behavior.
+Created element of type: iframe
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'img' element's behavior.
+Created element of type: img
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'source' element's behavior.
+Created element of type: source
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'track' element's behavior.
+Created element of type: track
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'video' element's behavior.
+Created element of type: video
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'a' element's behavior.
+Created element of type: a
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'area' element's behavior.
+Created element of type: area
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'link' element's behavior.
+Created element of type: link
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'object' element's behavior.
+Created element of type: object
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'div' element's behavior.
+Created element of type: div
+Set attribute: itemscope, value: itemscope
+Set attribute: itemprop, value: foo
+Set attribute: content, value: test
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html b/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html
new file mode 100644 (file)
index 0000000..79f5d61
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that writing to itemValue must throw an INVALID_ACCESS_ERR error if the element has an itemscope attribute.</p>
+<div id="console"></div>
+<script>
+var exceptionCode;
+function runTest(tagName)
+{
+    debug("Testing '" + tagName + "' element's behavior.");
+    exceptionCode = undefined;
+    testElement = createElement(tagName, {itemscope: 'itemscope', itemprop: 'foo', content: 'test'});
+    try {
+        testElement.itemValue = 'test'
+    } catch (exception) {
+        exceptionCode = exception.code;
+    }
+
+    if (exceptionCode == DOMException.INVALID_ACCESS_ERR)
+        debug("TEST SUCCEEDED: Got the expected exception (" + exceptionCode + ") INVALID_ACCESS_ERR.<br>");
+    else
+        debug("TEST FAILED: Should've thrown INVALID_ACCESS_ERR but threw " + exceptionCode + ".<br>");
+}
+
+runTest('meta');
+runTest('audio');
+runTest('embed');
+runTest('iframe');
+runTest('img');
+runTest('source');
+runTest('track');
+runTest('video');
+runTest('a');
+runTest('area');
+runTest('link');
+runTest('object');
+runTest('div');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002-expected.txt b/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002-expected.txt
new file mode 100644 (file)
index 0000000..64ac84f
--- /dev/null
@@ -0,0 +1,71 @@
+This test ensures that writing to itemValue must throw an INVALID_ACCESS_ERR error if the element does not have an itemprop attribute.
+
+Testing 'meta' element's behavior.
+Created element of type: meta
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'audio' element's behavior.
+Created element of type: audio
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'embed' element's behavior.
+Created element of type: embed
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'iframe' element's behavior.
+Created element of type: iframe
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'img' element's behavior.
+Created element of type: img
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'source' element's behavior.
+Created element of type: source
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'track' element's behavior.
+Created element of type: track
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'video' element's behavior.
+Created element of type: video
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'a' element's behavior.
+Created element of type: a
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'area' element's behavior.
+Created element of type: area
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'link' element's behavior.
+Created element of type: link
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'object' element's behavior.
+Created element of type: object
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+Testing 'div' element's behavior.
+Created element of type: div
+Set attribute: content, value: testContent
+TEST SUCCEEDED: Got the expected exception (15) INVALID_ACCESS_ERR.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html b/LayoutTests/fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html
new file mode 100644 (file)
index 0000000..1284919
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/microdata-common.js"></script>
+</head>
+<body>
+<p>This test ensures that writing to itemValue must throw an INVALID_ACCESS_ERR error if the element does not have an itemprop attribute.</p>
+<div id="console"></div>
+<script>
+var exceptionCode;
+function runTest(tagName)
+{
+    debug("Testing '" + tagName + "' element's behavior.");
+    exceptionCode = undefined;
+    testElement = createElement(tagName, {content: 'testContent'});
+    try {
+        testElement.itemValue = 'test'
+    } catch (exception) {
+        exceptionCode = exception.code;
+    }
+
+    if (exceptionCode == DOMException.INVALID_ACCESS_ERR)
+        debug("TEST SUCCEEDED: Got the expected exception (" + exceptionCode + ") INVALID_ACCESS_ERR.<br>");
+    else
+        debug("TEST FAILED: Should've thrown INVALID_ACCESS_ERR but threw " + exceptionCode + ".<br>");
+}
+
+runTest('meta');
+runTest('audio');
+runTest('embed');
+runTest('iframe');
+runTest('img');
+runTest('source');
+runTest('track');
+runTest('video');
+runTest('a');
+runTest('area');
+runTest('link');
+runTest('object');
+runTest('div');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html
index ea8bcc4..6925a85 100644 (file)
@@ -1,19 +1,21 @@
 // this function creates element with specified property and contents.
-function createElem(type,props,contents) {
+function createElement(type, props, contents) {
     if (window.layoutTestController)
       layoutTestController.dumpAsText();
 
-    var elem = document.createElement(type);
+    var element = document.createElement(type);
 
-    for( var i in props ) {
-      if( props.hasOwnProperty(i) ) {
-        elem.setAttribute(i,props[i]);
+    debug('Created element of type: ' + type);
+    for (var i in props) {
+      if (props.hasOwnProperty(i)) {
+        debug('Set attribute: ' + i + ', value: ' + props[i]);
+        element.setAttribute(i,props[i]);
       }
     }
-    if( contents ) {
-      elem.innerHTML = contents;
+    if (contents) {
+      element.innerHTML = contents;
     }
-    return elem;
+    return element;
 }
 
 
@@ -22,21 +24,20 @@ function runTest(collection, elements, title) {
   if (window.layoutTestController)
     layoutTestController.dumpAsText();
 
-  document.write(title + ': ');
   pass = true;
 
   if (collection.length != elements.length) {
     pass = false
-    document.write('FAIL - expected ' + elements.length + ' elements but got ' + collection.length + " elements. ");
+    debug('FAIL - expected ' + elements.length + ' elements but got ' + collection.length + " elements. ");
   }
   for(var i = 0, max = collection.length > elements.length ? elements.length : collection.length; i < max; i++) {
     if(collection[i] != elements[i]) {
+      debug(title);
       pass = false
-      document.write('FAIL - expected element : ' + elements[i].tagName + " but got element :" + collection[i].tagName);
-      document.write('FAIL - expected element with id: ' + elements[i].id + " but got element with id:" + collection[i].id);
+      debug('FAIL - expected element : ' + elements[i].tagName + " but got element :" + collection[i].tagName);
+      debug('FAIL - expected element with id: ' + elements[i].id + " but got element with id:" + collection[i].id);
     }
   }
   if (pass)
-    document.write('PASS');
-  document.write('<br>');
+    debug(title + ': PASS');
 }
index 8202fa9..31127f9 100644 (file)
@@ -803,6 +803,7 @@ SET(WebCore_SOURCES
     html/LabelsNodeList.cpp
     html/LinkRelAttribute.cpp
     html/MediaDocument.cpp
+    html/MicroDataItemValue.cpp
     html/MonthInputType.cpp
     html/NumberInputType.cpp
     html/PasswordInputType.cpp
index 176c974..4453b12 100755 (executable)
@@ -1,3 +1,124 @@
+2011-10-24  Arko Saha  <arko@motorola.com>
+
+        Microdata: Add itemprop, itemref, itemvalue attributes.
+        https://bugs.webkit.org/show_bug.cgi?id=69839
+
+        Reviewed by Ryosuke Niwa.
+
+        Tests: fast/dom/MicroData/itemprop-add-remove-tokens.html
+               fast/dom/MicroData/itemprop-for-an-element-must-be-correct.html
+               fast/dom/MicroData/itemprop-must-be-read-only.html
+               fast/dom/MicroData/itemprop-reflected-by-itemProp-property.html
+               fast/dom/MicroData/itemref-add-remove-tokens.html
+               fast/dom/MicroData/itemref-attribute-reflected-by-itemRef-property.html
+               fast/dom/MicroData/itemref-for-an-element-must-be-correct.html
+               fast/dom/MicroData/itemref-must-be-read-only.html
+               fast/dom/MicroData/itemvalue-reflects-data-attr-on-object-element.html
+               fast/dom/MicroData/itemvalue-reflects-href-attr.html
+               fast/dom/MicroData/itemvalue-reflects-src-attribute-on-img-element.html
+               fast/dom/MicroData/itemvalue-reflects-the-content-attr-on-meta-element.html
+               fast/dom/MicroData/itemvalue-reflects-the-src-attr.html
+               fast/dom/MicroData/itemvalue-returns-element-itself.html
+               fast/dom/MicroData/itemvalue-returns-null.html
+               fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-001.html
+               fast/dom/MicroData/itemvalue-throws-excpetion-onsetting-002.html
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * bindings/js/JSHTMLElementCustom.cpp:
+        (WebCore::toJS):
+        (WebCore::JSHTMLElement::itemValue):
+        (WebCore::JSHTMLElement::setItemValue):
+        * bindings/v8/custom/V8HTMLElementCustom.cpp:
+        (WebCore::toV8Object):
+        (WebCore::V8HTMLElement::itemValueAccessorGetter):
+        (WebCore::V8HTMLElement::itemValueAccessorSetter):
+        * dom/MicroDataItemList.cpp:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::itemValueText):
+        (WebCore::HTMLAnchorElement::setItemValueText):
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::itemValueText):
+        (WebCore::HTMLAreaElement::setItemValueText):
+        * html/HTMLAreaElement.h:
+        * html/HTMLAttributeNames.in:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseMappedAttribute):
+        (WebCore::HTMLElement::itemProp): Returns element's itemprop content attribute.
+        (WebCore::HTMLElement::setItemProp): Sets itemprop value on changing elemet's
+        itemprop attribute.
+        (WebCore::HTMLElement::itemRef): Returns element's itemref content attribute.
+        (WebCore::HTMLElement::setItemRef): Sets itemref value on changing elemet's
+        itemref attribute.
+        (WebCore::HTMLElement::setItemValue): Sets element's itemvalue. If the element has no
+        itemprop attribute or if element has an itemscope attribute, it throws INVALID_ACCESS_ERR
+        exception.
+        (WebCore::HTMLElement::itemValue): Returns the elements itemvalue.
+
+        If the element has no itemprop attribute it returns null.
+        If the element has an itemscope attribute, it returns the element itself.
+        If the element is a meta element: It acts as it would if it was reflecting the element's
+        content content attribute.
+        If the element is an audio, embed, iframe, img, source, track, or video element: It acts
+        as it would if it was reflecting the element's src content attribute.
+        If the element is an a, area, or link element: It act as it would if it was reflecting the
+        href content attribute.
+        If the element is an object element: It acts as  it would if it was reflecting the element's
+        data content attribute.
+
+        (WebCore::HTMLElement::itemValueText):
+        (WebCore::HTMLElement::setItemValueText):
+        * html/HTMLElement.h:
+        * html/HTMLElement.idl:
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::itemValueText):
+        (WebCore::HTMLEmbedElement::setItemValueText):
+        * html/HTMLEmbedElement.h:
+        * html/HTMLIFrameElement.cpp:
+        (WebCore::HTMLIFrameElement::itemValueText):
+        (WebCore::HTMLIFrameElement::setItemValueText):
+        * html/HTMLIFrameElement.h:
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::itemValueText):
+        (WebCore::HTMLImageElement::setItemValueText):
+        * html/HTMLImageElement.h:
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::itemValueText):
+        (WebCore::HTMLLinkElement::setItemValueText):
+        * html/HTMLLinkElement.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::itemValueText):
+        (WebCore::HTMLMediaElement::setItemValueText):
+        * html/HTMLMediaElement.h:
+        * html/HTMLMetaElement.cpp:
+        (WebCore::HTMLMetaElement::itemValueText):
+        (WebCore::HTMLMetaElement::setItemValueText):
+        * html/HTMLMetaElement.h:
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::itemValueText):
+        (WebCore::HTMLObjectElement::setItemValueText):
+        * html/HTMLObjectElement.h:
+        * html/HTMLSourceElement.cpp:
+        (WebCore::HTMLSourceElement::itemValueText):
+        (WebCore::HTMLSourceElement::setItemValueText):
+        * html/HTMLSourceElement.h:
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::itemValueText):
+        (WebCore::HTMLTrackElement::setItemValueText):
+        * html/HTMLTrackElement.h:
+        * html/MicroDataItemValue.cpp: Added.
+        (WebCore::MicroDataItemValue::MicroDataItemValue):
+        (WebCore::MicroDataItemValue::createFromString):
+        (WebCore::MicroDataItemValue::createFromNode):
+        * html/MicroDataItemValue.h: Added.
+        (WebCore::MicroDataItemValue::isNode):
+        (WebCore::MicroDataItemValue::getNode):
+        (WebCore::MicroDataItemValue::getString):
+
 2011-10-24  Joseph Pecoraro  <joepeck@webkit.org>
 
         Remove unused instance variable
index abdb1ec..15f590e 100644 (file)
@@ -1852,6 +1852,8 @@ webcore_sources += \
        Source/WebCore/html/MediaDocument.cpp \
        Source/WebCore/html/MediaDocument.h \
        Source/WebCore/html/MediaError.h \
+       Source/WebCore/html/MicroDataItemValue.cpp \
+       Source/WebCore/html/MicroDataItemValue.h \
        Source/WebCore/html/MonthInputType.cpp \
        Source/WebCore/html/MonthInputType.h \
        Source/WebCore/html/NumberInputType.cpp \
index ebea4ba..f9cecf4 100644 (file)
             'html/MediaDocument.cpp',
             'html/MediaDocument.h',
             'html/MediaError.h',
+            'html/MicroDataItemValue.cpp',
+            'html/MicroDataItemValue.h',
+            'html/MutableTextTrack.cpp',
+            'html/MutableTextTrack.h',
             'html/MonthInputType.cpp',
             'html/MonthInputType.h',
             'html/NumberInputType.cpp',
index d59190e..c5ef39d 100644 (file)
@@ -758,6 +758,7 @@ SOURCES += \
     html/LabelsNodeList.cpp \
     html/LinkRelAttribute.cpp \
     html/MediaDocument.cpp \
+    html/MicroDataItemValue.cpp \
     html/MonthInputType.cpp \
     html/NumberInputType.cpp \
     html/PasswordInputType.cpp \
@@ -1810,6 +1811,8 @@ HEADERS += \
     html/LinkRelAttribute.h \
     html/LoadableTextTrack.h \
     html/MediaDocument.h \
+    html/MicroDataItemValue.h \
+    html/MutableTextTrack.h \
     html/PluginDocument.h \
     html/StepRange.h \
     html/TextDocument.h \
index e821a7a..f598069 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\html\MicroDataItemValue.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\html\MicroDataItemValue.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\fileapi\Metadata.h"
                                >
                        </File>
index ff55f1a..e265903 100644 (file)
                4ACBC0BE12713CBD0094F9B2 /* ClassList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0BC12713CBD0094F9B2 /* ClassList.cpp */; };
                4ACBC0BF12713CBD0094F9B2 /* ClassList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0BD12713CBD0094F9B2 /* ClassList.h */; };
                4ACBC0C312713CCA0094F9B2 /* DOMSettableTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0C012713CCA0094F9B2 /* DOMSettableTokenList.cpp */; };
-               4ACBC0C412713CCA0094F9B2 /* DOMSettableTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0C112713CCA0094F9B2 /* DOMSettableTokenList.h */; };
+               4ACBC0C412713CCA0094F9B2 /* DOMSettableTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0C112713CCA0094F9B2 /* DOMSettableTokenList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0C812713D0A0094F9B2 /* JSDOMSettableTokenList.cpp */; };
                4ACBC0CB12713D0A0094F9B2 /* JSDOMSettableTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0C912713D0A0094F9B2 /* JSDOMSettableTokenList.h */; };
                4AD01000127E63100015035F /* JSHTMLOutputElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD00FFF127E63100015035F /* JSHTMLOutputElementCustom.cpp */; };
                9B32CDAA13DF7FA900F34D13 /* RenderedPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */; };
                9B375EDA14478A0100F3CAE5 /* MicroDataItemList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B375ED814478A0100F3CAE5 /* MicroDataItemList.cpp */; };
                9B375EDB14478A0100F3CAE5 /* MicroDataItemList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B375ED914478A0100F3CAE5 /* MicroDataItemList.h */; };
+               9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */; };
                9B417064125662B3006B28FC /* ApplyBlockElementCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9B417065125662B3006B28FC /* ApplyBlockElementCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B417063125662B3006B28FC /* ApplyBlockElementCommand.cpp */; };
                9B6C41531344949000085B62 /* StringWithDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6C41521344949000085B62 /* StringWithDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
                98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; };
                9B0FB18F140DB5790022588F /* HTTPValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPValidation.cpp; sourceTree = "<group>"; };
                9B0FB190140DB5790022588F /* HTTPValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPValidation.h; sourceTree = "<group>"; };
+               9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroDataItemValue.cpp; sourceTree = "<group>"; };
+               9B2F7CF814562120007F8B50 /* MicroDataItemValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MicroDataItemValue.h; sourceTree = "<group>"; };
                9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderedPosition.h; sourceTree = "<group>"; };
                9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderedPosition.cpp; sourceTree = "<group>"; };
                9B375ED814478A0100F3CAE5 /* MicroDataItemList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroDataItemList.cpp; sourceTree = "<group>"; };
                9B375ED914478A0100F3CAE5 /* MicroDataItemList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MicroDataItemList.h; sourceTree = "<group>"; };
+               9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMSettableTokenList.h; sourceTree = "<group>"; };
                9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplyBlockElementCommand.h; sourceTree = "<group>"; };
                9B417063125662B3006B28FC /* ApplyBlockElementCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyBlockElementCommand.cpp; sourceTree = "<group>"; };
                9B6C41521344949000085B62 /* StringWithDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringWithDirection.h; sourceTree = "<group>"; };
                656580EC09D12B20000E61D7 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               1A1414B313A0F0500019996C /* WebKitFontFamilyNames.cpp */,
-                               1A1414B413A0F0500019996C /* WebKitFontFamilyNames.h */,
                                656581AC09D14EE6000E61D7 /* CharsetData.cpp */,
                                E406F3FB1198307D009D59D6 /* ColorData.cpp */,
                                6565814409D13043000E61D7 /* CSSGrammar.cpp */,
                                E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */,
                                6565814709D13043000E61D7 /* CSSValueKeywords.gperf */,
                                6565814809D13043000E61D7 /* CSSValueKeywords.h */,
+                               9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */,
                                9766504E144FBFFE00F6BB51 /* EventFactory.cpp */,
                                970B72A5145008EB00F00A37 /* EventHeaders.h */,
                                970B7289144FFAC600F00A37 /* EventInterfaces.h */,
                                6565814C09D13043000E61D7 /* tokenizer.cpp */,
                                656581AE09D14EE6000E61D7 /* UserAgentStyleSheets.h */,
                                656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */,
+                               1A1414B313A0F0500019996C /* WebKitFontFamilyNames.cpp */,
+                               1A1414B413A0F0500019996C /* WebKitFontFamilyNames.h */,
                                656581EA09D1508D000E61D7 /* XLinkNames.cpp */,
                                656581EB09D1508D000E61D7 /* XLinkNames.h */,
                                A833C80A0A2CF25600D57664 /* XMLNames.cpp */,
                                97205AB41239291000B17380 /* MediaDocument.h */,
                                E446139B0CD6331000FADA75 /* MediaError.h */,
                                E446139C0CD6331000FADA75 /* MediaError.idl */,
+                               9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */,
+                               9B2F7CF814562120007F8B50 /* MicroDataItemValue.h */,
                                F55B3D911251F12D003EF269 /* MonthInputType.cpp */,
                                F55B3D921251F12D003EF269 /* MonthInputType.h */,
                                F55B3D931251F12D003EF269 /* NumberInputType.cpp */,
                                A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */,
                                970B728A144FFAC600F00A37 /* EventInterfaces.h in Headers */,
                                970B72A6145008EB00F00A37 /* EventHeaders.h in Headers */,
+                               9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 0d2bf94..dc160d6 100644 (file)
 #include "Document.h"
 #include "HTMLFormElement.h"
 
+#if ENABLE(MICRODATA)
+#include "MicroDataItemValue.h"
+#endif
+
 namespace WebCore {
 
 using namespace JSC;
 
+#if ENABLE(MICRODATA)
+static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, MicroDataItemValue* itemValue)
+{
+    if (!itemValue)
+        return jsNull();
+    if (itemValue->isNode())
+        return toJS(exec, globalObject, itemValue->getNode());
+    return jsString(exec, itemValue->getString());
+}
+#endif
+
 ScopeChainNode* JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChainNode* scope) const
 {
     HTMLElement* element = impl();
@@ -48,4 +63,20 @@ ScopeChainNode* JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChain
     return scope->push(asObject(toJS(exec, globalObject(), element)));
 }
 
+#if ENABLE(MICRODATA)
+JSValue JSHTMLElement::itemValue(ExecState* exec) const
+{
+    HTMLElement* element = impl();
+    return toJS(exec, globalObject(), WTF::getPtr(element->itemValue()));
+}
+
+void JSHTMLElement::setItemValue(ExecState* exec, JSValue value)
+{
+    HTMLElement* imp = impl();
+    ExceptionCode ec = 0;
+    imp->setItemValue(valueToStringWithNullCheck(exec, value), ec);
+    setDOMException(exec, ec);
+}
+#endif
+
 } // namespace WebCore
index 0eb55e9..1ca6bd3 100644 (file)
 
 #include "V8HTMLElementWrapperFactory.h"
 
+#if ENABLE(MICRODATA)
+#include "MicroDataItemValue.h"
+#include "V8Binding.h"
+#endif
+
 namespace WebCore {
 
+#if ENABLE(MICRODATA)
+static v8::Handle<v8::Value> toV8Object(MicroDataItemValue* itemValue)
+{
+    if (!itemValue)
+        return v8::Null();
+
+    if (itemValue->isNode())
+        return toV8(itemValue->getNode());
+
+    return v8String(itemValue->getString());
+}
+#endif
+
 v8::Handle<v8::Value> toV8(HTMLElement* impl, bool forceNewObject)
 {
     if (!impl)
@@ -42,4 +60,21 @@ v8::Handle<v8::Value> toV8(HTMLElement* impl, bool forceNewObject)
     return createV8HTMLWrapper(impl, forceNewObject);
 }
 
+#if ENABLE(MICRODATA)
+v8::Handle<v8::Value> V8HTMLElement::itemValueAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    HTMLElement* impl = V8HTMLElement::toNative(info.Holder());
+    return toV8Object(impl->itemValue().get());
+}
+
+void V8HTMLElement::itemValueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+    HTMLElement* impl = V8HTMLElement::toNative(info.Holder());
+    ExceptionCode ec = 0;
+    impl->setItemValue(toWebCoreString(value), ec);
+    if (ec)
+        V8Proxy::setDOMException(ec);
+}
+#endif
+
 } // namespace WebCore
index cfab71e..3daeff5 100644 (file)
 #include "HTMLElement.h"
 #include "HTMLNames.h"
 
-using namespace HTMLNames;
-
 namespace WebCore {
 
+using namespace HTMLNames;
+
 MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& typeNames)
     : DynamicNodeList(rootNode)
     , m_typeNames(typeNames, m_rootNode->document()->inQuirksMode())
index 3433637..40e38a5 100644 (file)
@@ -586,4 +586,16 @@ void handleLinkClick(Event* event, Document* document, const String& url, const
     frame->loader()->urlSelected(document->completeURL(url), target, event, false, false, hideReferrer ? NoReferrer : SendReferrer);
 }
 
+#if ENABLE(MICRODATA)
+String HTMLAnchorElement::itemValueText() const
+{
+    return getURLAttribute(hrefAttr);
+}
+
+void HTMLAnchorElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(hrefAttr, value, ec);
+}
+#endif
+
 }
index 9277ed3..1661843 100644 (file)
@@ -125,6 +125,11 @@ private:
     static EventType eventType(Event*);
     bool treatLinkAsLiveForEventType(EventType) const;
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     RefPtr<Element> m_rootEditableElementForSelectionOnMouseDown;
     bool m_wasShiftKeyDownOnMouseDown : 1;
     uint32_t m_linkRelations : 31;
index c2e8d6e..7628323 100644 (file)
@@ -246,4 +246,16 @@ String HTMLAreaElement::target() const
     return getAttribute(targetAttr);
 }
 
+#if ENABLE(MICRODATA)
+String HTMLAreaElement::itemValueText() const
+{
+    return getURLAttribute(hrefAttr);
+}
+
+void HTMLAreaElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(hrefAttr, value, ec);
+}
+#endif
+
 }
index c43ba6d..8173918 100644 (file)
@@ -58,7 +58,12 @@ private:
     virtual bool isFocusable() const;
     virtual void updateFocusAppearance(bool /*restorePreviousSelection*/);
     virtual void setFocus(bool);
-    
+
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     enum Shape { Default, Poly, Rect, Circle, Unknown };
     Path getRegion(const LayoutSize&) const;
     void invalidateCachedRegion();
index 2310b13..f1e354b 100644 (file)
@@ -123,6 +123,7 @@ indeterminate
 ismap
 itemid
 itemprop
+itemref
 itemscope
 itemtype
 keytype
index 346c4b5..e123080 100644 (file)
@@ -3,6 +3,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2011 Motorola Mobility. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 
+#if ENABLE(MICRODATA)
+#include "MicroDataItemValue.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -197,6 +202,10 @@ void HTMLElement::parseMappedAttribute(Attribute* attr)
         } else if (equalIgnoringCase(value, "false"))
             addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueNone);
 #if ENABLE(MICRODATA)
+    } else if (attr->name() == itempropAttr) {
+        setItemProp(attr->value());
+    } else if (attr->name() == itemrefAttr) {
+        setItemRef(attr->value());
     } else if (attr->name() == itemtypeAttr) {
         itemTypeAttributeChanged();
 #endif
@@ -984,6 +993,71 @@ void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC
     }
 }
 
+#if ENABLE(MICRODATA)
+PassRefPtr<DOMSettableTokenList> HTMLElement::itemProp() const
+{
+    if (!m_itemProp)
+        m_itemProp = DOMSettableTokenList::create();
+
+    return m_itemProp;
+}
+
+void HTMLElement::setItemProp(const String& value)
+{
+    if (!m_itemProp)
+        m_itemProp = DOMSettableTokenList::create();
+
+    m_itemProp->setValue(value);
+}
+
+PassRefPtr<DOMSettableTokenList> HTMLElement::itemRef() const
+{
+    if (!m_itemRef)
+        m_itemRef = DOMSettableTokenList::create();
+
+    return m_itemRef;
+}
+
+void HTMLElement::setItemRef(const String& value)
+{
+    if (!m_itemRef)
+        m_itemRef = DOMSettableTokenList::create();
+
+    m_itemRef->setValue(value);
+}
+
+void HTMLElement::setItemValue(const String& value, ExceptionCode& ec)
+{
+    if (!hasAttribute(itempropAttr) || hasAttribute(itemscopeAttr)) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    setItemValueText(value, ec);
+}
+
+PassRefPtr<MicroDataItemValue> HTMLElement::itemValue() const
+{
+    if (!hasAttribute(itempropAttr))
+        return 0;
+
+    if (hasAttribute(itemscopeAttr))
+        return MicroDataItemValue::createFromNode(const_cast<HTMLElement* const>(this));
+
+    return MicroDataItemValue::createFromString(itemValueText());
+}
+
+String HTMLElement::itemValueText() const
+{
+    return textContent(true);
+}
+
+void HTMLElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setTextContent(value, ec);
+}
+#endif
+
 } // namespace WebCore
 
 #ifndef NDEBUG
index e439c43..d58b3f5 100644 (file)
 
 #include "StyledElement.h"
 
+#if ENABLE(MICRODATA)
+#include "DOMSettableTokenList.h"
+#endif
+
 namespace WebCore {
 
 class DocumentFragment;
 class HTMLCollection;
 class HTMLFormElement;
-                       
+
+#if ENABLE(MICRODATA)
+class MicroDataItemValue;
+#endif
+
 class HTMLElement : public StyledElement {
 public:
     static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*);
@@ -81,6 +89,14 @@ public:
 
     TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const;
 
+#if ENABLE(MICRODATA)
+    PassRefPtr<DOMSettableTokenList> itemRef() const;
+    PassRefPtr<DOMSettableTokenList> itemProp() const;
+
+    void setItemValue(const String&, ExceptionCode&);
+    PassRefPtr<MicroDataItemValue> itemValue() const;
+#endif
+
 protected:
     HTMLElement(const QualifiedName& tagName, Document*);
 
@@ -107,6 +123,17 @@ private:
     void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child);
     void adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, int childCountDelta);
     TextDirection directionality(Node** strongDirectionalityTextNode= 0) const;
+
+#if ENABLE(MICRODATA)
+    void setItemProp(const String&);
+    void setItemRef(const String&);
+
+    virtual String itemValueText() const;
+    virtual void setItemValueText(const String&, ExceptionCode&);
+
+    mutable RefPtr<DOMSettableTokenList> m_itemProp;
+    mutable RefPtr<DOMSettableTokenList> m_itemRef;
+#endif
 };
 
 inline HTMLElement* toHTMLElement(Node* node)
index 08f8c24..328f924 100644 (file)
@@ -70,6 +70,16 @@ module html {
                  attribute [Conditional=MICRODATA, Reflect] DOMString itemType;
                  attribute [Conditional=MICRODATA, Reflect] DOMString itemId;
 
+        readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemRef;
+        readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemProp;
+
+#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
+#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
+                 attribute [Conditional=MICRODATA, Custom] DOMObject itemValue
+                     setter raises(DOMException);
+#endif
+#endif
+
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
         readonly attribute DOMString titleDisplayString;
 #endif
index e3e0cf9..76f72f7 100644 (file)
@@ -277,4 +277,16 @@ void HTMLEmbedElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
     addSubresourceURL(urls, document()->completeURL(getAttribute(srcAttr)));
 }
 
+#if ENABLE(MICRODATA)
+String HTMLEmbedElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLEmbedElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
index 076981b..4485e09 100644 (file)
@@ -52,6 +52,11 @@ private:
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
     void parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues);
+
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
 };
 
 }
index 1333c8e..f8edbcf 100644 (file)
@@ -163,4 +163,16 @@ bool HTMLIFrameElement::isURLAttribute(Attribute* attr) const
     return attr->name() == srcAttr;
 }
 
+#if ENABLE(MICRODATA)
+String HTMLIFrameElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLIFrameElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
index dc522c5..0f26312 100644 (file)
@@ -46,6 +46,11 @@ private:
     
     virtual bool isURLAttribute(Attribute*) const;
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     AtomicString m_name;
 };
 
index 8eebc49..9b0819c 100644 (file)
@@ -403,4 +403,16 @@ bool HTMLImageElement::isServerMap() const
     return document()->completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)).isEmpty();
 }
 
+#if ENABLE(MICRODATA)
+String HTMLImageElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLImageElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
index e8adeed..9bec9d8 100644 (file)
@@ -102,6 +102,11 @@ private:
     virtual void insertedIntoTree(bool deep);
     virtual void removedFromTree(bool deep);
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     HTMLImageLoader m_imageLoader;
     HTMLFormElement* m_form;
     AtomicString m_name;
index 273f895..ed8ad2d 100644 (file)
@@ -448,4 +448,16 @@ void HTMLLinkElement::setSizes(const String& value)
     m_sizes->setValue(value);
 }
 
+#if ENABLE(MICRODATA)
+String HTMLLinkElement::itemValueText() const
+{
+    return getURLAttribute(hrefAttr);
+}
+
+void HTMLLinkElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(hrefAttr, value, ec);
+}
+#endif
+
 } // namespace WebCore
index b1e0ead..6e05f2c 100644 (file)
@@ -94,6 +94,11 @@ private:
     void addPendingSheet(PendingSheetType);
     void removePendingSheet();
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
 private:
     HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
 
index 15b2a20..49d5f6e 100644 (file)
@@ -3068,6 +3068,18 @@ AudioSourceProvider* HTMLMediaElement::audioSourceProvider()
 }
 #endif
 
+#if ENABLE(MICRODATA)
+String HTMLMediaElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLMediaElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
 
 #endif
index 18c1074..fce32fa 100644 (file)
@@ -402,6 +402,11 @@ private:
 
     virtual void* preDispatchEventHandler(Event*);
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const;
+    virtual void setItemValueText(const String&, ExceptionCode&);
+#endif
+
     Timer<HTMLMediaElement> m_loadTimer;
     Timer<HTMLMediaElement> m_asyncEventTimer;
     Timer<HTMLMediaElement> m_progressEventTimer;
index 108a98c..0fa8c92 100644 (file)
@@ -94,4 +94,16 @@ String HTMLMetaElement::name() const
     return getAttribute(nameAttr);
 }
 
+#if ENABLE(MICRODATA)
+String HTMLMetaElement::itemValueText() const
+{
+    return getAttribute(contentAttr);
+}
+
+void HTMLMetaElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(contentAttr, value, ec);
+}
+#endif
+
 }
index 8f6f1be..df4d7e1 100644 (file)
@@ -42,6 +42,12 @@ private:
     virtual void insertedIntoDocument();
 
     void process();
+
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
 };
 
 } //namespace
index d8e817c..0bef939 100644 (file)
@@ -554,4 +554,16 @@ HTMLFormElement* HTMLObjectElement::virtualForm() const
     return FormAssociatedElement::form();
 }
 
+#if ENABLE(MICRODATA)
+String HTMLObjectElement::itemValueText() const
+{
+    return getURLAttribute(dataAttr);
+}
+
+void HTMLObjectElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(dataAttr, value, ec);
+}
+#endif
+
 }
index 62017ae..dcec5cf 100644 (file)
@@ -102,6 +102,11 @@ private:
 
     virtual const AtomicString& formControlName() const;
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     AtomicString m_id;
     String m_classId;
     bool m_docNamedItem : 1;
index 0631a20..eaf611a 100644 (file)
@@ -121,6 +121,18 @@ bool HTMLSourceElement::isURLAttribute(Attribute* attribute) const
     return attribute->name() == srcAttr;
 }
 
+#if ENABLE(MICRODATA)
+String HTMLSourceElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLSourceElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
 
 #endif
index cc1e5d7..431a66c 100644 (file)
@@ -55,6 +55,11 @@ private:
 
     void errorEventTimerFired(Timer<HTMLSourceElement>*);
 
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     Timer<HTMLSourceElement> m_errorEventTimer;
 };
 
index 2bcf8b8..9207d7a 100644 (file)
@@ -150,7 +150,19 @@ void HTMLTrackElement::textTrackLoadingCompleted(LoadableTextTrack*, bool loadin
     ExceptionCode ec = 0;
     dispatchEvent(Event::create(loadingFailed ? eventNames().errorEvent : eventNames().loadEvent, false, false), ec);
 }
-    
+
+#if ENABLE(MICRODATA)
+String HTMLTrackElement::itemValueText() const
+{
+    return getURLAttribute(srcAttr);
+}
+
+void HTMLTrackElement::setItemValueText(const String& value, ExceptionCode& ec)
+{
+    setAttribute(srcAttr, value, ec);
+}
+#endif
+
 }
 
 #endif
index 710c985..5b3002c 100644 (file)
@@ -63,7 +63,12 @@ private:
     virtual void insertedIntoTree(bool);
     virtual void willRemove();
     virtual bool isURLAttribute(Attribute*) const;
-    
+
+#if ENABLE(MICRODATA)
+    virtual String itemValueText() const OVERRIDE;
+    virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
+#endif
+
     RefPtr<LoadableTextTrack> m_track;
 };
 
diff --git a/Source/WebCore/html/MicroDataItemValue.cpp b/Source/WebCore/html/MicroDataItemValue.cpp
new file mode 100644 (file)
index 0000000..37720a0
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MICRODATA)
+#include "MicroDataItemValue.h"
+
+#include "Node.h"
+
+namespace WebCore {
+
+MicroDataItemValue::MicroDataItemValue(String string)
+    : m_type(STRING)
+    , m_string(string)
+{
+}
+
+MicroDataItemValue::MicroDataItemValue(Node* node)
+    : m_type(NODE)
+    , m_node(node)
+{
+}
+
+PassRefPtr<MicroDataItemValue> MicroDataItemValue::createFromString(const String& string)
+{
+    return adoptRef(new MicroDataItemValue(string));
+}
+
+PassRefPtr<MicroDataItemValue> MicroDataItemValue::createFromNode(Node* node)
+{
+    return adoptRef(new MicroDataItemValue(node));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MICRODATA)
diff --git a/Source/WebCore/html/MicroDataItemValue.h b/Source/WebCore/html/MicroDataItemValue.h
new file mode 100644 (file)
index 0000000..9b52ab4
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MicroDataItemValue_h
+#define MicroDataItemValue_h
+
+#if ENABLE(MICRODATA)
+
+#include "PlatformString.h"
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Node;
+
+class MicroDataItemValue : public RefCounted<MicroDataItemValue> {
+private:
+    enum Type {STRING, NODE};
+
+public:
+    static PassRefPtr<MicroDataItemValue> createFromString(const String&);
+    static PassRefPtr<MicroDataItemValue> createFromNode(Node*);
+
+    bool isNode() { return m_type == NODE; }
+    Node* getNode() { return m_node; }
+    String getString() { return m_string; }
+
+private:
+    MicroDataItemValue(String);
+    MicroDataItemValue(Node*);
+
+    Type m_type;
+    String m_string;
+    Node* m_node;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MICRODATA)
+
+#endif // MicroDataItemValue_h
+