Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 #include "core/html/HTMLFormElement.h" 33 #include "core/html/HTMLFormElement.h"
34 #include "core/html/parser/HTMLParserIdioms.h" 34 #include "core/html/parser/HTMLParserIdioms.h"
35 #include "core/rendering/RenderImage.h" 35 #include "core/rendering/RenderImage.h"
36 36
37 using namespace std; 37 using namespace std;
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 using namespace HTMLNames; 41 using namespace HTMLNames;
42 42
43 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* docum ent, HTMLFormElement* form) 43 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document& docum ent, HTMLFormElement* form)
44 : HTMLElement(tagName, document) 44 : HTMLElement(tagName, document)
45 , m_imageLoader(this) 45 , m_imageLoader(this)
46 , m_form(form) 46 , m_form(form)
47 , m_compositeOperator(CompositeSourceOver) 47 , m_compositeOperator(CompositeSourceOver)
48 { 48 {
49 ASSERT(hasTagName(imgTag)); 49 ASSERT(hasTagName(imgTag));
50 ScriptWrappable::init(this); 50 ScriptWrappable::init(this);
51 if (form) 51 if (form)
52 form->registerImgElement(this); 52 form->registerImgElement(this);
53 } 53 }
54 54
55 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document) 55 PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document& document)
56 { 56 {
57 return adoptRef(new HTMLImageElement(imgTag, document)); 57 return adoptRef(new HTMLImageElement(imgTag, document));
58 } 58 }
59 59
60 PassRefPtr<HTMLImageElement> HTMLImageElement::create(const QualifiedName& tagNa me, Document* document, HTMLFormElement* form) 60 PassRefPtr<HTMLImageElement> HTMLImageElement::create(const QualifiedName& tagNa me, Document& document, HTMLFormElement* form)
61 { 61 {
62 return adoptRef(new HTMLImageElement(tagName, document, form)); 62 return adoptRef(new HTMLImageElement(tagName, document, form));
63 } 63 }
64 64
65 HTMLImageElement::~HTMLImageElement() 65 HTMLImageElement::~HTMLImageElement()
66 { 66 {
67 if (m_form) 67 if (m_form)
68 m_form->removeImgElement(this); 68 m_form->removeImgElement(this);
69 } 69 }
70 70
71 PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* document, const int* optionalWidth, const int* optionalHeight) 71 PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, const int* optionalWidth, const int* optionalHeight)
72 { 72 {
73 RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, docum ent)); 73 RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, docum ent));
74 if (optionalWidth) 74 if (optionalWidth)
75 image->setWidth(*optionalWidth); 75 image->setWidth(*optionalWidth);
76 if (optionalHeight) 76 if (optionalHeight)
77 image->setHeight(*optionalHeight); 77 image->setHeight(*optionalHeight);
78 return image.release(); 78 return image.release();
79 } 79 }
80 80
81 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const 81 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 Image* HTMLImageElement::imageContents() 368 Image* HTMLImageElement::imageContents()
369 { 369 {
370 if (!m_imageLoader.imageComplete()) 370 if (!m_imageLoader.imageComplete())
371 return 0; 371 return 0;
372 372
373 return m_imageLoader.image()->image(); 373 return m_imageLoader.image()->image();
374 } 374 }
375 375
376 } 376 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698