Only apply clip() to positioned elements

This commit is contained in:
Manish Goregaokar 2020-07-27 23:15:46 -07:00
parent 0bc10b8073
commit b026dae8ac
5 changed files with 17 additions and 20 deletions

View file

@ -715,6 +715,10 @@ impl BoxFragment {
builder: &mut StackingContextBuilder,
containing_block_info: &ContainingBlockInfo,
) {
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
@ -730,6 +734,7 @@ impl BoxFragment {
builder.wr.define_clip_rect(&parent, clip_rect);
}
}
}
fn build_scroll_frame_if_necessary<'a>(
&self,

View file

@ -1,2 +0,0 @@
[clip-not-absolute-positioned-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[clip-not-absolute-positioned-002.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[clip-not-absolute-positioned-003.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[clip-not-absolute-positioned-004.html]
expected: FAIL