servo: Merge #17690 - layout: Stop in-order traversal on children of InlineFlow (from stshine:no-inorder); r=emilio

No need to do in-order traversal for children of InlineFlow, since
they are either inline-block or absolutely positioned elements, which
are guaranteed to be block formatting context.

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because cleanup

<!-- 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: 95bad3f33a9f0af9511011d4a83a9c95322784d5

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : d7ac1e1e92f245f468d4b8a2b01af901390e6db7
This commit is contained in:
Pu Xingyu 2017-07-13 09:53:39 -07:00
Родитель da04cde7ad
Коммит 9c9e796a36
1 изменённых файлов: 2 добавлений и 13 удалений

Просмотреть файл

@ -1420,6 +1420,8 @@ impl Flow for InlineFlow {
}
/// Calculate and set the block-size of this flow. See CSS 2.1 § 10.6.1.
/// Note that we do not need to do in-order traversal becase the children
/// are always block formatting context.
fn assign_block_size(&mut self, layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("inline::assign_block_size {:x}",
self.base.debug_id());
@ -1484,19 +1486,6 @@ impl Flow for InlineFlow {
indentation = Au(0)
}
// Assign block sizes for any inline-block descendants.
let thread_id = self.base.thread_id;
for kid in self.base.child_iter_mut() {
if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) ||
flow::base(kid).flags.is_float() {
continue
}
let content_box = flow::base(kid).position;
kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
thread_id,
content_box);
}
if self.contains_positioned_fragments() {
// Assign block-sizes for all flows in this absolute flow tree.
// This is preorder because the block-size of an absolute flow may depend on