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

Side by Side Diff: Source/core/html/forms/ImageInputType.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/forms/FileInputType.cpp ('k') | Source/core/html/forms/NumberInputType.cpp » ('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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (element().closedShadowRoot()) { 135 if (element().closedShadowRoot()) {
136 Element* text = element().closedShadowRoot()->getElementById("alttext"); 136 Element* text = element().closedShadowRoot()->getElementById("alttext");
137 String value = element().altText(); 137 String value = element().altText();
138 if (text && text->textContent() != value) 138 if (text && text->textContent() != value)
139 text->setTextContent(element().altText()); 139 text->setTextContent(element().altText());
140 } 140 }
141 } 141 }
142 142
143 void ImageInputType::srcAttributeChanged() 143 void ImageInputType::srcAttributeChanged()
144 { 144 {
145 if (!element().renderer()) 145 if (!element().layoutObject())
146 return; 146 return;
147 element().ensureImageLoader().updateFromElement(ImageLoader::UpdateIgnorePre viousError); 147 element().ensureImageLoader().updateFromElement(ImageLoader::UpdateIgnorePre viousError);
148 } 148 }
149 149
150 void ImageInputType::valueAttributeChanged() 150 void ImageInputType::valueAttributeChanged()
151 { 151 {
152 if (m_useFallbackContent) 152 if (m_useFallbackContent)
153 return; 153 return;
154 BaseButtonInputType::valueAttributeChanged(); 154 BaseButtonInputType::valueAttributeChanged();
155 } 155 }
156 156
157 void ImageInputType::startResourceLoading() 157 void ImageInputType::startResourceLoading()
158 { 158 {
159 BaseButtonInputType::startResourceLoading(); 159 BaseButtonInputType::startResourceLoading();
160 160
161 HTMLImageLoader& imageLoader = element().ensureImageLoader(); 161 HTMLImageLoader& imageLoader = element().ensureImageLoader();
162 imageLoader.updateFromElement(); 162 imageLoader.updateFromElement();
163 163
164 LayoutObject* renderer = element().renderer(); 164 LayoutObject* renderer = element().layoutObject();
165 if (!renderer || !renderer->isLayoutImage()) 165 if (!renderer || !renderer->isLayoutImage())
166 return; 166 return;
167 167
168 LayoutImageResource* imageResource = toLayoutImage(renderer)->imageResource( ); 168 LayoutImageResource* imageResource = toLayoutImage(renderer)->imageResource( );
169 imageResource->setImageResource(imageLoader.image()); 169 imageResource->setImageResource(imageLoader.image());
170 } 170 }
171 171
172 bool ImageInputType::shouldRespectAlignAttribute() 172 bool ImageInputType::shouldRespectAlignAttribute()
173 { 173 {
174 return true; 174 return true;
(...skipping 16 matching lines...) Expand all
191 191
192 bool ImageInputType::shouldRespectHeightAndWidthAttributes() 192 bool ImageInputType::shouldRespectHeightAndWidthAttributes()
193 { 193 {
194 return true; 194 return true;
195 } 195 }
196 196
197 unsigned ImageInputType::height() const 197 unsigned ImageInputType::height() const
198 { 198 {
199 RefPtrWillBeRawPtr<HTMLInputElement> element(this->element()); 199 RefPtrWillBeRawPtr<HTMLInputElement> element(this->element());
200 200
201 if (!element->renderer()) { 201 if (!element->layoutObject()) {
202 // Check the attribute first for an explicit pixel value. 202 // Check the attribute first for an explicit pixel value.
203 unsigned height; 203 unsigned height;
204 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), h eight)) 204 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), h eight))
205 return height; 205 return height;
206 206
207 // If the image is available, use its height. 207 // If the image is available, use its height.
208 HTMLImageLoader* imageLoader = element->imageLoader(); 208 HTMLImageLoader* imageLoader = element->imageLoader();
209 if (imageLoader && imageLoader->image()) 209 if (imageLoader && imageLoader->image())
210 return imageLoader->image()->imageSizeForRenderer(element->renderer( ), 1).height(); 210 return imageLoader->image()->imageSizeForRenderer(element->layoutObj ect(), 1).height();
211 } 211 }
212 212
213 element->document().updateLayout(); 213 element->document().updateLayout();
214 214
215 LayoutBox* box = element->layoutBox(); 215 LayoutBox* box = element->layoutBox();
216 return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0; 216 return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
217 } 217 }
218 218
219 unsigned ImageInputType::width() const 219 unsigned ImageInputType::width() const
220 { 220 {
221 RefPtrWillBeRawPtr<HTMLInputElement> element(this->element()); 221 RefPtrWillBeRawPtr<HTMLInputElement> element(this->element());
222 222
223 if (!element->renderer()) { 223 if (!element->layoutObject()) {
224 // Check the attribute first for an explicit pixel value. 224 // Check the attribute first for an explicit pixel value.
225 unsigned width; 225 unsigned width;
226 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(widthAttr), wi dth)) 226 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(widthAttr), wi dth))
227 return width; 227 return width;
228 228
229 // If the image is available, use its width. 229 // If the image is available, use its width.
230 HTMLImageLoader* imageLoader = element->imageLoader(); 230 HTMLImageLoader* imageLoader = element->imageLoader();
231 if (imageLoader && imageLoader->image()) 231 if (imageLoader && imageLoader->image())
232 return imageLoader->image()->imageSizeForRenderer(element->renderer( ), 1).width(); 232 return imageLoader->image()->imageSizeForRenderer(element->layoutObj ect(), 1).width();
233 } 233 }
234 234
235 element->document().updateLayout(); 235 element->document().updateLayout();
236 236
237 LayoutBox* box = element->layoutBox(); 237 LayoutBox* box = element->layoutBox();
238 return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0; 238 return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0;
239 } 239 }
240 240
241 bool ImageInputType::hasLegalLinkAttribute(const QualifiedName& name) const 241 bool ImageInputType::hasLegalLinkAttribute(const QualifiedName& name) const
242 { 242 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 PassRefPtr<LayoutStyle> ImageInputType::customStyleForRenderer(PassRefPtr<Layout Style> newStyle) 298 PassRefPtr<LayoutStyle> ImageInputType::customStyleForRenderer(PassRefPtr<Layout Style> newStyle)
299 { 299 {
300 if (!m_useFallbackContent) 300 if (!m_useFallbackContent)
301 return newStyle; 301 return newStyle;
302 302
303 return HTMLImageFallbackHelper::customStyleForAltText(element(), newStyle); 303 return HTMLImageFallbackHelper::customStyleForAltText(element(), newStyle);
304 } 304 }
305 305
306 } // namespace blink 306 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/forms/FileInputType.cpp ('k') | Source/core/html/forms/NumberInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698