mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add flags to longhands for gecko glue
The flags are creates_stacking_context, fixpos_cb and abspos_cb. These will be needed in will-change glue.
This commit is contained in:
parent
56b8c1d8b7
commit
a3862780ac
6 changed files with 55 additions and 2 deletions
|
@ -96,7 +96,8 @@ class Longhand(object):
|
|||
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
|
||||
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
|
||||
allowed_in_keyframe_block=True, complex_color=False, cast_type='u8',
|
||||
has_uncacheable_values=False, logical=False, alias=None, extra_prefixes=None, boxed=False):
|
||||
has_uncacheable_values=False, logical=False, alias=None, extra_prefixes=None, boxed=False,
|
||||
creates_stacking_context=False, fixpos_cb=False, abspos_cb=False):
|
||||
self.name = name
|
||||
if not spec:
|
||||
raise TypeError("Spec should be specified for %s" % name)
|
||||
|
@ -120,6 +121,9 @@ class Longhand(object):
|
|||
self.alias = alias.split() if alias else []
|
||||
self.extra_prefixes = extra_prefixes.split() if extra_prefixes else []
|
||||
self.boxed = arg_to_bool(boxed)
|
||||
self.creates_stacking_context = arg_to_bool(creates_stacking_context)
|
||||
self.fixpos_cb = arg_to_bool(fixpos_cb)
|
||||
self.abspos_cb = arg_to_bool(abspos_cb)
|
||||
|
||||
# https://drafts.csswg.org/css-animations/#keyframes
|
||||
# > The <declaration-list> inside of <keyframe-block> accepts any CSS property
|
||||
|
|
|
@ -108,6 +108,8 @@ ${helpers.single_keyword("-moz-top-layer", "none top",
|
|||
need_clone="True"
|
||||
extra_gecko_values="sticky"
|
||||
animatable="False"
|
||||
creates_stacking_context="True"
|
||||
abspos_cb="True"
|
||||
spec="https://drafts.csswg.org/css-position/#position-property">
|
||||
impl SpecifiedValue {
|
||||
pub fn is_absolutely_positioned_style(&self) -> bool {
|
||||
|
@ -1116,6 +1118,8 @@ ${helpers.predefined_type("scroll-snap-coordinate",
|
|||
|
||||
<%helpers:longhand name="transform" products="gecko servo" extra_prefixes="webkit"
|
||||
animatable="True"
|
||||
creates_stacking_context="True"
|
||||
fixpos_cb="True"
|
||||
spec="https://drafts.csswg.org/css-transforms/#propdef-transform">
|
||||
use app_units::Au;
|
||||
use style_traits::ToCss;
|
||||
|
@ -1672,6 +1676,7 @@ ${helpers.single_keyword("isolation",
|
|||
"auto isolate",
|
||||
products="gecko",
|
||||
spec="https://drafts.fxtf.org/compositing/#isolation",
|
||||
creates_stacking_context=True,
|
||||
animatable=False)}
|
||||
|
||||
// TODO add support for logical values recto and verso
|
||||
|
@ -1710,6 +1715,8 @@ ${helpers.predefined_type("perspective",
|
|||
spec="https://drafts.csswg.org/css-transforms/#perspective",
|
||||
extra_prefixes="moz webkit",
|
||||
boxed=True,
|
||||
creates_stacking_context=True,
|
||||
fixpos_cb=True,
|
||||
animatable=True)}
|
||||
|
||||
// FIXME: This prop should be animatable
|
||||
|
@ -1819,6 +1826,8 @@ ${helpers.single_keyword("transform-style",
|
|||
"flat preserve-3d",
|
||||
spec="https://drafts.csswg.org/css-transforms/#transform-style-property",
|
||||
extra_prefixes="moz webkit",
|
||||
creates_stacking_context=True,
|
||||
fixpos_cb=True,
|
||||
animatable=False)}
|
||||
|
||||
<%helpers:longhand name="transform-origin" animatable="True" extra_prefixes="moz webkit" boxed="True"
|
||||
|
|
|
@ -11,6 +11,7 @@ ${helpers.predefined_type("opacity",
|
|||
"Opacity",
|
||||
"1.0",
|
||||
animatable=True,
|
||||
creates_stacking_context=True,
|
||||
spec="https://drafts.csswg.org/css-color/#opacity")}
|
||||
|
||||
<%helpers:vector_longhand name="box-shadow" allow_empty="True"
|
||||
|
@ -86,6 +87,8 @@ ${helpers.predefined_type("clip",
|
|||
|
||||
// FIXME: This prop should be animatable
|
||||
<%helpers:longhand name="filter" animatable="False" extra_prefixes="webkit"
|
||||
creates_stacking_context="True"
|
||||
fixpos_cb="True"
|
||||
spec="https://drafts.fxtf.org/filters/#propdef-filter">
|
||||
//pub use self::computed_value::T as SpecifiedValue;
|
||||
use cssparser;
|
||||
|
@ -516,4 +519,5 @@ ${helpers.single_keyword("mix-blend-mode",
|
|||
color-burn hard-light soft-light difference exclusion hue
|
||||
saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND",
|
||||
animatable=False,
|
||||
creates_stacking_context=True,
|
||||
spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
${helpers.predefined_type("z-index", "IntegerOrAuto",
|
||||
"Either::Second(Auto)",
|
||||
spec="https://www.w3.org/TR/CSS2/visuren.html#z-index",
|
||||
creates_stacking_context=True,
|
||||
animatable="True")}
|
||||
|
||||
// CSS Flexible Box Layout Module Level 1
|
||||
|
|
|
@ -59,6 +59,7 @@ ${helpers.single_keyword("mask-type", "luminance alpha",
|
|||
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-type")}
|
||||
|
||||
<%helpers:longhand name="clip-path" animatable="False" products="gecko" boxed="True"
|
||||
creates_stacking_context="True"
|
||||
spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -189,7 +190,8 @@ ${helpers.single_keyword("mask-composite",
|
|||
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")}
|
||||
|
||||
<%helpers:vector_longhand name="mask-image" products="gecko" animatable="False" extra_prefixes="webkit"
|
||||
has_uncacheable_values="${product == 'gecko'}",
|
||||
has_uncacheable_values="${product == 'gecko'}"
|
||||
creates_stacking_context="True"
|
||||
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
|
|
@ -420,6 +420,20 @@ impl Parse for CSSWideKeyword {
|
|||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
/// A set of flags for properties.
|
||||
pub flags PropertyFlags: u8 {
|
||||
/// This property requires a stacking context.
|
||||
const CREATES_STACKING_CONTEXT = 0x01,
|
||||
/// This property has values that can establish a containing block for
|
||||
/// fixed positioned and absolutely positioned elements.
|
||||
const FIXPOS_CB = 0x02,
|
||||
/// This property has values that can establish a containing block for
|
||||
/// absolutely positioned elements.
|
||||
const ABSPOS_CB = 0x04,
|
||||
}
|
||||
}
|
||||
|
||||
/// An identifier for a given longhand property.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -458,6 +472,25 @@ impl LonghandId {
|
|||
_ => *self
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns PropertyFlags for given property.
|
||||
pub fn flags(&self) -> PropertyFlags {
|
||||
match *self {
|
||||
% for property in data.longhands:
|
||||
LonghandId::${property.camel_case} =>
|
||||
%if property.creates_stacking_context:
|
||||
CREATES_STACKING_CONTEXT |
|
||||
%endif
|
||||
%if property.fixpos_cb:
|
||||
FIXPOS_CB |
|
||||
%endif
|
||||
%if property.abspos_cb:
|
||||
ABSPOS_CB |
|
||||
%endif
|
||||
PropertyFlags::empty(),
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An identifier for a given shorthand property.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue