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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLSrcsetParser.cpp

Issue 2592113003: Load data URI images in an async way according to spec (take 3) (Closed)
Patch Set: Fixed more devtools reliance on sync loading Created 3 years, 11 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698