Skip to content

Commit b8b49d7

Browse files
committed
Address code review
1 parent 89d3404 commit b8b49d7

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

masonry_core/src/core/contexts.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,14 @@ impl LayoutCtx<'_> {
955955
/// [`post_paint`]: Widget::post_paint
956956
/// [clip shape]: crate::doc::masonry_concepts#clip-shape.
957957
pub fn set_clips_contents(&mut self, clips: bool) {
958-
self.widget_state.clips_contents = clips;
958+
if self.widget_state.clips_contents != clips {
959+
self.widget_state.clips_contents = clips;
959960

960-
self.widget_state.request_accessibility = true;
961-
self.widget_state.needs_accessibility = true;
962-
self.widget_state.needs_paint = true;
963-
self.global_state.needs_pointer_pass = true;
961+
self.widget_state.request_accessibility = true;
962+
self.widget_state.needs_accessibility = true;
963+
self.widget_state.needs_paint = true;
964+
self.global_state.needs_pointer_pass = true;
965+
}
964966
}
965967

966968
// TODO - Add set_clip_shape(impl Shape) method
@@ -1124,7 +1126,7 @@ impl_context_method!(
11241126
border_box_baseline - self.widget_state.border_box_insets.y1
11251127
}
11261128

1127-
/// Whether the children clips its own contents and that of its children.
1129+
/// Whether the widget clips its own contents and that of its children.
11281130
///
11291131
/// For more information, see
11301132
/// [`LayoutCtx::set_clips_contents`](crate::core::LayoutCtx::set_clips_contents).

masonry_core/src/doc/masonry_concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Widgets have a shape, usually one that matches their visual appearance, which ha
221221
- If the widget is set to clip its contents, pointer events outside the clip shape won't affect the children either.
222222
- If the widget is set to clip its contents, its scene and the children's scenes will be painted inside of the clip shape.
223223

224-
Currently, the clip shape is hardcoded to be the layout rect.
224+
Currently, the clip shape is hardcoded to be a rect with the widget's size and position.
225225

226226
<!-- TODO: Rename to "widget shape" instead? -->
227227
<!-- Need a better name. -->

0 commit comments

Comments
 (0)