OLD | NEW |
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 m_namespaceStack.append(HTML); | 145 m_namespaceStack.append(HTML); |
146 if (!inForeignContent()) { | 146 if (!inForeignContent()) { |
147 // FIXME: This is just a copy of Tokenizer::updateStateFor which use
s threadSafeMatches. | 147 // FIXME: This is just a copy of Tokenizer::updateStateFor which use
s threadSafeMatches. |
148 if (threadSafeMatch(tagName, textareaTag) || threadSafeMatch(tagName
, titleTag)) { | 148 if (threadSafeMatch(tagName, textareaTag) || threadSafeMatch(tagName
, titleTag)) { |
149 tokenizer->setState(HTMLTokenizer::RCDATAState); | 149 tokenizer->setState(HTMLTokenizer::RCDATAState); |
150 } else if (threadSafeMatch(tagName, plaintextTag)) { | 150 } else if (threadSafeMatch(tagName, plaintextTag)) { |
151 tokenizer->setState(HTMLTokenizer::PLAINTEXTState); | 151 tokenizer->setState(HTMLTokenizer::PLAINTEXTState); |
152 } else if (threadSafeMatch(tagName, scriptTag)) { | 152 } else if (threadSafeMatch(tagName, scriptTag)) { |
153 tokenizer->setState(HTMLTokenizer::ScriptDataState); | 153 tokenizer->setState(HTMLTokenizer::ScriptDataState); |
154 simulatedToken = ScriptStart; | 154 simulatedToken = ScriptStart; |
| 155 } else if (threadSafeMatch(tagName, linkTag)) { |
| 156 simulatedToken = LinkToken; |
155 } else if (threadSafeMatch(tagName, styleTag) | 157 } else if (threadSafeMatch(tagName, styleTag) |
156 || threadSafeMatch(tagName, iframeTag) | 158 || threadSafeMatch(tagName, iframeTag) |
157 || threadSafeMatch(tagName, xmpTag) | 159 || threadSafeMatch(tagName, xmpTag) |
158 || (threadSafeMatch(tagName, noembedTag) && m_options.pluginsEna
bled) | 160 || (threadSafeMatch(tagName, noembedTag) && m_options.pluginsEna
bled) |
159 || threadSafeMatch(tagName, noframesTag) | 161 || threadSafeMatch(tagName, noframesTag) |
160 || (threadSafeMatch(tagName, noscriptTag) && m_options.scriptEna
bled)) { | 162 || (threadSafeMatch(tagName, noscriptTag) && m_options.scriptEna
bled)) { |
161 tokenizer->setState(HTMLTokenizer::RAWTEXTState); | 163 tokenizer->setState(HTMLTokenizer::RAWTEXTState); |
162 } | 164 } |
163 } | 165 } |
164 } | 166 } |
165 | 167 |
166 if (token.type() == HTMLToken::EndTag) { | 168 if (token.type() == HTMLToken::EndTag) { |
167 const String& tagName = token.data(); | 169 const String& tagName = token.data(); |
168 if ((m_namespaceStack.last() == SVG && threadSafeMatch(tagName, SVGNames
::svgTag)) | 170 if ((m_namespaceStack.last() == SVG && threadSafeMatch(tagName, SVGNames
::svgTag)) |
169 || (m_namespaceStack.last() == MathML && threadSafeMatch(tagName, Ma
thMLNames::mathTag)) | 171 || (m_namespaceStack.last() == MathML && threadSafeMatch(tagName, Ma
thMLNames::mathTag)) |
170 || (m_namespaceStack.contains(SVG) && m_namespaceStack.last() == HTM
L && tokenExitsSVG(token)) | 172 || (m_namespaceStack.contains(SVG) && m_namespaceStack.last() == HTM
L && tokenExitsSVG(token)) |
171 || (m_namespaceStack.contains(MathML) && m_namespaceStack.last() ==
HTML && tokenExitsMath(token))) | 173 || (m_namespaceStack.contains(MathML) && m_namespaceStack.last() ==
HTML && tokenExitsMath(token))) |
172 m_namespaceStack.removeLast(); | 174 m_namespaceStack.removeLast(); |
173 if (threadSafeMatch(tagName, scriptTag)) { | 175 if (threadSafeMatch(tagName, scriptTag)) { |
174 if (!inForeignContent()) | 176 if (!inForeignContent()) |
175 tokenizer->setState(HTMLTokenizer::DataState); | 177 tokenizer->setState(HTMLTokenizer::DataState); |
176 return ScriptEnd; | 178 return ScriptEnd; |
177 } | 179 } |
| 180 if (threadSafeMatch(tagName, styleTag)) { |
| 181 simulatedToken = StyleEnd; |
| 182 } |
178 } | 183 } |
179 | 184 |
180 // FIXME: Also setForceNullCharacterReplacement when in text mode. | 185 // FIXME: Also setForceNullCharacterReplacement when in text mode. |
181 tokenizer->setForceNullCharacterReplacement(inForeignContent()); | 186 tokenizer->setForceNullCharacterReplacement(inForeignContent()); |
182 tokenizer->setShouldAllowCDATA(inForeignContent()); | 187 tokenizer->setShouldAllowCDATA(inForeignContent()); |
183 return simulatedToken; | 188 return simulatedToken; |
184 } | 189 } |
185 | 190 |
186 } // namespace blink | 191 } // namespace blink |
OLD | NEW |