servo: Merge #16285 - layout: Use the margin box of an inline block when computing the inline size (from stshine:inline-block-margin); r=emilio
authorPu Xingyu <pu.stshine@gmail.com>
Mon, 10 Apr 2017 15:07:06 -0500
changeset 560246 92fb427b464c49134341747d146ddef6f43c87b4
parent 560245 d508a91f09e9de268da1b7831c823c6a42f16526
child 560247 88e9938ce64ca0281c4f6ed2dd8ca93a0bfe5100
push id53365
push userjichen@mozilla.com
push dateTue, 11 Apr 2017 08:35:12 +0000
reviewersemilio
milestone55.0a1
servo: Merge #16285 - layout: Use the margin box of an inline block when computing the inline size (from stshine:inline-block-margin); r=emilio <!-- Please describe your changes on the following line: --> When computing the inline size of an inline block in inline formating context, use the margin box of the underling block. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12413 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4013e9d7a0be666343ef9d806408af5c0a852d91
servo/components/layout/fragment.rs
--- a/servo/components/layout/fragment.rs
+++ b/servo/components/layout/fragment.rs
@@ -2375,20 +2375,17 @@ impl Fragment {
     }
 
     /// Determines the inline sizes of inline-block fragments. These cannot be fully computed until
     /// inline size assignment has run for the child flow: thus it is computed "late", during
     /// block size assignment.
     pub fn update_late_computed_replaced_inline_size_if_necessary(&mut self) {
         if let SpecificFragmentInfo::InlineBlock(ref mut inline_block_info) = self.specific {
             let block_flow = FlowRef::deref_mut(&mut inline_block_info.flow_ref).as_block();
-            let margin = block_flow.fragment.style.logical_margin();
-            self.border_box.size.inline = block_flow.fragment.border_box.size.inline +
-                MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
-                MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero()
+            self.border_box.size.inline = block_flow.fragment.margin_box_inline_size();
         }
     }
 
     pub fn update_late_computed_inline_position_if_necessary(&mut self) {
         if let SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) = self.specific {
             let position = self.border_box.start.i;
             FlowRef::deref_mut(&mut info.flow_ref)
                 .update_late_computed_inline_position_if_necessary(position)