diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index 12fdef2ebad..c6e85dff304 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2113,9 +2113,9 @@ extern "C" { } extern "C" { pub fn Servo_StyleRule_GetSelectorTextAtIndex(rule: - RawServoStyleRuleBorrowed, - index: u32, - result: *mut nsAString); + RawServoStyleRuleBorrowed, + index: u32, + result: *mut nsAString); } extern "C" { pub fn Servo_StyleRule_GetSpecificityAtIndex(rule: diff --git a/components/style/gecko/generated/structs_debug.rs b/components/style/gecko/generated/structs_debug.rs index a0a630f02c3..27e1bb31e48 100644 --- a/components/style/gecko/generated/structs_debug.rs +++ b/components/style/gecko/generated/structs_debug.rs @@ -6644,9 +6644,10 @@ pub mod root { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum TraversalRestyleBehavior { Normal = 0, - ForReconstruct = 1, - ForAnimationOnly = 2, - ForCSSRuleChanges = 3, + ForNewlyBoundElement = 1, + ForReconstruct = 2, + ForAnimationOnly = 3, + ForCSSRuleChanges = 4, } #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -10436,6 +10437,12 @@ pub mod root { eFloatID_SpellCheckerUnderlineRelativeSize = 1, eFloatID_CaretAspectRatio = 2, } + pub const LookAndFeel_FontID_FontID_MINIMUM: + root::mozilla::LookAndFeel_FontID = + LookAndFeel_FontID::eFont_Caption; + pub const LookAndFeel_FontID_FontID_MAXIMUM: + root::mozilla::LookAndFeel_FontID = + LookAndFeel_FontID::eFont_Widget; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum LookAndFeel_FontID { @@ -34397,7 +34404,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_215166_instantiation_103() { + fn __bindgen_test_layout__bindgen_ty_id_215184_instantiation_103() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -34406,7 +34413,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_215202_instantiation_104() { + fn __bindgen_test_layout__bindgen_ty_id_215220_instantiation_104() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); diff --git a/components/style/gecko/generated/structs_release.rs b/components/style/gecko/generated/structs_release.rs index a8b493e82b3..29d5055edd2 100644 --- a/components/style/gecko/generated/structs_release.rs +++ b/components/style/gecko/generated/structs_release.rs @@ -6500,9 +6500,10 @@ pub mod root { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum TraversalRestyleBehavior { Normal = 0, - ForReconstruct = 1, - ForAnimationOnly = 2, - ForCSSRuleChanges = 3, + ForNewlyBoundElement = 1, + ForReconstruct = 2, + ForAnimationOnly = 3, + ForCSSRuleChanges = 4, } #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -10169,6 +10170,12 @@ pub mod root { eFloatID_SpellCheckerUnderlineRelativeSize = 1, eFloatID_CaretAspectRatio = 2, } + pub const LookAndFeel_FontID_FontID_MINIMUM: + root::mozilla::LookAndFeel_FontID = + LookAndFeel_FontID::eFont_Caption; + pub const LookAndFeel_FontID_FontID_MAXIMUM: + root::mozilla::LookAndFeel_FontID = + LookAndFeel_FontID::eFont_Widget; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum LookAndFeel_FontID { @@ -33852,7 +33859,7 @@ pub mod root { root::nsCharTraits ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_211327_instantiation_98() { + fn __bindgen_test_layout__bindgen_ty_id_211345_instantiation_98() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); @@ -33861,7 +33868,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout__bindgen_ty_id_211363_instantiation_99() { + fn __bindgen_test_layout__bindgen_ty_id_211381_instantiation_99() { assert_eq!(::std::mem::size_of::() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( u8 ) )); diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 107781b6c83..1f64b74bc6a 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -263,9 +263,11 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, let traversal_flags = match (root_behavior, restyle_behavior) { (Root::Normal, Restyle::Normal) | + (Root::Normal, Restyle::ForNewlyBoundElement) | (Root::Normal, Restyle::ForAnimationOnly) => TraversalFlags::empty(), (Root::UnstyledChildrenOnly, Restyle::Normal) | + (Root::UnstyledChildrenOnly, Restyle::ForNewlyBoundElement) | (Root::UnstyledChildrenOnly, Restyle::ForAnimationOnly) => UNSTYLED_CHILDREN_ONLY, (Root::Normal, Restyle::ForCSSRuleChanges) => FOR_CSS_RULE_CHANGES, @@ -291,6 +293,14 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, traversal_flags, unsafe { &*snapshots }); + if restyle_behavior == Restyle::ForNewlyBoundElement { + // In this mode, we only ever restyle new elements, so there is no + // need for a post-traversal, and the borrow_data().unwrap() call below + // could panic, so we don't bother computing whether a post-traversal + // is required. + return false; + } + element.has_dirty_descendants() || element.borrow_data().unwrap().has_restyle() }