OLD | NEW |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 , m_matchedMediaAttribute(true) | 109 , m_matchedMediaAttribute(true) |
110 , m_inputIsImage(false) | 110 , m_inputIsImage(false) |
111 , m_sourceSize(0) | 111 , m_sourceSize(0) |
112 , m_sourceSizeSet(false) | 112 , m_sourceSizeSet(false) |
113 , m_isCORSEnabled(false) | 113 , m_isCORSEnabled(false) |
114 , m_allowCredentials(DoNotAllowStoredCredentials) | 114 , m_allowCredentials(DoNotAllowStoredCredentials) |
115 , m_mediaValues(mediaValues) | 115 , m_mediaValues(mediaValues) |
116 { | 116 { |
117 if (match(m_tagImpl, imgTag) | 117 if (match(m_tagImpl, imgTag) |
118 || match(m_tagImpl, sourceTag)) { | 118 || match(m_tagImpl, sourceTag)) { |
| 119 bool viewportDependant; |
119 if (RuntimeEnabledFeatures::pictureSizesEnabled()) | 120 if (RuntimeEnabledFeatures::pictureSizesEnabled()) |
120 m_sourceSize = SizesAttributeParser::findEffectiveSize(String(),
m_mediaValues); | 121 m_sourceSize = SizesAttributeParser::findEffectiveSize(String(),
m_mediaValues, viewportDependant); |
121 return; | 122 return; |
122 } | 123 } |
123 if ( !match(m_tagImpl, inputTag) | 124 if ( !match(m_tagImpl, inputTag) |
124 && !match(m_tagImpl, linkTag) | 125 && !match(m_tagImpl, linkTag) |
125 && !match(m_tagImpl, scriptTag)) | 126 && !match(m_tagImpl, scriptTag)) |
126 m_tagImpl = 0; | 127 m_tagImpl = 0; |
127 } | 128 } |
128 | 129 |
129 enum URLReplacement { | 130 enum URLReplacement { |
130 AllowURLReplacement, | 131 AllowURLReplacement, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) { | 191 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) { |
191 m_imgSrcUrl = attributeValue; | 192 m_imgSrcUrl = attributeValue; |
192 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, attributeValue, m_srcsetImageCandidate), AllowURLRepla
cement); | 193 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, attributeValue, m_srcsetImageCandidate), AllowURLRepla
cement); |
193 } else if (match(attributeName, crossoriginAttr)) { | 194 } else if (match(attributeName, crossoriginAttr)) { |
194 setCrossOriginAllowed(attributeValue); | 195 setCrossOriginAllowed(attributeValue); |
195 } else if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.is
Empty()) { | 196 } else if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.is
Empty()) { |
196 m_srcsetAttributeValue = attributeValue; | 197 m_srcsetAttributeValue = attributeValue; |
197 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); | 198 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); |
198 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacem
ent); | 199 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacem
ent); |
199 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && match(attrib
uteName, sizesAttr) && !m_sourceSizeSet) { | 200 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && match(attrib
uteName, sizesAttr) && !m_sourceSizeSet) { |
200 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues); | 201 bool viewportDependant; |
| 202 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues, viewportDependant); |
201 m_sourceSizeSet = true; | 203 m_sourceSizeSet = true; |
202 if (!m_srcsetImageCandidate.isEmpty()) { | 204 if (!m_srcsetImageCandidate.isEmpty()) { |
203 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); | 205 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); |
204 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLRepl
acement); | 206 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLRepl
acement); |
205 } | 207 } |
206 } | 208 } |
207 } | 209 } |
208 | 210 |
209 template<typename NameType> | 211 template<typename NameType> |
210 void processLinkAttribute(const NameType& attributeName, const String& attri
buteValue) | 212 void processLinkAttribute(const NameType& attributeName, const String& attri
buteValue) |
(...skipping 21 matching lines...) Expand all Loading... |
232 | 234 |
233 template<typename NameType> | 235 template<typename NameType> |
234 void processSourceAttribute(const NameType& attributeName, const String& att
ributeValue) | 236 void processSourceAttribute(const NameType& attributeName, const String& att
ributeValue) |
235 { | 237 { |
236 if (!RuntimeEnabledFeatures::pictureEnabled()) | 238 if (!RuntimeEnabledFeatures::pictureEnabled()) |
237 return; | 239 return; |
238 if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.isEmpty()
) { | 240 if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.isEmpty()
) { |
239 m_srcsetAttributeValue = attributeValue; | 241 m_srcsetAttributeValue = attributeValue; |
240 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); | 242 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); |
241 } else if (match(attributeName, sizesAttr) && !m_sourceSizeSet) { | 243 } else if (match(attributeName, sizesAttr) && !m_sourceSizeSet) { |
242 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues); | 244 bool viewportDependant; |
| 245 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues, viewportDependant); |
243 m_sourceSizeSet = true; | 246 m_sourceSizeSet = true; |
244 if (!m_srcsetImageCandidate.isEmpty()) { | 247 if (!m_srcsetImageCandidate.isEmpty()) { |
245 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); | 248 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); |
246 } | 249 } |
247 } else if (match(attributeName, mediaAttr)) { | 250 } else if (match(attributeName, mediaAttr)) { |
248 // FIXME - Don't match media multiple times. | 251 // FIXME - Don't match media multiple times. |
249 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attr
ibuteValue); | 252 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attr
ibuteValue); |
250 } | 253 } |
251 | 254 |
252 } | 255 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 if (m_token.type() == HTMLToken::StartTag) | 503 if (m_token.type() == HTMLToken::StartTag) |
501 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 504 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
502 m_scanner.scan(m_token, m_source, requests); | 505 m_scanner.scan(m_token, m_source, requests); |
503 m_token.clear(); | 506 m_token.clear(); |
504 } | 507 } |
505 | 508 |
506 preloader->takeAndPreload(requests); | 509 preloader->takeAndPreload(requests); |
507 } | 510 } |
508 | 511 |
509 } | 512 } |
OLD | NEW |