Closed Bug 683855 Opened 13 years ago Closed 12 years ago

Implement input.{width,height}

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: Ms2ger, Assigned: tbsaunde)

References

()

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

As discussed.
Attached patch Patch v1Splinter Review
Attachment #557486 - Flags: review?(Ms2ger)
Whiteboard: [needs review]
Attachment #557486 - Flags: review?(Ms2ger) → feedback+
Attachment #557486 - Flags: review?(Olli.Pettay)
Since .width/.height are mainly for the same use case what img has them, they should work the same way, IMO. Could you file a spec bug? (Or explain why the properties in <input type="image"> and <img> should work differently)
You are right Olli. I've been naive enough to believe the specs would mess up something that simple but indeed, IE has those two attributes reflected as numbers and having them behaving like the image element seems to make sense.
Attachment #557486 - Flags: review?(Olli.Pettay)
Whiteboard: [needs review]
The specs have changed and it should now behave like img.
Attached patch patch 2Splinter Review
Attachment #636999 - Flags: review?(bzbarsky)
Comment on attachment 636999 [details] [diff] [review] patch 2 >+nsGenericHTMLElement::GetWidthHeight(imgIRequest *aRequest) Let's call this "GetWidthHeightForImage". >+++ b/content/html/content/src/nsGenericHTMLElement.h >+ * Get width and hight, using given request if attributes are unset. s/hight/height/ and s/request/image request/ >+++ b/content/html/content/src/nsHTMLInputElement.cpp >+nsHTMLInputElement::SetHeight(PRUint32 aHeight) >+{ >+ nsAutoString value; >+ value.AppendInt(aHeight); >+ >+ return nsGenericHTMLElement::SetAttr(kNameSpaceID_None, nsGkAtoms::height, >+ value, true); Document that this is not using SetIntAttr because we have an unsigned integer? Though maybe we should just add an overload of SetIntAttr that takes PRUint32.... >+nsHTMLInputElement::GetWidth(PRUint32 *aWidth) >+return NS_OK; Fix the indent, please. >+++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl Please rev the IID and fix the indentaion here too. r=me with those nits and a better commit message. ;)
Attachment #636999 - Flags: review?(bzbarsky) → review+
Thank you for working on that Trevor! :)
Assignee: mounir → trev.saunders
(In reply to Boris Zbarsky (:bz) from comment #8) > >+++ b/content/html/content/src/nsHTMLInputElement.cpp > >+nsHTMLInputElement::SetHeight(PRUint32 aHeight) > >+{ > >+ nsAutoString value; > >+ value.AppendInt(aHeight); > >+ > >+ return nsGenericHTMLElement::SetAttr(kNameSpaceID_None, nsGkAtoms::height, > >+ value, true); > > Document that this is not using SetIntAttr because we have an unsigned > integer? > > Though maybe we should just add an overload of SetIntAttr that takes > PRUint32.... Something like SetUnsignedIntAttr(), maybe?
Seems fine to me.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: