mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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,
|
||||
containing_block_info: &ContainingBlockInfo,
|
||||
) {
|
||||
let clip = self.style.get_effects().clip;
|
||||
if let ClipRectOrAuto::Rect(r) = clip {
|
||||
let border_rect = self
|
||||
.border_rect()
|
||||
.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 position = self.style.get_box().position;
|
||||
// https://drafts.csswg.org/css2/#clipping
|
||||
// The clip property applies only to absolutely positioned elements
|
||||
if position == ComputedPosition::Absolute || position == ComputedPosition::Fixed {
|
||||
let clip = self.style.get_effects().clip;
|
||||
if let ClipRectOrAuto::Rect(r) = clip {
|
||||
let border_rect = self
|
||||
.border_rect()
|
||||
.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;
|
||||
builder.current_space_and_clip.clip_id =
|
||||
builder.wr.define_clip_rect(&parent, clip_rect);
|
||||
let parent = builder.current_space_and_clip;
|
||||
builder.current_space_and_clip.clip_id =
|
||||
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