In order to implement CSS initial-letter property's sink value (on :first-letter only), we might want the initial letter has its own line. So we can ensure that the baseline of the initial letter would not affect the baseline of its continuation. A floating :first-letter already has it's own LineLayout ; however, a non-floating :first-letter does not. According to the discussion in Bug 1310106, it is preferred that forcing the :first-letter with initial-letter property to go through the non-floating code (no matter it will be explicitly specified in the spec.  or just our internally implementation). Therefore, we should support separating a non-floating :first-letter to its own line. Not sure if we shall use an separated LineLayout or just an separated LineBox. Any suggestion/feedback is welcomed!  http://searchfox.org/mozilla-central/rev/efcb1644e49c36445e75d89b434fdf4c84832c84/layout/generic/nsFirstLetterFrame.cpp#194-197  https://github.com/w3c/csswg-drafts/issues/688
Summary: Let :first-letter with initial-letter property has its own line → Let :first-letter with initial-letter property have its own line
I think having a separate line box indicates it needs to have a separate line layout, since one line layout only works on one line box. Actually I wonder whether initial letter really needs a line box. Line box acts as a container of a run of frames in the same line. However, initial letter seems to have only one frame, so having an extra line box for it seems unnecessary. Probably just having a line layout without line box would be enough. I guess initial letter can probably have its reflow code invoked somewhere in nsBlockFrame::ReflowDirtyLines before normal lines are reflowed. And then in nsBlockFrame::DoReflowInlineFrames, adjust istart and available isize of lines whose bstart is within initial letter's range.
Thanks to Xidorn for filing https://github.com/w3c/csswg-drafts/issues/743 for discussing about the implementation design. While waiting for the further discussion in the meantime, I'll study the out-of-flow case first. Here, the "out-of-flow" is from initial-letter's containing block's point of view, not saying it's floating. Please see the issue above for more detail. Per discussion with Xidorn offline, I'd like to implement the out-of-flow case as follows: 1. While creating a first letter frame, if this is an initial-letter, move it to an separated FrameList. So, the initial-letter would be treated like an out-of-flow frame from the aspect of its containing block. 2. In nsBlockFrame, try to reflow this initial-letter right before reflowing the first line.
The spec. discussion is leaning against to "in flow" design. Might be better to take a pause here.
(In reply to Jeremy Chen [:jeremychen] UTC+8 from comment #3) > The spec. discussion is leaning against to "in flow" design. Might be better > to take a pause here. Where?
(In reply to David Baron :dbaron: ⌚️UTC-8 from comment #4) > (In reply to Jeremy Chen [:jeremychen] UTC+8 from comment #3) > > The spec. discussion is leaning against to "in flow" design. Might be better > > to take a pause here. > > Where? The reason I said so is majorly based on: 1. your reply on the spec. issue (https://github.com/w3c/csswg-drafts/issues/743). 2. offline feedback from xidorn since there's not much feedback from other people so far...
(In reply to Jeremy Chen [:jeremychen] UTC+8 from comment #5) > (In reply to David Baron :dbaron: ⌚️UTC-8 from comment #4) > > (In reply to Jeremy Chen [:jeremychen] UTC+8 from comment #3) > > > The spec. discussion is leaning against to "in flow" design. Might be better > > > to take a pause here. > > > > Where? > > The reason I said so is majorly based on: > 1. your reply on the spec. issue > (https://github.com/w3c/csswg-drafts/issues/743). > 2. offline feedback from xidorn > > since there's not much feedback from other people so far... That said, it might be better to take a pause before we can clear the implementation design issue.
CSSWG resolved (on 2017-01-11) to have initial letter boxes be in-flow https://log.csswg.org/irc.w3.org/css/2017-01-11/#e758211
Unassigning myself from the bug as I don't quite have time working on this at the moment... Anyone interested can pick it up.
Assignee: jeremychen → nobody
Status: ASSIGNED → NEW
Moving to p3 because no activity for at least 1 year(s). See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.