style: Rename overflow:-moz-hidden-unscrollable to overflow:clip.

Differential Revision: https://phabricator.services.mozilla.com/D73716
This commit is contained in:
Jeremy Ir 2020-08-01 01:56:58 +00:00 committed by Emilio Cobos Álvarez
parent 8f89ebffec
commit 9bfcb3d741
2 changed files with 24 additions and 4 deletions

View file

@ -499,10 +499,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
{
// overflow: clip is deprecated, so convert to hidden if it's
// specified in only one dimension.
if overflow_x == Overflow::MozHiddenUnscrollable {
if overflow_x == Overflow::Clip {
overflow_x = Overflow::Hidden;
}
if overflow_y == Overflow::MozHiddenUnscrollable {
if overflow_y == Overflow::Clip {
overflow_y = Overflow::Hidden;
}
}
@ -560,7 +560,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
let overflow_y = box_style.clone_overflow_y();
fn scrollable(v: Overflow) -> bool {
v != Overflow::MozHiddenUnscrollable && v != Overflow::Visible
v != Overflow::Clip && v != Overflow::Visible
}
// If at least one is scrollable we'll adjust the other one in

View file

@ -1991,5 +1991,25 @@ pub enum Overflow {
Scroll,
Auto,
#[cfg(feature = "gecko")]
MozHiddenUnscrollable,
#[parse(aliases = "-moz-hidden-unscrollable")]
Clip,
}
impl Overflow {
/// Return true if the value will create a scrollable box.
#[inline]
pub fn is_scrollable(&self) -> bool {
matches!(*self, Self::Hidden | Self::Scroll | Self::Auto)
}
/// Convert the value to a scrollable value if it's not already scrollable.
/// This maps `visible` to `auto` and `clip` to `hidden`.
#[inline]
pub fn to_scrollable(&self) -> Self {
match *self {
Self::Hidden | Self::Scroll | Self::Auto => *self,
Self::Visible => Self::Auto,
#[cfg(feature = "gecko")]
Self::Clip => Self::Hidden,
}
}
}