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

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

Issue 302083009: Revert of Enable a srcset 0x descriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // The value of the 'h' descriptor is not used. 178 // The value of the 'h' descriptor is not used.
179 if (result.hasDensity() || result.hasHeight()) 179 if (result.hasDensity() || result.hasHeight())
180 return false; 180 return false;
181 int resourceHeight = it->toInt(attribute, isValid); 181 int resourceHeight = it->toInt(attribute, isValid);
182 if (!isValid || resourceHeight <= 0) 182 if (!isValid || resourceHeight <= 0)
183 return false; 183 return false;
184 result.setResourceHeight(resourceHeight); 184 result.setResourceHeight(resourceHeight);
185 } else if (c == 'x') { 185 } else if (c == 'x') {
186 if (result.hasDensity() || result.hasHeight() || result.hasWidth()) 186 if (result.hasDensity() || result.hasHeight() || result.hasWidth())
187 return false; 187 return false;
188 float density = it->toFloat(attribute, isValid); 188 int density = it->toFloat(attribute, isValid);
189 if (!isValid || density < 0) 189 if (!isValid || density < 0)
190 return false; 190 return false;
191 result.setDensity(density); 191 result.setDensity(density);
192 } 192 }
193 } 193 }
194 return true; 194 return true;
195 } 195 }
196 196
197 static bool parseDescriptors(const String& attribute, Vector<DescriptorToken>& d escriptors, DescriptorParsingResult& result) 197 static bool parseDescriptors(const String& attribute, Vector<DescriptorToken>& d escriptors, DescriptorParsingResult& result)
198 { 198 {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 Vector<ImageCandidate> imageCandidates; 341 Vector<ImageCandidate> imageCandidates;
342 imageCandidates.append(srcsetImageCandidate); 342 imageCandidates.append(srcsetImageCandidate);
343 343
344 if (!srcAttribute.isEmpty()) 344 if (!srcAttribute.isEmpty())
345 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin)); 345 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin));
346 346
347 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates ).toString(); 347 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates ).toString();
348 } 348 }
349 349
350 } 350 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698