Closed Bug 15428 Opened 26 years ago Closed 26 years ago

[TEXT] line-height values less than 1 are wrong {ll}

Categories

(Core :: Layout, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: emk, Assigned: dbaron)

References

()

Details

(Keywords: css1, testcase, Whiteboard: [TESTCASE])

Attachments

(2 files)

To reproduce: 1. Launch apprunner. 2. Nevigate to http://member.nifty.ne.jp/emk/moz/line-height.html Expected result: The lines overlap each other as if only one line exists. IE5 and Nav4 works as expected. Actual result: The lines do not overlap completely. I'm using [1999100118] build on Windows NT 4.0 (SP5)
Assignee: troy → kipp
Severity: normal → trivial
Status: NEW → ASSIGNED
Target Milestone: M17
One could argue that this shouldn't work. See bug 4234 and bug 13072.
I read bug 4234 and bug 13072, but I couldn't understand why this shouldn't work.
Interesting bug. According to the css2 spec (and numerous email discussions), text isn't an element and therefore it doesn't contribute to line-height calculations. Therefore, we should be able to end up with a zero height line given that there are no elements provided in the line that have a height and therefore the blocks line-height (== minimum line-height) is coming into play. Yes?
The problem is that line-height is based on the computed font-size, which is *almost never* the actual font size because of messed up fonts. The way you do things, which is arguably correct (since it makes line-height: 1 work correctly), is to get the half-leading from (font-size - line-height) [computed] and then put the half-leading around the edges of each inline box. In order to fix this, you'd have to disobey the probably-incorrect wording of the spec and base the actual value of the line-height (when a scaling-factor, anyway) on the actual value of the font-size, and then use both actual values for the leading computations. Then comes the question: do you do the same for the 'em'? (Or you could look at the whole thing as what you're currently doing is using actual font-size and computed line-height and ignore the half-leading bit, or something like that...) I've raised the issue of how bad OS font-sizes should be accomodated on www-style, but nobody seemed receptive to making any official statement. And I don't know if the actual/computed issues on line-height are going to be clarified anytime soon either. line-height: 0 should work with the "Ahem" font. :-) The usual references: http://www.fas.harvard.edu/~dbaron/css/fonts/sizes/ http://www.fas.harvard.edu/~dbaron/css/fonts/explanation http://www.fas.harvard.edu/~dbaron/css/fonts/aspect_results http://lists.w3.org/Archives/Public/www-style/1999May/0026.html http://lists.w3.org/Archives/Public/www-style/1999May/0036.html
I'm currently computing the line-height value based on the actual font-size as opposed to the value defined by the style system. EM units, on the other hand, recieve no special treatment and are therefore inconsistent :-(
*** Bug 15933 has been marked as a duplicate of this bug. ***
QA Contact: petersen → chrisd
Summary: Element assigned "line-height: 0" is not drawn correctly → {ll} Element assigned "line-height: 0" is not drawn correctly
Target Milestone: M17 → M13
Summary: {ll} Element assigned "line-height: 0" is not drawn correctly → {ll} {css1} Element assigned "line-height: 0" is not drawn correctly
Whiteboard: [TESTCASE]
We seem to be doing strange things indeed for line-height: 0. In fact we are doing weird things for all line-height values less than 1. Sections 5 and 6 of the Evil Tests "lineheight3" contain many thorough, complex test cases which should probably be distilled and turned into small tests. http://www.bath.ac.uk/%7Epy8ieh/internet/eviltests/lineheight3.html These tests use the Ahem font. [David: you may want to verify my mathematics...]
Positive lfHeight version also causes this bug. Probably this bug is not related with actual vs. computed height since both actual and computed height are the same on positive lfHeight version.
Here is the problem: 1. When nsLineLayout::VerticalAlignFrames is handling the root span, the initial values for the minY and maxY are zero so that only the child frames will impact their values. But this is not enough to avoid impact since yBottom for the child frames may become a negative value when line-height is shorter than font-size. 2. The BR frames lie on the baseline since BRFrame::Reflow set the aMetrics.ascent for them. But other frames assigned 'line-height:0' will be above the baseline, so the distance between the uppermost box top and the lowermost box bottom will not be zero.
Updating to default Layout Assignee...kipp no longer with us :-(
Why are you re-reassing layout bugs? Do NOT touch layout bugs. The bugs are assigned to Kipp so they can stay neatly organized until we have a new owner for the block/inline code.
VYV03354: Very nice work on finding the cause! :-) So... what would the solution be?
mass moving all Kipp's pre-beta bugs to M15. Nisheeth and I will prioritize these and selectively move high-priority bugs into M13 and M14.
Summary: {ll} {css1} Element assigned "line-height: 0" is not drawn correctly → {ll} {css1} [TEXT] Element assigned "line-height: 0" is not drawn correctly
Keywords: css1
Migrating from {css1} to css1 keyword. The {css1}, {css2}, {css3} and {css-moz} radars should now be considered deprecated in favour of keywords. I am *really* sorry about the spam...
Severity: trivial → normal
Summary: {ll} {css1} [TEXT] Element assigned "line-height: 0" is not drawn correctly → [TEXT] line-height values less than 1 are wrong {ll}
Bulk moving [testcase] code to new testcase keyword. Sorry for the spam!
Keywords: testcase
I have the fix for most of this bug in my tree, although it still doesn't work for lines terminated by BR. BR needs to be fixed.
I think what's left is that BR frames need to be made so that they set their size and position based on line-height and font metrics (rather than set their position to height 0 on the baseline, which can cause expansion of narrow lines). I think it is best to make it so BR frames are ignored in compat mode (which will be more important after the above fix), but this will still matter in strict mode. I am working on the ignoring code now...
In the above testcases, the first test tests a line-height of 0 (with and without BR) and the second tests BR with a line-height of 3.
OK... I've got this one fixed too (I made the BR element obey line-height). Assigning to myself.
Assignee: kipp → dbaron
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Target Milestone: M15 → M14
Fix checked in 2000-02-14 20:26PDT.
David: Wow. All relevant tests passed with Viewer in 2000021509 build. VERIFIED FIXED on Win32.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: