mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Bug 1348489 - stylo: Implement :-moz-window-inactive.
This commit is contained in:
parent
9a13cf6bda
commit
17f4d0c5d9
4 changed files with 30 additions and 4 deletions
|
@ -138,3 +138,16 @@ bitflags! {
|
||||||
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51,
|
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bitflags! {
|
||||||
|
/// Event-based document states.
|
||||||
|
///
|
||||||
|
/// NB: Is important for this to remain in sync with Gecko's
|
||||||
|
/// dom/base/nsIDocument.h.
|
||||||
|
pub flags DocumentState: u64 {
|
||||||
|
/// RTL locale: specific to the XUL localedir attribute
|
||||||
|
const NS_DOCUMENT_STATE_RTL_LOCALE = 1 << 0,
|
||||||
|
/// Window activation status
|
||||||
|
const NS_DOCUMENT_STATE_WINDOW_INACTIVE = 1 << 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -552,6 +552,9 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
|
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn Gecko_DocumentState(aDocument: *const nsIDocument) -> u64;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_IsTextNode(node: RawGeckoNodeBorrowed) -> bool;
|
pub fn Gecko_IsTextNode(node: RawGeckoNodeBorrowed) -> bool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
*
|
*
|
||||||
* Pending pseudo-classes:
|
* Pending pseudo-classes:
|
||||||
*
|
*
|
||||||
* :-moz-window-inactive.
|
|
||||||
*
|
|
||||||
* :scope -> <style scoped>, pending discussion.
|
* :scope -> <style scoped>, pending discussion.
|
||||||
*
|
*
|
||||||
* This follows the order defined in layout/style/nsCSSPseudoClassList.h when
|
* This follows the order defined in layout/style/nsCSSPseudoClassList.h when
|
||||||
|
@ -116,6 +114,7 @@ macro_rules! apply_non_ts_list {
|
||||||
("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
|
("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
|
||||||
("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
|
("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
|
||||||
("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
|
("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
|
||||||
|
("-moz-window-inactive", MozWindowInactive, mozWindowInactive, _, _),
|
||||||
],
|
],
|
||||||
string: [
|
string: [
|
||||||
("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, PSEUDO_CLASS_INTERNAL),
|
("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, PSEUDO_CLASS_INTERNAL),
|
||||||
|
|
|
@ -22,7 +22,7 @@ use context::{QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
||||||
use data::ElementData;
|
use data::ElementData;
|
||||||
use dom::{self, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
use dom::{self, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||||
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
|
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
|
||||||
use element_state::ElementState;
|
use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE};
|
||||||
use error_reporting::create_error_reporter;
|
use error_reporting::create_error_reporter;
|
||||||
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
||||||
use gecko::data::PerDocumentStyleData;
|
use gecko::data::PerDocumentStyleData;
|
||||||
|
@ -31,7 +31,7 @@ use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
|
||||||
use gecko::snapshot_helpers;
|
use gecko::snapshot_helpers;
|
||||||
use gecko_bindings::bindings;
|
use gecko_bindings::bindings;
|
||||||
use gecko_bindings::bindings::{Gecko_ConstructStyleChildrenIterator, Gecko_DestroyStyleChildrenIterator};
|
use gecko_bindings::bindings::{Gecko_ConstructStyleChildrenIterator, Gecko_DestroyStyleChildrenIterator};
|
||||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
use gecko_bindings::bindings::{Gecko_DocumentState, Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
||||||
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
|
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
|
||||||
use gecko_bindings::bindings::{Gecko_IsRootElement, Gecko_MatchesElement, Gecko_Namespace};
|
use gecko_bindings::bindings::{Gecko_IsRootElement, Gecko_MatchesElement, Gecko_Namespace};
|
||||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||||
|
@ -652,6 +652,14 @@ impl<'le> GeckoElement<'le> {
|
||||||
unsafe { Gecko_ElementState(self.0) }
|
unsafe { Gecko_ElementState(self.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn document_state(&self) -> DocumentState {
|
||||||
|
let node = self.as_node();
|
||||||
|
unsafe {
|
||||||
|
let states = Gecko_DocumentState(node.owner_doc());
|
||||||
|
DocumentState::from_bits_truncate(states)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn may_have_class(&self) -> bool {
|
fn may_have_class(&self) -> bool {
|
||||||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
|
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
|
||||||
|
@ -1758,6 +1766,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
NonTSPseudoClass::MozLWThemeDarkText => {
|
NonTSPseudoClass::MozLWThemeDarkText => {
|
||||||
self.get_document_theme() == DocumentTheme::Doc_Theme_Dark
|
self.get_document_theme() == DocumentTheme::Doc_Theme_Dark
|
||||||
}
|
}
|
||||||
|
NonTSPseudoClass::MozWindowInactive => {
|
||||||
|
self.document_state().contains(NS_DOCUMENT_STATE_WINDOW_INACTIVE)
|
||||||
|
}
|
||||||
NonTSPseudoClass::MozPlaceholder => false,
|
NonTSPseudoClass::MozPlaceholder => false,
|
||||||
NonTSPseudoClass::MozAny(ref sels) => {
|
NonTSPseudoClass::MozAny(ref sels) => {
|
||||||
let old_value = context.hover_active_quirk_disabled;
|
let old_value = context.hover_active_quirk_disabled;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue