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

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

Issue 466353002: Added a console warning when <picture><source src></picture> is used. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adjusted expected results Created 6 years, 4 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
« no previous file with comments | « LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 #include "core/dom/NodeTraversal.h" 34 #include "core/dom/NodeTraversal.h"
35 #include "core/fetch/ImageResource.h" 35 #include "core/fetch/ImageResource.h"
36 #include "core/frame/UseCounter.h" 36 #include "core/frame/UseCounter.h"
37 #include "core/html/HTMLAnchorElement.h" 37 #include "core/html/HTMLAnchorElement.h"
38 #include "core/html/HTMLCanvasElement.h" 38 #include "core/html/HTMLCanvasElement.h"
39 #include "core/html/HTMLFormElement.h" 39 #include "core/html/HTMLFormElement.h"
40 #include "core/html/HTMLSourceElement.h" 40 #include "core/html/HTMLSourceElement.h"
41 #include "core/html/canvas/CanvasRenderingContext.h" 41 #include "core/html/canvas/CanvasRenderingContext.h"
42 #include "core/html/parser/HTMLParserIdioms.h" 42 #include "core/html/parser/HTMLParserIdioms.h"
43 #include "core/html/parser/HTMLSrcsetParser.h" 43 #include "core/html/parser/HTMLSrcsetParser.h"
44 #include "core/inspector/ConsoleMessage.h"
44 #include "core/rendering/RenderImage.h" 45 #include "core/rendering/RenderImage.h"
45 #include "platform/MIMETypeRegistry.h" 46 #include "platform/MIMETypeRegistry.h"
46 #include "platform/RuntimeEnabledFeatures.h" 47 #include "platform/RuntimeEnabledFeatures.h"
47 48
48 namespace blink { 49 namespace blink {
49 50
50 using namespace HTMLNames; 51 using namespace HTMLNames;
51 52
52 class HTMLImageElement::ViewportChangeListener FINAL : public MediaQueryListList ener { 53 class HTMLImageElement::ViewportChangeListener FINAL : public MediaQueryListList ener {
53 public: 54 public:
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 if (!parent || !isHTMLPictureElement(*parent)) 276 if (!parent || !isHTMLPictureElement(*parent))
276 return ImageCandidate(); 277 return ImageCandidate();
277 for (Node* child = parent->firstChild(); child; child = child->nextSibling() ) { 278 for (Node* child = parent->firstChild(); child; child = child->nextSibling() ) {
278 if (child == this) 279 if (child == this)
279 return ImageCandidate(); 280 return ImageCandidate();
280 281
281 if (!isHTMLSourceElement(*child)) 282 if (!isHTMLSourceElement(*child))
282 continue; 283 continue;
283 284
284 HTMLSourceElement* source = toHTMLSourceElement(child); 285 HTMLSourceElement* source = toHTMLSourceElement(child);
286 if (!source->fastGetAttribute(srcAttr).isNull())
287 document().addConsoleMessage(ConsoleMessage::create(RenderingMessage Source, WarningMessageLevel, "<source src> with a <picture> parent is invalid an d therefore ignored. Use <source srcset> instead."));
Mike West 2014/08/13 13:57:24 It might be worthwhile to measure how often this o
285 String srcset = source->fastGetAttribute(srcsetAttr); 288 String srcset = source->fastGetAttribute(srcsetAttr);
286 if (srcset.isEmpty()) 289 if (srcset.isEmpty())
287 continue; 290 continue;
288 String type = source->fastGetAttribute(typeAttr); 291 String type = source->fastGetAttribute(typeAttr);
289 if (!type.isEmpty() && !supportedImageType(type)) 292 if (!type.isEmpty() && !supportedImageType(type))
290 continue; 293 continue;
291 294
292 if (!source->mediaQueryMatches()) 295 if (!source->mediaQueryMatches())
293 continue; 296 continue;
294 297
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 639 }
637 imageLoader().updateFromElement(behavior); 640 imageLoader().updateFromElement(behavior);
638 } 641 }
639 642
640 const KURL& HTMLImageElement::sourceURL() const 643 const KURL& HTMLImageElement::sourceURL() const
641 { 644 {
642 return cachedImage()->response().url(); 645 return cachedImage()->response().url();
643 } 646 }
644 647
645 } 648 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698