[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 12:32:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bf4dcbabb38b11c209fbdb30bfba8bafcd83499f
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 06:21:44 2010 +0000

    2010-08-24  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Delete HTMLElement::checkDTD
            https://bugs.webkit.org/show_bug.cgi?id=44563
    
            This function existed to service the LegacyHTMLTreeBuilder.  The new
            HTMLTreeBuilder has this logic internalized.  Pulling on this thread
            caused me to remove a legacyParserAddChild and to discover some code
            that shouldn't be calling these parser-specific APIs.
    
            * dom/ContainerNode.cpp:
            (WebCore::ContainerNode::parserAddChild):
            (WebCore::ContainerNode::deprecatedParserAddChild):
            * dom/ContainerNode.h:
            * dom/DOMImplementation.cpp:
            (WebCore::DOMImplementation::createDocument):
            * dom/Node.cpp:
            (WebCore::Node::deprecatedParserAddChild):
            * dom/Node.h:
            * dom/XMLDocumentParser.cpp:
            (WebCore::XMLDocumentParser::enterText):
            * dom/XMLDocumentParser.h:
            * dom/XMLDocumentParserLibxml2.cpp:
            (WebCore::XMLDocumentParser::startElementNs):
            (WebCore::XMLDocumentParser::characters):
            (WebCore::XMLDocumentParser::processingInstruction):
            (WebCore::XMLDocumentParser::cdataBlock):
            (WebCore::XMLDocumentParser::comment):
            (WebCore::XMLDocumentParser::internalSubset):
            * dom/XMLDocumentParserQt.cpp:
            (WebCore::XMLDocumentParser::parse):
            (WebCore::XMLDocumentParser::parseStartElement):
            (WebCore::XMLDocumentParser::parseCharacters):
            (WebCore::XMLDocumentParser::parseProcessingInstruction):
            (WebCore::XMLDocumentParser::parseCdata):
            (WebCore::XMLDocumentParser::parseComment):
            (WebCore::XMLDocumentParser::parseDtd):
            * html/HTMLDataGridElement.cpp:
            * html/HTMLDataGridElement.h:
            * html/HTMLDataGridRowElement.cpp:
            * html/HTMLDataGridRowElement.h:
            * html/HTMLDataListElement.cpp:
            * html/HTMLDataListElement.h:
            * html/HTMLDocument.cpp:
            * html/HTMLDocument.h:
            * html/HTMLElement.cpp:
            * html/HTMLElement.h:
            * html/HTMLFieldSetElement.cpp:
            * html/HTMLFieldSetElement.h:
            * html/HTMLFrameSetElement.cpp:
            * html/HTMLFrameSetElement.h:
            * html/HTMLHeadElement.cpp:
            * html/HTMLHeadElement.h:
            * html/HTMLHeadingElement.cpp:
            * html/HTMLHeadingElement.h:
            * html/HTMLHtmlElement.cpp:
            * html/HTMLHtmlElement.h:
            * html/HTMLKeygenElement.cpp:
            (WebCore::HTMLKeygenElement::HTMLKeygenElement):
            * html/HTMLMapElement.cpp:
            * html/HTMLMapElement.h:
            * html/HTMLMediaElement.cpp:
            * html/HTMLMediaElement.h:
            * html/HTMLNoScriptElement.cpp:
            * html/HTMLNoScriptElement.h:
            * html/HTMLOptGroupElement.cpp:
            * html/HTMLOptGroupElement.h:
            * html/HTMLOptionElement.cpp:
            * html/HTMLOptionElement.h:
            * html/HTMLParagraphElement.cpp:
            * html/HTMLParagraphElement.h:
            * html/HTMLPlugInElement.cpp:
            * html/HTMLPlugInElement.h:
            * html/HTMLScriptElement.h:
            * html/HTMLSelectElement.cpp:
            * html/HTMLSelectElement.h:
            * html/HTMLStyleElement.h:
            * html/HTMLTableColElement.cpp:
            * html/HTMLTableColElement.h:
            * html/HTMLTableElement.cpp:
            * html/HTMLTableElement.h:
            * html/HTMLTableRowElement.cpp:
            * html/HTMLTableRowElement.h:
            * html/HTMLTableSectionElement.cpp:
            * html/HTMLTableSectionElement.h:
            * html/HTMLTextAreaElement.h:
            * html/HTMLTitleElement.h:
            * rendering/MediaControlElements.cpp:
            (WebCore::MediaControlElement::attachToParent):
            (WebCore::MediaControlInputElement::attachToParent):
            * rendering/TextControlInnerElements.cpp:
            (WebCore::TextControlInnerElement::attachInnerElement):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65986 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index acf65ba..a0db5ec 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,101 @@
 
         Reviewed by Eric Seidel.
 
+        Delete HTMLElement::checkDTD
+        https://bugs.webkit.org/show_bug.cgi?id=44563
+
+        This function existed to service the LegacyHTMLTreeBuilder.  The new
+        HTMLTreeBuilder has this logic internalized.  Pulling on this thread
+        caused me to remove a legacyParserAddChild and to discover some code
+        that shouldn't be calling these parser-specific APIs.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::parserAddChild):
+        (WebCore::ContainerNode::deprecatedParserAddChild):
+        * dom/ContainerNode.h:
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocument):
+        * dom/Node.cpp:
+        (WebCore::Node::deprecatedParserAddChild):
+        * dom/Node.h:
+        * dom/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::enterText):
+        * dom/XMLDocumentParser.h:
+        * dom/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::startElementNs):
+        (WebCore::XMLDocumentParser::characters):
+        (WebCore::XMLDocumentParser::processingInstruction):
+        (WebCore::XMLDocumentParser::cdataBlock):
+        (WebCore::XMLDocumentParser::comment):
+        (WebCore::XMLDocumentParser::internalSubset):
+        * dom/XMLDocumentParserQt.cpp:
+        (WebCore::XMLDocumentParser::parse):
+        (WebCore::XMLDocumentParser::parseStartElement):
+        (WebCore::XMLDocumentParser::parseCharacters):
+        (WebCore::XMLDocumentParser::parseProcessingInstruction):
+        (WebCore::XMLDocumentParser::parseCdata):
+        (WebCore::XMLDocumentParser::parseComment):
+        (WebCore::XMLDocumentParser::parseDtd):
+        * html/HTMLDataGridElement.cpp:
+        * html/HTMLDataGridElement.h:
+        * html/HTMLDataGridRowElement.cpp:
+        * html/HTMLDataGridRowElement.h:
+        * html/HTMLDataListElement.cpp:
+        * html/HTMLDataListElement.h:
+        * html/HTMLDocument.cpp:
+        * html/HTMLDocument.h:
+        * html/HTMLElement.cpp:
+        * html/HTMLElement.h:
+        * html/HTMLFieldSetElement.cpp:
+        * html/HTMLFieldSetElement.h:
+        * html/HTMLFrameSetElement.cpp:
+        * html/HTMLFrameSetElement.h:
+        * html/HTMLHeadElement.cpp:
+        * html/HTMLHeadElement.h:
+        * html/HTMLHeadingElement.cpp:
+        * html/HTMLHeadingElement.h:
+        * html/HTMLHtmlElement.cpp:
+        * html/HTMLHtmlElement.h:
+        * html/HTMLKeygenElement.cpp:
+        (WebCore::HTMLKeygenElement::HTMLKeygenElement):
+        * html/HTMLMapElement.cpp:
+        * html/HTMLMapElement.h:
+        * html/HTMLMediaElement.cpp:
+        * html/HTMLMediaElement.h:
+        * html/HTMLNoScriptElement.cpp:
+        * html/HTMLNoScriptElement.h:
+        * html/HTMLOptGroupElement.cpp:
+        * html/HTMLOptGroupElement.h:
+        * html/HTMLOptionElement.cpp:
+        * html/HTMLOptionElement.h:
+        * html/HTMLParagraphElement.cpp:
+        * html/HTMLParagraphElement.h:
+        * html/HTMLPlugInElement.cpp:
+        * html/HTMLPlugInElement.h:
+        * html/HTMLScriptElement.h:
+        * html/HTMLSelectElement.cpp:
+        * html/HTMLSelectElement.h:
+        * html/HTMLStyleElement.h:
+        * html/HTMLTableColElement.cpp:
+        * html/HTMLTableColElement.h:
+        * html/HTMLTableElement.cpp:
+        * html/HTMLTableElement.h:
+        * html/HTMLTableRowElement.cpp:
+        * html/HTMLTableRowElement.h:
+        * html/HTMLTableSectionElement.cpp:
+        * html/HTMLTableSectionElement.h:
+        * html/HTMLTextAreaElement.h:
+        * html/HTMLTitleElement.h:
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlElement::attachToParent):
+        (WebCore::MediaControlInputElement::attachToParent):
+        * rendering/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerElement::attachInnerElement):
+
+2010-08-24  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Remove tagPriority
         https://bugs.webkit.org/show_bug.cgi?id=44557
 
diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp
index e919494..ef62b38 100644
--- a/WebCore/dom/ContainerNode.cpp
+++ b/WebCore/dom/ContainerNode.cpp
@@ -588,7 +588,7 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo
     return true;
 }
 
-void ContainerNode::addChildCommon(Node* newChild)
+void ContainerNode::parserAddChild(PassRefPtr<Node> newChild)
 {
     ASSERT(newChild);
     ASSERT(!newChild->parent()); // Use appendChild if you need to handle reparenting (and want DOM mutation events).
@@ -596,7 +596,7 @@ void ContainerNode::addChildCommon(Node* newChild)
     forbidEventDispatch();
     Node* last = m_lastChild;
     // FIXME: This method should take a PassRefPtr.
-    appendChildToContainer<Node, ContainerNode>(newChild, this);
+    appendChildToContainer<Node, ContainerNode>(newChild.get(), this);
     allowEventDispatch();
 
     // FIXME: Why doesn't this use notifyChildInserted(newChild) instead?
@@ -606,25 +606,9 @@ void ContainerNode::addChildCommon(Node* newChild)
     childrenChanged(true, last, 0, 1);
 }
 
-void ContainerNode::parserAddChild(PassRefPtr<Node> newChild)
-{
-    ASSERT(newChild);
-    addChildCommon(newChild.get());
-}
-
-ContainerNode* ContainerNode::legacyParserAddChild(PassRefPtr<Node> newChild)
+void ContainerNode::deprecatedParserAddChild(PassRefPtr<Node> node)
 {
-    ASSERT(newChild);
-
-    // Check for consistency with DTD, but only when parsing HTML.
-    if (document()->isHTMLDocument() && !childAllowed(newChild.get()))
-        return 0;
-
-    addChildCommon(newChild.get());
-
-    if (newChild->isElementNode())
-        return static_cast<ContainerNode*>(newChild.get());
-    return this;
+    parserAddChild(node);
 }
 
 void ContainerNode::suspendPostAttachCallbacks()
diff --git a/WebCore/dom/ContainerNode.h b/WebCore/dom/ContainerNode.h
index b84da2f..ad0a54a 100644
--- a/WebCore/dom/ContainerNode.h
+++ b/WebCore/dom/ContainerNode.h
@@ -51,7 +51,6 @@ public:
     // These methods are only used during parsing.
     // They don't send DOM mutation events or handle reparenting.
     // However, arbitrary code may be run by beforeload handlers.
-    virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);
     void parserAddChild(PassRefPtr<Node>);
     void parserRemoveChild(Node*);
     void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild);
@@ -100,8 +99,12 @@ protected:
     void setLastChild(Node* child) { m_lastChild = child; }
 
 private:
-    // FIXME: This should take a PassRefPtr.
-    void addChildCommon(Node*);
+    // Never call this function directly.  If you're trying to call this
+    // function, your code is either wrong or you're supposed to call
+    // parserAddChild.  Please do not call parserAddChild unless you are the
+    // parser!
+    virtual void deprecatedParserAddChild(PassRefPtr<Node>);
+
     void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild);
     void insertBeforeCommon(Node* nextChild, Node* oldChild);
 
diff --git a/WebCore/dom/DOMImplementation.cpp b/WebCore/dom/DOMImplementation.cpp
index 467f1fc..30e889f 100644
--- a/WebCore/dom/DOMImplementation.cpp
+++ b/WebCore/dom/DOMImplementation.cpp
@@ -258,9 +258,9 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceUR
 
     // FIXME: Shouldn't this call appendChild instead?
     if (doctype)
-        doc->legacyParserAddChild(doctype);
+        doc->parserAddChild(doctype);
     if (documentElement)
-        doc->legacyParserAddChild(documentElement.release());
+        doc->parserAddChild(documentElement.release());
 
     return doc.release();
 }
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index 7b534ce..f4a81ed 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -641,9 +641,8 @@ const AtomicString& Node::virtualNamespaceURI() const
     return nullAtom;
 }
 
-ContainerNode* Node::legacyParserAddChild(PassRefPtr<Node>)
+void Node::deprecatedParserAddChild(PassRefPtr<Node>)
 {
-    return 0;
 }
 
 bool Node::isContentEditable() const
@@ -1225,11 +1224,6 @@ bool Node::contains(const Node* node) const
     return this == node || node->isDescendantOf(this);
 }
 
-bool Node::childAllowed(Node* newChild)
-{
-    return childTypeAllowed(newChild->nodeType());
-}
-
 void Node::attach()
 {
     ASSERT(!attached());
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index 91ce035..697919c 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -258,11 +258,9 @@ public:
     Element* rootEditableElement() const;
     
     bool inSameContainingBlockFlowElement(Node*);
-    
-    // Used by the parser. Checks against the DTD, unlike DOM operations like appendChild().
-    // Also does not dispatch DOM mutation events.
-    // Returns the appropriate container node for future insertions as you parse, or 0 for failure.
-    virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);
+
+    // FIXME: All callers of this function are almost certainly wrong!
+    virtual void deprecatedParserAddChild(PassRefPtr<Node>);
 
     // Called by the parser when this element's close tag is reached,
     // signaling that all child tags have been parsed and added.
@@ -423,11 +421,9 @@ public:
     bool isDescendantOf(const Node*) const;
     bool contains(const Node*) const;
 
-    // These two methods are mutually exclusive.  The former is used to do strict error-checking
-    // when adding children via the public DOM API (e.g., appendChild()).  The latter is called only when parsing, 
-    // to sanity-check against the DTD for error recovery.
+    // This method is used to do strict error-checking when adding children via
+    // the public DOM API (e.g., appendChild()).
     void checkAddChild(Node* newChild, ExceptionCode&); // Error-checking when adding via the DOM API
-    virtual bool childAllowed(Node* newChild);          // Error-checking during parsing that checks the DTD
 
     void checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode&);
     virtual bool canReplaceChild(Node* newChild, Node* oldChild);
diff --git a/WebCore/dom/XMLDocumentParser.cpp b/WebCore/dom/XMLDocumentParser.cpp
index 117a454..c6d9f89 100644
--- a/WebCore/dom/XMLDocumentParser.cpp
+++ b/WebCore/dom/XMLDocumentParser.cpp
@@ -170,16 +170,14 @@ void XMLDocumentParser::handleError(ErrorType type, const char* m, int lineNumbe
         stopParsing();
 }
 
-bool XMLDocumentParser::enterText()
+void XMLDocumentParser::enterText()
 {
 #if !USE(QXMLSTREAM)
     ASSERT(m_bufferedText.size() == 0);
 #endif
     RefPtr<Node> newNode = Text::create(document(), "");
-    if (!m_currentNode->legacyParserAddChild(newNode.get()))
-        return false;
+    m_currentNode->deprecatedParserAddChild(newNode.get());
     pushCurrentNode(newNode.get());
-    return true;
 }
 
 #if !USE(QXMLSTREAM)
diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h
index a93fda7..df0f92a 100644
--- a/WebCore/dom/XMLDocumentParser.h
+++ b/WebCore/dom/XMLDocumentParser.h
@@ -166,7 +166,7 @@ public:
 
         void insertErrorMessageBlock();
 
-        bool enterText();
+        void enterText();
         void exitText();
 
         void doWrite(const String&);
diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp
index 4022db5..37da83c 100644
--- a/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -808,10 +808,7 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha
     if (scriptElement)
         m_scriptStartLine = lineNumber();
 
-    if (!m_currentNode->legacyParserAddChild(newElement.get())) {
-        stopParsing();
-        return;
-    }
+    m_currentNode->deprecatedParserAddChild(newElement.get());
 
     pushCurrentNode(newElement.get());
     if (m_view && !newElement->attached())
@@ -915,8 +912,9 @@ void XMLDocumentParser::characters(const xmlChar* s, int len)
         return;
     }
 
-    if (m_currentNode->isTextNode() || enterText())
-        m_bufferedText.append(s, len);
+    if (!m_currentNode->isTextNode())
+        enterText();
+    m_bufferedText.append(s, len);
 }
 
 void XMLDocumentParser::error(ErrorType type, const char* message, va_list args)
@@ -964,8 +962,7 @@ void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlCh
 
     pi->setCreatedByParser(true);
 
-    if (!m_currentNode->legacyParserAddChild(pi.get()))
-        return;
+    m_currentNode->deprecatedParserAddChild(pi.get());
     if (m_view && !pi->attached())
         pi->attach();
 
@@ -991,8 +988,7 @@ void XMLDocumentParser::cdataBlock(const xmlChar* s, int len)
     exitText();
 
     RefPtr<Node> newNode = CDATASection::create(document(), toString(s, len));
-    if (!m_currentNode->legacyParserAddChild(newNode.get()))
-        return;
+    m_currentNode->deprecatedParserAddChild(newNode.get());
     if (m_view && !newNode->attached())
         newNode->attach();
 }
@@ -1010,7 +1006,7 @@ void XMLDocumentParser::comment(const xmlChar* s)
     exitText();
 
     RefPtr<Node> newNode = Comment::create(document(), toString(s));
-    m_currentNode->legacyParserAddChild(newNode.get());
+    m_currentNode->deprecatedParserAddChild(newNode.get());
     if (m_view && !newNode->attached())
         newNode->attach();
 }
@@ -1074,7 +1070,7 @@ void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* exter
         }
 #endif
 
-        document()->legacyParserAddChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID)));
+        document()->parserAddChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID)));
     }
 }
 
diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp
index 3c01cfe..31775b5 100644
--- a/WebCore/dom/XMLDocumentParserQt.cpp
+++ b/WebCore/dom/XMLDocumentParserQt.cpp
@@ -410,12 +410,12 @@ void XMLDocumentParser::parse()
                ) {
                 QString entity = m_stream.name().toString();
                 UChar c = decodeNamedEntity(entity.toUtf8().constData());
-                if (m_currentNode->isTextNode() || enterText()) {
-                    ExceptionCode ec = 0;
-                    String str(&c, 1);
-                    //qDebug()<<" ------- adding entity "<<str;
-                    static_cast<Text*>(m_currentNode)->appendData(str, ec);
-                }
+                if (!m_currentNode->isTextNode())
+                    enterText();
+                ExceptionCode ec = 0;
+                String str(&c, 1);
+                // qDebug()<<" ------- adding entity "<<str;
+                static_cast<Text*>(m_currentNode)->appendData(str, ec);
             }
         }
             break;
@@ -518,10 +518,7 @@ void XMLDocumentParser::parseStartElement()
     if (scriptElement)
         m_scriptStartLine = lineNumber();
 
-    if (!m_currentNode->legacyParserAddChild(newElement.get())) {
-        stopParsing();
-        return;
-    }
+    m_currentNode->parserAddChild(newElement.get());
 
     pushCurrentNode(newElement.get());
     if (m_view && !newElement->attached())
@@ -599,10 +596,10 @@ void XMLDocumentParser::parseEndElement()
 
 void XMLDocumentParser::parseCharacters()
 {
-    if (m_currentNode->isTextNode() || enterText()) {
-        ExceptionCode ec = 0;
-        static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec);
-    }
+    if (!m_currentNode->isTextNode())
+        enterText();
+    ExceptionCode ec = 0;
+    static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec);
 }
 
 void XMLDocumentParser::parseProcessingInstruction()
@@ -619,8 +616,7 @@ void XMLDocumentParser::parseProcessingInstruction()
 
     pi->setCreatedByParser(true);
 
-    if (!m_currentNode->legacyParserAddChild(pi.get()))
-        return;
+    m_currentNode->parserAddChild(pi.get());
     if (m_view && !pi->attached())
         pi->attach();
 
@@ -638,8 +634,8 @@ void XMLDocumentParser::parseCdata()
     exitText();
 
     RefPtr<Node> newNode = CDATASection::create(document(), m_stream.text());
-    if (!m_currentNode->legacyParserAddChild(newNode.get()))
-        return;
+
+    m_currentNode->parserAddChild(newNode.get());
     if (m_view && !newNode->attached())
         newNode->attach();
 }
@@ -649,7 +645,8 @@ void XMLDocumentParser::parseComment()
     exitText();
 
     RefPtr<Node> newNode = Comment::create(document(), m_stream.text());
-    m_currentNode->legacyParserAddChild(newNode.get());
+
+    m_currentNode->parserAddChild(newNode.get());
     if (m_view && !newNode->attached())
         newNode->attach();
 }
@@ -708,7 +705,7 @@ void XMLDocumentParser::parseDtd()
         handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber());
 #endif
     if (!m_parsingFragment)
-        document()->legacyParserAddChild(DocumentType::create(document(), name, publicId, systemId));
+        document()->parserAddChild(DocumentType::create(document(), name, publicId, systemId));
 
 }
 }
diff --git a/WebCore/html/HTMLDataGridElement.cpp b/WebCore/html/HTMLDataGridElement.cpp
index 82edf8f..d9ffa27 100644
--- a/WebCore/html/HTMLDataGridElement.cpp
+++ b/WebCore/html/HTMLDataGridElement.cpp
@@ -55,13 +55,6 @@ HTMLDataGridElement::~HTMLDataGridElement()
     m_columns->clearDataGrid();
 }
 
-bool HTMLDataGridElement::checkDTD(const Node* newChild)
-{
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(dcolTag) || newChild->hasTagName(drowTag);
-}
-
 RenderObject* HTMLDataGridElement::createRenderer(RenderArena* arena, RenderStyle*)
 {
     return new (arena) RenderDataGrid(this);
diff --git a/WebCore/html/HTMLDataGridElement.h b/WebCore/html/HTMLDataGridElement.h
index d1e97ce..c594623 100644
--- a/WebCore/html/HTMLDataGridElement.h
+++ b/WebCore/html/HTMLDataGridElement.h
@@ -56,8 +56,6 @@ public:
 private:
     HTMLDataGridElement(const QualifiedName&, Document*);
 
-    virtual bool checkDTD(const Node*);
-
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
     RefPtr<DataGridDataSource> m_dataSource;
diff --git a/WebCore/html/HTMLDataGridRowElement.cpp b/WebCore/html/HTMLDataGridRowElement.cpp
index 8e08c7c..74c88ba 100644
--- a/WebCore/html/HTMLDataGridRowElement.cpp
+++ b/WebCore/html/HTMLDataGridRowElement.cpp
@@ -45,13 +45,6 @@ PassRefPtr<HTMLDataGridRowElement> HTMLDataGridRowElement::create(const Qualifie
     return adoptRef(new HTMLDataGridRowElement(name, document));
 }
 
-bool HTMLDataGridRowElement::checkDTD(const Node* newChild)
-{
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(drowTag) || newChild->hasTagName(dcellTag);
-}
-
 bool HTMLDataGridRowElement::selected() const
 {
     return hasAttribute(selectedAttr);
diff --git a/WebCore/html/HTMLDataGridRowElement.h b/WebCore/html/HTMLDataGridRowElement.h
index a7f44b6..3ee5bc6 100644
--- a/WebCore/html/HTMLDataGridRowElement.h
+++ b/WebCore/html/HTMLDataGridRowElement.h
@@ -47,8 +47,6 @@ public:
 
 private:
     HTMLDataGridRowElement(const QualifiedName&, Document*);
-
-    virtual bool checkDTD(const Node*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/HTMLDataListElement.cpp b/WebCore/html/HTMLDataListElement.cpp
index 3404348..b73606d 100644
--- a/WebCore/html/HTMLDataListElement.cpp
+++ b/WebCore/html/HTMLDataListElement.cpp
@@ -47,11 +47,6 @@ PassRefPtr<HTMLDataListElement> HTMLDataListElement::create(const QualifiedName&
     return adoptRef(new HTMLDataListElement(tagName, document));
 }
 
-bool HTMLDataListElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(HTMLNames::optionTag) || HTMLElement::inInlineTagList(newChild);
-}
-
 PassRefPtr<HTMLCollection> HTMLDataListElement::options()
 {
     return HTMLCollection::create(this, DataListOptions);
diff --git a/WebCore/html/HTMLDataListElement.h b/WebCore/html/HTMLDataListElement.h
index 3587234..97e608f 100644
--- a/WebCore/html/HTMLDataListElement.h
+++ b/WebCore/html/HTMLDataListElement.h
@@ -47,8 +47,6 @@ public:
 
 private:
     HTMLDataListElement(const QualifiedName&, Document*);
-
-    virtual bool checkDTD(const Node*);
 };
 
 }  // namespace WebCore
diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp
index 986c51d..cd268ae 100644
--- a/WebCore/html/HTMLDocument.cpp
+++ b/WebCore/html/HTMLDocument.cpp
@@ -296,11 +296,6 @@ PassRefPtr<DocumentParser> HTMLDocument::createParser()
 // not part of the DOM
 // --------------------------------------------------------------------------
 
-bool HTMLDocument::childAllowed(Node *newChild)
-{
-    return newChild->hasTagName(htmlTag) || newChild->isCommentNode() || (newChild->nodeType() == DOCUMENT_TYPE_NODE && !doctype());
-}
-
 PassRefPtr<Element> HTMLDocument::createElement(const AtomicString& name, ExceptionCode& ec)
 {
     if (!isValidName(name)) {
diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h
index f9744c7..b10a4ed 100644
--- a/WebCore/html/HTMLDocument.h
+++ b/WebCore/html/HTMLDocument.h
@@ -83,8 +83,6 @@ protected:
     HTMLDocument(Frame*, const KURL&);
 
 private:
-    virtual bool childAllowed(Node*);
-
     virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
 
     virtual bool isFrameSet() const;
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index 3e1ceaa..e055a3e 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -753,34 +753,9 @@ PassRefPtr<HTMLCollection> HTMLElement::children()
     return HTMLCollection::create(this, NodeChildren);
 }
 
-// DOM Section 1.1.1
-bool HTMLElement::childAllowed(Node *newChild)
-{
-    if (!Element::childAllowed(newChild))
-        return false;
-
-    // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
-    if (!document()->isHTMLDocument())
-        return true;
-
-    // Future-proof for XML content inside HTML documents (we may allow this some day).
-    if (newChild->isElementNode() && !newChild->isHTMLElement())
-        return true;
-
-    // Elements with forbidden tag status can never have children
-    if (endTagRequirement() == TagStatusForbidden)
-        return false;
-
-    // Comment nodes are always allowed.
-    if (newChild->isCommentNode())
-        return true;
-
-    // Now call checkDTD.
-    return checkDTD(newChild);
-}
-
 // DTD Stuff
 // This unfortunate function is only needed when checking against the DTD.  Other languages (like SVG) won't need this.
+// FIXME: Remove if only used by LegacyHTMLTreeBuilder.
 bool HTMLElement::isRecognizedTagName(const QualifiedName& tagName)
 {
     DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ());
@@ -979,13 +954,6 @@ bool HTMLElement::inBlockTagList(const Node* newChild)
     return false;
 }
 
-bool HTMLElement::checkDTD(const Node* newChild)
-{
-    if (hasLocalName(addressTag) && newChild->hasTagName(pTag))
-        return true;
-    return inEitherTagList(newChild);
-}
-
 bool HTMLElement::rendererIsNeeded(RenderStyle *style)
 {
 #if !ENABLE(XHTMLMP)
diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h
index a79da33..e1b56a0 100644
--- a/WebCore/html/HTMLElement.h
+++ b/WebCore/html/HTMLElement.h
@@ -89,11 +89,6 @@ protected:
     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(Attribute*);
 
-    virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
-
-    // Helper function to check the DTD for a given child node.
-    virtual bool checkDTD(const Node*);
-
     static bool inEitherTagList(const Node*);
     static bool inInlineTagList(const Node*);
     static bool inBlockTagList(const Node*);
diff --git a/WebCore/html/HTMLFieldSetElement.cpp b/WebCore/html/HTMLFieldSetElement.cpp
index ae0f8e7..4b90412 100644
--- a/WebCore/html/HTMLFieldSetElement.cpp
+++ b/WebCore/html/HTMLFieldSetElement.cpp
@@ -44,11 +44,6 @@ PassRefPtr<HTMLFieldSetElement> HTMLFieldSetElement::create(const QualifiedName&
     return adoptRef(new HTMLFieldSetElement(tagName, document, form));
 }
 
-bool HTMLFieldSetElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(legendTag) || HTMLElement::checkDTD(newChild);
-}
-
 bool HTMLFieldSetElement::supportsFocus() const
 {
     return HTMLElement::supportsFocus();
diff --git a/WebCore/html/HTMLFieldSetElement.h b/WebCore/html/HTMLFieldSetElement.h
index b3e589a..db99a89 100644
--- a/WebCore/html/HTMLFieldSetElement.h
+++ b/WebCore/html/HTMLFieldSetElement.h
@@ -35,8 +35,6 @@ public:
 private:
     HTMLFieldSetElement(const QualifiedName&, Document*, HTMLFormElement*);
 
-    virtual bool checkDTD(const Node* newChild);
-
     virtual bool supportsFocus() const;
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual const AtomicString& formControlType() const;
diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp
index aee6e13..e1c5fd4 100644
--- a/WebCore/html/HTMLFrameSetElement.cpp
+++ b/WebCore/html/HTMLFrameSetElement.cpp
@@ -59,15 +59,6 @@ PassRefPtr<HTMLFrameSetElement> HTMLFrameSetElement::create(const QualifiedName&
     return adoptRef(new HTMLFrameSetElement(tagName, document));
 }
 
-bool HTMLFrameSetElement::checkDTD(const Node* newChild)
-{
-    // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).
-    // What is the correct behavior?
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(framesetTag) || newChild->hasTagName(frameTag);
-}
-
 bool HTMLFrameSetElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
     if (attrName == bordercolorAttr) {
diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h
index fa63fd8..c48428f 100644
--- a/WebCore/html/HTMLFrameSetElement.h
+++ b/WebCore/html/HTMLFrameSetElement.h
@@ -68,7 +68,6 @@ private:
     HTMLFrameSetElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild);
 
     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(Attribute*);
diff --git a/WebCore/html/HTMLHeadElement.cpp b/WebCore/html/HTMLHeadElement.cpp
index c57cc2f..8218311 100644
--- a/WebCore/html/HTMLHeadElement.cpp
+++ b/WebCore/html/HTMLHeadElement.cpp
@@ -47,21 +47,4 @@ PassRefPtr<HTMLHeadElement> HTMLHeadElement::create(const QualifiedName& tagName
     return adoptRef(new HTMLHeadElement(tagName, document));
 }
 
-bool HTMLHeadElement::childAllowed(Node* newChild)
-{
-    // Do not allow non-whitespace text nodes in the head
-    if (newChild->isTextNode())
-        return static_cast<Text*>(newChild)->containsOnlyWhitespace();
-    
-    return HTMLElement::childAllowed(newChild);
-}
-
-bool HTMLHeadElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(noscriptTag) || newChild->hasTagName(titleTag) || newChild->hasTagName(isindexTag) ||
-           newChild->hasTagName(baseTag) || newChild->hasTagName(scriptTag) ||
-           newChild->hasTagName(styleTag) || newChild->hasTagName(metaTag) ||
-           newChild->hasTagName(linkTag) || newChild->isTextNode();
-}
-
 }
diff --git a/WebCore/html/HTMLHeadElement.h b/WebCore/html/HTMLHeadElement.h
index a4177d3..e8f3492 100644
--- a/WebCore/html/HTMLHeadElement.h
+++ b/WebCore/html/HTMLHeadElement.h
@@ -37,8 +37,6 @@ private:
     HTMLHeadElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
-    virtual bool childAllowed(Node* newChild);
-    virtual bool checkDTD(const Node* newChild);
 };
 
 } // namespace
diff --git a/WebCore/html/HTMLHeadingElement.cpp b/WebCore/html/HTMLHeadingElement.cpp
index e2a0f73..47a9ea3 100644
--- a/WebCore/html/HTMLHeadingElement.cpp
+++ b/WebCore/html/HTMLHeadingElement.cpp
@@ -23,12 +23,8 @@
 #include "config.h"
 #include "HTMLHeadingElement.h"
 
-#include "HTMLNames.h"
-
 namespace WebCore {
 
-using namespace HTMLNames;
-
 inline HTMLHeadingElement::HTMLHeadingElement(const QualifiedName& tagName, Document* document)
     : HTMLElement(tagName, document)
 {
@@ -39,14 +35,4 @@ PassRefPtr<HTMLHeadingElement> HTMLHeadingElement::create(const QualifiedName& t
     return adoptRef(new HTMLHeadingElement(tagName, document));
 }
 
-bool HTMLHeadingElement::checkDTD(const Node* newChild)
-{
-    if (newChild->hasTagName(h1Tag) || newChild->hasTagName(h2Tag) ||
-        newChild->hasTagName(h3Tag) || newChild->hasTagName(h4Tag) ||
-        newChild->hasTagName(h5Tag) || newChild->hasTagName(h6Tag))
-        return false;
-
-    return inEitherTagList(newChild);
-}
-
 }
diff --git a/WebCore/html/HTMLHeadingElement.h b/WebCore/html/HTMLHeadingElement.h
index 9c4b5b9..8d83905 100644
--- a/WebCore/html/HTMLHeadingElement.h
+++ b/WebCore/html/HTMLHeadingElement.h
@@ -35,7 +35,6 @@ private:
     HTMLHeadingElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/HTMLHtmlElement.cpp b/WebCore/html/HTMLHtmlElement.cpp
index 93edf6c..6205d10 100644
--- a/WebCore/html/HTMLHtmlElement.cpp
+++ b/WebCore/html/HTMLHtmlElement.cpp
@@ -50,12 +50,6 @@ PassRefPtr<HTMLHtmlElement> HTMLHtmlElement::create(const QualifiedName& tagName
     return adoptRef(new HTMLHtmlElement(tagName, document));
 }
 
-bool HTMLHtmlElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) ||
-           newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag);
-}
-
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 void HTMLHtmlElement::insertedIntoDocument()
 {
diff --git a/WebCore/html/HTMLHtmlElement.h b/WebCore/html/HTMLHtmlElement.h
index 7efb963..5a74b3d 100644
--- a/WebCore/html/HTMLHtmlElement.h
+++ b/WebCore/html/HTMLHtmlElement.h
@@ -37,7 +37,6 @@ private:
     HTMLHtmlElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild);
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     virtual void insertedIntoDocument();
diff --git a/WebCore/html/HTMLKeygenElement.cpp b/WebCore/html/HTMLKeygenElement.cpp
index 5185f51..881a0a8 100644
--- a/WebCore/html/HTMLKeygenElement.cpp
+++ b/WebCore/html/HTMLKeygenElement.cpp
@@ -45,13 +45,14 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume
 {
     ASSERT(hasTagName(keygenTag));
 
+    // FIXME: This markup should go in the shadow tree.
     // Add one option element for each key size.
     Vector<String> keys;
     getSupportedKeySizes(keys);
     for (size_t i = 0; i < keys.size(); ++i) {
         RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document, this->form());
-        legacyParserAddChild(option);
-        option->legacyParserAddChild(Text::create(document, keys[i]));
+        parserAddChild(option);
+        option->parserAddChild(Text::create(document, keys[i]));
     }
 }
 
diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp
index eba23ca..873a9ab 100644
--- a/WebCore/html/HTMLMapElement.cpp
+++ b/WebCore/html/HTMLMapElement.cpp
@@ -58,12 +58,6 @@ HTMLMapElement::~HTMLMapElement()
 {
 }
 
-bool HTMLMapElement::checkDTD(const Node* newChild)
-{
-    return inEitherTagList(newChild) || newChild->hasTagName(areaTag) // HTML 4 DTD
-        || newChild->hasTagName(scriptTag); // extensions
-}
-
 bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, HitTestResult& result)
 {
     HTMLAreaElement* defaultArea = 0;
diff --git a/WebCore/html/HTMLMapElement.h b/WebCore/html/HTMLMapElement.h
index 44ec4aa..8ff392f 100644
--- a/WebCore/html/HTMLMapElement.h
+++ b/WebCore/html/HTMLMapElement.h
@@ -48,7 +48,6 @@ private:
     HTMLMapElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node*);
 
     virtual void parseMappedAttribute(Attribute*);
 
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 53a8968..2e7ffc5 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -162,12 +162,6 @@ void HTMLMediaElement::didMoveToNewOwnerDocument()
     HTMLElement::didMoveToNewOwnerDocument();
 }
 
-
-bool HTMLMediaElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(sourceTag) || HTMLElement::checkDTD(newChild);
-}
-
 void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
 {
     HTMLElement::attributeChanged(attr, preserveDecls);
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index a73abba..4706178 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -183,7 +183,6 @@ protected:
     virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
 
 private:
-    virtual bool checkDTD(const Node* newChild);    
     virtual void attributeChanged(Attribute*, bool preserveDecls);
     virtual bool rendererIsNeeded(RenderStyle*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/WebCore/html/HTMLNoScriptElement.cpp b/WebCore/html/HTMLNoScriptElement.cpp
index f232340..5bba16f 100644
--- a/WebCore/html/HTMLNoScriptElement.cpp
+++ b/WebCore/html/HTMLNoScriptElement.cpp
@@ -42,11 +42,6 @@ PassRefPtr<HTMLNoScriptElement> HTMLNoScriptElement::create(const QualifiedName&
     return adoptRef(new HTMLNoScriptElement(tagName, document));
 }
 
-bool HTMLNoScriptElement::checkDTD(const Node* newChild)
-{
-    return newChild->isTextNode() || inBlockTagList(newChild); 
-}
-
 void HTMLNoScriptElement::attach()
 {
     HTMLElement::attach();
diff --git a/WebCore/html/HTMLNoScriptElement.h b/WebCore/html/HTMLNoScriptElement.h
index 8b98205..9a3b92d 100644
--- a/WebCore/html/HTMLNoScriptElement.h
+++ b/WebCore/html/HTMLNoScriptElement.h
@@ -34,7 +34,6 @@ public:
 private:
     HTMLNoScriptElement(const QualifiedName&, Document*);
 
-    virtual bool checkDTD(const Node*);
     virtual void attach();
     virtual void recalcStyle(StyleChange);
     virtual bool childShouldCreateRenderer(Node*) const;
diff --git a/WebCore/html/HTMLOptGroupElement.cpp b/WebCore/html/HTMLOptGroupElement.cpp
index 7db0924..091e0f2 100644
--- a/WebCore/html/HTMLOptGroupElement.cpp
+++ b/WebCore/html/HTMLOptGroupElement.cpp
@@ -86,12 +86,6 @@ void HTMLOptGroupElement::recalcSelectOptions()
         static_cast<HTMLSelectElement*>(select)->setRecalcListItems();
 }
 
-bool HTMLOptGroupElement::checkDTD(const Node* newChild)
-{
-    // Make sure to keep this in sync with <select> (other than not allowing an optgroup).
-    return newChild->isTextNode() || newChild->hasTagName(HTMLNames::optionTag) || newChild->hasTagName(HTMLNames::hrTag) || newChild->hasTagName(HTMLNames::scriptTag);
-}
-
 void HTMLOptGroupElement::attach()
 {
     if (parentNode()->renderStyle())
diff --git a/WebCore/html/HTMLOptGroupElement.h b/WebCore/html/HTMLOptGroupElement.h
index 095b9d2..a58e957 100644
--- a/WebCore/html/HTMLOptGroupElement.h
+++ b/WebCore/html/HTMLOptGroupElement.h
@@ -42,7 +42,6 @@ public:
 private:
     HTMLOptGroupElement(const QualifiedName&, Document*, HTMLFormElement*);
 
-    virtual bool checkDTD(const Node*);
     virtual const AtomicString& formControlType() const;
     virtual bool supportsFocus() const;
     virtual bool isFocusable() const;
diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp
index 19f40be..3bf522c 100644
--- a/WebCore/html/HTMLOptionElement.cpp
+++ b/WebCore/html/HTMLOptionElement.cpp
@@ -78,11 +78,6 @@ PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document
     return element.release();
 }
 
-bool HTMLOptionElement::checkDTD(const Node* newChild)
-{
-    return newChild->isTextNode() || newChild->hasTagName(scriptTag);
-}
-
 void HTMLOptionElement::attach()
 {
     if (parentNode()->renderStyle())
diff --git a/WebCore/html/HTMLOptionElement.h b/WebCore/html/HTMLOptionElement.h
index 5711d09..c8b9c2a 100644
--- a/WebCore/html/HTMLOptionElement.h
+++ b/WebCore/html/HTMLOptionElement.h
@@ -67,7 +67,6 @@ private:
     HTMLOptionElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
-    virtual bool checkDTD(const Node* newChild);
     virtual bool supportsFocus() const;
     virtual bool isFocusable() const;
     virtual bool rendererIsNeeded(RenderStyle*) { return false; }
diff --git a/WebCore/html/HTMLParagraphElement.cpp b/WebCore/html/HTMLParagraphElement.cpp
index 4af5b77..0b3e83f 100644
--- a/WebCore/html/HTMLParagraphElement.cpp
+++ b/WebCore/html/HTMLParagraphElement.cpp
@@ -44,11 +44,6 @@ PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(const QualifiedNam
     return adoptRef(new HTMLParagraphElement(tagName, document));
 }
 
-bool HTMLParagraphElement::checkDTD(const Node* newChild)
-{
-    return inInlineTagList(newChild) || (document()->inCompatMode() && newChild->hasTagName(tableTag));
-}
-
 bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
     if (attrName == alignAttr) {
diff --git a/WebCore/html/HTMLParagraphElement.h b/WebCore/html/HTMLParagraphElement.h
index bf47aa4..8fff62d 100644
--- a/WebCore/html/HTMLParagraphElement.h
+++ b/WebCore/html/HTMLParagraphElement.h
@@ -35,7 +35,6 @@ private:
     HTMLParagraphElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild);
 
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(Attribute*);
diff --git a/WebCore/html/HTMLPlugInElement.cpp b/WebCore/html/HTMLPlugInElement.cpp
index 6b11961..1871b65 100644
--- a/WebCore/html/HTMLPlugInElement.cpp
+++ b/WebCore/html/HTMLPlugInElement.cpp
@@ -143,11 +143,6 @@ void HTMLPlugInElement::parseMappedAttribute(Attribute* attr)
         HTMLFrameOwnerElement::parseMappedAttribute(attr);
 }
 
-bool HTMLPlugInElement::checkDTD(const Node* newChild)
-{
-    return newChild->hasTagName(paramTag) || HTMLFrameOwnerElement::checkDTD(newChild);
-}
-
 void HTMLPlugInElement::defaultEventHandler(Event* event)
 {
     // Firefox seems to use a fake event listener to dispatch events to plug-in (tested with mouse events only).
diff --git a/WebCore/html/HTMLPlugInElement.h b/WebCore/html/HTMLPlugInElement.h
index afa74fc..f2f8351 100644
--- a/WebCore/html/HTMLPlugInElement.h
+++ b/WebCore/html/HTMLPlugInElement.h
@@ -66,7 +66,6 @@ private:
     virtual RenderWidget* renderWidgetForJSBindings() const = 0;
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild);
 
     virtual void updateWidget() { }
 
diff --git a/WebCore/html/HTMLScriptElement.h b/WebCore/html/HTMLScriptElement.h
index 5fc95d9..29eb97d 100644
--- a/WebCore/html/HTMLScriptElement.h
+++ b/WebCore/html/HTMLScriptElement.h
@@ -50,7 +50,6 @@ private:
     virtual String scriptContent() const;
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
 
     virtual void parseMappedAttribute(Attribute*);
     virtual void insertedIntoDocument();
diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp
index 6ddcc2d..b1b6d23 100644
--- a/WebCore/html/HTMLSelectElement.cpp
+++ b/WebCore/html/HTMLSelectElement.cpp
@@ -58,13 +58,6 @@ PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tag
     return adoptRef(new HTMLSelectElement(tagName, document, form));
 }
 
-bool HTMLSelectElement::checkDTD(const Node* newChild)
-{
-    // Make sure to keep <optgroup> in sync with this.
-    return newChild->isTextNode() || newChild->hasTagName(optionTag) || newChild->hasTagName(optgroupTag) || newChild->hasTagName(hrTag) ||
-           newChild->hasTagName(scriptTag);
-}
-
 void HTMLSelectElement::recalcStyle(StyleChange change)
 {
     HTMLFormControlElementWithState::recalcStyle(change);
diff --git a/WebCore/html/HTMLSelectElement.h b/WebCore/html/HTMLSelectElement.h
index 918383a..79b0789 100644
--- a/WebCore/html/HTMLSelectElement.h
+++ b/WebCore/html/HTMLSelectElement.h
@@ -86,8 +86,6 @@ protected:
     HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*);
 
 private:
-    virtual bool checkDTD(const Node* newChild);
-
     virtual const AtomicString& formControlType() const;
     
     virtual bool isKeyboardFocusable(KeyboardEvent*) const;
diff --git a/WebCore/html/HTMLStyleElement.h b/WebCore/html/HTMLStyleElement.h
index 1379f1b..d68bab4 100644
--- a/WebCore/html/HTMLStyleElement.h
+++ b/WebCore/html/HTMLStyleElement.h
@@ -42,7 +42,6 @@ private:
     HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
 
     // overload from HTMLElement
     virtual void parseMappedAttribute(Attribute*);
diff --git a/WebCore/html/HTMLTableColElement.cpp b/WebCore/html/HTMLTableColElement.cpp
index 8ae0400..50718b0 100644
--- a/WebCore/html/HTMLTableColElement.cpp
+++ b/WebCore/html/HTMLTableColElement.cpp
@@ -52,16 +52,6 @@ HTMLTagStatus HTMLTableColElement::endTagRequirement() const
     return hasLocalName(colTag) ? TagStatusForbidden : TagStatusOptional;
 }
 
-bool HTMLTableColElement::checkDTD(const Node* newChild)
-{
-    if (hasLocalName(colTag))
-        return false;
-    
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(colTag);
-}
-
 bool HTMLTableColElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
     if (attrName == widthAttr) {
diff --git a/WebCore/html/HTMLTableColElement.h b/WebCore/html/HTMLTableColElement.h
index d093721..1a73ec6 100644
--- a/WebCore/html/HTMLTableColElement.h
+++ b/WebCore/html/HTMLTableColElement.h
@@ -43,7 +43,6 @@ private:
     HTMLTableColElement(const QualifiedName& tagName, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const;
-    virtual bool checkDTD(const Node*);
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(Attribute*);
     virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
diff --git a/WebCore/html/HTMLTableElement.cpp b/WebCore/html/HTMLTableElement.cpp
index 56cb32a..ef29bf6 100644
--- a/WebCore/html/HTMLTableElement.cpp
+++ b/WebCore/html/HTMLTableElement.cpp
@@ -63,17 +63,6 @@ PassRefPtr<HTMLTableElement> HTMLTableElement::create(const QualifiedName& tagNa
     return adoptRef(new HTMLTableElement(tagName, document));
 }
 
-bool HTMLTableElement::checkDTD(const Node* newChild)
-{
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(captionTag) ||
-           newChild->hasTagName(colTag) || newChild->hasTagName(colgroupTag) ||
-           newChild->hasTagName(theadTag) || newChild->hasTagName(tfootTag) ||
-           newChild->hasTagName(tbodyTag) || newChild->hasTagName(formTag) ||
-           newChild->hasTagName(scriptTag);
-}
-
 HTMLTableCaptionElement* HTMLTableElement::caption() const
 {
     for (Node* child = firstChild(); child; child = child->nextSibling()) {
@@ -251,20 +240,6 @@ void HTMLTableElement::deleteRow(int index, ExceptionCode& ec)
     row->remove(ec);
 }
 
-ContainerNode* HTMLTableElement::legacyParserAddChild(PassRefPtr<Node> child)
-{
-    if (child->hasTagName(formTag)) {
-        // First add the child.
-        HTMLElement::legacyParserAddChild(child);
-
-        // Now simply return ourselves as the container to insert into.
-        // This has the effect of demoting the form to a leaf and moving it safely out of the way.
-        return this;
-    }
-
-    return HTMLElement::legacyParserAddChild(child.get());
-}
-
 bool HTMLTableElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
 {
     if (attrName == backgroundAttr) {
diff --git a/WebCore/html/HTMLTableElement.h b/WebCore/html/HTMLTableElement.h
index 7ccc349..80f4a42 100644
--- a/WebCore/html/HTMLTableElement.h
+++ b/WebCore/html/HTMLTableElement.h
@@ -63,8 +63,6 @@ public:
     String rules() const;
     String summary() const;
 
-    virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);
-
     virtual void attach();
 
     void addSharedCellDecls(Vector<CSSMutableStyleDeclaration*>&);
@@ -74,7 +72,6 @@ private:
     HTMLTableElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
-    virtual bool checkDTD(const Node*);
 
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(Attribute*);
diff --git a/WebCore/html/HTMLTableRowElement.cpp b/WebCore/html/HTMLTableRowElement.cpp
index 0bafb12..e9b5cec 100644
--- a/WebCore/html/HTMLTableRowElement.cpp
+++ b/WebCore/html/HTMLTableRowElement.cpp
@@ -54,28 +54,6 @@ PassRefPtr<HTMLTableRowElement> HTMLTableRowElement::create(const QualifiedName&
     return adoptRef(new HTMLTableRowElement(tagName, document));
 }
 
-bool HTMLTableRowElement::checkDTD(const Node* newChild)
-{
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(tdTag) || newChild->hasTagName(thTag) ||
-           newChild->hasTagName(formTag) || newChild->hasTagName(scriptTag);
-}
-
-ContainerNode* HTMLTableRowElement::legacyParserAddChild(PassRefPtr<Node> child)
-{
-    if (child->hasTagName(formTag)) {
-        // First add the child.
-        HTMLTablePartElement::legacyParserAddChild(child);
-
-        // Now simply return ourselves as the container to insert into.
-        // This has the effect of demoting the form to a leaf and moving it safely out of the way.
-        return this;
-    }
-
-    return HTMLTablePartElement::legacyParserAddChild(child);
-}
-
 int HTMLTableRowElement::rowIndex() const
 {
     Node *table = parentNode();
diff --git a/WebCore/html/HTMLTableRowElement.h b/WebCore/html/HTMLTableRowElement.h
index b748fb5..ca241d8 100644
--- a/WebCore/html/HTMLTableRowElement.h
+++ b/WebCore/html/HTMLTableRowElement.h
@@ -35,8 +35,6 @@ public:
     static PassRefPtr<HTMLTableRowElement> create(Document*);
     static PassRefPtr<HTMLTableRowElement> create(const QualifiedName&, Document*);
 
-    virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);
-
     int rowIndex() const;
     void setRowIndex(int);
 
@@ -53,7 +51,6 @@ private:
     HTMLTableRowElement(const QualifiedName&, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
-    virtual bool checkDTD(const Node*);
 };
 
 } // namespace
diff --git a/WebCore/html/HTMLTableSectionElement.cpp b/WebCore/html/HTMLTableSectionElement.cpp
index 93bfef2..982e035 100644
--- a/WebCore/html/HTMLTableSectionElement.cpp
+++ b/WebCore/html/HTMLTableSectionElement.cpp
@@ -47,28 +47,6 @@ PassRefPtr<HTMLTableSectionElement> HTMLTableSectionElement::create(const Qualif
     return adoptRef(new HTMLTableSectionElement(tagName, document));
 }
 
-bool HTMLTableSectionElement::checkDTD(const Node* newChild)
-{
-    if (newChild->isTextNode())
-        return static_cast<const Text*>(newChild)->containsOnlyWhitespace();
-    return newChild->hasTagName(trTag) || newChild->hasTagName(formTag) ||
-           newChild->hasTagName(scriptTag);
-}
-
-ContainerNode* HTMLTableSectionElement::legacyParserAddChild(PassRefPtr<Node> child)
-{
-    if (child->hasTagName(formTag)) {
-        // First add the child.
-        HTMLTablePartElement::legacyParserAddChild(child);
-
-        // Now simply return ourselves as the container to insert into.
-        // This has the effect of demoting the form to a leaf and moving it safely out of the way.
-        return this;
-    }
-
-    return HTMLTablePartElement::legacyParserAddChild(child);
-}
-
 // used by table row groups to share style decls created by the enclosing table.
 void HTMLTableSectionElement::additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>& results)
 {
diff --git a/WebCore/html/HTMLTableSectionElement.h b/WebCore/html/HTMLTableSectionElement.h
index 471ea02..2248e72 100644
--- a/WebCore/html/HTMLTableSectionElement.h
+++ b/WebCore/html/HTMLTableSectionElement.h
@@ -34,8 +34,6 @@ class HTMLTableSectionElement : public HTMLTablePartElement {
 public:
     static PassRefPtr<HTMLTableSectionElement> create(const QualifiedName&, Document*);
 
-    virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);
-
     PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
     void deleteRow(int index, ExceptionCode&);
 
@@ -59,7 +57,6 @@ private:
     HTMLTableSectionElement(const QualifiedName& tagName, Document*);
 
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
-    virtual bool checkDTD(const Node*);
     virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
     virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
 };
diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h
index 43fe493..bb0039e 100644
--- a/WebCore/html/HTMLTextAreaElement.h
+++ b/WebCore/html/HTMLTextAreaElement.h
@@ -76,8 +76,6 @@ private:
 
     virtual void defaultEventHandler(Event*);
 
-    virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
-
     virtual bool isEnumeratable() const { return true; }
 
     virtual const AtomicString& formControlType() const;
diff --git a/WebCore/html/HTMLTitleElement.h b/WebCore/html/HTMLTitleElement.h
index bcd4283..8b90f56 100644
--- a/WebCore/html/HTMLTitleElement.h
+++ b/WebCore/html/HTMLTitleElement.h
@@ -36,8 +36,6 @@ public:
 private:
     HTMLTitleElement(const QualifiedName&, Document*);
 
-    virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
-
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp
index d4eb9a9..3fb712f 100644
--- a/WebCore/rendering/MediaControlElements.cpp
+++ b/WebCore/rendering/MediaControlElements.cpp
@@ -135,7 +135,9 @@ PassRefPtr<MediaControlElement> MediaControlElement::create(HTMLMediaElement* me
 
 void MediaControlElement::attachToParent(Element* parent)
 {
-    parent->legacyParserAddChild(this);
+    // FIXME: This code seems very wrong.  Why are we magically adding |this| to the DOM here?
+    //        We shouldn't be calling parser API methods outside of the parser!
+    parent->parserAddChild(this);
 }
 
 void MediaControlElement::update()
@@ -392,7 +394,9 @@ MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElemen
 
 void MediaControlInputElement::attachToParent(Element* parent)
 {
-    parent->legacyParserAddChild(this);
+    // FIXME: This code seems very wrong.  Why are we magically adding |this| to the DOM here?
+    //        We shouldn't be calling parser API methods outside of the parser!
+    parent->parserAddChild(this);
 }
 
 void MediaControlInputElement::update()
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index 8091bb6..82de5d9 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -112,9 +112,12 @@ void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render
     setInDocument();
     
     // For elements without a shadow parent, add the node to the DOM normally.
-    if (!m_shadowParent)
-        parent->legacyParserAddChild(this);
-    
+    if (!m_shadowParent) {
+        // FIXME: This code seems very wrong.  Why are we magically adding |this| to the DOM here?
+        //        We shouldn't be calling parser API methods outside of the parser!
+        parent->deprecatedParserAddChild(this);
+    }
+ 
     // Add the renderer to the render tree
     if (renderer)
         parent->renderer()->addChild(renderer);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list