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

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

Issue 233213003: Extend srcset's syntax to include 'w' descriptors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed nits and modified multiple descriptor layout test Created 6 years, 8 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.cpp ('k') | Source/core/html/parser/HTMLSrcsetParser.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) 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 { 164 {
165 if (match(attributeName, charsetAttr)) 165 if (match(attributeName, charsetAttr))
166 m_charset = attributeValue; 166 m_charset = attributeValue;
167 167
168 if (match(m_tagImpl, scriptTag)) { 168 if (match(m_tagImpl, scriptTag)) {
169 if (match(attributeName, srcAttr)) 169 if (match(attributeName, srcAttr))
170 setUrlToLoad(attributeValue, DisallowURLReplacement); 170 setUrlToLoad(attributeValue, DisallowURLReplacement);
171 else if (match(attributeName, crossoriginAttr)) 171 else if (match(attributeName, crossoriginAttr))
172 setCrossOriginAllowed(attributeValue); 172 setCrossOriginAllowed(attributeValue);
173 } else if (match(m_tagImpl, imgTag)) { 173 } else if (match(m_tagImpl, imgTag)) {
174 int effectiveSize = -1; // FIXME - hook up the real value from `size s`
174 if (match(attributeName, srcAttr) && !m_encounteredImgSrc) { 175 if (match(attributeName, srcAttr) && !m_encounteredImgSrc) {
175 m_encounteredImgSrc = true; 176 m_encounteredImgSrc = true;
176 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi cePixelRatio(), attributeValue, m_srcsetImageCandidate), AllowURLReplacement); 177 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi cePixelRatio(), effectiveSize, attributeValue, m_srcsetImageCandidate), AllowURL Replacement);
177 } else if (match(attributeName, crossoriginAttr)) { 178 } else if (match(attributeName, crossoriginAttr)) {
178 setCrossOriginAllowed(attributeValue); 179 setCrossOriginAllowed(attributeValue);
179 } else if (RuntimeEnabledFeatures::srcsetEnabled() 180 } else if (RuntimeEnabledFeatures::srcsetEnabled()
180 && match(attributeName, srcsetAttr) 181 && match(attributeName, srcsetAttr)
181 && m_srcsetImageCandidate.isEmpty()) { 182 && m_srcsetImageCandidate.isEmpty()) {
182 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media Values->devicePixelRatio(), attributeValue); 183 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media Values->devicePixelRatio(), effectiveSize, attributeValue);
183 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi cePixelRatio(), m_urlToLoad, m_srcsetImageCandidate), AllowURLReplacement); 184 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi cePixelRatio(), effectiveSize, m_urlToLoad, m_srcsetImageCandidate), AllowURLRep lacement);
184 } 185 }
185 } else if (match(m_tagImpl, linkTag)) { 186 } else if (match(m_tagImpl, linkTag)) {
186 if (match(attributeName, hrefAttr)) 187 if (match(attributeName, hrefAttr))
187 setUrlToLoad(attributeValue, DisallowURLReplacement); 188 setUrlToLoad(attributeValue, DisallowURLReplacement);
188 else if (match(attributeName, relAttr)) 189 else if (match(attributeName, relAttr))
189 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); 190 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue);
190 else if (match(attributeName, mediaAttr)) 191 else if (match(attributeName, mediaAttr))
191 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attributeValue); 192 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attributeValue);
192 else if (match(attributeName, crossoriginAttr)) 193 else if (match(attributeName, crossoriginAttr))
193 setCrossOriginAllowed(attributeValue); 194 setCrossOriginAllowed(attributeValue);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (m_token.type() == HTMLToken::StartTag) 417 if (m_token.type() == HTMLToken::StartTag)
417 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit)); 418 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit));
418 m_scanner.scan(m_token, m_source, requests); 419 m_scanner.scan(m_token, m_source, requests);
419 m_token.clear(); 420 m_token.clear();
420 } 421 }
421 422
422 preloader->takeAndPreload(requests); 423 preloader->takeAndPreload(requests);
423 } 424 }
424 425
425 } 426 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/parser/HTMLSrcsetParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698