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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 HTMLFormElement* HTMLImageElement::formOwner() const | 122 HTMLFormElement* HTMLImageElement::formOwner() const |
123 { | 123 { |
124 return m_form.get(); | 124 return m_form.get(); |
125 } | 125 } |
126 | 126 |
127 void HTMLImageElement::formRemovedFromTree(const Node& formRoot) | 127 void HTMLImageElement::formRemovedFromTree(const Node& formRoot) |
128 { | 128 { |
129 ASSERT(m_form); | 129 ASSERT(m_form); |
130 if (highestAncestor() != formRoot) | 130 if (highestAncestorOrSelf() != formRoot) |
131 resetFormOwner(); | 131 resetFormOwner(); |
132 } | 132 } |
133 | 133 |
134 void HTMLImageElement::resetFormOwner() | 134 void HTMLImageElement::resetFormOwner() |
135 { | 135 { |
136 m_formWasSetByParser = false; | 136 m_formWasSetByParser = false; |
137 HTMLFormElement* nearestForm = findFormAncestor(); | 137 HTMLFormElement* nearestForm = findFormAncestor(); |
138 if (m_form) { | 138 if (m_form) { |
139 if (nearestForm == m_form.get()) | 139 if (nearestForm == m_form.get()) |
140 return; | 140 return; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if (!m_imageLoader.image() && !renderImageResource->cachedImage()) | 221 if (!m_imageLoader.image() && !renderImageResource->cachedImage()) |
222 renderImage->setImageSizeForAltText(); | 222 renderImage->setImageSizeForAltText(); |
223 else | 223 else |
224 renderImageResource->setImageResource(m_imageLoader.image()); | 224 renderImageResource->setImageResource(m_imageLoader.image()); |
225 | 225 |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) | 229 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) |
230 { | 230 { |
231 if (!m_formWasSetByParser || insertionPoint->highestAncestor() != m_form->hi
ghestAncestor()) | 231 if (!m_formWasSetByParser || insertionPoint->highestAncestorOrSelf() != m_fo
rm->highestAncestorOrSelf()) |
232 resetFormOwner(); | 232 resetFormOwner(); |
233 | 233 |
234 // If we have been inserted from a renderer-less document, | 234 // If we have been inserted from a renderer-less document, |
235 // our loader may have not fetched the image, so do it now. | 235 // our loader may have not fetched the image, so do it now. |
236 if (insertionPoint->inDocument() && !m_imageLoader.image()) | 236 if (insertionPoint->inDocument() && !m_imageLoader.image()) |
237 m_imageLoader.updateFromElement(); | 237 m_imageLoader.updateFromElement(); |
238 | 238 |
239 return HTMLElement::insertedInto(insertionPoint); | 239 return HTMLElement::insertedInto(insertionPoint); |
240 } | 240 } |
241 | 241 |
242 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) | 242 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
243 { | 243 { |
244 if (!m_form || m_form->highestAncestor() != highestAncestor()) | 244 if (!m_form || m_form->highestAncestorOrSelf() != highestAncestorOrSelf()) |
245 resetFormOwner(); | 245 resetFormOwner(); |
246 HTMLElement::removedFrom(insertionPoint); | 246 HTMLElement::removedFrom(insertionPoint); |
247 } | 247 } |
248 | 248 |
249 int HTMLImageElement::width(bool ignorePendingStylesheets) | 249 int HTMLImageElement::width(bool ignorePendingStylesheets) |
250 { | 250 { |
251 if (!renderer()) { | 251 if (!renderer()) { |
252 // check the attribute first for an explicit pixel value | 252 // check the attribute first for an explicit pixel value |
253 bool ok; | 253 bool ok; |
254 int width = getAttribute(widthAttr).toInt(&ok); | 254 int width = getAttribute(widthAttr).toInt(&ok); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 if (!image) | 465 if (!image) |
466 return FloatSize(); | 466 return FloatSize(); |
467 LayoutSize size; | 467 LayoutSize size; |
468 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. | 468 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. |
469 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) | 469 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) |
470 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); | 470 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); |
471 return size; | 471 return size; |
472 } | 472 } |
473 | 473 |
474 } | 474 } |
OLD | NEW |