Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(css): expose touch-action
ldm01c6819d0088d
diff --git a/moli-benchmark/wpt-cross-current/failed-cases.txt b/moli-benchmark/wpt-cross-current/failed-cases.txtindex 462b90557..06903b2bf 100644--- a/moli-benchmark/wpt-cross-current/failed-cases.txt+++ b/moli-benchmark/wpt-cross-current/failed-cases.txt@@ -3600,9 +3600,7 @@ permissions-policy/policy-extends-to-sandbox.htmlpermissions-policy/reporting/fullscreen-reporting.htmlpermissions-policy/reporting/sync-xhr-report-only.htmlpermissions-policy/reporting/sync-xhr-reporting.html-pointerevents/compat/pointerevent_touch-action-verification.htmlpointerevents/pointerevent_on_event_handlers.html-pointerevents/pointerevent_touch-action-verification.htmlpreload/modulepreload-sri-importmap.htmlpreload/modulepreload-sri.htmlquirks/line-height-calculation.htmldiff --git a/moli-benchmark/wpt-cross-current/passed-cases.txt b/moli-benchmark/wpt-cross-current/passed-cases.txtindex 9ce6f0b90..f656ab42e 100644--- a/moli-benchmark/wpt-cross-current/passed-cases.txt+++ b/moli-benchmark/wpt-cross-current/passed-cases.txt@@ -6971,6 +6971,7 @@ permissions-policy/historical-feature-policy-header.htmlpermissions/all-permissions.htmlpermissions/midi-permission.htmlpermissions/permissionsstatus-name.html+pointerevents/compat/pointerevent_touch-action-verification.htmlpointerevents/inheritance.htmlpointerevents/parsing/touch-action-computed.htmlpointerevents/parsing/touch-action-invalid.html@@ -6981,6 +6982,7 @@ pointerevents/pointerevent_root_computed_style.htmlpointerevents/pointerevent_root_hit_test.htmlpointerevents/pointerevent_tiltX_tiltY_to_azimuth_altitude.htmlpointerevents/pointerevent_touch-action-illegal.html+pointerevents/pointerevent_touch-action-verification.htmlpointerlock/constructor.htmlpointerlock/pointerlock-requires-gesture.htmlpreload/avoid-delaying-onload-link-modulepreload-exec.htmldiff --git a/moli-renderer-v8/src/detached_css_style.rs b/moli-renderer-v8/src/detached_css_style.rsindex be434e18d..c86f45964 100644--- a/moli-renderer-v8/src/detached_css_style.rs+++ b/moli-renderer-v8/src/detached_css_style.rs@@ -453,6 +453,7 @@ const LIGHTWEIGHT_STYLE_PROPERTIES: &[&str] = &["text-underline-position","tab-size","top",+ "touch-action","transform","transform-origin","transform-style",diff --git a/moli-renderer-v8/src/native_bridge/element/styles/declaration/values.rs b/moli-renderer-v8/src/native_bridge/element/styles/declaration/values.rsindex 5aab3382e..00816bdde 100644--- a/moli-renderer-v8/src/native_bridge/element/styles/declaration/values.rs+++ b/moli-renderer-v8/src/native_bridge/element/styles/declaration/values.rs@@ -820,6 +820,9 @@ fn normalize_stylo_computed_style_value_with_resolution(return computed_text_size_adjust_specified_value(runtime, handle, value).or_else(|| Some(value.to_owned()));}+ if property == "touch-action" {+ return Some(normalize_touch_action_serialization(property, value));+ }if color_property_is_resolved_color(property) {return Some(resolve_computed_color_property_value(runtime, handle, property, value, resolution,@@ -828,6 +831,14 @@ fn normalize_stylo_computed_style_value_with_resolution(Some(value.to_owned())}+fn normalize_touch_action_serialization(property: &str, value: &str) -> String {+ if property == "touch-action" && value == "pan-x pan-y pinch-zoom" {+ "manipulation".to_owned()+ } else {+ value.to_owned()+ }+}+fn normalized_stylo_computed_pseudo_style_value(runtime: &JsContextHost,handle: DomHandle,@@ -859,9 +870,10 @@ fn inline_style_property_value_for_inline_style(if let Some(state) = runtime.element_inline_style_declaration_state(handle)&& let Some(value) = inline_state_property_value_with_pdb(state, &property){- return Some(value);+ return Some(normalize_touch_action_serialization(&property, &value));}- inline_style_entry_for_inline_style(runtime, handle, &property).map(|entry| entry.value)+ inline_style_entry_for_inline_style(runtime, handle, &property)+ .map(|entry| normalize_touch_action_serialization(&property, &entry.value))}pub(crate) fn raw_inline_style_property_value(@@ -1352,6 +1364,7 @@ pub(super) fn computed_style_default_value("pointer-events" => {inherited_computed_style_value(runtime, handle, "pointer-events", "auto")}+ "touch-action" => "auto".to_owned(),"accent-color" => "auto".to_owned(),"appearance" | "-webkit-appearance" => "none".to_owned(),"color" => inherited_computed_style_value(runtime, handle, "color", "rgb(0, 0, 0)"),@@ -1531,11 +1544,11 @@ pub(in crate::native_bridge::element::styles) fn style_property_value_with_viewpif let Some(state) = runtime.element_inline_style_declaration_state(handle)&& let Some(value) = inline_state_property_value_with_pdb(state, &property){- return value;+ return normalize_touch_action_serialization(&property, &value);}let entries = style_entries(runtime, handle);if let Some(value) = style_entries_property_value_with_pdb(&entries, &property) {- return value;+ return normalize_touch_action_serialization(&property, &value);}if property == "overflow" {if let Some(entry) = inline_style_entry_for_inline_style(runtime, handle, &property) {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 103bec066..c52d18451 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@@ -356,6 +356,48 @@ fn computed_style_exposes_root_pointer_events() {assert_eq!(result, "none|none|true");}+#[test]+fn computed_style_exposes_non_inherited_touch_action() {+ let mut vm = new_parsed_test_vm(+ "https://touch-action-computed.test/",+ r#"<!doctype html>+<style>#parent { touch-action: none; }</style>+<div id="parent"><div id="child"></div></div>"#,+ );++ let result = vm+ .eval(+ r#"+(() => {+ const parent = document.getElementById('parent');+ const child = document.getElementById('child');+ const initial = getComputedStyle(child);+ const values = [+ 'touch-action' in initial,+ 'touchAction' in initial,+ CSS.supports('touch-action', 'pan-y pan-x'),+ getComputedStyle(parent).touchAction,+ initial.touchAction+ ];++ child.style.touchAction = 'pinch-zoom pan-y pan-x';+ values.push(child.style.touchAction, getComputedStyle(child).touchAction);+ child.style.touchAction = 'pan-x pan-left';+ values.push(child.style.touchAction);+ child.style.touchAction = 'inherit';+ values.push(getComputedStyle(child).touchAction);+ return values.join('|');+})()+"#,+ )+ .expect("touch-action computed style should evaluate");++ assert_eq!(+ result,+ "true|true|true|none|auto|manipulation|manipulation|manipulation|none"+ );+}+#[test]fn style_element_type_attribute_uses_raw_exact_css_match() {let mut vm = new_parsed_test_vm(