mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #1331 : SimonSapin/servo/visibility, r=pcwalton
http://www.w3.org/TR/CSS21/visufx.html#visibility `visibility: collapse` is not supported yet because tables are not, either. This fixes #1329.
This commit is contained in:
commit
a92d430007
5 changed files with 45 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
18
src/test/ref/visibility_hidden.html
Normal file
18
src/test/ref/visibility_hidden.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>'visibility: hidden' test</title>
|
||||
<style type="text/css">
|
||||
body { color: black; background: white }
|
||||
.hidden { visibility: hidden; }
|
||||
.visible { visibility: visible; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>This should be visible.</p>
|
||||
<div class="hidden">
|
||||
<p>This should NOT be visible.</p>
|
||||
<p class="visible">This should be visible.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
17
src/test/ref/visibility_hidden_ref.html
Normal file
17
src/test/ref/visibility_hidden_ref.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>'visibility: hidden' test</title>
|
||||
<style type="text/css">
|
||||
body { color: black; background: white }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>This should be visible.</p>
|
||||
<div>
|
||||
<!-- Use the same markup so that this test is not affected by broken margin collapsing. -->
|
||||
<p> </p>
|
||||
<p>This should be visible.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue