Changeset 52846 in webkit


Ignore:
Timestamp:
Jan 5, 2010, 6:57:02 PM (16 years ago)
Author:
eric@webkit.org
Message:

2010-01-05 Kent Tamura <tkent@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@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.
Location:
trunk
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r52844 r52846  
     12010-01-05  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Implement HTML5 <header> and <footer> elements.
     6        https://bugs.webkit.org/show_bug.cgi?id=32943
     7
     8        These test:
     9        - <p> closing,
     10        - No nesting restriction,
     11        - Residual style, and
     12        - FormatBlock.
     13
     14        * fast/html/footer-element-expected.txt: Added.
     15        * fast/html/footer-element.html: Added.
     16        * fast/html/header-element-expected.txt: Added.
     17        * fast/html/header-element.html: Added.
     18        * fast/html/script-tests/footer-element.js: Added.
     19        * fast/html/script-tests/header-element.js: Added.
     20
    1212010-01-05  Darin Adler  <darin@apple.com>
    222
  • trunk/WebCore/ChangeLog

    r52840 r52846  
     12010-01-05  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Implement HTML5 <header> and <footer> elements.
     6        https://bugs.webkit.org/show_bug.cgi?id=32943
     7
     8        <header> and <footer> should behave the same as <nav>, <section>,
     9        <article>, and <aside>. The HTML parser doesn't need to restrict
     10        the nesting of header/footer elements.
     11
     12        Tests: fast/html/footer-element.html
     13               fast/html/header-element.html
     14
     15        * css/html.css: Add header/footer as block elements.
     16        * editing/htmlediting.cpp:
     17        (WebCore::validBlockTag): Add headerTag and footerTag.
     18        * html/HTMLElement.cpp:
     19        (WebCore::HTMLElement::tagPriority): Returns 5 for headerTag and footerTag.
     20        (WebCore::blockTagList): Add headerTag and footerTag.
     21        * html/HTMLParser.cpp:
     22        (WebCore::HTMLParser::handleError): Rename isHeaderTag() to isHeadingTag()
     23        (WebCore::HTMLParser::getNode): Add headerTag and footerTag.
     24        (WebCore::HTMLParser::isHeadingTag): Renamed from isHeaderTag().
     25        * html/HTMLParser.h:
     26          - Rename isHeaderTag() to isHeadingTag()
     27          - Remove non-existing popNestedHeaderTag().
     28        * html/HTMLTagNames.in: Add header and footer.
     29
    1302010-01-05  Darin Adler  <darin@apple.com>
    231
  • trunk/WebCore/css/html.css

    r52620 r52846  
    7373}
    7474
    75 article, aside, nav, section {
     75article, aside, footer, header, nav, section {
    7676    display: block
    7777}
  • trunk/WebCore/editing/htmlediting.cpp

    r52620 r52846  
    482482        blockTags.add(dlTag.localName());
    483483        blockTags.add(dtTag.localName());
     484        blockTags.add(footerTag.localName());
    484485        blockTags.add(h1Tag.localName());
    485486        blockTags.add(h2Tag.localName());
     
    488489        blockTags.add(h5Tag.localName());
    489490        blockTags.add(h6Tag.localName());
     491        blockTags.add(headerTag.localName());
    490492        blockTags.add(navTag.localName());
    491493        blockTags.add(pTag.localName());
  • trunk/WebCore/html/HTMLElement.cpp

    r52620 r52846  
    8989    if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag) || hasLocalName(rpTag) || hasLocalName(rtTag))
    9090        return 3;
    91     if (hasLocalName(articleTag) || hasLocalName(asideTag) || hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
     91    if (hasLocalName(articleTag) || hasLocalName(asideTag) || hasLocalName(centerTag) || hasLocalName(footerTag) || hasLocalName(headerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag) || hasLocalName(navTag) || hasLocalName(sectionTag))
    9292        return 5; // Same as <div>.
    9393    if (hasLocalName(noembedTag) || hasLocalName(noframesTag))
     
    875875        tagList.add(dtTag.localName().impl());
    876876        tagList.add(fieldsetTag.localName().impl());
     877        tagList.add(footerTag.localName().impl());
    877878        tagList.add(formTag.localName().impl());
    878879        tagList.add(h1Tag.localName().impl());
     
    882883        tagList.add(h5Tag.localName().impl());
    883884        tagList.add(h6Tag.localName().impl());
     885        tagList.add(headerTag.localName().impl());
    884886        tagList.add(hrTag.localName().impl());
    885887        tagList.add(isindexTag.localName().impl());
  • trunk/WebCore/html/HTMLParser.cpp

    r52620 r52846  
    654654            popBlock(objectTag);
    655655            handled = true;
    656         } else if (h->hasLocalName(pTag) || isHeaderTag(currentTagName)) {
     656        } else if (h->hasLocalName(pTag) || isHeadingTag(currentTagName)) {
    657657            if (!isInline(n)) {
    658658                popBlock(currentTagName);
     
    925925        gFunctionMap.set(formTag.localName().impl(), &HTMLParser::formCreateErrorCheck);
    926926        gFunctionMap.set(fieldsetTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
     927        gFunctionMap.set(footerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
    927928        gFunctionMap.set(framesetTag.localName().impl(), &HTMLParser::framesetCreateErrorCheck);
    928929        gFunctionMap.set(h1Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
     
    933934        gFunctionMap.set(h6Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
    934935        gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
     936        gFunctionMap.set(headerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
    935937        gFunctionMap.set(hrTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
    936938        gFunctionMap.set(iTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
     
    10201022}
    10211023
    1022 bool HTMLParser::isHeaderTag(const AtomicString& tagName)
    1023 {
    1024     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headerTags, ());
    1025     if (headerTags.isEmpty()) {
    1026         headerTags.add(h1Tag.localName().impl());
    1027         headerTags.add(h2Tag.localName().impl());
    1028         headerTags.add(h3Tag.localName().impl());
    1029         headerTags.add(h4Tag.localName().impl());
    1030         headerTags.add(h5Tag.localName().impl());
    1031         headerTags.add(h6Tag.localName().impl());
     1024bool HTMLParser::isHeadingTag(const AtomicString& tagName)
     1025{
     1026    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headingTags, ());
     1027    if (headingTags.isEmpty()) {
     1028        headingTags.add(h1Tag.localName().impl());
     1029        headingTags.add(h2Tag.localName().impl());
     1030        headingTags.add(h3Tag.localName().impl());
     1031        headingTags.add(h4Tag.localName().impl());
     1032        headingTags.add(h5Tag.localName().impl());
     1033        headingTags.add(h6Tag.localName().impl());
    10321034    }
    10331035   
    1034     return headerTags.contains(tagName.impl());
     1036    return headingTags.contains(tagName.impl());
    10351037}
    10361038
  • trunk/WebCore/html/HTMLParser.h

    r51101 r52846  
    137137    bool allowNestedRedundantTag(const AtomicString& tagName);
    138138   
    139     static bool isHeaderTag(const AtomicString& tagName);
    140     void popNestedHeaderTag();
     139    static bool isHeadingTag(const AtomicString& tagName);
    141140
    142141    bool isInline(Node*) const;
  • trunk/WebCore/html/HTMLTagNames.in

    r52620 r52846  
    4444fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement, createWithNew
    4545font createWithNew
     46footer interfaceName=HTMLElement
    4647form createWithNew
    4748frame
     
    5455h6 interfaceName=HTMLHeadingElement, createWithNew
    5556head createWithNew
     57header interfaceName=HTMLElement
    5658hr interfaceName=HTMLHRElement, createWithNew
    5759html createWithNew
Note: See TracChangeset for help on using the changeset viewer.