Re: [csswg-drafts] [css-inline] fill out initial-letter/float interaction section

The Working Group just discussed `Interaction with Floats`, and agreed to the following:

* `RESOLVED: clear doesn't apply to initial letters`
* `RESOLVED: Initial letters must not overlap floats (just like lineboxes don't).`
* `RESOLVED: If a linebox moves down or is shortened due to a float, initial letter moves with it, and vice versa.`
* `RESOLVED: An inline-start float originating on first line can go between initial letter and containing block edge. (It can't split the initial letter and the subsequent text.)`
* `RESOLVED: An inline-start float origining on subsequent impacted lines must clear the initial letter.`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: Interaction with Floats<br>
&lt;tantek> no one does this yet right?<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/689<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/360<br>
&lt;TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/360<br>
&lt;TabAtkins> fantasai: Based on minutes we made a bunch of changes to the spec.<br>
&lt;TabAtkins> fantasai: Specific things were:<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/360#issuecomment-392128995<br>
&lt;TabAtkins> fantasai: clear doesn't apply to initial-letters, or clear them. (It's only for floats.)<br>
&lt;TabAtkins> fantasai: initial-letters don't overlap floats.<br>
&lt;TabAtkins> fantasai: If line box is moved or shortened, initial-letter moves with it.<br>
&lt;TabAtkins>  fantasai: inline-start floats [something else, it's all in the issue]<br>
&lt;TabAtkins> fantasai: Ther'es a bunch of illustrations in the issue.<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/360#issuecomment-270734813<br>
&lt;TabAtkins> astearns: For last one, if you consider initial-letter as part of the first line, it falls out of the float behavior.<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/360#issuecomment-270760193<br>
&lt;TabAtkins> fantasai: For floats on first line, going with first illustration; for floats on subsequent lines, going with last.<br>
&lt;TabAtkins> dauwhe: The middle blue example is something we really want to avoid, so that's what we worked out the rules for.<br>
&lt;dbaron> proposal is the first example in the blue examples, and the last example in the green examples, right?<br>
&lt;TabAtkins> yes, dbaron<br>
&lt;TabAtkins> Rossen: What happens if there was a second left flaot that comes between "discontent" and "made"<br>
&lt;TabAtkins> fantasai: Depends on if it's on first or second line. Then just follow the rules.<br>
&lt;TabAtkins> fantasai: The floats will stack...<br>
&lt;TabAtkins> [rossen draws picture]<br>
&lt;fantasai> s/The floats/If on the second line, then the floats/<br>
&lt;fantasai> s/.../ because the float is taller than the initial letter. It clears the initial letter, but doesn't clear the float./<br>
&lt;TabAtkins> astearns: That flaot in that example - the top edge of the flaot can't be positioned above the bottom edge of the line box of preceding content, which includes the initial letter.<br>
&lt;TabAtkins> fantasai: No reason to clear it for right floats...<br>
&lt;TabAtkins> [multiple people] Oh no, that's bad.<br>
&lt;TabAtkins> iank_: You need to do it for both.<br>
&lt;TabAtkins> dbaron: You get into fun issues if you start getting right floats that actually fill most of the block<br>
&lt;TabAtkins> dbaron: You can then have a right float that bumps into the first letter.<br>
&lt;TabAtkins> fantasai: Then it wouldn't fit<br>
&lt;TabAtkins> dbaron: To say that, you have to rewrite a bunch of text to *say* it won't fit, because text is currently about line boxes, and per that, there's nothing there right now (initial letter isn' tin the line box)<br>
&lt;TabAtkins> Rossen: Positioning a large right float is the same as positioning a normal left float.<br>
&lt;TabAtkins> tantek: 2.1 algo assumes rectangel line boxes.<br>
&lt;TabAtkins> tantek: for fitting floats<br>
&lt;TabAtkins> tantek: A lot of it's reasoning is simplified as a result.<br>
&lt;TabAtkins> tantek: If you assume non-rectangular, you'll have to rethink those steps. Might be desirable, but we can't assume it'll "Just Work".<br>
&lt;TabAtkins> fantasai: line boxes stack with zero distance between them; if this was about line box getting taller, second line would have to clear the initial letter too, so that's false.<br>
&lt;tantek> yeah, I'm gonna need you to define non-rectangular line boxes<br>
&lt;TabAtkins> astearns: So we'd need to redefine some of the float behavior to say that, in the left-float case you set it as far left as you can without going above the line content (includes the initial letter), but for right float it can't go above the bottom of the actual line box.<br>
&lt;TabAtkins> astearns: If the float geometry doesn't intrude into the first-letter geometry.<br>
&lt;TabAtkins> dbaron: Elika said in Seattle we had said we wanted the right floats to still be able to have their top at one of th eintermediate lines.<br>
&lt;TabAtkins> dbaron: Som eof th ecomplexity is around that.<br>
&lt;TabAtkins> dbaron: I think there's an arg against that.<br>
&lt;TabAtkins> dbaron: If you ahve right and left floats, you still need to have the rule that a float's top can't be above the top of a previous floats.<br>
&lt;TabAtkins> dbaron: So sometimes if you have a left float, a right float will get pushed down anyway below the initial letter.<br>
&lt;TabAtkins> dbaron: So you're creating an inconsistent state where right floats are *sometimes* (indirectly) affected by the initial letter, so why not all the time?<br>
&lt;TabAtkins> tantek: Seems to be making the simple case bad so complex case works better.<br>
&lt;TabAtkins> dbaron: I think it's good both ways.<br>
&lt;TabAtkins> tantek: We need to decide what we want lineboxes to look like.<br>
&lt;TabAtkins> tantek: It sounds like people's expectations are (besides david) ?????<br>
&lt;TabAtkins> [trailed off]<br>
&lt;fantasai> Tantek draws two diagrams of line boxes, where the left side has a nonrectangular outline around the initial letter and its line box, with the second line tucked inside that L an subsequent lines<br>
&lt;TabAtkins> tantek: Start with a consistent linebox model, and figure out what consistent behaviors you get.<br>
&lt;TabAtkins> myles: If you use non-rectangular thing dont' call it a box...<br>
&lt;fantasai> Then another diagram where the first line box is rectangular, and the second line is inside it<br>
&lt;fantasai> tucked in the botom right corner<br>
&lt;TabAtkins> [mumbly discussion around the whiteboard]<br>
&lt;TabAtkins> dbaron: We have three diagrams here.<br>
&lt;TabAtkins> dbaron: A two-line dropcap.<br>
&lt;fantasai> dbaron draws another diagram where the first line box is rectangular, but only single-height high<br>
&lt;TabAtkins> dbaron: In all three, the second linebox is shorter as a result, third and fourth are full-length.<br>
&lt;fantasai> the second line box is shortened, so there's a gap on the left<br>
&lt;TabAtkins> dbaron: Question is first linebox.<br>
&lt;TabAtkins> dbaron: IN first, linebox is rectangle enclosing both lines.<br>
&lt;TabAtkins> dbaron: In second, linebox is sideways L enclosing drop-cap and first line text.<br>
&lt;TabAtkins> dbaron: In third, linebox is rectangle enclosing the entirety of first-line (only top half of drop cap)<br>
&lt;Rossen> https://lists.w3.org/Archives/Public/www-archive/2018Jul/0000.html<br>
&lt;TabAtkins> fantasai: I think we should use third.<br>
&lt;TabAtkins> tantek: That doesn't give you floating behavior rossen wants.<br>
&lt;TabAtkins> fantasai: We can define some behaviors for the initial letter, like it shortens the second linebox, or that floats can't hit it and must clear.<br>
&lt;TabAtkins> Rossen: Problem is that you want initial-letter to act like a float sometimes and not others, and that's weird.<br>
&lt;TabAtkins> tantek: Worse is that you sometimes want it to cause floats to clear after, and sometimes dont'<br>
&lt;dauwhe> q+<br>
&lt;TabAtkins> iank_: emil and I were discussing some tricky cases<br>
&lt;TabAtkins> iank_: A lot can be simplified if you treat the A as some special type of float, and also apply top-edge alignment rules, gets much simpler.<br>
&lt;TabAtkins> iank_: Apply top-edge alignment rule to initial letter, and additional rule that all subsequent floats will clear that initial letter.<br>
&lt;TabAtkins> iank_: (the rule that floats can't go higher the preceding floats)<br>
&lt;TabAtkins> iank_: [draws something on the whiteboard]<br>
&lt;TabAtkins> iank_: If you apply the additional constraint that the initial letter is always treated as a float, and has the top-edge alignment rule, it gets pushed down.<br>
&lt;TabAtkins> dbaron: I dont' think we want that blank space that'll result...<br>
&lt;TabAtkins> dbaron: You need to assert that there's enough room for the initial letter, but shouldn't need to assert that it's past all floats.<br>
&lt;dauwhe> q?<br>
&lt;TabAtkins> iank_: That's makes things very hard for us<br>
&lt;fantasai> iank drew a small right float followed by a large right float. Then tried to place initial-letter'ed line next to the floats.<br>
&lt;TabAtkins> Rossen: One thing to make impls easy...<br>
&lt;TabAtkins> Rossen: Three models for line box.<br>
&lt;TabAtkins> Rossen: If we go with the box that always includes the initial letter as part of its bounds (#1), then that's straightforward for impls.<br>
&lt;fantasai> iank asserted that since the initial-letter follows top edge alignment rule, it has to move down to at least the top edge of the second float<br>
&lt;fantasai> dbaron said we don't want to do that<br>
&lt;TabAtkins> Rossen: You have a line which is tall enough, it'll get cleared by either float.<br>
&lt;fantasai> that we don't want that extra space<br>
&lt;TabAtkins> Rossen: the one contentious case is that if we have a right float on second line, it could have fit, but it'll get pushed down to clear the initial-letter instead.<br>
&lt;TabAtkins> Rossen: But that's consistent with itself and with our current model, it's the 2.1 float algo.<br>
&lt;TabAtkins> Rossen: Only different is that there's a linebox that extends past its initial line of content.<br>
&lt;dauwhe> q?<br>
&lt;TabAtkins> dauwhe: The existing impl of this treats initial -letter as floats, and this gives a lot of bad behavior. If we can minimize bad behavior that's great, but these can't just be pure floats.<br>
&lt;TabAtkins> dbaron: Rossen convinced me that 1 is better model.<br>
&lt;TabAtkins> fantasai: That'll make weird alignment<br>
&lt;TabAtkins> dbaron: Going with model 1 - this is linebox for float rules - requires fewer edits to float rules, and produces pretty sensible results.<br>
&lt;TabAtkins> florian: Not the height of the linebox for *other* purposes, jsut for floats.<br>
&lt;TabAtkins> tantek: I see appeal, but it makes the feature potentially worse than using floats to fake first letter.<br>
&lt;TabAtkins> tantek: That would let right-floating items be fully up, not pushed down.<br>
&lt;TabAtkins> tantek: So subsequent left flaots would go beneath first letter, subsequent right floats wouldn't need to.<br>
&lt;TabAtkins> florian: Other things break when you do it like that tho.<br>
&lt;TabAtkins> fantasai: An issue I didn't want to get into was what dbaron raised - what's the linebox model for initial letters?d<br>
&lt;dauwhe> the drawing (for the minutes): https://lists.w3.org/Archives/Public/www-archive/2018Jul/att-0000/IMG_2701.JPG<br>
&lt;TabAtkins> fantasai: You need a linebox for the letter, it has styling and content.<br>
&lt;TabAtkins> fantasai: Need a linebox for it, for alignment.<br>
&lt;TabAtkins> fantasai: So I think we need two *overlapping* lineboxes. You can say they're same width (model 1), but we don't need to.<br>
&lt;TabAtkins> tantek: That works.<br>
&lt;TabAtkins> Rossen: So in that model, if you have a left float that would fit, why would it move down<br>
&lt;TabAtkins> fantasai: Rule is that you can't have linebox between float and the containing block, so it can't sit there next to the initial letter.<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/360#issuecomment-270760193<br>
&lt;TabAtkins> fantasai: What you're looking at there is Dave's green examples, you just used a tiny float to make it look more confusing.<br>
&lt;TabAtkins> fantasai: So either we go with the first green image, and if you happen to make your float small enough it'll tuck under there, or we dont'.<br>
&lt;TabAtkins> fantasai: But I thought we discussed and agreed with taking the third green rendering.<br>
&lt;tantek> blue 1, green 3<br>
&lt;TabAtkins> iank_: The way we'd implement this is to treat the letter A as an exclusion, and then we have optimizations that assume you don't put an exlucsion above another one; this breaks that case.<br>
&lt;TabAtkins> iank_: Then you have to work out the layout areas...<br>
&lt;TabAtkins> iank_: You're asserting that the initial letter will go higher than other floats.<br>
&lt;TabAtkins> dbaron: I'd implement this not using the float mechanism.<br>
&lt;TabAtkins> Rossen: Another example case.<br>
&lt;fantasai> fantasai: which float is going higher than the initial latter, iank_ ?<br>
&lt;TabAtkins> Rossen: Take initial letter. Then a float-left and float-right at end of first line.<br>
&lt;TabAtkins> Rossen: So first float-left doesn't fit on the first line, so it goes below the initial letter.<br>
&lt;TabAtkins> Rossen: Then the float-right can't go above the float-left, so it gets pushed down as well.<br>
&lt;TabAtkins> Rossen: But if we reverse the order, then it would be okay for the float-right to be up in the corner? And you think that's not confusing?<br>
&lt;TabAtkins> fantasai: So imagine the first letter is a float with clear:left. This would clear the left float, then force the right float to go lower. If you reversed them the right float woudln't be pushed down. What's the difference?<br>
&lt;fantasai> fantasai: All we're saying here is that you cannot stack a float against the initial letter, you have to clear it.<br>
&lt;TabAtkins> Rossen: So the complexity in our impl comes from the current model assuming you have the bottom of your content, which is assumed to be a position in the block direction; none of this is allowed to b eintruded by floats.<br>
&lt;TabAtkins> Rossen: The rest is just geometry on both sides, it's not interesting.<br>
&lt;TabAtkins> Rossen: Float logic is simple in this case. There's a bottom defined as a position (*not* a geometry), then the only geometries to take into acount are those from floats.<br>
&lt;TabAtkins> dbaron: Reminder that the float rules do no in any way reference the bottom of line boxes, only the top.<br>
&lt;TabAtkins> dbaron: I think to fix this we should *introduce* such a rule.<br>
&lt;TabAtkins> dbaron: Right now the top of the flaot can't be higher than the top of th eline box containing preceding content.<br>
&lt;TabAtkins> dbaron: I think for initial letter the top of a float can't be higher than the bottom of a line box that is *prior* to a linebox containing preceding content.<br>
&lt;TabAtkins> dbaron: So if float is anchored in second line, current rules say it can't be above top of second line box, or first line box, or initial letter line box.<br>
&lt;TabAtkins> dbaron: We can fix it to say that it can't be above the top of second line box, or bottom of first line box, or bottom of initial letter line box.<br>
&lt;TabAtkins> dbaron: Then we can worry if we want this bottom rules to depend on what area the linebox covers, so we can see if right floats can pop up or not.<br>
&lt;TabAtkins> florian: And you're going on lineboxes rather than clearances so floats anchored on first line don't necessarily have to clear the initial letter?<br>
&lt;TabAtkins> dbaron: Yeah.<br>
&lt;TabAtkins> fantasai: Alternative is, in terms of clearances, the first line box includes the first letter, there's nothing to clear, but the part of th einitial letter that drops below the first line box is an exclusion area that needs to be cleared if you're floating to the start edge.<br>
&lt;TabAtkins> dauwhe: Seems straightforward to me.<br>
&lt;astearns> +1 from me<br>
&lt;fantasai> s/nothig to clear,/nothing to clear, it's just in-flow content;/<br>
&lt;TabAtkins> florian: So the effect of these two models in usage, both do the same thing for left floats, different for right floats.<br>
&lt;TabAtkins> florian: fantasai's lets right floats go high, david's doesn't.<br>
&lt;TabAtkins> dbaron: I prefer linebox model because I'm hesitant to tie it too much into the float model. I think too many things can go wrong if initial letters get tied into floats, should be associated with lines.<br>
&lt;TabAtkins> fantasai: I think we still need two lineboxes model.<br>
&lt;TabAtkins> Rossen: Exclusions by current definition - if I created A to be an exclusion positioned like that (bottom half), a left float on second line will still b enext to the initial letter.<br>
&lt;TabAtkins> florian: It's an exclusion you must clear.<br>
&lt;TabAtkins> Rossen: We don't have that right now. We hav exclusions that clear start, end, max.<br>
&lt;TabAtkins> Rossen: So if this was exclusions would it be exlude start or end?<br>
&lt;TabAtkins> fantasai: Whatever float would do.<br>
&lt;TabAtkins> Rossen: So start.<br>
&lt;TabAtkins> Rossen: So you're saying that nothing can be placed to the start of it.<br>
&lt;TabAtkins> fantasai: Right.<br>
&lt;TabAtkins> Rossen: So if you have a left float here, what rule makes it clear?<br>
&lt;TabAtkins> florian: The new rule we add, that left floats must clear it.<br>
&lt;TabAtkins> Rossen: I think what you need here is not exclusions, but a clear-after behavior - say "after me, I want to clear all left floats".<br>
&lt;TabAtkins> florian: So if dotted blue box has clear-after:left, left floats must clear it.<br>
&lt;TabAtkins> Rossen: And I assert that has nothing to do with exclusions.<br>
&lt;TabAtkins> TabAtkins: If the float is anchored in the middle of the first line, how does this give us Blue 1 rather than Blue 3?<br>
&lt;TabAtkins> fantasai: You do a hypothetical layout to figure out where the anchor is, then place the float, *then* place the initial letter (which establishes the exclusion/clear-after) which'll affect subsequent lines.<br>
&lt;TabAtkins> astearns: Two outcomes. One places right floats without caring about the initial letter, one does care. Can we resolve on which outcome we want ,then discuss behavior?<br>
&lt;TabAtkins> TabAtkins: No, objections are about the mechanics.<br>
&lt;TabAtkins> tantek: I think it's important to not degrade behavior from the legacy float stuff.<br>
&lt;TabAtkins> tantek: With a very tall initial letter, it'll look extra bad.<br>
&lt;TabAtkins> TabAtkins: If you put the float beofre your content, everything works fine.<br>
&lt;dbaron> Use of floats for what they were intended for is pretty rare on the Web, outside of wikipedia...<br>
&lt;TabAtkins> fantasai: Yeah, this is mostly about if the float shows up inside the content, such that it's on the second line. I think it's okay to treat that as an edge case.<br>
&lt;astearns> s/then discuss behavior/then work out how to specify it/<br>
&lt;astearns> q?<br>
&lt;fantasai> whiteboard photos: https://lists.w3.org/Archives/Public/www-archive/2018Jul/0000.html<br>
&lt;astearns> ack dauwhe<br>
&lt;fantasai> (this should go up much higher in the minutes)<br>
&lt;TabAtkins> [takes pictures]<br>
&lt;TabAtkins> florian: I don't know if this is a separate convo.<br>
&lt;TabAtkins> florian: If we take first blue, it looks good because the float is taller than the letter.<br>
&lt;TabAtkins> florian: If it's shorter, does it still look good?<br>
&lt;TabAtkins> fantasai: I think it's fine, and in most cases it'll be taller.<br>
&lt;TabAtkins> fantasai: I think we agree on the renderings here. We should resolve on that.<br>
&lt;TabAtkins> fantasai: We just disagree on whether right floats have to clear or not.<br>
&lt;Rossen> https://lists.w3.org/Archives/Public/www-archive/2018Jul/0001.html<br>
&lt;TabAtkins> fantasai: So for left floats: clear doesn't apply to initial letters<br>
&lt;TabAtkins> Rossen: Why doesn't it apply?<br>
&lt;TabAtkins> dbaron: I'ts an inline.<br>
&lt;TabAtkins> RESOLVED: clear doesn't apply to initial letters<br>
&lt;TabAtkins> fantasai: Initial letter mustn't overlap floats, just like lineboxes don't.<br>
&lt;TabAtkins> RESOLVED: Initial letters must not overlap floats (just like lineboxes don't).<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/689<br>
&lt;TabAtkins> fantasai: If a linebox moves down or is shortened due to a float, initial letter moves with it, and vice versa.<br>
&lt;TabAtkins> florian: Not sure if there's space for initial letter but not rest of line, it should move down with the line...<br>
&lt;TabAtkins> tantek: This is just linebreaking rules. If you have [T]he, and Th fits but not e, the whole thing moves down. But if you have [A], then it can stay on the line by itself and subsequent content moves down to next line, because space introduces linebreaking opportunity.<br>
&lt;fantasai> Exact prose is in https://github.com/w3c/csswg-drafts/commit/71edb81b0d8b8781fec05e46ca05de2ed1d2d3ff btw<br>
&lt;TabAtkins> RESOLVED: If a linebox moves down or is shortened due to a float, initial letter moves with it, and vice versa.<br>
&lt;TabAtkins> fantasai: An inline-start float originating on first line goes between initial letter and containing block edge. (It doesn't split the initial letter and the subsequent text.)<br>
&lt;TabAtkins> florian: This is how flaots works, if the initial letter isn't a float.<br>
&lt;TabAtkins> RESOLVED: An inline-start float originating on first line can go between initial letter and containing block edge. (It can't split the initial letter and the subsequent text.)<br>
&lt;TabAtkins> fantasai: An inline-start float origining on subsequent impacted lines must clear the initial letter.<br>
&lt;TabAtkins> RESOLVED: An inline-start float origining on subsequent impacted lines must clear the initial letter.<br>
&lt;TabAtkins> fantasai: inline-end floats that start on subsequent impacted lines are still an open issue.<br>
&lt;TabAtkins> myles: first-line inline-end floats?<br>
&lt;TabAtkins> florian: I think they're the same.<br>
&lt;TabAtkins> myles: Let's talk about it later.<br>
&lt;TabAtkins> fantasai: Okay, so mark an open issue in the draft about inline-end floats.<br>
&lt;TabAtkins> fantasai: This should close #360 and #689.<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/360#issuecomment-401995257 using your GitHub account

Received on Tuesday, 3 July 2018 02:38:05 UTC