diff options
author | Clark Gaebel <cgaebel@mozilla.com> | 2014-10-21 14:26:22 -0700 |
---|---|---|
committer | Clark Gaebel <cgaebel@mozilla.com> | 2014-10-21 14:26:22 -0700 |
commit | b31f9e01881b92d18bae5891dc4784233bf713fe (patch) | |
tree | a51efc1c40c51388f7785b6f205b392af3b0393e | |
parent | 156ca98236a57ee52ff5b68741bc7783ba073612 (diff) | |
download | servo-b31f9e01881b92d18bae5891dc4784233bf713fe.tar.gz servo-b31f9e01881b92d18bae5891dc4784233bf713fe.zip |
properly incrementally set block size
-rw-r--r-- | components/layout/fragment.rs | 18 | ||||
-rw-r--r-- | components/layout/inline.rs | 4 | ||||
-rw-r--r-- | components/layout/text.rs | 6 |
3 files changed, 13 insertions, 15 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 1546605fdf0..e08405e089d 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -380,19 +380,19 @@ pub struct ScannedTextFragmentInfo { /// fragments, it will have to be restored. pub original_new_line_pos: Option<Vec<CharIndex>>, - /// The inline-size of the text fragment. - pub content_inline_size: Au, + /// The intrinsic size of the text fragment. + pub content_size: LogicalSize<Au>, } impl ScannedTextFragmentInfo { /// Creates the information specific to a scanned text fragment from a range and a text run. - pub fn new(run: Arc<Box<TextRun>>, range: Range<CharIndex>, content_inline_size: Au) + pub fn new(run: Arc<Box<TextRun>>, range: Range<CharIndex>, content_size: LogicalSize<Au>) -> ScannedTextFragmentInfo { ScannedTextFragmentInfo { run: run, range: range, original_new_line_pos: None, - content_inline_size: content_inline_size, + content_size: content_size, } } } @@ -603,7 +603,7 @@ impl Fragment { let new_border_box = LogicalRect::from_point_size(self.style.writing_mode, self.border_box.start, size); - info.content_inline_size = size.inline; + info.content_size = size.clone(); Fragment { node: self.node, @@ -821,7 +821,7 @@ impl Fragment { } }; - self.border_padding = border + padding + self.border_padding = border + padding; } // Return offset from original position because of `position: relative`. @@ -1705,7 +1705,7 @@ impl Fragment { ScannedTextFragment(ref info) => { // Scanned text fragments will have already had their content inline-sizes assigned // by this point. - self.border_box.size.inline = info.content_inline_size + noncontent_inline_size + self.border_box.size.inline = info.content_size.inline + noncontent_inline_size } ImageFragment(ref mut image_fragment_info) => { // TODO(ksh8281): compute border,margin @@ -1805,10 +1805,10 @@ impl Fragment { image_fragment_info.computed_block_size = Some(block_size); self.border_box.size.block = block_size + noncontent_block_size } - ScannedTextFragment(_) => { + ScannedTextFragment(ref info) => { // Scanned text fragments' content block-sizes are calculated by the text run // scanner during flow construction. - self.border_box.size.block = self.border_box.size.block + noncontent_block_size + self.border_box.size.block = info.content_size.block + noncontent_block_size } InlineBlockFragment(ref mut info) => { // Not the primary fragment, so we do not take the noncontent size into account. diff --git a/components/layout/inline.rs b/components/layout/inline.rs index bdfc9474fe7..c103b57cecf 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -408,7 +408,7 @@ impl LineBreaker { ScannedTextFragmentInfo::new( run.clone(), split.range, - in_fragment.border_box.size.inline); + in_fragment.border_box.size); let size = LogicalSize::new( writing_mode, split.inline_size, in_fragment.border_box.size.block); in_fragment.transform(size, info) @@ -499,7 +499,7 @@ impl LineBreaker { ScannedTextFragmentInfo::new( run.clone(), split.range, - in_fragment.border_box.size.inline); + in_fragment.border_box.size); let size = LogicalSize::new(self.floats.writing_mode, split.inline_size, in_fragment.border_box.size.block); diff --git a/components/layout/text.rs b/components/layout/text.rs index da5fd549697..7889c8a18bc 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -159,9 +159,9 @@ impl TextRunScanner { continue } - let text_inline_size = old_fragment.border_box.size.inline; + let text_size = old_fragment.border_box.size; let new_text_fragment_info = - ScannedTextFragmentInfo::new(run.clone(), range, text_inline_size); + ScannedTextFragmentInfo::new(run.clone(), range, text_size); let new_metrics = new_text_fragment_info.run.metrics_for_range(&range); let bounding_box_size = bounding_box_for_run_metrics(&new_metrics, old_fragment.style.writing_mode); @@ -223,5 +223,3 @@ pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) -> line_height::Length(l) => l } } - - |