@@ -306,29 +306,33 @@ impl PushScissorStackResult {
306306 }
307307}
308308
309- /// Returns true if scissor has been pushed.
309+ /// Returns Some() if scissor has been pushed.
310310pub fn push_scissor_stack (
311311 transform_stack : & mut TransformStack ,
312312 scissor_stack : & mut ScissorStack ,
313313 scroll_shift : Vec2 ,
314314 info : & Option < ScrollbarInfo > ,
315315 style : & taffy:: Style ,
316- ) -> PushScissorStackResult {
316+ ) -> Option < PushScissorStackResult > {
317317 let mut boundary_absolute = drawing:: Boundary :: construct_absolute ( transform_stack) ;
318318 boundary_absolute. pos += scroll_shift;
319319
320320 let do_clip = info. is_some ( ) && has_overflow_clip ( style) ;
321321
322+ if !do_clip {
323+ return None ; // Don't care
324+ }
325+
322326 scissor_stack. push ( ScissorBoundary ( boundary_absolute) ) ;
323327
324328 if scissor_stack. is_out_of_bounds ( ) {
325- return PushScissorStackResult :: OutOfBounds ;
329+ return Some ( PushScissorStackResult :: OutOfBounds ) ;
326330 }
327331
328332 if do_clip {
329- PushScissorStackResult :: VisibleAndClip
333+ Some ( PushScissorStackResult :: VisibleAndClip )
330334 } else {
331- PushScissorStackResult :: VisibleDontClip
335+ Some ( PushScissorStackResult :: VisibleDontClip )
332336 }
333337}
334338
@@ -380,7 +384,9 @@ fn draw_widget(
380384 let starting_scissor_set_count = internal. scissor_set_count ;
381385 let scissor_result = push_scissor_stack ( state. transform_stack , state. scissor_stack , scroll_shift, & info, style) ;
382386
383- if scissor_result == PushScissorStackResult :: VisibleAndClip {
387+ if let Some ( scissor_result) = & scissor_result
388+ && * scissor_result == PushScissorStackResult :: VisibleAndClip
389+ {
384390 if params. debug_draw {
385391 let mut boundary_relative = drawing:: Boundary :: construct_relative ( state. transform_stack ) ;
386392 boundary_relative. pos += scroll_shift;
@@ -403,12 +409,17 @@ fn draw_widget(
403409 style,
404410 } ;
405411
406- if scissor_result. should_display ( ) {
412+ if scissor_result
413+ . as_ref ( )
414+ . is_none_or ( PushScissorStackResult :: should_display)
415+ {
407416 widget_state. draw_all ( state, & draw_params) ;
408417 draw_children ( params, state, node_id, internal, false ) ;
409418 }
410419
411- state. scissor_stack . pop ( ) ;
420+ if scissor_result. is_some ( ) {
421+ state. scissor_stack . pop ( ) ;
422+ }
412423
413424 let current_scissor_set_count = internal. scissor_set_count ;
414425
0 commit comments