auto merge of #3604 : pcwalton/servo/inline-block-overflow-hidden, r=glennw

Makes lots of GitHub appear.

r? @glennw
This commit is contained in:
bors-servo 2014-10-13 15:54:41 -06:00
commit a92e55597e
6 changed files with 34 additions and 14 deletions

View file

@ -1097,7 +1097,8 @@ impl BlockFlow {
DList::new())); DList::new()));
} }
accumulator.finish(&mut *self, display_list); accumulator.finish(&mut display_list);
self.base.display_list = display_list;
self.base.layers = child_layers self.base.layers = child_layers
} }

View file

@ -1833,8 +1833,11 @@ pub struct ChildDisplayListAccumulator {
impl ChildDisplayListAccumulator { impl ChildDisplayListAccumulator {
/// Creates a `ChildDisplayListAccumulator` from the `overflow` property in the given style. /// Creates a `ChildDisplayListAccumulator` from the `overflow` property in the given style.
fn new(style: &ComputedValues, bounds: Rect<Au>, node: OpaqueNode, fn new(style: &ComputedValues,
level: StackingLevel, may_need_clip: bool) bounds: Rect<Au>,
node: OpaqueNode,
level: StackingLevel,
may_need_clip: bool)
-> ChildDisplayListAccumulator { -> ChildDisplayListAccumulator {
ChildDisplayListAccumulator { ChildDisplayListAccumulator {
clip_display_item: match (may_need_clip, style.get_box().overflow) { clip_display_item: match (may_need_clip, style.get_box().overflow) {
@ -1869,9 +1872,9 @@ impl ChildDisplayListAccumulator {
} }
} }
/// Consumes this accumulator and pushes the clipping item, if any, onto the display list /// Consumes this accumulator and pushes the clipping item, if any, onto the given display
/// associated with the given flow, along with the items in the given display list. /// list.
pub fn finish(self, parent: &mut Flow, mut display_list: DisplayList) { pub fn finish(self, display_list: &mut DisplayList) {
let ChildDisplayListAccumulator { let ChildDisplayListAccumulator {
clip_display_item clip_display_item
} = self; } = self;
@ -1879,6 +1882,5 @@ impl ChildDisplayListAccumulator {
None => {} None => {}
Some(clip_display_item) => display_list.push(ClipDisplayItemClass(clip_display_item)), Some(clip_display_item) => display_list.push(ClipDisplayItemClass(clip_display_item)),
} }
flow::mut_base(parent).display_list = display_list
} }
} }

View file

@ -786,11 +786,13 @@ impl InlineFlow {
let rel_offset = fragment.relative_position(&self.base let rel_offset = fragment.relative_position(&self.base
.absolute_position_info .absolute_position_info
.relative_containing_block_size); .relative_containing_block_size);
let fragment_position = self.base
.abs_position
.add_size(&rel_offset.to_physical(self.base.writing_mode));
let mut accumulator = fragment.build_display_list(&mut self.base.display_list, let mut accumulator = fragment.build_display_list(&mut self.base.display_list,
layout_context, layout_context,
self.base.abs_position.add_size( fragment_position,
&rel_offset.to_physical(self.base.writing_mode)), ContentLevel);
ContentLevel);
match fragment.specific { match fragment.specific {
InlineBlockFragment(ref mut block_flow) => { InlineBlockFragment(ref mut block_flow) => {
let block_flow = block_flow.flow_ref.get_mut(); let block_flow = block_flow.flow_ref.get_mut();
@ -798,10 +800,9 @@ impl InlineFlow {
} }
_ => {} _ => {}
} }
}
// TODO(#225): Should `inline-block` elements have flows as children of the inline flow or accumulator.finish(&mut self.base.display_list);
// should the flow be nested inside the fragment somehow? }
// For now, don't traverse the subtree rooted here. // For now, don't traverse the subtree rooted here.
} }

View file

@ -172,3 +172,4 @@ fragment=top != ../html/acid2.html acid2_ref.html
== pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html == pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html
== many_brs_a.html many_brs_ref.html == many_brs_a.html many_brs_ref.html
== box_sizing_sanity_check_a.html box_sizing_sanity_check_ref.html == box_sizing_sanity_check_a.html box_sizing_sanity_check_ref.html
== inline_block_overflow_hidden_a.html inline_block_overflow_hidden_ref.html

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<div style="display: inline-block; overflow: hidden">This should be visible</div>
</body>
</html>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<div style="display: inline-block">This should be visible</div>
</body>
</html>