Bug 236108 - line-height: 1px on <input type=search> is not reflected in getComputedStyle()
Summary: line-height: 1px on <input type=search> is not reflected in getComputedStyle()
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-03 15:40 PST by Simon Pieters (:zcorpan)
Modified: 2023-05-25 21:49 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters (:zcorpan) 2022-02-03 15:40:45 PST
What steps will reproduce the problem?
(1) Apply a 'line-height' that is smaller than 'normal' on <input type=search>
(2) Call getComputedStyle(input).lineHeight
(3)

What is the expected result?
1px

What happens instead?
assert_equals: expected "1px" but got "normal"

There's some magic for text entry widgets to change the used value of 'line-height' to 'normal' if it was smaller than 'normal', but the computed value should not be affected by this. Only used value.

This doesn't happen with the type=text, type=url, type=email, type=password.

Spec change: https://github.com/whatwg/html/pull/5462
Test: https://github.com/web-platform-tests/wpt/pull/32684

(Maybe related: https://bugs.webkit.org/show_bug.cgi?id=203751 )
Comment 1 Simon Pieters (:zcorpan) 2022-02-04 00:47:25 PST
dholbert pointed out that the test was incorrect, since getComputedStyle returns the resolved value, which for line-height will be the used value. So the used value should be something like 16px (depending on font metrics). I've now fixed the test.

I also tested computedStyleMap() although it seems it is not yet supported in WebKit. (https://bugs.webkit.org/show_bug.cgi?id=175733)

This bug thus applies to all text entry widgets, although <input type=search> is different from the others and returns 'normal'.
Comment 2 Radar WebKit Bug Importer 2022-02-04 16:15:31 PST
<rdar://problem/88513265>