Changeset 61974 in webkit


Ignore:
Timestamp:
Jun 27, 2010 4:19:15 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-06-27 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Clean up some loose ends in HTML5 tree builder
https://bugs.webkit.org/show_bug.cgi?id=41265

This patch cleans up a few loose ends in HTML5 tree builder.
Technically, we could do each of these as individual patches, but that
didn't seem worth while.

  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTag):
    • Add missing break before default case statement. I don't think this change is observable.

(WebCore::HTMLTreeBuilder::processComment):

  • Originally I thought that comments had special processing in the InHeadNoscriptMode, but it turns out that when you unwind the definitions, it amounts to exactly the same thing.

(WebCore::HTMLTreeBuilder::processEndOfFile):

  • Add missing break before default case statement. I don't think this change is observable.

(WebCore::HTMLTreeBuilder::insertComment):

  • Eliminate one unnecessary ref/deref pair.

(WebCore::HTMLTreeBuilder::insertSelfClosingElement):

  • When we insert self-closing elements, there's no reason to push them onto the stack of open elements just to pop them off again. This change saves a malloc/free pair as well as a ref/deref pair. Go team.
  • html/HTMLTreeBuilder.h:
    • Remove unused function.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61973 r61974  
     12010-06-27  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Clean up some loose ends in HTML5 tree builder
     6        https://bugs.webkit.org/show_bug.cgi?id=41265
     7
     8        This patch cleans up a few loose ends in HTML5 tree builder.
     9        Technically, we could do each of these as individual patches, but that
     10        didn't seem worth while.
     11
     12        * html/HTMLTreeBuilder.cpp:
     13        (WebCore::HTMLTreeBuilder::processStartTag):
     14            - Add missing break before default case statement.  I don't think
     15              this change is observable.
     16        (WebCore::HTMLTreeBuilder::processComment):
     17            - Originally I thought that comments had special processing in the
     18              InHeadNoscriptMode, but it turns out that when you unwind the
     19              definitions, it amounts to exactly the same thing.
     20        (WebCore::HTMLTreeBuilder::processEndOfFile):
     21            - Add missing break before default case statement.  I don't think
     22              this change is observable.
     23        (WebCore::HTMLTreeBuilder::insertComment):
     24            - Eliminate one unnecessary ref/deref pair.
     25        (WebCore::HTMLTreeBuilder::insertSelfClosingElement):
     26            - When we insert self-closing elements, there's no reason to push
     27              them onto the stack of open elements just to pop them off again.
     28              This change saves a malloc/free pair as well as a ref/deref pair.
     29              Go team.
     30        * html/HTMLTreeBuilder.h:
     31            - Remove unused function.
     32
    1332010-06-27  Adam Barth  <abarth@webkit.org>
    234
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r61973 r61974  
    373373        processDefaultForInHeadNoscriptMode(token);
    374374        processToken(token);
     375        break;
    375376    default:
    376377        notImplemented();
     
    463464void HTMLTreeBuilder::processComment(AtomicHTMLToken& token)
    464465{
    465     if (insertionMode() == InHeadNoscriptMode) {
    466         notImplemented();
    467         return;
    468     }
    469466    insertComment(token);
    470467}
     
    511508        processDefaultForInHeadNoscriptMode(token);
    512509        processToken(token);
     510        break;
    513511    default:
    514512        notImplemented();
     
    608606{
    609607    ASSERT(token.type() == HTMLToken::Comment);
    610     RefPtr<Node> element = Comment::create(m_document, token.comment());
    611     currentElement()->addChild(element);
     608    currentElement()->addChild(Comment::create(m_document, token.comment()));
    612609}
    613610
     
    615612{
    616613    ASSERT(token.type() == HTMLToken::StartTag);
    617     RefPtr<Element> element = HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, token.name(), xhtmlNamespaceURI), m_document, 0);
     614    RefPtr<Element> element = createElement(token);
    618615    currentElement()->addChild(element);
    619616    m_openElements.push(element.release());
     
    623620{
    624621    ASSERT(token.type() == HTMLToken::StartTag);
    625     insertElement(token);
    626     m_openElements.pop();
     622    currentElement()->addChild(createElement(token));
    627623    // FIXME: Do we want to acknowledge the token's self-closing flag?
    628624    // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag
    629 }
    630 
    631 void HTMLTreeBuilder::insertCharacter(UChar cc)
    632 {
    633     ASSERT_UNUSED(cc, cc);
    634625}
    635626
     
    663654}
    664655
     656PassRefPtr<Element> HTMLTreeBuilder::createElement(AtomicHTMLToken& token)
     657{
     658    return HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, token.name(), xhtmlNamespaceURI), m_document, 0);
     659}
     660
    665661void HTMLTreeBuilder::finished()
    666662{
  • trunk/WebCore/html/HTMLTreeBuilder.h

    r61973 r61974  
    180180    void insertElement(AtomicHTMLToken&);
    181181    void insertSelfClosingElement(AtomicHTMLToken&);
    182     void insertCharacter(UChar cc);
    183182    void insertGenericRCDATAElement(AtomicHTMLToken&);
    184183    void insertGenericRawTextElement(AtomicHTMLToken&);
     
    187186    void insertHTMLStartTagBeforeHTML(AtomicHTMLToken&);
    188187    void insertHTMLStartTagInBody(AtomicHTMLToken&);
     188
     189    PassRefPtr<Element> createElement(AtomicHTMLToken&);
    189190
    190191    Element* currentElement() { return m_openElements.top(); }
Note: See TracChangeset for help on using the changeset viewer.