mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 775618 - Introduce the concept of legacy shorthands. r=heycam
We need this because there's a weird mapping between these properties' values ('always' maps to 'page'). See https://drafts.csswg.org/css-cascade-4/#legacy-shorthand. Differential Revision: https://phabricator.services.mozilla.com/D12213 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c76f00a8ad
commit
cd451a8c96
@ -917,6 +917,10 @@ impl PropertyDeclarationBlock {
|
||||
}
|
||||
already_serialized.insert(shorthand.into());
|
||||
|
||||
if shorthand.is_legacy_shorthand() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Substep 2 & 3
|
||||
let mut current_longhands = SmallVec::<[_; 10]>::new();
|
||||
let mut important_count = 0;
|
||||
|
@ -948,6 +948,10 @@ bitflags! {
|
||||
/// This property's getComputedStyle implementation requires layout
|
||||
/// to be flushed.
|
||||
const GETCS_NEEDS_LAYOUT_FLUSH = 1 << 6;
|
||||
/// This property is a legacy shorthand.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-cascade/#legacy-shorthand
|
||||
const IS_LEGACY_SHORTHAND = 1 << 7;
|
||||
|
||||
/* The following flags are currently not used in Rust code, they
|
||||
* only need to be listed in corresponding properties so that
|
||||
@ -1461,17 +1465,24 @@ impl ShorthandId {
|
||||
None
|
||||
}
|
||||
|
||||
/// Returns PropertyFlags for given shorthand property.
|
||||
pub fn flags(&self) -> PropertyFlags {
|
||||
match *self {
|
||||
/// Returns PropertyFlags for the given shorthand property.
|
||||
#[inline]
|
||||
pub fn flags(self) -> PropertyFlags {
|
||||
const FLAGS: [u8; ${len(data.shorthands)}] = [
|
||||
% for property in data.shorthands:
|
||||
ShorthandId::${property.camel_case} =>
|
||||
% for flag in property.flags:
|
||||
PropertyFlags::${flag} |
|
||||
% endfor
|
||||
PropertyFlags::empty(),
|
||||
% for flag in property.flags:
|
||||
PropertyFlags::${flag}.bits |
|
||||
% endfor
|
||||
0,
|
||||
% endfor
|
||||
}
|
||||
];
|
||||
PropertyFlags::from_bits_truncate(FLAGS[self as usize])
|
||||
}
|
||||
|
||||
/// Returns whether this property is a legacy shorthand.
|
||||
#[inline]
|
||||
pub fn is_legacy_shorthand(self) -> bool {
|
||||
self.flags().contains(PropertyFlags::IS_LEGACY_SHORTHAND)
|
||||
}
|
||||
|
||||
/// Returns the order in which this property appears relative to other
|
||||
|
Loading…
Reference in New Issue
Block a user