Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
Anchor scrollable overflow at the padding box
ldm07733dcd84317
diff --git a/moli-layout/src/projection.rs b/moli-layout/src/projection.rsindex 9ee9ab645..b8be32019 100644--- a/moli-layout/src/projection.rs+++ b/moli-layout/src/projection.rs@@ -167,7 +167,7 @@ wherepaint_order_count: usize,pub(crate) diagnostics: Vec<PaintDiagnostic>,resolved_transforms: Vec<ResolvedLayoutTransform>,- overflow: Vec<LayoutRect>,+ scrollable_overflow: Vec<LayoutRect>,viewport_anchored: Vec<bool>,direct_fragments: Vec<Option<LayoutFragmentId>>,owner_paint_fragments: Vec<Vec<LayoutFragmentId>>,@@ -211,7 +211,7 @@ wherepaint_order_count: 0,diagnostics: Vec::new(),resolved_transforms: vec![ResolvedLayoutTransform::IDENTITY; count],- overflow: vec![LayoutRect::ZERO; count],+ scrollable_overflow: vec![LayoutRect::ZERO; count],viewport_anchored: vec![false; count],direct_fragments: vec![None; count],owner_paint_fragments: vec![Vec::new(); count],@@ -277,12 +277,16 @@ wherePaintDiagnosticSeverity::Warning,));}- let mut overflow = border_box;+ // Scrollable overflow starts at the padding box. The box's own border is visual+ // geometry, not descendant content that can be reached by scrolling. Taffy's+ // `content_size` is measured from the padding-box origin and already includes the+ // end padding, so keep that coordinate space when projecting its extent.+ let mut overflow = padding_box;let content_extent = LayoutRect::new(- 0.0,- 0.0,- layout.size.width.max(layout.content_size.width).max(0.0),- layout.size.height.max(layout.content_size.height).max(0.0),+ padding_box.x,+ padding_box.y,+ padding_box.width.max(layout.content_size.width).max(0.0),+ padding_box.height.max(layout.content_size.height).max(0.0),);overflow = overflow.union(content_extent);if let Some(context) = layout_box.inline_layout.as_ref() {@@ -300,7 +304,7 @@ whereoverflow = overflow.union(offset_rect(fragment.rect, origin));}}- self.overflow[index] = overflow;+ self.scrollable_overflow[index] = overflow;let source = layout_box.source.or_else(|| {(layout_box.anonymous_reason== Some(LayoutAnonymousReason::InlineSplitContinuation))@@ -371,7 +375,7 @@ wherelet visual_overflow = if self.world.boxes[index].style.clips_overflow() {child_geometry.border_box} else {- self.overflow[index]+ self.scrollable_overflow[index]};let location = self.world.boxes[index].final_layout.location;let layout_translation = LayoutTransform2D::translation(location.x, location.y);@@ -385,12 +389,13 @@ where.map_rect(child_geometry.margin_box).bounding_rect(),);- self.overflow[parent_id.index()] = self.overflow[parent_id.index()].union(mapped);+ self.scrollable_overflow[parent_id.index()] =+ self.scrollable_overflow[parent_id.index()].union(mapped);}for index in 0..self.world.boxes.len() {let geometry = &self.boxes[index];- let overflow = self.overflow[index];+ let overflow = self.scrollable_overflow[index];let is_root = index == self.world.root.index();let scrollport = if is_root {LayoutRect::new(@@ -720,7 +725,7 @@ wherelet layout_translation = LayoutTransform2D::translation(root_layout.x, root_layout.y);let overflow = layout_translation.concatenate(self.resolved_transforms[root].transform)- .map_rect(self.overflow[root])+ .map_rect(self.scrollable_overflow[root]).bounding_rect().union(layout_translationdiff --git a/moli-layout/tests/phase5_output_contract.rs b/moli-layout/tests/phase5_output_contract.rsindex 09ddc58ef..e3b10b970 100644--- a/moli-layout/tests/phase5_output_contract.rs+++ b/moli-layout/tests/phase5_output_contract.rs@@ -257,6 +257,47 @@ fn pass_result_owns_complete_box_models_and_answers_a_batch_from_one_pass() {));}+#[test]+fn own_border_is_visual_geometry_not_scrollable_content() {+ let source = Source(vec![+ Node::element("root", vec![1]),+ Node::element("bordered-child", Vec::new()),+ ]);+ let mut styles = Styles::default();+ styles+ .0+ .insert(0, fixed_size(LayoutDisplay::Block, 320.0, 240.0));+ styles.0.insert(+ 1,+ resolved(+ LayoutDisplay::Block,+ Style {+ box_sizing: BoxSizing::ContentBox,+ size: Size {+ width: length(100.0),+ height: length(60.0),+ },+ border: Rect {+ left: length(7.0),+ right: length(11.0),+ top: length(5.0),+ bottom: length(13.0),+ },+ ..Style::default()+ },+ ),+ );++ let output = build(&source, &mut styles);+ let metrics = output.element_metrics_for_source(1).unwrap();+ assert_eq!(+ metrics.client_size,+ moli_layout::LayoutSize::new(100.0, 60.0)+ );+ assert_eq!(metrics.scroll_size, metrics.client_size);+ assert_eq!(metrics.client_border, LayoutPoint::new(7.0, 5.0));+}+#[test]fn pass_output_freezes_into_the_sole_queryable_retained_tree() {let source = Source(vec![