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

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

Issue 1772853002: Block the HTML parser on external stylesheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified parser blocking logic Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 enum Namespace { 41 enum Namespace {
42 HTML, 42 HTML,
43 SVG, 43 SVG,
44 MathML 44 MathML
45 }; 45 };
46 46
47 public: 47 public:
48 enum SimulatedToken { 48 enum SimulatedToken {
49 ScriptStart, 49 ScriptStart,
50 ScriptEnd, 50 ScriptEnd,
51 StyleEnd,
52 LinkToken,
51 OtherToken 53 OtherToken
52 }; 54 };
53 55
54 typedef Vector<Namespace, 1> State; 56 typedef Vector<Namespace, 1> State;
55 57
56 explicit HTMLTreeBuilderSimulator(const HTMLParserOptions&); 58 explicit HTMLTreeBuilderSimulator(const HTMLParserOptions&);
57 59
58 static State stateFor(HTMLTreeBuilder*); 60 static State stateFor(HTMLTreeBuilder*);
59 61
60 const State& state() const { return m_namespaceStack; } 62 const State& state() const { return m_namespaceStack; }
61 void setState(const State& state) { m_namespaceStack = state; } 63 void setState(const State& state) { m_namespaceStack = state; }
62 64
63 SimulatedToken simulate(const CompactHTMLToken&, HTMLTokenizer*); 65 SimulatedToken simulate(const CompactHTMLToken&, HTMLTokenizer*);
64 66
65 private: 67 private:
66 explicit HTMLTreeBuilderSimulator(HTMLTreeBuilder*); 68 explicit HTMLTreeBuilderSimulator(HTMLTreeBuilder*);
67 69
68 bool inForeignContent() const { return m_namespaceStack.last() != HTML; } 70 bool inForeignContent() const { return m_namespaceStack.last() != HTML; }
69 71
70 HTMLParserOptions m_options; 72 HTMLParserOptions m_options;
71 State m_namespaceStack; 73 State m_namespaceStack;
72 }; 74 };
73 75
74 } // namespace blink 76 } // namespace blink
75 77
76 #endif 78 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698