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

Unified Diff: Source/core/html/parser/HTMLSrcsetParser.cpp

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed crash+rebased Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/parser/HTMLSrcsetParser.h ('k') | Source/core/rendering/RenderImage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLSrcsetParser.cpp
diff --git a/Source/core/html/parser/HTMLSrcsetParser.cpp b/Source/core/html/parser/HTMLSrcsetParser.cpp
index 40c95a19643c7000afcc631bcf41f13bd126effb..815b5560647515e817a51e69f08bef53760b644d 100644
--- a/Source/core/html/parser/HTMLSrcsetParser.cpp
+++ b/Source/core/html/parser/HTMLSrcsetParser.cpp
@@ -154,10 +154,13 @@ ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const St
return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
}
-String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute)
+ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute)
{
- if (srcsetAttribute.isNull())
- return srcAttribute;
+ if (srcsetAttribute.isNull()) {
+ if (srcAttribute.isNull())
+ return ImageCandidate();
+ return ImageCandidate(srcAttribute, 0, srcAttribute.length(), 1);
+ }
Vector<ImageCandidate> imageCandidates;
@@ -166,7 +169,7 @@ String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& sr
if (!srcAttribute.isEmpty())
imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.length(), 1.0));
- return pickBestImageCandidate(deviceScaleFactor, imageCandidates).toString();
+ return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
}
String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate)
« no previous file with comments | « Source/core/html/parser/HTMLSrcsetParser.h ('k') | Source/core/rendering/RenderImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698