Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(layout): keep scrollbar gutters out of overflow

ldm0ddab89586ad4
diff --git a/Cargo.lock b/Cargo.lock
index 89eb505b3..89da49d17 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4469,7 +4469,7 @@ dependencies = [
[[package]]
name = "taffy"
version = "0.13.0"
-source = "git+https://github.com/ldm0/taffy?rev=72e1ee73a8b0d3ed1b1717c8e5cc6f570e82d96a#72e1ee73a8b0d3ed1b1717c8e5cc6f570e82d96a"
+source = "git+https://github.com/ldm0/taffy?rev=722358e39cd42cb95cc93d5bf06f3a2940a05748#722358e39cd42cb95cc93d5bf06f3a2940a05748"
dependencies = [
"arrayvec",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index 43e175b6a..26ae9e0d4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -96,7 +96,7 @@ stylo_atoms = { git = "https://github.com/ldm0/stylo", rev = "74cd014af14d84db1f
stylo_dom = { git = "https://github.com/ldm0/stylo", rev = "74cd014af14d84db1fc8faed85086895012fc687" }
stylo_static_prefs = { git = "https://github.com/ldm0/stylo", rev = "74cd014af14d84db1fc8faed85086895012fc687" }
stylo_traits = { git = "https://github.com/ldm0/stylo", rev = "74cd014af14d84db1fc8faed85086895012fc687" }
-taffy = { git = "https://github.com/ldm0/taffy", rev = "72e1ee73a8b0d3ed1b1717c8e5cc6f570e82d96a" }
+taffy = { git = "https://github.com/ldm0/taffy", rev = "722358e39cd42cb95cc93d5bf06f3a2940a05748" }
[workspace.lints.clippy]
disallowed_methods = "deny"
diff --git a/moli-cdp-smoke/README.md b/moli-cdp-smoke/README.md
index 950b057a6..b570004d8 100644
--- a/moli-cdp-smoke/README.md
+++ b/moli-cdp-smoke/README.md
@@ -173,8 +173,10 @@ Covered well:
`overflow-body-propagation-003`'s `display:contents` exclusion, and an overlay
that occludes a lower painted scrollbar. The numeric matrix additionally
covers padding/border with both box-sizing modes, auto/min/max block sizing,
- aspect-ratio, and physical top/bottom gutters in `vertical-rl`. It also
- verifies Moli's consume-only scrollbar corner and screenshot-triggered layout freshness.
+ aspect-ratio, and physical top/bottom gutters in `vertical-rl`. Block, flex,
+ and grid cases also assert that leading `both-edges` gutters neither create a
+ phantom `scrollWidth`/`scrollHeight` nor inflate a real overflow range. It
+ also verifies Moli's consume-only scrollbar corner and screenshot-triggered layout freshness.
The final workflow was calibrated on 2026-08-22 against the headed Xvfb
build `~/chromium/src/out/Default/chrome` (`Chrome/147.0.7709.0`) and then
extended with the physical-inset matrix on 2026-08-23 against that same
diff --git a/moli-cdp-smoke/moli_cdp_smoke/groups/classic_scrollbar.py b/moli-cdp-smoke/moli_cdp_smoke/groups/classic_scrollbar.py
index 32d7152a2..bb19fd529 100644
--- a/moli-cdp-smoke/moli_cdp_smoke/groups/classic_scrollbar.py
+++ b/moli-cdp-smoke/moli_cdp_smoke/groups/classic_scrollbar.py
@@ -751,23 +751,30 @@ async def _run_viewport_policy_and_numeric_gutter_workflow(
<div id="block" class="scroller"><div></div></div>
<div id="flex" class="scroller"><div></div></div>
<div id="grid" class="scroller"><div></div></div>
+ <div id="overflow" class="scroller"><div style="width:400px;height:200px"></div></div>
""",
wait_until="domcontentloaded",
)
both_edges = await page.evaluate(
- """() => ["block", "flex", "grid"].map(id => {
+ """() => ["block", "flex", "grid", "overflow"].map(id => {
const scroller = document.getElementById(id);
const child = scroller.firstElementChild;
return [
scroller.clientWidth, scroller.clientHeight,
+ scroller.scrollWidth, scroller.scrollHeight,
child.offsetWidth, child.offsetHeight,
];
})"""
)
assert_equal(
both_edges,
- [[170, 85, 170, 85], [170, 85, 170, 85], [170, 85, 170, 85]],
- "both-edge horizontal gutter participates in block/flex/grid numeric layout",
+ [
+ [170, 85, 170, 85, 170, 85],
+ [170, 85, 170, 85, 170, 85],
+ [170, 85, 170, 85, 170, 85],
+ [170, 85, 400, 200, 400, 200],
+ ],
+ "both-edge gutters participate in numeric layout without inflating scroll ranges",
)
await page.set_content(
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs
index 84aacbd3b..decfe151a 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs
@@ -1422,7 +1422,7 @@ fn body_overflow_defines_viewport_scrolling_and_default_root_stable_gutters() {
}
#[test]
-fn stable_both_edges_horizontal_bar_sizes_percentage_children_in_numeric_layout() {
+fn stable_both_edges_preserve_numeric_layout_and_scroll_ranges() {
let mut vm = new_storage_test_vm("https://both-edges-numeric-layout.test/");
vm.eval(
r#"
@@ -1438,7 +1438,10 @@ fn stable_both_edges_horizontal_bar_sizes_percentage_children_in_numeric_layout(
document.body.innerHTML = ["block", "flex", "grid"].map(display => `
<div id="${display}" style="display:${display};width:200px;height:100px;overflow:scroll;scrollbar-gutter:stable both-edges">
<div style="width:100%;height:100%"></div>
- </div>`).join("");
+ </div>`).join("") + `
+ <div id="overflow" style="width:200px;height:100px;overflow:scroll;scrollbar-gutter:stable both-edges">
+ <div style="width:400px;height:200px"></div>
+ </div>`;
})()
"#,
)
@@ -1448,12 +1451,14 @@ fn stable_both_edges_horizontal_bar_sizes_percentage_children_in_numeric_layout(
assert_eq!(
vm.eval(
r#"
- JSON.stringify(["block", "flex", "grid"].map(id => {
+ JSON.stringify(["block", "flex", "grid", "overflow"].map(id => {
const scroller = document.getElementById(id);
const child = scroller.firstElementChild;
return [
scroller.clientWidth,
scroller.clientHeight,
+ scroller.scrollWidth,
+ scroller.scrollHeight,
child.offsetWidth,
child.offsetHeight,
];
@@ -1461,7 +1466,7 @@ fn stable_both_edges_horizontal_bar_sizes_percentage_children_in_numeric_layout(
"#,
)
.expect("both-edge numeric layout metrics should evaluate"),
- "[[170,85,170,85],[170,85,170,85],[170,85,170,85]]"
+ "[[170,85,170,85,170,85],[170,85,170,85,170,85],[170,85,170,85,170,85],[170,85,400,200,400,200]]"
);
}