mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Only apply clip() to positioned elements
This commit is contained in:
parent
0bc10b8073
commit
b026dae8ac
5 changed files with 17 additions and 20 deletions
|
@ -715,19 +715,24 @@ impl BoxFragment {
|
||||||
builder: &mut StackingContextBuilder,
|
builder: &mut StackingContextBuilder,
|
||||||
containing_block_info: &ContainingBlockInfo,
|
containing_block_info: &ContainingBlockInfo,
|
||||||
) {
|
) {
|
||||||
let clip = self.style.get_effects().clip;
|
let position = self.style.get_box().position;
|
||||||
if let ClipRectOrAuto::Rect(r) = clip {
|
// https://drafts.csswg.org/css2/#clipping
|
||||||
let border_rect = self
|
// The clip property applies only to absolutely positioned elements
|
||||||
.border_rect()
|
if position == ComputedPosition::Absolute || position == ComputedPosition::Fixed {
|
||||||
.to_physical(self.style.writing_mode, &containing_block_info.rect);
|
let clip = self.style.get_effects().clip;
|
||||||
let clip_rect = r
|
if let ClipRectOrAuto::Rect(r) = clip {
|
||||||
.for_border_rect(border_rect)
|
let border_rect = self
|
||||||
.translate(containing_block_info.rect.origin.to_vector())
|
.border_rect()
|
||||||
.to_webrender();
|
.to_physical(self.style.writing_mode, &containing_block_info.rect);
|
||||||
|
let clip_rect = r
|
||||||
|
.for_border_rect(border_rect)
|
||||||
|
.translate(containing_block_info.rect.origin.to_vector())
|
||||||
|
.to_webrender();
|
||||||
|
|
||||||
let parent = builder.current_space_and_clip;
|
let parent = builder.current_space_and_clip;
|
||||||
builder.current_space_and_clip.clip_id =
|
builder.current_space_and_clip.clip_id =
|
||||||
builder.wr.define_clip_rect(&parent, clip_rect);
|
builder.wr.define_clip_rect(&parent, clip_rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[clip-not-absolute-positioned-001.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[clip-not-absolute-positioned-002.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[clip-not-absolute-positioned-003.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[clip-not-absolute-positioned-004.html]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue