Repository navigation
fix(layout): return border-box content quads - #2809
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review of a67f462
No blocking findings
- Correctness:
moli-layout/src/layout_tree/source_query.rs:418-422now mapsbox_model.borderfor Box and InlineBox fragments. This matches Chromium'sLayoutObject::AbsoluteQuads(border box). Text fragments have no box model and still usefragment.rect. Inmoli-layout/src/projection.rs:654-662,720-722,box_model.borderis the same rect asfragment.rectfor both fragment kinds, so content quads now agree withclient_rects_for_output. Each split inline still gets one quad per line fragment, with its own sliced border edges. Transforms take the samelocal_to_viewport.map_rectpath as before, which maps all four corners (model.rs:260), so quads still follow the transform and are not reduced to an AABB. SVG has no padding or border, so its content box equals its border box and nothing changes there. - Other callers:
scroll_query.rs:28,36reaches content quads only when client rects are empty, which in practice means text nodes (unchanged). Otherwise it now scrolls the border box, as Chromium does.page_inspection.rs:174node_quadsuses the content-quad fallback only for text.provider.rs:114(observable_sources_with_fragments) checks only whether the list is empty. The mock geometry path (mock/queries.rs:96) already returned the client (border) rect. The only change a client can see isDOM.getContentQuads. Puppeteer's and Playwright's click points move from the content-box centre to the border-box centre, which is what Chromium gives (equal for symmetric padding and border), and padded empty controls become clickable. - Test: the added assertion in
phase5_output_contract.rs(border 3,3,114,74 vs content 10,10,100,60) fails without the fix. - Cost: the change reads a different field of the same struct, so no new work. The numbers in the body are plausible.
- CI: Format, Node harness and revision checks pass. Nextest, Clippy, CDP smoke, Python harness, Windows and release builds were still pending when I looked.
- Body: the picture is still pending.
Sequential Navigation Soak A/BWorkflow: No navigation resilience or memory conclusion is available for this run. |
Spider Bench A/BWorkflow: No benchmark result or performance conclusion is available for this run. |
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 116/116 groups passed; 1,680 scenariosWorkers: 4 · cumulative group time: 476.82 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |

**Track:** Trajectory Replay (Browser Eval). Replaces part of #640.Closes #2797.
Replaces part of #640.
Problem
DOM.getContentQuadsreturned the content box instead of the border box. Padded but empty controls therefore got zero-area quads, which Puppeteer and Playwright discard, soclick()on icon-only links/buttons failed; for other padded or bordered elements the click point shifted inward. Chromium returns border-box quads (LayoutObject::AbsoluteQuads). Repro (issue fixture,moli serve --layout):DOM.getContentQuadsandDOM.getBoxModelon#b1(100x50, padding 7, border 5) and#pad(empty inline-block, padding 12, border 1).Change
moli-layout/src/layout_tree/source_query.rs(content_quads_for_output): use the fragment'sbox_model.borderinstead ofbox_model.content, matchingclient_rects_for_output, which already uses the border rect. Text fragments (no box model) are unchanged.pass_result_owns_complete_box_models_and_answers_a_batch_from_one_passnow also checks the content quad equals the border box.Verification
Before: debug build of
origin/mainf935014; after: debug build of this branch.cargo fmt --all: clean.cargo clippy -p moli-layout --all-targets --all-features -- -D warnings: passed.cargo nextest run -p moli-layout: 330 passed.cargo nextest run -p moli-renderer-v8 -p moli-protocol -p moli-protocol-server -E 'test(quad) | test(scroll_into_view) | test(box_model) | test(geometry)': 223 passed.Cost
Debug builds,
/usr/bin/time -l, median of 5 runs (repro: three interleaved rounds; shared host):moli serve --layout)moli fetch --layoutof a local 46 KB articleThe change reads a different field of the same fragment box model; no extra layout or allocation. The single 1.597 s round was host noise (the other two rounds match main).