OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 static unsigned avoidDownloadIfHigherDensityResourceIsInCache( | 388 static unsigned avoidDownloadIfHigherDensityResourceIsInCache( |
389 Vector<ImageCandidate*>& imageCandidates, | 389 Vector<ImageCandidate*>& imageCandidates, |
390 unsigned winner, | 390 unsigned winner, |
391 Document* document) { | 391 Document* document) { |
392 if (!document) | 392 if (!document) |
393 return winner; | 393 return winner; |
394 for (unsigned i = imageCandidates.size() - 1; i > winner; --i) { | 394 for (unsigned i = imageCandidates.size() - 1; i > winner; --i) { |
395 KURL url = document->completeURL( | 395 KURL url = document->completeURL( |
396 stripLeadingAndTrailingHTMLSpaces(imageCandidates[i]->url())); | 396 stripLeadingAndTrailingHTMLSpaces(imageCandidates[i]->url())); |
397 if (memoryCache()->resourceForURL( | 397 if (memoryCache()->resourceForURL( |
398 url, document->fetcher()->getCacheIdentifier())) | 398 url, document->fetcher()->getCacheIdentifier()) || |
| 399 url.protocolIsData()) |
399 return i; | 400 return i; |
400 } | 401 } |
401 return winner; | 402 return winner; |
402 } | 403 } |
403 | 404 |
404 static ImageCandidate pickBestImageCandidate( | 405 static ImageCandidate pickBestImageCandidate( |
405 float deviceScaleFactor, | 406 float deviceScaleFactor, |
406 float sourceSize, | 407 float sourceSize, |
407 Vector<ImageCandidate>& imageCandidates, | 408 Vector<ImageCandidate>& imageCandidates, |
408 Document* document = nullptr) { | 409 Document* document = nullptr) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (!srcAttribute.isEmpty()) | 500 if (!srcAttribute.isEmpty()) |
500 imageCandidates.append( | 501 imageCandidates.append( |
501 ImageCandidate(srcAttribute, 0, srcAttribute.length(), | 502 ImageCandidate(srcAttribute, 0, srcAttribute.length(), |
502 DescriptorParsingResult(), ImageCandidate::SrcOrigin)); | 503 DescriptorParsingResult(), ImageCandidate::SrcOrigin)); |
503 | 504 |
504 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates) | 505 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates) |
505 .toString(); | 506 .toString(); |
506 } | 507 } |
507 | 508 |
508 } // namespace blink | 509 } // namespace blink |
OLD | NEW |