diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 09a113d4a8e..d2c046fbd9e 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -28,7 +28,8 @@ use std::unstable::raw::Box; use style::ComputedValues; use style::computed_values::{ border_style, clear, float, font_family, font_style, line_height, - position, text_align, text_decoration, vertical_align, LengthOrPercentage, overflow}; + position, text_align, text_decoration, vertical_align, LengthOrPercentage, + overflow, visibility}; use css::node_style::StyledNode; use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData, ToGfxColor}; @@ -1032,6 +1033,10 @@ impl RenderBoxUtils for @RenderBox { box_bounds, absolute_box_bounds, self.debug_str()); debug!("RenderBox::build_display_list: dirty={}, offset={}", *dirty, *offset); + if base.nearest_ancestor_element().style().Box.visibility != visibility::visible { + return; + } + if absolute_box_bounds.intersects(dirty) { debug!("RenderBox::build_display_list: intersected. Adding display item..."); } else { diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako index 067f08b5a1a..26f05cfacaa 100644 --- a/src/components/style/properties.rs.mako +++ b/src/components/style/properties.rs.mako @@ -373,6 +373,9 @@ pub mod longhands { // CSS 2.1, Section 11 - Visual effects ${single_keyword("overflow", "visible hidden", inherited=False)} // TODO: scroll auto + // TODO: collapse. Well, do tables first. + ${single_keyword("visibility", "visible hidden", inherited=True)} + // CSS 2.1, Section 12 - Generated content, automatic numbering, and lists // CSS 2.1, Section 13 - Paged media diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list index a18747e8ab9..5b8bb85e9a8 100644 --- a/src/test/ref/basic.list +++ b/src/test/ref/basic.list @@ -12,3 +12,4 @@ == first_of_type_pseudo_a.html first_of_type_pseudo_b.html == last_of_type_pseudo_a.html last_of_type_pseudo_b.html == only_of_type_pseudo_a.html only_of_type_pseudo_b.html +== visibility_hidden.html visibility_hidden_ref.html diff --git a/src/test/ref/visibility_hidden.html b/src/test/ref/visibility_hidden.html new file mode 100644 index 00000000000..2b8e468a8a3 --- /dev/null +++ b/src/test/ref/visibility_hidden.html @@ -0,0 +1,18 @@ + + +
+This should be visible.
+This should NOT be visible.
+This should be visible.
+This should be visible.
++
This should be visible.
+