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

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

Issue 839733003: Image() constructor's arguments should not have default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLImageElement.idl » ('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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 void HTMLImageElement::notifyViewportChanged() 137 void HTMLImageElement::notifyViewportChanged()
138 { 138 {
139 // Re-selecting the source URL in order to pick a more fitting resource 139 // Re-selecting the source URL in order to pick a more fitting resource
140 // And update the image's intrinsic dimensions when the viewport changes. 140 // And update the image's intrinsic dimensions when the viewport changes.
141 // Picking of a better fitting resource is UA dependant, not spec required. 141 // Picking of a better fitting resource is UA dependant, not spec required.
142 selectSourceURL(ImageLoader::UpdateSizeChanged); 142 selectSourceURL(ImageLoader::UpdateSizeChanged);
143 } 143 }
144 144
145 PassRefPtrWillBeRawPtr<HTMLImageElement> HTMLImageElement::createForJSConstructo r(Document& document)
146 {
147 RefPtrWillBeRawPtr<HTMLImageElement> image = adoptRefWillBeNoop(new HTMLImag eElement(document));
148 image->m_elementCreatedByParser = false;
149 return image.release();
150 }
151
152 PassRefPtrWillBeRawPtr<HTMLImageElement> HTMLImageElement::createForJSConstructo r(Document& document, int width)
153 {
154 RefPtrWillBeRawPtr<HTMLImageElement> image = adoptRefWillBeNoop(new HTMLImag eElement(document));
155 image->setWidth(width);
156 image->m_elementCreatedByParser = false;
157 return image.release();
158 }
159
145 PassRefPtrWillBeRawPtr<HTMLImageElement> HTMLImageElement::createForJSConstructo r(Document& document, int width, int height) 160 PassRefPtrWillBeRawPtr<HTMLImageElement> HTMLImageElement::createForJSConstructo r(Document& document, int width, int height)
146 { 161 {
147 RefPtrWillBeRawPtr<HTMLImageElement> image = adoptRefWillBeNoop(new HTMLImag eElement(document)); 162 RefPtrWillBeRawPtr<HTMLImageElement> image = adoptRefWillBeNoop(new HTMLImag eElement(document));
148 if (width) 163 image->setWidth(width);
149 image->setWidth(width); 164 image->setHeight(height);
150 if (height)
151 image->setHeight(height);
152 image->m_elementCreatedByParser = false; 165 image->m_elementCreatedByParser = false;
153 return image.release(); 166 return image.release();
154 } 167 }
155 168
156 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const 169 bool HTMLImageElement::isPresentationAttribute(const QualifiedName& name) const
157 { 170 {
158 if (name == widthAttr || name == heightAttr || name == borderAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr || name == valignAttr) 171 if (name == widthAttr || name == heightAttr || name == borderAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr || name == valignAttr)
159 return true; 172 return true;
160 return HTMLElement::isPresentationAttribute(name); 173 return HTMLElement::isPresentationAttribute(name);
161 } 174 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 727 }
715 728
716 void HTMLImageElement::setUseFallbackContent() 729 void HTMLImageElement::setUseFallbackContent()
717 { 730 {
718 m_useFallbackContent = true; 731 m_useFallbackContent = true;
719 if (document().inStyleRecalc()) 732 if (document().inStyleRecalc())
720 return; 733 return;
721 ensureUserAgentShadowRoot(); 734 ensureUserAgentShadowRoot();
722 } 735 }
723 } 736 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698