зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1835681 - Update bitflags in the dom and style crates. r=zrhoffman
Use from_bits_retain where possible to save a few instructions here and there while at it. Differential Revision: https://phabricator.services.mozilla.com/D179379
This commit is contained in:
Родитель
0bee1526f8
Коммит
8600cbca49
|
@ -1378,7 +1378,7 @@ dependencies = [
|
|||
name = "dom"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.999.999",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4622,7 +4622,7 @@ dependencies = [
|
|||
name = "selectors"
|
||||
version = "0.22.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.999.999",
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
"fxhash",
|
||||
|
@ -4981,7 +4981,7 @@ dependencies = [
|
|||
"arrayvec",
|
||||
"atomic_refcell",
|
||||
"bindgen 0.64.0",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.999.999",
|
||||
"byteorder",
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
|
@ -5047,7 +5047,7 @@ name = "style_traits"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.999.999",
|
||||
"cssparser",
|
||||
"euclid",
|
||||
"lazy_static",
|
||||
|
|
|
@ -11,4 +11,4 @@ license = "MPL-2.0"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
bitflags = "2"
|
||||
|
|
|
@ -9,6 +9,7 @@ use bitflags::bitflags;
|
|||
bitflags! {
|
||||
/// Event-based element states.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct ElementState: u64 {
|
||||
/// The mouse is down on this element.
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-active>
|
||||
|
@ -181,6 +182,7 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// Event-based document states.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct DocumentState: u64 {
|
||||
/// Window activation status
|
||||
const WINDOW_INACTIVE = 1 << 0;
|
||||
|
|
|
@ -18,7 +18,7 @@ path = "lib.rs"
|
|||
bench = []
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
bitflags = "2"
|
||||
matches = "0.1"
|
||||
cssparser = "0.31"
|
||||
derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign"] }
|
||||
|
|
|
@ -178,7 +178,7 @@ fn split_from_end<T>(s: &[T], at: usize) -> (&[T], &[T]) {
|
|||
|
||||
bitflags! {
|
||||
/// Flags that indicate at which point of parsing a selector are we.
|
||||
#[derive(Default, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, ToShmem)]
|
||||
pub (crate) struct SelectorFlags : u8 {
|
||||
const HAS_PSEUDO = 1 << 0;
|
||||
const HAS_SLOTTED = 1 << 1;
|
||||
|
|
|
@ -28,6 +28,7 @@ pub static RECOMMENDED_SELECTOR_BLOOM_FILTER_SIZE: usize = 4096;
|
|||
bitflags! {
|
||||
/// 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.
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct ElementSelectorFlags: usize {
|
||||
/// When a child is added or removed from the parent, all the children
|
||||
/// must be restyled, because they may match :nth-last-child,
|
||||
|
|
|
@ -78,6 +78,7 @@ fn to_ascii_lowercase(s: &str) -> Cow<str> {
|
|||
|
||||
bitflags! {
|
||||
/// Flags that indicate at which point of parsing a selector are we.
|
||||
#[derive(Copy, Clone)]
|
||||
struct SelectorParsingState: u8 {
|
||||
/// Whether we should avoid adding default namespaces to selectors that
|
||||
/// aren't type or universal selectors.
|
||||
|
@ -1506,6 +1507,7 @@ pub struct RelativeSelector<Impl: SelectorImpl> {
|
|||
|
||||
bitflags! {
|
||||
/// Composition of combinators in a given selector, not traversing selectors of pseudoclasses.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
struct CombinatorComposition: u8 {
|
||||
const DESCENDANTS = 1 << 0;
|
||||
const SIBLINGS = 1 << 1;
|
||||
|
@ -1518,10 +1520,10 @@ impl CombinatorComposition {
|
|||
for combinator in CombinatorIter::new(inner_selector.iter_skip_relative_selector_anchor()) {
|
||||
match combinator {
|
||||
Combinator::Descendant | Combinator::Child => {
|
||||
result.insert(CombinatorComposition::DESCENDANTS);
|
||||
result.insert(Self::DESCENDANTS);
|
||||
},
|
||||
Combinator::NextSibling | Combinator::LaterSibling => {
|
||||
result.insert(CombinatorComposition::SIBLINGS);
|
||||
result.insert(Self::SIBLINGS);
|
||||
},
|
||||
Combinator::Part | Combinator::PseudoElement | Combinator::SlotAssignment => {
|
||||
continue
|
||||
|
|
|
@ -62,7 +62,7 @@ pub trait SelectorVisitor: Sized {
|
|||
|
||||
bitflags! {
|
||||
/// The kinds of components the visitor is visiting the selector list of, if any
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
pub struct SelectorListKind: u8 {
|
||||
/// The visitor is inside :not(..)
|
||||
const NEGATION = 1 << 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ gecko_refcount_logging = []
|
|||
app_units = "0.7"
|
||||
arrayvec = "0.7"
|
||||
atomic_refcell = "0.1"
|
||||
bitflags = "1.0"
|
||||
bitflags = "2"
|
||||
byteorder = "1.0"
|
||||
cssparser = "0.31"
|
||||
derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign", "deref", "from"] }
|
||||
|
|
|
@ -128,7 +128,7 @@ impl ColorSpace {
|
|||
|
||||
bitflags! {
|
||||
/// Flags used when serializing colors.
|
||||
#[derive(Default, MallocSizeOf, ToShmem)]
|
||||
#[derive(Clone, Copy, Default, MallocSizeOf, PartialEq, ToShmem)]
|
||||
#[repr(C)]
|
||||
pub struct ColorFlags : u8 {
|
||||
/// If set, serializes sRGB colors into `color(srgb ...)` instead of
|
||||
|
|
|
@ -97,7 +97,7 @@ pub enum FontFaceSourceFormatKeyword {
|
|||
bitflags! {
|
||||
/// Flags for the @font-face tech() function, indicating font technologies
|
||||
/// required by the resource.
|
||||
#[derive(ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
||||
#[repr(C)]
|
||||
pub struct FontFaceSourceTechFlags: u16 {
|
||||
/// Font requires OpenType feature support.
|
||||
|
|
|
@ -26,6 +26,7 @@ pub use crate::gecko::snapshot::SnapshotMap;
|
|||
|
||||
bitflags! {
|
||||
// See NonTSPseudoClass::is_enabled_in()
|
||||
#[derive(Copy, Clone)]
|
||||
struct NonTSPseudoClassFlag: u8 {
|
||||
const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS = 1 << 0;
|
||||
const PSEUDO_CLASS_ENABLED_IN_CHROME = 1 << 1;
|
||||
|
|
|
@ -170,7 +170,7 @@ impl ElementSnapshot for GeckoElementSnapshot {
|
|||
|
||||
fn state(&self) -> Option<ElementState> {
|
||||
if self.has_any(Flags::State) {
|
||||
Some(ElementState::from_bits_truncate(self.mState))
|
||||
Some(ElementState::from_bits_retain(self.mState))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -719,7 +719,7 @@ impl<'le> GeckoElement<'le> {
|
|||
|
||||
#[inline]
|
||||
fn document_state(&self) -> DocumentState {
|
||||
DocumentState::from_bits_truncate(self.as_node().owner_doc().0.mDocumentState.bits)
|
||||
DocumentState::from_bits_retain(self.as_node().owner_doc().0.mDocumentState.bits)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1183,7 +1183,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
#[inline]
|
||||
fn state(&self) -> ElementState {
|
||||
ElementState::from_bits_truncate(self.state_internal())
|
||||
ElementState::from_bits_retain(self.state_internal())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn assert_flags_match() {
|
|||
|
||||
impl From<OriginFlags> for OriginSet {
|
||||
fn from(flags: OriginFlags) -> Self {
|
||||
Self::from_bits_truncate(flags.0)
|
||||
Self::from_bits_retain(flags.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::traversal_flags::TraversalFlags;
|
|||
bitflags! {
|
||||
/// The kind of restyle we need to do for a given element.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct RestyleHint: u16 {
|
||||
/// Do a selector match of the element.
|
||||
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()
|
||||
bitflags!(
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf, Serialize))]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Serialize)]
|
||||
#[repr(C)]
|
||||
pub struct WritingMode: u8 {
|
||||
/// A vertical writing mode; writing-mode is vertical-rl,
|
||||
|
@ -170,7 +170,7 @@ impl WritingMode {
|
|||
|
||||
/// Returns the `horizontal-tb` value.
|
||||
pub fn horizontal_tb() -> Self {
|
||||
Self::from_bits_truncate(0)
|
||||
Self::empty()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -418,7 +418,7 @@ impl DebugWritingMode {
|
|||
|
||||
#[inline]
|
||||
fn new(mode: WritingMode) -> DebugWritingMode {
|
||||
DebugWritingMode { mode: mode }
|
||||
DebugWritingMode { mode }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ bitflags! {
|
|||
/// If we ever want to add some flags that shouldn't inherit for them,
|
||||
/// we might want to add a function to handle this.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct ComputedValueFlags: u32 {
|
||||
/// Whether the style or any of the ancestors has a text-decoration-line
|
||||
/// property that should get propagated to descendants.
|
||||
|
|
|
@ -36,24 +36,6 @@
|
|||
)}
|
||||
% endfor
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
macro_rules! impl_align_conversions {
|
||||
($name: path) => {
|
||||
impl From<u8> for $name {
|
||||
fn from(bits: u8) -> $name {
|
||||
$name(crate::values::specified::align::AlignFlags::from_bits(bits)
|
||||
.expect("bits contain valid flag"))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<$name> for u8 {
|
||||
fn from(v: $name) -> u8 {
|
||||
v.0.bits()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"z-index",
|
||||
"ZIndex",
|
||||
|
@ -184,9 +166,6 @@ ${helpers.single_keyword(
|
|||
servo_restyle_damage="reflow",
|
||||
)}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_align_conversions!(crate::values::specified::align::AlignItems);
|
||||
|
||||
${helpers.predefined_type(
|
||||
"justify-items",
|
||||
"JustifyItems",
|
||||
|
@ -195,9 +174,6 @@ ${helpers.single_keyword(
|
|||
spec="https://drafts.csswg.org/css-align/#propdef-justify-items",
|
||||
animation_value_type="discrete",
|
||||
)}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_align_conversions!(crate::values::specified::align::JustifyItems);
|
||||
% endif
|
||||
|
||||
// Flex item properties
|
||||
|
@ -258,9 +234,6 @@ ${helpers.predefined_type(
|
|||
spec="https://drafts.csswg.org/css-align/#justify-self-property",
|
||||
animation_value_type="discrete",
|
||||
)}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_align_conversions!(crate::values::specified::align::SelfAlignment);
|
||||
% endif
|
||||
|
||||
// https://drafts.csswg.org/css-flexbox/#propdef-order
|
||||
|
|
|
@ -1198,6 +1198,7 @@ impl CSSWideKeyword {
|
|||
|
||||
bitflags! {
|
||||
/// A set of flags for properties.
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct PropertyFlags: u16 {
|
||||
/// This longhand property applies to ::first-letter.
|
||||
const APPLIES_TO_FIRST_LETTER = 1 << 1;
|
||||
|
@ -1427,7 +1428,7 @@ impl LonghandId {
|
|||
0,
|
||||
% endfor
|
||||
];
|
||||
PropertyFlags::from_bits_truncate(FLAGS[self as usize])
|
||||
PropertyFlags::from_bits_retain(FLAGS[self as usize])
|
||||
}
|
||||
|
||||
/// Returns true if the property is one that is ignored when document
|
||||
|
@ -1602,7 +1603,7 @@ impl ShorthandId {
|
|||
0,
|
||||
% endfor
|
||||
];
|
||||
PropertyFlags::from_bits_truncate(FLAGS[self as usize])
|
||||
PropertyFlags::from_bits_retain(FLAGS[self as usize])
|
||||
}
|
||||
|
||||
/// Returns whether this property is a legacy shorthand.
|
||||
|
|
|
@ -104,7 +104,7 @@ macro_rules! keyword_evaluator {
|
|||
bitflags! {
|
||||
/// Different flags or toggles that change how a expression is parsed or
|
||||
/// evaluated.
|
||||
#[derive(ToShmem)]
|
||||
#[derive(Clone, Copy, ToShmem)]
|
||||
pub struct FeatureFlags : u8 {
|
||||
/// The feature should only be parsed in chrome and ua sheets.
|
||||
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
|
||||
/// these pseudo-class states.
|
||||
const RARE_PSEUDO_CLASS_STATES: ElementState = ElementState::from_bits_truncate(
|
||||
const RARE_PSEUDO_CLASS_STATES: ElementState = ElementState::from_bits_retain(
|
||||
ElementState::FULLSCREEN.bits() |
|
||||
ElementState::VISITED_OR_UNVISITED.bits() |
|
||||
ElementState::URLTARGET.bits() |
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Origin {
|
|||
|
||||
bitflags! {
|
||||
/// A set of origins. This is equivalent to Gecko's OriginFlags.
|
||||
#[derive(MallocSizeOf)]
|
||||
#[derive(Clone, Copy, PartialEq, MallocSizeOf)]
|
||||
pub struct OriginSet: u8 {
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
|
||||
const ORIGIN_USER_AGENT = Origin::UserAgent as u8;
|
||||
|
@ -85,7 +85,7 @@ impl OriginSet {
|
|||
|
||||
impl From<Origin> for OriginSet {
|
||||
fn from(origin: Origin) -> Self {
|
||||
Self::from_bits_truncate(origin as u8)
|
||||
Self::from_bits_retain(origin as u8)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
use std::cell::RefCell;
|
||||
|
||||
bitflags! {
|
||||
bitflags ! {
|
||||
/// A thread state flag, used for multiple assertions.
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct ThreadState: u32 {
|
||||
/// Whether we're in a script thread.
|
||||
const SCRIPT = 0x01;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
bitflags! {
|
||||
/// Flags that control the traversal process.
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct TraversalFlags: u32 {
|
||||
/// Traverse only elements for animation restyles.
|
||||
const AnimationOnly = 1 << 0;
|
||||
|
|
|
@ -13,7 +13,7 @@ use style_traits::{CssWriter, KeywordsCollectFn, ParseError, SpecifiedValueInfo,
|
|||
|
||||
bitflags! {
|
||||
/// Constants shared by multiple CSS Box Alignment properties
|
||||
#[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
pub struct AlignFlags: u8 {
|
||||
// Enumeration stored in the lower 5 bits:
|
||||
|
|
|
@ -1001,7 +1001,7 @@ impl WillChange {
|
|||
|
||||
bitflags! {
|
||||
/// The change bits that we care about.
|
||||
#[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Default, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
pub struct WillChangeBits: u16 {
|
||||
/// Whether a property which can create a stacking context **on any
|
||||
|
@ -1112,7 +1112,7 @@ impl Parse for WillChange {
|
|||
|
||||
bitflags! {
|
||||
/// Values for the `touch-action` property.
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem, Parse)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[css(bitflags(single = "none,auto,manipulation", mixed = "pan-x,pan-y,pinch-zoom"))]
|
||||
#[repr(C)]
|
||||
pub struct TouchAction: u8 {
|
||||
|
@ -1140,7 +1140,7 @@ impl TouchAction {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, Parse, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[css(bitflags(single = "none,strict,content", mixed="size,layout,style,paint,inline-size", overlapping_bits))]
|
||||
#[repr(C)]
|
||||
/// Constants for contain: https://drafts.csswg.org/css-contain/#contain-property
|
||||
|
@ -1882,7 +1882,7 @@ impl Overflow {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem, Parse)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
#[css(bitflags(single = "auto", mixed = "stable,both-edges", validate_mixed="Self::has_stable"))]
|
||||
/// Values for scrollbar-gutter:
|
||||
|
|
|
@ -119,6 +119,7 @@ bitflags! {
|
|||
/// This is used as a hint for the parser to fast-reject invalid
|
||||
/// expressions. Numbers are always allowed because they multiply other
|
||||
/// units.
|
||||
#[derive(Clone, Copy)]
|
||||
struct CalcUnits: u8 {
|
||||
const LENGTH = 1 << 0;
|
||||
const PERCENTAGE = 1 << 1;
|
||||
|
|
|
@ -1011,7 +1011,7 @@ impl Parse for CaretColor {
|
|||
bitflags! {
|
||||
/// Various flags to represent the color-scheme property in an efficient
|
||||
/// way.
|
||||
#[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Default, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
#[value_info(other_values = "light,dark,only")]
|
||||
pub struct ColorSchemeFlags: u8 {
|
||||
|
|
|
@ -983,7 +983,7 @@ impl Parse for FontSize {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy)]
|
||||
/// Flags of variant alternates in bit
|
||||
struct VariantAlternatesParsingFlags: u8 {
|
||||
/// None of variant alternates enabled
|
||||
|
@ -1208,7 +1208,7 @@ macro_rules! impl_variant_east_asian {
|
|||
)+
|
||||
} => {
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
/// Vairants for east asian variant
|
||||
pub struct FontVariantEastAsian: u16 {
|
||||
/// None of the features
|
||||
|
@ -1379,7 +1379,7 @@ macro_rules! impl_variant_ligatures {
|
|||
)+
|
||||
} => {
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
/// Variants of ligatures
|
||||
pub struct FontVariantLigatures: u16 {
|
||||
/// Specifies that common default features are enabled
|
||||
|
@ -1557,8 +1557,8 @@ macro_rules! impl_variant_numeric {
|
|||
)+
|
||||
} => {
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
/// Vairants of numeric values
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
/// Variants of numeric values
|
||||
pub struct FontVariantNumeric: u8 {
|
||||
/// None of other variants are enabled.
|
||||
const NORMAL = 0;
|
||||
|
|
|
@ -166,6 +166,7 @@ pub type MozImageRect = generic::GenericMozImageRect<NumberOrPercentage, Specifi
|
|||
pub enum MozImageRect {}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy)]
|
||||
struct ParseImageFlags: u8 {
|
||||
const FORBID_NONE = 1 << 0;
|
||||
const FORBID_IMAGE_SET = 1 << 1;
|
||||
|
|
|
@ -370,15 +370,9 @@ impl Side for VerticalPositionKeyword {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
/// Controls how the auto-placement algorithm works
|
||||
/// specifying exactly how auto-placed items get flowed into the grid
|
||||
#[derive(
|
||||
MallocSizeOf,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem
|
||||
)]
|
||||
/// Controls how the auto-placement algorithm works specifying exactly how auto-placed items
|
||||
/// get flowed into the grid.
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[value_info(other_values = "row,column,dense")]
|
||||
#[repr(C)]
|
||||
pub struct GridAutoFlow: u8 {
|
||||
|
|
|
@ -249,7 +249,7 @@ impl ToCss for SVGPaintOrder {
|
|||
|
||||
bitflags! {
|
||||
/// The context properties we understand.
|
||||
#[derive(Default, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
pub struct ContextPropertyBits: u8 {
|
||||
/// `fill`
|
||||
|
|
|
@ -232,7 +232,7 @@ impl ToComputedValue for TextOverflow {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[css(bitflags(single = "none", mixed = "underline,overline,line-through,blink"))]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for the text-decoration-line property.
|
||||
|
@ -408,8 +408,8 @@ pub enum TextTransformCase {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[value_info(other_values = "none,full-width,full-size-kana")]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[css(bitflags(mixed = "full-width,full-size-kana"))]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for non-case transforms in the text-transform property. (Non-exclusive.)
|
||||
pub struct TextTransformOther: u8 {
|
||||
|
@ -420,31 +420,6 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for TextTransformOther {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
let mut writer = SequenceWriter::new(dest, " ");
|
||||
let mut any = false;
|
||||
macro_rules! maybe_write {
|
||||
($ident:ident => $str:expr) => {
|
||||
if self.contains(TextTransformOther::$ident) {
|
||||
writer.raw_item($str)?;
|
||||
any = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
maybe_write!(FULL_WIDTH => "full-width");
|
||||
maybe_write!(FULL_SIZE_KANA => "full-size-kana");
|
||||
|
||||
debug_assert!(any || self.is_empty());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Specified and computed value of text-align-last.
|
||||
#[derive(
|
||||
Clone,
|
||||
|
@ -773,7 +748,7 @@ impl Parse for TextEmphasisStyle {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem, Parse, ToCss)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, Parse, Serialize, SpecifiedValueInfo, ToCss, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(C)]
|
||||
#[css(bitflags(mixed="over,under,left,right", validate_mixed="Self::validate_and_simplify"))]
|
||||
/// Values for text-emphasis-position:
|
||||
|
@ -985,7 +960,7 @@ impl TextDecorationLength {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[value_info(other_values = "auto,from-font,under,left,right")]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for the text-underline-position property.
|
||||
|
|
|
@ -15,7 +15,7 @@ gecko = []
|
|||
|
||||
[dependencies]
|
||||
app_units = "0.7"
|
||||
bitflags = "1.0"
|
||||
bitflags = "2"
|
||||
cssparser = "0.31"
|
||||
euclid = "0.22"
|
||||
lazy_static = "1"
|
||||
|
|
|
@ -245,6 +245,7 @@ pub enum PropertySyntaxParseError {
|
|||
|
||||
bitflags! {
|
||||
/// The mode to use when parsing values.
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
pub struct ParsingMode: u8 {
|
||||
/// In CSS; lengths must have units, except for zero values, where the unit can be omitted.
|
||||
/// <https://www.w3.org/TR/css3-values/#lengths>
|
||||
|
|
|
@ -295,7 +295,7 @@ pub extern "C" fn Servo_TraverseSubtree(
|
|||
snapshots: *const ServoElementSnapshotTable,
|
||||
raw_flags: ServoTraversalFlags,
|
||||
) -> bool {
|
||||
let traversal_flags = TraversalFlags::from_bits_truncate(raw_flags);
|
||||
let traversal_flags = TraversalFlags::from_bits_retain(raw_flags);
|
||||
debug_assert!(!snapshots.is_null());
|
||||
|
||||
let element = GeckoElement(root);
|
||||
|
@ -4374,7 +4374,7 @@ fn parse_property_into(
|
|||
reporter: Option<&dyn ParseErrorReporter>,
|
||||
) -> Result<(), ()> {
|
||||
let value = unsafe { value.as_str_unchecked() };
|
||||
let parsing_mode = ParsingMode::from_bits_truncate(parsing_mode);
|
||||
let parsing_mode = ParsingMode::from_bits_retain(parsing_mode);
|
||||
|
||||
if let Some(non_custom) = property_id.non_custom_id() {
|
||||
if !non_custom.allowed_in_rule(rule_type.into()) {
|
||||
|
@ -5194,7 +5194,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
|||
Clear => get_from_computed::<Clear>(value),
|
||||
VerticalAlign => VerticalAlign::Keyword(VerticalAlignKeyword::from_u32(value).unwrap()),
|
||||
TextAlign => get_from_computed::<TextAlign>(value),
|
||||
TextEmphasisPosition => TextEmphasisPosition::from_bits_truncate(value as u8),
|
||||
TextEmphasisPosition => TextEmphasisPosition::from_bits_retain(value as u8),
|
||||
FontSize => {
|
||||
// We rely on Gecko passing in font-size values (0...7) here.
|
||||
longhands::font_size::SpecifiedValue::from_html_size(value as u8)
|
||||
|
@ -6754,7 +6754,7 @@ pub extern "C" fn Servo_StyleSet_HasStateDependency(
|
|||
) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
|
||||
let state = ElementState::from_bits_truncate(state);
|
||||
let state = ElementState::from_bits_retain(state);
|
||||
let data = raw_data.borrow();
|
||||
|
||||
data.stylist
|
||||
|
@ -6769,7 +6769,7 @@ pub extern "C" fn Servo_StyleSet_HasNthOfStateDependency(
|
|||
) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
|
||||
let state = ElementState::from_bits_truncate(state);
|
||||
let state = ElementState::from_bits_retain(state);
|
||||
let data = raw_data.borrow();
|
||||
|
||||
data.stylist
|
||||
|
@ -6781,7 +6781,7 @@ pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
|
|||
raw_data: &PerDocumentStyleData,
|
||||
state: u64,
|
||||
) -> bool {
|
||||
let state = DocumentState::from_bits_truncate(state);
|
||||
let state = DocumentState::from_bits_retain(state);
|
||||
let data = raw_data.borrow();
|
||||
|
||||
data.stylist.has_document_state_dependency(state)
|
||||
|
@ -7360,7 +7360,7 @@ pub unsafe extern "C" fn Servo_InvalidateStyleForDocStateChanges(
|
|||
let root = GeckoElement(root);
|
||||
let mut processor = DocumentStateInvalidationProcessor::new(
|
||||
iter,
|
||||
DocumentState::from_bits_truncate(states_changed),
|
||||
DocumentState::from_bits_retain(states_changed),
|
||||
&mut nth_index_cache,
|
||||
root.as_node().owner_doc().quirks_mode(),
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче