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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return mediaQueryEvaluator.eval(mediaQueries.get()); | 101 return mediaQueryEvaluator.eval(mediaQueries.get()); |
102 } | 102 } |
103 | 103 |
104 class TokenPreloadScanner::StartTagScanner { | 104 class TokenPreloadScanner::StartTagScanner { |
105 public: | 105 public: |
106 StartTagScanner(const StringImpl* tagImpl, PassRefPtr<MediaValues> mediaValu
es) | 106 StartTagScanner(const StringImpl* tagImpl, PassRefPtr<MediaValues> mediaValu
es) |
107 : m_tagImpl(tagImpl) | 107 : m_tagImpl(tagImpl) |
108 , m_linkIsStyleSheet(false) | 108 , m_linkIsStyleSheet(false) |
109 , m_matchedMediaAttribute(true) | 109 , m_matchedMediaAttribute(true) |
110 , m_inputIsImage(false) | 110 , m_inputIsImage(false) |
111 , m_imgSourceSize(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, inputTag) | 118 || match(m_tagImpl, sourceTag)) { |
| 119 if (RuntimeEnabledFeatures::pictureSizesEnabled()) |
| 120 m_sourceSize = SizesAttributeParser::findEffectiveSize(String(),
m_mediaValues); |
| 121 return; |
| 122 } |
| 123 if ( !match(m_tagImpl, inputTag) |
119 && !match(m_tagImpl, linkTag) | 124 && !match(m_tagImpl, linkTag) |
120 && !match(m_tagImpl, scriptTag)) | 125 && !match(m_tagImpl, scriptTag)) |
121 m_tagImpl = 0; | 126 m_tagImpl = 0; |
122 if (RuntimeEnabledFeatures::pictureSizesEnabled()) | |
123 m_imgSourceSize = SizesAttributeParser::findEffectiveSize(String(),
m_mediaValues); | |
124 } | 127 } |
125 | 128 |
126 enum URLReplacement { | 129 enum URLReplacement { |
127 AllowURLReplacement, | 130 AllowURLReplacement, |
128 DisallowURLReplacement | 131 DisallowURLReplacement |
129 }; | 132 }; |
130 | 133 |
131 void processAttributes(const HTMLToken::AttributeList& attributes) | 134 void processAttributes(const HTMLToken::AttributeList& attributes) |
132 { | 135 { |
133 ASSERT(isMainThread()); | 136 ASSERT(isMainThread()); |
134 if (!m_tagImpl) | 137 if (!m_tagImpl) |
135 return; | 138 return; |
136 for (HTMLToken::AttributeList::const_iterator iter = attributes.begin();
iter != attributes.end(); ++iter) { | 139 for (HTMLToken::AttributeList::const_iterator iter = attributes.begin();
iter != attributes.end(); ++iter) { |
137 AtomicString attributeName(iter->name); | 140 AtomicString attributeName(iter->name); |
138 String attributeValue = StringImpl::create8BitIfPossible(iter->value
); | 141 String attributeValue = StringImpl::create8BitIfPossible(iter->value
); |
139 processAttribute(attributeName, attributeValue); | 142 processAttribute(attributeName, attributeValue); |
140 } | 143 } |
141 } | 144 } |
142 | 145 |
143 void processAttributes(const Vector<CompactHTMLToken::Attribute>& attributes
) | 146 void processAttributes(const Vector<CompactHTMLToken::Attribute>& attributes
) |
144 { | 147 { |
145 if (!m_tagImpl) | 148 if (!m_tagImpl) |
146 return; | 149 return; |
147 for (Vector<CompactHTMLToken::Attribute>::const_iterator iter = attribut
es.begin(); iter != attributes.end(); ++iter) | 150 for (Vector<CompactHTMLToken::Attribute>::const_iterator iter = attribut
es.begin(); iter != attributes.end(); ++iter) |
148 processAttribute(iter->name, iter->value); | 151 processAttribute(iter->name, iter->value); |
149 } | 152 } |
150 | 153 |
| 154 void handlePictureSourceURL(Vector<String>& pictureSourceURLStack) |
| 155 { |
| 156 if (pictureSourceURLStack.isEmpty()) |
| 157 return; |
| 158 |
| 159 if (match(m_tagImpl, sourceTag) && pictureSourceURLStack.last().isEmpty(
) && m_matchedMediaAttribute) { |
| 160 pictureSourceURLStack.removeLast(); |
| 161 pictureSourceURLStack.append(m_srcsetImageCandidate.toString()); |
| 162 } else if (match(m_tagImpl, imgTag) && !pictureSourceURLStack.last().isE
mpty()) { |
| 163 setUrlToLoad(pictureSourceURLStack.last(), AllowURLReplacement); |
| 164 } |
| 165 } |
| 166 |
151 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL
, const SegmentedString& source) | 167 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL
, const SegmentedString& source) |
152 { | 168 { |
153 if (!shouldPreload() || !m_matchedMediaAttribute) | 169 if (!shouldPreload() || !m_matchedMediaAttribute) |
154 return nullptr; | 170 return nullptr; |
155 | 171 |
156 TRACE_EVENT_INSTANT1("net", "PreloadRequest", "url", m_urlToLoad.ascii()
); | 172 TRACE_EVENT_INSTANT1("net", "PreloadRequest", "url", m_urlToLoad.ascii()
); |
157 TextPosition position = TextPosition(source.currentLine(), source.curren
tColumn()); | 173 TextPosition position = TextPosition(source.currentLine(), source.curren
tColumn()); |
158 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t
agImpl), position, m_urlToLoad, predictedBaseURL, resourceType()); | 174 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t
agImpl), position, m_urlToLoad, predictedBaseURL, resourceType()); |
159 if (isCORSEnabled()) | 175 if (isCORSEnabled()) |
160 request->setCrossOriginEnabled(allowStoredCredentials()); | 176 request->setCrossOriginEnabled(allowStoredCredentials()); |
161 request->setCharset(charset()); | 177 request->setCharset(charset()); |
162 return request.release(); | 178 return request.release(); |
163 } | 179 } |
164 | 180 |
165 private: | 181 private: |
166 template<typename NameType> | 182 template<typename NameType> |
| 183 void processScriptAttribute(const NameType& attributeName, const String& att
ributeValue) |
| 184 { |
| 185 if (match(attributeName, srcAttr)) |
| 186 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 187 else if (match(attributeName, crossoriginAttr)) |
| 188 setCrossOriginAllowed(attributeValue); |
| 189 } |
| 190 |
| 191 template<typename NameType> |
| 192 void processImgAttribute(const NameType& attributeName, const String& attrib
uteValue) |
| 193 { |
| 194 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) { |
| 195 m_imgSrcUrl = attributeValue; |
| 196 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, attributeValue, m_srcsetImageCandidate), AllowURLRepla
cement); |
| 197 } else if (match(attributeName, crossoriginAttr)) { |
| 198 setCrossOriginAllowed(attributeValue); |
| 199 } else if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.is
Empty()) { |
| 200 m_srcsetAttributeValue = attributeValue; |
| 201 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); |
| 202 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi
xelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacem
ent); |
| 203 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && match(attrib
uteName, sizesAttr) && !m_sourceSizeSet) { |
| 204 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues); |
| 205 m_sourceSizeSet = true; |
| 206 if (!m_srcsetImageCandidate.isEmpty()) { |
| 207 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); |
| 208 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLRepl
acement); |
| 209 } |
| 210 } |
| 211 } |
| 212 |
| 213 template<typename NameType> |
| 214 void processLinkAttribute(const NameType& attributeName, const String& attri
buteValue) |
| 215 { |
| 216 if (match(attributeName, hrefAttr)) |
| 217 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 218 else if (match(attributeName, relAttr)) |
| 219 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); |
| 220 else if (match(attributeName, mediaAttr)) |
| 221 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attr
ibuteValue); |
| 222 else if (match(attributeName, crossoriginAttr)) |
| 223 setCrossOriginAllowed(attributeValue); |
| 224 } |
| 225 |
| 226 template<typename NameType> |
| 227 void processInputAttribute(const NameType& attributeName, const String& attr
ibuteValue) |
| 228 { |
| 229 if (match(attributeName, srcAttr)) |
| 230 setUrlToLoad(attributeValue, DisallowURLReplacement); |
| 231 else if (match(attributeName, typeAttr)) |
| 232 m_inputIsImage = equalIgnoringCase(attributeValue, InputTypeNames::i
mage); |
| 233 } |
| 234 |
| 235 template<typename NameType> |
| 236 void processSourceAttribute(const NameType& attributeName, const String& att
ributeValue) |
| 237 { |
| 238 if (!RuntimeEnabledFeatures::pictureEnabled()) |
| 239 return; |
| 240 if (match(attributeName, srcsetAttr) && m_srcsetImageCandidate.isEmpty()
) { |
| 241 m_srcsetAttributeValue = attributeValue; |
| 242 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValu
es->devicePixelRatio(), m_sourceSize, attributeValue); |
| 243 } else if (match(attributeName, sizesAttr) && !m_sourceSizeSet) { |
| 244 m_sourceSize = SizesAttributeParser::findEffectiveSize(attributeValu
e, m_mediaValues); |
| 245 m_sourceSizeSet = true; |
| 246 if (!m_srcsetImageCandidate.isEmpty()) { |
| 247 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue); |
| 248 } |
| 249 } else if (match(attributeName, mediaAttr)) { |
| 250 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues, attr
ibuteValue); |
| 251 } |
| 252 } |
| 253 |
| 254 template<typename NameType> |
167 void processAttribute(const NameType& attributeName, const String& attribute
Value) | 255 void processAttribute(const NameType& attributeName, const String& attribute
Value) |
168 { | 256 { |
169 if (match(attributeName, charsetAttr)) | 257 if (match(attributeName, charsetAttr)) |
170 m_charset = attributeValue; | 258 m_charset = attributeValue; |
171 | 259 |
172 if (match(m_tagImpl, scriptTag)) { | 260 if (match(m_tagImpl, scriptTag)) |
173 if (match(attributeName, srcAttr)) | 261 processScriptAttribute(attributeName, attributeValue); |
174 setUrlToLoad(attributeValue, DisallowURLReplacement); | 262 else if (match(m_tagImpl, imgTag)) |
175 else if (match(attributeName, crossoriginAttr)) | 263 processImgAttribute(attributeName, attributeValue); |
176 setCrossOriginAllowed(attributeValue); | 264 else if (match(m_tagImpl, linkTag)) |
177 } else if (match(m_tagImpl, imgTag)) { | 265 processLinkAttribute(attributeName, attributeValue); |
178 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) { | 266 else if (match(m_tagImpl, inputTag)) |
179 m_imgSrcUrl = attributeValue; | 267 processInputAttribute(attributeName, attributeValue); |
180 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_imgSourceSize, attributeValue, m_srcsetImageCandidate), AllowU
RLReplacement); | 268 else if (match(m_tagImpl, sourceTag)) |
181 } else if (match(attributeName, crossoriginAttr)) { | 269 processSourceAttribute(attributeName, attributeValue); |
182 setCrossOriginAllowed(attributeValue); | |
183 } else if (match(attributeName, srcsetAttr) && m_srcsetImageCandidat
e.isEmpty()) { | |
184 m_imgSrcsetAttributeValue = attributeValue; | |
185 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_media
Values->devicePixelRatio(), m_imgSourceSize, attributeValue); | |
186 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devi
cePixelRatio(), m_imgSourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLR
eplacement); | |
187 } else if (RuntimeEnabledFeatures::pictureSizesEnabled() && match(at
tributeName, sizesAttr) && !m_sourceSizeSet) { | |
188 m_imgSourceSize = SizesAttributeParser::findEffectiveSize(attrib
uteValue, m_mediaValues); | |
189 m_sourceSizeSet = true; | |
190 if (!m_srcsetImageCandidate.isEmpty()) { | |
191 m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_m
ediaValues->devicePixelRatio(), m_imgSourceSize, m_imgSrcsetAttributeValue); | |
192 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->
devicePixelRatio(), m_imgSourceSize, m_imgSrcUrl, m_srcsetImageCandidate), Allow
URLReplacement); | |
193 } | |
194 } | |
195 } else if (match(m_tagImpl, linkTag)) { | |
196 if (match(attributeName, hrefAttr)) | |
197 setUrlToLoad(attributeValue, DisallowURLReplacement); | |
198 else if (match(attributeName, relAttr)) | |
199 m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); | |
200 else if (match(attributeName, mediaAttr)) | |
201 m_matchedMediaAttribute = mediaAttributeMatches(*m_mediaValues,
attributeValue); | |
202 else if (match(attributeName, crossoriginAttr)) | |
203 setCrossOriginAllowed(attributeValue); | |
204 } else if (match(m_tagImpl, inputTag)) { | |
205 if (match(attributeName, srcAttr)) | |
206 setUrlToLoad(attributeValue, DisallowURLReplacement); | |
207 else if (match(attributeName, typeAttr)) | |
208 m_inputIsImage = equalIgnoringCase(attributeValue, InputTypeName
s::image); | |
209 } | |
210 } | 270 } |
211 | 271 |
212 static bool relAttributeIsStyleSheet(const String& attributeValue) | 272 static bool relAttributeIsStyleSheet(const String& attributeValue) |
213 { | 273 { |
214 LinkRelAttribute rel(attributeValue); | 274 LinkRelAttribute rel(attributeValue); |
215 return rel.isStyleSheet() && !rel.isAlternate() && rel.iconType() == Inv
alidIcon && !rel.isDNSPrefetch(); | 275 return rel.isStyleSheet() && !rel.isAlternate() && rel.iconType() == Inv
alidIcon && !rel.isDNSPrefetch(); |
216 } | 276 } |
217 | 277 |
218 void setUrlToLoad(const String& value, URLReplacement replacement) | 278 void setUrlToLoad(const String& value, URLReplacement replacement) |
219 { | 279 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 338 } |
279 | 339 |
280 const StringImpl* m_tagImpl; | 340 const StringImpl* m_tagImpl; |
281 String m_urlToLoad; | 341 String m_urlToLoad; |
282 ImageCandidate m_srcsetImageCandidate; | 342 ImageCandidate m_srcsetImageCandidate; |
283 String m_charset; | 343 String m_charset; |
284 bool m_linkIsStyleSheet; | 344 bool m_linkIsStyleSheet; |
285 bool m_matchedMediaAttribute; | 345 bool m_matchedMediaAttribute; |
286 bool m_inputIsImage; | 346 bool m_inputIsImage; |
287 String m_imgSrcUrl; | 347 String m_imgSrcUrl; |
288 String m_imgSrcsetAttributeValue; | 348 String m_srcsetAttributeValue; |
289 unsigned m_imgSourceSize; | 349 unsigned m_sourceSize; |
290 bool m_sourceSizeSet; | 350 bool m_sourceSizeSet; |
291 bool m_isCORSEnabled; | 351 bool m_isCORSEnabled; |
292 StoredCredentials m_allowCredentials; | 352 StoredCredentials m_allowCredentials; |
293 RefPtr<MediaValues> m_mediaValues; | 353 RefPtr<MediaValues> m_mediaValues; |
294 }; | 354 }; |
295 | 355 |
296 TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassRefPtr<Med
iaValues> mediaValues) | 356 TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassRefPtr<Med
iaValues> mediaValues) |
297 : m_documentURL(documentURL) | 357 : m_documentURL(documentURL) |
298 , m_inStyle(false) | 358 , m_inStyle(false) |
299 , m_templateCount(0) | 359 , m_templateCount(0) |
300 , m_mediaValues(mediaValues) | 360 , m_mediaValues(mediaValues) |
301 { | 361 { |
302 } | 362 } |
303 | 363 |
304 TokenPreloadScanner::~TokenPreloadScanner() | 364 TokenPreloadScanner::~TokenPreloadScanner() |
305 { | 365 { |
306 } | 366 } |
307 | 367 |
308 TokenPreloadScannerCheckpoint TokenPreloadScanner::createCheckpoint() | 368 TokenPreloadScannerCheckpoint TokenPreloadScanner::createCheckpoint() |
309 { | 369 { |
310 TokenPreloadScannerCheckpoint checkpoint = m_checkpoints.size(); | 370 TokenPreloadScannerCheckpoint checkpoint = m_checkpoints.size(); |
311 m_checkpoints.append(Checkpoint(m_predictedBaseElementURL, m_inStyle, m_temp
lateCount)); | 371 m_checkpoints.append(Checkpoint(m_predictedBaseElementURL, m_inStyle, m_pict
ureSourceURLStack, m_templateCount)); |
312 return checkpoint; | 372 return checkpoint; |
313 } | 373 } |
314 | 374 |
315 void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex
) | 375 void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex
) |
316 { | 376 { |
317 ASSERT(checkpointIndex < m_checkpoints.size()); // If this ASSERT fires, che
ckpointIndex is invalid. | 377 ASSERT(checkpointIndex < m_checkpoints.size()); // If this ASSERT fires, che
ckpointIndex is invalid. |
318 const Checkpoint& checkpoint = m_checkpoints[checkpointIndex]; | 378 const Checkpoint& checkpoint = m_checkpoints[checkpointIndex]; |
319 m_predictedBaseElementURL = checkpoint.predictedBaseElementURL; | 379 m_predictedBaseElementURL = checkpoint.predictedBaseElementURL; |
320 m_inStyle = checkpoint.inStyle; | 380 m_inStyle = checkpoint.inStyle; |
| 381 m_pictureSourceURLStack = checkpoint.pictureSourceURLStack; |
321 m_templateCount = checkpoint.templateCount; | 382 m_templateCount = checkpoint.templateCount; |
322 m_cssScanner.reset(); | 383 m_cssScanner.reset(); |
323 m_checkpoints.clear(); | 384 m_checkpoints.clear(); |
324 } | 385 } |
325 | 386 |
326 void TokenPreloadScanner::scan(const HTMLToken& token, const SegmentedString& so
urce, PreloadRequestStream& requests) | 387 void TokenPreloadScanner::scan(const HTMLToken& token, const SegmentedString& so
urce, PreloadRequestStream& requests) |
327 { | 388 { |
328 scanCommon(token, source, requests); | 389 scanCommon(token, source, requests); |
329 } | 390 } |
330 | 391 |
(...skipping 17 matching lines...) Expand all Loading... |
348 if (match(tagImpl, templateTag)) { | 409 if (match(tagImpl, templateTag)) { |
349 if (m_templateCount) | 410 if (m_templateCount) |
350 --m_templateCount; | 411 --m_templateCount; |
351 return; | 412 return; |
352 } | 413 } |
353 if (match(tagImpl, styleTag)) { | 414 if (match(tagImpl, styleTag)) { |
354 if (m_inStyle) | 415 if (m_inStyle) |
355 m_cssScanner.reset(); | 416 m_cssScanner.reset(); |
356 m_inStyle = false; | 417 m_inStyle = false; |
357 } | 418 } |
| 419 if (match(tagImpl, pictureTag)) |
| 420 m_pictureSourceURLStack.removeLast(); |
358 return; | 421 return; |
359 } | 422 } |
360 case HTMLToken::StartTag: { | 423 case HTMLToken::StartTag: { |
361 if (m_templateCount) | 424 if (m_templateCount) |
362 return; | 425 return; |
363 const StringImpl* tagImpl = tagImplFor(token.data()); | 426 const StringImpl* tagImpl = tagImplFor(token.data()); |
364 if (match(tagImpl, templateTag)) { | 427 if (match(tagImpl, templateTag)) { |
365 ++m_templateCount; | 428 ++m_templateCount; |
366 return; | 429 return; |
367 } | 430 } |
368 if (match(tagImpl, styleTag)) { | 431 if (match(tagImpl, styleTag)) { |
369 m_inStyle = true; | 432 m_inStyle = true; |
370 return; | 433 return; |
371 } | 434 } |
372 if (match(tagImpl, baseTag)) { | 435 if (match(tagImpl, baseTag)) { |
373 // The first <base> element is the one that wins. | 436 // The first <base> element is the one that wins. |
374 if (!m_predictedBaseElementURL.isEmpty()) | 437 if (!m_predictedBaseElementURL.isEmpty()) |
375 return; | 438 return; |
376 updatePredictedBaseURL(token); | 439 updatePredictedBaseURL(token); |
377 return; | 440 return; |
378 } | 441 } |
| 442 if (match(tagImpl, pictureTag)) |
| 443 m_pictureSourceURLStack.append(String()); |
379 | 444 |
380 StartTagScanner scanner(tagImpl, m_mediaValues); | 445 StartTagScanner scanner(tagImpl, m_mediaValues); |
381 scanner.processAttributes(token.attributes()); | 446 scanner.processAttributes(token.attributes()); |
| 447 scanner.handlePictureSourceURL(m_pictureSourceURLStack); |
382 OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predicte
dBaseElementURL, source); | 448 OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predicte
dBaseElementURL, source); |
383 if (request) | 449 if (request) |
384 requests.append(request.release()); | 450 requests.append(request.release()); |
385 return; | 451 return; |
386 } | 452 } |
387 default: { | 453 default: { |
388 return; | 454 return; |
389 } | 455 } |
390 } | 456 } |
391 } | 457 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (m_token.type() == HTMLToken::StartTag) | 495 if (m_token.type() == HTMLToken::StartTag) |
430 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 496 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
431 m_scanner.scan(m_token, m_source, requests); | 497 m_scanner.scan(m_token, m_source, requests); |
432 m_token.clear(); | 498 m_token.clear(); |
433 } | 499 } |
434 | 500 |
435 preloader->takeAndPreload(requests); | 501 preloader->takeAndPreload(requests); |
436 } | 502 } |
437 | 503 |
438 } | 504 } |
OLD | NEW |