Remove unneeded clones and add some comments.

This commit is contained in:
Glenn Watson 2014-09-26 19:26:55 +10:00
parent 26cf00ef4e
commit 71758643dc
4 changed files with 10 additions and 3 deletions

View file

@ -419,7 +419,7 @@ impl<'a> FlowConstructor<'a> {
// between block elements, and retained when between inline elements.
let fragment_info = UnscannedTextFragment(UnscannedTextFragmentInfo::from_text(" ".to_string()));
let mut fragment = Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_style.clone(),
whitespace_style,
fragment_info);
inline_fragment_accumulator.fragments.push(&mut fragment);
}
@ -583,7 +583,7 @@ impl<'a> FlowConstructor<'a> {
// Instantiate the whitespace fragment.
let fragment_info = UnscannedTextFragment(UnscannedTextFragmentInfo::from_text(" ".to_string()));
let mut fragment = Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_style.clone(),
whitespace_style,
fragment_info);
fragment_accumulator.fragments.push(&mut fragment)
}

View file

@ -619,6 +619,10 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
&Some(ref mut layout_data) => {
match self.type_id() {
Some(TextNodeTypeId) => {
// Text nodes get a copy of the parent style. This ensures
// that during fragment construction any non-inherited
// CSS properties (such as vertical-align) are correctly
// set on the fragment(s).
let cloned_parent_style = parent_style.unwrap().clone();
layout_data.shared_data.style = Some(cloned_parent_style);
}

View file

@ -917,6 +917,9 @@ impl InlineFlow {
let mut block_size_above_baseline = inline_metrics.block_size_above_baseline;
let mut depth_below_baseline = inline_metrics.depth_below_baseline;
// CSS section 10.8
// line-height of any inline element specifies the minimal height of line
// boxes within the element.
for frag in self.fragments.fragments.iter() {
match frag.inline_context {
Some(ref inline_context) => {

View file

@ -106,7 +106,7 @@ fragment=top != ../html/acid2.html acid2_ref.html
# Should be != with expected failure:
# FIXME: use the real test when pixel-snapping for scrolling is fixed.
#fragment=top == ../html/acid2.html acid2_ref_broken.html
== acid2_noscroll.html acid2_ref_broken.html
flaky_linux == acid2_noscroll.html acid2_ref_broken.html
!= inline_background_a.html inline_background_ref.html
== inline_element_border_a.html inline_element_border_ref.html