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

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

Issue 287163010: Notify <picture> elements when a media query (potentially) changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: forgot to adjust test after moving Created 6 years, 5 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 continue; 236 continue;
237 237
238 HTMLSourceElement* source = toHTMLSourceElement(child); 238 HTMLSourceElement* source = toHTMLSourceElement(child);
239 String srcset = source->fastGetAttribute(srcsetAttr); 239 String srcset = source->fastGetAttribute(srcsetAttr);
240 if (srcset.isEmpty()) 240 if (srcset.isEmpty())
241 continue; 241 continue;
242 String type = source->fastGetAttribute(typeAttr); 242 String type = source->fastGetAttribute(typeAttr);
243 if (!type.isEmpty() && !supportedImageType(type)) 243 if (!type.isEmpty() && !supportedImageType(type))
244 continue; 244 continue;
245 245
246 String media = source->fastGetAttribute(mediaAttr); 246 if (!source->mediaQueryMatches())
247 if (!media.isEmpty()) { 247 continue;
248 RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::crea te(media);
249 if (!document().mediaQueryMatcher().evaluate(mediaQueries.get()))
250 continue;
251 }
252 248
253 unsigned effectiveSize = SizesAttributeParser::findEffectiveSize(source- >fastGetAttribute(sizesAttr), MediaValuesDynamic::create(document())); 249 unsigned effectiveSize = SizesAttributeParser::findEffectiveSize(source- >fastGetAttribute(sizesAttr), MediaValuesDynamic::create(document()));
254 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr)); 250 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr));
255 if (candidate.isEmpty()) 251 if (candidate.isEmpty())
256 continue; 252 continue;
257 return candidate; 253 return candidate;
258 } 254 }
259 return ImageCandidate(); 255 return ImageCandidate();
260 } 256 }
261 257
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 else 583 else
588 imageLoader().updateFromElement(); 584 imageLoader().updateFromElement();
589 } 585 }
590 586
591 const KURL& HTMLImageElement::sourceURL() const 587 const KURL& HTMLImageElement::sourceURL() const
592 { 588 {
593 return cachedImage()->response().url(); 589 return cachedImage()->response().url();
594 } 590 }
595 591
596 } 592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698