| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |