Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<input> with no specified value or size has incorrect width #8773

Closed
frewsxcv opened this issue Dec 2, 2015 · 8 comments
Closed

<input> with no specified value or size has incorrect width #8773

frewsxcv opened this issue Dec 2, 2015 · 8 comments

Comments

@frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Dec 2, 2015

$ cat /tmp/hi.html
<input>

Chrome (and Firefox):

screen shot 2015-12-01 at 8 07 30 pm

Servo:

screen shot 2015-12-01 at 8 07 36 pm

Relevant section of spec

@frewsxcv frewsxcv added the I-wrong label Dec 2, 2015
@frewsxcv
Copy link
Member Author

@frewsxcv frewsxcv commented Dec 2, 2015

On a similar note:

$ cat /tmp/hi.html
<input size=50>

Chrome (and Firefox):

screen shot 2015-12-01 at 8 14 18 pm

Servo:

screen shot 2015-12-01 at 8 14 01 pm

@frewsxcv
Copy link
Member Author

@frewsxcv frewsxcv commented Dec 2, 2015

Possibly related to #4378

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Dec 30, 2015

The size attribute does have an effect in:

<input type=text size=50>

So I’m guessing that where we’re implementing this (emphasis added):

https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-text-entry-widget:the-input-element

If an input element whose type attribute is in one of the above states has a size attribute, and parsing that attribute's value using the rules for parsing non-negative integers doesn't generate an error, then the user agent is expected to use the attribute as a presentational hint for the 'width' property on the element, with the value obtained from applying the converting a character width to pixels algorithm to the value of the attribute.

… we’re not accounting for the default state of the type attribute:

https://html.spec.whatwg.org/multipage/forms.html#attr-input-type

The missing value default is the Text state.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Dec 30, 2015

Relevant code is synthesize_presentational_hints_for_legacy_attributes in components/script/dom/element.rs

@TheKK
Copy link
Contributor

@TheKK TheKK commented Dec 30, 2015

Hi!
This issue looks like a nice place for me to start, can I take this one?

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Dec 30, 2015

It's yours! Look for "nonsense" in components/script/dom/element.rs.

@Ms2ger Ms2ger added the C-assigned label Dec 30, 2015
@TheKK
Copy link
Contributor

@TheKK TheKK commented Jan 1, 2016

Hi, here my modification. I compare the rendering result with Firefox and has no difference. Could you help me checking the commit, thanks.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jan 1, 2016

Hi @TheKK. Thanks for your contribution! Please open a pull request so that we can use the usual tooling for code review.

TheKK added a commit to TheKK/servo that referenced this issue Jan 4, 2016
TheKK added a commit to TheKK/servo that referenced this issue Jan 4, 2016
TheKK added a commit to TheKK/servo that referenced this issue Jan 5, 2016
TheKK added a commit to TheKK/servo that referenced this issue Jan 6, 2016
bors-servo added a commit that referenced this issue Jan 6, 2016
Parse size attribute of HTMLInputElemnt correctly

Should fix #8773

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9119)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.