mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
contain: paint
should update overflow and display properties
This commit is contained in:
parent
aa077ed40a
commit
fe47726b7c
2 changed files with 34 additions and 3 deletions
|
@ -2076,7 +2076,7 @@ ${helpers.single_keyword("transform-style",
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="contain" animation_type="none" products="none"
|
||||
<%helpers:longhand name="contain" animation_type="none" products="none" need_clone="True"
|
||||
spec="https://drafts.csswg.org/css-contain/#contain-property">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
|
|
@ -2407,8 +2407,11 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
{
|
||||
use computed_values::overflow_x::T as overflow;
|
||||
use computed_values::overflow_y;
|
||||
match (style.get_box().clone_overflow_x() == longhands::overflow_x::computed_value::T::visible,
|
||||
style.get_box().clone_overflow_y().0 == longhands::overflow_x::computed_value::T::visible) {
|
||||
|
||||
let overflow_x = style.get_box().clone_overflow_x();
|
||||
let overflow_y = style.get_box().clone_overflow_y().0;
|
||||
match (overflow_x == longhands::overflow_x::computed_value::T::visible,
|
||||
overflow_y == longhands::overflow_x::computed_value::T::visible) {
|
||||
(true, true) => {}
|
||||
(true, _) => {
|
||||
style.mutate_box().set_overflow_x(overflow::auto);
|
||||
|
@ -2418,7 +2421,35 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
% if product == "gecko":
|
||||
use properties::longhands::contain;
|
||||
// When 'contain: paint', update overflow from 'visible' to 'clip'.
|
||||
let contain = style.get_box().clone_contain();
|
||||
if contain.contains(contain::PAINT) {
|
||||
if let longhands::overflow_x::computed_value::T::visible = overflow_x {
|
||||
style.mutate_box().set_overflow_x(overflow::clip);
|
||||
}
|
||||
if let longhands::overflow_x::computed_value::T::visible = overflow_y {
|
||||
style.mutate_box().set_overflow_y(overflow_y::T(overflow::clip));
|
||||
}
|
||||
}
|
||||
% endif
|
||||
}
|
||||
|
||||
% if product == "gecko":
|
||||
{
|
||||
use computed_values::display::T as display;
|
||||
use properties::longhands::contain;
|
||||
// An element with contain:paint or contain:layout needs to "be a
|
||||
// formatting context"
|
||||
let contain = style.get_box().clone_contain();
|
||||
if contain.contains(contain::PAINT) &&
|
||||
style.get_box().clone_display() == display::inline {
|
||||
style.mutate_box().set_adjusted_display(display::inline_block);
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
||||
// CSS 2.1 section 9.7:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue