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

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: 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
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 551
552 if (isStopped()) 552 if (isStopped())
553 return; 553 return;
554 554
555 if (session.needsYield) 555 if (session.needsYield)
556 m_parserScheduler->scheduleForResume(); 556 m_parserScheduler->scheduleForResume();
557 557
558 if (isWaitingForScripts()) { 558 if (isWaitingForScripts()) {
559 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); 559 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState);
560 if (!m_preloadScanner) { 560 if (!m_preloadScanner) {
561 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url())); 561 float deviceScaleFactor = 1.0;
562 if (Page* page = document()->page())
563 deviceScaleFactor = page->deviceScaleFactor();
564 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url(), deviceScaleFactor));
562 m_preloadScanner->appendToEnd(m_input.current()); 565 m_preloadScanner->appendToEnd(m_input.current());
563 } 566 }
564 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); 567 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
565 } 568 }
566 569
567 InspectorInstrumentation::didWriteHTML(cookie, m_input.current().currentLine ().zeroBasedInt()); 570 InspectorInstrumentation::didWriteHTML(cookie, m_input.current().currentLine ().zeroBasedInt());
568 } 571 }
569 572
570 void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken) 573 void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken)
571 { 574 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 628 }
626 629
627 SegmentedString excludedLineNumberSource(source); 630 SegmentedString excludedLineNumberSource(source);
628 excludedLineNumberSource.setExcludeLineNumbers(); 631 excludedLineNumberSource.setExcludeLineNumbers();
629 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource); 632 m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource);
630 pumpTokenizerIfPossible(ForceSynchronous); 633 pumpTokenizerIfPossible(ForceSynchronous);
631 634
632 if (isWaitingForScripts()) { 635 if (isWaitingForScripts()) {
633 // Check the document.write() output with a separate preload scanner as 636 // Check the document.write() output with a separate preload scanner as
634 // the main scanner can't deal with insertions. 637 // the main scanner can't deal with insertions.
635 if (!m_insertionPreloadScanner) 638 if (!m_insertionPreloadScanner) {
636 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option s, document()->url())); 639 float deviceScaleFactor = 1.0;
640 if (Page* page = document()->page())
641 deviceScaleFactor = page->deviceScaleFactor();
642 m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_option s, document()->url(), deviceScaleFactor));
643 }
637 m_insertionPreloadScanner->appendToEnd(source); 644 m_insertionPreloadScanner->appendToEnd(source);
638 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme ntURL()); 645 m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseEleme ntURL());
639 } 646 }
640 647
641 endIfDelayed(); 648 endIfDelayed();
642 } 649 }
643 650
644 void HTMLDocumentParser::startBackgroundParser() 651 void HTMLDocumentParser::startBackgroundParser()
645 { 652 {
646 ASSERT(shouldUseThreading()); 653 ASSERT(shouldUseThreading());
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 m_parserScheduler->suspend(); 958 m_parserScheduler->suspend();
952 } 959 }
953 960
954 void HTMLDocumentParser::resumeScheduledTasks() 961 void HTMLDocumentParser::resumeScheduledTasks()
955 { 962 {
956 if (m_parserScheduler) 963 if (m_parserScheduler)
957 m_parserScheduler->resume(); 964 m_parserScheduler->resume();
958 } 965 }
959 966
960 } 967 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698