Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 String type = source->fastGetAttribute(typeAttr); | 299 String type = source->fastGetAttribute(typeAttr); |
| 300 if (!type.isEmpty() && !supportedImageType(type)) | 300 if (!type.isEmpty() && !supportedImageType(type)) |
| 301 continue; | 301 continue; |
| 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 bool hasLocalFrame = document().frame() ? true : false; |
|
adamk
2014/10/14 22:43:07
To answer Ojan's question, this is exactly the rea
ojan
2014/10/14 22:46:09
I don't know the code here well enough to know wha
adamk
2014/10/14 22:48:22
Sounds like we should reparse when we switch docum
| |
| 310 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynamic::c reate(document()), sizes, hasLocalFrame); | |
| 310 float effectiveSize = parser.length(); | 311 float effectiveSize = parser.length(); |
| 311 m_effectiveSizeViewportDependant = parser.viewportDependant(); | 312 m_effectiveSizeViewportDependant = parser.viewportDependant(); |
| 312 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr)); | 313 ImageCandidate candidate = bestFitSourceForSrcsetAttribute(document().de vicePixelRatio(), effectiveSize, source->fastGetAttribute(srcsetAttr)); |
| 313 if (candidate.isEmpty()) | 314 if (candidate.isEmpty()) |
| 314 continue; | 315 continue; |
| 315 return candidate; | 316 return candidate; |
| 316 } | 317 } |
| 317 return ImageCandidate(); | 318 return ImageCandidate(); |
| 318 } | 319 } |
| 319 | 320 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 foundURL = true; | 634 foundURL = true; |
| 634 } | 635 } |
| 635 } | 636 } |
| 636 | 637 |
| 637 if (!foundURL) { | 638 if (!foundURL) { |
| 638 float effectiveSize = 0; | 639 float effectiveSize = 0; |
| 639 if (RuntimeEnabledFeatures::pictureSizesEnabled()) { | 640 if (RuntimeEnabledFeatures::pictureSizesEnabled()) { |
| 640 String sizes = fastGetAttribute(sizesAttr); | 641 String sizes = fastGetAttribute(sizesAttr); |
| 641 if (!sizes.isNull()) | 642 if (!sizes.isNull()) |
| 642 UseCounter::count(document(), UseCounter::Sizes); | 643 UseCounter::count(document(), UseCounter::Sizes); |
| 643 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynami c::create(document()), sizes); | 644 bool hasLocalFrame = document().frame() ? true : false; |
| 645 SizesAttributeParser parser = SizesAttributeParser(MediaValuesDynami c::create(document()), sizes, hasLocalFrame); | |
| 644 effectiveSize = parser.length(); | 646 effectiveSize = parser.length(); |
| 645 m_effectiveSizeViewportDependant = parser.viewportDependant(); | 647 m_effectiveSizeViewportDependant = parser.viewportDependant(); |
| 646 } | 648 } |
| 647 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr)); | 649 ImageCandidate candidate = bestFitSourceForImageAttributes(document().de vicePixelRatio(), effectiveSize, fastGetAttribute(srcAttr), fastGetAttribute(src setAttr)); |
| 648 setBestFitURLAndDPRFromImageCandidate(candidate); | 650 setBestFitURLAndDPRFromImageCandidate(candidate); |
| 649 } | 651 } |
| 650 if (m_intrinsicSizingViewportDependant && m_effectiveSizeViewportDependant & & !m_listener) { | 652 if (m_intrinsicSizingViewportDependant && m_effectiveSizeViewportDependant & & !m_listener) { |
| 651 m_listener = ViewportChangeListener::create(this); | 653 m_listener = ViewportChangeListener::create(this); |
| 652 document().mediaQueryMatcher().addViewportListener(m_listener); | 654 document().mediaQueryMatcher().addViewportListener(m_listener); |
| 653 } | 655 } |
| 654 imageLoader().updateFromElement(behavior); | 656 imageLoader().updateFromElement(behavior); |
| 655 } | 657 } |
| 656 | 658 |
| 657 const KURL& HTMLImageElement::sourceURL() const | 659 const KURL& HTMLImageElement::sourceURL() const |
| 658 { | 660 { |
| 659 return cachedImage()->response().url(); | 661 return cachedImage()->response().url(); |
| 660 } | 662 } |
| 661 | 663 |
| 662 } | 664 } |
| OLD | NEW |