Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
Make layout tests font-independent
ldm0fc95d293dd07
diff --git a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rsindex 42b7db2f5..5604a6a83 100644--- a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs+++ b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs@@ -2386,7 +2386,7 @@ getComputedStyle(document.getElementById('inline-gradient')).getPropertyValue('-}#[tokio::test(flavor = "current_thread")]-async fn baseline_atomic_inline_keeps_parent_font_descent_in_flex_header() {+async fn baseline_atomic_inline_keeps_parent_strut_descent_in_flex_header() {run_page_vm_async_test(async move {let loader =crate::network::ResourceRequestClient::new(&FetchConfig::default()).expect("loader");@@ -2401,7 +2401,8 @@ document.head.innerHTML = `<style>html,body{margin:0}#bar{display:flex;align-items:center;box-sizing:border-box;width:200px;height:60px;padding:6px}#header{display:flex;align-items:center}-#wrapper{display:block;font:14px/normal Arial,sans-serif}+/* A zero-size font makes the 3px half-leading below the baseline deterministic. */+#wrapper{display:block;font-size:0;line-height:6px}#atomic{display:inline-block;width:48px;height:48px;background:blue}</style>`;document.body.innerHTML = `<div id=bar><header id=header><div id=wrapper><span id=atomic></span></div></header></div>`;@@ -2493,7 +2494,7 @@ document.body.innerHTML = `<div class=row><div class=item id=ask><i class=icon><.as_array().unwrap_or_else(|| panic!("missing geometry for {id}: {geometry}"));for (index, expected) in expected.into_iter().enumerate() {- let actual = actual[index].as_f64().expect("numeric geometry") as f32;+ let actual = actual[index].as_f64().expect("numeric geometry");assert!((actual - expected).abs() <= 0.05,"{id}[{index}]: expected {expected}, got {actual}; geometry={geometry}"diff --git a/moli-renderer-v8/src/runtime/phase_one/mod.rs b/moli-renderer-v8/src/runtime/phase_one/mod.rsindex 75aec42ab..9fc36f1be 100644--- a/moli-renderer-v8/src/runtime/phase_one/mod.rs+++ b/moli-renderer-v8/src/runtime/phase_one/mod.rs@@ -1167,7 +1167,8 @@ li::marker { color: rgb(201,202,203) }let mut flow_page = parse_phase_one_html_into_page_vm_for_test(r#"<!doctype html><html><head><style>-html, body { margin: 0; padding: 0; font-family: Arial, sans-serif }+/* A zero-size font makes the 4px half-leading below the baseline deterministic. */+html, body { margin: 0; padding: 0; font-size: 0; line-height: 8px }#flow { display: flow-root; width: 200px }#left { float: left; width: 60px; height: 40px; background: rgb(1,2,3) }#right { float: right; width: 50px; height: 30px; background: rgb(11,12,13) }diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rsindex b8d5f3b18..75a086c5c 100644--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs@@ -9809,12 +9809,14 @@ fn mouse_event_offsets_follow_retargeted_shadow_targets() {(() => {const pageStyle = document.createElement('style');pageStyle.textContent =- 'html, body { padding: 0; margin: 0; font-family: Arial, sans-serif; } ' ++ 'html, body { padding: 0; margin: 0; } ' +'my-host { display: block; width: 180px; height: 80px; margin: 10px 20px; padding: 10px; }';document.documentElement.firstChild.appendChild(pageStyle);+ // Keep the span non-atomic while fixing its line-box top independently of+ // whichever default font the host has installed.const shadowStyle ='#container { width: 160px; height: 60px; padding: 10px; } ' +- '#target { margin-left: 5px; }';+ '#target { line-height: 20px; vertical-align: top; margin-left: 5px; }';function makeHost(id) {for (const host of document.querySelectorAll('my-host')) {