Auto merge of #16891 - kvark:preserve3d, r=glennw,emilio

Using TransformStyle::Preserve3D

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

The changes were reviewed previously as a part of WR update PRs, but then we decided to move them out.
r? @emilio

---
<!-- 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: -->
- [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. -->

<!-- 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/16891)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-17 20:38:14 -05:00 committed by GitHub
commit a5ff57b20f
9 changed files with 79 additions and 57 deletions

View file

@ -1954,33 +1954,30 @@ impl ComputedValues {
))
}
/// https://drafts.csswg.org/css-transforms/#grouping-property-values
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
/// Return true if the effects force the transform style to be Flat
pub fn overrides_transform_style(&self) -> bool {
use computed_values::mix_blend_mode;
use computed_values::transform_style;
let effects = self.get_effects();
// TODO(gw): Add clip-path, isolation, mask-image, mask-border-source when supported.
effects.opacity < 1.0 ||
!effects.filter.is_empty() ||
!effects.clip.is_auto() ||
effects.mix_blend_mode != mix_blend_mode::T::normal
}
/// https://drafts.csswg.org/css-transforms/#grouping-property-values
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
use computed_values::transform_style;
let box_ = self.get_box();
// TODO(gw): Add clip-path, isolation, mask-image, mask-border-source when supported.
if effects.opacity < 1.0 ||
!effects.filter.is_empty() ||
!effects.clip.is_auto() {
effects.mix_blend_mode != mix_blend_mode::T::normal ||
return transform_style::T::flat;
if self.overrides_transform_style() {
transform_style::T::flat
} else {
// Return the computed value if not overridden by the above exceptions
box_.transform_style
}
if box_.transform_style == transform_style::T::auto {
if box_.transform.0.is_some() {
return transform_style::T::flat;
}
if let Either::First(ref _length) = box_.perspective {
return transform_style::T::flat;
}
}
// Return the computed value if not overridden by the above exceptions
box_.transform_style
}
/// Whether given this transform value, the compositor would require a