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

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

Issue 1738623004: Rename enums/functions that collide in chromium style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-4
Patch Set: get-names-5: rebase-and-stuff Created 4 years, 10 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
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, float sour ceSize, Vector<ImageCandidate>& imageCandidates, Document* document = nullptr) 364 static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, float sour ceSize, Vector<ImageCandidate>& imageCandidates, Document* document = nullptr)
365 { 365 {
366 const float defaultDensityValue = 1.0; 366 const float defaultDensityValue = 1.0;
367 bool ignoreSrc = false; 367 bool ignoreSrc = false;
368 if (imageCandidates.isEmpty()) 368 if (imageCandidates.isEmpty())
369 return ImageCandidate(); 369 return ImageCandidate();
370 370
371 // http://picture.responsiveimages.org/#normalize-source-densities 371 // http://picture.responsiveimages.org/#normalize-source-densities
372 for (ImageCandidate& image : imageCandidates) { 372 for (ImageCandidate& image : imageCandidates) {
373 if (image.resourceWidth() > 0) { 373 if (image.getResourceWidth() > 0) {
374 image.setDensity((float)image.resourceWidth() / sourceSize); 374 image.setDensity((float)image.getResourceWidth() / sourceSize);
375 ignoreSrc = true; 375 ignoreSrc = true;
376 } else if (image.density() < 0) { 376 } else if (image.density() < 0) {
377 image.setDensity(defaultDensityValue); 377 image.setDensity(defaultDensityValue);
378 } 378 }
379 } 379 }
380 380
381 std::stable_sort(imageCandidates.begin(), imageCandidates.end(), compareByDe nsity); 381 std::stable_sort(imageCandidates.begin(), imageCandidates.end(), compareByDe nsity);
382 382
383 Vector<ImageCandidate*> deDupedImageCandidates; 383 Vector<ImageCandidate*> deDupedImageCandidates;
384 float prevDensity = -1.0; 384 float prevDensity = -1.0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Vector<ImageCandidate> imageCandidates; 435 Vector<ImageCandidate> imageCandidates;
436 imageCandidates.append(srcsetImageCandidate); 436 imageCandidates.append(srcsetImageCandidate);
437 437
438 if (!srcAttribute.isEmpty()) 438 if (!srcAttribute.isEmpty())
439 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin)); 439 imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.leng th(), DescriptorParsingResult(), ImageCandidate::SrcOrigin));
440 440
441 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates ).toString(); 441 return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates ).toString();
442 } 442 }
443 443
444 } // namespace blink 444 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698