diff options
-rw-r--r-- | components/script/dom/canvasrenderingcontext2d.rs | 18 | ||||
-rw-r--r-- | components/script/dom/element.rs | 2 | ||||
-rw-r--r-- | components/script/script_thread.rs | 3 | ||||
-rw-r--r-- | components/style/gecko/generated/bindings.rs | 13 | ||||
-rw-r--r-- | components/style/gecko/generated/structs.rs | 910 | ||||
-rw-r--r-- | components/style/gecko/wrapper.rs | 36 | ||||
-rw-r--r-- | components/style/properties/properties.mako.rs | 107 | ||||
-rw-r--r-- | ports/geckolib/glue.rs | 34 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/transitionend_safety.html | 2 |
10 files changed, 949 insertions, 178 deletions
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 93d4981d2bb..1e2278e81ca 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -9,7 +9,6 @@ use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle, byte_swap_and_ use cssparser::{Parser, ParserInput, RGBA}; use cssparser::Color as CSSColor; use dom::bindings::cell::DomRefCell; -use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource; @@ -17,7 +16,6 @@ use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLin use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; -use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; @@ -27,6 +25,7 @@ use dom::bindings::root::{Dom, DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; +use dom::element::Element; use dom::globalscope::GlobalScope; use dom::htmlcanvaselement::HTMLCanvasElement; use dom::imagedata::ImageData; @@ -543,18 +542,11 @@ impl CanvasRenderingContext2D { Some(ref canvas) => &**canvas, }; - let window = window_from_node(canvas); + let canvas_element = canvas.upcast::<Element>(); - let style = window.GetComputedStyle(canvas.upcast(), None); - - let element_not_rendered = - !canvas.upcast::<Node>().is_in_doc() || - style.GetPropertyValue(DOMString::from("display")) == "none"; - - if element_not_rendered { - Ok(RGBA::new(0, 0, 0, 255)) - } else { - self.parse_color(&style.GetPropertyValue(DOMString::from("color"))) + match canvas_element.style() { + Some(ref s) if canvas_element.has_css_layout_box() => Ok(s.get_color().color), + _ => Ok(RGBA::new(0, 0, 0, 255)) } }, _ => Err(()) diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c8407c3277f..5060492160b 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -350,7 +350,7 @@ impl Element { /// style will be `None` for elements in a `display: none` subtree. otherwise, the element has a /// layout box iff it doesn't have `display: none`. - fn style(&self) -> Option<Arc<ComputedValues>> { + pub fn style(&self) -> Option<Arc<ComputedValues>> { window_from_node(self).style_query( self.upcast::<Node>().to_trusted_node_address() ) diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 3a51c812dce..f386d29487e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -25,7 +25,6 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use devtools_traits::CSSError; use document_loader::DocumentLoader; use dom::bindings::cell::DomRefCell; -use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use dom::bindings::codegen::Bindings::EventBinding::EventInit; use dom::bindings::codegen::Bindings::TransitionEventBinding::TransitionEventInit; @@ -1926,7 +1925,7 @@ impl ScriptThread { node.dirty(NodeDamage::NodeStyleDamaged); if let Some(el) = node.downcast::<Element>() { - if &*window.GetComputedStyle(el, None).Display() == "none" { + if !el.has_css_layout_box() { return; } } 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 @@ -2299,6 +2299,19 @@ extern "C" { ); } 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); } extern "C" { 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::<Rule_cycleCollection>(), + 16usize, + concat!("Size of: ", stringify!(Rule_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::<Rule_cycleCollection>(), + 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::<Rule>(), + 64usize, + concat!("Size of: ", stringify!(Rule)) + ); + assert_eq!( + ::std::mem::align_of::<Rule>(), + 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::<Rule_cycleCollection>(), - 16usize, - concat!("Size of: ", stringify!(Rule_cycleCollection)) - ); - assert_eq!( - ::std::mem::align_of::<Rule_cycleCollection>(), - 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::<Rule>(), - 64usize, - concat!("Size of: ", stringify!(Rule)) - ); - assert_eq!( - ::std::mem::align_of::<Rule>(), - 8usize, - concat!("Alignment of ", stringify!(Rule)) - ); - } } #[repr(C)] #[derive(Debug)] @@ -2600,17 +2600,17 @@ pub mod root { } #[repr(C)] #[derive(Debug, Copy, Clone)] - pub struct ClientSource { + pub struct Promise { _unused: [u8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] - pub struct CSSImportRule { + pub struct ClientSource { _unused: [u8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] - pub struct ShadowRoot { + pub struct CSSImportRule { _unused: [u8; 0], } /// Struct that stores info on an attribute. The name and value must either both @@ -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<root::mozilla::dom::Element>, + } + #[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::<DocumentFragment_cycleCollection>(), + 16usize, + concat!("Size of: ", stringify!(DocumentFragment_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::<DocumentFragment_cycleCollection>(), + 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::<DocumentFragment>(), + 120usize, + concat!("Size of: ", stringify!(DocumentFragment)) + ); + assert_eq!( + ::std::mem::align_of::<DocumentFragment>(), + 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<root::RawServoAuthorStyles>, + pub mStyleRuleMap: root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>, + 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::<ShadowRoot_cycleCollection>(), + 16usize, + concat!("Size of: ", stringify!(ShadowRoot_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::<ShadowRoot_cycleCollection>(), + 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::<ShadowRoot>(), + 256usize, + concat!("Size of: ", stringify!(ShadowRoot)) + ); + assert_eq!( + ::std::mem::align_of::<ShadowRoot>(), + 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::<BindingStyleRule>(), + 64usize, + concat!("Size of: ", stringify!(BindingStyleRule)) + ); + assert_eq!( + ::std::mem::align_of::<BindingStyleRule>(), + 8usize, + concat!("Alignment of ", stringify!(BindingStyleRule)) + ); + } + #[repr(C)] + #[derive(Debug)] + pub struct ServoStyleRuleDeclaration { + pub _base: root::nsDOMCSSDeclaration, + pub mDecls: root::RefPtr<root::mozilla::ServoDeclarationBlock>, + } + #[test] + fn bindgen_test_layout_ServoStyleRuleDeclaration() { + assert_eq!( + ::std::mem::size_of::<ServoStyleRuleDeclaration>(), + 40usize, + concat!("Size of: ", stringify!(ServoStyleRuleDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::<ServoStyleRuleDeclaration>(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRuleDeclaration)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<ServoStyleRuleDeclaration>())).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<root::RawServoStyleRule>, + 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::<ServoStyleRule_cycleCollection>(), + 16usize, + concat!("Size of: ", stringify!(ServoStyleRule_cycleCollection)) + ); + assert_eq!( + ::std::mem::align_of::<ServoStyleRule_cycleCollection>(), + 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::<ServoStyleRule>(), + 120usize, + concat!("Size of: ", stringify!(ServoStyleRule)) + ); + assert_eq!( + ::std::mem::align_of::<ServoStyleRule>(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRule)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<ServoStyleRule>())).mRawRule as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ServoStyleRule), + "::", + stringify!(mRawRule) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<ServoStyleRule>())).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::<ServoStyleRuleMap>(), + 32usize, + concat!("Size of: ", stringify!(ServoStyleRuleMap)) + ); + assert_eq!( + ::std::mem::align_of::<ServoStyleRuleMap>(), + 8usize, + concat!("Alignment of ", stringify!(ServoStyleRuleMap)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<ServoStyleRuleMap>())).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<root::nsCString>, + 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::<nsIGlobalObject>(), - 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::<nsIScriptGlobalObject>(), - 32usize, + 64usize, concat!("Size of: ", stringify!(nsIScriptGlobalObject)) ); assert_eq!( @@ -21868,6 +22130,7 @@ pub mod root { pub mFontFaceSet: root::RefPtr<root::mozilla::dom::FontFaceSet>, pub mLastFocusTime: root::mozilla::TimeStamp, pub mDocumentState: root::mozilla::EventStates, + pub mReadyForIdle: root::RefPtr<root::mozilla::dom::Promise>, 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::<nsIDocument>(), - 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::<nsIDOMDocumentFragment>(), + 8usize, + concat!("Size of: ", stringify!(nsIDOMDocumentFragment)) + ); + assert_eq!( + ::std::mem::align_of::<nsIDOMDocumentFragment>(), + 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::<nsICSSDeclaration>(), + 32usize, + concat!("Size of: ", stringify!(nsICSSDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::<nsICSSDeclaration>(), + 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<root::mozilla::URLExtraData>, + pub mCompatMode: root::nsCompatibility, + pub mLoader: *mut root::mozilla::css::Loader, + } + #[test] + fn bindgen_test_layout_nsDOMCSSDeclaration_ServoCSSParsingEnvironment() { + assert_eq!( + ::std::mem::size_of::<nsDOMCSSDeclaration_ServoCSSParsingEnvironment>(), + 24usize, + concat!( + "Size of: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment) + ) + ); + assert_eq!( + ::std::mem::align_of::<nsDOMCSSDeclaration_ServoCSSParsingEnvironment>(), + 8usize, + concat!( + "Alignment of ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_ServoCSSParsingEnvironment>())) + .mUrlExtraData as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment), + "::", + stringify!(mUrlExtraData) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_ServoCSSParsingEnvironment>())) + .mCompatMode as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_ServoCSSParsingEnvironment), + "::", + stringify!(mCompatMode) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_ServoCSSParsingEnvironment>())).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::<nsDOMCSSDeclaration_CSSParsingEnvironment>(), + 32usize, + concat!( + "Size of: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment) + ) + ); + assert_eq!( + ::std::mem::align_of::<nsDOMCSSDeclaration_CSSParsingEnvironment>(), + 8usize, + concat!( + "Alignment of ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_CSSParsingEnvironment>())).mSheetURI + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mSheetURI) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_CSSParsingEnvironment>())).mBaseURI + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mBaseURI) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_CSSParsingEnvironment>())).mPrincipal + as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(nsDOMCSSDeclaration_CSSParsingEnvironment), + "::", + stringify!(mPrincipal) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::<nsDOMCSSDeclaration_CSSParsingEnvironment>())).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::<nsDOMCSSDeclaration>(), + 32usize, + concat!("Size of: ", stringify!(nsDOMCSSDeclaration)) + ); + assert_eq!( + ::std::mem::align_of::<nsDOMCSSDeclaration>(), + 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::<nsICSSDeclaration>(), - 32usize, - concat!("Size of: ", stringify!(nsICSSDeclaration)) - ); - assert_eq!( - ::std::mem::align_of::<nsICSSDeclaration>(), - 8usize, - concat!("Alignment of ", stringify!(nsICSSDeclaration)) - ); - } - #[repr(C)] - #[derive(Debug)] pub struct nsCSSFontFaceStyleDecl { pub _base: root::nsICSSDeclaration, pub mDescriptors: root::mozilla::CSSFontFaceDescriptors, @@ -37843,6 +38305,10 @@ pub mod root { 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::<root::nsPtrHashKey<root::mozilla::DOMEventTargetHelper>>(), + 16usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsPtrHashKey<root::mozilla::DOMEventTargetHelper>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::nsPtrHashKey<root::mozilla::DOMEventTargetHelper>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::nsPtrHashKey<root::mozilla::DOMEventTargetHelper>) + ) + ); + } + #[test] fn __bindgen_test_layout_nsCOMPtr_open0_EventTarget_close0_instantiation() { assert_eq!( ::std::mem::size_of::<root::nsCOMPtr>(), @@ -40832,6 +41317,25 @@ pub mod root { ); } #[test] + fn __bindgen_test_layout_RefPtr_open0_Promise_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::RefPtr<root::mozilla::dom::Promise>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr<root::mozilla::dom::Promise>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::RefPtr<root::mozilla::dom::Promise>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr<root::mozilla::dom::Promise>) + ) + ); + } + #[test] fn __bindgen_test_layout_nsCOMPtr_open0_nsIScriptGlobalObject_close0_instantiation() { assert_eq!( ::std::mem::size_of::<root::nsCOMPtr>(), @@ -44840,6 +45344,198 @@ pub mod root { ); } #[test] + fn __bindgen_test_layout_RefPtr_open0_Element_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::RefPtr<root::mozilla::dom::Element>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr<root::mozilla::dom::Element>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::RefPtr<root::mozilla::dom::Element>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr<root::mozilla::dom::Element>) + ) + ); + } + #[test] + fn __bindgen_test_layout_RefPtr_open0_URLExtraData_close0_instantiation_3() { + assert_eq!( + ::std::mem::size_of::<root::RefPtr<root::mozilla::URLExtraData>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr<root::mozilla::URLExtraData>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::RefPtr<root::mozilla::URLExtraData>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr<root::mozilla::URLExtraData>) + ) + ); + } + #[test] + fn __bindgen_test_layout_nsCOMPtr_open0_nsIURI_close0_instantiation_17() { + assert_eq!( + ::std::mem::size_of::<root::nsCOMPtr>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsCOMPtr) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::nsCOMPtr>(), + 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::<root::RefPtr<root::mozilla::ServoDeclarationBlock>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr<root::mozilla::ServoDeclarationBlock>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::RefPtr<root::mozilla::ServoDeclarationBlock>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr<root::mozilla::ServoDeclarationBlock>) + ) + ); + } + #[test] + fn __bindgen_test_layout_RefPtr_open0_RawServoStyleRule_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::RefPtr<root::RawServoStyleRule>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::RefPtr<root::RawServoStyleRule>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::RefPtr<root::RawServoStyleRule>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::RefPtr<root::RawServoStyleRule>) + ) + ); + } + #[test] + fn __bindgen_test_layout_nsPtrHashKey_open0_RawServoStyleRule_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::nsPtrHashKey<root::RawServoStyleRule>>(), + 16usize, + concat!( + "Size of template specialization: ", + stringify!(root::nsPtrHashKey<root::RawServoStyleRule>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::nsPtrHashKey<root::RawServoStyleRule>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::nsPtrHashKey<root::RawServoStyleRule>) + ) + ); + } + #[test] + fn __bindgen_test_layout_UniquePtr_open0_RawServoAuthorStyles_DefaultDelete_open1_RawServoAuthorStyles_close1_close0_instantiation( +) { + assert_eq!( + ::std::mem::size_of::<root::mozilla::UniquePtr<root::RawServoAuthorStyles>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::UniquePtr<root::RawServoAuthorStyles>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::mozilla::UniquePtr<root::RawServoAuthorStyles>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::UniquePtr<root::RawServoAuthorStyles>) + ) + ); + } + #[test] + fn __bindgen_test_layout_DefaultDelete_open0_RawServoAuthorStyles_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::mozilla::DefaultDelete>(), + 1usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::mozilla::DefaultDelete>(), + 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::<root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>>(), + 8usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>>(), + 8usize, + concat!( + "Alignment of template specialization: ", + stringify!(root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>) + ) + ); + } + #[test] + fn __bindgen_test_layout_DefaultDelete_open0_ServoStyleRuleMap_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::mozilla::DefaultDelete>(), + 1usize, + concat!( + "Size of template specialization: ", + stringify!(root::mozilla::DefaultDelete) + ) + ); + assert_eq!( + ::std::mem::align_of::<root::mozilla::DefaultDelete>(), + 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::<root::RefPtr<root::mozilla::dom::Element>>(), 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::<root::mozilla::UniquePtr<root::mozilla::ServoStyleRuleMap>>(), @@ -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::<root::mozilla::DefaultDelete>(), 1usize, diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 659e55a4c20..6ade508c2c9 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(); @@ -990,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(); } @@ -1408,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::<GeckoStyleSheet>::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/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index d3b6687b5e3..19541d6d79d 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -438,6 +438,51 @@ impl NonCustomPropertyId { MAP[self.0] } + #[inline] + fn enabled_for_all_content(self) -> bool { + ${static_non_custom_property_id_set( + "EXPERIMENTAL", + lambda p: p.experimental(product) + )} + + ${static_non_custom_property_id_set( + "ALWAYS_ENABLED", + lambda p: (not p.experimental(product)) and p.enabled_in_content() + )} + + let passes_pref_check = || { + % if product == "servo": + static PREF_NAME: [Option< &str>; ${len(data.longhands) + len(data.shorthands)}] = [ + % for property in data.longhands + data.shorthands: + % if property.servo_pref: + Some("${property.servo_pref}"), + % else: + None, + % endif + % endfor + ]; + let pref = match PREF_NAME[self.0] { + None => return true, + Some(pref) => pref, + }; + + PREFS.get(pref).as_boolean().unwrap_or(false) + % else: + unsafe { structs::nsCSSProps_gPropertyEnabled[self.to_nscsspropertyid() as usize] } + % endif + }; + + if ALWAYS_ENABLED.contains(self) { + return true + } + + if EXPERIMENTAL.contains(self) && passes_pref_check() { + return true + } + + false + } + fn allowed_in(self, context: &ParserContext) -> bool { debug_assert!( matches!( @@ -447,10 +492,14 @@ impl NonCustomPropertyId { "Declarations are only expected inside a keyframe, page, or style rule." ); - <% id_set = static_non_custom_property_id_set %> - - ${id_set("DISALLOWED_IN_KEYFRAME_BLOCK", lambda p: not p.allowed_in_keyframe_block)} - ${id_set("DISALLOWED_IN_PAGE_RULE", lambda p: not p.allowed_in_page_rule)} + ${static_non_custom_property_id_set( + "DISALLOWED_IN_KEYFRAME_BLOCK", + lambda p: not p.allowed_in_keyframe_block + )} + ${static_non_custom_property_id_set( + "DISALLOWED_IN_PAGE_RULE", + lambda p: not p.allowed_in_page_rule + )} match context.rule_type() { CssRuleType::Keyframe if DISALLOWED_IN_KEYFRAME_BLOCK.contains(self) => { return false; @@ -473,40 +522,18 @@ impl NonCustomPropertyId { // Non-experimental properties are either normal properties which are // usable everywhere, or internal-only properties which are only usable // in certain context they are explicitly enabled in. - ${id_set("ENABLED_IN_UA_SHEETS", lambda p: p.explicitly_enabled_in_ua_sheets())} - ${id_set("ENABLED_IN_CHROME", lambda p: p.explicitly_enabled_in_chrome())} - ${id_set("EXPERIMENTAL", lambda p: p.experimental(product))} - ${id_set("ALWAYS_ENABLED", lambda p: (not p.experimental(product)) and p.enabled_in_content())} - - let passes_pref_check = || { - % if product == "servo": - static PREF_NAME: [Option< &str>; ${len(data.longhands) + len(data.shorthands)}] = [ - % for property in data.longhands + data.shorthands: - % if property.servo_pref: - Some("${property.servo_pref}"), - % else: - None, - % endif - % endfor - ]; - let pref = match PREF_NAME[self.0] { - None => return true, - Some(pref) => pref, - }; - - PREFS.get(pref).as_boolean().unwrap_or(false) - % else: - unsafe { structs::nsCSSProps_gPropertyEnabled[self.to_nscsspropertyid() as usize] } - % endif - }; - - if ALWAYS_ENABLED.contains(self) { - return true + if self.enabled_for_all_content() { + return true; } - if EXPERIMENTAL.contains(self) && passes_pref_check() { - return true - } + ${static_non_custom_property_id_set( + "ENABLED_IN_UA_SHEETS", + lambda p: p.explicitly_enabled_in_ua_sheets() + )} + ${static_non_custom_property_id_set( + "ENABLED_IN_CHROME", + lambda p: p.explicitly_enabled_in_chrome() + )} if context.stylesheet_origin == Origin::UserAgent && ENABLED_IN_UA_SHEETS.contains(self) @@ -1805,14 +1832,6 @@ impl PropertyDeclaration { } } - /// The shorthands that this longhand is part of. - pub fn shorthands(&self) -> &'static [ShorthandId] { - match self.id() { - PropertyDeclarationId::Longhand(id) => id.shorthands(), - PropertyDeclarationId::Custom(..) => &[], - } - } - /// Returns true if this property declaration is for one of the animatable /// properties. pub fn is_animatable(&self) -> bool { 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 @@ -1150,6 +1150,40 @@ pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet( } #[no_mangle] +pub unsafe extern "C" fn Servo_AuthorStyles_InsertStyleSheetBefore( + styles: RawServoAuthorStylesBorrowedMut, + sheet: *const ServoStyleSheet, + before_sheet: *const ServoStyleSheet, +) { + let styles = AuthorStyles::<GeckoStyleSheet>::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::<GeckoStyleSheet>::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, ) { diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 892d423d807..2cd4e005039 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -70817,7 +70817,7 @@ "testharness" ], "mozilla/transitionend_safety.html": [ - "778e43b049aa421bad7f86eb03d0955576a84ce0", + "16d238e94b2cc2843c9aee4210db43d496bb3114", "testharness" ], "mozilla/union.html": [ diff --git a/tests/wpt/mozilla/tests/mozilla/transitionend_safety.html b/tests/wpt/mozilla/tests/mozilla/transitionend_safety.html index 1b38fca741d..b72766c357a 100644 --- a/tests/wpt/mozilla/tests/mozilla/transitionend_safety.html +++ b/tests/wpt/mozilla/tests/mozilla/transitionend_safety.html @@ -11,7 +11,6 @@ elem.textContent = 'hi there'; elem.style.transition = 'color 10ms'; elem.style.color = 'black'; - elem.ontransitionend = t.step_func_done(); t.step_timeout(function() { elem.style.color = 'red'; @@ -20,6 +19,7 @@ document.body.removeChild(elem); elem = null; window.gc(); + t.step_timeout(t.step_func_done(), 100); }, 0); }, 0); }, 'Nodes cannot be GCed while a CSS transition is in effect.'); |