Skip to content
Permalink
Browse files
2010-03-08 Kent Tamura <tkent@chromium.org>
        Reviewed by Adam Barth.

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

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

        * fast/html/hgroup-element-expected.txt: Added.
        * fast/html/hgroup-element.html: Added.
        * fast/html/script-tests/hgroup-element.js: Added.
2010-03-08  Kent Tamura  <tkent@chromium.org>

        Reviewed by Adam Barth.

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

        <hgroup> should behave the same as <nav>, <section>, <article>, and <aside>.
        <hgroup> has no specific parsing rules.

        Test: fast/html/hgroup-element.html

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

Canonical link: https://commits.webkit.org/47007@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
tkent-google committed Mar 9, 2010
1 parent 3c5534a commit deeefcbd5c75a50d55954472c02b0b18d100783b
Showing 10 changed files with 121 additions and 1 deletion.
@@ -1,3 +1,19 @@
2010-03-08 Kent Tamura <tkent@chromium.org>

Reviewed by Adam Barth.

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

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

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

2010-03-08 Tony Chang <tony@chromium.org>

Reviewed by Adam Barth.
@@ -0,0 +1,20 @@
Various tests for the hgroup element.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


<hgroup> closes <p>:
PASS hgroup1.parentNode.nodeName == "p" is false
<p> does not close <hgroup>:
PASS p1.parentNode.nodeName is "HGROUP"
<hgroup> can be nested inside <hgroup>:
PASS hgroup3.parentNode.id is "hgroup2"
Residual style:
PASS getWeight("hgroup4") is "bold"
PASS getWeight("span1") is "bold"
FormatBlock:
PASS document.getElementById("span2").parentNode.nodeName is "HGROUP"
PASS successfullyParsed is true

TEST COMPLETE

@@ -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/hgroup-element.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,44 @@
description('Various tests for the hgroup element.');

var testParent = document.createElement('div');
document.body.appendChild(testParent);

debug('&lt;hgroup> closes &lt;p>:');
testParent.innerHTML = '<p>Test that <hgroup id="hgroup1"><h1>a hgroup element</h1></hgroup> closes &lt;p>.</p>';
var hgroup1 = document.getElementById('hgroup1');
shouldBeFalse('hgroup1.parentNode.nodeName == "p"');

debug('&lt;p> does not close &lt;hgroup>:');
testParent.innerHTML = '<hgroup>Test that <p id="p1">a p element</p> does not close a hgroup element.</hgroup>';
var p1 = document.getElementById('p1');
shouldBe('p1.parentNode.nodeName', '"HGROUP"');

// Note: hgroup *should* have only h1-h6 elements, but *can* have any elements.
debug('&lt;hgroup> can be nested inside &lt;hgroup>:');
testParent.innerHTML = '<hgroup id="hgroup2">Test that <hgroup id="hgroup3">a hgroup element</hgroup> can be nested inside another.</hgroup>';
var hgroup3 = document.getElementById('hgroup3');
shouldBe('hgroup3.parentNode.id', '"hgroup2"');

debug('Residual style:');
testParent.innerHTML = '<b><hgroup id="hgroup4"><h2>This text should be bold.</h2></hgroup> <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("hgroup4")', '"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;hgroup>.</span>]';
document.body.appendChild(editable);
editable.contentEditable = true;
var selection = window.getSelection();
selection.selectAllChildren(editable);
document.execCommand('FormatBlock', false, 'hgroup');
selection.collapse();
shouldBe('document.getElementById("span2").parentNode.nodeName', '"HGROUP"');
document.body.removeChild(editable);

var successfullyParsed = true;

@@ -1,3 +1,25 @@
2010-03-08 Kent Tamura <tkent@chromium.org>

Reviewed by Adam Barth.

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

<hgroup> should behave the same as <nav>, <section>, <article>, and <aside>.
<hgroup> has no specific parsing rules.

Test: fast/html/hgroup-element.html

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

2010-03-08 Tony Chang <tony@chromium.org>

Reviewed by Adam Barth.
@@ -72,7 +72,7 @@ layer {
display: block
}

article, aside, footer, header, nav, section {
article, aside, footer, header, hgroup, nav, section {
display: block
}

@@ -489,6 +489,7 @@ bool validBlockTag(const AtomicString& blockTag)
blockTags.add(h5Tag.localName());
blockTags.add(h6Tag.localName());
blockTags.add(headerTag.localName());
blockTags.add(hgroupTag.localName());
blockTags.add(navTag.localName());
blockTags.add(pTag.localName());
blockTags.add(preTag.localName());
@@ -107,6 +107,7 @@ static const TagPriorityMap* createTagPriorityMap()
map->add(centerTag.localName().impl(), 5);
map->add(footerTag.localName().impl(), 5);
map->add(headerTag.localName().impl(), 5);
map->add(hgroupTag.localName().impl(), 5);
map->add(nobrTag.localName().impl(), 5);
map->add(rubyTag.localName().impl(), 5);
map->add(navTag.localName().impl(), 5);
@@ -881,6 +882,7 @@ static HashSet<AtomicStringImpl*>* blockTagList()
tagList.add(h5Tag.localName().impl());
tagList.add(h6Tag.localName().impl());
tagList.add(headerTag.localName().impl());
tagList.add(hgroupTag.localName().impl());
tagList.add(hrTag.localName().impl());
tagList.add(isindexTag.localName().impl());
tagList.add(layerTag.localName().impl());
@@ -938,6 +938,7 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
gFunctionMap.set(h6Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
gFunctionMap.set(headerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(hgroupTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(hrTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(iTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
gFunctionMap.set(isindexTag.localName().impl(), &HTMLParser::isindexCreateErrorCheck);
@@ -55,6 +55,7 @@ h5 interfaceName=HTMLHeadingElement, createWithNew
h6 interfaceName=HTMLHeadingElement, createWithNew
head createWithNew
header interfaceName=HTMLElement
hgroup interfaceName=HTMLElement
hr interfaceName=HTMLHRElement, createWithNew
html createWithNew
i interfaceName=HTMLElement

0 comments on commit deeefcb

Please sign in to comment.