Auto merge of #421 - pcwalton:canvas-nested-clip-paths, r=pcwalton

Allow clip paths to nest in the canvas API.

Closes #372.
This commit is contained in:
bors-servo 2020-07-28 17:30:23 -04:00 committed by GitHub
commit e48b2759dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -358,8 +358,11 @@ impl CanvasRenderingContext2D {
let mut clip_path = ClipPath::new(outline);
clip_path.set_fill_rule(fill_rule);
let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
if let Some(existing_clip_path) = self.current_state.clip_path.take() {
clip_path.set_clip_path(Some(existing_clip_path));
}
let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
self.current_state.clip_path = Some(clip_path_id);
}