Changeset 62028 in webkit
- Timestamp:
- Jun 28, 2010 1:05:25 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62024 r62028 1 2010-06-28 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 The new tree builder needs to call attach() on elements it attaches to 6 the DOM 7 https://bugs.webkit.org/show_bug.cgi?id=41293 8 9 Update expected results to show that the contents of the iframe 10 actually get created. This only gets us a few lines down the test 11 harness before erroring out again, but I'll take it. 12 13 * html5lib/runner-expected-html5.txt: 14 * html5lib/webkit-resumer-expected-html5.txt: 15 1 16 2010-06-28 Robert Hogan <robert@webkit.org> 2 17 -
trunk/LayoutTests/html5lib/runner-expected-html5.txt
r61991 r62028 1 CONSOLE MESSAGE: line 3 3: TypeError: Result of expression 'iframe.contentWindow' [null] is not an object.1 CONSOLE MESSAGE: line 36: TypeError: Result of expression 'iframe.contentWindow.document.lastChild' [null] is not an object. 2 2 Content-Type: text/plain 3 3 -
trunk/LayoutTests/html5lib/webkit-resumer-expected-html5.txt
r61991 r62028 1 CONSOLE MESSAGE: line 3 3: TypeError: Result of expression 'iframe.contentWindow' [null] is not an object.1 CONSOLE MESSAGE: line 36: TypeError: Result of expression 'iframe.contentWindow.document.lastChild' [null] is not an object. 2 2 Content-Type: text/plain 3 3 -
trunk/WebCore/ChangeLog
r62026 r62028 1 2010-06-28 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 The new tree builder needs to call attach() on elements it attaches to 6 the DOM 7 https://bugs.webkit.org/show_bug.cgi?id=41293 8 9 Apparently Nodes expect to have their attach() method called when they 10 are attached to the DOM. The new tree builder is happy to oblige. 11 Making this call requires some fancy footwork with RefPtr/PassRefPtr to 12 avoid extra ref churn while keeping each function small. 13 14 * html/HTMLTreeBuilder.cpp: 15 (WebCore::HTMLTreeBuilder::insertHTMLStartTagBeforeHTML): 16 (WebCore::HTMLTreeBuilder::processCharacter): 17 (WebCore::HTMLTreeBuilder::insertDoctype): 18 (WebCore::HTMLTreeBuilder::insertComment): 19 (WebCore::HTMLTreeBuilder::insertCommentOnDocument): 20 (WebCore::HTMLTreeBuilder::insertElement): 21 (WebCore::HTMLTreeBuilder::insertSelfClosingElement): 22 (WebCore::HTMLTreeBuilder::insertScriptElement): 23 * html/HTMLTreeBuilder.h: 24 (WebCore::HTMLTreeBuilder::attach): 25 1 26 2010-06-28 Xan Lopez <xlopez@igalia.com> 2 27 -
trunk/WebCore/html/HTMLTreeBuilder.cpp
r61989 r62028 282 282 RefPtr<Element> element = HTMLHtmlElement::create(m_document); 283 283 element->setAttributeMap(token.attributes(), m_fragmentScriptingPermission); 284 m_document->addChild(element); 285 m_openElements.push(element.release()); 284 m_openElements.push(attach(m_document, element.release())); 286 285 } 287 286 … … 667 666 { 668 667 if (insertionMode() == TextMode) { 669 currentElement()->addChild(Text::create(m_document, token.characters()));668 attach(currentElement(), Text::create(m_document, token.characters())); 670 669 return; 671 670 } … … 793 792 { 794 793 ASSERT(token.type() == HTMLToken::DOCTYPE); 795 m_document->addChild(DocumentType::create(m_document, token.name(), String::adopt(token.publicIdentifier()), String::adopt(token.systemIdentifier())));794 attach(m_document, DocumentType::create(m_document, token.name(), String::adopt(token.publicIdentifier()), String::adopt(token.systemIdentifier()))); 796 795 // FIXME: Move quirks mode detection from DocumentType element to here. 797 796 notImplemented(); … … 803 802 { 804 803 ASSERT(token.type() == HTMLToken::Comment); 805 currentElement()->addChild(Comment::create(m_document, token.comment()));804 attach(currentElement(), Comment::create(m_document, token.comment())); 806 805 } 807 806 … … 809 808 { 810 809 ASSERT(token.type() == HTMLToken::Comment); 811 m_document->addChild(Comment::create(m_document, token.comment()));810 attach(m_document, Comment::create(m_document, token.comment())); 812 811 } 813 812 … … 815 814 { 816 815 ASSERT(token.type() == HTMLToken::StartTag); 817 RefPtr<Element> element = createElement(token); 818 currentElement()->addChild(element); 819 m_openElements.push(element.release()); 816 m_openElements.push(attach(currentElement(), createElement(token))); 820 817 } 821 818 … … 823 820 { 824 821 ASSERT(token.type() == HTMLToken::StartTag); 825 currentElement()->addChild(createElement(token));822 attach(currentElement(), createElement(token)); 826 823 // FIXME: Do we want to acknowledge the token's self-closing flag? 827 824 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag … … 857 854 RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, m_document, true); 858 855 element->setAttributeMap(token.attributes(), m_fragmentScriptingPermission); 859 currentElement()->addChild(element); 860 m_openElements.push(element.release()); 856 m_openElements.push(attach(currentElement(), element.release())); 861 857 m_tokenizer->setState(HTMLTokenizer::ScriptDataState); 862 858 m_originalInsertionMode = m_insertionMode; -
trunk/WebCore/html/HTMLTreeBuilder.h
r61990 r62028 178 178 bool processStartTagForInHead(AtomicHTMLToken&); 179 179 180 template<typename ChildType> 181 PassRefPtr<ChildType> attach(Node* parent, PassRefPtr<ChildType> prpChild) 182 { 183 RefPtr<ChildType> child = prpChild; 184 parent->addChild(child); 185 // It's slightly unfortunate that we need to hold a reference to child 186 // here to call attach(). We should investigate whether we can rely on 187 // |parent| to hold a ref at this point. In the common case (at least 188 // for elements), however, we'll get to use this ref in the stack of 189 // open elements. 190 child->attach(); 191 return child.release(); 192 }; 193 180 194 void insertDoctype(AtomicHTMLToken&); 181 195 void insertComment(AtomicHTMLToken&);
Note: See TracChangeset
for help on using the changeset viewer.