Open Bug 362880 Opened 18 years ago Updated 1 year ago

[reflow branch] intrinsic widths computed incorrectly for ::first-letter

Categories

(Core :: Layout: Block and Inline, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Whiteboard: [first letter])

Attachments

(1 file)

nsFirstLetterFrame needs to implement AddInlineMinWidth, AddInlinePrefWidth, GetMinWidth, and GetPrefWidth.
Attached file testcase
The first and third tables should intrinsically size around the pref widh; the second and fourth around the min width.
Whiteboard: [first letter]
So I did the implementations.  It turns out that making this really work requires splitting the first-letter at frame-construction time rather than at reflow.  This probably means:

 * making nsCSSFrameConstructor::CreateLetterFrame and nsCSSFrameConstructor::CreateFloatingLetterFrame actually do the split, and create the continuation with aIsFluid==PR_FALSE

 * removing the code that does the splits from nsTextFrame

 * moving the style context munging from nsFirstLetterFrame::Init to nsCSSFrameConstructor::CreateLetterFrame (if we even want the continuation letter frame at all!)

 * removing the first-letter-related code from nsLineLayout.

I propose doing this as a separate patch after the reflow branch lands.
Summary: [reflow branch] nsFirstLetterFrame: implement all 4 intrinsic width functions → [reflow branch] intrinsic widths computed incorrectly for ::first-letter
Another test case, demonstrating how this bug has affected one of my websites in the wild:
http://codepen.io/dampkwab/pen/rOZPwa

This has been a long-standing and it doesn't look like it's received much attention.
It sounds like a fix would require a lot of familiarity with the codebase but is there anything an external contributor could to to help speed up the process?
I understand that it is a longstanding issue requiering fundamental core changes but can we hope a fix?

Another test case for this: https://test.chrislewis.codes/initial-letter/simple.html

I'm trying to fit text into a given space, and the mis-calculation of ::first-letter box width makes the text measurements very inaccurate.

I opened a PR on WPT with a reftest for this bug: https://github.com/web-platform-tests/wpt/pull/18882

See Also: → 1603179
Assignee: dbaron → nobody
Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 10 duplicates.
:jfkthame, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jfkthame)

The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.

Flags: needinfo?(jfkthame)
Duplicate of this bug: 1819401
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: