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

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

Issue 1982263002: Fix preloadScanner double download issue with link preload and media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 4 years, 7 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 | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp » ('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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 pictureData.sourceSize = m_sourceSize; 198 pictureData.sourceSize = m_sourceSize;
199 pictureData.picked = true; 199 pictureData.picked = true;
200 } else if (match(m_tagImpl, imgTag) && !pictureData.sourceURL.isEmpty()) { 200 } else if (match(m_tagImpl, imgTag) && !pictureData.sourceURL.isEmpty()) {
201 setUrlToLoad(pictureData.sourceURL, AllowURLReplacement); 201 setUrlToLoad(pictureData.sourceURL, AllowURLReplacement);
202 } 202 }
203 } 203 }
204 204
205 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source, const ClientHintsPreferences& clientHintsPrefer ences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPoli cy) 205 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source, const ClientHintsPreferences& clientHintsPrefer ences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPoli cy)
206 { 206 {
207 PreloadRequest::RequestType requestType = PreloadRequest::RequestTypePre load; 207 PreloadRequest::RequestType requestType = PreloadRequest::RequestTypePre load;
208 if (shouldPreconnect()) 208 if (shouldPreconnect()) {
209 requestType = PreloadRequest::RequestTypePreconnect; 209 requestType = PreloadRequest::RequestTypePreconnect;
210 else if (isLinkRelPreload()) 210 } else {
211 requestType = PreloadRequest::RequestTypeLinkRelPreload; 211 if (isLinkRelPreload()) {
212 else if (!shouldPreload() || !m_matchedMediaAttribute) 212 requestType = PreloadRequest::RequestTypeLinkRelPreload;
213 return nullptr; 213 }
214 if (!shouldPreload() || !m_matchedMediaAttribute) {
215 return nullptr;
216 }
217 }
218
214 219
215 TextPosition position = TextPosition(source.currentLine(), source.curren tColumn()); 220 TextPosition position = TextPosition(source.currentLine(), source.curren tColumn());
216 FetchRequest::ResourceWidth resourceWidth; 221 FetchRequest::ResourceWidth resourceWidth;
217 float sourceSize = m_sourceSize; 222 float sourceSize = m_sourceSize;
218 bool sourceSizeSet = m_sourceSizeSet; 223 bool sourceSizeSet = m_sourceSizeSet;
219 if (pictureData.picked) { 224 if (pictureData.picked) {
220 sourceSizeSet = pictureData.sourceSizeSet; 225 sourceSizeSet = pictureData.sourceSizeSet;
221 sourceSize = pictureData.sourceSize; 226 sourceSize = pictureData.sourceSize;
222 } 227 }
223 if (sourceSizeSet) { 228 if (sourceSizeSet) {
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 ASSERT(document); 803 ASSERT(document);
799 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm lPreloadScanning(); 804 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm lPreloadScanning();
800 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame(); 805 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame();
801 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 806 defaultViewportMinWidth = document->viewportDefaultMinWidth();
802 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk(); 807 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk();
803 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled(); 808 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled();
804 referrerPolicy = document->getReferrerPolicy(); 809 referrerPolicy = document->getReferrerPolicy();
805 } 810 }
806 811
807 } // namespace blink 812 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698