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

Unified Diff: sky/engine/core/html/parser/HTMLDocumentParser.cpp

Issue 665613003: Remove the ability to parse HTML fragments (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
Index: sky/engine/core/html/parser/HTMLDocumentParser.cpp
diff --git a/sky/engine/core/html/parser/HTMLDocumentParser.cpp b/sky/engine/core/html/parser/HTMLDocumentParser.cpp
index c0d782815622efa576f8b100f7f835e6b06601ca..9006dab0d4f99c45018c16167398ac6da70a8b17 100644
--- a/sky/engine/core/html/parser/HTMLDocumentParser.cpp
+++ b/sky/engine/core/html/parser/HTMLDocumentParser.cpp
@@ -29,7 +29,6 @@
#include "base/bind.h"
#include "core/HTMLNames.h"
#include "core/css/MediaValuesCached.h"
-#include "core/dom/DocumentFragment.h"
#include "core/dom/Element.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLDocument.h"
@@ -46,22 +45,6 @@
namespace blink {
-// This is a direct transcription of step 4 from:
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case
-static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElement, bool reportErrors, const HTMLParserOptions& options)
-{
- if (!contextElement)
- return HTMLTokenizer::DataState;
-
- const QualifiedName& contextTag = contextElement->tagQName();
-
- if (contextTag == HTMLNames::styleTag)
- return HTMLTokenizer::RAWTEXTState;
- if (contextTag == HTMLNames::scriptTag)
- return HTMLTokenizer::ScriptDataState;
- return HTMLTokenizer::DataState;
-}
-
HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors)
: DecodedDataDocumentParser(document)
, m_options(&document)
@@ -78,25 +61,6 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
}
-// FIXME: Member variables should be grouped into self-initializing structs to
-// minimize code duplication between these constructors.
-HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement)
- : DecodedDataDocumentParser(fragment->document())
- , m_options(&fragment->document())
- , m_token(adoptPtr(new HTMLToken))
- , m_tokenizer(HTMLTokenizer::create(m_options))
- , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, m_options))
- , m_weakFactory(this)
- , m_isFragment(true)
- , m_endWasDelayed(false)
- , m_haveBackgroundParser(false)
- , m_pumpSessionNestingLevel(0)
-{
- ASSERT(!shouldUseThreading());
- bool reportErrors = false; // For now document fragment parsing never reports errors.
- m_tokenizer->setState(tokenizerStateForContextElement(contextElement, reportErrors, m_options));
-}
-
HTMLDocumentParser::~HTMLDocumentParser()
{
#if ENABLE(OILPAN)
@@ -702,15 +666,6 @@ void HTMLDocumentParser::executeScriptsWaitingForResources()
resumeParsingAfterScriptExecution();
}
-void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFragment* fragment, Element* contextElement)
-{
- RefPtrWillBeRawPtr<HTMLDocumentParser> parser = HTMLDocumentParser::create(fragment, contextElement);
- parser->insert(source); // Use insert() so that the parser will not yield.
- parser->finish();
- ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/3963151>
- parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction.
-}
-
void HTMLDocumentParser::appendBytes(const char* data, size_t length)
{
if (!length || isStopped())

Powered by Google App Engine
This is Rietveld 408576698