зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #17577 - Bug 1348489 - stylo: Implement :-moz-window-inactive (from mbrubeck:inactive); r=emilio
https://bugzilla.mozilla.org/show_bug.cgi?id=1348489 Source-Repo: https://github.com/servo/servo Source-Revision: a24600d626384c6b3cd214a52ff251d706d59064 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 795ce88c61055db8e37c0eb4bd5371f360724d4a
This commit is contained in:
Родитель
707bacec3b
Коммит
d7925bd74e
|
@ -138,3 +138,16 @@ bitflags! {
|
|||
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" {
|
||||
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_DocumentState(aDocument: *const nsIDocument) -> u64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_IsTextNode(node: RawGeckoNodeBorrowed) -> bool;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
*
|
||||
* Pending pseudo-classes:
|
||||
*
|
||||
* :-moz-window-inactive.
|
||||
*
|
||||
* :scope -> <style scoped>, pending discussion.
|
||||
*
|
||||
* This follows the order defined in layout/style/nsCSSPseudoClassList.h when
|
||||
|
@ -117,6 +115,7 @@ macro_rules! apply_non_ts_list {
|
|||
("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
|
||||
("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
|
||||
("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
|
||||
("-moz-window-inactive", MozWindowInactive, mozWindowInactive, _, _),
|
||||
],
|
||||
string: [
|
||||
("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, PSEUDO_CLASS_INTERNAL),
|
||||
|
|
|
@ -22,7 +22,7 @@ use context::{QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
|||
use data::ElementData;
|
||||
use dom::{self, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||
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 font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
||||
use gecko::data::PerDocumentStyleData;
|
||||
|
@ -31,7 +31,7 @@ use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
|
|||
use gecko::snapshot_helpers;
|
||||
use gecko_bindings::bindings;
|
||||
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_IsRootElement, Gecko_MatchesElement, Gecko_Namespace};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
|
@ -652,6 +652,14 @@ impl<'le> GeckoElement<'le> {
|
|||
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]
|
||||
fn may_have_class(&self) -> bool {
|
||||
self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementMayHaveClass)
|
||||
|
@ -1759,6 +1767,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
NonTSPseudoClass::MozLWThemeDarkText => {
|
||||
self.get_document_theme() == DocumentTheme::Doc_Theme_Dark
|
||||
}
|
||||
NonTSPseudoClass::MozWindowInactive => {
|
||||
self.document_state().contains(NS_DOCUMENT_STATE_WINDOW_INACTIVE)
|
||||
}
|
||||
NonTSPseudoClass::MozPlaceholder => false,
|
||||
NonTSPseudoClass::MozAny(ref sels) => {
|
||||
let old_value = context.hover_active_quirk_disabled;
|
||||
|
|
Загрузка…
Ссылка в новой задаче