style: Move Origin into its own file.

This commit is contained in:
Cameron McCormack 2017-08-12 13:36:31 +08:00
parent 4ddf6dbd15
commit 0635fddbfc
2 changed files with 23 additions and 16 deletions

View file

@ -14,6 +14,7 @@ mod loader;
mod media_rule; mod media_rule;
mod memory; mod memory;
mod namespace_rule; mod namespace_rule;
mod origin;
mod page_rule; mod page_rule;
mod rule_list; mod rule_list;
mod rule_parser; mod rule_parser;
@ -43,6 +44,7 @@ pub use self::memory::{MallocSizeOf, MallocSizeOfFn, MallocSizeOfWithGuard};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use self::memory::{MallocSizeOfWithRepeats, SizeOfState}; pub use self::memory::{MallocSizeOfWithRepeats, SizeOfState};
pub use self::namespace_rule::NamespaceRule; pub use self::namespace_rule::NamespaceRule;
pub use self::origin::Origin;
pub use self::page_rule::PageRule; pub use self::page_rule::PageRule;
pub use self::rule_parser::{State, TopLevelRuleParser}; pub use self::rule_parser::{State, TopLevelRuleParser};
pub use self::rule_list::{CssRules, CssRulesHelpers}; pub use self::rule_list::{CssRules, CssRulesHelpers};
@ -82,22 +84,6 @@ impl UrlExtraData {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
impl Eq for UrlExtraData {} 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. /// A CSS rule.
/// ///
/// TODO(emilio): Lots of spec links should be around. /// TODO(emilio): Lots of spec links should be around.

View file

@ -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,
}