Open
Bug 1510360
Opened 6 years ago
Updated 2 years ago
Need to handle cases where dynamic reflow roots' baselines impact the position of other elements
Categories
(Core :: Layout, defect, P3)
Core
Layout
Tracking
()
ASSIGNED
Tracking | Status | |
---|---|---|
firefox65 | --- | affected |
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
One case we don't handle thoroughly in bug 1159042 right now: baseline alignment between a reflow root and content outside of that reflow root.
See attached testcase, which fails right now with bug 1159042's patches applied. (It's got a "flow-root" (a BFC) inside of an "inline-block", and the inline-block lets us observe the flow-root's baseline.)
STR: Hover the "Hover" text in the attached testcase.
EXPECTED RESULTS:
The word "Hover" should grow, *and the rest of the text should shift down to stay aligned*.
ACTUAL RESULTS (in a build with bug 1159042):
The rest of the text does not move down. Presumably we initiate the reflow at the "display:flow-root" element (because we tag it as a dynamic reflow root), and this means we don't notify its parent of its new baseline and allow the rest of the text to be baseline-aligned with it.
Assignee | ||
Comment 1•6 years ago
|
||
dbaron, how do you think we should handle this?
Strawman thoughts that may or may not be feasible:
(A) Don't let things be reflow roots if there's a chance anyone cares about the baseline. (Though I'm not sure how to determine this... there could be an arbitrary number of wrapper-blocks between the inline-block and the flow-root in the attached testcase. Maybe we could set some ReflowInput flag for "some ancestor might care about your baseline", and we'd set that flag for in-flow descendants of frames that are inline level or have "align-self:baseline"?)
(B) Post some sort of reflow callback if a reflow root detects that its baseline has changed (though that requires some overhead to detect, because we don't store the baseline anywhere, in general - it's just available via accessors that may do some tree-traversal, and it's returned in the ReflowOutput for convenience. So we know what it ends up at, but we don't necessarily know what it was before [or if anyone cares].)
I think (A) is feasible, but I'm curious if you see any flaws or any better options.
Flags: needinfo?(dbaron)
Comment 2•6 years ago
|
||
I think (A) is probably better.
Can baseline alignment operate at large distances (ancestor-descendant hops) without all the intermediate values of vertical-align or align-self being 'baseline'? I don't think it can for 'vertical-align' (although there 'baseline' is the default, so long distances are feasible)... but can it for 'align-self'?
Flags: needinfo?(dbaron)
Assignee | ||
Comment 3•6 years ago
|
||
I think it can, yeah.
If a flex container doesn't have any items with "align-self:baseline", it derives its baseline from its first flex item, per (2) at https://drafts.csswg.org/css-flexbox-1/#flex-baselines
I think we could have something like the following:
<div class="flex">
<div style="align-self:baseline">abc</div>
<div class="align-self:baseline">
<div class="flex"><!-- no baseline specific styling on this div -->
<div class="reflow-root">
abc
...where the contents of the reflow-root end up influencing the baseline of their align-self:baseline ancestor (and the position of "abc" as a result).
Assignee | ||
Comment 4•6 years ago
|
||
Here's a testcase to illustrate comment 3 (with slightly different content from what I included there).
The testcase has a stack of wrapper-divs that have "vertical-align:top" and the initial align-self (not baseline) -- and baseline information "leaks through", from a descendant of those divs to an ancestor of those divs, so that the hover-triggered font-size change must cause a sibling of an ancestor to change position. (And this testcase is broken similarly to the first one, with the current soon-to-land dynamic-reflow-root implementation.)
This baseline-info-leakage is fine, I think -- it just means we need the hypothetical ReflowInput flag (from strategy "(A)") to be propagated pretty thoroughly to descendants of baseline-aligned stuff -- probably only getting unset for OOF descendants, to be on the conservative side.
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Assignee | ||
Updated•6 years ago
|
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•