Merge pull request #2740 from mbrubeck/scroll-auto

Basic parsing of `overflow: scroll` and `auto`.
This commit is contained in:
Simon Sapin 2014-07-01 23:47:10 +01:00
commit 966b5c2112
5 changed files with 52 additions and 9 deletions

View file

@ -1395,11 +1395,6 @@ impl Fragment {
}
}
/// Returns true if the contents should be clipped (i.e. if `overflow` is `hidden`).
pub fn needs_clip(&self) -> bool {
self.style().get_box().overflow == overflow::hidden
}
/// A helper function to return a debug string describing the side offsets for one of the rect
/// box model properties (border, padding, or margin).
fn side_offsets_debug_fmt(&self, name: &str,
@ -1475,13 +1470,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,
}
}
}

View file

@ -515,7 +515,8 @@ pub mod longhands {
// CSS 2.1, Section 11 - Visual effects
${single_keyword("overflow", "visible hidden")} // TODO: scroll auto
// FIXME: Implement scrolling for `scroll` and `auto` (#2742).
${single_keyword("overflow", "visible hidden scroll auto")}
${switch_to_style_struct("InheritedBox")}

View file

@ -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

View file

@ -0,0 +1,22 @@
<html>
<head>
<style>
#first {
height: 100px;
width: 100px;
overflow: auto;
}
#second {
height: 100px;
width: 200px;
background: green;
}
</style>
</head>
<body>
<div id="first">
<div id="second">
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,22 @@
<html>
<head>
<style>
#first {
height: 100px;
width: 100px;
overflow: scroll;
}
#second {
height: 100px;
width: 200px;
background: green;
}
</style>
</head>
<body>
<div id="first">
<div id="second">
</div>
</div>
</body>
</html>