Closed Bug 1541964 Opened 6 years ago Closed 6 months ago

Input with line-height: 1 may cut off parts of the text, unlike Blink.

Categories

(Core :: Layout: Form Controls, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1623124
Webcompat Priority P3

People

(Reporter: twisniewski, Unassigned)

References

()

Details

(Whiteboard: [webcompat])

Attachments

(1 file)

Attached file testcase.html

In the simple attached test-case, an input has its default padding and border removed, and the results are the the text's descenders do not always fit in the box (dependent on font-size/zoom level, and presumably the font itself).

It appears as though Blink makes the input tall enough to fit its text's descenders, while Firefox seems to rely on the border and/or padding to ensure that the input will be tall enough to completely show the text.

This is ultimately causing the inputs in this webcompat issue to appear cut off: https://webcompat.com/issues/28810

Flags: webcompat?

There is already a line-height hack for <input>: https://searchfox.org/mozilla-central/rev/9ee63566281365f26e7a4b06c9d4e2219e64c3e8/layout/generic/ReflowInput.cpp#2903

This was added in bug 349259. Maybe we do need to increase that limit a bit to be "at least normal"? May be worth checking what Chrome and WebKit are doing...

See Also: → 349259

This doesn't have to do with margin / border though, at least the following repros for me too on linux: data:text/html,<input style="line-height: 1; font-size: 50px">.

Summary: Input with padding and border removed may cut off parts of the text, unlike Blink. → Input with line-height: 1 may cut off parts of the text, unlike Blink.

Make the floor 1.2 and declare victory?

This is the Blink version of the hack:

https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc?l=175&rcl=9c25a970bb13a707bc4c5de5eaef6d4662a5eb90

So what they use is roughly: if (fontSize >= lineHeight) lineHeight = normal;

Which is a bit silly, since that means that in my example, with line-height: 1.05 you get an smaller line-height than with line-height: 1, which makes no sense.

Wow, and I thought that the Gecko hack was bad. That whole function is a mess.

I wonder if that just means this is a good opportunity to try to standardize something with this behavior? :)

Sure, the "what" is the hard part...

Perhaps max(resolved computed line-height, resolved 'line-height:normal')
would be acceptable to everyone?

Standardizing 'normal' might be trickier, so the above avoids that issue...
https://github.com/w3c/csswg-drafts/issues/3749

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

Priority: -- → P3
Webcompat Priority: ? → P3
Severity: normal → S3

The linked webcompat issue has been fixed. The issue in the testcase is no longer reproducible either.

mozregression range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=7c83f04c82e9ef6c1d2823a64aedd34a79a90eb9&tochange=737aba43bfa1685fa15a9b542636b959397603a8

Looks like bug 1623124 might have fixed this.

Status: NEW → RESOLVED
Closed: 6 months ago
Duplicate of bug: 1623124
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: