mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout_2020: Implement support for backface-visibility
This commit is contained in:
parent
7d7e987ba0
commit
c2875482d6
14 changed files with 37 additions and 32 deletions
|
@ -8,6 +8,7 @@ use crate::ContainingBlock;
|
|||
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
|
||||
use style::computed_values::position::T as ComputedPosition;
|
||||
use style::computed_values::transform_style::T as ComputedTransformStyle;
|
||||
use style::properties::longhands::backface_visibility::computed_value::T as BackfaceVisiblity;
|
||||
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::image::Image as ComputedImageLayer;
|
||||
|
@ -17,6 +18,7 @@ use style::values::generics::box_::Perspective;
|
|||
use style::values::generics::length::MaxSize;
|
||||
use style::values::specified::box_ as stylo;
|
||||
use style::Zero;
|
||||
use webrender_api as wr;
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub(crate) enum Display {
|
||||
|
@ -90,6 +92,7 @@ pub(crate) trait ComputedValuesExt {
|
|||
fn establishes_containing_block(&self) -> bool;
|
||||
fn establishes_containing_block_for_all_descendants(&self) -> bool;
|
||||
fn background_is_transparent(&self) -> bool;
|
||||
fn get_webrender_primitive_flags(&self) -> wr::PrimitiveFlags;
|
||||
}
|
||||
|
||||
impl ComputedValuesExt for ComputedValues {
|
||||
|
@ -375,6 +378,15 @@ impl ComputedValuesExt for ComputedValues {
|
|||
.iter()
|
||||
.all(|layer| matches!(layer, ComputedImageLayer::None))
|
||||
}
|
||||
|
||||
/// Generate appropriate WebRender `PrimitiveFlags` that should be used
|
||||
/// for display items generated by the `Fragment` which owns this style.
|
||||
fn get_webrender_primitive_flags(&self) -> wr::PrimitiveFlags {
|
||||
match self.get_box().backface_visibility {
|
||||
BackfaceVisiblity::Visible => wr::PrimitiveFlags::default(),
|
||||
BackfaceVisiblity::Hidden => wr::PrimitiveFlags::empty(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<stylo::Display> for Display {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue