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

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

Issue 1738133002: Add support for media attribute on link (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 { 238 {
239 TextPosition position = TextPosition(m_input.current().currentLine() , m_input.current().currentColumn()); 239 TextPosition position = TextPosition(m_input.current().currentLine() , m_input.current().currentColumn());
240 240
241 if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenR equest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { 241 if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenR equest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) {
242 xssInfo->m_textPosition = position; 242 xssInfo->m_textPosition = position;
243 m_pendingXSSInfos.append(xssInfo.release()); 243 m_pendingXSSInfos.append(xssInfo.release());
244 } 244 }
245 245
246 CompactHTMLToken token(m_token.get(), position); 246 CompactHTMLToken token(m_token.get(), position);
247 247
248 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads); 248 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads, &m_viewportDescription);
249 simulatedToken = m_treeBuilderSimulator.simulate(token, m_tokenizer. get()); 249 simulatedToken = m_treeBuilderSimulator.simulate(token, m_tokenizer. get());
250 250
251 // Break chunks before a script tag is inserted and flag the chunk a s starting a script 251 // Break chunks before a script tag is inserted and flag the chunk a s starting a script
252 // so the main parser can decide if it should yield before processin g the chunk. 252 // so the main parser can decide if it should yield before processin g the chunk.
253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { 253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) {
254 sendTokensToMainThread(); 254 sendTokensToMainThread();
255 m_startingScript = true; 255 m_startingScript = true;
256 } 256 }
257 257
258 m_pendingTokens->append(token); 258 m_pendingTokens->append(token);
(...skipping 16 matching lines...) Expand all
275 return; 275 return;
276 276
277 #if ENABLE(ASSERT) 277 #if ENABLE(ASSERT)
278 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get()); 278 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get());
279 checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads); 279 checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads);
280 checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos); 280 checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
281 #endif 281 #endif
282 282
283 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk); 283 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk);
284 chunk->preloads.swap(m_pendingPreloads); 284 chunk->preloads.swap(m_pendingPreloads);
285 if (m_viewportDescription.set)
286 chunk->viewport = m_viewportDescription;
285 chunk->xssInfos.swap(m_pendingXSSInfos); 287 chunk->xssInfos.swap(m_pendingXSSInfos);
286 chunk->tokenizerState = m_tokenizer->getState(); 288 chunk->tokenizerState = m_tokenizer->getState();
287 chunk->treeBuilderState = m_treeBuilderSimulator.state(); 289 chunk->treeBuilderState = m_treeBuilderSimulator.state();
288 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size()); 290 chunk->inputCheckpoint = m_input.createCheckpoint(m_pendingTokens->size());
289 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); 291 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint();
290 chunk->tokens = m_pendingTokens.release(); 292 chunk->tokens = m_pendingTokens.release();
291 chunk->startingScript = m_startingScript; 293 chunk->startingScript = m_startingScript;
292 m_startingScript = false; 294 m_startingScript = false;
293 295
294 bool isEmpty = m_parsedChunkQueue->enqueue(chunk.release()); 296 bool isEmpty = m_parsedChunkQueue->enqueue(chunk.release());
295 if (isEmpty) { 297 if (isEmpty) {
296 m_loadingTaskRunner->postTask( 298 m_loadingTaskRunner->postTask(
297 BLINK_FROM_HERE, 299 BLINK_FROM_HERE,
298 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow CrossThreadAccess(m_parser))); 300 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow CrossThreadAccess(m_parser)));
299 } 301 }
300 302
301 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 303 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
302 } 304 }
303 305
304 } // namespace blink 306 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698