2009-12-28  Kent Tamura  <tkent@chromium.org>

        Reviewed by Maciej Stachowiak.

        Implement HTML5 <article> element.
        https://bugs.webkit.org/show_bug.cgi?id=32942

        The new test file tests:
        - <p> closing,
        - Residual style, and
        - FormatBlock.

        * fast/html/article-element-expected.txt: Added.
        * fast/html/article-element.html: Added.
        * fast/html/script-tests/article-element.js: Added.

2009-12-28  Kent Tamura  <tkent@chromium.org>

        Reviewed by Maciej Stachowiak.

        Implement HTML5 <article> element.
        https://bugs.webkit.org/show_bug.cgi?id=32936

        <article> should behave the same as <nav> and <section>.

        Test: fast/html/article-element.html

        * css/html.css: Add article as a block element.
        * editing/htmlediting.cpp:
        (WebCore::validBlockTag): Add articleTag.
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::tagPriority): Returns 5 for articleTag.
        (WebCore::blockTagList): Add articleTag.
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::getNode): Add articleTag.
        * html/HTMLTagNames.in: Add article.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2e9b888..d6641e0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2009-12-28  Kent Tamura  <tkent@chromium.org>
+
+        Reviewed by Maciej Stachowiak.
+
+        Implement HTML5 <article> element.
+        https://bugs.webkit.org/show_bug.cgi?id=32942
+
+        The new test file tests:
+        - <p> closing,
+        - Residual style, and
+        - FormatBlock.
+
+        * fast/html/article-element-expected.txt: Added.
+        * fast/html/article-element.html: Added.
+        * fast/html/script-tests/article-element.js: Added.
+
 2009-12-27  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Adam Barth.
diff --git a/LayoutTests/fast/html/article-element-expected.txt b/LayoutTests/fast/html/article-element-expected.txt
new file mode 100644
index 0000000..f60ac38
--- /dev/null
+++ b/LayoutTests/fast/html/article-element-expected.txt
@@ -0,0 +1,20 @@
+Various tests for the article element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+<article> closes <p>:
+PASS article1.parentNode.nodeName == "p" is false
+<p> does not close <article>:
+PASS p1.parentNode.nodeName is "ARTICLE"
+<article> can be nested inside <article>:
+PASS article3.parentNode.id is "article2"
+Residual style:
+PASS getWeight("article4") is "bold"
+PASS getWeight("span1") is "bold"
+FormatBlock:
+PASS document.getElementById("span2").parentNode.nodeName is "ARTICLE"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/article-element.html b/LayoutTests/fast/html/article-element.html
new file mode 100644
index 0000000..c0f4547
--- /dev/null
+++ b/LayoutTests/fast/html/article-element.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/article-element.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/html/script-tests/article-element.js b/LayoutTests/fast/html/script-tests/article-element.js
new file mode 100644
index 0000000..3e10150
--- /dev/null
+++ b/LayoutTests/fast/html/script-tests/article-element.js
@@ -0,0 +1,43 @@
+description('Various tests for the article element.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('&lt;article> closes &lt;p>:');
+testParent.innerHTML = '<p>Test that <article id="article1">an article element</nav> closes &lt;p>.</p>';
+var article1 = document.getElementById('article1');
+shouldBeFalse('article1.parentNode.nodeName == "p"');
+
+debug('&lt;p> does not close &lt;article>:');
+testParent.innerHTML = '<article>Test that <p id="p1">a p element</p> does not close an article element.</article>';
+var p1 = document.getElementById('p1');
+shouldBe('p1.parentNode.nodeName', '"ARTICLE"');
+
+debug('&lt;article> can be nested inside &lt;article>:');
+testParent.innerHTML = '<article id="article2">Test that <article id="article3">an article element</article> can be nested inside another.</article>';
+var article3 = document.getElementById('article3');
+shouldBe('article3.parentNode.id', '"article2"');
+
+debug('Residual style:');
+testParent.innerHTML = '<b><article id="article4">This text should be bold.</article> <span id="span1">This is also bold.</span></b>';
+function getWeight(id) {
+    return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('font-weight');
+}
+shouldBe('getWeight("article4")', '"bold"');
+shouldBe('getWeight("span1")', '"bold"');
+document.body.removeChild(testParent);
+
+debug('FormatBlock:');
+var editable = document.createElement('div');
+editable.innerHTML = '[<span id="span2">The text will be a child of &lt;article>.</span>]';
+document.body.appendChild(editable);
+editable.contentEditable = true;
+var selection = window.getSelection();
+selection.selectAllChildren(editable);
+document.execCommand('FormatBlock', false, 'article');
+selection.collapse();
+shouldBe('document.getElementById("span2").parentNode.nodeName', '"ARTICLE"');
+document.body.removeChild(editable);
+
+var successfullyParsed = true;
+