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

Side by Side Diff: Source/WebCore/html/ImageInputType.cpp

Issue 10780024: Merge 122418 - (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 { 183 {
184 RefPtr<HTMLInputElement> element = this->element(); 184 RefPtr<HTMLInputElement> element = this->element();
185 185
186 if (!element->renderer()) { 186 if (!element->renderer()) {
187 // Check the attribute first for an explicit pixel value. 187 // Check the attribute first for an explicit pixel value.
188 unsigned height; 188 unsigned height;
189 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), h eight)) 189 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), h eight))
190 return height; 190 return height;
191 191
192 // If the image is available, use its height. 192 // If the image is available, use its height.
193 if (m_imageLoader->image()) 193 if (m_imageLoader && m_imageLoader->image())
194 return m_imageLoader->image()->imageSizeForRenderer(element->rendere r(), 1).height(); 194 return m_imageLoader->image()->imageSizeForRenderer(element->rendere r(), 1).height();
195 } 195 }
196 196
197 element->document()->updateLayout(); 197 element->document()->updateLayout();
198 198
199 RenderBox* box = element->renderBox(); 199 RenderBox* box = element->renderBox();
200 return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0; 200 return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
201 } 201 }
202 202
203 unsigned ImageInputType::width() const 203 unsigned ImageInputType::width() const
204 { 204 {
205 RefPtr<HTMLInputElement> element = this->element(); 205 RefPtr<HTMLInputElement> element = this->element();
206 206
207 if (!element->renderer()) { 207 if (!element->renderer()) {
208 // Check the attribute first for an explicit pixel value. 208 // Check the attribute first for an explicit pixel value.
209 unsigned width; 209 unsigned width;
210 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(widthAttr), wi dth)) 210 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(widthAttr), wi dth))
211 return width; 211 return width;
212 212
213 // If the image is available, use its width. 213 // If the image is available, use its width.
214 if (m_imageLoader->image()) 214 if (m_imageLoader && m_imageLoader->image())
215 return m_imageLoader->image()->imageSizeForRenderer(element->rendere r(), 1).width(); 215 return m_imageLoader->image()->imageSizeForRenderer(element->rendere r(), 1).width();
216 } 216 }
217 217
218 element->document()->updateLayout(); 218 element->document()->updateLayout();
219 219
220 RenderBox* box = element->renderBox(); 220 RenderBox* box = element->renderBox();
221 return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0; 221 return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0;
222 } 222 }
223 223
224 } // namespace WebCore 224 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698