mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Bug 1367312 - stylo: Implement :-moz-lwtheme* pseudo-classes.
https://bugzilla.mozilla.org/show_bug.cgi?id=1367312
This commit is contained in:
parent
522d24d126
commit
e0b864d787
3 changed files with 27 additions and 2 deletions
|
@ -11,6 +11,8 @@ use gecko_bindings::structs::mozilla::css::URLValue;
|
|||
use gecko_bindings::structs::mozilla::MallocSizeOf;
|
||||
use gecko_bindings::structs::mozilla::Side;
|
||||
use gecko_bindings::structs::nsIContent;
|
||||
use gecko_bindings::structs::nsIDocument;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme;
|
||||
use gecko_bindings::structs::RawGeckoAnimationPropertySegment;
|
||||
use gecko_bindings::structs::RawGeckoComputedTiming;
|
||||
use gecko_bindings::structs::RawGeckoCSSPropertyIDList;
|
||||
|
@ -583,6 +585,10 @@ extern "C" {
|
|||
pub fn Gecko_GetXMLLangValue(element: RawGeckoElementBorrowed)
|
||||
-> *mut nsIAtom;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_GetDocumentLWTheme(aDocument: *const nsIDocument)
|
||||
-> nsIDocument_DocumentTheme;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_AtomAttrValue(element: RawGeckoElementBorrowed,
|
||||
attribute: *mut nsIAtom) -> *mut nsIAtom;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
*
|
||||
* Pending pseudo-classes:
|
||||
*
|
||||
* :-moz-lwtheme, :-moz-lwtheme-brighttext, :-moz-lwtheme-darktext,
|
||||
* :-moz-window-inactive.
|
||||
*
|
||||
* :scope -> <style scoped>, pending discussion.
|
||||
|
@ -114,6 +113,9 @@ macro_rules! apply_non_ts_list {
|
|||
("-moz-use-shadow-tree-root", MozUseShadowTreeRoot, mozUseShadowTreeRoot, _, PSEUDO_CLASS_INTERNAL),
|
||||
("-moz-is-html", MozIsHTML, mozIsHTML, _, _),
|
||||
("-moz-placeholder", MozPlaceholder, mozPlaceholder, _, _),
|
||||
("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
|
||||
("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
|
||||
("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
|
||||
],
|
||||
string: [
|
||||
("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, PSEUDO_CLASS_INTERNAL),
|
||||
|
|
|
@ -31,7 +31,8 @@ use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
|
|||
use gecko::snapshot_helpers;
|
||||
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_ElementState, Gecko_GetDocumentLWTheme};
|
||||
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
|
||||
use gecko_bindings::bindings::{Gecko_IsRootElement, Gecko_MatchesElement, Gecko_Namespace};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
use gecko_bindings::bindings::Gecko_ClassOrClassList;
|
||||
|
@ -62,6 +63,7 @@ use gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
|
|||
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||
use gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
|
||||
use gecko_bindings::structs::NODE_IS_NATIVE_ANONYMOUS;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
|
@ -586,6 +588,12 @@ impl<'le> GeckoElement<'le> {
|
|||
fn may_have_style_attribute(&self) -> bool {
|
||||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveStyle)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_document_theme(&self) -> DocumentTheme {
|
||||
let node = self.as_node();
|
||||
unsafe { Gecko_GetDocumentLWTheme(node.owner_doc()) }
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts flags from the layout used by rust-selectors to the layout used
|
||||
|
@ -1659,6 +1667,15 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
NonTSPseudoClass::MozIsHTML => {
|
||||
self.is_html_element_in_html_document()
|
||||
}
|
||||
NonTSPseudoClass::MozLWTheme => {
|
||||
self.get_document_theme() != DocumentTheme::Doc_Theme_None
|
||||
}
|
||||
NonTSPseudoClass::MozLWThemeBrightText => {
|
||||
self.get_document_theme() == DocumentTheme::Doc_Theme_Bright
|
||||
}
|
||||
NonTSPseudoClass::MozLWThemeDarkText => {
|
||||
self.get_document_theme() == DocumentTheme::Doc_Theme_Dark
|
||||
}
|
||||
NonTSPseudoClass::MozPlaceholder => false,
|
||||
NonTSPseudoClass::MozAny(ref sels) => {
|
||||
let old_value = context.hover_active_quirk_disabled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue