Skip to content

Commit 41f9dc6

Browse files
committed
Integrate Taffy's and Parley's baseline support
1 parent b5eb450 commit 41f9dc6

3 files changed

Lines changed: 65 additions & 26 deletions

File tree

Cargo.lock

Lines changed: 53 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ taffy = { version = "=0.11.0-experimental-cache-fix.3", default-features = false
100100
"calc",
101101
"detailed_layout_info",
102102
] }
103-
parley = { git = "https://github.com/linebender/parley", rev="f9f53108885410786a25098d7d41f023d33a3e25", default-features = false, features = ["std"] }
103+
parley = { git = "https://github.com/linebender/parley", rev="30f6ff1970e958498787fbfbf68a2eb013bee158", default-features = false, features = ["std"] }
104104
skrifa = { version = "0.42", default-features = false, features = [
105105
"std",
106106
] } # Should match parley and vello versions

packages/blitz-dom/src/layout/inline.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ impl BaseDocument {
300300
ibox.height = 0.0;
301301
} else {
302302
let output = self.compute_child_layout(NodeId::from(ibox.id), child_inputs);
303+
ibox.baseline = output.first_baselines.y;
303304
ibox.width = (margin.left + margin.right + output.size.width) * scale;
304305
ibox.height = (margin.top + margin.bottom + output.size.height) * scale;
305306
}
@@ -537,7 +538,7 @@ impl BaseDocument {
537538
// dbg!(&layout.size);
538539
// dbg!(&layout.location);
539540

540-
state.append_inline_box_to_line(box_break_data.advance, 0.0);
541+
state.append_inline_box_to_line(box_break_data.advance, 0.0, 0.0);
541542

542543
// if float.is_floated() {
543544
// println!("INLINE FLOATED BOX ({}) {:?}", ibox.id, float);
@@ -662,6 +663,11 @@ impl BaseDocument {
662663
// println!("known_dimensions: w: {:?} h: {:?}", inputs.known_dimensions.width, inputs.known_dimensions.height);
663664
// println!("\n");
664665

666+
let first_baseline = inline_layout
667+
.layout
668+
.first_baseline()
669+
.map(|baseline| baseline + content_box_inset.top);
670+
665671
// Put layout back
666672
self.nodes[node_id]
667673
.data
@@ -672,7 +678,10 @@ impl BaseDocument {
672678
LayoutOutput {
673679
size: final_size,
674680
content_size: measured_size + padding.sum_axes(),
675-
first_baselines: Point::NONE,
681+
first_baselines: Point {
682+
x: None,
683+
y: first_baseline,
684+
},
676685
top_margin: CollapsibleMarginSet::ZERO,
677686
bottom_margin: CollapsibleMarginSet::ZERO,
678687
margins_can_collapse_through: !has_styles_preventing_being_collapsed_through

0 commit comments

Comments
 (0)