From eaa987d5ea129080597e7e537a5037eea213d42d Mon Sep 17 00:00:00 2001 From: kouhei Date: Mon, 19 Oct 2015 18:21:11 -0700 Subject: Rename HTMLConstructionSite::insertSelfClosingHTMLElement{,DestroyingToken} Make it obvious that the method mutates the passed token. This has caused bugs in the past, and this name will avoid making similar mistakes. BUG=None Review URL: https://codereview.chromium.org/1401823002 Cr-Commit-Position: refs/heads/master@{#354949} --- .../Source/core/html/parser/HTMLConstructionSite.cpp | 2 +- .../Source/core/html/parser/HTMLConstructionSite.h | 2 +- .../WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp index ed322ff..d280778 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp @@ -624,7 +624,7 @@ void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) m_openElements.push(HTMLStackItem::create(element.release(), token)); } -void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token) +void HTMLConstructionSite::insertSelfClosingHTMLElementDestroyingToken(AtomicHTMLToken* token) { ASSERT(token->type() == HTMLToken::StartTag); // Normally HTMLElementStack is responsible for calling finishParsingChildren, diff --git a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h index 8e2b3d1..6aeb152 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h @@ -147,7 +147,7 @@ public: void insertCommentOnDocument(AtomicHTMLToken*); void insertCommentOnHTMLHtmlElement(AtomicHTMLToken*); void insertHTMLElement(AtomicHTMLToken*); - void insertSelfClosingHTMLElement(AtomicHTMLToken*); + void insertSelfClosingHTMLElementDestroyingToken(AtomicHTMLToken*); void insertFormattingElement(AtomicHTMLToken*); void insertHTMLHeadElement(AtomicHTMLToken*); void insertHTMLBodyElement(AtomicHTMLToken*); diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp index f8a5ef3..b88efa1 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp @@ -788,7 +788,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) || token->name() == keygenTag || token->name() == wbrTag) { m_tree.reconstructTheActiveFormattingElements(); - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); m_framesetOk = false; return; } @@ -800,8 +800,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) bool disableFrameset = !typeAttribute || !equalIgnoringCase(typeAttribute->value(), "hidden"); m_tree.reconstructTheActiveFormattingElements(); - // TODO(kouhei): Make it obvious that insertSelfClosingHTMLElement may mutate the token. - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); if (disableFrameset) m_framesetOk = false; @@ -811,12 +810,12 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) || token->name() == paramTag || token->name() == sourceTag || token->name() == trackTag) { - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); return; } if (token->name() == hrTag) { processFakePEndTagIfPInButtonScope(); - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); m_framesetOk = false; return; } @@ -1047,7 +1046,7 @@ void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken* token) Attribute* typeAttribute = token->getAttributeItem(typeAttr); if (typeAttribute && equalIgnoringCase(typeAttribute->value(), "hidden")) { parseError(token); - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); return; } // Fall through to "anything else" case. @@ -1176,7 +1175,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token) return; } if (token->name() == colTag) { - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); return; } if (token->name() == templateTag) { @@ -1303,7 +1302,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token) return; } if (token->name() == frameTag) { - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); return; } if (token->name() == noframesTag) { @@ -2582,7 +2581,7 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken* token) || token->name() == commandTag || token->name() == linkTag || token->name() == metaTag) { - m_tree.insertSelfClosingHTMLElement(token); + m_tree.insertSelfClosingHTMLElementDestroyingToken(token); // Note: The custom processing for the tag is done in HTMLMetaElement::process(). return true; } -- cgit v1.1