diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 17650406cb1..80a8736adad 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -154,6 +154,10 @@ pub enum NonTSPseudoClass { ReadWrite, /// :read-only ReadOnly, + + // Internal pseudo-classes + /// :-moz-browser-frame + MozBrowserFrame, } impl ToCss for NonTSPseudoClass { @@ -173,6 +177,8 @@ impl ToCss for NonTSPseudoClass { Indeterminate => ":indeterminate", ReadWrite => ":read-write", ReadOnly => ":read-only", + + MozBrowserFrame => ":-moz-browser-frame", }) } } @@ -196,6 +202,7 @@ impl NonTSPseudoClass { Indeterminate | ReadWrite | ReadOnly => false, + MozBrowserFrame => true, } } @@ -216,7 +223,8 @@ impl NonTSPseudoClass { AnyLink | Link | - Visited => ElementState::empty(), + Visited | + MozBrowserFrame => ElementState::empty(), } } @@ -236,6 +244,7 @@ impl NonTSPseudoClass { Disabled => disabled, Checked => checked, Indeterminate => indeterminate, + MozBrowserFrame => mozBrowserFrame, ReadWrite | ReadOnly => { return None; } }) } @@ -287,6 +296,10 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> { "indeterminate" => Indeterminate, "read-write" => ReadWrite, "read-only" => ReadOnly, + + // Internal + "-moz-browser-frame" => MozBrowserFrame, + _ => return Err(()) }; diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index f5890e2b95f..8b74844590b 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -26,7 +26,7 @@ use gecko_bindings::bindings; use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator}; use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetLastChild, Gecko_GetNextStyleChild}; use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument}; -use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement}; +use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_MatchesElement}; use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace}; use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use gecko_bindings::bindings::Gecko_ClassOrClassList; @@ -519,6 +519,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::ReadOnly => { !self.get_state().contains(pseudo_class.state_flag()) } + + NonTSPseudoClass::MozBrowserFrame => unsafe { + Gecko_MatchesElement(pseudo_class.to_gecko_pseudoclasstype().unwrap(), self.0) + } } } diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index d9106d9ace2..a9b73f54e8f 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -10,6 +10,7 @@ use gecko_bindings::structs::RawGeckoPresContext; use gecko_bindings::structs::ThreadSafeURIHolder; use gecko_bindings::structs::ThreadSafePrincipalHolder; use gecko_bindings::structs::ConsumeStyleBehavior; +use gecko_bindings::structs::CSSPseudoClassType; use gecko_bindings::structs::TraversalRootBehavior; use gecko_bindings::structs::FontFamilyList; use gecko_bindings::structs::FontFamilyType; @@ -370,6 +371,10 @@ extern "C" { extern "C" { pub fn Gecko_IsRootElement(element: RawGeckoElementBorrowed) -> bool; } +extern "C" { + pub fn Gecko_MatchesElement(type_: CSSPseudoClassType, + element: RawGeckoElementBorrowed) -> bool; +} extern "C" { pub fn Gecko_LocalName(element: RawGeckoElementBorrowed) -> *mut nsIAtom; }