servo: Create a css module and divide into values, styles, and resolve things.
authorBrian J. Burg <burg@cs.washington.edu>
Thu, 06 Sep 2012 12:32:09 -0700
changeset 361878 7558834c2fca470a61df56b86903e5c8dffea25a
parent 361877 1470a44d3f254b3d5c0244410894dbc7d43c9ddf
child 361879 85dea2f644e5cd4922cefef8d13533213ad08524
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Create a css module and divide into values, styles, and resolve things. Source-Repo: https://github.com/servo/servo Source-Revision: e1bcdc509a89afc686651c46bcae110106ab353e
servo/src/servo/content/content_task.rs
servo/src/servo/css/resolve/apply.rs
servo/src/servo/css/resolve/matching.rs
servo/src/servo/css/styles.rs
servo/src/servo/css/values.rs
servo/src/servo/dom/base.rs
servo/src/servo/dom/style.rs
servo/src/servo/layout/base.rs
servo/src/servo/layout/block.rs
servo/src/servo/layout/box_builder.rs
servo/src/servo/layout/inline.rs
servo/src/servo/layout/layout_task.rs
servo/src/servo/layout/style/apply.rs
servo/src/servo/layout/style/matching.rs
servo/src/servo/layout/style/style.rs
servo/src/servo/parser/css_builder.rs
servo/src/servo/parser/css_lexer.rs
servo/src/servo/parser/html_builder.rs
servo/src/servo/parser/html_lexer.rs
servo/src/servo/parser/hubbub_html_parser.rs
servo/src/servo/parser/parser_util.rs
servo/src/servo/servo.rc
--- a/servo/src/servo/content/content_task.rs
+++ b/servo/src/servo/content/content_task.rs
@@ -9,24 +9,24 @@ export PingMsg, PongMsg;
 
 import std::arc::{ARC, clone};
 import comm::{Port, Chan, listen, select2};
 import task::{spawn, spawn_listener};
 import io::{read_whole_file, println};
 
 import dom::base::{Document, Node, NodeScope, Window, define_bindings};
 import dom::event::{Event, ResizeEvent, ReflowEvent};
-import dom::style;
-import dom::style::Stylesheet;
 import gfx::compositor::Compositor;
 import parser::html_lexer::spawn_html_lexer_task;
 import parser::html_builder::build_dom;
 import layout::layout_task;
 import layout_task::{LayoutTask, BuildMsg};
 
+import css::styles::Stylesheet;
+
 import jsrt = js::rust::rt;
 import js::rust::{cx, methods};
 import js::global::{global_class, debug_fns};
 
 import either::{Either, Left, Right};
 
 import dom::bindings::utils::rust_box;
 import js::rust::compartment;
rename from servo/src/servo/layout/style/apply.rs
rename to servo/src/servo/css/resolve/apply.rs
--- a/servo/src/servo/layout/style/apply.rs
+++ b/servo/src/servo/css/resolve/apply.rs
@@ -1,19 +1,20 @@
 #[doc="Applies the appropriate CSS style to boxes."]
 
 import dom::base::{Element, HTMLImageElement, Node};
-import dom::style::{Percent, Mm, Pt, Px, Auto, PtToPx, MmToPx};
 import gfx::geometry::au_to_px;
-import base::{Box, BTree, NTree, LayoutData, SpecifiedStyle, ImageHolder,
+import layout::base::{Box, BTree, NTree, LayoutData, SpecifiedStyle, ImageHolder,
               BlockBox, InlineBox, IntrinsicBox, TextBox};
-import traverse::{top_down_traversal};
+import layout::traverse::{top_down_traversal};
 import std::net::url::Url;
 import resource::image_cache_task::ImageCacheTask;
 
+import css::values::{Percent, Mm, Pt, Px, Auto, PtToPx, MmToPx};
+
 struct StyleApplicator {
     box: @Box;
     doc_url: &Url;
     image_cache_task: ImageCacheTask;
     reflow: fn~();
 }
 
 fn apply_style(box: @Box, doc_url: &Url, image_cache_task: ImageCacheTask, reflow: fn~()) {
rename from servo/src/servo/layout/style/matching.rs
rename to servo/src/servo/css/resolve/matching.rs
--- a/servo/src/servo/layout/style/matching.rs
+++ b/servo/src/servo/css/resolve/matching.rs
@@ -1,17 +1,18 @@
 #[doc="Performs CSS selector matching."]
 
-import base::{LayoutData};
+import dom::base::{LayoutData};
 import dom::base;
 import base::{ElementData, Node, Text};
-import dom::style::{Selector, StyleDeclaration, FontSize, Display, TextColor, BackgroundColor,
+
+import values::{Selector, StyleDeclaration, FontSize, Display, TextColor, BackgroundColor,
                     Stylesheet, Element, Child, Descendant, Sibling, Attr, Exact, Exists, Includes,
                     StartsWith, Width, Height};
-import style::{SpecifiedStyle};
+import styles::{SpecifiedStyle};
 
 #[doc="Check if a CSS attribute matches the attribute of an HTML element."]
 fn attrs_match(attr: Attr, elmt: ElementData) -> bool {
     match attr {
       Exists(name) => {
         match elmt.get_attr(name) {
           Some(_) => true,
           None => false
rename from servo/src/servo/layout/style/style.rs
rename to servo/src/servo/css/styles.rs
--- a/servo/src/servo/layout/style/style.rs
+++ b/servo/src/servo/css/styles.rs
@@ -1,18 +1,19 @@
 #[doc="High-level interface to CSS selector matching."]
 
 import std::arc::{ARC, get, clone};
 
-import dom::style::{DisplayType, DisBlock, DisInline, DisNone, Stylesheet, Unit, Auto};
+import css::values::{DisplayType, DisBlock, DisInline, DisNone, Unit, Auto};
+import css::values::Stylesheet;
 import dom::base::{HTMLDivElement, HTMLHeadElement, HTMLImageElement, UnknownElement, HTMLScriptElement};
 import dom::base::{Comment, Doctype, Element, Node, NodeKind, Text};
 import util::color::{Color, rgb};
 import util::color::css_colors::{white, black};
-import base::{LayoutData, NTree};
+import layout::base::{LayoutData, NTree};
 
 type SpecifiedStyle = {mut background_color : Option<Color>,
                         mut display_type : Option<DisplayType>,
                         mut font_size : Option<Unit>,
                         mut height : Option<Unit>,
                         mut text_color : Option<Color>,
                         mut width : Option<Unit>
                        };
rename from servo/src/servo/dom/style.rs
rename to servo/src/servo/css/values.rs
--- a/servo/src/servo/dom/base.rs
+++ b/servo/src/servo/dom/base.rs
@@ -8,17 +8,17 @@ import js::rust::{bare_compartment, comp
 import js::jsapi::{JSClass, JSObject, JSPropertySpec, JSContext, jsid, jsval, JSBool};
 import js::{JSPROP_ENUMERATE, JSPROP_SHARED};
 import js::crust::*;
 import js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
 import dvec::DVec;
 import ptr::null;
 import bindings;
 import std::arc::ARC;
-import style::Stylesheet;
+import css::values::Stylesheet;
 import comm::{Port, Chan};
 import content::content_task::{ControlMsg, Timer};
 
 enum TimerControlMsg {
     Fire(~dom::bindings::window::TimerData),
     Close
 }
 
--- a/servo/src/servo/layout/base.rs
+++ b/servo/src/servo/layout/base.rs
@@ -1,25 +1,25 @@
 #[doc="Fundamental layout structures and algorithms."]
 
+import css::values::Unit;
+import css::styles::SpecifiedStyle;
 import dom::base::{Element, ElementKind, HTMLDivElement, HTMLImageElement, Node, NodeData};
 import dom::base::{NodeKind};
 import dom::rcu;
-import dom::style::Unit;
 import gfx::geometry;
 import gfx::geometry::{au, zero_size_au};
 import geom::point::Point2D;
 import geom::rect::Rect;
 import geom::size::Size2D;
 import image::base::Image;
 import util::tree;
 import util::color::Color;
 import text::TextBox;
 import traverse::extended_full_traversal;
-import style::style::{SpecifiedStyle};
 import vec::{push, push_all};
 import std::net::url::Url;
 import resource::image_cache_task;
 import image_cache_task::ImageCacheTask;
 import core::to_str::ToStr;
 import std::arc::{ARC, clone};
 import task::spawn;
 
--- a/servo/src/servo/layout/block.rs
+++ b/servo/src/servo/layout/block.rs
@@ -1,11 +1,11 @@
 #[doc="Block layout."]
 
-import dom::style::{Px, Mm, Pt, Auto, Percent, Unit};
+import css::values::{Px, Mm, Pt, Auto, Percent, Unit};
 import geom::point::Point2D;
 import geom::size::Size2D;
 import gfx::geometry::{px_to_au, au};
 import util::tree;
 import base::{Box, BlockBox, BTree};
 
 trait BlockLayoutMethods {
     fn reflow_block();
--- a/servo/src/servo/layout/box_builder.rs
+++ b/servo/src/servo/layout/box_builder.rs
@@ -1,12 +1,12 @@
 #[doc="Creates CSS boxes from a DOM."]
 
+import css::values::{DisplayType, DisBlock, DisInline, DisNone};
 import dom::base::{ElementData, HTMLDivElement, HTMLImageElement, Element, Text, Node};
-import dom::style::{DisplayType, DisBlock, DisInline, DisNone};
 import gfx::geometry::zero_size_au;
 import layout::base::{Appearance, BTree, BlockBox, Box, BoxKind, InlineBox, IntrinsicBox, NTree};
 import layout::base::{TextBoxKind};
 import layout::text::TextBox;
 import util::tree;
 import option::is_none;
 
 export box_builder_methods;
--- a/servo/src/servo/layout/inline.rs
+++ b/servo/src/servo/layout/inline.rs
@@ -1,13 +1,13 @@
 #[doc="Inline layout."]
 
 import base::{Box, InlineBox, BTree};
+import css::values::{Auto, Px};
 import dom::rcu;
-import dom::style::{Auto, Px};
 import geom::point::Point2D;
 import geom::size::Size2D;
 import gfx::geometry::{au, px_to_au};
 import num::Num;
 import util::tree;
 
 trait InlineLayout {
     fn reflow_inline();
--- a/servo/src/servo/layout/layout_task.rs
+++ b/servo/src/servo/layout/layout_task.rs
@@ -1,23 +1,23 @@
 #[doc = "
     The layout task. Performs layout on the DOM, builds display lists and sends them to be
     rendered.
 "];
 
 import std::arc::ARC;
 import display_list_builder::build_display_list;
 import dom::base::Node;
-import dom::style::Stylesheet;
+import css::values::Stylesheet;
 import gfx::geometry::px_to_au;
 import gfx::render_task;
 import render_task::RenderTask;
 import resource::image_cache_task::ImageCacheTask;
 import std::net::url::Url;
-import style::apply::apply_style;
+import css::resolve::apply::apply_style;
 import dom::event::{Event, ReflowEvent};
 import content::content_task;
 
 import task::*;
 import comm::*;
 
 type LayoutTask = Chan<Msg>;
 
--- a/servo/src/servo/parser/css_builder.rs
+++ b/servo/src/servo/parser/css_builder.rs
@@ -1,20 +1,19 @@
 #[doc="Constructs a list of css style rules from a token stream"]
 
 // TODO: fail according to the css spec instead of failing when things
 // are not as expected
 
-import dom::style;
-import style::{DisInline, DisBlock, DisNone, Display, TextColor, BackgroundColor, FontSize,
-               Height, Width, StyleDeclaration, Selector};
-import parser::css_lexer::{Token, StartDescription, EndDescription,
-                           Descendant, Child, Sibling,
-                           Comma, Element, Attr, Description,
-                           Eof};
+import css::values::{DisInline, DisBlock, DisNone, Display, TextColor, BackgroundColor, FontSize,
+                     Height, Width, StyleDeclaration};
+// Disambiguate parsed Selector, Rule values from tokens
+import css = css::values;
+import tok = parser::css_lexer;
+import parser::css_lexer::Token;
 import comm::recv;
 import option::{map, is_none};
 import vec::push;
 import parser::parser_util::{parse_display_type, parse_font_size, parse_size};
 import util::color::parsing::parse_color;
 import vec::push;
 
 type TokenReader = {stream : pipes::Port<Token>, mut lookahead : Option<Token>};
@@ -34,157 +33,158 @@ impl TokenReader : TokenReaderMethods {
 
     fn unget(-tok : Token) {
         assert is_none(self.lookahead);
         self.lookahead = Some(tok);
     }
 }
 
 trait ParserMethods {
-    fn parse_element() -> Option<~style::Selector>;
-    fn parse_selector() -> Option<~[~Selector]>;
+    fn parse_element() -> Option<~css::Selector>;
+    fn parse_selector() -> Option<~[~css::Selector]>;
     fn parse_description() -> Option<~[StyleDeclaration]>;
-    fn parse_rule() -> Option<~style::Rule>;
+    fn parse_rule() -> Option<~css::Rule>;
 }
 
 impl TokenReader : ParserMethods {
-    fn parse_element() -> Option<~style::Selector> {
+    fn parse_element() -> Option<~css::Selector> {
         // Get the current element type
          let elmt_name = match self.get() {
-           Element(tag) => { copy tag }
-           Eof => { return None; }
+           tok::Element(tag) => { copy tag }
+           tok::Eof => { return None; }
            _ => { fail ~"Expected an element" }
          };
 
          let mut attr_list = ~[];
 
          // Get the attributes associated with that element
          loop {
-             let tok = self.get();
-             match tok {
-               Attr(attr) => { push(attr_list, copy attr); }
-               StartDescription | Descendant | Child | Sibling | Comma => {
-                 self.unget(tok); 
+             let token = self.get();
+             match token {
+               tok::Attr(attr) => { push(attr_list, copy attr); }
+               tok::StartDescription | tok::Descendant | tok::Child | tok::Sibling | tok::Comma => {
+                 self.unget(token); 
                  break;
                }
-               Eof => { return None; }
-               Element(_) => fail ~"Unexpected second element without relation to first element",
-               EndDescription => fail ~"Unexpected '}'",
-               Description(_, _) => fail ~"Unexpected description"
+               tok::Eof => { return None; }
+               tok::Element(_) => fail ~"Unexpected second element without relation to first element",
+               tok::EndDescription => fail ~"Unexpected '}'",
+               tok::Description(_, _) => fail ~"Unexpected description"
              }
          }
-        return Some(~style::Element(elmt_name, attr_list));
+        return Some(~css::Element(elmt_name, attr_list));
     }
 
-    fn parse_selector() -> Option<~[~Selector]> {
+    fn parse_selector() -> Option<~[~css::Selector]> {
         let mut sel_list = ~[];
 
         // Collect all the selectors that this rule applies to
         loop {
             let mut cur_sel;
 
             match self.parse_element() {
               Some(elmt) => { cur_sel = copy elmt; }
               None => { return None; } // we hit an eof in the middle of a rule
             }
 
             loop {
                 let tok = self.get();
                 let built_sel <- cur_sel;
                 
                 match tok {
-                  Descendant => {
+                  tok::Descendant => {
                     match self.parse_element() {
                       Some(elmt) => { 
                         let new_sel = copy elmt;
-                        cur_sel <- ~style::Descendant(built_sel, new_sel)
+                        cur_sel <- ~css::Descendant(built_sel, new_sel)
                       }
                       None => { return None; }
                     }
                   }
-                  Child => {
+                  tok::Child => {
                     match self.parse_element() {
                       Some(elmt) => { 
                         let new_sel = copy elmt;
-                        cur_sel <- ~style::Child(built_sel, new_sel)
+                        cur_sel <- ~css::Child(built_sel, new_sel)
                       }
                       None => { return None; }
                     }
                   }
-                  Sibling => {
+                  tok::Sibling => {
                     match self.parse_element() {
                       Some(elmt) => { 
                         let new_sel = copy elmt;
-                        cur_sel <- ~style::Sibling(built_sel, new_sel)
+                        cur_sel <- ~css::Sibling(built_sel, new_sel)
                       }
                       None => { return None; }
                     }
                   }
-                  StartDescription => {
+                  tok::StartDescription => {
                     push(sel_list, built_sel);
-                    self.unget(StartDescription);
+                    self.unget(tok::StartDescription);
                     break;
                   }
-                  Comma => {
+                  tok::Comma => {
                     push(sel_list, built_sel);
-                    self.unget(Comma);
+                    self.unget(tok::Comma);
                     break;
                   }
-                  Attr(_) | EndDescription | Element(_) | Description(_, _) => {
+                  tok::Attr(_) | tok::EndDescription | tok::Element(_) | tok::Description(_, _) => {
                     fail #fmt["Unexpected token %? in elements", tok];
                   }
-                  Eof => { return None; }
+                  tok::Eof => { return None; }
                 }
             }
 
             // check if we should break out of the nesting loop as well
             // TODO: fix this when rust gets labelled loops
             let tok = self.get();
             match tok {
-              StartDescription => { break; }
-              Comma => { }
+              tok::StartDescription => { break; }
+              tok::Comma => { }
               _ => { self.unget(tok); }
             }
         }
         
         return Some(sel_list);
     }
 
     fn parse_description() -> Option<~[StyleDeclaration]> {
         let mut desc_list : ~[StyleDeclaration]= ~[];
         
         // Get the description to be applied to the selector
         loop {
             let tok = self.get();
             match tok {
-              EndDescription => { break; }
-              Description(prop, val) => {
+              tok::EndDescription => { break; }
+              tok::Description(prop, val) => {
                 let desc = match prop {
                   // TODO: have color parsing return an option instead of a real value
                   ~"background-color" => parse_color(val).map(|res| BackgroundColor(res)),
                   ~"color" => parse_color(val).map(|res| TextColor(res)),
                   ~"display" => parse_display_type(val).map(|res| Display(res)),
                   ~"font-size" => parse_font_size(val).map(|res| FontSize(res)),
                   ~"height" => parse_size(val).map(|res| Height(res)),
                   ~"width" => parse_size(val).map(|res| Width(res)),
                   _ => { #debug["Recieved unknown style property '%s'", val]; None }
                 };
                 desc.map(|res| push(desc_list, res));
               }
-              Eof => { return None; }
-              StartDescription | Descendant | Child | Sibling | Comma | Element(_) | Attr(_) => {
+              tok::Eof => { return None; }
+              tok::StartDescription | tok::Descendant |  tok::Child | tok::Sibling 
+              | tok::Comma | tok::Element(_) | tok::Attr(_) => {
                 fail #fmt["Unexpected token %? in description", tok]; 
               }
             }
         }
         
         return Some(desc_list);
     }
 
-    fn parse_rule() -> Option<~style::Rule> {
+    fn parse_rule() -> Option<~css::Rule> {
         // TODO: get rid of copies once match move works
         let sel_list = match self.parse_selector() {
           Some(list) => { copy list }
           None => { return None; }
         };
 
         #debug("sel_list: %?", sel_list);
         
@@ -195,17 +195,17 @@ impl TokenReader : ParserMethods {
         };
 
         #debug("desc_list: %?", desc_list);
         
         return Some(~(sel_list, desc_list));
     }
 }
 
-fn build_stylesheet(+stream : pipes::Port<Token>) -> ~[~style::Rule] {
+fn build_stylesheet(+stream : pipes::Port<Token>) -> ~[~css::Rule] {
     let mut rule_list = ~[];
     let reader = {stream : stream, mut lookahead : None};
 
     loop {
         match reader.parse_rule() {
           Some(rule) => { push(rule_list, copy rule); }
           None => { break; }
         }
--- a/servo/src/servo/parser/css_lexer.rs
+++ b/servo/src/servo/parser/css_lexer.rs
@@ -1,11 +1,10 @@
 #[doc = "Code to lex and tokenize css files."]
 
-import dom::style;
 import option::is_none;
 import str::from_bytes;
 import vec::push;
 
 import pipes::{Port, Chan};
 
 import lexer_util::*;
 
@@ -27,17 +26,17 @@ type CssLexer = {
 enum Token {
     StartDescription,
     EndDescription,
     Descendant,
     Child,
     Sibling,
     Comma,
     Element(~str),
-    Attr(style::Attr), 
+    Attr(css::values::Attr), 
     Description(~str, ~str),
     Eof
 }
 
 trait CssLexerMethods {
     fn parse_css() -> Token;
     fn parse_css_relation(c : u8) -> Token;
     fn parse_css_element(c : u8) -> Token;
@@ -115,42 +114,42 @@ impl CssLexer : CssLexerMethods {
               CoeChar(c) => { ch = c }
               CoeEof => { fail ~"File ended before description of style" }
             }
 
             return self.parse_css_relation(ch);
         }
         
         match ch {
-          '.' as u8 => return Attr(style::Includes(~"class", self.input_state.parse_ident())),
-          '#' as u8 => return Attr(style::Includes(~"id", self.input_state.parse_ident())),
+          '.' as u8 => return Attr(css::values::Includes(~"class", self.input_state.parse_ident())),
+          '#' as u8 => return Attr(css::values::Includes(~"id", self.input_state.parse_ident())),
           '[' as u8 => {
             let attr_name = self.input_state.parse_ident();
             
             match self.input_state.get() {
               CoeChar(c) => { ch = c; }
               CoeEof => { fail ~"File ended before description finished"; }
             }
 
             if ch == ']' as u8 {
-                return Attr(style::Exists(attr_name));
+                return Attr(css::values::Exists(attr_name));
             } else if ch == '=' as u8 {
                 let attr_val = self.input_state.parse_ident();
                 self.input_state.expect(']' as u8);
-                return Attr(style::Exact(attr_name, attr_val));
+                return Attr(css::values::Exact(attr_name, attr_val));
             } else if ch == '~' as u8 {
                 self.input_state.expect('=' as u8);
                 let attr_val = self.input_state.parse_ident();
                 self.input_state.expect(']' as u8);
-                return Attr(style::Includes(attr_name, attr_val));
+                return Attr(css::values::Includes(attr_name, attr_val));
             } else if ch == '|' as u8 {
                 self.input_state.expect('=' as u8);
                 let attr_val = self.input_state.parse_ident();
                 self.input_state.expect(']' as u8);
-                return Attr(style::StartsWith(attr_name, attr_val));
+                return Attr(css::values::StartsWith(attr_name, attr_val));
             }
             
             fail #fmt("Unexpected symbol %c in attribute", ch as char);
           }
           _ => { fail #fmt("Unexpected symbol %c in attribute", ch as char); }
         }
     }
 
--- a/servo/src/servo/parser/html_builder.rs
+++ b/servo/src/servo/parser/html_builder.rs
@@ -3,17 +3,17 @@
 import dom::base::{Attr, Element, ElementData, ElementKind, HTMLDivElement, HTMLHeadElement,
                    HTMLScriptElement};
 import dom::base::{HTMLImageElement, Node, NodeScope, Text, UnknownElement};
 import geom::size::Size2D;
 import gfx::geometry;
 import gfx::geometry::au;
 import parser = parser::html_lexer;
 import parser::Token;
-import dom::style::Stylesheet;
+import css::values::Stylesheet;
 import vec::{push, push_all_move, flat_map};
 import std::net::url::Url;
 import resource::resource_task::{ResourceTask, Load, Payload, Done};
 import to_str::ToStr;
 
 enum CSSMessage {
     File(Url),
     Exit   
--- a/servo/src/servo/parser/html_lexer.rs
+++ b/servo/src/servo/parser/html_lexer.rs
@@ -1,10 +1,9 @@
 import comm::{Port, Chan};
-import dom::style;
 import option::is_none;
 import str::from_bytes;
 import vec::push;
 import lexer_util::*;
 import resource::resource_task;
 import resource_task::{ResourceTask, ProgressMsg, Load};
 import std::net::url::Url;
 
--- a/servo/src/servo/parser/hubbub_html_parser.rs
+++ b/servo/src/servo/parser/hubbub_html_parser.rs
@@ -1,12 +1,12 @@
 use dom::base::{Attr, Comment, Doctype, DoctypeData, Element, ElementData, ElementKind};
 use dom::base::{HTMLDivElement, HTMLHeadElement, HTMLImageElement, HTMLScriptElement};
 use dom::base::{Node, NodeScope, Text, UnknownElement};
-use dom::style::Stylesheet;
+use css::values::Stylesheet;
 use geom::size::Size2D;
 use gfx::geometry::px_to_au;
 use parser::html_builder::CSSMessage;
 use resource::resource_task::{Done, Load, Payload, ResourceTask};
 use CSSExitMessage = parser::html_builder::Exit;
 use CSSFileMessage = parser::html_builder::File;
 use JSExitMessage = parser::html_builder::js_exit;
 use JSFileMessage = parser::html_builder::js_file;
--- a/servo/src/servo/parser/parser_util.rs
+++ b/servo/src/servo/parser/parser_util.rs
@@ -1,11 +1,11 @@
 #[doc = "Helper functions to parse values of specific attributes."]
 
-import dom::style::*;
+import css::values::*;
 import str::{pop_char, from_chars};
 import float::from_str;
 import option::map;
 
 export parse_font_size;
 export parse_size;
 export parse_display_type;
 
--- a/servo/src/servo/servo.rc
+++ b/servo/src/servo/servo.rc
@@ -19,38 +19,40 @@ use http_client;
 use hubbub;
 
 mod engine;
 
 mod dom {
     mod base;
     mod event;
     mod rcu;
-    mod style;
     mod bindings {
         mod document;
         mod element;
         mod utils;
         mod node;
         mod window;
     }
 }
 
 #[allow(non_implicitly_copyable_typarams)]
 mod content {
     mod content_task;
 }
 
-mod layout {
-    mod style {
+mod css {
+    mod values;
+    mod styles;
+    mod resolve {
         mod apply;
-        mod style;
         mod matching;
     }
+}
 
+mod layout {
     mod base;
     mod block;
     mod box_builder;
     mod display_list;
     mod display_list_builder;
     mod inline;
     mod layout_task;
     mod text;