| 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 15 matching lines...) Expand all Loading... |
| 26 #include "gen/sky/core/CSSPropertyNames.h" | 26 #include "gen/sky/core/CSSPropertyNames.h" |
| 27 #include "gen/sky/core/HTMLNames.h" | 27 #include "gen/sky/core/HTMLNames.h" |
| 28 #include "gen/sky/core/MediaTypeNames.h" | 28 #include "gen/sky/core/MediaTypeNames.h" |
| 29 #include "gen/sky/platform/RuntimeEnabledFeatures.h" | 29 #include "gen/sky/platform/RuntimeEnabledFeatures.h" |
| 30 #include "sky/engine/core/css/MediaQueryListListener.h" | 30 #include "sky/engine/core/css/MediaQueryListListener.h" |
| 31 #include "sky/engine/core/css/MediaQueryMatcher.h" | 31 #include "sky/engine/core/css/MediaQueryMatcher.h" |
| 32 #include "sky/engine/core/css/MediaValuesDynamic.h" | 32 #include "sky/engine/core/css/MediaValuesDynamic.h" |
| 33 #include "sky/engine/core/dom/Attribute.h" | 33 #include "sky/engine/core/dom/Attribute.h" |
| 34 #include "sky/engine/core/dom/NodeTraversal.h" | 34 #include "sky/engine/core/dom/NodeTraversal.h" |
| 35 #include "sky/engine/core/fetch/ImageResource.h" | 35 #include "sky/engine/core/fetch/ImageResource.h" |
| 36 #include "sky/engine/core/frame/UseCounter.h" | |
| 37 #include "sky/engine/core/html/HTMLAnchorElement.h" | 36 #include "sky/engine/core/html/HTMLAnchorElement.h" |
| 38 #include "sky/engine/core/html/HTMLCanvasElement.h" | 37 #include "sky/engine/core/html/HTMLCanvasElement.h" |
| 39 #include "sky/engine/core/html/canvas/CanvasRenderingContext.h" | 38 #include "sky/engine/core/html/canvas/CanvasRenderingContext.h" |
| 40 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" | 39 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" |
| 41 #include "sky/engine/core/html/parser/HTMLSrcsetParser.h" | 40 #include "sky/engine/core/html/parser/HTMLSrcsetParser.h" |
| 42 #include "sky/engine/core/inspector/ConsoleMessage.h" | 41 #include "sky/engine/core/inspector/ConsoleMessage.h" |
| 43 #include "sky/engine/core/rendering/RenderImage.h" | 42 #include "sky/engine/core/rendering/RenderImage.h" |
| 44 #include "sky/engine/platform/MIMETypeRegistry.h" | 43 #include "sky/engine/platform/MIMETypeRegistry.h" |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 { | 117 { |
| 119 return m_bestFitImageURL.isNull() ? getAttribute(HTMLNames::srcAttr) : m_bes
tFitImageURL; | 118 return m_bestFitImageURL.isNull() ? getAttribute(HTMLNames::srcAttr) : m_bes
tFitImageURL; |
| 120 } | 119 } |
| 121 | 120 |
| 122 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) | 121 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) |
| 123 { | 122 { |
| 124 m_bestFitImageURL = candidate.url(); | 123 m_bestFitImageURL = candidate.url(); |
| 125 float candidateDensity = candidate.density(); | 124 float candidateDensity = candidate.density(); |
| 126 if (candidateDensity >= 0) | 125 if (candidateDensity >= 0) |
| 127 m_imageDevicePixelRatio = 1.0 / candidateDensity; | 126 m_imageDevicePixelRatio = 1.0 / candidateDensity; |
| 128 if (candidate.resourceWidth() > 0) { | 127 if (candidate.resourceWidth() > 0) |
| 129 m_intrinsicSizingViewportDependant = true; | 128 m_intrinsicSizingViewportDependant = true; |
| 130 UseCounter::count(document(), UseCounter::SrcsetWDescriptor); | |
| 131 } else if (!candidate.srcOrigin()) { | |
| 132 UseCounter::count(document(), UseCounter::SrcsetXDescriptor); | |
| 133 } | |
| 134 if (renderer() && renderer()->isImage()) | 129 if (renderer() && renderer()->isImage()) |
| 135 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa
tio); | 130 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa
tio); |
| 136 } | 131 } |
| 137 | 132 |
| 138 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 133 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 139 { | 134 { |
| 140 if (name == HTMLNames::srcAttr) { | 135 if (name == HTMLNames::srcAttr) { |
| 141 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); | 136 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); |
| 142 } else { | 137 } else { |
| 143 HTMLElement::parseAttribute(name, value); | 138 HTMLElement::parseAttribute(name, value); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 364 } |
| 370 imageLoader().updateFromElement(behavior); | 365 imageLoader().updateFromElement(behavior); |
| 371 } | 366 } |
| 372 | 367 |
| 373 const KURL& HTMLImageElement::sourceURL() const | 368 const KURL& HTMLImageElement::sourceURL() const |
| 374 { | 369 { |
| 375 return cachedImage()->response().url(); | 370 return cachedImage()->response().url(); |
| 376 } | 371 } |
| 377 | 372 |
| 378 } | 373 } |
| OLD | NEW |