Skip to content

Commit

Permalink
Add :-moz-browser-frame pseudo-class
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper committed Jan 6, 2017
1 parent 0399f35 commit e7e3889
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
15 changes: 14 additions & 1 deletion components/style/gecko/selector_parser.rs
Expand Up @@ -154,6 +154,10 @@ pub enum NonTSPseudoClass {
ReadWrite,
/// :read-only
ReadOnly,

// Internal pseudo-classes
/// :-moz-browser-frame
MozBrowserFrame,
}

impl ToCss for NonTSPseudoClass {
Expand All @@ -173,6 +177,8 @@ impl ToCss for NonTSPseudoClass {
Indeterminate => ":indeterminate",
ReadWrite => ":read-write",
ReadOnly => ":read-only",

MozBrowserFrame => ":-moz-browser-frame",
})
}
}
Expand All @@ -196,6 +202,7 @@ impl NonTSPseudoClass {
Indeterminate |
ReadWrite |
ReadOnly => false,
MozBrowserFrame => true,
}
}

Expand All @@ -216,7 +223,8 @@ impl NonTSPseudoClass {

AnyLink |
Link |
Visited => ElementState::empty(),
Visited |
MozBrowserFrame => ElementState::empty(),
}
}

Expand All @@ -236,6 +244,7 @@ impl NonTSPseudoClass {
Disabled => disabled,
Checked => checked,
Indeterminate => indeterminate,
MozBrowserFrame => mozBrowserFrame,
ReadWrite | ReadOnly => { return None; }
})
}
Expand Down Expand Up @@ -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(())
};

Expand Down
6 changes: 5 additions & 1 deletion components/style/gecko/wrapper.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions components/style/gecko_bindings/bindings.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit e7e3889

Please sign in to comment.