Skip to content

Commit

Permalink
2009-12-29 Kent Tamura <tkent@chromium.org>
Browse files Browse the repository at this point in the history
        Reviewed by Maciej Stachowiak.

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

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

        Test: fast/html/aside-element.html

        * css/html.css: Add aside as a block element.
        * editing/htmlediting.cpp:
        (WebCore::validBlockTag): Add asideTag.
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::tagPriority): Returns 5 for asideTag.
        (WebCore::blockTagList): Add asideTag.
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::getNode): Add asideTag.
        * html/HTMLTagNames.in: Add aside.
2009-12-29  Kent Tamura  <tkent@chromium.org>

        Reviewed by Maciej Stachowiak.

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

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

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


Canonical link: https://commits.webkit.org/44033@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@52620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Dec 29, 2009
1 parent 0200dd8 commit 68cf6ab
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 2 deletions.
16 changes: 16 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2009-12-29 Kent Tamura <tkent@chromium.org>

Reviewed by Maciej Stachowiak.

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

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

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

2009-12-29 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>

[GTK] Failing media/video-seek-past-end-playing.html
Expand Down
20 changes: 20 additions & 0 deletions LayoutTests/fast/html/aside-element-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Various tests for the aside element.

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


<aside> closes <p>:
PASS aside1.parentNode.nodeName == "p" is false
<p> does not close <aside>:
PASS p1.parentNode.nodeName is "ASIDE"
<aside> can be nested inside <aside>:
PASS aside3.parentNode.id is "aside2"
Residual style:
PASS getWeight("aside4") is "bold"
PASS getWeight("span1") is "bold"
FormatBlock:
PASS document.getElementById("span2").parentNode.nodeName is "ASIDE"
PASS successfullyParsed is true

TEST COMPLETE

13 changes: 13 additions & 0 deletions LayoutTests/fast/html/aside-element.html
Original file line number Diff line number Diff line change
@@ -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/aside-element.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
43 changes: 43 additions & 0 deletions LayoutTests/fast/html/script-tests/aside-element.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
description('Various tests for the aside element.');

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

debug('&lt;aside> closes &lt;p>:');
testParent.innerHTML = '<p>Test that <aside id="aside1">an aside element</nav> closes &lt;p>.</p>';
var aside1 = document.getElementById('aside1');
shouldBeFalse('aside1.parentNode.nodeName == "p"');

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

debug('&lt;aside> can be nested inside &lt;aside>:');
testParent.innerHTML = '<aside id="aside2">Test that <aside id="aside3">an aside element</aside> can be nested inside another.</aside>';
var aside3 = document.getElementById('aside3');
shouldBe('aside3.parentNode.id', '"aside2"');

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

var successfullyParsed = true;

21 changes: 21 additions & 0 deletions WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
2009-12-29 Kent Tamura <tkent@chromium.org>

Reviewed by Maciej Stachowiak.

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

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

Test: fast/html/aside-element.html

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

2009-12-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>

Reviewed by Eric Seidel.
Expand Down
2 changes: 1 addition & 1 deletion WebCore/css/html.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ layer {
display: block
}

article, nav, section {
article, aside, nav, section {
display: block
}

Expand Down
1 change: 1 addition & 0 deletions WebCore/editing/htmlediting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ bool validBlockTag(const AtomicString& blockTag)
if (blockTags.isEmpty()) {
blockTags.add(addressTag.localName());
blockTags.add(articleTag.localName());
blockTags.add(asideTag.localName());
blockTags.add(blockquoteTag.localName());
blockTags.add(ddTag.localName());
blockTags.add(divTag.localName());
Expand Down
3 changes: 2 additions & 1 deletion WebCore/html/HTMLElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int HTMLElement::tagPriority() const
return 0;
if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag) || hasLocalName(rpTag) || hasLocalName(rtTag))
return 3;
if (hasLocalName(articleTag) || hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
if (hasLocalName(articleTag) || hasLocalName(asideTag) || hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
return 5; // Same as <div>.
if (hasLocalName(noembedTag) || hasLocalName(noframesTag))
return 10;
Expand Down Expand Up @@ -865,6 +865,7 @@ static HashSet<AtomicStringImpl*>* blockTagList()
if (tagList.isEmpty()) {
tagList.add(addressTag.localName().impl());
tagList.add(articleTag.localName().impl());
tagList.add(asideTag.localName().impl());
tagList.add(blockquoteTag.localName().impl());
tagList.add(centerTag.localName().impl());
tagList.add(ddTag.localName().impl());
Expand Down
1 change: 1 addition & 0 deletions WebCore/html/HTMLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
gFunctionMap.set(aTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
gFunctionMap.set(addressTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(articleTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(asideTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
gFunctionMap.set(bTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
gFunctionMap.set(bigTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
gFunctionMap.set(blockquoteTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
Expand Down
1 change: 1 addition & 0 deletions WebCore/html/HTMLTagNames.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ address interfaceName=HTMLElement
applet
area
article interfaceName=HTMLElement
aside interfaceName=HTMLElement
audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, createWithNew
b interfaceName=HTMLElement
base createWithNew
Expand Down

0 comments on commit 68cf6ab

Please sign in to comment.