Changeset 116389 in webkit
- Timestamp:
- May 7, 2012 8:49:57 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116388 r116389 1 2012-05-07 Dongwoo Im <dw.im@samsung.com> 2 3 width/height attributes of input element cannot be accessed by JavaScript. 4 https://bugs.webkit.org/show_bug.cgi?id=70304 5 6 Reviewed by Darin Adler. 7 8 If the type of input element is image button, width/height attributes should be supported. 9 These attributes are defined in HTML5 spec. 10 http://www.w3.org/TR/html5/the-map-element.html#attr-dim-width 11 12 * fast/forms/input-width-height-attributes-expected.txt: Added. 13 * fast/forms/input-width-height-attributes-without-renderer-expected.txt: Added. 14 * fast/forms/input-width-height-attributes-without-renderer-loaded-image-expected.txt: Added. 15 * fast/forms/input-width-height-attributes-without-renderer-loaded-image.html: Added. 16 * fast/forms/input-width-height-attributes-without-renderer-not-loaded-image-expected.txt: Added. 17 * fast/forms/input-width-height-attributes-without-renderer-not-loaded-image.html: Added. 18 * fast/forms/input-width-height-attributes-without-renderer.html: Added. 19 * fast/forms/input-width-height-attributes.html: Added. 20 * fast/forms/resources/green.jpg: Added. 21 * fast/forms/resources/image-slow.pl: Added. 22 1 23 2012-05-07 Kinuko Yasuda <kinuko@chromium.org> 2 24 -
trunk/Source/WebCore/ChangeLog
r116388 r116389 1 2012-05-07 Dongwoo Im <dw.im@samsung.com> 2 3 width/height attributes of input element cannot be accessed by JavaScript. 4 https://bugs.webkit.org/show_bug.cgi?id=70304 5 6 Reviewed by Darin Adler. 7 8 If the type of input element is image button, width/height attributes should be supported. 9 These attributes are defined in HTML5 spec. 10 http://www.w3.org/TR/html5/the-map-element.html#attr-dim-width 11 12 Tests: fast/forms/input-width-height-attributes-without-renderer-loaded-image.html 13 fast/forms/input-width-height-attributes-without-renderer-not-loaded-image.html 14 fast/forms/input-width-height-attributes-without-renderer.html 15 fast/forms/input-width-height-attributes.html 16 17 * html/HTMLInputElement.cpp: Add setter/getter functions to query/set width/height of input element. 18 (WebCore): 19 (WebCore::HTMLInputElement::height): Gets height of input element. 20 (WebCore::HTMLInputElement::width): Gets width of input element. 21 (WebCore::HTMLInputElement::setHeight): Sets height of input element. 22 (WebCore::HTMLInputElement::setWidth): Sets width of input element. 23 * html/HTMLInputElement.h: Add public prototype. 24 (HTMLInputElement): 25 * html/HTMLInputElement.idl: Add width/height attributes. 26 * html/ImageInputType.cpp: Add getter functions if the element is an image button. 27 (WebCore): 28 (WebCore::ImageInputType::height): Gets height of input element. 29 (WebCore::ImageInputType::width): Gets width of input element. 30 * html/ImageInputType.h: Add prototype. 31 (ImageInputType): 32 * html/InputType.cpp: Add getter functions. 33 (WebCore::InputType::height): Returns zero. 34 (WebCore): 35 (WebCore::InputType::width): Returns zero. 36 * html/InputType.h: Add prototype. 37 (InputType): 38 1 39 2012-05-07 Kinuko Yasuda <kinuko@chromium.org> 2 40 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r115434 r116389 8 8 * Copyright (C) 2010 Google Inc. All rights reserved. 9 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 11 * 11 12 * This library is free software; you can redistribute it and/or … … 1844 1845 buttons->removeButton(this); 1845 1846 } 1847 1848 unsigned HTMLInputElement::height() const 1849 { 1850 return m_inputType->height(); 1851 } 1852 1853 unsigned HTMLInputElement::width() const 1854 { 1855 return m_inputType->width(); 1856 } 1857 1858 void HTMLInputElement::setHeight(unsigned height) 1859 { 1860 setAttribute(heightAttr, String::number(height)); 1861 } 1862 1863 void HTMLInputElement::setWidth(unsigned width) 1864 { 1865 setAttribute(widthAttr, String::number(width)); 1866 } 1867 1846 1868 } // namespace -
trunk/Source/WebCore/html/HTMLInputElement.h
r114545 r116389 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 237 238 static const int maximumLength; 238 239 240 unsigned height() const; 241 unsigned width() const; 242 void setHeight(unsigned); 243 void setWidth(unsigned); 244 239 245 protected: 240 246 HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); -
trunk/Source/WebCore/html/HTMLInputElement.idl
r113532 r116389 2 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 37 38 attribute [Reflect] boolean formNoValidate; 38 39 attribute [Reflect] DOMString formTarget; 40 attribute unsigned long height; 39 41 attribute boolean indeterminate; 40 42 readonly attribute [Conditional=DATALIST] HTMLElement list; … … 66 68 void stepDown(in [Optional] long n) raises(DOMException); 67 69 70 attribute unsigned long width; 68 71 readonly attribute boolean willValidate; 69 72 readonly attribute ValidityState validity; -
trunk/Source/WebCore/html/ImageInputType.cpp
r112215 r116389 2 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 27 28 #include "HTMLImageLoader.h" 28 29 #include "HTMLInputElement.h" 30 #include "HTMLNames.h" 31 #include "HTMLParserIdioms.h" 29 32 #include "MouseEvent.h" 30 33 #include "RenderImage.h" … … 32 35 33 36 namespace WebCore { 37 38 using namespace HTMLNames; 34 39 35 40 inline ImageInputType::ImageInputType(HTMLInputElement* element) … … 175 180 } 176 181 182 unsigned ImageInputType::height() const 183 { 184 RefPtr<HTMLInputElement> element = this->element(); 185 186 if (!element->renderer()) { 187 // Check the attribute first for an explicit pixel value. 188 unsigned height; 189 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), height)) 190 return height; 191 192 // If the image is available, use its height. 193 if (m_imageLoader->image()) 194 return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height(); 195 } 196 197 element->document()->updateLayout(); 198 199 RenderBox* box = element->renderBox(); 200 return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0; 201 } 202 203 unsigned ImageInputType::width() const 204 { 205 RefPtr<HTMLInputElement> element = this->element(); 206 207 if (!element->renderer()) { 208 // Check the attribute first for an explicit pixel value. 209 unsigned width; 210 if (parseHTMLNonNegativeInteger(element->fastGetAttribute(widthAttr), width)) 211 return width; 212 213 // If the image is available, use its width. 214 if (m_imageLoader->image()) 215 return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width(); 216 } 217 218 element->document()->updateLayout(); 219 220 RenderBox* box = element->renderBox(); 221 return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0; 222 } 223 177 224 } // namespace WebCore -
trunk/Source/WebCore/html/ImageInputType.h
r103400 r116389 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 62 63 virtual bool isEnumeratable() OVERRIDE; 63 64 virtual bool shouldRespectHeightAndWidthAttributes() OVERRIDE; 65 virtual unsigned height() const OVERRIDE; 66 virtual unsigned width() const OVERRIDE; 64 67 65 68 OwnPtr<HTMLImageLoader> m_imageLoader; -
trunk/Source/WebCore/html/InputType.cpp
r116277 r116389 7 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 8 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 9 10 * 10 11 * This library is free software; you can redistribute it and/or … … 43 44 #include "HTMLFormElement.h" 44 45 #include "HTMLInputElement.h" 46 #include "HTMLNames.h" 47 #include "HTMLParserIdioms.h" 45 48 #include "HTMLShadowElement.h" 46 49 #include "HiddenInputType.h" … … 773 776 } 774 777 778 unsigned InputType::height() const 779 { 780 return 0; 781 } 782 783 unsigned InputType::width() const 784 { 785 return 0; 786 } 787 775 788 namespace InputTypeNames { 776 789 -
trunk/Source/WebCore/html/InputType.h
r115704 r116389 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 276 277 virtual bool supportsIndeterminateAppearance() const; 277 278 279 // Gets width and height of the input element if the type of the 280 // element is image. It returns 0 if the element is not image type. 281 virtual unsigned height() const; 282 virtual unsigned width() const; 283 278 284 protected: 279 285 InputType(HTMLInputElement* element) : m_element(element) { }
Note: See TracChangeset
for help on using the changeset viewer.