| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // 8. If url ends with a U+002C COMMA character (,) | 280 // 8. If url ends with a U+002C COMMA character (,) |
| 281 if (isComma(*(position - 1))) { | 281 if (isComma(*(position - 1))) { |
| 282 // Remove all trailing U+002C COMMA characters from url. | 282 // Remove all trailing U+002C COMMA characters from url. |
| 283 imageURLEnd = position - 1; | 283 imageURLEnd = position - 1; |
| 284 reverseSkipWhile<CharType, isComma>(imageURLEnd, imageURLStart); | 284 reverseSkipWhile<CharType, isComma>(imageURLEnd, imageURLStart); |
| 285 ++imageURLEnd; | 285 ++imageURLEnd; |
| 286 // If url is empty, then jump to the step labeled splitting loop. | 286 // If url is empty, then jump to the step labeled splitting loop. |
| 287 if (imageURLStart == imageURLEnd) | 287 if (imageURLStart == imageURLEnd) |
| 288 continue; | 288 continue; |
| 289 } else { | 289 } else { |
| 290 skipWhile<CharType, isHTMLSpace<CharType> >(position, attributeEnd); | 290 skipWhile<CharType, isHTMLSpace<CharType>>(position, attributeEnd); |
| 291 Vector<DescriptorToken> descriptorTokens; | 291 Vector<DescriptorToken> descriptorTokens; |
| 292 tokenizeDescriptors(attributeStart, position, attributeEnd, descript
orTokens); | 292 tokenizeDescriptors(attributeStart, position, attributeEnd, descript
orTokens); |
| 293 // Contrary to spec language - descriptor parsing happens on each ca
ndidate. | 293 // Contrary to spec language - descriptor parsing happens on each ca
ndidate. |
| 294 // This is a black-box equivalent, to avoid storing descriptor lists
for each candidate. | 294 // This is a black-box equivalent, to avoid storing descriptor lists
for each candidate. |
| 295 if (!parseDescriptors(attribute, descriptorTokens, result, document)
) { | 295 if (!parseDescriptors(attribute, descriptorTokens, result, document)
) { |
| 296 if (document) { | 296 if (document) { |
| 297 UseCounter::count(document, UseCounter::SrcsetDroppedCandida
te); | 297 UseCounter::count(document, UseCounter::SrcsetDroppedCandida
te); |
| 298 if (document->frame()) | 298 if (document->frame()) |
| 299 document->frame()->console().addMessage(ConsoleMessage::
create(OtherMessageSource, ErrorMessageLevel, String("Dropped srcset candidate "
) + String(imageURLStart, imageURLEnd - imageURLStart))); | 299 document->frame()->console().addMessage(ConsoleMessage::
create(OtherMessageSource, ErrorMessageLevel, String("Dropped srcset candidate "
) + String(imageURLStart, imageURLEnd - imageURLStart))); |
| 300 } | 300 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 Vector<ImageCandidate> imageCandidates; | 431 Vector<ImageCandidate> imageCandidates; |
| 432 imageCandidates.append(srcsetImageCandidate); | 432 imageCandidates.append(srcsetImageCandidate); |
| 433 | 433 |
| 434 if (!srcAttribute.isEmpty()) | 434 if (!srcAttribute.isEmpty()) |
| 435 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng
th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin)); | 435 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng
th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin)); |
| 436 | 436 |
| 437 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates
).toString(); | 437 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates
).toString(); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } | 440 } |
| OLD | NEW |