font metrics of ::first-line erroneously used to calculate intrinsic width of entire element




7 years ago
5 years ago


(Reporter: eclipsechasers2, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



7 years ago
Created attachment 589707 [details]

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20111220165912

Steps to reproduce:

Browse the attached file, which shows some different colors in a table as foreground color on a black background, and background color with black foreground. In both cases, the same text is displayed twice in the table cell, one with normal weight, and once with bold (with a break tag between them). (For convenience, I have uploaded the attachment to

Actual results:

The width of the table cells is set to the width for "LightGoldenrodYellow" in normal font weight. This means that the bold line exceeds the width of the table cell, and is truncated in one case, and extends beyond the bounds of the table in another. It does this no matter how different weights are applied (e.g. I use css :first-child in the attached file, but see the same result when using explicit html <b> tags instead). If both lines are displayed in bold, the table width is set correctly.

Expected results:

The width of the cell should be set to the width for "LightGoldenrodYellow" in bold font weight (so that no data should be truncated or extend beyond the table boundary). It happens this way in Opera, Safari, Chrome, all releases IE5.5-10, and even Netscape 4.

Comment 1

7 years ago
Maybe Duplication Bug 385615

Comment 2

7 years ago
(In reply to Alice0775 White from comment #1)
> Maybe Duplication Bug 385615

Correcting a misstatement - the problem seems to happen only in conjunction with use of css first-line, not with explicit html tags. So, yes, it may well be a duplicate of the first-letter problem identified in the previous comment. Looking at that problem and its duplicates, some report "zoom in then zoom out" as a workaround for the problem, and that workaround is indeed effective in this case.
Owen, are you still seeing this problem in the current Firefox release? I'm looking at your testcase and the text doesn't look like it's going outside of the table boundaries. Thanks!
Component: Untriaged → Layout: Text
Flags: needinfo?(eclipsechasers2)
Product: Firefox → Core


5 years ago
Attachment #589707 - Attachment mime type: text/plain → text/html

Comment 4

5 years ago
I can still reproduce the problem with newly created clean profile in latest Nightly26.0a1.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 ID:20130816030205
Component: Layout: Text → Layout: Block and Inline
Ever confirmed: true
Flags: needinfo?(eclipsechasers2)
OS: Windows 7 → All
Hardware: x86_64 → All
Summary: TD Too Narrow With Normal Text on One Line and Bold on Another → font metrics of ::first-line erroneously used to calculate intrinsic width of entire element
Version: 9 Branch → Trunk
Actually, despite being older, I'm going to dupe forward since the other bug has more analysis.
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 860666

Comment 6

5 years ago
In respone to Liz Henry's message above, I tried my testcase on both Windows 7 Pro 64-bit and Ubuntu 12.04 LTS 64-bit. It still appears to render incorrectly in both environments.
You need to log in before you can comment on or make changes to this bug.