build(deps): bump bitflags from 1.3.2 to 2.3.1 (#30273)

Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.3.1.
 - [Release notes](https://github.com/bitflags/bitflags/releases)
 - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
 - [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.3.1)
This commit is contained in:
Martin Robinson 2023-09-01 11:58:48 +02:00 committed by GitHub
parent 6eb3e16578
commit e9281e2eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 110 additions and 113 deletions

16
Cargo.lock generated
View file

@ -463,7 +463,7 @@ dependencies = [
name = "bluetooth" name = "bluetooth"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.3.1",
"bluetooth_traits", "bluetooth_traits",
"device", "device",
"embedder_traits", "embedder_traits",
@ -639,7 +639,7 @@ dependencies = [
name = "canvas" name = "canvas"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.3.1",
"byteorder", "byteorder",
"canvas_traits", "canvas_traits",
"crossbeam-channel", "crossbeam-channel",
@ -1390,7 +1390,7 @@ dependencies = [
name = "devtools_traits" name = "devtools_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.3.1",
"headers", "headers",
"http", "http",
"ipc-channel", "ipc-channel",
@ -2077,7 +2077,7 @@ name = "gfx"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 1.3.2", "bitflags 2.3.1",
"byteorder", "byteorder",
"core-foundation 0.9.3", "core-foundation 0.9.3",
"core-graphics", "core-graphics",
@ -3068,7 +3068,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units", "app_units",
"atomic_refcell", "atomic_refcell",
"bitflags 1.3.2", "bitflags 2.3.1",
"canvas_traits", "canvas_traits",
"embedder_traits", "embedder_traits",
"euclid", "euclid",
@ -3113,7 +3113,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units", "app_units",
"atomic_refcell", "atomic_refcell",
"bitflags 1.3.2", "bitflags 2.3.1",
"canvas_traits", "canvas_traits",
"cssparser", "cssparser",
"embedder_traits", "embedder_traits",
@ -4940,7 +4940,7 @@ dependencies = [
"atomic_refcell", "atomic_refcell",
"backtrace", "backtrace",
"base64 0.21.3", "base64 0.21.3",
"bitflags 1.3.2", "bitflags 2.3.1",
"bluetooth_traits", "bluetooth_traits",
"canvas_traits", "canvas_traits",
"chrono", "chrono",
@ -5086,7 +5086,7 @@ dependencies = [
name = "script_traits" name = "script_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.3.1",
"bluetooth_traits", "bluetooth_traits",
"canvas_traits", "canvas_traits",
"cookie 0.12.0", "cookie 0.12.0",

View file

@ -17,7 +17,7 @@ atomic_refcell = "0.1.11"
arrayvec = "0.7" arrayvec = "0.7"
backtrace = "0.3" backtrace = "0.3"
base64 = "0.21.3" base64 = "0.21.3"
bitflags = "1.0" bitflags = "2.3"
byteorder = "1.0" byteorder = "1.0"
encoding_rs = "0.8" encoding_rs = "0.8"
euclid = "0.22" euclid = "0.22"

View file

@ -177,16 +177,17 @@ impl Font {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct ShapingFlags: u8 { pub struct ShapingFlags: u8 {
#[doc = "Set if the text is entirely whitespace."] /// Set if the text is entirely whitespace.
const IS_WHITESPACE_SHAPING_FLAG = 0x01; const IS_WHITESPACE_SHAPING_FLAG = 0x01;
#[doc = "Set if we are to ignore ligatures."] /// Set if we are to ignore ligatures.
const IGNORE_LIGATURES_SHAPING_FLAG = 0x02; const IGNORE_LIGATURES_SHAPING_FLAG = 0x02;
#[doc = "Set if we are to disable kerning."] /// Set if we are to disable kerning.
const DISABLE_KERNING_SHAPING_FLAG = 0x04; const DISABLE_KERNING_SHAPING_FLAG = 0x04;
#[doc = "Text direction is right-to-left."] /// Text direction is right-to-left.
const RTL_FLAG = 0x08; const RTL_FLAG = 0x08;
#[doc = "Set if word-break is set to keep-all."] /// Set if word-break is set to keep-all.
const KEEP_ALL_FLAG = 0x10; const KEEP_ALL_FLAG = 0x10;
} }
} }

View file

@ -57,10 +57,9 @@ impl StackingContextId {
} }
int_range_index! { int_range_index! {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, MallocSizeOf, Serialize)]
#[doc = "An index that refers to a byte offset in a text run. This could \ /// An index that refers to a byte offset in a text run. This could
point to the middle of a glyph."] /// the middle of a glyph.
#[derive(MallocSizeOf)]
struct ByteIndex(isize) struct ByteIndex(isize)
} }

View file

@ -603,10 +603,11 @@ pub struct BlockFlow {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy)]
struct BlockFlowFlags: u8 { struct BlockFlowFlags: u8 {
#[doc = "If this is set, then this block flow is the root flow."] /// If this is set, then this block flow is the root flow.
const IS_ROOT = 0b0000_0001; const IS_ROOT = 0b0000_0001;
#[doc = "If this is set, then this block flow has overflow and it will scroll."] /// If this is set, then this block flow has overflow and it will scroll.
const HAS_SCROLLING_OVERFLOW = 0b0000_0010; const HAS_SCROLLING_OVERFLOW = 0b0000_0010;
} }
} }
@ -1663,9 +1664,7 @@ impl BlockFlow {
// //
// TODO(#2265, pcwalton): Do this in the cascade instead. // TODO(#2265, pcwalton): Do this in the cascade instead.
let containing_block_text_align = self.fragment.style().get_inherited_text().text_align; let containing_block_text_align = self.fragment.style().get_inherited_text().text_align;
kid.mut_base() kid.mut_base().text_align = containing_block_text_align;
.flags
.set_text_align(containing_block_text_align);
// Handle `text-indent` on behalf of any inline children that we have. This is // Handle `text-indent` on behalf of any inline children that we have. This is
// necessary because any percentages are relative to the containing block, which only // necessary because any percentages are relative to the containing block, which only
@ -2970,7 +2969,7 @@ pub trait ISizeAndMarginsComputer {
// Check for direction of parent flow (NOT Containing Block) // Check for direction of parent flow (NOT Containing Block)
let block_mode = block.base.writing_mode; let block_mode = block.base.writing_mode;
let container_mode = block.base.block_container_writing_mode; let container_mode = block.base.block_container_writing_mode;
let block_align = block.base.flags.text_align(); let block_align = block.base.text_align;
// FIXME (mbrubeck): Handle vertical writing modes. // FIXME (mbrubeck): Handle vertical writing modes.
let parent_has_same_direction = container_mode.is_bidi_ltr() == block_mode.is_bidi_ltr(); let parent_has_same_direction = container_mode.is_bidi_ltr() == block_mode.is_bidi_ltr();

View file

@ -51,10 +51,11 @@ impl Default for LayoutData {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy)]
pub struct LayoutDataFlags: u8 { pub struct LayoutDataFlags: u8 {
#[doc = "Whether a flow has been newly constructed."] /// Whether a flow has been newly constructed.
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01; const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01;
#[doc = "Whether this node has been traversed by layout."] /// Whether this node has been traversed by layout.
const HAS_BEEN_TRAVERSED = 0x02; const HAS_BEEN_TRAVERSED = 0x02;
} }
} }

View file

@ -2223,6 +2223,7 @@ impl Fragment {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy)]
pub struct StackingContextCollectionFlags: u8 { pub struct StackingContextCollectionFlags: u8 {
/// This flow never establishes a containing block. /// This flow never establishes a containing block.
const POSITION_NEVER_CREATES_CONTAINING_BLOCK = 0b001; const POSITION_NEVER_CREATES_CONTAINING_BLOCK = 0b001;

View file

@ -658,7 +658,7 @@ impl FlexFlow {
// Per CSS 2.1 § 16.3.1, text alignment propagates to all children in flow. // Per CSS 2.1 § 16.3.1, text alignment propagates to all children in flow.
// //
// TODO(#2265, pcwalton): Do this in the cascade instead. // TODO(#2265, pcwalton): Do this in the cascade instead.
block.base.flags.set_text_align(containing_block_text_align); block.base.text_align = containing_block_text_align;
let margin = block.fragment.style().logical_margin(); let margin = block.fragment.style().logical_margin();
let auto_len = if line.auto_margin_count == 0 || line.free_space <= Au(0) { let auto_len = if line.auto_margin_count == 0 || line.free_space <= Au(0) {

View file

@ -47,7 +47,6 @@ use app_units::Au;
use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use euclid::default::{Point2D, Rect, Size2D, Vector2D};
use gfx_traits::print_tree::PrintTree; use gfx_traits::print_tree::PrintTree;
use gfx_traits::StackingContextId; use gfx_traits::StackingContextId;
use num_traits::cast::FromPrimitive;
use serde::ser::{Serialize, SerializeStruct, Serializer}; use serde::ser::{Serialize, SerializeStruct, Serializer};
use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect}; use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect};
use std::fmt; use std::fmt;
@ -613,73 +612,53 @@ impl FlowClass {
} }
bitflags! { bitflags! {
#[doc = "Flags used in flows."] /// Flags used in flows.
#[derive(Clone, Copy, Debug)]
pub struct FlowFlags: u32 { pub struct FlowFlags: u32 {
// text align flags /// Whether this flow is absolutely positioned. This is checked all over layout, so a
#[doc = "Whether this flow is absolutely positioned. This is checked all over layout, so a"] /// virtual call is too expensive.
#[doc = "virtual call is too expensive."]
const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000; const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000;
#[doc = "Whether this flow clears to the left. This is checked all over layout, so a"] /// Whether this flow clears to the left. This is checked all over layout, so a
#[doc = "virtual call is too expensive."] /// virtual call is too expensive.
const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000; const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000;
#[doc = "Whether this flow clears to the right. This is checked all over layout, so a"] /// Whether this flow clears to the right. This is checked all over layout, so a
#[doc = "virtual call is too expensive."] /// virtual call is too expensive.
const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000; const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000;
#[doc = "Whether this flow is left-floated. This is checked all over layout, so a"] /// Whether this flow is left-floated. This is checked all over layout, so a
#[doc = "virtual call is too expensive."] /// virtual call is too expensive.
const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000; const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000;
#[doc = "Whether this flow is right-floated. This is checked all over layout, so a"] /// Whether this flow is right-floated. This is checked all over layout, so a
#[doc = "virtual call is too expensive."] /// virtual call is too expensive.
const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000; const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000;
#[doc = "Text alignment. \ /// Whether this flow has a fragment with `counter-reset` or `counter-increment`
\ /// styles.
NB: If you update this, update `TEXT_ALIGN_SHIFT` below."] const AFFECTS_COUNTERS = 0b0000_0000_0000_1000_0000_0000;
const TEXT_ALIGN = 0b0000_0000_0111_1000_0000_0000; /// Whether this flow's descendants have fragments that affect `counter-reset` or
#[doc = "Whether this flow has a fragment with `counter-reset` or `counter-increment` \ // `counter-increment` styles.
styles."] const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0000_0001_0000_0000_0000;
const AFFECTS_COUNTERS = 0b0000_0000_1000_0000_0000_0000; /// Whether this flow behaves as though it had `position: static` for the purposes
#[doc = "Whether this flow's descendants have fragments that affect `counter-reset` or \ /// of positioning in the inline direction. This is set for flows with `position:
`counter-increment` styles."] /// static` and `position: relative` as well as absolutely-positioned flows with
const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0001_0000_0000_0000_0000; /// unconstrained positions in the inline direction."]
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \ const INLINE_POSITION_IS_STATIC = 0b0000_0000_0010_0000_0000_0000;
of positioning in the inline direction. This is set for flows with `position: \ /// Whether this flow behaves as though it had `position: static` for the purposes
static` and `position: relative` as well as absolutely-positioned flows with \ /// of positioning in the block direction. This is set for flows with `position:
unconstrained positions in the inline direction."] /// static` and `position: relative` as well as absolutely-positioned flows with
const INLINE_POSITION_IS_STATIC = 0b0000_0010_0000_0000_0000_0000; /// unconstrained positions in the block direction.
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \ const BLOCK_POSITION_IS_STATIC = 0b0000_0000_0100_0000_0000_0000;
of positioning in the block direction. This is set for flows with `position: \
static` and `position: relative` as well as absolutely-positioned flows with \
unconstrained positions in the block direction."]
const BLOCK_POSITION_IS_STATIC = 0b0000_0100_0000_0000_0000_0000;
/// Whether any ancestor is a fragmentation container /// Whether any ancestor is a fragmentation container
const CAN_BE_FRAGMENTED = 0b0000_1000_0000_0000_0000_0000; const CAN_BE_FRAGMENTED = 0b0000_0000_1000_0000_0000_0000;
/// Whether this flow contains any text and/or replaced fragments. /// Whether this flow contains any text and/or replaced fragments.
const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0001_0000_0000_0000_0000_0000; const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0000_0001_0000_0000_0000_0000;
/// Whether margins are prohibited from collapsing with this flow. /// Whether margins are prohibited from collapsing with this flow.
const MARGINS_CANNOT_COLLAPSE = 0b0010_0000_0000_0000_0000_0000; const MARGINS_CANNOT_COLLAPSE = 0b0000_0010_0000_0000_0000_0000;
} }
} }
/// The number of bits we must shift off to handle the text alignment field.
///
/// NB: If you update this, update `TEXT_ALIGN` above.
static TEXT_ALIGN_SHIFT: usize = 11;
impl FlowFlags { impl FlowFlags {
#[inline]
pub fn text_align(self) -> TextAlign {
TextAlign::from_u32((self & FlowFlags::TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
}
#[inline]
pub fn set_text_align(&mut self, value: TextAlign) {
*self = (*self & !FlowFlags::TEXT_ALIGN) |
FlowFlags::from_bits((value as u32) << TEXT_ALIGN_SHIFT).unwrap();
}
#[inline] #[inline]
pub fn float_kind(&self) -> Float { pub fn float_kind(&self) -> Float {
if self.contains(FlowFlags::FLOATS_LEFT) { if self.contains(FlowFlags::FLOATS_LEFT) {
@ -936,6 +915,9 @@ pub struct BaseFlow {
/// Various flags for flows, tightly packed to save space. /// Various flags for flows, tightly packed to save space.
pub flags: FlowFlags, pub flags: FlowFlags,
/// Text alignment of this flow.
pub text_align: TextAlign,
/// The ID of the StackingContext that contains this flow. This is initialized /// The ID of the StackingContext that contains this flow. This is initialized
/// to 0, but it assigned during the collect_stacking_contexts phase of display /// to 0, but it assigned during the collect_stacking_contexts phase of display
/// list construction. /// list construction.
@ -1115,8 +1097,9 @@ impl BaseFlow {
early_absolute_position_info: EarlyAbsolutePositionInfo::new(writing_mode), early_absolute_position_info: EarlyAbsolutePositionInfo::new(writing_mode),
late_absolute_position_info: LateAbsolutePositionInfo::new(), late_absolute_position_info: LateAbsolutePositionInfo::new(),
clip: MaxRect::max_rect(), clip: MaxRect::max_rect(),
flags: flags, flags,
writing_mode: writing_mode, text_align: TextAlign::Start,
writing_mode,
thread_id: 0, thread_id: 0,
stacking_context_id: StackingContextId::root(), stacking_context_id: StackingContextId::root(),
clipping_and_scrolling: None, clipping_and_scrolling: None,

View file

@ -534,6 +534,7 @@ pub struct ScannedTextFragmentInfo {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy)]
pub struct ScannedTextFlags: u8 { pub struct ScannedTextFlags: u8 {
/// Whether a line break is required after this fragment if wrapping on newlines (e.g. if /// Whether a line break is required after this fragment if wrapping on newlines (e.g. if
/// `white-space: pre` is in effect). /// `white-space: pre` is in effect).
@ -3328,10 +3329,10 @@ bitflags! {
// Various flags we can use when splitting fragments. See // Various flags we can use when splitting fragments. See
// `calculate_split_position_using_breaking_strategy()`. // `calculate_split_position_using_breaking_strategy()`.
struct SplitOptions: u8 { struct SplitOptions: u8 {
#[doc = "True if this is the first fragment on the line."] /// True if this is the first fragment on the line."]
const STARTS_LINE = 0x01; const STARTS_LINE = 0x01;
#[doc = "True if we should attempt to split at character boundaries if this split fails. \ /// True if we should attempt to split at character boundaries if this split fails. \
This is used to implement `overflow-wrap: break-word`."] /// This is used to implement `overflow-wrap: break-word`."]
const RETRY_AT_CHARACTER_BOUNDARIES = 0x02; const RETRY_AT_CHARACTER_BOUNDARIES = 0x02;
} }
} }
@ -3446,6 +3447,7 @@ impl Overflow {
} }
bitflags! { bitflags! {
#[derive(Clone, Debug)]
pub struct FragmentFlags: u8 { pub struct FragmentFlags: u8 {
// TODO(stshine): find a better name since these flags can also be used for grid item. // TODO(stshine): find a better name since these flags can also be used for grid item.
/// Whether this fragment represents a child in a row flex container. /// Whether this fragment represents a child in a row flex container.

View file

@ -16,8 +16,8 @@ pub enum RelayoutMode {
bitflags! { bitflags! {
pub struct SpecialRestyleDamage: u8 { pub struct SpecialRestyleDamage: u8 {
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \ /// If this flag is set, we need to reflow the entire document. This is more or less a
temporary hack to deal with cases that we don't handle incrementally yet."] /// temporary hack to deal with cases that we don't handle incrementally yet.
const REFLOW_ENTIRE_DOCUMENT = 0x01; const REFLOW_ENTIRE_DOCUMENT = 0x01;
} }
} }

View file

@ -221,7 +221,7 @@ impl Line {
int_range_index! { int_range_index! {
#[derive(Serialize)] #[derive(Serialize)]
#[doc = "The index of a fragment in a flattened vector of DOM elements."] /// The index of a fragment in a flattened vector of DOM elements.
struct FragmentIndex(isize) struct FragmentIndex(isize)
} }
@ -1658,7 +1658,7 @@ impl Flow for InlineFlow {
InlineFlow::set_inline_fragment_positions( InlineFlow::set_inline_fragment_positions(
&mut self.fragments, &mut self.fragments,
line, line,
self.base.flags.text_align(), self.base.text_align,
indentation, indentation,
line_index + 1 == line_count, line_index + 1 == line_count,
); );
@ -2053,6 +2053,7 @@ pub struct InlineFragmentNodeInfo {
} }
bitflags! { bitflags! {
#[derive(Clone)]
pub struct InlineFragmentNodeFlags: u8 { pub struct InlineFragmentNodeFlags: u8 {
const FIRST_FRAGMENT_OF_ELEMENT = 0x01; const FIRST_FRAGMENT_OF_ELEMENT = 0x01;
const LAST_FRAGMENT_OF_ELEMENT = 0x02; const LAST_FRAGMENT_OF_ELEMENT = 0x02;

View file

@ -72,10 +72,10 @@ impl From<BaseFragmentInfo> for BaseFragment {
} }
bitflags! { bitflags! {
#[doc = "Flags used to track various information about a DOM node during layout."] /// Flags used to track various information about a DOM node during layout.
#[derive(Serialize)] #[derive(Clone, Copy, Debug, Serialize)]
pub(crate) struct FragmentFlags: u8 { pub(crate) struct FragmentFlags: u8 {
#[doc = "Whether or not this node is a body element on an HTML document."] /// Whether or not this node is a body element on an HTML document.
const IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT = 0b00000001; const IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT = 0b00000001;
} }
} }

View file

@ -7964,7 +7964,7 @@ class GlobalGenRoots():
global_flags = CGWrapper(CGIndenter(CGList([ global_flags = CGWrapper(CGIndenter(CGList([
CGGeneric("const %s = %#x;" % args) CGGeneric("const %s = %#x;" % args)
for args in flags for args in flags
], "\n")), pre="pub struct Globals: u8 {\n", post="\n}") ], "\n")), pre="#[derive(Clone, Copy)]\npub struct Globals: u8 {\n", post="\n}")
globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags! {\n", post="\n}") globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags! {\n", post="\n}")
phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));") phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));")

View file

@ -43,9 +43,11 @@ use servo_url::ServoUrl;
use std::cell::Cell; use std::cell::Cell;
use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::attr::{AttrValue, LengthOrPercentageOrAuto};
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
struct SandboxAllowance(u8);
bitflags! { bitflags! {
#[derive(JSTraceable, MallocSizeOf)] impl SandboxAllowance: u8 {
struct SandboxAllowance: u8 {
const ALLOW_NOTHING = 0x00; const ALLOW_NOTHING = 0x00;
const ALLOW_SAME_ORIGIN = 0x01; const ALLOW_SAME_ORIGIN = 0x01;
const ALLOW_TOP_NAVIGATION = 0x02; const ALLOW_TOP_NAVIGATION = 0x02;

View file

@ -157,28 +157,30 @@ pub struct Node {
style_and_layout_data: DomRefCell<Option<Box<StyleAndOpaqueLayoutData>>>, style_and_layout_data: DomRefCell<Option<Box<StyleAndOpaqueLayoutData>>>,
} }
/// Flags for node items
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub struct NodeFlags(u16);
bitflags! { bitflags! {
#[doc = "Flags for node items."] impl NodeFlags: u16 {
#[derive(JSTraceable, MallocSizeOf)] /// Specifies whether this node is in a document.
pub struct NodeFlags: u16 {
#[doc = "Specifies whether this node is in a document."]
const IS_IN_DOC = 1 << 0; const IS_IN_DOC = 1 << 0;
#[doc = "Specifies whether this node needs style recalc on next reflow."] /// Specifies whether this node needs style recalc on next reflow.
const HAS_DIRTY_DESCENDANTS = 1 << 1; const HAS_DIRTY_DESCENDANTS = 1 << 1;
#[doc = "Specifies whether or not there is an authentic click in progress on \ /// Specifies whether or not there is an authentic click in progress on
this element."] /// this element.
const CLICK_IN_PROGRESS = 1 << 2; const CLICK_IN_PROGRESS = 1 << 2;
#[doc = "Specifies whether this node is focusable and whether it is supposed \ /// Specifies whether this node is focusable and whether it is supposed
to be reachable with using sequential focus navigation."] /// to be reachable with using sequential focus navigation."]
const SEQUENTIALLY_FOCUSABLE = 1 << 3; const SEQUENTIALLY_FOCUSABLE = 1 << 3;
// There are two free bits here. // There are two free bits here.
#[doc = "Specifies whether the parser has set an associated form owner for \ /// Specifies whether the parser has set an associated form owner for
this element. Only applicable for form-associatable elements."] /// this element. Only applicable for form-associatable elements.
const PARSER_ASSOCIATED_FORM_OWNER = 1 << 6; const PARSER_ASSOCIATED_FORM_OWNER = 1 << 6;
/// Whether this element has a snapshot stored due to a style or /// Whether this element has a snapshot stored due to a style or

View file

@ -20,9 +20,11 @@ use std::fmt;
use style::element_state::ElementState; use style::element_state::ElementState;
// https://html.spec.whatwg.org/multipage/#validity-states // https://html.spec.whatwg.org/multipage/#validity-states
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub struct ValidationFlags(u32);
bitflags! { bitflags! {
#[derive(JSTraceable, MallocSizeOf)] impl ValidationFlags: u32 {
pub struct ValidationFlags: u32 {
const VALUE_MISSING = 0b0000000001; const VALUE_MISSING = 0b0000000001;
const TYPE_MISMATCH = 0b0000000010; const TYPE_MISMATCH = 0b0000000010;
const PATTERN_MISMATCH = 0b0000000100; const PATTERN_MISMATCH = 0b0000000100;

View file

@ -136,10 +136,12 @@ where
ObjectValue(rval.get()) ObjectValue(rval.get())
} }
/// Set of bitflags for texture unpacking (texImage2d, etc...)
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
struct TextureUnpacking(u8);
bitflags! { bitflags! {
/// Set of bitflags for texture unpacking (texImage2d, etc...) impl TextureUnpacking: u8 {
#[derive(JSTraceable, MallocSizeOf)]
struct TextureUnpacking: u8 {
const FLIP_Y_AXIS = 0x01; const FLIP_Y_AXIS = 0x01;
const PREMULTIPLY_ALPHA = 0x02; const PREMULTIPLY_ALPHA = 0x02;
const CONVERT_COLORSPACE = 0x04; const CONVERT_COLORSPACE = 0x04;
@ -4703,12 +4705,14 @@ macro_rules! capabilities {
capabilities!($name, $next, $($rest,)* [$name = 1;]); capabilities!($name, $next, $($rest,)* [$name = 1;]);
}; };
($prev:ident, $name:ident, $($rest:ident,)* [$($tt:tt)*]) => { ($prev:ident, $name:ident, $($rest:ident,)* [$($tt:tt)*]) => {
capabilities!($name, $($rest,)* [$($tt)* $name = Self::$prev.bits << 1;]); capabilities!($name, $($rest,)* [$($tt)* $name = Self::$prev.bits() << 1;]);
}; };
($prev:ident, [$($name:ident = $value:expr;)*]) => { ($prev:ident, [$($name:ident = $value:expr;)*]) => {
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub struct CapFlags(u16);
bitflags! { bitflags! {
#[derive(JSTraceable, MallocSizeOf)] impl CapFlags: u16 {
struct CapFlags: u16 {
$(const $name = $value;)* $(const $name = $value;)*
} }
} }