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

Test how line-height works on <input type=text> and friends #32684

Merged
merged 4 commits into from
Feb 10, 2022

Conversation

zcorpan
Copy link
Member

@zcorpan zcorpan commented Feb 3, 2022

@dholbert
Copy link
Contributor

dholbert commented Feb 4, 2022

I think the test expectations are wrong here, as discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1753537#c3 .

getComputedStyle returns the "resolved value", which is usually the computed value but is instead the used value in some cases, as discussed at https://drafts.csswg.org/cssom/#resolved-values . And line-height:[not normal] is one such case where it specifically returns the used value.

So: if the test is using getComputedStyle, then it should be expecting to get back the used value of line-height here; and given that the used value is specced as being clamped for these controls, then the test should be expecting that clamping to show up in the getComputedStyle returned value.

@zcorpan
Copy link
Member Author

zcorpan commented Feb 4, 2022

@dholbert thanks, you're correct. I'll fix the test.

@zcorpan zcorpan requested a review from dholbert February 4, 2022 11:16
Copy link
Contributor

@dholbert dholbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just a few suggestions (the first of which is actually a suggestion for whatwg/html@c6440d4 to make it better-match these tests).

@zcorpan
Copy link
Member Author

zcorpan commented Feb 10, 2022

@dholbert thanks, clarified the spec in whatwg/html@40c9c5e

I also changed the test names to describe the expectations.

@zcorpan zcorpan force-pushed the bocoup/input-used-line-height branch from bf6cd39 to d233771 Compare February 10, 2022 23:35
@zcorpan zcorpan force-pushed the bocoup/input-used-line-height branch from d233771 to eb82acf Compare February 10, 2022 23:43
@zcorpan zcorpan merged commit ac55bfa into master Feb 10, 2022
@zcorpan zcorpan deleted the bocoup/input-used-line-height branch February 10, 2022 23:52
@dholbert
Copy link
Contributor

dholbert commented Feb 11, 2022

@dholbert thanks, clarified the spec in whatwg/html@40c9c5e

FWIW I didn't mean to request a spec-clarification along those lines -- I don't think that spec-clarification (saying 'normal' is not supposed to be there in the used value) was strictly necessary, since line-height:normal is already explicitly defined as setting a numeric used value, here: https://www.w3.org/TR/CSS21/visudet.html#propdef-line-height :

normal
Tells user agents to set the used value to a "reasonable" value based on the font of the element. [...] We recommend a used value for 'normal' between 1.0 to 1.2. The computed value is 'normal'.

So normal is by-definition not something that should show up in the used value.

It's fine with the clarification, but if you end up doing further wordsmithing here later on and feel like removing that spec-clarification, I won't object. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants