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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h

Issue 2366203006: Revert r403630 which broke parsing on some sites. (Closed)
Patch Set: Revert r403630 (by hand) Created 4 years, 3 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: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h
index 1d4d898b03dffd9cfa45d9777589daa763e7976e..3b0f3749eec13250c6ae6615e4225b9c4b606c50 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h
@@ -26,7 +26,6 @@
#ifndef HTMLTreeBuilderSimulator_h
#define HTMLTreeBuilderSimulator_h
-#include "core/CoreExport.h"
#include "core/html/parser/HTMLParserOptions.h"
#include "wtf/Vector.h"
@@ -36,7 +35,7 @@ class CompactHTMLToken;
class HTMLTokenizer;
class HTMLTreeBuilder;
-class CORE_EXPORT HTMLTreeBuilderSimulator {
+class HTMLTreeBuilderSimulator {
USING_FAST_MALLOC(HTMLTreeBuilderSimulator);
private:
enum Namespace {
@@ -45,16 +44,6 @@ private:
MathML
};
- struct StateFlags {
- unsigned ns : 2; // Namespace
- unsigned isHTMLIntegrationPoint : 1;
-
- bool operator==(const StateFlags& other) const
- {
- return ns == other.ns && isHTMLIntegrationPoint == other.isHTMLIntegrationPoint;
- }
- };
-
public:
enum SimulatedToken {
ScriptStart,
@@ -62,35 +51,24 @@ public:
OtherToken
};
- // The state of the tree builder simulator is an abbreviated stack
- // of open elements that only contains entries for namespace
- // changes, or elements which may change whether the current node
- // is a HTML integration point.
- typedef Vector<StateFlags, 1> State;
+ typedef Vector<Namespace, 1> State;
explicit HTMLTreeBuilderSimulator(const HTMLParserOptions&);
static State stateFor(HTMLTreeBuilder*);
- const State& state() const { return m_stack; }
- void setState(const State& state) { m_stack = state; }
+ const State& state() const { return m_namespaceStack; }
+ void setState(const State& state) { m_namespaceStack = state; }
SimulatedToken simulate(const CompactHTMLToken&, HTMLTokenizer*);
private:
- bool inForeignContent() const { return currentNamespace() != HTML; }
- Namespace currentNamespace() const { return static_cast<Namespace>(m_stack.last().ns); }
- bool stackContainsNamespace(Namespace namespaceOfInterest) const
- {
- for (const auto& entry : m_stack) {
- if (static_cast<Namespace>(entry.ns) == namespaceOfInterest)
- return true;
- }
- return false;
- }
+ explicit HTMLTreeBuilderSimulator(HTMLTreeBuilder*);
+
+ bool inForeignContent() const { return m_namespaceStack.last() != HTML; }
HTMLParserOptions m_options;
- State m_stack;
+ State m_namespaceStack;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698