Bug 1852201 - Downgrade bitflags in the dom and style crates. r=emilio

This undoes bug 1835681, adjusting for changes that happened since then,
because the crates don't build with the real bitflags 2, and there are
some challenges to make them work with the real bitflags 2.

Differential Revision: https://phabricator.services.mozilla.com/D187748
This commit is contained in:
Mike Hommey 2023-09-10 22:27:26 +00:00
Родитель 95606652ac
Коммит 5384d789bb
40 изменённых файлов: 48 добавлений и 65 удалений

8
Cargo.lock сгенерированный
Просмотреть файл

@ -1411,7 +1411,7 @@ dependencies = [
name = "dom" name = "dom"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bitflags 2.999.999", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -4811,7 +4811,7 @@ dependencies = [
name = "selectors" name = "selectors"
version = "0.22.0" version = "0.22.0"
dependencies = [ dependencies = [
"bitflags 2.999.999", "bitflags 1.3.2",
"cssparser", "cssparser",
"derive_more 0.99.999", "derive_more 0.99.999",
"fxhash", "fxhash",
@ -5178,7 +5178,7 @@ dependencies = [
"arrayvec", "arrayvec",
"atomic_refcell", "atomic_refcell",
"bindgen 0.66.1", "bindgen 0.66.1",
"bitflags 2.999.999", "bitflags 1.3.2",
"byteorder", "byteorder",
"cssparser", "cssparser",
"derive_more 0.99.999", "derive_more 0.99.999",
@ -5245,7 +5245,7 @@ name = "style_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 2.999.999", "bitflags 1.3.2",
"cssparser", "cssparser",
"euclid", "euclid",
"lazy_static", "lazy_static",

Просмотреть файл

@ -11,4 +11,4 @@ license = "MPL-2.0"
path = "lib.rs" path = "lib.rs"
[dependencies] [dependencies]
bitflags = "2" bitflags = "1.0"

Просмотреть файл

@ -9,7 +9,6 @@ use bitflags::bitflags;
bitflags! { bitflags! {
/// Event-based element states. /// Event-based element states.
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct ElementState: u64 { pub struct ElementState: u64 {
/// The mouse is down on this element. /// The mouse is down on this element.
/// <https://html.spec.whatwg.org/multipage/#selector-active> /// <https://html.spec.whatwg.org/multipage/#selector-active>
@ -148,7 +147,6 @@ bitflags! {
bitflags! { bitflags! {
/// Event-based document states. /// Event-based document states.
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct DocumentState: u64 { pub struct DocumentState: u64 {
/// Window activation status /// Window activation status
const WINDOW_INACTIVE = 1 << 0; const WINDOW_INACTIVE = 1 << 0;

Просмотреть файл

@ -18,7 +18,7 @@ path = "lib.rs"
bench = [] bench = []
[dependencies] [dependencies]
bitflags = "2" bitflags = "1.0"
cssparser = "0.32" cssparser = "0.32"
derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign"] } derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign"] }
fxhash = "0.2" fxhash = "0.2"

Просмотреть файл

@ -168,7 +168,7 @@ fn split_from_end<T>(s: &[T], at: usize) -> (&[T], &[T]) {
bitflags! { bitflags! {
/// Flags that indicate at which point of parsing a selector are we. /// Flags that indicate at which point of parsing a selector are we.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, ToShmem)] #[derive(Default, ToShmem)]
pub (crate) struct SelectorFlags : u8 { pub (crate) struct SelectorFlags : u8 {
const HAS_PSEUDO = 1 << 0; const HAS_PSEUDO = 1 << 0;
const HAS_SLOTTED = 1 << 1; const HAS_SLOTTED = 1 << 1;

Просмотреть файл

@ -28,7 +28,6 @@ pub static RECOMMENDED_SELECTOR_BLOOM_FILTER_SIZE: usize = 4096;
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.
#[derive(Clone, Copy)]
pub struct ElementSelectorFlags: usize { pub struct 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,

Просмотреть файл

@ -77,7 +77,6 @@ fn to_ascii_lowercase(s: &str) -> Cow<str> {
bitflags! { bitflags! {
/// Flags that indicate at which point of parsing a selector are we. /// Flags that indicate at which point of parsing a selector are we.
#[derive(Copy, Clone)]
struct SelectorParsingState: u8 { struct SelectorParsingState: u8 {
/// Whether we should avoid adding default namespaces to selectors that /// Whether we should avoid adding default namespaces to selectors that
/// aren't type or universal selectors. /// aren't type or universal selectors.
@ -1576,7 +1575,6 @@ pub struct RelativeSelector<Impl: SelectorImpl> {
bitflags! { bitflags! {
/// Composition of combinators in a given selector, not traversing selectors of pseudoclasses. /// Composition of combinators in a given selector, not traversing selectors of pseudoclasses.
#[derive(Clone, Debug, Eq, PartialEq)]
struct CombinatorComposition: u8 { struct CombinatorComposition: u8 {
const DESCENDANTS = 1 << 0; const DESCENDANTS = 1 << 0;
const SIBLINGS = 1 << 1; const SIBLINGS = 1 << 1;

Просмотреть файл

@ -62,7 +62,7 @@ pub trait SelectorVisitor: Sized {
bitflags! { bitflags! {
/// The kinds of components the visitor is visiting the selector list of, if any /// The kinds of components the visitor is visiting the selector list of, if any
#[derive(Clone, Copy, Default)] #[derive(Default)]
pub struct SelectorListKind: u8 { pub struct SelectorListKind: u8 {
/// The visitor is inside :not(..) /// The visitor is inside :not(..)
const NEGATION = 1 << 0; const NEGATION = 1 << 0;

Просмотреть файл

@ -30,7 +30,7 @@ gecko_refcount_logging = []
app_units = "0.7" app_units = "0.7"
arrayvec = "0.7" arrayvec = "0.7"
atomic_refcell = "0.1" atomic_refcell = "0.1"
bitflags = "2" bitflags = "1.0"
byteorder = "1.0" byteorder = "1.0"
cssparser = "0.32" cssparser = "0.32"
derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign", "deref", "deref_mut", "from"] } derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign", "deref", "deref_mut", "from"] }

Просмотреть файл

@ -165,7 +165,7 @@ impl ColorSpace {
bitflags! { bitflags! {
/// Flags used when serializing colors. /// Flags used when serializing colors.
#[derive(Clone, Copy, Default, MallocSizeOf, PartialEq, ToShmem)] #[derive(Default, MallocSizeOf, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct ColorFlags : u8 { pub struct ColorFlags : u8 {
/// Marks that this color is in the legacy color format. This flag is /// Marks that this color is in the legacy color format. This flag is

Просмотреть файл

@ -97,7 +97,7 @@ pub enum FontFaceSourceFormatKeyword {
bitflags! { bitflags! {
/// Flags for the @font-face tech() function, indicating font technologies /// Flags for the @font-face tech() function, indicating font technologies
/// required by the resource. /// required by the resource.
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)] #[derive(ToShmem)]
#[repr(C)] #[repr(C)]
pub struct FontFaceSourceTechFlags: u16 { pub struct FontFaceSourceTechFlags: u16 {
/// Font requires OpenType feature support. /// Font requires OpenType feature support.

Просмотреть файл

@ -26,7 +26,6 @@ pub use crate::gecko::snapshot::SnapshotMap;
bitflags! { bitflags! {
// See NonTSPseudoClass::is_enabled_in() // See NonTSPseudoClass::is_enabled_in()
#[derive(Copy, Clone)]
struct NonTSPseudoClassFlag: u8 { struct NonTSPseudoClassFlag: u8 {
const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS = 1 << 0; const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS = 1 << 0;
const PSEUDO_CLASS_ENABLED_IN_CHROME = 1 << 1; const PSEUDO_CLASS_ENABLED_IN_CHROME = 1 << 1;

Просмотреть файл

@ -106,7 +106,7 @@ impl ElementSnapshot for GeckoElementSnapshot {
fn state(&self) -> Option<ElementState> { fn state(&self) -> Option<ElementState> {
if self.has_any(Flags::State) { if self.has_any(Flags::State) {
Some(ElementState::from_bits_retain(self.mState)) Some(ElementState::from_bits_truncate(self.mState))
} else { } else {
None None
} }

Просмотреть файл

@ -709,7 +709,7 @@ impl<'le> GeckoElement<'le> {
#[inline] #[inline]
fn document_state(&self) -> DocumentState { fn document_state(&self) -> DocumentState {
DocumentState::from_bits_retain(self.as_node().owner_doc().0.mDocumentState.bits) DocumentState::from_bits_truncate(self.as_node().owner_doc().0.mDocumentState.bits)
} }
#[inline] #[inline]
@ -1170,7 +1170,7 @@ impl<'le> TElement for GeckoElement<'le> {
#[inline] #[inline]
fn state(&self) -> ElementState { fn state(&self) -> ElementState {
ElementState::from_bits_retain(self.state_internal()) ElementState::from_bits_truncate(self.state_internal())
} }
#[inline] #[inline]

Просмотреть файл

@ -20,7 +20,7 @@ pub fn assert_flags_match() {
impl From<OriginFlags> for OriginSet { impl From<OriginFlags> for OriginSet {
fn from(flags: OriginFlags) -> Self { fn from(flags: OriginFlags) -> Self {
Self::from_bits_retain(flags.0) Self::from_bits_truncate(flags.0)
} }
} }

Просмотреть файл

@ -9,7 +9,6 @@ use crate::traversal_flags::TraversalFlags;
bitflags! { bitflags! {
/// The kind of restyle we need to do for a given element. /// The kind of restyle we need to do for a given element.
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct RestyleHint: u16 { pub struct RestyleHint: u16 {
/// Do a selector match of the element. /// Do a selector match of the element.
const RESTYLE_SELF = 1 << 0; const RESTYLE_SELF = 1 << 0;

Просмотреть файл

@ -25,7 +25,7 @@ pub enum InlineBaseDirection {
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt() // TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
bitflags!( bitflags!(
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Serialize)] #[derive(MallocSizeOf, Serialize)]
#[repr(C)] #[repr(C)]
pub struct WritingMode: u8 { pub struct WritingMode: u8 {
/// A vertical writing mode; writing-mode is vertical-rl, /// A vertical writing mode; writing-mode is vertical-rl,

Просмотреть файл

@ -12,7 +12,6 @@ bitflags! {
/// If we ever want to add some flags that shouldn't inherit for them, /// If we ever want to add some flags that shouldn't inherit for them,
/// we might want to add a function to handle this. /// we might want to add a function to handle this.
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct ComputedValueFlags: u32 { pub struct ComputedValueFlags: u32 {
/// Whether the style or any of the ancestors has a text-decoration-line /// Whether the style or any of the ancestors has a text-decoration-line
/// property that should get propagated to descendants. /// property that should get propagated to descendants.

Просмотреть файл

@ -1169,7 +1169,6 @@ impl CSSWideKeyword {
bitflags! { bitflags! {
/// A set of flags for properties. /// A set of flags for properties.
#[derive(Clone, Copy)]
pub struct PropertyFlags: u16 { pub struct PropertyFlags: u16 {
/// This longhand property applies to ::first-letter. /// This longhand property applies to ::first-letter.
const APPLIES_TO_FIRST_LETTER = 1 << 1; const APPLIES_TO_FIRST_LETTER = 1 << 1;
@ -1406,7 +1405,7 @@ impl LonghandId {
0, 0,
% endfor % endfor
]; ];
PropertyFlags::from_bits_retain(FLAGS[self as usize]) PropertyFlags::from_bits_truncate(FLAGS[self as usize])
} }
/// Returns true if the property is one that is ignored when document /// Returns true if the property is one that is ignored when document
@ -1581,7 +1580,7 @@ impl ShorthandId {
0, 0,
% endfor % endfor
]; ];
PropertyFlags::from_bits_retain(FLAGS[self as usize]) PropertyFlags::from_bits_truncate(FLAGS[self as usize])
} }
/// Returns whether this property is a legacy shorthand. /// Returns whether this property is a legacy shorthand.

Просмотреть файл

@ -104,7 +104,7 @@ macro_rules! keyword_evaluator {
bitflags! { bitflags! {
/// Different flags or toggles that change how a expression is parsed or /// Different flags or toggles that change how a expression is parsed or
/// evaluated. /// evaluated.
#[derive(Clone, Copy, ToShmem)] #[derive(ToShmem)]
pub struct FeatureFlags : u8 { pub struct FeatureFlags : u8 {
/// The feature should only be parsed in chrome and ua sheets. /// The feature should only be parsed in chrome and ua sheets.
const CHROME_AND_UA_ONLY = 1 << 0; const CHROME_AND_UA_ONLY = 1 << 0;

Просмотреть файл

@ -40,7 +40,7 @@ impl Default for PrecomputedHasher {
/// ///
/// We can avoid selector-matching those global rules for all elements without /// We can avoid selector-matching those global rules for all elements without
/// these pseudo-class states. /// these pseudo-class states.
const RARE_PSEUDO_CLASS_STATES: ElementState = ElementState::from_bits_retain( const RARE_PSEUDO_CLASS_STATES: ElementState = ElementState::from_bits_truncate(
ElementState::FULLSCREEN.bits() | ElementState::FULLSCREEN.bits() |
ElementState::VISITED_OR_UNVISITED.bits() | ElementState::VISITED_OR_UNVISITED.bits() |
ElementState::URLTARGET.bits() | ElementState::URLTARGET.bits() |

Просмотреть файл

@ -58,7 +58,7 @@ impl Origin {
bitflags! { bitflags! {
/// A set of origins. This is equivalent to Gecko's OriginFlags. /// A set of origins. This is equivalent to Gecko's OriginFlags.
#[derive(Clone, Copy, PartialEq, MallocSizeOf)] #[derive(MallocSizeOf)]
pub struct OriginSet: u8 { pub struct OriginSet: u8 {
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent> /// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
const ORIGIN_USER_AGENT = Origin::UserAgent as u8; const ORIGIN_USER_AGENT = Origin::UserAgent as u8;
@ -85,7 +85,7 @@ impl OriginSet {
impl From<Origin> for OriginSet { impl From<Origin> for OriginSet {
fn from(origin: Origin) -> Self { fn from(origin: Origin) -> Self {
Self::from_bits_retain(origin as u8) Self::from_bits_truncate(origin as u8)
} }
} }

Просмотреть файл

@ -83,7 +83,6 @@ bitflags! {
/// page-rule applies. /// page-rule applies.
/// ///
/// https://drafts.csswg.org/css-page-3/#page-selectors /// https://drafts.csswg.org/css-page-3/#page-selectors
#[derive(Clone, Copy)]
#[repr(C)] #[repr(C)]
pub struct PagePseudoClassFlags : u8 { pub struct PagePseudoClassFlags : u8 {
/// No pseudo-classes /// No pseudo-classes

Просмотреть файл

@ -11,7 +11,6 @@ use std::cell::RefCell;
bitflags! { bitflags! {
/// A thread state flag, used for multiple assertions. /// A thread state flag, used for multiple assertions.
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct ThreadState: u32 { pub struct ThreadState: u32 {
/// Whether we're in a script thread. /// Whether we're in a script thread.
const SCRIPT = 0x01; const SCRIPT = 0x01;

Просмотреть файл

@ -10,7 +10,6 @@
bitflags! { bitflags! {
/// Flags that control the traversal process. /// Flags that control the traversal process.
#[derive(Clone, Copy, Eq, PartialEq)]
pub struct TraversalFlags: u32 { pub struct TraversalFlags: u32 {
/// Traverse only elements for animation restyles. /// Traverse only elements for animation restyles.
const AnimationOnly = 1 << 0; const AnimationOnly = 1 << 0;

Просмотреть файл

@ -217,7 +217,6 @@ bitflags! {
/// This is used as a hint for the parser to fast-reject invalid /// This is used as a hint for the parser to fast-reject invalid
/// expressions. Numbers are always allowed because they multiply other /// expressions. Numbers are always allowed because they multiply other
/// units. /// units.
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct CalcUnits: u8 { pub struct CalcUnits: u8 {
/// <length> /// <length>
const LENGTH = 1 << 0; const LENGTH = 1 << 0;

Просмотреть файл

@ -25,7 +25,7 @@ pub enum GenericColor<Percentage> {
bitflags! { bitflags! {
/// Flags used to modify the calculation of a color mix result. /// Flags used to modify the calculation of a color mix result.
#[derive(Clone, Copy, Default, MallocSizeOf, PartialEq, ToShmem)] #[derive(MallocSizeOf, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct ColorMixFlags : u8 { pub struct ColorMixFlags : u8 {
/// Normalize the weights of the mix. /// Normalize the weights of the mix.

Просмотреть файл

@ -161,7 +161,7 @@ pub use self::GenericImageSetItem as ImageSetItem;
bitflags! { bitflags! {
/// State flags stored on each variant of a Gradient. /// State flags stored on each variant of a Gradient.
#[derive(Clone, Copy, Default, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct GradientFlags: u8 { pub struct GradientFlags: u8 {
/// Set if this is a repeating gradient. /// Set if this is a repeating gradient.

Просмотреть файл

@ -13,7 +13,7 @@ use style_traits::{CssWriter, KeywordsCollectFn, ParseError, SpecifiedValueInfo,
bitflags! { bitflags! {
/// Constants shared by multiple CSS Box Alignment properties /// Constants shared by multiple CSS Box Alignment properties
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct AlignFlags: u8 { pub struct AlignFlags: u8 {
// Enumeration stored in the lower 5 bits: // Enumeration stored in the lower 5 bits:

Просмотреть файл

@ -165,7 +165,6 @@ bitflags! {
/// we use the bitflags to choose the supported basic shapes for each property at the parse /// we use the bitflags to choose the supported basic shapes for each property at the parse
/// time. /// time.
/// https://github.com/w3c/csswg-drafts/issues/7390 /// https://github.com/w3c/csswg-drafts/issues/7390
#[derive(Clone, Copy)]
#[repr(C)] #[repr(C)]
pub struct AllowedBasicShapes: u8 { pub struct AllowedBasicShapes: u8 {
/// inset(). /// inset().

Просмотреть файл

@ -1022,7 +1022,7 @@ impl WillChange {
bitflags! { bitflags! {
/// The change bits that we care about. /// The change bits that we care about.
#[derive(Clone, Copy, Default, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct WillChangeBits: u16 { pub struct WillChangeBits: u16 {
/// Whether a property which can create a stacking context **on any /// Whether a property which can create a stacking context **on any
@ -1133,7 +1133,7 @@ impl Parse for WillChange {
bitflags! { bitflags! {
/// Values for the `touch-action` property. /// Values for the `touch-action` property.
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
#[css(bitflags(single = "none,auto,manipulation", mixed = "pan-x,pan-y,pinch-zoom"))] #[css(bitflags(single = "none,auto,manipulation", mixed = "pan-x,pan-y,pinch-zoom"))]
#[repr(C)] #[repr(C)]
pub struct TouchAction: u8 { pub struct TouchAction: u8 {
@ -1161,7 +1161,7 @@ impl TouchAction {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
#[css(bitflags(single = "none,strict,content", mixed="size,layout,style,paint,inline-size", overlapping_bits))] #[css(bitflags(single = "none,strict,content", mixed="size,layout,style,paint,inline-size", overlapping_bits))]
#[repr(C)] #[repr(C)]
/// Constants for contain: https://drafts.csswg.org/css-contain/#contain-property /// Constants for contain: https://drafts.csswg.org/css-contain/#contain-property
@ -1855,7 +1855,7 @@ impl Overflow {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
#[css(bitflags(single = "auto", mixed = "stable,both-edges", validate_mixed="Self::has_stable"))] #[css(bitflags(single = "auto", mixed = "stable,both-edges", validate_mixed="Self::has_stable"))]
/// Values for scrollbar-gutter: /// Values for scrollbar-gutter:

Просмотреть файл

@ -1031,7 +1031,7 @@ impl Parse for CaretColor {
bitflags! { bitflags! {
/// Various flags to represent the color-scheme property in an efficient /// Various flags to represent the color-scheme property in an efficient
/// way. /// way.
#[derive(Clone, Copy, Default, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
#[value_info(other_values = "light,dark,only")] #[value_info(other_values = "light,dark,only")]
pub struct ColorSchemeFlags: u8 { pub struct ColorSchemeFlags: u8 {

Просмотреть файл

@ -1012,7 +1012,6 @@ impl Parse for FontSize {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy)]
/// Flags of variant alternates in bit /// Flags of variant alternates in bit
struct VariantAlternatesParsingFlags: u8 { struct VariantAlternatesParsingFlags: u8 {
/// None of variant alternates enabled /// None of variant alternates enabled
@ -1239,8 +1238,8 @@ macro_rules! impl_variant_east_asian {
)+ )+
} => { } => {
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
/// Vairants for east asian variant /// Variants for east asian variant
pub struct FontVariantEastAsian: u16 { pub struct FontVariantEastAsian: u16 {
/// None of the features /// None of the features
const NORMAL = 0; const NORMAL = 0;
@ -1410,7 +1409,7 @@ macro_rules! impl_variant_ligatures {
)+ )+
} => { } => {
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
/// Variants of ligatures /// Variants of ligatures
pub struct FontVariantLigatures: u16 { pub struct FontVariantLigatures: u16 {
/// Specifies that common default features are enabled /// Specifies that common default features are enabled
@ -1588,8 +1587,8 @@ macro_rules! impl_variant_numeric {
)+ )+
} => { } => {
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
/// Variants of numeric values /// Vairants of numeric values
pub struct FontVariantNumeric: u8 { pub struct FontVariantNumeric: u8 {
/// None of other variants are enabled. /// None of other variants are enabled.
const NORMAL = 0; const NORMAL = 0;

Просмотреть файл

@ -208,7 +208,6 @@ pub type MozImageRect = generic::GenericMozImageRect<NumberOrPercentage, Specifi
pub enum MozImageRect {} pub enum MozImageRect {}
bitflags! { bitflags! {
#[derive(Clone, Copy)]
struct ParseImageFlags: u8 { struct ParseImageFlags: u8 {
const FORBID_NONE = 1 << 0; const FORBID_NONE = 1 << 0;
const FORBID_IMAGE_SET = 1 << 1; const FORBID_IMAGE_SET = 1 << 1;

Просмотреть файл

@ -372,7 +372,7 @@ impl Side for VerticalPositionKeyword {
bitflags! { bitflags! {
/// Controls how the auto-placement algorithm works specifying exactly how auto-placed items /// Controls how the auto-placement algorithm works specifying exactly how auto-placed items
/// get flowed into the grid. /// get flowed into the grid.
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
#[value_info(other_values = "row,column,dense")] #[value_info(other_values = "row,column,dense")]
#[repr(C)] #[repr(C)]
pub struct GridAutoFlow: u8 { pub struct GridAutoFlow: u8 {

Просмотреть файл

@ -249,7 +249,7 @@ impl ToCss for SVGPaintOrder {
bitflags! { bitflags! {
/// The context properties we understand. /// The context properties we understand.
#[derive(Clone, Copy, Eq, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
pub struct ContextPropertyBits: u8 { pub struct ContextPropertyBits: u8 {
/// `fill` /// `fill`

Просмотреть файл

@ -232,7 +232,7 @@ impl ToComputedValue for TextOverflow {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
#[css(bitflags(single = "none", mixed = "underline,overline,line-through,blink"))] #[css(bitflags(single = "none", mixed = "underline,overline,line-through,blink"))]
#[repr(C)] #[repr(C)]
/// Specified keyword values for the text-decoration-line property. /// Specified keyword values for the text-decoration-line property.
@ -415,7 +415,7 @@ pub enum TextTransformCase {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
#[css(bitflags(mixed = "full-width,full-size-kana"))] #[css(bitflags(mixed = "full-width,full-size-kana"))]
#[repr(C)] #[repr(C)]
/// Specified keyword values for non-case transforms in the text-transform property. (Non-exclusive.) /// Specified keyword values for non-case transforms in the text-transform property. (Non-exclusive.)
@ -755,7 +755,7 @@ impl Parse for TextEmphasisStyle {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
#[repr(C)] #[repr(C)]
#[css(bitflags(mixed="over,under,left,right", validate_mixed="Self::validate_and_simplify"))] #[css(bitflags(mixed="over,under,left,right", validate_mixed="Self::validate_and_simplify"))]
/// Values for text-emphasis-position: /// Values for text-emphasis-position:
@ -967,7 +967,7 @@ impl TextDecorationLength {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
#[value_info(other_values = "auto,from-font,under,left,right")] #[value_info(other_values = "auto,from-font,under,left,right")]
#[repr(C)] #[repr(C)]
/// Specified keyword values for the text-underline-position property. /// Specified keyword values for the text-underline-position property.

Просмотреть файл

@ -15,7 +15,7 @@ gecko = []
[dependencies] [dependencies]
app_units = "0.7" app_units = "0.7"
bitflags = "2" bitflags = "1.0"
cssparser = "0.32" cssparser = "0.32"
euclid = "0.22" euclid = "0.22"
lazy_static = "1" lazy_static = "1"

Просмотреть файл

@ -242,7 +242,6 @@ pub enum PropertySyntaxParseError {
bitflags! { bitflags! {
/// The mode to use when parsing values. /// The mode to use when parsing values.
#[derive(Clone, Copy, Eq, PartialEq)]
#[repr(C)] #[repr(C)]
pub struct ParsingMode: u8 { pub struct ParsingMode: u8 {
/// In CSS; lengths must have units, except for zero values, where the unit can be omitted. /// In CSS; lengths must have units, except for zero values, where the unit can be omitted.

Просмотреть файл

@ -296,7 +296,7 @@ pub extern "C" fn Servo_TraverseSubtree(
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
raw_flags: ServoTraversalFlags, raw_flags: ServoTraversalFlags,
) -> bool { ) -> bool {
let traversal_flags = TraversalFlags::from_bits_retain(raw_flags); let traversal_flags = TraversalFlags::from_bits_truncate(raw_flags);
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let element = GeckoElement(root); let element = GeckoElement(root);
@ -5163,7 +5163,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
Clear => get_from_computed::<Clear>(value), Clear => get_from_computed::<Clear>(value),
VerticalAlign => VerticalAlign::Keyword(VerticalAlignKeyword::from_u32(value).unwrap()), VerticalAlign => VerticalAlign::Keyword(VerticalAlignKeyword::from_u32(value).unwrap()),
TextAlign => get_from_computed::<TextAlign>(value), TextAlign => get_from_computed::<TextAlign>(value),
TextEmphasisPosition => TextEmphasisPosition::from_bits_retain(value as u8), TextEmphasisPosition => TextEmphasisPosition::from_bits_truncate(value as u8),
FontSize => { FontSize => {
// We rely on Gecko passing in font-size values (0...7) here. // We rely on Gecko passing in font-size values (0...7) here.
longhands::font_size::SpecifiedValue::from_html_size(value as u8) longhands::font_size::SpecifiedValue::from_html_size(value as u8)
@ -6724,7 +6724,7 @@ pub extern "C" fn Servo_StyleSet_HasStateDependency(
) -> bool { ) -> bool {
let element = GeckoElement(element); let element = GeckoElement(element);
let state = ElementState::from_bits_retain(state); let state = ElementState::from_bits_truncate(state);
let data = raw_data.borrow(); let data = raw_data.borrow();
data.stylist data.stylist
@ -6739,7 +6739,7 @@ pub extern "C" fn Servo_StyleSet_HasNthOfStateDependency(
) -> bool { ) -> bool {
let element = GeckoElement(element); let element = GeckoElement(element);
let state = ElementState::from_bits_retain(state); let state = ElementState::from_bits_truncate(state);
let data = raw_data.borrow(); let data = raw_data.borrow();
data.stylist data.stylist
@ -6751,7 +6751,7 @@ pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
raw_data: &PerDocumentStyleData, raw_data: &PerDocumentStyleData,
state: u64, state: u64,
) -> bool { ) -> bool {
let state = DocumentState::from_bits_retain(state); let state = DocumentState::from_bits_truncate(state);
let data = raw_data.borrow(); let data = raw_data.borrow();
data.stylist.has_document_state_dependency(state) data.stylist.has_document_state_dependency(state)
@ -7406,7 +7406,7 @@ pub unsafe extern "C" fn Servo_InvalidateStyleForDocStateChanges(
let root = GeckoElement(root); let root = GeckoElement(root);
let mut processor = DocumentStateInvalidationProcessor::new( let mut processor = DocumentStateInvalidationProcessor::new(
iter, iter,
DocumentState::from_bits_retain(states_changed), DocumentState::from_bits_truncate(states_changed),
&mut selector_caches, &mut selector_caches,
root.as_node().owner_doc().quirks_mode(), root.as_node().owner_doc().quirks_mode(),
); );