Reorganize bits and make the flags usize.

These are never stored persistently anywhere, and I'm pretty sure it's slower
for the compiler/CPU to operate on non-word-sized flags.

MozReview-Commit-ID: LQNsJbUsw85
This commit is contained in:
Bobby Holley 2017-04-21 18:14:29 -07:00
parent 60f846b2ca
commit e4ed69c52b

View file

@ -17,24 +17,24 @@ bitflags! {
/// the selector matching process. /// the selector matching process.
/// ///
/// This is used to implement efficient sharing. /// This is used to implement efficient sharing.
pub flags StyleRelations: u16 { pub flags StyleRelations: usize {
/// Whether this element is affected by an ID selector. /// Whether this element is affected by an ID selector.
const AFFECTED_BY_ID_SELECTOR = 1 << 3, const AFFECTED_BY_ID_SELECTOR = 1 << 0,
/// Whether this element has a style attribute. Computed /// Whether this element has a style attribute. Computed
/// externally. /// externally.
const AFFECTED_BY_STYLE_ATTRIBUTE = 1 << 6, const AFFECTED_BY_STYLE_ATTRIBUTE = 1 << 1,
/// Whether this element is affected by presentational hints. This is /// Whether this element is affected by presentational hints. This is
/// computed externally (that is, in Servo). /// computed externally (that is, in Servo).
const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 7, const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 2,
/// Whether this element has pseudo-element styles. Computed externally. /// Whether this element has pseudo-element styles. Computed externally.
const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 8, const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 3,
} }
} }
bitflags! { bitflags! {
/// Set of flags that are set on either the element or its parent (depending /// Set of flags that are set on either the element or its parent (depending
/// on the flag) if the element could potentially match a selector. /// on the flag) if the element could potentially match a selector.
pub flags ElementSelectorFlags: u8 { pub flags ElementSelectorFlags: usize {
/// When a child is added or removed from the parent, all the children /// When a child is added or removed from the parent, all the children
/// must be restyled, because they may match :nth-last-child, /// must be restyled, because they may match :nth-last-child,
/// :last-of-type, :nth-last-of-type, or :only-of-type. /// :last-of-type, :nth-last-of-type, or :only-of-type.