| Index: Source/core/html/parser/HTMLSrcsetParser.cpp
|
| diff --git a/Source/core/html/parser/HTMLSrcsetParser.cpp b/Source/core/html/parser/HTMLSrcsetParser.cpp
|
| index b2b02ccd510c245618fd46348990af33359a878a..72b50045357a4248f46a31d22f2c78b3eb1a5e09 100644
|
| --- a/Source/core/html/parser/HTMLSrcsetParser.cpp
|
| +++ b/Source/core/html/parser/HTMLSrcsetParser.cpp
|
| @@ -179,15 +179,15 @@ static void tokenizeDescriptors(const CharType* attributeStart,
|
| template<typename CharType>
|
| static bool parseDescriptors(const CharType* attribute, Vector<DescriptorToken>& descriptors, DescriptorParsingResult& result)
|
| {
|
| - for (Vector<DescriptorToken>::iterator it = descriptors.begin(); it != descriptors.end(); ++it) {
|
| - if (it->length == 0)
|
| + for (auto& descriptor : descriptors) {
|
| + if (descriptor.length == 0)
|
| continue;
|
| - CharType c = attribute[it->lastIndex()];
|
| + CharType c = attribute[descriptor.lastIndex()];
|
| bool isValid = false;
|
| if (RuntimeEnabledFeatures::pictureSizesEnabled() && c == 'w') {
|
| if (result.hasDensity() || result.hasWidth())
|
| return false;
|
| - int resourceWidth = it->toInt(attribute, isValid);
|
| + int resourceWidth = descriptor.toInt(attribute, isValid);
|
| if (!isValid || resourceWidth <= 0)
|
| return false;
|
| result.setResourceWidth(resourceWidth);
|
| @@ -196,14 +196,14 @@ static bool parseDescriptors(const CharType* attribute, Vector<DescriptorToken>&
|
| // The value of the 'h' descriptor is not used.
|
| if (result.hasDensity() || result.hasHeight())
|
| return false;
|
| - int resourceHeight = it->toInt(attribute, isValid);
|
| + int resourceHeight = descriptor.toInt(attribute, isValid);
|
| if (!isValid || resourceHeight <= 0)
|
| return false;
|
| result.setResourceHeight(resourceHeight);
|
| } else if (c == 'x') {
|
| if (result.hasDensity() || result.hasHeight() || result.hasWidth())
|
| return false;
|
| - float density = it->toFloat(attribute, isValid);
|
| + float density = descriptor.toFloat(attribute, isValid);
|
| if (!isValid || density < 0)
|
| return false;
|
| result.setDensity(density);
|
| @@ -294,12 +294,12 @@ static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, float sour
|
| return ImageCandidate();
|
|
|
| // http://picture.responsiveimages.org/#normalize-source-densities
|
| - for (Vector<ImageCandidate>::iterator it = imageCandidates.begin(); it != imageCandidates.end(); ++it) {
|
| - if (it->resourceWidth() > 0) {
|
| - it->setDensity((float)it->resourceWidth() / sourceSize);
|
| + for (auto& image : imageCandidates) {
|
| + if (image.resourceWidth() > 0) {
|
| + image.setDensity((float)image.resourceWidth() / sourceSize);
|
| ignoreSrc = true;
|
| - } else if (it->density() < 0) {
|
| - it->setDensity(defaultDensityValue);
|
| + } else if (image.density() < 0) {
|
| + image.setDensity(defaultDensityValue);
|
| }
|
| }
|
|
|
|
|