[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:55:31 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 3d675910acef479a5cac6cf38866ab0f76fde1a0
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 6 02:57:02 2010 +0000

    2010-01-05  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Maciej Stachowiak.
    
            Implement HTML5 <header> and <footer> elements.
            https://bugs.webkit.org/show_bug.cgi?id=32943
    
            These test:
            - <p> closing,
            - No nesting restriction,
            - Residual style, and
            - FormatBlock.
    
            * fast/html/footer-element-expected.txt: Added.
            * fast/html/footer-element.html: Added.
            * fast/html/header-element-expected.txt: Added.
            * fast/html/header-element.html: Added.
            * fast/html/script-tests/footer-element.js: Added.
            * fast/html/script-tests/header-element.js: Added.
    2010-01-05  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Maciej Stachowiak.
    
            Implement HTML5 <header> and <footer> elements.
            https://bugs.webkit.org/show_bug.cgi?id=32943
    
            <header> and <footer> should behave the same as <nav>, <section>,
            <article>, and <aside>. The HTML parser doesn't need to restrict
            the nesting of header/footer elements.
    
            Tests: fast/html/footer-element.html
                   fast/html/header-element.html
    
            * css/html.css: Add header/footer as block elements.
            * editing/htmlediting.cpp:
            (WebCore::validBlockTag): Add headerTag and footerTag.
            * html/HTMLElement.cpp:
            (WebCore::HTMLElement::tagPriority): Returns 5 for headerTag and footerTag.
            (WebCore::blockTagList): Add headerTag and footerTag.
            * html/HTMLParser.cpp:
            (WebCore::HTMLParser::handleError): Rename isHeaderTag() to isHeadingTag()
            (WebCore::HTMLParser::getNode): Add headerTag and footerTag.
            (WebCore::HTMLParser::isHeadingTag): Renamed from isHeaderTag().
            * html/HTMLParser.h:
              - Rename isHeaderTag() to isHeadingTag()
              - Remove non-existing popNestedHeaderTag().
            * html/HTMLTagNames.in: Add header and footer.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52846 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 271eba7..18ab435 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-05  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Maciej Stachowiak.
+
+        Implement HTML5 <header> and <footer> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=32943
+
+        These test:
+        - <p> closing,
+        - No nesting restriction,
+        - Residual style, and
+        - FormatBlock.
+
+        * fast/html/footer-element-expected.txt: Added.
+        * fast/html/footer-element.html: Added.
+        * fast/html/header-element-expected.txt: Added.
+        * fast/html/header-element.html: Added.
+        * fast/html/script-tests/footer-element.js: Added.
+        * fast/html/script-tests/header-element.js: Added.
+
 2010-01-05  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/html/footer-element-expected.txt b/LayoutTests/fast/html/footer-element-expected.txt
new file mode 100644
index 0000000..933f1aa
--- /dev/null
+++ b/LayoutTests/fast/html/footer-element-expected.txt
@@ -0,0 +1,21 @@
+Various tests for the footer element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+<footer> closes <p>:
+PASS footer1.parentNode.nodeName == "p" is false
+<p> does not close <footer>:
+PASS p1.parentNode.nodeName is "FOOTER"
+<footer> can be nested inside <footer> or <header>:
+PASS footer3.parentNode.id is "footer2"
+PASS footer5.parentNode.id is "header1"
+Residual style:
+PASS getWeight("footer4") is "bold"
+PASS getWeight("span1") is "bold"
+FormatBlock:
+PASS document.getElementById("span2").parentNode.nodeName is "FOOTER"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/footer-element.html b/LayoutTests/fast/html/footer-element.html
new file mode 100644
index 0000000..e686bb1
--- /dev/null
+++ b/LayoutTests/fast/html/footer-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/footer-element.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/html/header-element-expected.txt b/LayoutTests/fast/html/header-element-expected.txt
new file mode 100644
index 0000000..6dcba54
--- /dev/null
+++ b/LayoutTests/fast/html/header-element-expected.txt
@@ -0,0 +1,21 @@
+Various tests for the header element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+<header> closes <p>:
+PASS header1.parentNode.nodeName == "p" is false
+<p> does not close <header>:
+PASS p1.parentNode.nodeName is "HEADER"
+<header> can be nested inside <header> or <footer>:
+PASS header3.parentNode.id is "header2"
+PASS header5.parentNode.id is "footer1"
+Residual style:
+PASS getWeight("header4") is "bold"
+PASS getWeight("span1") is "bold"
+FormatBlock:
+PASS document.getElementById("span2").parentNode.nodeName is "HEADER"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/header-element.html b/LayoutTests/fast/html/header-element.html
new file mode 100644
index 0000000..6e09842
--- /dev/null
+++ b/LayoutTests/fast/html/header-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/header-element.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/html/script-tests/footer-element.js b/LayoutTests/fast/html/script-tests/footer-element.js
new file mode 100644
index 0000000..bcfab6c
--- /dev/null
+++ b/LayoutTests/fast/html/script-tests/footer-element.js
@@ -0,0 +1,46 @@
+description('Various tests for the footer element.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('&lt;footer> closes &lt;p>:');
+testParent.innerHTML = '<p>Test that <footer id="footer1">a footer element</nav> closes &lt;p>.</p>';
+var footer1 = document.getElementById('footer1');
+shouldBeFalse('footer1.parentNode.nodeName == "p"');
+
+debug('&lt;p> does not close &lt;footer>:');
+testParent.innerHTML = '<footer>Test that <p id="p1">a p element</p> does not close a footer element.</footer>';
+var p1 = document.getElementById('p1');
+shouldBe('p1.parentNode.nodeName', '"FOOTER"');
+
+debug('&lt;footer> can be nested inside &lt;footer> or &lt;header>:');
+testParent.innerHTML = '<footer id="footer2">Test that <footer id="footer3">a footer element</footer> can be nested inside another footer element.</footer>';
+var footer3 = document.getElementById('footer3');
+shouldBe('footer3.parentNode.id', '"footer2"');
+testParent.innerHTML = '<header id="header1">Test that <footer id="footer5">a footer element</footer> can be nested inside a header element.</header>';
+var footer5 = document.getElementById('footer5');
+shouldBe('footer5.parentNode.id', '"header1"');
+
+debug('Residual style:');
+testParent.innerHTML = '<b><footer id="footer4">This text should be bold.</footer> <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("footer4")', '"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;footer>.</span>]';
+document.body.appendChild(editable);
+editable.contentEditable = true;
+var selection = window.getSelection();
+selection.selectAllChildren(editable);
+document.execCommand('FormatBlock', false, 'footer');
+selection.collapse();
+shouldBe('document.getElementById("span2").parentNode.nodeName', '"FOOTER"');
+document.body.removeChild(editable);
+
+var successfullyParsed = true;
+
diff --git a/LayoutTests/fast/html/script-tests/header-element.js b/LayoutTests/fast/html/script-tests/header-element.js
new file mode 100644
index 0000000..245b5f4
--- /dev/null
+++ b/LayoutTests/fast/html/script-tests/header-element.js
@@ -0,0 +1,46 @@
+description('Various tests for the header element.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('&lt;header> closes &lt;p>:');
+testParent.innerHTML = '<p>Test that <header id="header1">a header element</nav> closes &lt;p>.</p>';
+var header1 = document.getElementById('header1');
+shouldBeFalse('header1.parentNode.nodeName == "p"');
+
+debug('&lt;p> does not close &lt;header>:');
+testParent.innerHTML = '<header>Test that <p id="p1">a p element</p> does not close a header element.</header>';
+var p1 = document.getElementById('p1');
+shouldBe('p1.parentNode.nodeName', '"HEADER"');
+
+debug('&lt;header> can be nested inside &lt;header> or &lt;footer>:');
+testParent.innerHTML = '<header id="header2">Test that <header id="header3">a header element</header> can be nested inside another header element.</header>';
+var header3 = document.getElementById('header3');
+shouldBe('header3.parentNode.id', '"header2"');
+testParent.innerHTML = '<footer id="footer1">Test that <header id="header5">a header element</header> can be nested inside a footer element.</footer>';
+var header5 = document.getElementById('header5');
+shouldBe('header5.parentNode.id', '"footer1"');
+
+debug('Residual style:');
+testParent.innerHTML = '<b><header id="header4">This text should be bold.</header> <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("header4")', '"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;header>.</span>]';
+document.body.appendChild(editable);
+editable.contentEditable = true;
+var selection = window.getSelection();
+selection.selectAllChildren(editable);
+document.execCommand('FormatBlock', false, 'header');
+selection.collapse();
+shouldBe('document.getElementById("span2").parentNode.nodeName', '"HEADER"');
+document.body.removeChild(editable);
+
+var successfullyParsed = true;
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9bcdc84..29991bf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-01-05  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Maciej Stachowiak.
+
+        Implement HTML5 <header> and <footer> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=32943
+
+        <header> and <footer> should behave the same as <nav>, <section>,
+        <article>, and <aside>. The HTML parser doesn't need to restrict
+        the nesting of header/footer elements.
+
+        Tests: fast/html/footer-element.html
+               fast/html/header-element.html
+
+        * css/html.css: Add header/footer as block elements.
+        * editing/htmlediting.cpp:
+        (WebCore::validBlockTag): Add headerTag and footerTag.
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::tagPriority): Returns 5 for headerTag and footerTag.
+        (WebCore::blockTagList): Add headerTag and footerTag.
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::handleError): Rename isHeaderTag() to isHeadingTag()
+        (WebCore::HTMLParser::getNode): Add headerTag and footerTag.
+        (WebCore::HTMLParser::isHeadingTag): Renamed from isHeaderTag().
+        * html/HTMLParser.h:
+          - Rename isHeaderTag() to isHeadingTag()
+          - Remove non-existing popNestedHeaderTag().
+        * html/HTMLTagNames.in: Add header and footer.
+
 2010-01-05  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/css/html.css b/WebCore/css/html.css
index 4e6bdd6..913dbe5 100644
--- a/WebCore/css/html.css
+++ b/WebCore/css/html.css
@@ -72,7 +72,7 @@ layer {
     display: block
 }
 
-article, aside, nav, section {
+article, aside, footer, header, nav, section {
     display: block
 }
 
diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp
index b2e67c3..46315f6 100644
--- a/WebCore/editing/htmlediting.cpp
+++ b/WebCore/editing/htmlediting.cpp
@@ -481,12 +481,14 @@ bool validBlockTag(const AtomicString& blockTag)
         blockTags.add(divTag.localName());
         blockTags.add(dlTag.localName());
         blockTags.add(dtTag.localName());
+        blockTags.add(footerTag.localName());
         blockTags.add(h1Tag.localName());
         blockTags.add(h2Tag.localName());
         blockTags.add(h3Tag.localName());
         blockTags.add(h4Tag.localName());
         blockTags.add(h5Tag.localName());
         blockTags.add(h6Tag.localName());
+        blockTags.add(headerTag.localName());
         blockTags.add(navTag.localName());
         blockTags.add(pTag.localName());
         blockTags.add(preTag.localName());
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index 41f3a43..ffa0eea 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -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(asideTag) || hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
+    if (hasLocalName(articleTag) || hasLocalName(asideTag) || hasLocalName(centerTag) || hasLocalName(footerTag) || hasLocalName(headerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
         return 5; // Same as <div>.
     if (hasLocalName(noembedTag) || hasLocalName(noframesTag))
         return 10;
@@ -874,6 +874,7 @@ static HashSet<AtomicStringImpl*>* blockTagList()
         tagList.add(dlTag.localName().impl());
         tagList.add(dtTag.localName().impl());
         tagList.add(fieldsetTag.localName().impl());
+        tagList.add(footerTag.localName().impl());
         tagList.add(formTag.localName().impl());
         tagList.add(h1Tag.localName().impl());
         tagList.add(h2Tag.localName().impl());
@@ -881,6 +882,7 @@ static HashSet<AtomicStringImpl*>* blockTagList()
         tagList.add(h4Tag.localName().impl());
         tagList.add(h5Tag.localName().impl());
         tagList.add(h6Tag.localName().impl());
+        tagList.add(headerTag.localName().impl());
         tagList.add(hrTag.localName().impl());
         tagList.add(isindexTag.localName().impl());
         tagList.add(layerTag.localName().impl());
diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp
index 9993b7a..06c65c4 100644
--- a/WebCore/html/HTMLParser.cpp
+++ b/WebCore/html/HTMLParser.cpp
@@ -653,7 +653,7 @@ bool HTMLParser::handleError(Node* n, bool flat, const AtomicString& localName,
             reportError(MisplacedContentRetryError, &localName, &currentTagName);
             popBlock(objectTag);
             handled = true;
-        } else if (h->hasLocalName(pTag) || isHeaderTag(currentTagName)) {
+        } else if (h->hasLocalName(pTag) || isHeadingTag(currentTagName)) {
             if (!isInline(n)) {
                 popBlock(currentTagName);
                 handled = true;
@@ -924,6 +924,7 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
         gFunctionMap.set(dtTag.localName().impl(), &HTMLParser::dtCreateErrorCheck);
         gFunctionMap.set(formTag.localName().impl(), &HTMLParser::formCreateErrorCheck);
         gFunctionMap.set(fieldsetTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(footerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(framesetTag.localName().impl(), &HTMLParser::framesetCreateErrorCheck);
         gFunctionMap.set(h1Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(h2Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
@@ -932,6 +933,7 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
         gFunctionMap.set(h5Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(h6Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
+        gFunctionMap.set(headerTag.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);
@@ -1019,19 +1021,19 @@ void HTMLParser::processCloseTag(Token* t)
     }
 }
 
-bool HTMLParser::isHeaderTag(const AtomicString& tagName)
+bool HTMLParser::isHeadingTag(const AtomicString& tagName)
 {
-    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headerTags, ());
-    if (headerTags.isEmpty()) {
-        headerTags.add(h1Tag.localName().impl());
-        headerTags.add(h2Tag.localName().impl());
-        headerTags.add(h3Tag.localName().impl());
-        headerTags.add(h4Tag.localName().impl());
-        headerTags.add(h5Tag.localName().impl());
-        headerTags.add(h6Tag.localName().impl());
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headingTags, ());
+    if (headingTags.isEmpty()) {
+        headingTags.add(h1Tag.localName().impl());
+        headingTags.add(h2Tag.localName().impl());
+        headingTags.add(h3Tag.localName().impl());
+        headingTags.add(h4Tag.localName().impl());
+        headingTags.add(h5Tag.localName().impl());
+        headingTags.add(h6Tag.localName().impl());
     }
     
-    return headerTags.contains(tagName.impl());
+    return headingTags.contains(tagName.impl());
 }
 
 bool HTMLParser::isInline(Node* node) const
diff --git a/WebCore/html/HTMLParser.h b/WebCore/html/HTMLParser.h
index f07b64b..e667248 100644
--- a/WebCore/html/HTMLParser.h
+++ b/WebCore/html/HTMLParser.h
@@ -136,8 +136,7 @@ private:
 
     bool allowNestedRedundantTag(const AtomicString& tagName);
     
-    static bool isHeaderTag(const AtomicString& tagName);
-    void popNestedHeaderTag();
+    static bool isHeadingTag(const AtomicString& tagName);
 
     bool isInline(Node*) const;
     
diff --git a/WebCore/html/HTMLTagNames.in b/WebCore/html/HTMLTagNames.in
index f7007e9..1b77c5a 100644
--- a/WebCore/html/HTMLTagNames.in
+++ b/WebCore/html/HTMLTagNames.in
@@ -43,6 +43,7 @@ em interfaceName=HTMLElement
 embed
 fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement, createWithNew
 font createWithNew
+footer interfaceName=HTMLElement
 form createWithNew
 frame
 frameset interfaceName=HTMLFrameSetElement, createWithNew
@@ -53,6 +54,7 @@ h4 interfaceName=HTMLHeadingElement, createWithNew
 h5 interfaceName=HTMLHeadingElement, createWithNew
 h6 interfaceName=HTMLHeadingElement, createWithNew
 head createWithNew
+header interfaceName=HTMLElement
 hr interfaceName=HTMLHRElement, createWithNew
 html createWithNew
 i interfaceName=HTMLElement

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list