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

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 23861003: Enable srcset support in HTMLImageElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed a flaky test Created 7 years, 3 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
« no previous file with comments | « Source/core/html/HTMLImageElement.idl ('k') | Source/core/html/parser/HTMLPreloadScanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 552
553 if (isStopped()) 553 if (isStopped())
554 return; 554 return;
555 555
556 if (session.needsYield) 556 if (session.needsYield)
557 m_parserScheduler->scheduleForResume(); 557 m_parserScheduler->scheduleForResume();
558 558
559 if (isWaitingForScripts()) { 559 if (isWaitingForScripts()) {
560 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); 560 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState);
561 if (!m_preloadScanner) { 561 if (!m_preloadScanner) {
562 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url())); 562 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url(), document()->devicePixelRatio()));
563 m_preloadScanner->appendToEnd(m_input.current()); 563 m_preloadScanner->appendToEnd(m_input.current());
564 } 564 }
565 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); 565 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
566 } 566 }
567 567
568 InspectorInstrumentation::didWriteHTML(cookie, m_input.current().currentLine ().zeroBasedInt()); 568 InspectorInstrumentation::didWriteHTML(cookie, m_input.current().currentLine ().zeroBasedInt());
569 } 569 }
570 570
571 void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken) 571 void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken)
572 { 572 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 SegmentedString excludedLineNumberSource(source); 628 SegmentedString excludedLineNumberSource(source);
629 excludedLineNumberSource.setExcludeLineNumbers(); 629 excludedLineNumberSource.setExcludeLineNumbers();
630 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); 630 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource);
631 pumpTokenizerIfPossible(ForceSynchronous); 631 pumpTokenizerIfPossible(ForceSynchronous);
632 632
633 if (isWaitingForScripts()) { 633 if (isWaitingForScripts()) {
634 // Check the document.write() output with a separate preload scanner as 634 // Check the document.write() output with a separate preload scanner as
635 // the main scanner can't deal with insertions. 635 // the main scanner can't deal with insertions.
636 if (!m_insertionPreloadScanner) 636 if (!m_insertionPreloadScanner)
637 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option s, document()->url())); 637 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option s, document()->url(), document()->devicePixelRatio()));
638 638
639 m_insertionPreloadScanner->appendToEnd(source); 639 m_insertionPreloadScanner->appendToEnd(source);
640 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme ntURL()); 640 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme ntURL());
641 } 641 }
642 642
643 endIfDelayed(); 643 endIfDelayed();
644 } 644 }
645 645
646 void HTMLDocumentParser::startBackgroundParser() 646 void HTMLDocumentParser::startBackgroundParser()
647 { 647 {
648 ASSERT(shouldUseThreading()); 648 ASSERT(shouldUseThreading());
649 ASSERT(!m_haveBackgroundParser); 649 ASSERT(!m_haveBackgroundParser);
650 m_haveBackgroundParser = true; 650 m_haveBackgroundParser = true;
651 651
652 HTMLIdentifier::init(); 652 HTMLIdentifier::init();
653 653
654 RefPtr<WeakReference<BackgroundHTMLParser> > reference = WeakReference<Backg roundHTMLParser>::createUnbound(); 654 RefPtr<WeakReference<BackgroundHTMLParser> > reference = WeakReference<Backg roundHTMLParser>::createUnbound();
655 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); 655 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
656 656
657 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); 657 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration);
658 config->options = m_options; 658 config->options = m_options;
659 config->parser = m_weakFactory.createWeakPtr(); 659 config->parser = m_weakFactory.createWeakPtr();
660 config->xssAuditor = adoptPtr(new XSSAuditor); 660 config->xssAuditor = adoptPtr(new XSSAuditor);
661 config->xssAuditor->init(document(), &m_xssAuditorDelegate); 661 config->xssAuditor->init(document(), &m_xssAuditorDelegate);
662 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy())); 662 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), document()->devicePixelRatio()));
663 663
664 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); 664 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
665 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); 665 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread());
666 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::create, ref erence.release(), config.release())); 666 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::create, ref erence.release(), config.release()));
667 } 667 }
668 668
669 void HTMLDocumentParser::stopBackgroundParser() 669 void HTMLDocumentParser::stopBackgroundParser()
670 { 670 {
671 ASSERT(shouldUseThreading()); 671 ASSERT(shouldUseThreading());
672 ASSERT(m_haveBackgroundParser); 672 ASSERT(m_haveBackgroundParser);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 m_parserScheduler->suspend(); 953 m_parserScheduler->suspend();
954 } 954 }
955 955
956 void HTMLDocumentParser::resumeScheduledTasks() 956 void HTMLDocumentParser::resumeScheduledTasks()
957 { 957 {
958 if (m_parserScheduler) 958 if (m_parserScheduler)
959 m_parserScheduler->resume(); 959 m_parserScheduler->resume();
960 } 960 }
961 961
962 } 962 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.idl ('k') | Source/core/html/parser/HTMLPreloadScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698