Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 2143833003: [Match Spec] Form element pointer should not be updated w/in <template> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo labels which have been split into separate CL Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
index 7e8382c60d5e680c00d6c55b5b7c560972b30b3d..7461e3f6a1d48f969a4440d277db8d7950be15de 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -38,6 +38,7 @@
#include "core/frame/UseCounter.h"
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLFormElement.h"
+#include "core/html/HTMLTemplateElement.h"
#include "core/html/parser/AtomicHTMLToken.h"
#include "core/html/parser/HTMLDocumentParser.h"
#include "core/html/parser/HTMLParserIdioms.h"
@@ -133,12 +134,6 @@ static bool isFormattingTag(const AtomicString& tagName)
return tagName == aTag || isNonAnchorFormattingTag(tagName);
}
-static HTMLFormElement* closestFormAncestor(Element& element)
-{
- ASSERT(isMainThread());
- return Traversal<HTMLFormElement>::firstAncestorOrSelf(element);
-}
-
class HTMLTreeBuilder::CharacterTokenBuffer {
WTF_MAKE_NONCOPYABLE(CharacterTokenBuffer);
public:
@@ -287,7 +282,7 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f
{
ASSERT(isMainThread());
ASSERT(contextElement);
- m_tree.initFragmentParsing(fragment);
+ m_tree.initFragmentParsing(fragment, contextElement);
m_fragmentContext.init(fragment, contextElement);
// Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm:
@@ -300,7 +295,6 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f
m_templateInsertionModes.append(TemplateContentsMode);
resetInsertionModeAppropriately();
- m_tree.setForm(closestFormAncestor(*contextElement));
}
HTMLTreeBuilder::~HTMLTreeBuilder()
@@ -674,7 +668,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
return;
}
if (token->name() == formTag) {
- if (m_tree.form()) {
+ if (m_tree.isFormElementPointerNonNull() && !isParsingTemplateContents()) {
parseError(token);
return;
}
@@ -1039,7 +1033,7 @@ void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken* token)
}
if (token->name() == formTag) {
parseError(token);
- if (m_tree.form())
+ if (m_tree.isFormElementPointerNonNull() && !isParsingTemplateContents())
return;
m_tree.insertHTMLFormElement(token, true);
m_tree.openElements()->pop();
@@ -1791,7 +1785,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token)
m_tree.openElements()->popUntilPopped(token->name());
return;
}
- if (token->name() == formTag) {
+ if (token->name() == formTag && !isParsingTemplateContents()) {
Element* node = m_tree.takeForm();
if (!node || !m_tree.openElements()->inScope(node)) {
parseError(token);
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698