servo: Merge #12382 - layout: Clear non-inherited properties on anonymous block (from stshine:anonymous-block); r=SimonSapin

<!-- Please describe your changes on the following line: -->

This is one of my pull requests that imlement basic flexible box layout.
This pull request adds a `modify_style_for_anonymous_flow()` function to use initial values for non-inherited properties and parent values for inherited properties as the flow style. It also set border and outline to zero and set the display property from the parameter. This function may also be reused to modify style of anonymous table object in the future.
Part of code comes from `cascade_anonymous()` from @SimonSapin .

---
<!-- 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 flexbox is not implemented yet.

<!-- 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: 9b01a4cc97af29b81f92a403992d0498d4290f4f
This commit is contained in:
Pu Xingyu
2016-07-11 16:19:52 -07:00
parent 356291c325
commit a32f4286b9
2 changed files with 44 additions and 0 deletions

View File

@@ -1304,6 +1304,9 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
Arc::new(TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide))
},
FlowClass::Flex => {
properties::modify_style_for_anonymous_flow(
&mut style,
display::T::block);
let fragment =
Fragment::from_opaque_node_and_style(node.opaque(),
PseudoElementType::Normal,