diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-01-22 19:57:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-22 19:57:49 -0800 |
commit | c75946c3ed52d262aae585055023becd5a2e9769 (patch) | |
tree | 36da4e4a5afd4ea3dafbc5ec6e0511d55c638d5a /components/layout/construct.rs | |
parent | 27a7999d5d85c9b1156554f597cb0eea592624e1 (diff) | |
parent | e31ee04dad52d80af33762aad13d500aff087041 (diff) | |
download | servo-c75946c3ed52d262aae585055023becd5a2e9769.tar.gz servo-c75946c3ed52d262aae585055023becd5a2e9769.zip |
Auto merge of #14978 - shinglyu:inline-flex, r=notriddle
Implemented display: inline-flex
<!-- Please describe your changes on the following line: -->
---
<!-- 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 #14685 (github issue number if applicable).
<!-- Either: -->
- [x] There are tests for these changes
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14978)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r-- | components/layout/construct.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 6671a07b4ad..95603f8dea7 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -937,9 +937,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> ConstructionResult::ConstructionItem(construction_item) } - fn build_fragment_for_inline_block(&mut self, node: &ConcreteThreadSafeLayoutNode) - -> ConstructionResult { - let block_flow_result = self.build_flow_for_block(node, None); + /// Build the fragment for an inline-block or inline-flex, based on the `display` flag + fn build_fragment_for_inline_block_or_inline_flex(&mut self, node: &ConcreteThreadSafeLayoutNode, + display: display::T) -> ConstructionResult { + let block_flow_result = match display { + display::T::inline_block => self.build_flow_for_block(node, None), + display::T::inline_flex => self.build_flow_for_flex(node, None), + _ => panic!("The flag should be inline-block or inline-flex") + }; let (block_flow, abs_descendants) = match block_flow_result { ConstructionResult::Flow(block_flow, abs_descendants) => (block_flow, abs_descendants), _ => unreachable!() @@ -1548,7 +1553,8 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS // Inline-block items contribute inline fragment construction results. (display::T::inline_block, float::T::none, _) => { - let construction_result = self.build_fragment_for_inline_block(node); + let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node, + display::T::inline_block); self.set_flow_construction_result(node, construction_result) } @@ -1597,6 +1603,12 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS self.set_flow_construction_result(node, construction_result) } + (display::T::inline_flex, _, _) => { + let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node, + display::T::inline_flex); + self.set_flow_construction_result(node, construction_result) + } + // Block flows that are not floated contribute block flow construction results. // // TODO(pcwalton): Make this only trigger for blocks and handle the other `display` |