From 07f86404cd4c58724f85ed6cece05426f8e6702d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 Feb 2018 17:58:59 +0100 Subject: [PATCH 1/4] style: Make the simplified children iterator check account for Shadow DOM on its own. We are relying in the XBL binding for the shadow host, we need to check explicitly. Also, we were checking in_shadow_tree, which is really broad. Just is_html_slot_element should do, since the rest of the nodes should have only light tree children. Bug: 1425759 Reviewed-by: xidorn MozReview-Commit-ID: KAFRVxaLsK --- components/style/gecko/wrapper.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 0c5e283cee7..20e9f9f3860 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -959,7 +959,8 @@ impl<'le> TElement for GeckoElement<'le> { // ::before/::after, XBL bindings, or nsIAnonymousContentCreators. if self.is_in_anonymous_subtree() || self.has_xbl_binding_with_content() || - self.is_in_shadow_tree() || + self.is_html_slot_element() || + self.shadow_root().is_some() || self.may_have_anonymous_children() { unsafe { let mut iter: structs::StyleChildrenIterator = ::std::mem::zeroed(); From 28ea5933471fcec4e615d5f70d9f403bfeac2dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 Feb 2018 19:01:42 +0100 Subject: [PATCH 2/4] style: Make a style sharing check account for Shadow DOM explicitly too. Good I added tests for this (style-sharing-across-shadow.html). Bug: 1425759 Reviewed-by: xidorn MozReview-Commit-ID: 7d4WioCDAn7 --- components/style/gecko/wrapper.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 20e9f9f3860..aadf55dd6a7 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -991,7 +991,7 @@ impl<'le> TElement for GeckoElement<'le> { return self.as_node().owner_doc().as_node(); } - if self.xbl_binding().is_some() { + if self.xbl_binding().is_some() || self.shadow_root().is_some() { return self.as_node(); } From cfbdf3d694740bf0120dc07611e9fd1881fc3bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 Feb 2018 18:01:42 +0100 Subject: [PATCH 3/4] style: Make Shadow DOM not use XBL anymore. More improvements to come. In particular, this still iterates through Shadow DOM in each_xbl_cascade_data, but that should be changed later. That allows to cleanup a bunch of stuff and finally fix Shadow DOM cascade order. We still rely on the binding parent to be setup properly in the shadow tree, but that requirement can go away later (we can walk the containing shadow chain instead). This mostly focuses on removing the XBL binding from the Shadow host. It'd be nice to do EnumerateShadowRoots faster. I think that should also be a followup, if needed. Bug: 1425759 Reviewed-by: xidorn MozReview-Commit-ID: Jf2iGvLC5de --- components/style/gecko/wrapper.rs | 31 +++++++++++++++++++++------- ports/geckolib/glue.rs | 34 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index aadf55dd6a7..e8bfdf6dbc7 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1409,19 +1409,36 @@ impl<'le> TElement for GeckoElement<'le> { // If we are a NAC pseudo-element, we want to get rules from our // rule_hash_target, that is, our originating element. let mut current = Some(self.rule_hash_target()); - while let Some(element) = current { + // TODO(emilio): Deal with Shadow DOM separately than with XBL + // (right now we still rely on get_xbl_binding_parent()). + // + // That will allow to clean up a bunch in + // push_applicable_declarations. + if let Some(shadow) = element.shadow_root() { + debug_assert!(!shadow.mServoStyles.mPtr.is_null()); + let author_styles = unsafe { + &*(shadow.mServoStyles.mPtr + as *const structs::RawServoAuthorStyles + as *const bindings::RawServoAuthorStyles) + }; + + let author_styles: &'a _ = AuthorStyles::::from_ffi(author_styles); + f(&author_styles.data, author_styles.quirks_mode); + if element != *self { + break; + } + } + if let Some(binding) = element.xbl_binding() { binding.each_xbl_cascade_data(&mut f); // If we're not looking at our original element, allow the // binding to cut off style inheritance. - if element != *self { - if !binding.inherits_style() { - // Go no further; we're not inheriting style from - // anything above here. - break; - } + if element != *self && !binding.inherits_style() { + // Go no further; we're not inheriting style from + // anything above here. + break; } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 9f6a64e0dd1..1896b87fa71 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1149,6 +1149,40 @@ pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet( styles.stylesheets.append_stylesheet(None, sheet, &guard); } +#[no_mangle] +pub unsafe extern "C" fn Servo_AuthorStyles_InsertStyleSheetBefore( + styles: RawServoAuthorStylesBorrowedMut, + sheet: *const ServoStyleSheet, + before_sheet: *const ServoStyleSheet, +) { + let styles = AuthorStyles::::from_ffi_mut(styles); + + let global_style_data = &*GLOBAL_STYLE_DATA; + let guard = global_style_data.shared_lock.read(); + styles.stylesheets.insert_stylesheet_before( + None, + GeckoStyleSheet::new(sheet), + GeckoStyleSheet::new(before_sheet), + &guard, + ); +} + +#[no_mangle] +pub unsafe extern "C" fn Servo_AuthorStyles_RemoveStyleSheet( + styles: RawServoAuthorStylesBorrowedMut, + sheet: *const ServoStyleSheet, +) { + let styles = AuthorStyles::::from_ffi_mut(styles); + + let global_style_data = &*GLOBAL_STYLE_DATA; + let guard = global_style_data.shared_lock.read(); + styles.stylesheets.remove_stylesheet( + None, + GeckoStyleSheet::new(sheet), + &guard, + ); +} + #[no_mangle] pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty( styles: RawServoAuthorStylesBorrowedMut, From a5957fadf6217c42788fde7b8c806ac036d19c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 27 Feb 2018 11:12:06 +0100 Subject: [PATCH 4/4] style: Update bindings. --- components/style/gecko/generated/bindings.rs | 13 + components/style/gecko/generated/structs.rs | 914 ++++++++++++++++--- 2 files changed, 818 insertions(+), 109 deletions(-) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index a801c5a9c5f..bbc833f1f8b 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2298,6 +2298,19 @@ extern "C" { gecko_sheet: *const ServoStyleSheet, ); } +extern "C" { + pub fn Servo_AuthorStyles_RemoveStyleSheet( + self_: RawServoAuthorStylesBorrowedMut, + gecko_sheet: *const ServoStyleSheet, + ); +} +extern "C" { + pub fn Servo_AuthorStyles_InsertStyleSheetBefore( + self_: RawServoAuthorStylesBorrowedMut, + gecko_sheet: *const ServoStyleSheet, + before: *const ServoStyleSheet, + ); +} extern "C" { pub fn Servo_AuthorStyles_ForceDirty(self_: RawServoAuthorStylesBorrowedMut); } diff --git a/components/style/gecko/generated/structs.rs b/components/style/gecko/generated/structs.rs index 38e0d1f9d1b..3f6b903ac66 100644 --- a/components/style/gecko/generated/structs.rs +++ b/components/style/gecko/generated/structs.rs @@ -2033,6 +2033,73 @@ pub mod root { ); } #[repr(C)] + #[derive(Debug)] + pub struct Rule { + pub _base: root::nsISupports, + pub _base_1: root::nsWrapperCache, + pub mRefCnt: root::nsCycleCollectingAutoRefCnt, + pub mSheet: *mut root::mozilla::StyleSheet, + pub mParentRule: *mut root::mozilla::css::GroupRule, + pub mLineNumber: u32, + pub mColumnNumber: u32, + } + pub type Rule_HasThreadSafeRefCnt = root::mozilla::FalseType; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Rule_cycleCollection { + pub _base: root::nsXPCOMCycleCollectionParticipant, + } + #[test] + fn bindgen_test_layout_Rule_cycleCollection() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(Rule_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(Rule_cycleCollection)) + ); + } + impl Clone for Rule_cycleCollection { + fn clone(&self) -> Self { + *self + } + } + pub const Rule_UNKNOWN_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 0; + pub const Rule_CHARSET_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 1; + pub const Rule_IMPORT_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 2; + pub const Rule_NAMESPACE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 3; + pub const Rule_STYLE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 4; + pub const Rule_MEDIA_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 5; + pub const Rule_FONT_FACE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 6; + pub const Rule_PAGE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 7; + pub const Rule_KEYFRAME_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 8; + pub const Rule_KEYFRAMES_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 9; + pub const Rule_DOCUMENT_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 10; + pub const Rule_SUPPORTS_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 11; + pub const Rule_FONT_FEATURE_VALUES_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 12; + pub const Rule_COUNTER_STYLE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 13; + pub type Rule__bindgen_ty_1 = u32; + extern "C" { + #[link_name = "\u{1}_ZN7mozilla3css4Rule21_cycleCollectorGlobalE"] + pub static mut Rule__cycleCollectorGlobal: root::mozilla::css::Rule_cycleCollection; + } + #[test] + fn bindgen_test_layout_Rule() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(Rule)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(Rule)) + ); + } + #[repr(C)] pub struct ErrorReporter { pub mError: root::nsAutoString, pub mErrorLine: ::nsstring::nsStringRepr, @@ -2203,73 +2270,6 @@ pub mod root { eDomain = 2, eRegExp = 3, } - #[repr(C)] - #[derive(Debug)] - pub struct Rule { - pub _base: root::nsISupports, - pub _base_1: root::nsWrapperCache, - pub mRefCnt: root::nsCycleCollectingAutoRefCnt, - pub mSheet: *mut root::mozilla::StyleSheet, - pub mParentRule: *mut root::mozilla::css::GroupRule, - pub mLineNumber: u32, - pub mColumnNumber: u32, - } - pub type Rule_HasThreadSafeRefCnt = root::mozilla::FalseType; - #[repr(C)] - #[derive(Debug, Copy)] - pub struct Rule_cycleCollection { - pub _base: root::nsXPCOMCycleCollectionParticipant, - } - #[test] - fn bindgen_test_layout_Rule_cycleCollection() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(Rule_cycleCollection)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(Rule_cycleCollection)) - ); - } - impl Clone for Rule_cycleCollection { - fn clone(&self) -> Self { - *self - } - } - pub const Rule_UNKNOWN_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 0; - pub const Rule_CHARSET_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 1; - pub const Rule_IMPORT_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 2; - pub const Rule_NAMESPACE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 3; - pub const Rule_STYLE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 4; - pub const Rule_MEDIA_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 5; - pub const Rule_FONT_FACE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 6; - pub const Rule_PAGE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 7; - pub const Rule_KEYFRAME_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 8; - pub const Rule_KEYFRAMES_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 9; - pub const Rule_DOCUMENT_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 10; - pub const Rule_SUPPORTS_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 11; - pub const Rule_FONT_FEATURE_VALUES_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 12; - pub const Rule_COUNTER_STYLE_RULE: root::mozilla::css::Rule__bindgen_ty_1 = 13; - pub type Rule__bindgen_ty_1 = u32; - extern "C" { - #[link_name = "\u{1}_ZN7mozilla3css4Rule21_cycleCollectorGlobalE"] - pub static mut Rule__cycleCollectorGlobal: root::mozilla::css::Rule_cycleCollection; - } - #[test] - fn bindgen_test_layout_Rule() { - assert_eq!( - ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(Rule)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(Rule)) - ); - } } #[repr(C)] #[derive(Debug)] @@ -2600,6 +2600,11 @@ pub mod root { } #[repr(C)] #[derive(Debug, Copy, Clone)] + pub struct Promise { + _unused: [u8; 0], + } + #[repr(C)] + #[derive(Debug, Copy, Clone)] pub struct ClientSource { _unused: [u8; 0], } @@ -2608,11 +2613,6 @@ pub mod root { pub struct CSSImportRule { _unused: [u8; 0], } - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct ShadowRoot { - _unused: [u8; 0], - } /// Struct that stores info on an attribute. The name and value must either both /// be null or both be non-null. /// @@ -3941,6 +3941,10 @@ pub mod root { concat!("Alignment of ", stringify!(DOMRectReadOnly)) ); } + pub const ShadowRootMode_Open: root::mozilla::dom::ShadowRootMode = 0; + pub const ShadowRootMode_Closed: root::mozilla::dom::ShadowRootMode = 1; + pub const ShadowRootMode_EndGuard_: root::mozilla::dom::ShadowRootMode = 2; + pub type ShadowRootMode = u8; #[repr(C)] pub struct Element { pub _base: root::mozilla::dom::FragmentOrElement, @@ -4181,6 +4185,109 @@ pub mod root { EndGuard_ = 2, } #[repr(C)] + pub struct DocumentFragment { + pub _base: root::mozilla::dom::FragmentOrElement, + pub _base_1: root::nsIDOMDocumentFragment, + pub mHost: root::RefPtr, + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct DocumentFragment_cycleCollection { + pub _base: root::mozilla::dom::FragmentOrElement_cycleCollection, + } + #[test] + fn bindgen_test_layout_DocumentFragment_cycleCollection() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(DocumentFragment_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(DocumentFragment_cycleCollection) + ) + ); + } + impl Clone for DocumentFragment_cycleCollection { + fn clone(&self) -> Self { + *self + } + } + extern "C" { + #[link_name = "\u{1}_ZN7mozilla3dom16DocumentFragment21_cycleCollectorGlobalE"] + pub static mut DocumentFragment__cycleCollectorGlobal: + root::mozilla::dom::DocumentFragment_cycleCollection; + } + #[test] + fn bindgen_test_layout_DocumentFragment() { + assert_eq!( + ::std::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(DocumentFragment)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(DocumentFragment)) + ); + } + #[repr(C)] + pub struct ShadowRoot { + pub _base: root::mozilla::dom::DocumentFragment, + pub _base_1: root::mozilla::dom::DocumentOrShadowRoot, + pub _base_2: root::nsStubMutationObserver, + pub mMode: root::mozilla::dom::ShadowRootMode, + pub mServoStyles: root::mozilla::UniquePtr, + pub mStyleRuleMap: root::mozilla::UniquePtr, + pub mSlotMap: [u64; 4usize], + pub mIsComposedDocParticipant: bool, + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct ShadowRoot_cycleCollection { + pub _base: root::mozilla::dom::DocumentFragment_cycleCollection, + } + #[test] + fn bindgen_test_layout_ShadowRoot_cycleCollection() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ShadowRoot_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ShadowRoot_cycleCollection)) + ); + } + impl Clone for ShadowRoot_cycleCollection { + fn clone(&self) -> Self { + *self + } + } + pub type ShadowRoot_SlotArray = u8; + extern "C" { + #[link_name = "\u{1}_ZN7mozilla3dom10ShadowRoot21_cycleCollectorGlobalE"] + pub static mut ShadowRoot__cycleCollectorGlobal: + root::mozilla::dom::ShadowRoot_cycleCollection; + } + #[test] + fn bindgen_test_layout_ShadowRoot() { + assert_eq!( + ::std::mem::size_of::(), + 256usize, + concat!("Size of: ", stringify!(ShadowRoot)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ShadowRoot)) + ); + } + #[repr(C)] #[derive(Debug, Copy)] pub struct ExplicitChildIterator { pub mParent: *const root::nsIContent, @@ -5642,7 +5749,8 @@ pub mod root { pub const UpdateAnimationsTasks_CSSTransitions: root::mozilla::UpdateAnimationsTasks = 2; pub const UpdateAnimationsTasks_EffectProperties: root::mozilla::UpdateAnimationsTasks = 4; pub const UpdateAnimationsTasks_CascadeResults: root::mozilla::UpdateAnimationsTasks = 8; - pub const UpdateAnimationsTasks_DisplayChangedFromNone: root::mozilla::UpdateAnimationsTasks = 16; + pub const UpdateAnimationsTasks_DisplayChangedFromNone: + root::mozilla::UpdateAnimationsTasks = 16; pub type UpdateAnimationsTasks = u8; pub const ParsingMode_Default: root::mozilla::ParsingMode = 0; pub const ParsingMode_AllowUnitlessLength: root::mozilla::ParsingMode = 1; @@ -6428,6 +6536,11 @@ pub mod root { pub struct Encoding { _unused: [u8; 0], } + #[repr(C)] + #[derive(Debug, Copy, Clone)] + pub struct DOMEventTargetHelper { + _unused: [u8; 0], + } pub const UseCounter_eUseCounter_UNKNOWN: root::mozilla::UseCounter = -1; pub const UseCounter_eUseCounter_SVGSVGElement_getElementById: root::mozilla::UseCounter = 0; @@ -9169,6 +9282,156 @@ pub mod root { ); } #[repr(C)] + #[derive(Debug)] + pub struct BindingStyleRule { + pub _base: root::mozilla::css::Rule, + } + #[test] + fn bindgen_test_layout_BindingStyleRule() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(BindingStyleRule)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(BindingStyleRule)) + ); + } + #[repr(C)] + #[derive(Debug)] + pub struct ServoStyleRuleDeclaration { + pub _base: root::nsDOMCSSDeclaration, + pub mDecls: root::RefPtr, + } + #[test] + fn bindgen_test_layout_ServoStyleRuleDeclaration() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(ServoStyleRuleDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRuleDeclaration)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mDecls as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ServoStyleRuleDeclaration), + "::", + stringify!(mDecls) + ) + ); + } + #[repr(C)] + #[derive(Debug)] + pub struct ServoStyleRule { + pub _base: root::mozilla::BindingStyleRule, + pub _base_1: u64, + pub mRawRule: root::RefPtr, + pub mDecls: root::mozilla::ServoStyleRuleDeclaration, + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct ServoStyleRule_cycleCollection { + pub _base: root::mozilla::css::Rule_cycleCollection, + } + #[test] + fn bindgen_test_layout_ServoStyleRule_cycleCollection() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ServoStyleRule_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRule_cycleCollection)) + ); + } + impl Clone for ServoStyleRule_cycleCollection { + fn clone(&self) -> Self { + *self + } + } + extern "C" { + #[link_name = "\u{1}_ZN7mozilla14ServoStyleRule21_cycleCollectorGlobalE"] + pub static mut ServoStyleRule__cycleCollectorGlobal: + root::mozilla::ServoStyleRule_cycleCollection; + } + #[test] + fn bindgen_test_layout_ServoStyleRule() { + assert_eq!( + ::std::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(ServoStyleRule)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRule)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mRawRule as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ServoStyleRule), + "::", + stringify!(mRawRule) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).mDecls as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(ServoStyleRule), + "::", + stringify!(mDecls) + ) + ); + } + #[repr(C)] + #[derive(Debug)] + pub struct ServoStyleRuleMap { + pub mTable: root::mozilla::ServoStyleRuleMap_Hashtable, + } + pub type ServoStyleRuleMap_Hashtable = [u64; 4usize]; + #[test] + fn bindgen_test_layout_ServoStyleRuleMap() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(ServoStyleRuleMap)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRuleMap)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mTable as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ServoStyleRuleMap), + "::", + stringify!(mTable) + ) + ); + } + #[repr(C)] #[derive(Debug, Copy)] pub struct ComputedTimingFunction { pub mType: root::nsTimingFunction_Type, @@ -11457,11 +11720,6 @@ pub mod root { ) ); } - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct ServoStyleRuleMap { - _unused: [u8; 0], - } pub const OriginFlags_UserAgent: root::mozilla::OriginFlags = root::mozilla::OriginFlags(1); pub const OriginFlags_User: root::mozilla::OriginFlags = root::mozilla::OriginFlags(2); pub const OriginFlags_Author: root::mozilla::OriginFlags = root::mozilla::OriginFlags(4); @@ -12511,6 +12769,9 @@ pub mod root { NS_ERROR_UC_UPDATE_BUILD_PREFIX_FAILURE = 2154758153, NS_ERROR_UC_UPDATE_FAIL_TO_WRITE_DISK = 2154758154, NS_ERROR_UC_UPDATE_PROTOCOL_PARSER_ERROR = 2154758155, + NS_ERROR_UC_PARSER_MISSING_PARAM = 2154758156, + NS_ERROR_UC_PARSER_DECODE_FAILURE = 2154758157, + NS_ERROR_UC_PARSER_UNKNOWN_THREAT = 2154758158, NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION = 2154823681, NS_ERROR_INTERNAL_ERRORRESULT_DOMEXCEPTION = 2154823682, NS_ERROR_INTERNAL_ERRORRESULT_EXCEPTION_ON_JSCONTEXT = 2154823683, @@ -19660,6 +19921,7 @@ pub mod root { pub _base: root::nsISupports, pub _base_1: root::mozilla::dom::DispatcherTrait, pub mHostObjectURIs: root::nsTArray, + pub mEventTargetObjects: [u64; 4usize], pub mIsDying: bool, } #[repr(C)] @@ -19671,7 +19933,7 @@ pub mod root { fn bindgen_test_layout_nsIGlobalObject() { assert_eq!( ::std::mem::size_of::(), - 32usize, + 64usize, concat!("Size of: ", stringify!(nsIGlobalObject)) ); assert_eq!( @@ -19698,7 +19960,7 @@ pub mod root { fn bindgen_test_layout_nsIScriptGlobalObject() { assert_eq!( ::std::mem::size_of::(), - 32usize, + 64usize, concat!("Size of: ", stringify!(nsIScriptGlobalObject)) ); assert_eq!( @@ -21868,6 +22130,7 @@ pub mod root { pub mFontFaceSet: root::RefPtr, pub mLastFocusTime: root::mozilla::TimeStamp, pub mDocumentState: root::mozilla::EventStates, + pub mReadyForIdle: root::RefPtr, pub _bitfield_1: root::__BindgenBitfieldUnit<[u8; 7usize], u8>, pub mCompatMode: root::nsCompatibility, pub mReadyState: root::nsIDocument_ReadyState, @@ -22362,7 +22625,7 @@ pub mod root { fn bindgen_test_layout_nsIDocument() { assert_eq!( ::std::mem::size_of::(), - 928usize, + 936usize, concat!("Size of: ", stringify!(nsIDocument)) ); assert_eq!( @@ -36681,6 +36944,229 @@ pub mod root { concat!("Alignment of ", stringify!(nsGenericHTMLElement)) ); } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct nsIDOMDocumentFragment { + pub _base: root::nsIDOMNode, + } + #[repr(C)] + #[derive(Debug, Copy, Clone)] + pub struct nsIDOMDocumentFragment_COMTypeInfo { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_nsIDOMDocumentFragment() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(nsIDOMDocumentFragment)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nsIDOMDocumentFragment)) + ); + } + impl Clone for nsIDOMDocumentFragment { + fn clone(&self) -> Self { + *self + } + } + /// Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule, + /// for use from bindings code. + #[repr(C)] + #[derive(Debug)] + pub struct nsICSSDeclaration { + pub _base: root::nsISupports, + pub _base_1: root::nsWrapperCache, + } + #[repr(C)] + #[derive(Debug, Copy, Clone)] + pub struct nsICSSDeclaration_COMTypeInfo { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_nsICSSDeclaration() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(nsICSSDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nsICSSDeclaration)) + ); + } + #[repr(C)] + #[derive(Debug)] + pub struct nsDOMCSSDeclaration { + pub _base: root::nsICSSDeclaration, + } + #[repr(C)] + #[derive(Debug)] + pub struct nsDOMCSSDeclaration_ServoCSSParsingEnvironment { + pub mUrlExtraData: root::RefPtr, + pub mCompatMode: root::nsCompatibility, + pub mLoader: *mut root::mozilla::css::Loader, + } + #[test] + fn bindgen_test_layout_nsDOMCSSDeclaration_ServoCSSParsingEnvironment() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!( + "Size of: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .mUrlExtraData as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment), + "::", + stringify!(mUrlExtraData) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .mCompatMode as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment), + "::", + stringify!(mCompatMode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mLoader + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment), + "::", + stringify!(mLoader) + ) + ); + } + pub const nsDOMCSSDeclaration_Operation_eOperation_Read: root::nsDOMCSSDeclaration_Operation = + 0; + pub const nsDOMCSSDeclaration_Operation_eOperation_Modify: root::nsDOMCSSDeclaration_Operation = + 1; + pub const nsDOMCSSDeclaration_Operation_eOperation_RemoveProperty: + root::nsDOMCSSDeclaration_Operation = 2; + pub type nsDOMCSSDeclaration_Operation = u32; + #[repr(C)] + #[derive(Debug)] + pub struct nsDOMCSSDeclaration_CSSParsingEnvironment { + pub mSheetURI: *mut root::nsIURI, + pub mBaseURI: root::nsCOMPtr, + pub mPrincipal: *mut root::nsIPrincipal, + pub mCSSLoader: *mut root::mozilla::css::Loader, + } + #[test] + fn bindgen_test_layout_nsDOMCSSDeclaration_CSSParsingEnvironment() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mSheetURI + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mSheetURI) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mBaseURI + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mBaseURI) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mPrincipal + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mPrincipal) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).mCSSLoader + as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mCSSLoader) + ) + ); + } + #[test] + fn bindgen_test_layout_nsDOMCSSDeclaration() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(nsDOMCSSDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(nsDOMCSSDeclaration)) + ); + } /// Utility class to provide scaling defined in a keySplines element. #[repr(C)] #[derive(Debug, Copy)] @@ -37057,7 +37543,7 @@ pub mod root { pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozFocusOuter: u32 = 0; pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozListBullet: u32 = 0; pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozListNumber: u32 = 0; - pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozMathAnonymous: u32 = 0; + pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozMathAnonymous: u32 = 16; pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberWrapper: u32 = 56; pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberText: u32 = 56; pub const SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberSpinBox: u32 = 56; @@ -37400,30 +37886,6 @@ pub mod root { } #[repr(C)] #[derive(Debug)] - pub struct nsICSSDeclaration { - pub _base: root::nsISupports, - pub _base_1: root::nsWrapperCache, - } - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct nsICSSDeclaration_COMTypeInfo { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_nsICSSDeclaration() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(nsICSSDeclaration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nsICSSDeclaration)) - ); - } - #[repr(C)] - #[derive(Debug)] pub struct nsCSSFontFaceStyleDecl { pub _base: root::nsICSSDeclaration, pub mDescriptors: root::mozilla::CSSFontFaceDescriptors, @@ -37842,6 +38304,10 @@ pub mod root { #[link_name = "\u{1}_ZN14nsContentUtils37sIsPerformanceNavigationTimingEnabledE"] pub static mut nsContentUtils_sIsPerformanceNavigationTimingEnabled: bool; } + extern "C" { + #[link_name = "\u{1}_ZN14nsContentUtils38sIsUpgradableDisplayContentPrefEnabledE"] + pub static mut nsContentUtils_sIsUpgradableDisplayContentPrefEnabled: bool; + } extern "C" { #[link_name = "\u{1}_ZN14nsContentUtils25sIsFrameTimingPrefEnabledE"] pub static mut nsContentUtils_sIsFrameTimingPrefEnabled: bool; @@ -39598,6 +40064,25 @@ pub mod root { ); } #[test] + fn __bindgen_test_layout_nsPtrHashKey_open0_DOMEventTargetHelper_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 16usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsPtrHashKey) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::nsPtrHashKey) + ) + ); + } + #[test] fn __bindgen_test_layout_nsCOMPtr_open0_EventTarget_close0_instantiation() { assert_eq!( ::std::mem::size_of::(), @@ -40832,6 +41317,25 @@ pub mod root { ); } #[test] + fn __bindgen_test_layout_RefPtr_open0_Promise_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr) + ) + ); + } + #[test] fn __bindgen_test_layout_nsCOMPtr_open0_nsIScriptGlobalObject_close0_instantiation() { assert_eq!( ::std::mem::size_of::(), @@ -44840,6 +45344,198 @@ pub mod root { ); } #[test] + fn __bindgen_test_layout_RefPtr_open0_Element_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_RefPtr_open0_URLExtraData_close0_instantiation_3() { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_nsCOMPtr_open0_nsIURI_close0_instantiation_17() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsCOMPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::nsCOMPtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_RefPtr_open0_ServoDeclarationBlock_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_RefPtr_open0_RawServoStyleRule_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_nsPtrHashKey_open0_RawServoStyleRule_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::>(), + 16usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsPtrHashKey) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::nsPtrHashKey) + ) + ); + } + #[test] + fn __bindgen_test_layout_UniquePtr_open0_RawServoAuthorStyles_DefaultDelete_open1_RawServoAuthorStyles_close1_close0_instantiation( +) { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::UniquePtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::UniquePtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_DefaultDelete_open0_RawServoAuthorStyles_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + } + #[test] + fn __bindgen_test_layout_UniquePtr_open0_ServoStyleRuleMap_DefaultDelete_open1_ServoStyleRuleMap_close1_close0_instantiation( +) { + assert_eq!( + ::std::mem::size_of::>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::UniquePtr) + ) + ); + assert_eq!( + ::std::mem::align_of::>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::UniquePtr) + ) + ); + } + #[test] + fn __bindgen_test_layout_DefaultDelete_open0_ServoStyleRuleMap_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + } + #[test] fn __bindgen_test_layout_BaseTimeDuration_open0_StickyTimeDurationValueCalculator_close0_instantiation( ) { assert_eq!( @@ -44955,7 +45651,7 @@ pub mod root { ); } #[test] - fn __bindgen_test_layout_RefPtr_open0_Element_close0_instantiation() { + fn __bindgen_test_layout_RefPtr_open0_Element_close0_instantiation_1() { assert_eq!( ::std::mem::size_of::>(), 8usize, @@ -45142,7 +45838,7 @@ pub mod root { ); } #[test] - fn __bindgen_test_layout_UniquePtr_open0_ServoStyleRuleMap_DefaultDelete_open1_ServoStyleRuleMap_close1_close0_instantiation( + fn __bindgen_test_layout_UniquePtr_open0_ServoStyleRuleMap_DefaultDelete_open1_ServoStyleRuleMap_close1_close0_instantiation_1( ) { assert_eq!( ::std::mem::size_of::>(), @@ -45162,7 +45858,7 @@ pub mod root { ); } #[test] - fn __bindgen_test_layout_DefaultDelete_open0_ServoStyleRuleMap_close0_instantiation() { + fn __bindgen_test_layout_DefaultDelete_open0_ServoStyleRuleMap_close0_instantiation_1() { assert_eq!( ::std::mem::size_of::(), 1usize,