Implement input.{width,height}

RESOLVED FIXED in mozilla16

Status

()

Core
DOM: Core & HTML
--
enhancement
RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: Ms2ger, Assigned: tbsaunde)

Tracking

({dev-doc-complete})

Trunk
mozilla16
dev-doc-complete
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
As discussed.
Created attachment 557486 [details] [diff] [review]
Patch v1
Attachment #557486 - Flags: review?(Ms2ger)
Whiteboard: [needs review]
(Reporter)

Updated

6 years ago
Attachment #557486 - Flags: review?(Ms2ger) → feedback+
Try server push:
http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=9e3d51151949
Attachment #557486 - Flags: review?(Olli.Pettay)

Comment 3

6 years ago
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)

Comment 4

6 years ago
http://www.w3.org/Bugs/Public/show_bug.cgi?id=14036
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.
(Assignee)

Comment 7

5 years ago
Created attachment 636999 [details] [diff] [review]
patch 2
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
(Reporter)

Comment 10

5 years ago
(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.
(Assignee)

Comment 12

5 years ago
landed https://hg.mozilla.org/integration/mozilla-inbound/rev/b038d3cfa0c3
https://hg.mozilla.org/mozilla-central/rev/b038d3cfa0c3
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16

Updated

5 years ago
Keywords: dev-doc-needed

Updated

5 years ago
Duplicate of this bug: 772207
Documentation updated:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
and
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/16
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.