| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/html/parser/HTMLParserIdioms.h" | 35 #include "core/html/parser/HTMLParserIdioms.h" |
| 36 #include "core/html/parser/HTMLSrcsetParser.h" | 36 #include "core/html/parser/HTMLSrcsetParser.h" |
| 37 #include "core/rendering/RenderImage.h" | 37 #include "core/rendering/RenderImage.h" |
| 38 | 38 |
| 39 using namespace std; | 39 using namespace std; |
| 40 | 40 |
| 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(Document& document, HTMLFormElement* form) |
| 46 : HTMLElement(tagName, document) | 46 : HTMLElement(imgTag, 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 , m_imageDevicePixelRatio(1.0f) | 50 , m_imageDevicePixelRatio(1.0f) |
| 51 { | 51 { |
| 52 ASSERT(hasTagName(imgTag)); | |
| 53 ScriptWrappable::init(this); | 52 ScriptWrappable::init(this); |
| 54 if (form) | 53 if (form) |
| 55 form->registerImgElement(this); | 54 form->registerImgElement(this); |
| 56 } | 55 } |
| 57 | 56 |
| 58 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document& document) | 57 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document& document) |
| 59 { | 58 { |
| 60 return adoptRef(new HTMLImageElement(imgTag, document)); | 59 return adoptRef(new HTMLImageElement(document)); |
| 61 } | 60 } |
| 62 | 61 |
| 63 PassRefPtr<HTMLImageElement> HTMLImageElement::create(const QualifiedName& tagNa
me, Document& document, HTMLFormElement* form) | 62 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document& document, HTMLFo
rmElement* form) |
| 64 { | 63 { |
| 65 return adoptRef(new HTMLImageElement(tagName, document, form)); | 64 return adoptRef(new HTMLImageElement(document, form)); |
| 66 } | 65 } |
| 67 | 66 |
| 68 HTMLImageElement::~HTMLImageElement() | 67 HTMLImageElement::~HTMLImageElement() |
| 69 { | 68 { |
| 70 if (m_form) | 69 if (m_form) |
| 71 m_form->removeImgElement(this); | 70 m_form->removeImgElement(this); |
| 72 } | 71 } |
| 73 | 72 |
| 74 PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document&
document, int width, int height) | 73 PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document&
document, int width, int height) |
| 75 { | 74 { |
| 76 RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, docum
ent)); | 75 RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(document)); |
| 77 if (width) | 76 if (width) |
| 78 image->setWidth(width); | 77 image->setWidth(width); |
| 79 if (height) | 78 if (height) |
| 80 image->setHeight(height); | 79 image->setHeight(height); |
| 81 return image.release(); | 80 return image.release(); |
| 82 } | 81 } |
| 83 | 82 |
| 84 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const | 83 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const |
| 85 { | 84 { |
| 86 if (name == widthAttr || name == heightAttr || name == borderAttr || name ==
vspaceAttr || name == hspaceAttr || name == alignAttr || name == valignAttr) | 85 if (name == widthAttr || name == heightAttr || name == borderAttr || name ==
vspaceAttr || name == hspaceAttr || name == alignAttr || name == valignAttr) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 390 |
| 392 return m_imageLoader.image()->image(); | 391 return m_imageLoader.image()->image(); |
| 393 } | 392 } |
| 394 | 393 |
| 395 bool HTMLImageElement::isInteractiveContent() const | 394 bool HTMLImageElement::isInteractiveContent() const |
| 396 { | 395 { |
| 397 return fastHasAttribute(usemapAttr); | 396 return fastHasAttribute(usemapAttr); |
| 398 } | 397 } |
| 399 | 398 |
| 400 } | 399 } |
| OLD | NEW |