Select element text is cut off if letter-spacing / word-spacing are used
Categories
(Core :: Layout: Form Controls, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | wontfix |
firefox-esr115 | --- | fix-optional |
firefox117 | --- | wontfix |
firefox118 | --- | fix-optional |
firefox119 | --- | fix-optional |
People
(Reporter: annaphillipsnz, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0
Steps to reproduce:
Added CSS 2px of letter-spacing to a <select> element.
I found this question on Stack Overflow which has a demo of the issue:
https://stackoverflow.com/questions/75411603/why-firefox-doesnt-resize-correctly-the-select-tag-with-custom-letter-spacin
Actual results:
Text is cut off on the right.
Expected results:
Select element is extended to the width of the text so text is not cut off.
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•1 year ago
•
|
||
Regression window(Although large zoom levels can break even the good build):
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=a5d7c6af687c94da40bca876b39d9cb962a9f4bb&tochange=518851d83f889a127fa56716a6f75a1e21d9adef
Suspect:
bd4c36e21201ebfeb8981030330c04d8fb77cc0d Emilio Cobos Álvarez — Bug 1762873 - Don't incorrectly add scrollbar size to select intrinsic size. r=jfkthame
Comment 3•1 year ago
|
||
:emilio, since you are the author of the regressor, bug 1762873, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Comment 4•1 year ago
|
||
Comment 5•1 year ago
|
||
The real regressor here is bug 1744009.
The main issue is that this code doesn't account for letter/word-spacing.
We could most definitely pass down that information all the way through nsFontMetrics::GetWidth
, which uses a StubPropertyProvider
here where we could enable spacing.
Jonathan, is that the best path forward? I see the Canvas2d provider already has some support for letter / word-spacing. Do you have a better idea to avoid duplicating that code?
Comment 6•1 year ago
|
||
Emilio, sorry, my wrong regressor alarm.
Comment 7•1 year ago
|
||
Set release status flags based on info from the regressing bug 1744009
Comment 8•1 year ago
|
||
(In reply to Alice0775 White from comment #6)
Emilio, sorry, my wrong regressor alarm.
No worries at all! Same author anyways :P
It seemed like that on Windows because on the original test-case the extra width is ~the space that letter-spacing should add :)
Comment 9•1 year ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
The real regressor here is bug 1744009.
The main issue is that this code doesn't account for letter/word-spacing.
We could most definitely pass down that information all the way through
nsFontMetrics::GetWidth
, which uses aStubPropertyProvider
here where we could enable spacing.Jonathan, is that the best path forward? I see the Canvas2d provider already has some support for letter / word-spacing. Do you have a better idea to avoid duplicating that code?
I guess that'd probably be the most straightforward, though it's a bit sad to duplicate more and more of the functionality between HTML reflow (nsTextFrame), canvas2d text, and now the nsFontMetrics utilities. (If we add spacing support to GetWidth, we should add it to DrawString as well for consistency.)
In theory, it seems like a cleaner method would be to create an nsTextFrame for the option, with the appropriate style, and query its intrinsic width, but that might be a significantly more heavyweight approach; if there are lots of options, that'd mean an awful lot of temporary frame-munging just to measure the longest one.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 10•1 year ago
|
||
Is there any workaround? I'm also affected by this bug.
Description
•