style: Move Origin into its own file. draft
authorCameron McCormack <cam@mcc.id.au>
Sat, 12 Aug 2017 13:36:31 +0800
changeset 645500 048f81b21e6a9bd3992cbfed5e0fca05c8bc871a
parent 645499 59594b3879cc7b038ba8a1ed6e9e66c6423bf6e2
child 645501 fb7152a4cffafd5487d341310d90554eba6dc0c6
child 645558 8cb72c7beb5856ffb3b4ecbd9ab23942bbb2f85e
push id73769
push userbmo:cam@mcc.id.au
push dateSun, 13 Aug 2017 04:04:30 +0000
milestone57.0a1
style: Move Origin into its own file. MozReview-Commit-ID: 7tpdPVBb47r
servo/components/style/stylesheets/mod.rs
servo/components/style/stylesheets/origin.rs
--- a/servo/components/style/stylesheets/mod.rs
+++ b/servo/components/style/stylesheets/mod.rs
@@ -9,16 +9,17 @@ mod document_rule;
 mod font_face_rule;
 pub mod font_feature_values_rule;
 pub mod import_rule;
 pub mod keyframes_rule;
 mod loader;
 mod media_rule;
 mod memory;
 mod namespace_rule;
+mod origin;
 mod page_rule;
 mod rule_list;
 mod rule_parser;
 mod rules_iterator;
 mod style_rule;
 mod stylesheet;
 pub mod supports_rule;
 pub mod viewport_rule;
@@ -38,16 +39,17 @@ pub use self::font_feature_values_rule::
 pub use self::import_rule::ImportRule;
 pub use self::keyframes_rule::KeyframesRule;
 pub use self::loader::StylesheetLoader;
 pub use self::media_rule::MediaRule;
 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};
 pub use self::rules_iterator::{AllRules, EffectiveRules, NestedRuleIterationCondition, RulesIterator};
 pub use self::stylesheet::{Namespaces, Stylesheet, StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
 pub use self::style_rule::StyleRule;
 pub use self::supports_rule::SupportsRule;
 pub use self::viewport_rule::ViewportRule;
@@ -77,32 +79,16 @@ impl UrlExtraData {
     }
 }
 
 // XXX We probably need to figure out whether we should mark Eq here.
 // It is currently marked so because properties::UnparsedValue wants Eq.
 #[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.
 #[derive(Debug, Clone)]
 #[allow(missing_docs)]
 pub enum CssRule {
     // No Charset here, CSSCharsetRule has been removed from CSSOM
     // https://drafts.csswg.org/cssom/#changes-from-5-december-2013
new file mode 100644
--- /dev/null
+++ b/servo/components/style/stylesheets/origin.rs
@@ -0,0 +1,22 @@
+/* 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,
+}
+