Changeset 65134 in webkit
- Timestamp:
- Aug 11, 2010 12:51:08 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65131 r65134 1 2010-08-10 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Fix three ASSERTs hit with the HTML5 TreeBuilder in fragment mode 6 https://bugs.webkit.org/show_bug.cgi?id=43762 7 8 In order to fix the insertAdjacentHTML I had to some behavior. 9 The behavior I changed brings us closer to the HTML5 spec, 10 but since it was not previously tested, I added tests. 11 12 * fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt: Added. 13 * fast/dom/HTMLElement/insertAdjacentHTML-errors.html: Added. 14 1 15 2010-08-11 Yoshiki Hayashi <yhayashi@google.com> 2 16 … … 213 227 * fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt: Added. 214 228 * fast/dom/HTMLElement/insertAdjacentHTML-errors.html: Added. 229 * fast/dom/HTMLElement/script-tests/TEMPLATE.html: Added. 230 * fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js: Added. 231 * fast/dynamic/insertAdjacentHTML-expected.txt: 232 - Updated to match HTML5's expected exception on error. 215 233 216 234 2010-08-10 MORITA Hajime <morrita@google.com> -
trunk/LayoutTests/fast/dynamic/insertAdjacentHTML-expected.txt
r34543 r65134 1 Caught expected exception: Error: NOT_SUPPORTED_ERR: DOM Exception 91 Caught expected exception: Error: SYNTAX_ERR: DOM Exception 12 2 2 1 (black) 2 (green) 3 (green) 4 (black) 3 3 -
trunk/WebCore/ChangeLog
r65133 r65134 1 2010-08-10 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Fix three ASSERTs hit with the HTML5 TreeBuilder in fragment mode 6 https://bugs.webkit.org/show_bug.cgi?id=43762 7 8 In fixing the insertAdjacentHTML I had to make small changes to 9 the error logic, which ended up bringing us closer to HTML5. 10 11 Test: fast/dom/HTMLElement/insertAdjacentHTML-errors.html 12 13 * html/HTMLConstructionSite.cpp: 14 (WebCore::HTMLConstructionSite::attach): 15 - This ASSERT was just wrong, the child should not be attached 16 in the case the parent is not attached. 17 * html/HTMLElement.cpp: 18 (WebCore::contextElementForInsertion): 19 - This is part of HTML5, needed to know what to call the 20 HTML or XML parsers with. The previous code always passed 21 "this" which is wrong in the case of beforeBegin or afterEnd insertion. 22 (WebCore::HTMLElement::insertAdjacentHTML): 23 - Use the right contextElement now that we know how to compute it. 24 * html/HTMLTreeBuilder.cpp: 25 (WebCore::HTMLTreeBuilder::processEndTagForInCell): 26 - This ASSERT is direct from the spec, but it's wrong, so I've filed a spec bug. 27 1 28 2010-08-11 Adam Barth <abarth@webkit.org> 2 29 -
trunk/WebCore/html/HTMLConstructionSite.cpp
r65064 r65134 94 94 if (shouldFosterParent()) { 95 95 fosterParent(child.get()); 96 ASSERT(child->attached() );96 ASSERT(child->attached() || !child->parent()->attached()); 97 97 return child.release(); 98 98 } -
trunk/WebCore/html/HTMLElement.cpp
r65064 r65134 550 550 } 551 551 552 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml() 553 static Element* contextElementForInsertion(const String& where, Element* element, ExceptionCode& ec) 554 { 555 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) { 556 Node* parent = element->parentNode(); 557 if (parent && parent->isDocumentNode()) { 558 ec = NO_MODIFICATION_ALLOWED_ERR; 559 return 0; 560 } 561 ASSERT(!parent || parent->isElementNode()); 562 return static_cast<Element*>(parent); 563 } 564 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd")) 565 return element; 566 ec = SYNTAX_ERR; 567 return 0; 568 } 569 552 570 void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) 553 571 { 554 572 RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); 573 Element* contextElement = contextElementForInsertion(where, this, ec); 574 if (!contextElement) 575 return; 576 555 577 if (document()->isHTMLDocument()) 556 fragment->parseHTML(markup, this);578 fragment->parseHTML(markup, contextElement); 557 579 else { 558 if (!fragment->parseXML(markup, this))580 if (!fragment->parseXML(markup, contextElement)) 559 581 // FIXME: We should propagate a syntax error exception out here. 560 582 return; -
trunk/WebCore/html/HTMLTreeBuilder.cpp
r65064 r65134 1998 1998 m_tree.activeFormattingElements()->clearToLastMarker(); 1999 1999 setInsertionMode(InRowMode); 2000 ASSERT(m_tree.currentElement()->hasTagName(trTag)); 2000 // FIXME: The fragment case of this ASSERT is a spec bug: 2001 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10338 2002 ASSERT(m_tree.currentElement()->hasTagName(trTag) || (isParsingFragment() && m_fragmentContext.contextElement()->hasTagName(trTag))); 2001 2003 return; 2002 2004 }
Note: See TracChangeset
for help on using the changeset viewer.