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

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 649183007: Add console errors and usecounter when srcset candidates are dropped (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: improved log messages Created 6 years, 2 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 if (!source->mediaQueryMatches()) 303 if (!source->mediaQueryMatches())
304 continue; 304 continue;
305 305
306 String sizes = source->fastGetAttribute(sizesAttr); 306 String sizes = source->fastGetAttribute(sizesAttr);
307 if (!sizes.isNull()) 307 if (!sizes.isNull())
308 UseCounter::count(document(), UseCounter::Sizes); 308 UseCounter::count(document(), UseCounter::Sizes);
309 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynamic::c reate(document()), sizes); 309 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynamic::c reate(document()), sizes);
310 float effectiveSize = parser.length(); 310 float effectiveSize = parser.length();
311 m_effectiveSizeViewportDependant = parser.viewportDependant(); 311 m_effectiveSizeViewportDependant = parser.viewportDependant();
312 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr)); 312 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr), &document ());
313 if (candidate.isEmpty()) 313 if (candidate.isEmpty())
314 continue; 314 continue;
315 return candidate; 315 return candidate;
316 } 316 }
317 return ImageCandidate(); 317 return ImageCandidate();
318 } 318 }
319 319
320 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style) 320 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style)
321 { 321 {
322 if (style->hasContent()) 322 if (style->hasContent())
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if (!foundURL) { 637 if (!foundURL) {
638 float effectiveSize = 0; 638 float effectiveSize = 0;
639 if (RuntimeEnabledFeatures::pictureSizesEnabled()) { 639 if (RuntimeEnabledFeatures::pictureSizesEnabled()) {
640 String sizes = fastGetAttribute(sizesAttr); 640 String sizes = fastGetAttribute(sizesAttr);
641 if (!sizes.isNull()) 641 if (!sizes.isNull())
642 UseCounter::count(document(), UseCounter::Sizes); 642 UseCounter::count(document(), UseCounter::Sizes);
643 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynami c::create(document()), sizes); 643 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynami c::create(document()), sizes);
644 effectiveSize = parser.length(); 644 effectiveSize = parser.length();
645 m_effectiveSizeViewportDependant = parser.viewportDependant(); 645 m_effectiveSizeViewportDependant = parser.viewportDependant();
646 } 646 }
647 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr)); 647 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr), &document());
648 setBestFitURLAndDPRFromImageCandidate(candidate); 648 setBestFitURLAndDPRFromImageCandidate(candidate);
649 } 649 }
650 if (m_intrinsicSizingViewportDependant && m_effectiveSizeViewportDependant & & !m_listener) { 650 if (m_intrinsicSizingViewportDependant && m_effectiveSizeViewportDependant & & !m_listener) {
651 m_listener = ViewportChangeListener::create(this); 651 m_listener = ViewportChangeListener::create(this);
652 document().mediaQueryMatcher().addViewportListener(m_listener); 652 document().mediaQueryMatcher().addViewportListener(m_listener);
653 } 653 }
654 imageLoader().updateFromElement(behavior); 654 imageLoader().updateFromElement(behavior);
655 } 655 }
656 656
657 const KURL& HTMLImageElement::sourceURL() const 657 const KURL& HTMLImageElement::sourceURL() const
658 { 658 {
659 return cachedImage()->response().url(); 659 return cachedImage()->response().url();
660 } 660 }
661 661
662 } 662 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698