Changeset 129164 in webkit


Ignore:
Timestamp:
Sep 20, 2012 1:47:41 PM (12 years ago)
Author:
adamk@chromium.org
Message:

Rename ContainerNode::parserAddChild "parserAppendChild" for consistency
https://bugs.webkit.org/show_bug.cgi?id=97254

Reviewed by Adam Barth.

No functional change, all the below changes are simple renames.

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::takeAllChildrenFrom):
(WebCore::ContainerNode::parserAppendChild):

  • dom/ContainerNode.h:

(ContainerNode):

  • dom/DOMImplementation.cpp:

(WebCore::DOMImplementation::createDocument):

  • editing/markup.cpp:

(WebCore::createFragmentForTransformToFragment):

  • html/HTMLViewSourceDocument.cpp:

(WebCore::HTMLViewSourceDocument::createContainingTable):
(WebCore::HTMLViewSourceDocument::addSpanWithClassName):
(WebCore::HTMLViewSourceDocument::addLine):
(WebCore::HTMLViewSourceDocument::finishLine):
(WebCore::HTMLViewSourceDocument::addText):
(WebCore::HTMLViewSourceDocument::addBase):
(WebCore::HTMLViewSourceDocument::addLink):

  • html/parser/HTMLConstructionSite.cpp:

(WebCore::executeTask):

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::callTheAdoptionAgency):

  • html/track/WebVTTParser.cpp:

(WebCore::WebVTTParser::constructTreeFromToken):

  • xml/XMLErrors.cpp:

(WebCore::createXHTMLParserErrorHeader):
(WebCore::XMLErrors::insertErrorMessageBlock):

  • xml/parser/XMLDocumentParser.cpp:

(WebCore::XMLDocumentParser::enterText):
(WebCore::XMLDocumentParser::parseDocumentFragment):

  • xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::XMLDocumentParser::startElementNs):
(WebCore::XMLDocumentParser::processingInstruction):
(WebCore::XMLDocumentParser::cdataBlock):
(WebCore::XMLDocumentParser::comment):
(WebCore::XMLDocumentParser::internalSubset):

  • xml/parser/XMLDocumentParserQt.cpp:

(WebCore::XMLDocumentParser::parseStartElement):
(WebCore::XMLDocumentParser::parseProcessingInstruction):
(WebCore::XMLDocumentParser::parseCdata):
(WebCore::XMLDocumentParser::parseComment):
(WebCore::XMLDocumentParser::parseDtd):

  • xml/parser/XMLTreeBuilder.cpp:

(WebCore::XMLTreeBuilder::processDOCTYPE):
(WebCore::XMLTreeBuilder::processStartTag):
(WebCore::XMLTreeBuilder::add):

Location:
trunk/Source/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129160 r129164  
     12012-09-20  Adam Klein  <adamk@chromium.org>
     2
     3        Rename ContainerNode::parserAddChild "parserAppendChild" for consistency
     4        https://bugs.webkit.org/show_bug.cgi?id=97254
     5
     6        Reviewed by Adam Barth.
     7
     8        No functional change, all the below changes are simple renames.
     9
     10        * dom/ContainerNode.cpp:
     11        (WebCore::ContainerNode::takeAllChildrenFrom):
     12        (WebCore::ContainerNode::parserAppendChild):
     13        * dom/ContainerNode.h:
     14        (ContainerNode):
     15        * dom/DOMImplementation.cpp:
     16        (WebCore::DOMImplementation::createDocument):
     17        * editing/markup.cpp:
     18        (WebCore::createFragmentForTransformToFragment):
     19        * html/HTMLViewSourceDocument.cpp:
     20        (WebCore::HTMLViewSourceDocument::createContainingTable):
     21        (WebCore::HTMLViewSourceDocument::addSpanWithClassName):
     22        (WebCore::HTMLViewSourceDocument::addLine):
     23        (WebCore::HTMLViewSourceDocument::finishLine):
     24        (WebCore::HTMLViewSourceDocument::addText):
     25        (WebCore::HTMLViewSourceDocument::addBase):
     26        (WebCore::HTMLViewSourceDocument::addLink):
     27        * html/parser/HTMLConstructionSite.cpp:
     28        (WebCore::executeTask):
     29        * html/parser/HTMLTreeBuilder.cpp:
     30        (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
     31        * html/track/WebVTTParser.cpp:
     32        (WebCore::WebVTTParser::constructTreeFromToken):
     33        * xml/XMLErrors.cpp:
     34        (WebCore::createXHTMLParserErrorHeader):
     35        (WebCore::XMLErrors::insertErrorMessageBlock):
     36        * xml/parser/XMLDocumentParser.cpp:
     37        (WebCore::XMLDocumentParser::enterText):
     38        (WebCore::XMLDocumentParser::parseDocumentFragment):
     39        * xml/parser/XMLDocumentParserLibxml2.cpp:
     40        (WebCore::XMLDocumentParser::startElementNs):
     41        (WebCore::XMLDocumentParser::processingInstruction):
     42        (WebCore::XMLDocumentParser::cdataBlock):
     43        (WebCore::XMLDocumentParser::comment):
     44        (WebCore::XMLDocumentParser::internalSubset):
     45        * xml/parser/XMLDocumentParserQt.cpp:
     46        (WebCore::XMLDocumentParser::parseStartElement):
     47        (WebCore::XMLDocumentParser::parseProcessingInstruction):
     48        (WebCore::XMLDocumentParser::parseCdata):
     49        (WebCore::XMLDocumentParser::parseComment):
     50        (WebCore::XMLDocumentParser::parseDtd):
     51        * xml/parser/XMLTreeBuilder.cpp:
     52        (WebCore::XMLTreeBuilder::processDOCTYPE):
     53        (WebCore::XMLTreeBuilder::processStartTag):
     54        (WebCore::XMLTreeBuilder::add):
     55
    1562012-09-20  James Robinson  <jamesr@chromium.org>
    257
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r128679 r129164  
    104104        RefPtr<Node> child = document()->adoptNode(children[i].release(), ec);
    105105        ASSERT(!ec);
    106         parserAddChild(child.get());
     106        parserAppendChild(child.get());
    107107        // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
    108108        // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
     
    601601}
    602602
    603 void ContainerNode::parserAddChild(PassRefPtr<Node> newChild)
     603void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild)
    604604{
    605605    ASSERT(newChild);
  • trunk/Source/WebCore/dom/ContainerNode.h

    r128762 r129164  
    6161    // They don't send DOM mutation events or handle reparenting.
    6262    // However, arbitrary code may be run by beforeload handlers.
    63     void parserAddChild(PassRefPtr<Node>);
     63    void parserAppendChild(PassRefPtr<Node>);
    6464    void parserRemoveChild(Node*);
    6565    void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild);
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r121053 r129164  
    318318    // FIXME: Shouldn't this call appendChild instead?
    319319    if (doctype)
    320         doc->parserAddChild(doctype);
     320        doc->parserAppendChild(doctype);
    321321    if (documentElement)
    322         doc->parserAddChild(documentElement.release());
     322        doc->parserAppendChild(documentElement.release());
    323323
    324324    return doc.release();
  • trunk/Source/WebCore/editing/markup.cpp

    r127062 r129164  
    10271027        fragment->parseHTML(sourceString, fakeBody.get());
    10281028    } else if (sourceMIMEType == "text/plain")
    1029         fragment->parserAddChild(Text::create(outputDoc, sourceString));
     1029        fragment->parserAppendChild(Text::create(outputDoc, sourceString));
    10301030    else {
    10311031        bool successfulParse = fragment->parseXML(sourceString, 0);
  • trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp

    r125878 r129164  
    7171{
    7272    RefPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(this);
    73     parserAddChild(html);
     73    parserAppendChild(html);
    7474    html->attach();
    7575    RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(this);
    76     html->parserAddChild(body);
     76    html->parserAppendChild(body);
    7777    body->attach();
    7878
     
    8181    RefPtr<HTMLDivElement> div = HTMLDivElement::create(this);
    8282    div->setAttribute(classAttr, "webkit-line-gutter-backdrop");
    83     body->parserAddChild(div);
     83    body->parserAppendChild(div);
    8484    div->attach();
    8585
    8686    RefPtr<HTMLTableElement> table = HTMLTableElement::create(this);
    87     body->parserAddChild(table);
     87    body->parserAppendChild(table);
    8888    table->attach();
    8989    m_tbody = HTMLTableSectionElement::create(tbodyTag, this);
    90     table->parserAddChild(m_tbody);
     90    table->parserAppendChild(m_tbody);
    9191    m_tbody->attach();
    9292    m_current = m_tbody;
     
    187187    RefPtr<HTMLElement> span = HTMLElement::create(spanTag, this);
    188188    span->setAttribute(classAttr, className);
    189     m_current->parserAddChild(span);
     189    m_current->parserAppendChild(span);
    190190    span->attach();
    191191    return span.release();
     
    196196    // Create a table row.
    197197    RefPtr<HTMLTableRowElement> trow = HTMLTableRowElement::create(this);
    198     m_tbody->parserAddChild(trow);
     198    m_tbody->parserAppendChild(trow);
    199199    trow->attach();
    200200
     
    202202    RefPtr<HTMLTableCellElement> td = HTMLTableCellElement::create(tdTag, this);
    203203    td->setAttribute(classAttr, "webkit-line-number");
    204     trow->parserAddChild(td);
     204    trow->parserAppendChild(td);
    205205    td->attach();
    206206
     
    208208    td = HTMLTableCellElement::create(tdTag, this);
    209209    td->setAttribute(classAttr, "webkit-line-content");
    210     trow->parserAddChild(td);
     210    trow->parserAppendChild(td);
    211211    td->attach();
    212212    m_current = m_td = td;
     
    230230    if (!m_current->hasChildNodes()) {
    231231        RefPtr<HTMLBRElement> br = HTMLBRElement::create(this);
    232         m_current->parserAddChild(br);
     232        m_current->parserAppendChild(br);
    233233        br->attach();
    234234    }
     
    256256        }
    257257        RefPtr<Text> t = Text::create(this, substring);
    258         m_current->parserAddChild(t);
     258        m_current->parserAppendChild(t);
    259259        t->attach();
    260260        if (i < size - 1)
     
    286286    RefPtr<HTMLBaseElement> base = HTMLBaseElement::create(baseTag, this);
    287287    base->setAttribute(hrefAttr, href);
    288     m_current->parserAddChild(base);
     288    m_current->parserAppendChild(base);
    289289    base->attach();
    290290    return base.release();
     
    306306    anchor->setAttribute(targetAttr, "_blank");
    307307    anchor->setAttribute(hrefAttr, url);
    308     m_current->parserAddChild(anchor);
     308    m_current->parserAppendChild(anchor);
    309309    anchor->attach();
    310310    return anchor.release();
  • trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp

    r124537 r129164  
    8181        task.parent->parserInsertBefore(task.child.get(), task.nextChild.get());
    8282    else
    83         task.parent->parserAddChild(task.child.get());
     83        task.parent->parserAppendChild(task.child.get());
    8484
    8585    // JavaScript run from beforeload (or DOM Mutation or event handlers)
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r128373 r129164  
    14891489            if (ContainerNode* parent = lastNode->element()->parentNode())
    14901490                parent->parserRemoveChild(lastNode->element());
    1491             node->element()->parserAddChild(lastNode->element());
     1491            node->element()->parserAppendChild(lastNode->element());
    14921492            if (lastNode->element()->parentElement()->attached() && !lastNode->element()->attached())
    14931493                lastNode->element()->lazyAttach();
     
    15011501            m_tree.fosterParent(lastNode->element());
    15021502        else {
    1503             commonAncestor->node()->parserAddChild(lastNode->element());
     1503            commonAncestor->node()->parserAppendChild(lastNode->element());
    15041504            ASSERT(lastNode->stackItem()->isElementNode());
    15051505            ASSERT(lastNode->element()->parentNode());
     
    15131513        // 13.
    15141514        Element* furthestBlockElement = furthestBlock->element();
    1515         // FIXME: All this creation / parserAddChild / attach business should
     1515        // FIXME: All this creation / parserAppendChild / attach business should
    15161516        //        be in HTMLConstructionSite. My guess is that steps 11--15
    15171517        //        should all be in some HTMLConstructionSite function.
    1518         furthestBlockElement->parserAddChild(newItem->element());
     1518        furthestBlockElement->parserAppendChild(newItem->element());
    15191519        // FIXME: Why is this attach logic necessary? Style resolve should attach us if needed.
    15201520        if (furthestBlockElement->attached() && !newItem->element()->attached()) {
  • trunk/Source/WebCore/html/track/WebVTTParser.cpp

    r126350 r129164  
    352352        String content(m_token.characters().data(), m_token.characters().size());
    353353        RefPtr<Text> child = Text::create(document, content);
    354         m_currentNode->parserAddChild(child);
     354        m_currentNode->parserAppendChild(child);
    355355        break;
    356356    }
     
    369369            if (child->hasTagName(qTag))
    370370                child->setAttribute(titleAttr, AtomicString(m_token.annotation().data(), m_token.annotation().size()));
    371             m_currentNode->parserAddChild(child);
     371            m_currentNode->parserAppendChild(child);
    372372            m_currentNode = child;
    373373        }
     
    386386        double time = collectTimeStamp(m_token.characters().data(), &position);
    387387        if (time != malformedTime)
    388             m_currentNode->parserAddChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters().data(), m_token.characters().size())));
     388            m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", String(m_token.characters().data(), m_token.characters().size())));
    389389        break;
    390390    }
  • trunk/Source/WebCore/xml/XMLErrors.cpp

    r128014 r129164  
    9797
    9898    RefPtr<Element> h3 = doc->createElement(h3Tag, true);
    99     reportElement->parserAddChild(h3.get());
    100     h3->parserAddChild(doc->createTextNode("This page contains the following errors:"));
     99    reportElement->parserAppendChild(h3.get());
     100    h3->parserAppendChild(doc->createTextNode("This page contains the following errors:"));
    101101
    102102    RefPtr<Element> fixed = doc->createElement(divTag, true);
     
    104104    fixedAttributes.append(Attribute(styleAttr, "font-family:monospace;font-size:12px"));
    105105    fixed->parserSetAttributes(fixedAttributes, DisallowScriptingContent);
    106     reportElement->parserAddChild(fixed.get());
     106    reportElement->parserAppendChild(fixed.get());
    107107
    108     fixed->parserAddChild(doc->createTextNode(errorMessages));
     108    fixed->parserAppendChild(doc->createTextNode(errorMessages));
    109109
    110110    h3 = doc->createElement(h3Tag, true);
    111     reportElement->parserAddChild(h3.get());
    112     h3->parserAddChild(doc->createTextNode("Below is a rendering of the page up to the first error."));
     111    reportElement->parserAppendChild(h3.get());
     112    h3->parserAppendChild(doc->createTextNode("Below is a rendering of the page up to the first error."));
    113113
    114114    return reportElement.release();
     
    126126        RefPtr<Element> rootElement = m_document->createElement(htmlTag, true);
    127127        RefPtr<Element> body = m_document->createElement(bodyTag, true);
    128         rootElement->parserAddChild(body);
    129         m_document->parserAddChild(rootElement);
     128        rootElement->parserAppendChild(body);
     129        m_document->parserAppendChild(rootElement);
    130130        if (m_document->attached() && !rootElement->attached())
    131131            rootElement->attach();
     
    136136        RefPtr<Element> rootElement = m_document->createElement(htmlTag, true);
    137137        RefPtr<Element> body = m_document->createElement(bodyTag, true);
    138         rootElement->parserAddChild(body);
     138        rootElement->parserAppendChild(body);
    139139
    140140        documentElement->parentNode()->parserRemoveChild(documentElement.get());
     
    142142            documentElement->detach();
    143143
    144         body->parserAddChild(documentElement);
    145         m_document->parserAddChild(rootElement.get());
     144        body->parserAppendChild(documentElement);
     145        m_document->parserAppendChild(rootElement.get());
    146146
    147147        if (m_document->attached())
     
    163163        RefPtr<Element> paragraph = m_document->createElement(pTag, true);
    164164        paragraph->parserSetAttributes(attributes, DisallowScriptingContent);
    165         paragraph->parserAddChild(m_document->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."));
    166         reportElement->parserAddChild(paragraph.release());
     165        paragraph->parserAppendChild(m_document->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."));
     166        reportElement->parserAppendChild(paragraph.release());
    167167    }
    168168#endif
     
    172172        documentElement->parserInsertBefore(reportElement, documentElement->firstChild());
    173173    else
    174         documentElement->parserAddChild(reportElement);
     174        documentElement->parserAppendChild(reportElement);
    175175
    176176    if (documentElement->attached() && !reportElement->attached())
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp

    r127366 r129164  
    148148    ASSERT(!m_leafTextNode);
    149149    m_leafTextNode = Text::create(document(), "");
    150     m_currentNode->parserAddChild(m_leafTextNode.get());
     150    m_currentNode->parserAppendChild(m_leafTextNode.get());
    151151}
    152152
     
    296296    // For now we have a hack for script/style innerHTML support:
    297297    if (contextElement && (contextElement->hasLocalName(HTMLNames::scriptTag) || contextElement->hasLocalName(HTMLNames::styleTag))) {
    298         fragment->parserAddChild(fragment->document()->createTextNode(chunk));
     298        fragment->parserAppendChild(fragment->document()->createTextNode(chunk));
    299299        return true;
    300300    }
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp

    r128572 r129164  
    817817        m_scriptStartPosition = textPosition();
    818818
    819     m_currentNode->parserAddChild(newElement.get());
     819    m_currentNode->parserAppendChild(newElement.get());
    820820
    821821    pushCurrentNode(newElement.get());
     
    969969    pi->setCreatedByParser(true);
    970970
    971     m_currentNode->parserAddChild(pi.get());
     971    m_currentNode->parserAppendChild(pi.get());
    972972    if (m_view && !pi->attached())
    973973        pi->attach();
     
    997997
    998998    RefPtr<CDATASection> newNode = CDATASection::create(document(), toString(s, len));
    999     m_currentNode->parserAddChild(newNode.get());
     999    m_currentNode->parserAppendChild(newNode.get());
    10001000    if (m_view && !newNode->attached())
    10011001        newNode->attach();
     
    10151015
    10161016    RefPtr<Comment> newNode = Comment::create(document(), toString(s));
    1017     m_currentNode->parserAddChild(newNode.get());
     1017    m_currentNode->parserAppendChild(newNode.get());
    10181018    if (m_view && !newNode->attached())
    10191019        newNode->attach();
     
    10601060
    10611061    if (document())
    1062         document()->parserAddChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID)));
     1062        document()->parserAppendChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID)));
    10631063}
    10641064
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp

    r127366 r129164  
    481481        m_scriptStartPosition = textPosition();
    482482
    483     m_currentNode->parserAddChild(newElement.get());
     483    m_currentNode->parserAppendChild(newElement.get());
    484484
    485485    pushCurrentNode(newElement.get());
     
    573573    pi->setCreatedByParser(true);
    574574
    575     m_currentNode->parserAddChild(pi.get());
     575    m_currentNode->parserAppendChild(pi.get());
    576576    if (m_view && !pi->attached())
    577577        pi->attach();
     
    594594    RefPtr<CDATASection> newNode = CDATASection::create(document(), m_stream.text());
    595595
    596     m_currentNode->parserAddChild(newNode.get());
     596    m_currentNode->parserAppendChild(newNode.get());
    597597    if (m_view && !newNode->attached())
    598598        newNode->attach();
     
    605605    RefPtr<Comment> newNode = Comment::create(document(), m_stream.text());
    606606
    607     m_currentNode->parserAddChild(newNode.get());
     607    m_currentNode->parserAppendChild(newNode.get());
    608608    if (m_view && !newNode->attached())
    609609        newNode->attach();
     
    637637        setIsXHTMLDocument(true); // controls if we replace entities or not.
    638638    if (!m_parsingFragment)
    639         document()->parserAddChild(DocumentType::create(document(), name, publicId, systemId));
    640 
    641 }
    642 }
     639        document()->parserAppendChild(DocumentType::create(document(), name, publicId, systemId));
     640
     641}
     642}
  • trunk/Source/WebCore/xml/parser/XMLTreeBuilder.cpp

    r127300 r129164  
    215215    RefPtr<DocumentType> doctype = DocumentType::create(m_document, token.name(), publicIdentifier, systemIdentifier);
    216216    m_document->setDocType(doctype);
    217     m_document->parserAddChild(doctype);
     217    m_document->parserAppendChild(doctype);
    218218
    219219    if ((publicIdentifier == xhtmlTransitional)
     
    245245
    246246    newElement->beginParsingChildren();
    247     m_currentNodeStack.last().node()->parserAddChild(newElement.get());
     247    m_currentNodeStack.last().node()->parserAppendChild(newElement.get());
    248248
    249249    top.setNode(newElement);
     
    389389inline void XMLTreeBuilder::add(PassRefPtr<Node> node)
    390390{
    391     m_currentNodeStack.last().node()->parserAddChild(node.get());
     391    m_currentNodeStack.last().node()->parserAppendChild(node.get());
    392392    if (!node->attached())
    393393        node->attach();
Note: See TracChangeset for help on using the changeset viewer.