diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 758bbdeb1a1..e5fc73b9064 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -14,6 +14,7 @@ mod loader; mod media_rule; mod memory; mod namespace_rule; +mod origin; mod page_rule; mod rule_list; mod rule_parser; @@ -43,6 +44,7 @@ pub use self::memory::{MallocSizeOf, MallocSizeOfFn, MallocSizeOfWithGuard}; #[cfg(feature = "gecko")] pub use self::memory::{MallocSizeOfWithRepeats, SizeOfState}; pub use self::namespace_rule::NamespaceRule; +pub use self::origin::Origin; pub use self::page_rule::PageRule; pub use self::rule_parser::{State, TopLevelRuleParser}; pub use self::rule_list::{CssRules, CssRulesHelpers}; @@ -82,22 +84,6 @@ impl UrlExtraData { #[cfg(feature = "gecko")] impl Eq for UrlExtraData {} -/// Each style rule has an origin, which determines where it enters the cascade. -/// -/// http://dev.w3.org/csswg/css-cascade/#cascading-origins -#[derive(Clone, PartialEq, Eq, Copy, Debug)] -#[cfg_attr(feature = "servo", derive(HeapSizeOf))] -pub enum Origin { - /// http://dev.w3.org/csswg/css-cascade/#cascade-origin-ua - UserAgent, - - /// http://dev.w3.org/csswg/css-cascade/#cascade-origin-author - Author, - - /// http://dev.w3.org/csswg/css-cascade/#cascade-origin-user - User, -} - /// A CSS rule. /// /// TODO(emilio): Lots of spec links should be around. diff --git a/components/style/stylesheets/origin.rs b/components/style/stylesheets/origin.rs new file mode 100644 index 00000000000..312b62cb087 --- /dev/null +++ b/components/style/stylesheets/origin.rs @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +///! [CSS cascade origins](https://drafts.csswg.org/css-cascade/#cascading-origins). + +/// Each style rule has an origin, which determines where it enters the cascade. +/// +/// https://drafts.csswg.org/css-cascade/#cascading-origins +#[derive(Clone, PartialEq, Eq, Copy, Debug)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +pub enum Origin { + /// https://drafts.csswg.org/css-cascade/#cascade-origin-us + UserAgent, + + /// https://drafts.csswg.org/css-cascade/#cascade-origin-author + Author, + + /// https://drafts.csswg.org/css-cascade/#cascade-origin-user + User, +}