diff --git a/src/components/layout/fragment.rs b/src/components/layout/fragment.rs index 3fea9cb9afa..2266b4c4baf 100644 --- a/src/components/layout/fragment.rs +++ b/src/components/layout/fragment.rs @@ -1395,9 +1395,12 @@ impl Fragment { } } - /// Returns true if the contents should be clipped (i.e. if `overflow` is `hidden`). + /// Returns true if the contents should be clipped (i.e. if `overflow` is not `visible`). pub fn needs_clip(&self) -> bool { - self.style().get_box().overflow == overflow::hidden + match self.style().get_box().overflow { + overflow::visible => true, + overflow::hidden | overflow::auto | overflow::scroll => false, + } } /// A helper function to return a debug string describing the side offsets for one of the rect @@ -1475,13 +1478,13 @@ impl ChildDisplayListAccumulator { -> ChildDisplayListAccumulator { ChildDisplayListAccumulator { clip_display_item: match style.get_box().overflow { - overflow::hidden => { + overflow::hidden | overflow::auto | overflow::scroll => { Some(box ClipDisplayItem { base: BaseDisplayItem::new(bounds, node, level), children: DisplayList::new(), }) - } - _ => None, + }, + overflow::visible => None, } } } diff --git a/src/components/style/properties/mod.rs.mako b/src/components/style/properties/mod.rs.mako index 44cbcbef40f..f22e6095390 100644 --- a/src/components/style/properties/mod.rs.mako +++ b/src/components/style/properties/mod.rs.mako @@ -515,7 +515,7 @@ pub mod longhands { // CSS 2.1, Section 11 - Visual effects - ${single_keyword("overflow", "visible hidden")} // TODO: scroll auto + ${single_keyword("overflow", "visible hidden scroll auto")} ${switch_to_style_struct("InheritedBox")} diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list index 68670ec1cdd..6f6c775d685 100644 --- a/src/test/ref/basic.list +++ b/src/test/ref/basic.list @@ -76,6 +76,9 @@ == linebreak_simple_a.html linebreak_simple_b.html == linebreak_inline_span_a.html linebreak_inline_span_b.html == overconstrained_block.html overconstrained_block_ref.html +== overflow_auto.html overflow_simple_b.html +== overflow_scroll.html overflow_simple_b.html +== overflow_simple_a.html overflow_simple_b.html == position_fixed_background_color_a.html position_fixed_background_color_b.html == position_fixed_overflow_a.html position_fixed_overflow_b.html == noscript.html noscript_ref.html diff --git a/src/test/ref/overflow_auto.html b/src/test/ref/overflow_auto.html new file mode 100644 index 00000000000..29eb7e2e2c1 --- /dev/null +++ b/src/test/ref/overflow_auto.html @@ -0,0 +1,22 @@ + + + + + +
+
+
+
+ + diff --git a/src/test/ref/overflow_scroll.html b/src/test/ref/overflow_scroll.html new file mode 100644 index 00000000000..26c333f4efe --- /dev/null +++ b/src/test/ref/overflow_scroll.html @@ -0,0 +1,22 @@ + + + + + +
+
+
+
+ +