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: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 2404463002: Avoid <picture> preloading when viewport not initialized. (Closed)
Patch Set: style Created 4 years, 2 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 | no next file » | 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 800 }
801 801
802 if (match(tagImpl, pictureTag)) { 802 if (match(tagImpl, pictureTag)) {
803 m_inPicture = true; 803 m_inPicture = true;
804 m_pictureData = PictureData(); 804 m_pictureData = PictureData();
805 return; 805 return;
806 } 806 }
807 807
808 StartTagScanner scanner(tagImpl, m_mediaValues); 808 StartTagScanner scanner(tagImpl, m_mediaValues);
809 scanner.processAttributes(token.attributes()); 809 scanner.processAttributes(token.attributes());
810 if (m_inPicture) 810 // TODO(yoav): ViewportWidth is currently racy and might be zero in some
811 // cases, at least in tests. That problem will go away once
812 // ParseHTMLOnMainThread lands and MediaValuesCached is eliminated.
813 if (m_inPicture && m_mediaValues->viewportWidth())
811 scanner.handlePictureSourceURL(m_pictureData); 814 scanner.handlePictureSourceURL(m_pictureData);
812 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest( 815 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(
813 m_predictedBaseElementURL, source, m_clientHintsPreferences, 816 m_predictedBaseElementURL, source, m_clientHintsPreferences,
814 m_pictureData, m_documentParameters->referrerPolicy); 817 m_pictureData, m_documentParameters->referrerPolicy);
815 if (request) 818 if (request)
816 requests.append(std::move(request)); 819 requests.append(std::move(request));
817 return; 820 return;
818 } 821 }
819 default: { return; } 822 default: { return; }
820 } 823 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 892 defaultViewportMinWidth = document->viewportDefaultMinWidth();
890 viewportMetaZeroValuesQuirk = 893 viewportMetaZeroValuesQuirk =
891 document->settings() && 894 document->settings() &&
892 document->settings()->viewportMetaZeroValuesQuirk(); 895 document->settings()->viewportMetaZeroValuesQuirk();
893 viewportMetaEnabled = 896 viewportMetaEnabled =
894 document->settings() && document->settings()->viewportMetaEnabled(); 897 document->settings() && document->settings()->viewportMetaEnabled();
895 referrerPolicy = document->getReferrerPolicy(); 898 referrerPolicy = document->getReferrerPolicy();
896 } 899 }
897 900
898 } // namespace blink 901 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698