Changeset 65986 in webkit
- Timestamp:
- Aug 24, 2010 11:21:44 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65982 r65986 1 2010-08-24 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Delete HTMLElement::checkDTD 6 https://bugs.webkit.org/show_bug.cgi?id=44563 7 8 This function existed to service the LegacyHTMLTreeBuilder. The new 9 HTMLTreeBuilder has this logic internalized. Pulling on this thread 10 caused me to remove a legacyParserAddChild and to discover some code 11 that shouldn't be calling these parser-specific APIs. 12 13 * dom/ContainerNode.cpp: 14 (WebCore::ContainerNode::parserAddChild): 15 (WebCore::ContainerNode::deprecatedParserAddChild): 16 * dom/ContainerNode.h: 17 * dom/DOMImplementation.cpp: 18 (WebCore::DOMImplementation::createDocument): 19 * dom/Node.cpp: 20 (WebCore::Node::deprecatedParserAddChild): 21 * dom/Node.h: 22 * dom/XMLDocumentParser.cpp: 23 (WebCore::XMLDocumentParser::enterText): 24 * dom/XMLDocumentParser.h: 25 * dom/XMLDocumentParserLibxml2.cpp: 26 (WebCore::XMLDocumentParser::startElementNs): 27 (WebCore::XMLDocumentParser::characters): 28 (WebCore::XMLDocumentParser::processingInstruction): 29 (WebCore::XMLDocumentParser::cdataBlock): 30 (WebCore::XMLDocumentParser::comment): 31 (WebCore::XMLDocumentParser::internalSubset): 32 * dom/XMLDocumentParserQt.cpp: 33 (WebCore::XMLDocumentParser::parse): 34 (WebCore::XMLDocumentParser::parseStartElement): 35 (WebCore::XMLDocumentParser::parseCharacters): 36 (WebCore::XMLDocumentParser::parseProcessingInstruction): 37 (WebCore::XMLDocumentParser::parseCdata): 38 (WebCore::XMLDocumentParser::parseComment): 39 (WebCore::XMLDocumentParser::parseDtd): 40 * html/HTMLDataGridElement.cpp: 41 * html/HTMLDataGridElement.h: 42 * html/HTMLDataGridRowElement.cpp: 43 * html/HTMLDataGridRowElement.h: 44 * html/HTMLDataListElement.cpp: 45 * html/HTMLDataListElement.h: 46 * html/HTMLDocument.cpp: 47 * html/HTMLDocument.h: 48 * html/HTMLElement.cpp: 49 * html/HTMLElement.h: 50 * html/HTMLFieldSetElement.cpp: 51 * html/HTMLFieldSetElement.h: 52 * html/HTMLFrameSetElement.cpp: 53 * html/HTMLFrameSetElement.h: 54 * html/HTMLHeadElement.cpp: 55 * html/HTMLHeadElement.h: 56 * html/HTMLHeadingElement.cpp: 57 * html/HTMLHeadingElement.h: 58 * html/HTMLHtmlElement.cpp: 59 * html/HTMLHtmlElement.h: 60 * html/HTMLKeygenElement.cpp: 61 (WebCore::HTMLKeygenElement::HTMLKeygenElement): 62 * html/HTMLMapElement.cpp: 63 * html/HTMLMapElement.h: 64 * html/HTMLMediaElement.cpp: 65 * html/HTMLMediaElement.h: 66 * html/HTMLNoScriptElement.cpp: 67 * html/HTMLNoScriptElement.h: 68 * html/HTMLOptGroupElement.cpp: 69 * html/HTMLOptGroupElement.h: 70 * html/HTMLOptionElement.cpp: 71 * html/HTMLOptionElement.h: 72 * html/HTMLParagraphElement.cpp: 73 * html/HTMLParagraphElement.h: 74 * html/HTMLPlugInElement.cpp: 75 * html/HTMLPlugInElement.h: 76 * html/HTMLScriptElement.h: 77 * html/HTMLSelectElement.cpp: 78 * html/HTMLSelectElement.h: 79 * html/HTMLStyleElement.h: 80 * html/HTMLTableColElement.cpp: 81 * html/HTMLTableColElement.h: 82 * html/HTMLTableElement.cpp: 83 * html/HTMLTableElement.h: 84 * html/HTMLTableRowElement.cpp: 85 * html/HTMLTableRowElement.h: 86 * html/HTMLTableSectionElement.cpp: 87 * html/HTMLTableSectionElement.h: 88 * html/HTMLTextAreaElement.h: 89 * html/HTMLTitleElement.h: 90 * rendering/MediaControlElements.cpp: 91 (WebCore::MediaControlElement::attachToParent): 92 (WebCore::MediaControlInputElement::attachToParent): 93 * rendering/TextControlInnerElements.cpp: 94 (WebCore::TextControlInnerElement::attachInnerElement): 95 1 96 2010-08-24 Adam Barth <abarth@webkit.org> 2 97 -
trunk/WebCore/dom/ContainerNode.cpp
r65769 r65986 589 589 } 590 590 591 void ContainerNode:: addChildCommon(Node*newChild)591 void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) 592 592 { 593 593 ASSERT(newChild); … … 597 597 Node* last = m_lastChild; 598 598 // FIXME: This method should take a PassRefPtr. 599 appendChildToContainer<Node, ContainerNode>(newChild , this);599 appendChildToContainer<Node, ContainerNode>(newChild.get(), this); 600 600 allowEventDispatch(); 601 601 … … 607 607 } 608 608 609 void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) 610 { 611 ASSERT(newChild); 612 addChildCommon(newChild.get()); 613 } 614 615 ContainerNode* ContainerNode::legacyParserAddChild(PassRefPtr<Node> newChild) 616 { 617 ASSERT(newChild); 618 619 // Check for consistency with DTD, but only when parsing HTML. 620 if (document()->isHTMLDocument() && !childAllowed(newChild.get())) 621 return 0; 622 623 addChildCommon(newChild.get()); 624 625 if (newChild->isElementNode()) 626 return static_cast<ContainerNode*>(newChild.get()); 627 return this; 609 void ContainerNode::deprecatedParserAddChild(PassRefPtr<Node> node) 610 { 611 parserAddChild(node); 628 612 } 629 613 -
trunk/WebCore/dom/ContainerNode.h
r65849 r65986 52 52 // They don't send DOM mutation events or handle reparenting. 53 53 // However, arbitrary code may be run by beforeload handlers. 54 virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);55 54 void parserAddChild(PassRefPtr<Node>); 56 55 void parserRemoveChild(Node*); … … 101 100 102 101 private: 103 // FIXME: This should take a PassRefPtr. 104 void addChildCommon(Node*); 102 // Never call this function directly. If you're trying to call this 103 // function, your code is either wrong or you're supposed to call 104 // parserAddChild. Please do not call parserAddChild unless you are the 105 // parser! 106 virtual void deprecatedParserAddChild(PassRefPtr<Node>); 107 105 108 void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild); 106 109 void insertBeforeCommon(Node* nextChild, Node* oldChild); -
trunk/WebCore/dom/DOMImplementation.cpp
r62079 r65986 259 259 // FIXME: Shouldn't this call appendChild instead? 260 260 if (doctype) 261 doc-> legacyParserAddChild(doctype);261 doc->parserAddChild(doctype); 262 262 if (documentElement) 263 doc-> legacyParserAddChild(documentElement.release());263 doc->parserAddChild(documentElement.release()); 264 264 265 265 return doc.release(); -
trunk/WebCore/dom/Node.cpp
r65852 r65986 642 642 } 643 643 644 ContainerNode* Node::legacyParserAddChild(PassRefPtr<Node>) 645 { 646 return 0; 644 void Node::deprecatedParserAddChild(PassRefPtr<Node>) 645 { 647 646 } 648 647 … … 1224 1223 return false; 1225 1224 return this == node || node->isDescendantOf(this); 1226 }1227 1228 bool Node::childAllowed(Node* newChild)1229 {1230 return childTypeAllowed(newChild->nodeType());1231 1225 } 1232 1226 -
trunk/WebCore/dom/Node.h
r65852 r65986 259 259 260 260 bool inSameContainingBlockFlowElement(Node*); 261 262 // Used by the parser. Checks against the DTD, unlike DOM operations like appendChild(). 263 // Also does not dispatch DOM mutation events. 264 // Returns the appropriate container node for future insertions as you parse, or 0 for failure. 265 virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>); 261 262 // FIXME: All callers of this function are almost certainly wrong! 263 virtual void deprecatedParserAddChild(PassRefPtr<Node>); 266 264 267 265 // Called by the parser when this element's close tag is reached, … … 424 422 bool contains(const Node*) const; 425 423 426 // These two methods are mutually exclusive. The former is used to do strict error-checking 427 // when adding children via the public DOM API (e.g., appendChild()). The latter is called only when parsing, 428 // to sanity-check against the DTD for error recovery. 424 // This method is used to do strict error-checking when adding children via 425 // the public DOM API (e.g., appendChild()). 429 426 void checkAddChild(Node* newChild, ExceptionCode&); // Error-checking when adding via the DOM API 430 virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD431 427 432 428 void checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode&); -
trunk/WebCore/dom/XMLDocumentParser.cpp
r65958 r65986 171 171 } 172 172 173 boolXMLDocumentParser::enterText()173 void XMLDocumentParser::enterText() 174 174 { 175 175 #if !USE(QXMLSTREAM) … … 177 177 #endif 178 178 RefPtr<Node> newNode = Text::create(document(), ""); 179 if (!m_currentNode->legacyParserAddChild(newNode.get())) 180 return false; 179 m_currentNode->deprecatedParserAddChild(newNode.get()); 181 180 pushCurrentNode(newNode.get()); 182 return true;183 181 } 184 182 -
trunk/WebCore/dom/XMLDocumentParser.h
r65958 r65986 167 167 void insertErrorMessageBlock(); 168 168 169 boolenterText();169 void enterText(); 170 170 void exitText(); 171 171 -
trunk/WebCore/dom/XMLDocumentParserLibxml2.cpp
r65958 r65986 809 809 m_scriptStartLine = lineNumber(); 810 810 811 if (!m_currentNode->legacyParserAddChild(newElement.get())) { 812 stopParsing(); 813 return; 814 } 811 m_currentNode->deprecatedParserAddChild(newElement.get()); 815 812 816 813 pushCurrentNode(newElement.get()); … … 916 913 } 917 914 918 if (m_currentNode->isTextNode() || enterText()) 919 m_bufferedText.append(s, len); 915 if (!m_currentNode->isTextNode()) 916 enterText(); 917 m_bufferedText.append(s, len); 920 918 } 921 919 … … 965 963 pi->setCreatedByParser(true); 966 964 967 if (!m_currentNode->legacyParserAddChild(pi.get())) 968 return; 965 m_currentNode->deprecatedParserAddChild(pi.get()); 969 966 if (m_view && !pi->attached()) 970 967 pi->attach(); … … 992 989 993 990 RefPtr<Node> newNode = CDATASection::create(document(), toString(s, len)); 994 if (!m_currentNode->legacyParserAddChild(newNode.get())) 995 return; 991 m_currentNode->deprecatedParserAddChild(newNode.get()); 996 992 if (m_view && !newNode->attached()) 997 993 newNode->attach(); … … 1011 1007 1012 1008 RefPtr<Node> newNode = Comment::create(document(), toString(s)); 1013 m_currentNode-> legacyParserAddChild(newNode.get());1009 m_currentNode->deprecatedParserAddChild(newNode.get()); 1014 1010 if (m_view && !newNode->attached()) 1015 1011 newNode->attach(); … … 1075 1071 #endif 1076 1072 1077 document()-> legacyParserAddChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID)));1073 document()->parserAddChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID))); 1078 1074 } 1079 1075 } -
trunk/WebCore/dom/XMLDocumentParserQt.cpp
r65878 r65986 411 411 QString entity = m_stream.name().toString(); 412 412 UChar c = decodeNamedEntity(entity.toUtf8().constData()); 413 if ( m_currentNode->isTextNode() || enterText()) {414 ExceptionCode ec = 0;415 String str(&c, 1);416 //qDebug()<<" ------- adding entity "<<str;417 static_cast<Text*>(m_currentNode)->appendData(str, ec);418 }413 if (!m_currentNode->isTextNode()) 414 enterText(); 415 ExceptionCode ec = 0; 416 String str(&c, 1); 417 // qDebug()<<" ------- adding entity "<<str; 418 static_cast<Text*>(m_currentNode)->appendData(str, ec); 419 419 } 420 420 } … … 519 519 m_scriptStartLine = lineNumber(); 520 520 521 if (!m_currentNode->legacyParserAddChild(newElement.get())) { 522 stopParsing(); 523 return; 524 } 521 m_currentNode->parserAddChild(newElement.get()); 525 522 526 523 pushCurrentNode(newElement.get()); … … 600 597 void XMLDocumentParser::parseCharacters() 601 598 { 602 if ( m_currentNode->isTextNode() || enterText()) {603 ExceptionCode ec = 0;604 static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec);605 }599 if (!m_currentNode->isTextNode()) 600 enterText(); 601 ExceptionCode ec = 0; 602 static_cast<Text*>(m_currentNode)->appendData(m_stream.text(), ec); 606 603 } 607 604 … … 620 617 pi->setCreatedByParser(true); 621 618 622 if (!m_currentNode->legacyParserAddChild(pi.get())) 623 return; 619 m_currentNode->parserAddChild(pi.get()); 624 620 if (m_view && !pi->attached()) 625 621 pi->attach(); … … 639 635 640 636 RefPtr<Node> newNode = CDATASection::create(document(), m_stream.text()); 641 if (!m_currentNode->legacyParserAddChild(newNode.get())) 642 return;637 638 m_currentNode->parserAddChild(newNode.get()); 643 639 if (m_view && !newNode->attached()) 644 640 newNode->attach(); … … 650 646 651 647 RefPtr<Node> newNode = Comment::create(document(), m_stream.text()); 652 m_currentNode->legacyParserAddChild(newNode.get()); 648 649 m_currentNode->parserAddChild(newNode.get()); 653 650 if (m_view && !newNode->attached()) 654 651 newNode->attach(); … … 709 706 #endif 710 707 if (!m_parsingFragment) 711 document()-> legacyParserAddChild(DocumentType::create(document(), name, publicId, systemId));712 713 } 714 } 715 708 document()->parserAddChild(DocumentType::create(document(), name, publicId, systemId)); 709 710 } 711 } 712 -
trunk/WebCore/html/HTMLDataGridElement.cpp
r61293 r65986 54 54 { 55 55 m_columns->clearDataGrid(); 56 }57 58 bool HTMLDataGridElement::checkDTD(const Node* newChild)59 {60 if (newChild->isTextNode())61 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();62 return newChild->hasTagName(dcolTag) || newChild->hasTagName(drowTag);63 56 } 64 57 -
trunk/WebCore/html/HTMLDataGridElement.h
r65982 r65986 57 57 HTMLDataGridElement(const QualifiedName&, Document*); 58 58 59 virtual bool checkDTD(const Node*);60 61 59 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 62 60 -
trunk/WebCore/html/HTMLDataGridRowElement.cpp
r61293 r65986 46 46 } 47 47 48 bool HTMLDataGridRowElement::checkDTD(const Node* newChild)49 {50 if (newChild->isTextNode())51 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();52 return newChild->hasTagName(drowTag) || newChild->hasTagName(dcellTag);53 }54 55 48 bool HTMLDataGridRowElement::selected() const 56 49 { -
trunk/WebCore/html/HTMLDataGridRowElement.h
r65982 r65986 48 48 private: 49 49 HTMLDataGridRowElement(const QualifiedName&, Document*); 50 51 virtual bool checkDTD(const Node*);52 50 }; 53 51 -
trunk/WebCore/html/HTMLDataListElement.cpp
r61293 r65986 48 48 } 49 49 50 bool HTMLDataListElement::checkDTD(const Node* newChild)51 {52 return newChild->hasTagName(HTMLNames::optionTag) || HTMLElement::inInlineTagList(newChild);53 }54 55 50 PassRefPtr<HTMLCollection> HTMLDataListElement::options() 56 51 { -
trunk/WebCore/html/HTMLDataListElement.h
r60342 r65986 48 48 private: 49 49 HTMLDataListElement(const QualifiedName&, Document*); 50 51 virtual bool checkDTD(const Node*);52 50 }; 53 51 -
trunk/WebCore/html/HTMLDocument.cpp
r65692 r65986 296 296 // not part of the DOM 297 297 // -------------------------------------------------------------------------- 298 299 bool HTMLDocument::childAllowed(Node *newChild)300 {301 return newChild->hasTagName(htmlTag) || newChild->isCommentNode() || (newChild->nodeType() == DOCUMENT_TYPE_NODE && !doctype());302 }303 298 304 299 PassRefPtr<Element> HTMLDocument::createElement(const AtomicString& name, ExceptionCode& ec) -
trunk/WebCore/html/HTMLDocument.h
r65692 r65986 84 84 85 85 private: 86 virtual bool childAllowed(Node*);87 88 86 virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); 89 87 -
trunk/WebCore/html/HTMLElement.cpp
r65982 r65986 754 754 } 755 755 756 // DOM Section 1.1.1757 bool HTMLElement::childAllowed(Node *newChild)758 {759 if (!Element::childAllowed(newChild))760 return false;761 762 // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.763 if (!document()->isHTMLDocument())764 return true;765 766 // Future-proof for XML content inside HTML documents (we may allow this some day).767 if (newChild->isElementNode() && !newChild->isHTMLElement())768 return true;769 770 // Elements with forbidden tag status can never have children771 if (endTagRequirement() == TagStatusForbidden)772 return false;773 774 // Comment nodes are always allowed.775 if (newChild->isCommentNode())776 return true;777 778 // Now call checkDTD.779 return checkDTD(newChild);780 }781 782 756 // DTD Stuff 783 757 // This unfortunate function is only needed when checking against the DTD. Other languages (like SVG) won't need this. 758 // FIXME: Remove if only used by LegacyHTMLTreeBuilder. 784 759 bool HTMLElement::isRecognizedTagName(const QualifiedName& tagName) 785 760 { … … 980 955 } 981 956 982 bool HTMLElement::checkDTD(const Node* newChild)983 {984 if (hasLocalName(addressTag) && newChild->hasTagName(pTag))985 return true;986 return inEitherTagList(newChild);987 }988 989 957 bool HTMLElement::rendererIsNeeded(RenderStyle *style) 990 958 { -
trunk/WebCore/html/HTMLElement.h
r65982 r65986 90 90 virtual void parseMappedAttribute(Attribute*); 91 91 92 virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD93 94 // Helper function to check the DTD for a given child node.95 virtual bool checkDTD(const Node*);96 97 92 static bool inEitherTagList(const Node*); 98 93 static bool inInlineTagList(const Node*); -
trunk/WebCore/html/HTMLFieldSetElement.cpp
r61293 r65986 45 45 } 46 46 47 bool HTMLFieldSetElement::checkDTD(const Node* newChild)48 {49 return newChild->hasTagName(legendTag) || HTMLElement::checkDTD(newChild);50 }51 52 47 bool HTMLFieldSetElement::supportsFocus() const 53 48 { -
trunk/WebCore/html/HTMLFieldSetElement.h
r65982 r65986 36 36 HTMLFieldSetElement(const QualifiedName&, Document*, HTMLFormElement*); 37 37 38 virtual bool checkDTD(const Node* newChild);39 40 38 virtual bool supportsFocus() const; 41 39 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); -
trunk/WebCore/html/HTMLFrameSetElement.cpp
r64383 r65986 58 58 { 59 59 return adoptRef(new HTMLFrameSetElement(tagName, document)); 60 }61 62 bool HTMLFrameSetElement::checkDTD(const Node* newChild)63 {64 // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).65 // What is the correct behavior?66 if (newChild->isTextNode())67 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();68 return newChild->hasTagName(framesetTag) || newChild->hasTagName(frameTag);69 60 } 70 61 -
trunk/WebCore/html/HTMLFrameSetElement.h
r65982 r65986 69 69 70 70 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 71 virtual bool checkDTD(const Node* newChild);72 71 73 72 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; -
trunk/WebCore/html/HTMLHeadElement.cpp
r61959 r65986 48 48 } 49 49 50 bool HTMLHeadElement::childAllowed(Node* newChild)51 {52 // Do not allow non-whitespace text nodes in the head53 if (newChild->isTextNode())54 return static_cast<Text*>(newChild)->containsOnlyWhitespace();55 56 return HTMLElement::childAllowed(newChild);57 50 } 58 59 bool HTMLHeadElement::checkDTD(const Node* newChild)60 {61 return newChild->hasTagName(noscriptTag) || newChild->hasTagName(titleTag) || newChild->hasTagName(isindexTag) ||62 newChild->hasTagName(baseTag) || newChild->hasTagName(scriptTag) ||63 newChild->hasTagName(styleTag) || newChild->hasTagName(metaTag) ||64 newChild->hasTagName(linkTag) || newChild->isTextNode();65 }66 67 } -
trunk/WebCore/html/HTMLHeadElement.h
r65982 r65986 38 38 39 39 virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; } 40 virtual bool childAllowed(Node* newChild);41 virtual bool checkDTD(const Node* newChild);42 40 }; 43 41 -
trunk/WebCore/html/HTMLHeadingElement.cpp
r61959 r65986 24 24 #include "HTMLHeadingElement.h" 25 25 26 #include "HTMLNames.h"27 28 26 namespace WebCore { 29 30 using namespace HTMLNames;31 27 32 28 inline HTMLHeadingElement::HTMLHeadingElement(const QualifiedName& tagName, Document* document) … … 40 36 } 41 37 42 bool HTMLHeadingElement::checkDTD(const Node* newChild)43 {44 if (newChild->hasTagName(h1Tag) || newChild->hasTagName(h2Tag) ||45 newChild->hasTagName(h3Tag) || newChild->hasTagName(h4Tag) ||46 newChild->hasTagName(h5Tag) || newChild->hasTagName(h6Tag))47 return false;48 49 return inEitherTagList(newChild);50 38 } 51 52 } -
trunk/WebCore/html/HTMLHeadingElement.h
r65982 r65986 36 36 37 37 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 38 virtual bool checkDTD(const Node* newChild);39 38 }; 40 39 -
trunk/WebCore/html/HTMLHtmlElement.cpp
r61959 r65986 51 51 } 52 52 53 bool HTMLHtmlElement::checkDTD(const Node* newChild)54 {55 return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) ||56 newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag);57 }58 59 53 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 60 54 void HTMLHtmlElement::insertedIntoDocument() -
trunk/WebCore/html/HTMLHtmlElement.h
r65982 r65986 38 38 39 39 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 40 virtual bool checkDTD(const Node* newChild);41 40 42 41 #if ENABLE(OFFLINE_WEB_APPLICATIONS) -
trunk/WebCore/html/HTMLKeygenElement.cpp
r62079 r65986 46 46 ASSERT(hasTagName(keygenTag)); 47 47 48 // FIXME: This markup should go in the shadow tree. 48 49 // Add one option element for each key size. 49 50 Vector<String> keys; … … 51 52 for (size_t i = 0; i < keys.size(); ++i) { 52 53 RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document, this->form()); 53 legacyParserAddChild(option);54 option-> legacyParserAddChild(Text::create(document, keys[i]));54 parserAddChild(option); 55 option->parserAddChild(Text::create(document, keys[i])); 55 56 } 56 57 } -
trunk/WebCore/html/HTMLMapElement.cpp
r61959 r65986 57 57 HTMLMapElement::~HTMLMapElement() 58 58 { 59 }60 61 bool HTMLMapElement::checkDTD(const Node* newChild)62 {63 return inEitherTagList(newChild) || newChild->hasTagName(areaTag) // HTML 4 DTD64 || newChild->hasTagName(scriptTag); // extensions65 59 } 66 60 -
trunk/WebCore/html/HTMLMapElement.h
r65982 r65986 49 49 50 50 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 51 virtual bool checkDTD(const Node*);52 51 53 52 virtual void parseMappedAttribute(Attribute*); -
trunk/WebCore/html/HTMLMediaElement.cpp
r65324 r65986 161 161 document()->registerForMediaVolumeCallbacks(this); 162 162 HTMLElement::didMoveToNewOwnerDocument(); 163 }164 165 166 bool HTMLMediaElement::checkDTD(const Node* newChild)167 {168 return newChild->hasTagName(sourceTag) || HTMLElement::checkDTD(newChild);169 163 } 170 164 -
trunk/WebCore/html/HTMLMediaElement.h
r65170 r65986 184 184 185 185 private: 186 virtual bool checkDTD(const Node* newChild);187 186 virtual void attributeChanged(Attribute*, bool preserveDecls); 188 187 virtual bool rendererIsNeeded(RenderStyle*); -
trunk/WebCore/html/HTMLNoScriptElement.cpp
r61293 r65986 43 43 } 44 44 45 bool HTMLNoScriptElement::checkDTD(const Node* newChild)46 {47 return newChild->isTextNode() || inBlockTagList(newChild);48 }49 50 45 void HTMLNoScriptElement::attach() 51 46 { -
trunk/WebCore/html/HTMLNoScriptElement.h
r60361 r65986 35 35 HTMLNoScriptElement(const QualifiedName&, Document*); 36 36 37 virtual bool checkDTD(const Node*);38 37 virtual void attach(); 39 38 virtual void recalcStyle(StyleChange); -
trunk/WebCore/html/HTMLOptGroupElement.cpp
r61959 r65986 87 87 } 88 88 89 bool HTMLOptGroupElement::checkDTD(const Node* newChild)90 {91 // Make sure to keep this in sync with <select> (other than not allowing an optgroup).92 return newChild->isTextNode() || newChild->hasTagName(HTMLNames::optionTag) || newChild->hasTagName(HTMLNames::hrTag) || newChild->hasTagName(HTMLNames::scriptTag);93 }94 95 89 void HTMLOptGroupElement::attach() 96 90 { -
trunk/WebCore/html/HTMLOptGroupElement.h
r61959 r65986 43 43 HTMLOptGroupElement(const QualifiedName&, Document*, HTMLFormElement*); 44 44 45 virtual bool checkDTD(const Node*);46 45 virtual const AtomicString& formControlType() const; 47 46 virtual bool supportsFocus() const; -
trunk/WebCore/html/HTMLOptionElement.cpp
r61963 r65986 79 79 } 80 80 81 bool HTMLOptionElement::checkDTD(const Node* newChild)82 {83 return newChild->isTextNode() || newChild->hasTagName(scriptTag);84 }85 86 81 void HTMLOptionElement::attach() 87 82 { -
trunk/WebCore/html/HTMLOptionElement.h
r65982 r65986 68 68 69 69 virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; } 70 virtual bool checkDTD(const Node* newChild);71 70 virtual bool supportsFocus() const; 72 71 virtual bool isFocusable() const; -
trunk/WebCore/html/HTMLParagraphElement.cpp
r61959 r65986 45 45 } 46 46 47 bool HTMLParagraphElement::checkDTD(const Node* newChild)48 {49 return inInlineTagList(newChild) || (document()->inCompatMode() && newChild->hasTagName(tableTag));50 }51 52 47 bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const 53 48 { -
trunk/WebCore/html/HTMLParagraphElement.h
r65982 r65986 36 36 37 37 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 38 virtual bool checkDTD(const Node* newChild);39 38 40 39 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; -
trunk/WebCore/html/HTMLPlugInElement.cpp
r64093 r65986 144 144 } 145 145 146 bool HTMLPlugInElement::checkDTD(const Node* newChild)147 {148 return newChild->hasTagName(paramTag) || HTMLFrameOwnerElement::checkDTD(newChild);149 }150 151 146 void HTMLPlugInElement::defaultEventHandler(Event* event) 152 147 { -
trunk/WebCore/html/HTMLPlugInElement.h
r64093 r65986 67 67 68 68 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 69 virtual bool checkDTD(const Node* newChild);70 69 71 70 virtual void updateWidget() { } -
trunk/WebCore/html/HTMLScriptElement.h
r65982 r65986 51 51 52 52 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 53 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }54 53 55 54 virtual void parseMappedAttribute(Attribute*); -
trunk/WebCore/html/HTMLSelectElement.cpp
r62391 r65986 59 59 } 60 60 61 bool HTMLSelectElement::checkDTD(const Node* newChild)62 {63 // Make sure to keep <optgroup> in sync with this.64 return newChild->isTextNode() || newChild->hasTagName(optionTag) || newChild->hasTagName(optgroupTag) || newChild->hasTagName(hrTag) ||65 newChild->hasTagName(scriptTag);66 }67 68 61 void HTMLSelectElement::recalcStyle(StyleChange change) 69 62 { -
trunk/WebCore/html/HTMLSelectElement.h
r65982 r65986 87 87 88 88 private: 89 virtual bool checkDTD(const Node* newChild);90 91 89 virtual const AtomicString& formControlType() const; 92 90 -
trunk/WebCore/html/HTMLStyleElement.h
r65982 r65986 43 43 44 44 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 45 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }46 45 47 46 // overload from HTMLElement -
trunk/WebCore/html/HTMLTableColElement.cpp
r65982 r65986 51 51 { 52 52 return hasLocalName(colTag) ? TagStatusForbidden : TagStatusOptional; 53 }54 55 bool HTMLTableColElement::checkDTD(const Node* newChild)56 {57 if (hasLocalName(colTag))58 return false;59 60 if (newChild->isTextNode())61 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();62 return newChild->hasTagName(colTag);63 53 } 64 54 -
trunk/WebCore/html/HTMLTableColElement.h
r65982 r65986 44 44 45 45 virtual HTMLTagStatus endTagRequirement() const; 46 virtual bool checkDTD(const Node*);47 46 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; 48 47 virtual void parseMappedAttribute(Attribute*); -
trunk/WebCore/html/HTMLTableElement.cpp
r62079 r65986 64 64 } 65 65 66 bool HTMLTableElement::checkDTD(const Node* newChild)67 {68 if (newChild->isTextNode())69 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();70 return newChild->hasTagName(captionTag) ||71 newChild->hasTagName(colTag) || newChild->hasTagName(colgroupTag) ||72 newChild->hasTagName(theadTag) || newChild->hasTagName(tfootTag) ||73 newChild->hasTagName(tbodyTag) || newChild->hasTagName(formTag) ||74 newChild->hasTagName(scriptTag);75 }76 77 66 HTMLTableCaptionElement* HTMLTableElement::caption() const 78 67 { … … 250 239 } 251 240 row->remove(ec); 252 }253 254 ContainerNode* HTMLTableElement::legacyParserAddChild(PassRefPtr<Node> child)255 {256 if (child->hasTagName(formTag)) {257 // First add the child.258 HTMLElement::legacyParserAddChild(child);259 260 // Now simply return ourselves as the container to insert into.261 // This has the effect of demoting the form to a leaf and moving it safely out of the way.262 return this;263 }264 265 return HTMLElement::legacyParserAddChild(child.get());266 241 } 267 242 -
trunk/WebCore/html/HTMLTableElement.h
r65982 r65986 64 64 String summary() const; 65 65 66 virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);67 68 66 virtual void attach(); 69 67 … … 75 73 76 74 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } 77 virtual bool checkDTD(const Node*);78 75 79 76 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; -
trunk/WebCore/html/HTMLTableRowElement.cpp
r62079 r65986 53 53 { 54 54 return adoptRef(new HTMLTableRowElement(tagName, document)); 55 }56 57 bool HTMLTableRowElement::checkDTD(const Node* newChild)58 {59 if (newChild->isTextNode())60 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();61 return newChild->hasTagName(tdTag) || newChild->hasTagName(thTag) ||62 newChild->hasTagName(formTag) || newChild->hasTagName(scriptTag);63 }64 65 ContainerNode* HTMLTableRowElement::legacyParserAddChild(PassRefPtr<Node> child)66 {67 if (child->hasTagName(formTag)) {68 // First add the child.69 HTMLTablePartElement::legacyParserAddChild(child);70 71 // Now simply return ourselves as the container to insert into.72 // This has the effect of demoting the form to a leaf and moving it safely out of the way.73 return this;74 }75 76 return HTMLTablePartElement::legacyParserAddChild(child);77 55 } 78 56 -
trunk/WebCore/html/HTMLTableRowElement.h
r65982 r65986 36 36 static PassRefPtr<HTMLTableRowElement> create(const QualifiedName&, Document*); 37 37 38 virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);39 40 38 int rowIndex() const; 41 39 void setRowIndex(int); … … 54 52 55 53 virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; } 56 virtual bool checkDTD(const Node*);57 54 }; 58 55 -
trunk/WebCore/html/HTMLTableSectionElement.cpp
r62079 r65986 46 46 { 47 47 return adoptRef(new HTMLTableSectionElement(tagName, document)); 48 }49 50 bool HTMLTableSectionElement::checkDTD(const Node* newChild)51 {52 if (newChild->isTextNode())53 return static_cast<const Text*>(newChild)->containsOnlyWhitespace();54 return newChild->hasTagName(trTag) || newChild->hasTagName(formTag) ||55 newChild->hasTagName(scriptTag);56 }57 58 ContainerNode* HTMLTableSectionElement::legacyParserAddChild(PassRefPtr<Node> child)59 {60 if (child->hasTagName(formTag)) {61 // First add the child.62 HTMLTablePartElement::legacyParserAddChild(child);63 64 // Now simply return ourselves as the container to insert into.65 // This has the effect of demoting the form to a leaf and moving it safely out of the way.66 return this;67 }68 69 return HTMLTablePartElement::legacyParserAddChild(child);70 48 } 71 49 -
trunk/WebCore/html/HTMLTableSectionElement.h
r65982 r65986 35 35 static PassRefPtr<HTMLTableSectionElement> create(const QualifiedName&, Document*); 36 36 37 virtual ContainerNode* legacyParserAddChild(PassRefPtr<Node>);38 39 37 PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&); 40 38 void deleteRow(int index, ExceptionCode&); … … 60 58 61 59 virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; } 62 virtual bool checkDTD(const Node*);63 60 virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; } 64 61 virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&); -
trunk/WebCore/html/HTMLTextAreaElement.h
r61959 r65986 77 77 virtual void defaultEventHandler(Event*); 78 78 79 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }80 81 79 virtual bool isEnumeratable() const { return true; } 82 80 -
trunk/WebCore/html/HTMLTitleElement.h
r60361 r65986 37 37 HTMLTitleElement(const QualifiedName&, Document*); 38 38 39 virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }40 41 39 virtual void insertedIntoDocument(); 42 40 virtual void removedFromDocument(); -
trunk/WebCore/rendering/MediaControlElements.cpp
r62821 r65986 136 136 void MediaControlElement::attachToParent(Element* parent) 137 137 { 138 parent->legacyParserAddChild(this); 138 // FIXME: This code seems very wrong. Why are we magically adding |this| to the DOM here? 139 // We shouldn't be calling parser API methods outside of the parser! 140 parent->parserAddChild(this); 139 141 } 140 142 … … 393 395 void MediaControlInputElement::attachToParent(Element* parent) 394 396 { 395 parent->legacyParserAddChild(this); 397 // FIXME: This code seems very wrong. Why are we magically adding |this| to the DOM here? 398 // We shouldn't be calling parser API methods outside of the parser! 399 parent->parserAddChild(this); 396 400 } 397 401 -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r65856 r65986 113 113 114 114 // For elements without a shadow parent, add the node to the DOM normally. 115 if (!m_shadowParent) 116 parent->legacyParserAddChild(this); 117 115 if (!m_shadowParent) { 116 // FIXME: This code seems very wrong. Why are we magically adding |this| to the DOM here? 117 // We shouldn't be calling parser API methods outside of the parser! 118 parent->deprecatedParserAddChild(this); 119 } 120 118 121 // Add the renderer to the render tree 119 122 if (renderer)
Note: See TracChangeset
for help on using the changeset viewer.