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

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 expected test results 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
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..e65e3f54baa0aef731bd75c2169279e416250e42 100644
--- a/Source/core/html/parser/HTMLSrcsetParser.cpp
+++ b/Source/core/html/parser/HTMLSrcsetParser.cpp
@@ -154,7 +154,7 @@ ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const St
return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
}
-String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute)
+String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute, float& intrinsicSizeFactor)
{
if (srcsetAttribute.isNull())
return srcAttribute;
@@ -166,7 +166,10 @@ String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& sr
if (!srcAttribute.isEmpty())
imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.length(), 1.0));
- return pickBestImageCandidate(deviceScaleFactor, imageCandidates).toString();
+ ImageCandidate candidate = pickBestImageCandidate(deviceScaleFactor, imageCandidates);
+ intrinsicSizeFactor = 1 / candidate.scaleFactor();
pdr. 2013/10/11 05:17:33 Do we need to check that scaleFactor is non-zero h
Yoav Weiss 2013/10/11 07:22:32 Yes, we should. Will fix.
+
+ return candidate.toString();
}
String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate)

Powered by Google App Engine
This is Rietveld 408576698