https://bugs.webkit.org/show_bug.cgi?id=139561
Reviewed by Darin Adler.
Source/WebCore:
The bug was caused by us not setting the form pointer in insertHTMLFormElement.
Since we already avoid associating a form inside HTMLConstructionSite::createHTMLElement,
we didn't need this code at all.
Fixed the bug by partially reverting r160182.
Test: fast/dom/dom-parse-close-form.html
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertHTMLFormElement):
(WebCore::HTMLConstructionSite::insideTemplateElement): Deleted.
* html/parser/HTMLConstructionSite.h:
LayoutTests:
Added a regression test.
* fast/dom/dom-parse-close-form-expected.txt: Added.
* fast/dom/dom-parse-close-form.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177263
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-12-14 Ryosuke Niwa <rniwa@webkit.org>
+
+ REGRESSION(r160182): Fragment parser doesn't close a form element with a close tag
+ https://bugs.webkit.org/show_bug.cgi?id=139561
+
+ Reviewed by Darin Adler.
+
+ Added a regression test.
+
+ * fast/dom/dom-parse-close-form-expected.txt: Added.
+ * fast/dom/dom-parse-close-form.html: Added.
+
2014-12-13 Zalan Bujtas <zalan@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=139597
--- /dev/null
+This tests that DOMParser closes a form element when it sees its close tag.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS (new DOMParser()).parseFromString("<form></form>text", "text/html").body.innerHTML is "<form></form>text"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+
+description('This tests that DOMParser closes a form element when it sees its close tag.');
+
+shouldBeEqualToString('(new DOMParser()).parseFromString("<form></form>text", "text/html").body.innerHTML', '<form></form>text');
+
+var successfullyParsed = true;
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+2014-12-14 Ryosuke Niwa <rniwa@webkit.org>
+
+ REGRESSION(r160182): Fragment parser doesn't close a form element with a close tag
+ https://bugs.webkit.org/show_bug.cgi?id=139561
+
+ Reviewed by Darin Adler.
+
+ The bug was caused by us not setting the form pointer in insertHTMLFormElement.
+ Since we already avoid associating a form inside HTMLConstructionSite::createHTMLElement,
+ we didn't need this code at all.
+
+ Fixed the bug by partially reverting r160182.
+
+ Test: fast/dom/dom-parse-close-form.html
+
+ * html/parser/HTMLConstructionSite.cpp:
+ (WebCore::HTMLConstructionSite::insertHTMLFormElement):
+ (WebCore::HTMLConstructionSite::insideTemplateElement): Deleted.
+ * html/parser/HTMLConstructionSite.h:
+
2014-12-14 Andreas Kling <akling@apple.com>
Fix build even more. Not a strong performance here.
{
RefPtr<Element> element = createHTMLElement(token);
ASSERT(is<HTMLFormElement>(*element));
- RefPtr<HTMLFormElement> form = static_pointer_cast<HTMLFormElement>(element.release());
- if (!insideTemplateElement())
- m_form = form;
- form->setDemoted(isDemoted);
- attachLater(currentNode(), form);
- m_openElements.push(HTMLStackItem::create(form.release(), token));
+ m_form = static_pointer_cast<HTMLFormElement>(element.release());
+ m_form->setDemoted(isDemoted);
+ attachLater(currentNode(), m_form);
+ m_openElements.push(HTMLStackItem::create(m_form, token));
}
void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token)
return currentNode()->document();
}
-inline bool HTMLConstructionSite::insideTemplateElement()
-{
- return !ownerDocumentForCurrentNode().frame();
-}
-
PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token)
{
QualifiedName tagName(nullAtom, token->name(), xhtmlNamespaceURI);
HTMLStackItem* currentStackItem() const { return m_openElements.topStackItem(); }
HTMLStackItem* oneBelowTop() const { return m_openElements.oneBelowTop(); }
Document& ownerDocumentForCurrentNode();
- bool insideTemplateElement();
HTMLElementStack* openElements() const { return &m_openElements; }
HTMLFormattingElementList* activeFormattingElements() const { return &m_activeFormattingElements; }
bool currentIsRootNode() { return m_openElements.topNode() == m_openElements.rootNode(); }