git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit27d5dcc4152d9b2d91748ae3f6d54eb33fc9b640
parent3c3b3f4303
authorLucas Galante <[email protected]>
date2026-07-12 00:22
refactor(widget): fold check_out_of_bounds + transform_event_for_child (6au follow-up)

The Layer/Page deletion stranded two more Element methods whose ONLY
override was Page (census round 3): check_out_of_bounds (the scrolled
page bounds veto — its propagate_event_impl branch is now unreachable)
and transform_event_for_child (the page scrollbar y-shift — its three
call sites now pass the event through unchanged). Call sites folded,
methods deleted. Element: 106 -> 104 methods. 169 tests pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018u7qTwzX95dd5ysAkaSCLk

 src/context.rs    | 13 +++----------
 src/widget/mod.rs |  8 --------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/context.rs b/src/context.rs
index c58f467..615cec1 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -203,8 +203,7 @@ impl UiContext {
                                 if let Some(target_ptr) = self.tree.get_ptr(target_id) {
                                     let (cx, cy, _, _) = (*target_ptr).rect();
                                     let drag_evt = Event::DragUpdate { dx, dy, x: *x, y: *y, local_x: *x - cx, local_y: *y - cy };
-                                    let adjusted = (*root).transform_event_for_child(target_ptr, drag_evt, self);
-                                    (*target_ptr).handle_event(&adjusted, self);
+                                    (*target_ptr).handle_event(&drag_evt, self);
                                     (*target_ptr).mark_dirty(self);
                                 }
                             } else {
@@ -244,10 +243,6 @@ impl UiContext {
                 }
             }
 
-            if (*root).check_out_of_bounds(event, self) {
-                return false;
-            }
-
             // For KeyInput, send directly to focused widget if it exists
             if let Event::KeyInput(_) = event {
                 if let Some(focused) = self.focused_widget {
@@ -285,8 +280,7 @@ impl UiContext {
                             }
                             _ => {}
                         }
-                        let adjusted_event = (*root).transform_event_for_child(child, local_adjusted, self);
-                        if self.propagate_event_impl(&adjusted_event, child) {
+                        if self.propagate_event_impl(&local_adjusted, child) {
                             handled = true;
                         }
                     }
@@ -309,8 +303,7 @@ impl UiContext {
                             }
                             _ => {}
                         }
-                        let adjusted_event = (*root).transform_event_for_child(child, local_adjusted, self);
-                        if self.propagate_event_impl(&adjusted_event, child) {
+                        if self.propagate_event_impl(&local_adjusted, child) {
                             if check_drag_target {
                                 if let Some(b) = (*child).base() {
                                     self.drag_target = Some(b.id());
diff --git a/src/widget/mod.rs b/src/widget/mod.rs
index b688240..d824809 100644
--- a/src/widget/mod.rs
+++ b/src/widget/mod.rs
@@ -181,14 +181,6 @@ pub trait Element {
     /// overrides child `i`'s own `layout_style`. `None` (default) means children use their own.
     fn layout_children(&self) -> Option<Vec<crate::scene::layout::Style>> { None }
 
-    fn check_out_of_bounds(&self, _event: &Event, _ctx: &UiContext) -> bool {
-        false
-    }
-
-    fn transform_event_for_child(&self, _child: *mut (dyn Element + 'static), event: Event, _ctx: &UiContext) -> Event {
-        event
-    }
-
     fn mark_dirty(&mut self, ctx: &mut UiContext) {
         let mut parent_id = None;
         if let Some(b) = self.base_mut() {