| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 | 246 |
| 247 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) | 247 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) |
| 248 { | 248 { |
| 249 m_bestFitImageURL = candidate.url(); | 249 m_bestFitImageURL = candidate.url(); |
| 250 float candidateDensity = candidate.density(); | 250 float candidateDensity = candidate.density(); |
| 251 if (candidateDensity >= 0) | 251 if (candidateDensity >= 0) |
| 252 m_imageDevicePixelRatio = 1.0 / candidateDensity; | 252 m_imageDevicePixelRatio = 1.0 / candidateDensity; |
| 253 | 253 |
| 254 bool intrinsicSizingViewportDependant = false; | 254 bool intrinsicSizingViewportDependant = false; |
| 255 if (candidate.resourceWidth() > 0) { | 255 if (candidate.getResourceWidth() > 0) { |
| 256 intrinsicSizingViewportDependant = true; | 256 intrinsicSizingViewportDependant = true; |
| 257 UseCounter::count(document(), UseCounter::SrcsetWDescriptor); | 257 UseCounter::count(document(), UseCounter::SrcsetWDescriptor); |
| 258 } else if (!candidate.srcOrigin()) { | 258 } else if (!candidate.srcOrigin()) { |
| 259 UseCounter::count(document(), UseCounter::SrcsetXDescriptor); | 259 UseCounter::count(document(), UseCounter::SrcsetXDescriptor); |
| 260 } | 260 } |
| 261 if (layoutObject() && layoutObject()->isImage()) | 261 if (layoutObject() && layoutObject()->isImage()) |
| 262 toLayoutImage(layoutObject())->setImageDevicePixelRatio(m_imageDevicePix
elRatio); | 262 toLayoutImage(layoutObject())->setImageDevicePixelRatio(m_imageDevicePix
elRatio); |
| 263 | 263 |
| 264 if (intrinsicSizingViewportDependant) { | 264 if (intrinsicSizingViewportDependant) { |
| 265 if (!m_listener) | 265 if (!m_listener) |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 static bool sourceSizeValue(Element& element, Document& currentDocument, float&
sourceSize) | 664 static bool sourceSizeValue(Element& element, Document& currentDocument, float&
sourceSize) |
| 665 { | 665 { |
| 666 String sizes = element.fastGetAttribute(sizesAttr); | 666 String sizes = element.fastGetAttribute(sizesAttr); |
| 667 bool exists = !sizes.isNull(); | 667 bool exists = !sizes.isNull(); |
| 668 if (exists) | 668 if (exists) |
| 669 UseCounter::count(currentDocument, UseCounter::Sizes); | 669 UseCounter::count(currentDocument, UseCounter::Sizes); |
| 670 sourceSize = SizesAttributeParser(MediaValuesDynamic::create(currentDocument
), sizes).length(); | 670 sourceSize = SizesAttributeParser(MediaValuesDynamic::create(currentDocument
), sizes).length(); |
| 671 return exists; | 671 return exists; |
| 672 } | 672 } |
| 673 | 673 |
| 674 FetchRequest::ResourceWidth HTMLImageElement::resourceWidth() | 674 FetchRequest::ResourceWidth HTMLImageElement::getResourceWidth() |
| 675 { | 675 { |
| 676 FetchRequest::ResourceWidth resourceWidth; | 676 FetchRequest::ResourceWidth resourceWidth; |
| 677 Element* element = m_source.get(); | 677 Element* element = m_source.get(); |
| 678 if (!element) | 678 if (!element) |
| 679 element = this; | 679 element = this; |
| 680 resourceWidth.isSet = sourceSizeValue(*element, document(), resourceWidth.wi
dth); | 680 resourceWidth.isSet = sourceSizeValue(*element, document(), resourceWidth.wi
dth); |
| 681 return resourceWidth; | 681 return resourceWidth; |
| 682 } | 682 } |
| 683 | 683 |
| 684 float HTMLImageElement::sourceSize(Element& element) | 684 float HTMLImageElement::sourceSize(Element& element) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 { | 812 { |
| 813 ImageResource* image = cachedImage(); | 813 ImageResource* image = cachedImage(); |
| 814 if (!image) | 814 if (!image) |
| 815 return IntSize(); | 815 return IntSize(); |
| 816 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 816 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 817 ASSERT(lSize.fraction().isZero()); | 817 ASSERT(lSize.fraction().isZero()); |
| 818 return IntSize(lSize.width(), lSize.height()); | 818 return IntSize(lSize.width(), lSize.height()); |
| 819 } | 819 } |
| 820 | 820 |
| 821 } // namespace blink | 821 } // namespace blink |
| OLD | NEW |