Rewild Your Web
web browser dweb
at main 31 lines 1.1 kB view raw
1--- original 2+++ modified 3@@ -531,6 +531,28 @@ 4 result 5 } 6 7+ /// Try to scroll any scroll node in the tree that can accept the scroll. 8+ /// This is used for bubbling scroll events from embedded iframes where we 9+ /// don't have a specific target scroll node from hit-testing. 10+ pub fn try_scroll_any_node( 11+ &mut self, 12+ scroll_location: ScrollLocation, 13+ context: ScrollType, 14+ ) -> Option<(ExternalScrollId, LayoutVector2D)> { 15+ // Try each scroll node in order (depth-first from root) 16+ for i in 0..self.nodes.len() { 17+ let node_id = ScrollTreeNodeId { index: i }; 18+ 19+ if let Some(result) = 20+ self.scroll_node_or_ancestor_inner(node_id, scroll_location, context) 21+ { 22+ self.invalidate_cached_transforms(); 23+ return Some(result); 24+ } 25+ } 26+ None 27+ } 28+ 29 /// Given an [`ExternalScrollId`] and an offset, update the scroll offset of the scroll node 30 /// with the given id. 31 pub fn set_scroll_offset_for_node_with_external_scroll_id(