mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Auto merge of #16577 - emilio:adjust-overflow, r=Wafflespeanut
style: Refactor overflow fixup to account for overflow: clip. This is the missing piece to make the remaining contain tests not assert on Gecko. <!-- 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/16577) <!-- Reviewable:end -->
This commit is contained in:
commit
c65dea95d7
1 changed files with 38 additions and 16 deletions
|
@ -2436,33 +2436,55 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
||||||
use computed_values::overflow_x::T as overflow;
|
use computed_values::overflow_x::T as overflow;
|
||||||
use computed_values::overflow_y;
|
use computed_values::overflow_y;
|
||||||
|
|
||||||
let overflow_x = style.get_box().clone_overflow_x();
|
let original_overflow_x = style.get_box().clone_overflow_x();
|
||||||
let overflow_y = style.get_box().clone_overflow_y().0;
|
let original_overflow_y = style.get_box().clone_overflow_y().0;
|
||||||
match (overflow_x == longhands::overflow_x::computed_value::T::visible,
|
let mut overflow_x = original_overflow_x;
|
||||||
overflow_y == longhands::overflow_x::computed_value::T::visible) {
|
let mut overflow_y = original_overflow_y;
|
||||||
(true, true) => {}
|
|
||||||
(true, _) => {
|
// CSS3 overflow-x and overflow-y require some fixup as well in some
|
||||||
style.mutate_box().set_overflow_x(overflow::auto);
|
// cases. overflow: clip and overflow: visible are meaningful only when
|
||||||
|
// used in both dimensions.
|
||||||
|
if overflow_x != overflow_y {
|
||||||
|
// If 'visible' is specified but doesn't match the other dimension,
|
||||||
|
// it turns into 'auto'.
|
||||||
|
if overflow_x == overflow::visible {
|
||||||
|
overflow_x = overflow::auto;
|
||||||
}
|
}
|
||||||
(_, true) => {
|
if overflow_y == overflow::visible {
|
||||||
style.mutate_box().set_overflow_y(overflow_y::T(overflow::auto));
|
overflow_y = overflow::auto;
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
|
% if product == "gecko":
|
||||||
|
// overflow: clip is deprecated, so convert to hidden if it's
|
||||||
|
// specified in only one dimension.
|
||||||
|
if overflow_x == overflow::clip {
|
||||||
|
overflow_x = overflow::hidden;
|
||||||
|
}
|
||||||
|
if overflow_y == overflow::clip {
|
||||||
|
overflow_y = overflow::hidden;
|
||||||
|
}
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
|
|
||||||
% if product == "gecko":
|
% if product == "gecko":
|
||||||
use properties::longhands::contain;
|
use properties::longhands::contain;
|
||||||
// When 'contain: paint', update overflow from 'visible' to 'clip'.
|
// When 'contain: paint', update overflow from 'visible' to 'clip'.
|
||||||
let contain = style.get_box().clone_contain();
|
if style.get_box().clone_contain().contains(contain::PAINT) {
|
||||||
if contain.contains(contain::PAINT) {
|
if overflow_x == overflow::visible {
|
||||||
if let longhands::overflow_x::computed_value::T::visible = overflow_x {
|
overflow_x = overflow::clip;
|
||||||
style.mutate_box().set_overflow_x(overflow::clip);
|
|
||||||
}
|
}
|
||||||
if let longhands::overflow_x::computed_value::T::visible = overflow_y {
|
if overflow_y == overflow::visible {
|
||||||
style.mutate_box().set_overflow_y(overflow_y::T(overflow::clip));
|
overflow_y = overflow::clip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
if overflow_x != original_overflow_x ||
|
||||||
|
overflow_y != original_overflow_y {
|
||||||
|
let mut box_style = style.mutate_box();
|
||||||
|
box_style.set_overflow_x(overflow_x);
|
||||||
|
box_style.set_overflow_y(overflow_y::T(overflow_y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
% if product == "gecko":
|
% if product == "gecko":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue