Changeset 160182 in webkit
- Timestamp:
- Dec 5, 2013, 11:45:29 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r160181 r160182 1 2013-12-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Change how the form element pointer affects parsing template elements, to reduce weirdness in templates 4 https://bugs.webkit.org/show_bug.cgi?id=125279 5 6 Reviewed by Antti Koivisto. 7 8 Added a regression test. Someone should port this test into web-platform-tests once the latest spec. 9 change has been refelcted to a working draft version of the HTML5 specification. 10 11 * fast/dom/HTMLTemplateElement/no-form-association-2-expected.txt: Added. 12 * fast/dom/HTMLTemplateElement/no-form-association-2.html: Added. 13 1 14 2013-12-05 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r160181 r160182 1 2013-12-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Change how the form element pointer affects parsing template elements, to reduce weirdness in templates 4 https://bugs.webkit.org/show_bug.cgi?id=125279 5 6 Reviewed by Antti Koivisto. 7 8 Faithfully update the HTML5 parser after http://html5.org/tools/web-apps-tracker?from=8330&to=8331. 9 10 Test: fast/dom/HTMLTemplateElement/no-form-association-2.html 11 12 * html/parser/HTMLConstructionSite.cpp: 13 (WebCore::HTMLConstructionSite::insertHTMLFormElement): Don't the form element pointer if the context 14 element or its ancestor is a template element. 15 (WebCore::HTMLConstructionSite::insideTemplateElement): Added. 16 (WebCore::HTMLConstructionSite::createHTMLElement): Renamed openElementsContainTemplateElement to 17 insideTemplateElement to reflect the true semantics of the boolean. 18 19 * html/parser/HTMLConstructionSite.h: 20 21 * html/parser/HTMLTreeBuilder.cpp: 22 (WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody): Ignore the form element pointer if there 23 is a template element on the stack of open elements. This faithfully reflects what's being said in the 24 specification. We should probably make isParsingTemplateContents more efficient by storing a boolean 25 and then wrap from() in some helper function but that should probbaly happen in a separate patch. 26 (WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto. 27 (WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto. 28 (WebCore::HTMLTreeBuilder::processEndTagForInBody): Don't unset or rely on the form element pointer 29 when there is a template element on the stack of open elements. 30 31 * html/parser/HTMLTreeBuilder.h: 32 (WebCore::HTMLTreeBuilder::isParsingTemplateContents): Added a trivial implementation for when 33 TEMPLATE_ELEMENT is disabled. 34 (WebCore::HTMLTreeBuilder::isParsingFragmentOrTemplateContents): Merged two implementations. 35 1 36 2013-12-05 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 37 -
trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp
r159909 r160182 412 412 RefPtr<Element> element = createHTMLElement(token); 413 413 ASSERT(isHTMLFormElement(element.get())); 414 m_form = static_pointer_cast<HTMLFormElement>(element.release()); 415 m_form->setDemoted(isDemoted); 416 attachLater(currentNode(), m_form); 417 m_openElements.push(HTMLStackItem::create(m_form, token)); 414 RefPtr<HTMLFormElement> form = static_pointer_cast<HTMLFormElement>(element.release()); 415 if (!insideTemplateElement()) 416 m_form = form; 417 form->setDemoted(isDemoted); 418 attachLater(currentNode(), form); 419 m_openElements.push(HTMLStackItem::create(form.release(), token)); 418 420 } 419 421 … … 538 540 } 539 541 542 inline bool HTMLConstructionSite::insideTemplateElement() 543 { 544 return !ownerDocumentForCurrentNode().frame(); 545 } 546 540 547 PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token) 541 548 { … … 546 553 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#create-an-element-for-the-token 547 554 Document& ownerDocument = ownerDocumentForCurrentNode(); 548 bool openElementsContainTemplateElement = !ownerDocument.frame();549 RefPtr<Element> element = HTMLElementFactory::createElement(tagName, ownerDocument, openElementsContainTemplateElement ? nullptr : form(), true);555 bool insideTemplateElement = !ownerDocument.frame(); 556 RefPtr<Element> element = HTMLElementFactory::createElement(tagName, ownerDocument, insideTemplateElement ? nullptr : form(), true); 550 557 setAttributes(element.get(), token, m_parserContentPolicy); 551 558 ASSERT(element->isHTMLElement()); -
trunk/Source/WebCore/html/parser/HTMLConstructionSite.h
r159909 r160182 120 120 HTMLStackItem* oneBelowTop() const { return m_openElements.oneBelowTop(); } 121 121 Document& ownerDocumentForCurrentNode(); 122 bool insideTemplateElement(); 122 123 HTMLElementStack* openElements() const { return &m_openElements; } 123 124 HTMLFormattingElementList* activeFormattingElements() const { return &m_activeFormattingElements; } -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
r159610 r160182 463 463 ASSERT(token->name() == isindexTag); 464 464 parseError(token); 465 if (m_tree.form() )465 if (m_tree.form() && !isParsingTemplateContents()) 466 466 return; 467 467 notImplemented(); // Acknowledge self-closing flag … … 701 701 } 702 702 if (token->name() == formTag) { 703 if (m_tree.form() ) {703 if (m_tree.form() && !isParsingTemplateContents()) { 704 704 parseError(token); 705 705 return; … … 1052 1052 if (token->name() == formTag) { 1053 1053 parseError(token); 1054 if (m_tree.form() )1054 if (m_tree.form() && !isParsingTemplateContents()) 1055 1055 return; 1056 1056 m_tree.insertHTMLFormElement(token, true); … … 1865 1865 } 1866 1866 if (token->name() == formTag) { 1867 RefPtr<Element> node = m_tree.takeForm(); 1868 if (!node || !m_tree.openElements()->inScope(node.get())) { 1869 parseError(token); 1870 return; 1871 } 1872 m_tree.generateImpliedEndTags(); 1873 if (m_tree.currentElement() != node.get()) 1874 parseError(token); 1875 m_tree.openElements()->remove(node.get()); 1867 if (!isParsingTemplateContents()) { 1868 RefPtr<Element> node = m_tree.takeForm(); 1869 if (!node || !m_tree.openElements()->inScope(node.get())) { 1870 parseError(token); 1871 return; 1872 } 1873 m_tree.generateImpliedEndTags(); 1874 if (m_tree.currentNode() != node.get()) 1875 parseError(token); 1876 m_tree.openElements()->remove(node.get()); 1877 } else { 1878 if (!m_tree.openElements()->inScope(token->name())) { 1879 parseError(token); 1880 return; 1881 } 1882 m_tree.generateImpliedEndTags(); 1883 if (!m_tree.currentNode()->hasTagName(formTag)) 1884 parseError(token); 1885 m_tree.openElements()->popUntilPopped(token->name()); 1886 } 1876 1887 } 1877 1888 if (token->name() == pTag) { -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h
r156980 r160182 73 73 #if ENABLE(TEMPLATE_ELEMENT) 74 74 bool isParsingTemplateContents() const { return m_tree.openElements()->hasTemplateInHTMLScope(); } 75 #else 76 bool isParsingTemplateContents() const { return false; } 77 #endif 75 78 bool isParsingFragmentOrTemplateContents() const { return isParsingFragment() || isParsingTemplateContents(); } 76 #else77 bool isParsingFragmentOrTemplateContents() const { return isParsingFragment(); }78 #endif79 79 80 80 void detach();
Note:
See TracChangeset
for help on using the changeset viewer.