| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 m_form = nearestForm->createWeakPtr(); | 150 m_form = nearestForm->createWeakPtr(); |
| 151 m_form->associate(*this); | 151 m_form->associate(*this); |
| 152 } else { | 152 } else { |
| 153 m_form = WeakPtr<HTMLFormElement>(); | 153 m_form = WeakPtr<HTMLFormElement>(); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) | 157 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
e& candidate) |
| 158 { | 158 { |
| 159 m_bestFitImageURL = candidate.url(); | 159 m_bestFitImageURL = candidate.url(); |
| 160 m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string(
)); |
| 160 float candidateScaleFactor = candidate.scaleFactor(); | 161 float candidateScaleFactor = candidate.scaleFactor(); |
| 161 // FIXME: Make this ">0" part match the spec, once it settles. | 162 // FIXME: Make this ">0" part match the spec, once it settles. |
| 162 if (candidateScaleFactor > 0) | 163 if (candidateScaleFactor > 0) |
| 163 m_imageDevicePixelRatio = 1 / candidateScaleFactor; | 164 m_imageDevicePixelRatio = 1 / candidateScaleFactor; |
| 164 if (renderer() && renderer()->isImage()) | 165 if (renderer() && renderer()->isImage()) |
| 165 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa
tio); | 166 toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRa
tio); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 169 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 169 { | 170 { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 int HTMLImageElement::naturalHeight() const | 370 int HTMLImageElement::naturalHeight() const |
| 370 { | 371 { |
| 371 if (!m_imageLoader.image()) | 372 if (!m_imageLoader.image()) |
| 372 return 0; | 373 return 0; |
| 373 | 374 |
| 374 return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height(
); | 375 return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height(
); |
| 375 } | 376 } |
| 376 | 377 |
| 377 const AtomicString& HTMLImageElement::currentSrc() const | 378 const AtomicString& HTMLImageElement::currentSrc() const |
| 378 { | 379 { |
| 379 // FIXME: Need to absolutize the returned value. | 380 return m_currentSrc; |
| 380 return m_bestFitImageURL; | |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const | 383 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const |
| 384 { | 384 { |
| 385 return attribute.name() == srcAttr | 385 return attribute.name() == srcAttr |
| 386 || attribute.name() == lowsrcAttr | 386 || attribute.name() == lowsrcAttr |
| 387 || attribute.name() == longdescAttr | 387 || attribute.name() == longdescAttr |
| 388 || (attribute.name() == usemapAttr && attribute.value().string()[0] != '
#') | 388 || (attribute.name() == usemapAttr && attribute.value().string()[0] != '
#') |
| 389 || HTMLElement::isURLAttribute(attribute); | 389 || HTMLElement::isURLAttribute(attribute); |
| 390 } | 390 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 if (!image) | 537 if (!image) |
| 538 return FloatSize(); | 538 return FloatSize(); |
| 539 LayoutSize size; | 539 LayoutSize size; |
| 540 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. | 540 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. |
| 541 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) | 541 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) |
| 542 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); | 542 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); |
| 543 return size; | 543 return size; |
| 544 } | 544 } |
| 545 | 545 |
| 546 } | 546 } |
| OLD | NEW |