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

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

Issue 2614663004: Pause HTML parser for external stylesheets in the body (Closed)
Patch Set: Paramaterized test cases Created 3 years, 11 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 m_namespaceStack.push_back(HTML); 144 m_namespaceStack.push_back(HTML);
145 if (!inForeignContent()) { 145 if (!inForeignContent()) {
146 // FIXME: This is just a copy of Tokenizer::updateStateFor which uses 146 // FIXME: This is just a copy of Tokenizer::updateStateFor which uses
147 // threadSafeMatches. 147 // threadSafeMatches.
148 if (threadSafeMatch(tagName, textareaTag) || 148 if (threadSafeMatch(tagName, textareaTag) ||
149 threadSafeMatch(tagName, titleTag)) { 149 threadSafeMatch(tagName, titleTag)) {
150 tokenizer->setState(HTMLTokenizer::RCDATAState); 150 tokenizer->setState(HTMLTokenizer::RCDATAState);
151 } else if (threadSafeMatch(tagName, scriptTag)) { 151 } else if (threadSafeMatch(tagName, scriptTag)) {
152 tokenizer->setState(HTMLTokenizer::ScriptDataState); 152 tokenizer->setState(HTMLTokenizer::ScriptDataState);
153 simulatedToken = ScriptStart; 153 simulatedToken = ScriptStart;
154 } else if (threadSafeMatch(tagName, linkTag)) {
155 simulatedToken = Link;
154 } else if (!m_inSelectInsertionMode) { 156 } else if (!m_inSelectInsertionMode) {
155 // If we're in the "in select" insertion mode, all of these tags are 157 // If we're in the "in select" insertion mode, all of these tags are
156 // ignored, so we shouldn't change the tokenizer state: 158 // ignored, so we shouldn't change the tokenizer state:
157 // https://html.spec.whatwg.org/#parsing-main-inselect 159 // https://html.spec.whatwg.org/#parsing-main-inselect
158 if (threadSafeMatch(tagName, plaintextTag) && 160 if (threadSafeMatch(tagName, plaintextTag) &&
159 !m_inSelectInsertionMode) { 161 !m_inSelectInsertionMode) {
160 tokenizer->setState(HTMLTokenizer::PLAINTEXTState); 162 tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
161 } else if (threadSafeMatch(tagName, styleTag) || 163 } else if (threadSafeMatch(tagName, styleTag) ||
162 threadSafeMatch(tagName, iframeTag) || 164 threadSafeMatch(tagName, iframeTag) ||
163 threadSafeMatch(tagName, xmpTag) || 165 threadSafeMatch(tagName, xmpTag) ||
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 tokenExitsMath(token))) { 200 tokenExitsMath(token))) {
199 m_namespaceStack.pop_back(); 201 m_namespaceStack.pop_back();
200 } 202 }
201 if (threadSafeMatch(tagName, scriptTag)) { 203 if (threadSafeMatch(tagName, scriptTag)) {
202 if (!inForeignContent()) 204 if (!inForeignContent())
203 tokenizer->setState(HTMLTokenizer::DataState); 205 tokenizer->setState(HTMLTokenizer::DataState);
204 return ScriptEnd; 206 return ScriptEnd;
205 } else if (threadSafeMatch(tagName, selectTag)) { 207 } else if (threadSafeMatch(tagName, selectTag)) {
206 m_inSelectInsertionMode = false; 208 m_inSelectInsertionMode = false;
207 } 209 }
210 if (threadSafeMatch(tagName, styleTag))
211 simulatedToken = StyleEnd;
208 } 212 }
209 213
210 // FIXME: Also setForceNullCharacterReplacement when in text mode. 214 // FIXME: Also setForceNullCharacterReplacement when in text mode.
211 tokenizer->setForceNullCharacterReplacement(inForeignContent()); 215 tokenizer->setForceNullCharacterReplacement(inForeignContent());
212 tokenizer->setShouldAllowCDATA(inForeignContent()); 216 tokenizer->setShouldAllowCDATA(inForeignContent());
213 return simulatedToken; 217 return simulatedToken;
214 } 218 }
215 219
216 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTreeBuilderSimulator.h ('k') | third_party/WebKit/Source/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698