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

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: Modify TODO 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.
Charlie Harrison 2016/10/10 19:23:12 nit: Fix comment reflow by removing line breaks.
812 // That problem will go away once ParseHTMLOnMainThread lands and
813 // MediaValuesCached is eliminated.
814 if (m_inPicture && m_mediaValues->viewportWidth())
811 scanner.handlePictureSourceURL(m_pictureData); 815 scanner.handlePictureSourceURL(m_pictureData);
812 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest( 816 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(
813 m_predictedBaseElementURL, source, m_clientHintsPreferences, 817 m_predictedBaseElementURL, source, m_clientHintsPreferences,
814 m_pictureData, m_documentParameters->referrerPolicy); 818 m_pictureData, m_documentParameters->referrerPolicy);
815 if (request) 819 if (request)
816 requests.append(std::move(request)); 820 requests.append(std::move(request));
817 return; 821 return;
818 } 822 }
819 default: { return; } 823 default: { return; }
820 } 824 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 893 defaultViewportMinWidth = document->viewportDefaultMinWidth();
890 viewportMetaZeroValuesQuirk = 894 viewportMetaZeroValuesQuirk =
891 document->settings() && 895 document->settings() &&
892 document->settings()->viewportMetaZeroValuesQuirk(); 896 document->settings()->viewportMetaZeroValuesQuirk();
893 viewportMetaEnabled = 897 viewportMetaEnabled =
894 document->settings() && document->settings()->viewportMetaEnabled(); 898 document->settings() && document->settings()->viewportMetaEnabled();
895 referrerPolicy = document->getReferrerPolicy(); 899 referrerPolicy = document->getReferrerPolicy();
896 } 900 }
897 901
898 } // namespace blink 902 } // 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