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 30 matching lines...) Expand all Loading... |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 using namespace HTMLNames; | 43 using namespace HTMLNames; |
44 | 44 |
45 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* docum
ent, HTMLFormElement* form) | 45 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* docum
ent, HTMLFormElement* form) |
46 : HTMLElement(tagName, document) | 46 : HTMLElement(tagName, document) |
47 , m_imageLoader(this) | 47 , m_imageLoader(this) |
48 , m_form(form) | 48 , m_form(form) |
49 , m_compositeOperator(CompositeSourceOver) | 49 , m_compositeOperator(CompositeSourceOver) |
50 { | 50 { |
51 ASSERT(hasTagName(imgTag)); | 51 ASSERT((hasTagName(imgTag)) |
| 52 #if ENABLE(PICTURE) |
| 53 || (hasTagName(pictureTag)) |
| 54 #endif |
| 55 ); |
52 ScriptWrappable::init(this); | 56 ScriptWrappable::init(this); |
53 if (form) | 57 if (form) |
54 form->registerImgElement(this); | 58 form->registerImgElement(this); |
55 } | 59 } |
56 | 60 |
57 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document) | 61 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document) |
58 { | 62 { |
59 return adoptRef(new HTMLImageElement(imgTag, document)); | 63 return adoptRef(new HTMLImageElement(imgTag, document)); |
60 } | 64 } |
61 | 65 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 195 } |
192 | 196 |
193 // If we have been inserted from a renderer-less document, | 197 // If we have been inserted from a renderer-less document, |
194 // our loader may have not fetched the image, so do it now. | 198 // our loader may have not fetched the image, so do it now. |
195 if (insertionPoint->inDocument() && !m_imageLoader.image()) | 199 if (insertionPoint->inDocument() && !m_imageLoader.image()) |
196 m_imageLoader.updateFromElement(); | 200 m_imageLoader.updateFromElement(); |
197 | 201 |
198 return HTMLElement::insertedInto(insertionPoint); | 202 return HTMLElement::insertedInto(insertionPoint); |
199 } | 203 } |
200 | 204 |
| 205 void HTMLImageElement::updateResources() |
| 206 { |
| 207 m_imageLoader.updateFromElement(); |
| 208 } |
201 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) | 209 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
202 { | 210 { |
203 if (m_form) | 211 if (m_form) |
204 m_form->removeImgElement(this); | 212 m_form->removeImgElement(this); |
205 m_form = 0; | 213 m_form = 0; |
206 HTMLElement::removedFrom(insertionPoint); | 214 HTMLElement::removedFrom(insertionPoint); |
207 } | 215 } |
208 | 216 |
209 int HTMLImageElement::width(bool ignorePendingStylesheets) | 217 int HTMLImageElement::width(bool ignorePendingStylesheets) |
210 { | 218 { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 374 |
367 void HTMLImageElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st | 375 void HTMLImageElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st |
368 { | 376 { |
369 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 377 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
370 HTMLElement::reportMemoryUsage(memoryObjectInfo); | 378 HTMLElement::reportMemoryUsage(memoryObjectInfo); |
371 info.addMember(m_imageLoader, "imageLoader"); | 379 info.addMember(m_imageLoader, "imageLoader"); |
372 info.addMember(m_form, "form"); | 380 info.addMember(m_form, "form"); |
373 } | 381 } |
374 | 382 |
375 } | 383 } |
OLD | NEW |