Open Bug 1416615 Opened 8 years ago Updated 2 years ago

(Windows) Including Meiryo as font causes incorrect scrollHeight for japanese writing

Categories

(Core :: DOM: CSS Object Model, defect, P3)

56 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: diogomfranco, Unassigned)

References

Details

(Keywords: testcase)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Build ID: 20170926190823 Steps to reproduce: Block elements that have "Meiryo" as a possible font and a line-height other than "normal" seem to get an incorrect height calculation on Windows. The block's height is shorter than it should be, and thus it overflows. The scrollbar does not always show when overflow-y is auto, but it seems that in some cases with "word-break: pre-wrap" it can happen. Sample HTML, with no external stylesheets, that reproduces the issue: ``` <html> <body> <div style="font-family: Arial,Meiryo,sans-serif; font-size: 12px; line-height: 16px;"> あああ<br>あああ </div> </body> </html> ``` Actual results: The div may overflow. Even when the scrollbar is not shown with "overflow-y: scroll", the DOM element's state is inconsistent, and it has scrollHeight greater than its offsetWidth even when there are no borders or padding. From the above example with 2 lines of japanese text: > $0.scrollHeight 34 > $0.offsetHeight 32 Removing any fallbacks (setting the "font-family" to "Meiryo" only) yields 33 as the scrollHeight, with the offsetHeight still being 32. Expected results: At the very least, scrollHeight should be equal to offsetHeight (minus border, minus padding) when there is no scrollbar being shown.
Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core
Priority: -- → P3

"Noto Sans CJK JP DemiLight" is the font used by my Linux Debian 9.8 system when trying Diogo Franco's test and the following tests:

http://www.gtalbot.org/BugzillaSection/Bug1416615-Meiryo-font-incorrect-scrollHeight-font-size-40px.html

http://www.gtalbot.org/BugzillaSection/Bug1416615-Meiryo-font-incorrect-scrollHeight-font-size-50px.html

The problem (scrollHeight should be equal to offsetHeight if+when there is no vertical scrollbar generated) reported is more obvious and more present when specified font size value is close to line-height computed value.

Right now, I can not say if this is a specification violation since we are using glyphs that normally would (or should expectedly) only appear inside or with a block that uses a vertical writing mode.

Chromium 72.0.3626.122 has the same issue: scrollHeight is greater than offsetHeight and no vertical scrollbar is generated in all 3 tests.

Finally, it seems clear that, in both Firefox 60.5.1 ESR and in Chromium 72, the glyphs of last line box bleeds out and bleeds over the first line box and overlaps it partially. So, there should be no vertical scrollbar for that reason but then the reported scrollHeight value is not reliable and not trustworthy.

Keywords: testcase
Severity: normal → S3
See Also: → 1848367
See Also: → 540521
You need to log in before you can comment on or make changes to this bug.