mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Implement visibility for layout_2020
This commit is contained in:
parent
9e09e1034f
commit
b85a5dac5d
2 changed files with 34 additions and 21 deletions
|
@ -16,6 +16,7 @@ use net_traits::image_cache::UsePlaceholder;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle;
|
use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle;
|
||||||
use style::dom::OpaqueNode;
|
use style::dom::OpaqueNode;
|
||||||
|
use style::properties::longhands::visibility::computed_value::T as Visibility;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::{BorderStyle, Length, LengthPercentage};
|
use style::values::computed::{BorderStyle, Length, LengthPercentage};
|
||||||
use style::values::specified::text::TextDecorationLine;
|
use style::values::specified::text::TextDecorationLine;
|
||||||
|
@ -93,28 +94,42 @@ impl Fragment {
|
||||||
containing_block: &PhysicalRect<Length>,
|
containing_block: &PhysicalRect<Length>,
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
Fragment::Box(b) => BuilderForBoxFragment::new(b, containing_block).build(builder),
|
Fragment::Box(b) => match b.style.get_inherited_box().visibility {
|
||||||
|
Visibility::Visible => {
|
||||||
|
BuilderForBoxFragment::new(b, containing_block).build(builder)
|
||||||
|
},
|
||||||
|
Visibility::Hidden => (),
|
||||||
|
Visibility::Collapse => (),
|
||||||
|
},
|
||||||
Fragment::AbsoluteOrFixedPositioned(_) => {},
|
Fragment::AbsoluteOrFixedPositioned(_) => {},
|
||||||
Fragment::Anonymous(_) => {},
|
Fragment::Anonymous(_) => {},
|
||||||
Fragment::Image(i) => {
|
Fragment::Image(i) => match i.style.get_inherited_box().visibility {
|
||||||
builder.is_contentful = true;
|
Visibility::Visible => {
|
||||||
let rect = i
|
builder.is_contentful = true;
|
||||||
.rect
|
let rect = i
|
||||||
.to_physical(i.style.writing_mode, containing_block)
|
.rect
|
||||||
.translate(containing_block.origin.to_vector());
|
.to_physical(i.style.writing_mode, containing_block)
|
||||||
|
.translate(containing_block.origin.to_vector());
|
||||||
|
|
||||||
let common = builder.common_properties(rect.to_webrender(), &i.style);
|
let common = builder.common_properties(rect.to_webrender(), &i.style);
|
||||||
builder.wr.push_image(
|
builder.wr.push_image(
|
||||||
&common,
|
&common,
|
||||||
rect.to_webrender(),
|
rect.to_webrender(),
|
||||||
image_rendering(i.style.get_inherited_box().image_rendering),
|
image_rendering(i.style.get_inherited_box().image_rendering),
|
||||||
wr::AlphaType::PremultipliedAlpha,
|
wr::AlphaType::PremultipliedAlpha,
|
||||||
i.image_key,
|
i.image_key,
|
||||||
wr::ColorF::WHITE,
|
wr::ColorF::WHITE,
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
Visibility::Hidden => (),
|
||||||
|
Visibility::Collapse => (),
|
||||||
},
|
},
|
||||||
Fragment::Text(t) => {
|
Fragment::Text(t) => match t.parent_style.get_inherited_box().visibility {
|
||||||
self.build_display_list_for_text_fragment(t, builder, containing_block)
|
Visibility::Visible => {
|
||||||
|
self.build_display_list_for_text_fragment(t, builder, containing_block)
|
||||||
|
},
|
||||||
|
Visibility::Hidden => (),
|
||||||
|
Visibility::Collapse => (),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
// TODO: collapse. Well, do tables first.
|
// TODO: collapse. Well, do tables first.
|
||||||
${helpers.single_keyword(
|
${helpers.single_keyword(
|
||||||
"visibility",
|
"visibility",
|
||||||
"visible hidden",
|
"visible hidden collapse",
|
||||||
engines="gecko servo-2013 servo-2020",
|
engines="gecko servo-2013 servo-2020",
|
||||||
servo_2020_pref="layout.2020.unimplemented",
|
|
||||||
extra_gecko_values="collapse",
|
|
||||||
gecko_ffi_name="mVisible",
|
gecko_ffi_name="mVisible",
|
||||||
animation_value_type="ComputedValue",
|
animation_value_type="ComputedValue",
|
||||||
spec="https://drafts.csswg.org/css-box/#propdef-visibility",
|
spec="https://drafts.csswg.org/css-box/#propdef-visibility",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue