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

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

Issue 2546373002: Properly simulate self-closing tags when in "foreign content" mode (Closed)
Patch Set: Add CORE_EXPORT Created 4 years 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 (threadSafeMatch(tagName, noembedTag) && 151 (threadSafeMatch(tagName, noembedTag) &&
152 m_options.pluginsEnabled) || 152 m_options.pluginsEnabled) ||
153 threadSafeMatch(tagName, noframesTag) || 153 threadSafeMatch(tagName, noframesTag) ||
154 (threadSafeMatch(tagName, noscriptTag) && 154 (threadSafeMatch(tagName, noscriptTag) &&
155 m_options.scriptEnabled)) { 155 m_options.scriptEnabled)) {
156 tokenizer->setState(HTMLTokenizer::RAWTEXTState); 156 tokenizer->setState(HTMLTokenizer::RAWTEXTState);
157 } 157 }
158 } 158 }
159 } 159 }
160 160
161 if (token.type() == HTMLToken::EndTag) { 161 if (token.type() == HTMLToken::EndTag ||
162 (token.selfClosing() && token.type() == HTMLToken::StartTag &&
163 inForeignContent())) {
162 const String& tagName = token.data(); 164 const String& tagName = token.data();
163 if ((m_namespaceStack.back() == SVG && 165 if ((m_namespaceStack.back() == SVG &&
164 threadSafeMatch(tagName, SVGNames::svgTag)) || 166 threadSafeMatch(tagName, SVGNames::svgTag)) ||
165 (m_namespaceStack.back() == MathML && 167 (m_namespaceStack.back() == MathML &&
166 threadSafeMatch(tagName, MathMLNames::mathTag)) || 168 threadSafeMatch(tagName, MathMLNames::mathTag)) ||
167 (m_namespaceStack.contains(SVG) && m_namespaceStack.back() == HTML && 169 (m_namespaceStack.contains(SVG) && m_namespaceStack.back() == HTML &&
168 tokenExitsSVG(token)) || 170 tokenExitsSVG(token)) ||
169 (m_namespaceStack.contains(MathML) && m_namespaceStack.back() == HTML && 171 (m_namespaceStack.contains(MathML) && m_namespaceStack.back() == HTML &&
170 tokenExitsMath(token))) 172 tokenExitsMath(token)))
171 m_namespaceStack.pop_back(); 173 m_namespaceStack.pop_back();
172 if (threadSafeMatch(tagName, scriptTag)) { 174 if (threadSafeMatch(tagName, scriptTag)) {
173 if (!inForeignContent()) 175 if (!inForeignContent())
174 tokenizer->setState(HTMLTokenizer::DataState); 176 tokenizer->setState(HTMLTokenizer::DataState);
175 return ScriptEnd; 177 return ScriptEnd;
176 } 178 }
177 } 179 }
178 180
179 // FIXME: Also setForceNullCharacterReplacement when in text mode. 181 // FIXME: Also setForceNullCharacterReplacement when in text mode.
180 tokenizer->setForceNullCharacterReplacement(inForeignContent()); 182 tokenizer->setForceNullCharacterReplacement(inForeignContent());
181 tokenizer->setShouldAllowCDATA(inForeignContent()); 183 tokenizer->setShouldAllowCDATA(inForeignContent());
182 return simulatedToken; 184 return simulatedToken;
183 } 185 }
184 186
185 } // namespace blink 187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698