Always inherit parent layer's clip bounds

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-09-02 16:24:08 +02:00
co-authored by Nathan Sobo
parent a27a17b8e2
commit 26fe285408
+11 -8
View File
@@ -204,14 +204,17 @@ impl StackingContext {
}
fn push_layer(&mut self, clip_bounds: Option<RectF>) {
let clip_bounds = clip_bounds.map(|clip_bounds| {
clip_bounds
.intersection(self.active_layer().clip_bounds.unwrap_or(clip_bounds))
.unwrap_or_else(|| {
log::warn!("specified clip bounds are disjoint from parent layer");
RectF::default()
})
});
let parent_clip_bounds = self.active_layer().clip_bounds();
let clip_bounds = clip_bounds
.map(|clip_bounds| {
clip_bounds
.intersection(parent_clip_bounds.unwrap_or(clip_bounds))
.unwrap_or_else(|| {
log::warn!("specified clip bounds are disjoint from parent layer");
RectF::default()
})
})
.or(parent_clip_bounds);
let ix = self.layers.len();
self.layers.push(Layer::new(clip_bounds));