render: real block layout for mixed content, owner-space overflow clips
Two structural fixes to the layout and paint model. Mixed inline+block content: a block holding both was promoted wholesale to a flex-row-wrap container to approximate the inline formatting context. That collapsed contentless block children to width 0 (a position:relative hero wrapper whose only child is an absolute fill image vanished with it) and let text share lines with sibling blocks. Now the parent stays a real block, block-level children stay direct children (auto width fills the containing block), and each maximal run of consecutive inline-level siblings becomes one anonymous block-level box carrying the IFC. A run of pure text and foldable inline wrappers collapses to a single shaped cosmic-text leaf (one taffy node per run instead of one per word); runs with atomic inline boxes fall back to a flex-wrap wrapper. Absolutely positioned children neither join nor break runs and no longer count as inline content, so their containing block keeps its real used width and taffy resolves width:100%/inset:0 fills against it. Overflow clips: an inherited overflow:hidden clip was shifted by the painted node's own accumulated translate, so a carousel track's translateX dragged the viewport's clip along with every slide and all slides stayed visible stacked. Clips are now stored in the clip owner's coordinate space (owner translate baked in at resolve time) and no longer move with descendants, for boxes, per-word text, and shaped inline items alike. The same walk records per-node accumulated translates once, replacing the per-painted-node ancestor walks. Also parse translate3d (Swiper-style carousels position their track exclusively through it) and make transform:none reset a lower-priority transform. Verified: abs-fill repros that rendered 0x0 now fill across block/flex/grid parents; carousel repro shows exactly one slide; danluu.com mismatch vs Chromium 13.0 to 5.7 percent; no regressions across the prose and framework spot sets; obstacle course 33/33; 36 percent faster on a layout-bound synthetic page with neutral real-page memory.
This commit is contained in:
1 parent
8fa387faed
commit
35cbbff9b2
5 files changed
+533
-168
No files matched your search
@@ -51,6 +51,17 @@ pub mod inline {
|
||||
pub fn try_build(&mut self, _tree: &DomTree, _id: NodeId, _styles: &HashMap<NodeId, crate::LayoutStyle>) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
/// See `try_build`: inline runs likewise fall back to word-split
|
||||
/// geometry in layout-only builds.
|
||||
pub fn try_build_run(
|
||||
&mut self,
|
||||
_tree: &DomTree,
|
||||
_parent: NodeId,
|
||||
_run: &[NodeId],
|
||||
_styles: &HashMap<NodeId, crate::LayoutStyle>,
|
||||
) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user