diff --git a/src/rust-css b/src/rust-css index 9496e6d60d2..41d232fe563 160000 --- a/src/rust-css +++ b/src/rust-css @@ -1 +1 @@ -Subproject commit 9496e6d60d2a3f75aebcd63ad65a8d886a299960 +Subproject commit 41d232fe56314d0406a3d846b70182405811865b diff --git a/src/rust-netsurfcss b/src/rust-netsurfcss index 372d0334abe..2865a928229 160000 --- a/src/rust-netsurfcss +++ b/src/rust-netsurfcss @@ -1 +1 @@ -Subproject commit 372d0334abe19eca4d9b9ba3e0948f81d586c14e +Subproject commit 2865a9282299ee21f70e2ebf409e6804767db160 diff --git a/src/servo/content/content_task.rs b/src/servo/content/content_task.rs index 3451fd8e452..db2ee847ddd 100644 --- a/src/servo/content/content_task.rs +++ b/src/servo/content/content_task.rs @@ -23,7 +23,7 @@ use layout::layout_task; use layout_task::{LayoutTask, BuildMsg, BuildData, AddStylesheet}; use resource::image_cache_task::ImageCacheTask; -use newcss::Stylesheet; +use newcss::stylesheet::Stylesheet; use jsrt = js::rust::rt; use js::rust::{cx, methods}; diff --git a/src/servo/css/compute.rs b/src/servo/css/compute.rs index abba4365dd9..83f2ccc42d3 100644 --- a/src/servo/css/compute.rs +++ b/src/servo/css/compute.rs @@ -7,8 +7,10 @@ The only exception is that this is where inheritance is resolved. use dom::node::Node; use newcss::color::{Color, rgba}; -use newcss::values::{CSSValue, Specified, Inherit, Length, Px, CSSBorderWidth, BdrWidthLength}; -use newcss::ComputedStyle; +use newcss::units::{Length, Px}; +use newcss::values::{CSSValue, Specified, Inherit}; +use newcss::values::{CSSBorderWidth, CSSBorderWidthLength}; +use newcss::computed::ComputedStyle; pub trait ComputeStyles { fn compute_background_color(&self) -> Color; @@ -28,19 +30,19 @@ impl Node: ComputeStyles { } fn compute_border_top_width(&self) -> CSSBorderWidth { - resolve(self, BdrWidthLength(Px(0.0)), |cs| cs.border_top_width() ) + resolve(self, CSSBorderWidthLength(Px(0.0)), |cs| cs.border_top_width() ) } fn compute_border_right_width(&self) -> CSSBorderWidth { - resolve(self, BdrWidthLength(Px(0.0)), |cs| cs.border_right_width() ) + resolve(self, CSSBorderWidthLength(Px(0.0)), |cs| cs.border_right_width() ) } fn compute_border_bottom_width(&self) -> CSSBorderWidth { - resolve(self, BdrWidthLength(Px(0.0)), |cs| cs.border_bottom_width() ) + resolve(self, CSSBorderWidthLength(Px(0.0)), |cs| cs.border_bottom_width() ) } fn compute_border_left_width(&self) -> CSSBorderWidth { - resolve(self, BdrWidthLength(Px(0.0)), |cs| cs.border_left_width() ) + resolve(self, CSSBorderWidthLength(Px(0.0)), |cs| cs.border_left_width() ) } fn compute_border_top_color(&self) -> Color { @@ -68,6 +70,5 @@ fn resolve(node: &Node, default: T, get: &fn(cs: ComputedStyle) -> CSSValue /* FIXME: need inheritance */ move default, Specified(move value) => move value, - _ => fail } } \ No newline at end of file diff --git a/src/servo/css/matching.rs b/src/servo/css/matching.rs index 8bd39f6bf1a..70061260893 100644 --- a/src/servo/css/matching.rs +++ b/src/servo/css/matching.rs @@ -3,7 +3,7 @@ */ use std::arc::{ARC, get, clone}; use dom::node::{Node, NodeTree}; -use newcss::{SelectCtx, SelectResults}; +use newcss::select::{SelectCtx, SelectResults}; use layout::context::LayoutContext; use select_handler::NodeSelectHandler; diff --git a/src/servo/css/node_util.rs b/src/servo/css/node_util.rs index 7e20f12e742..cc4a8ca166c 100644 --- a/src/servo/css/node_util.rs +++ b/src/servo/css/node_util.rs @@ -1,5 +1,5 @@ use dom::node::Node; -use newcss::SelectResults; +use newcss::select::SelectResults; use std::cell::Cell; trait NodeUtil { diff --git a/src/servo/css/select_handler.rs b/src/servo/css/select_handler.rs index d0f58b37c16..861de58fbf1 100644 --- a/src/servo/css/select_handler.rs +++ b/src/servo/css/select_handler.rs @@ -1,5 +1,5 @@ use dom::node::{Node, NodeData, NodeTree, Doctype, Comment, Element, Text}; -use newcss::SelectHandler; +use newcss::select::SelectHandler; use util::tree; pub struct NodeSelectHandler { diff --git a/src/servo/dom/document.rs b/src/servo/dom/document.rs index b0253005747..df9e8b6a485 100644 --- a/src/servo/dom/document.rs +++ b/src/servo/dom/document.rs @@ -1,4 +1,4 @@ -use newcss::values::Stylesheet; +use newcss::stylesheet::Stylesheet; use dom::node::{NodeScope, Node}; use std::arc::ARC; diff --git a/src/servo/dom/node.rs b/src/servo/dom/node.rs index ec5fe4910da..d4d6e2e6bbe 100644 --- a/src/servo/dom/node.rs +++ b/src/servo/dom/node.rs @@ -1,5 +1,5 @@ /* The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements. */ -use newcss::SelectResults; +use newcss::select::SelectResults; use dom::bindings; use dom::document::Document; use dom::element::{Attr, ElementData}; diff --git a/src/servo/html/cssparse.rs b/src/servo/html/cssparse.rs index 0ac0d7c2c2d..9273e8e2883 100644 --- a/src/servo/html/cssparse.rs +++ b/src/servo/html/cssparse.rs @@ -5,7 +5,7 @@ Some little helpers for hooking up the HTML parser with the CSS parser use std::net::url::Url; use std::cell::Cell; use resource::resource_task::{ResourceTask, ProgressMsg, Load, Payload, Done}; -use newcss::Stylesheet; +use newcss::stylesheet::Stylesheet; use newcss::util::DataStream; pub fn spawn_css_parser(url: Url, resource_task: ResourceTask) -> comm::Port { diff --git a/src/servo/html/hubbub_html_parser.rs b/src/servo/html/hubbub_html_parser.rs index 9addf671429..5fea36f40db 100644 --- a/src/servo/html/hubbub_html_parser.rs +++ b/src/servo/html/hubbub_html_parser.rs @@ -1,6 +1,6 @@ use au = gfx::geometry; use content::content_task::ContentTask; -use newcss::Stylesheet; +use newcss::stylesheet::Stylesheet; use dom::cow; use dom::element::*; use dom::event::{Event, ReflowEvent}; diff --git a/src/servo/layout/box.rs b/src/servo/layout/box.rs index b00908e96a5..64f320f2edc 100644 --- a/src/servo/layout/box.rs +++ b/src/servo/layout/box.rs @@ -9,9 +9,10 @@ use core::dvec::DVec; use core::to_str::ToStr; use core::rand; use css::compute::ComputeStyles; -use newcss::values::{BoxSizing, Length, Px, CSSDisplay, Specified, BgColor, BgColorTransparent}; -use newcss::values::{BdrColor, PosAbsolute}; -use newcss::values::{BdrWidthLength, BdrWidthMedium}; +use newcss::units::{BoxSizing, Length, Px}; +use newcss::values::{CSSDisplay, Specified, CSSBackgroundColorColor, CSSBackgroundColorTransparent}; +use newcss::values::{CSSBorderColor, CSSPositionAbsolute}; +use newcss::values::{CSSBorderWidthLength, CSSBorderWidthMedium}; use newcss::color::{Color, rgba}; use dom::element::{ElementKind, HTMLDivElement, HTMLImageElement}; use dom::node::{Element, Node, NodeData, NodeKind, NodeTree}; @@ -442,10 +443,10 @@ impl RenderBox : RenderBoxMethods { let left_width = self.d().node.compute_border_left_width(); match (top_width, right_width, bottom_width, left_width) { - (BdrWidthLength(Px(top)), - BdrWidthLength(Px(right)), - BdrWidthLength(Px(bottom)), - BdrWidthLength(Px(left))) => { + (CSSBorderWidthLength(Px(top)), + CSSBorderWidthLength(Px(right)), + CSSBorderWidthLength(Px(bottom)), + CSSBorderWidthLength(Px(left))) => { let top_au = au::from_frac_px(top); let right_au = au::from_frac_px(right); let bottom_au = au::from_frac_px(bottom); @@ -474,10 +475,10 @@ impl RenderBox : RenderBoxMethods { fail ~"unimplemented border widths"; } } - (BdrWidthMedium, - BdrWidthMedium, - BdrWidthMedium, - BdrWidthMedium) => { + (CSSBorderWidthMedium, + CSSBorderWidthMedium, + CSSBorderWidthMedium, + CSSBorderWidthMedium) => { // FIXME: This seems to be the default for non-root nodes. For now we'll ignore it warn!("ignoring medium border widths"); } diff --git a/src/servo/layout/box_builder.rs b/src/servo/layout/box_builder.rs index 1b85a04cd21..56ff9cab487 100644 --- a/src/servo/layout/box_builder.rs +++ b/src/servo/layout/box_builder.rs @@ -1,8 +1,8 @@ /** Creates CSS boxes from a DOM. */ use au = gfx::geometry; use core::dvec::DVec; -use newcss::values::{CSSDisplay, DisplayBlock, DisplayInline, DisplayInlineBlock, DisplayNone}; -use newcss::values::{Inherit, Initial, Specified}; +use newcss::values::{CSSDisplay, CSSDisplayBlock, CSSDisplayInline, CSSDisplayInlineBlock, CSSDisplayNone}; +use newcss::values::{Inherit, Specified}; use dom::element::*; use dom::node::{Comment, Doctype, Element, Text, Node, LayoutData}; use image::holder::ImageHolder; @@ -52,23 +52,23 @@ priv fn simulate_UA_display_rules(node: Node) -> CSSDisplay { Specified(v) => v } };*/ - let resolved = DisplayInline; - if (resolved == DisplayNone) { return resolved; } + let resolved = CSSDisplayInline; + if (resolved == CSSDisplayNone) { return resolved; } do node.read |n| { match n.kind { - ~Doctype(*) | ~Comment(*) => DisplayNone, - ~Text(*) => DisplayInline, + ~Doctype(*) | ~Comment(*) => CSSDisplayNone, + ~Text(*) => CSSDisplayInline, ~Element(e) => match e.kind { - ~HTMLHeadElement(*) => DisplayNone, - ~HTMLScriptElement(*) => DisplayNone, - ~HTMLParagraphElement(*) => DisplayBlock, - ~HTMLDivElement(*) => DisplayBlock, - ~HTMLBodyElement(*) => DisplayBlock, - ~HTMLHeadingElement(*) => DisplayBlock, - ~HTMLHtmlElement(*) => DisplayBlock, - ~HTMLUListElement(*) => DisplayBlock, - ~HTMLOListElement(*) => DisplayBlock, + ~HTMLHeadElement(*) => CSSDisplayNone, + ~HTMLScriptElement(*) => CSSDisplayNone, + ~HTMLParagraphElement(*) => CSSDisplayBlock, + ~HTMLDivElement(*) => CSSDisplayBlock, + ~HTMLBodyElement(*) => CSSDisplayBlock, + ~HTMLHeadingElement(*) => CSSDisplayBlock, + ~HTMLHtmlElement(*) => CSSDisplayBlock, + ~HTMLUListElement(*) => CSSDisplayBlock, + ~HTMLOListElement(*) => CSSDisplayBlock, _ => resolved } } @@ -223,15 +223,15 @@ impl BuilderContext { fn containing_context_for_display(display: CSSDisplay, builder: &LayoutTreeBuilder) -> BuilderContext { match (display, self.default_collector.flow) { - (DisplayBlock, @RootFlow(*)) => self.create_child_flow_of_type(Flow_Block, builder), - (DisplayBlock, @BlockFlow(*)) => { + (CSSDisplayBlock, @RootFlow(*)) => self.create_child_flow_of_type(Flow_Block, builder), + (CSSDisplayBlock, @BlockFlow(*)) => { self.clear_inline_collector(); self.create_child_flow_of_type(Flow_Block, builder) }, - (DisplayInline, @InlineFlow(*)) => self.clone(), - (DisplayInlineBlock, @InlineFlow(*)) => self.clone(), - (DisplayInline, @BlockFlow(*)) => self.get_inline_collector(builder), - (DisplayInlineBlock, @BlockFlow(*)) => self.get_inline_collector(builder), + (CSSDisplayInline, @InlineFlow(*)) => self.clone(), + (CSSDisplayInlineBlock, @InlineFlow(*)) => self.clone(), + (CSSDisplayInline, @BlockFlow(*)) => self.get_inline_collector(builder), + (CSSDisplayInlineBlock, @BlockFlow(*)) => self.get_inline_collector(builder), _ => self.clone() } } @@ -251,7 +251,7 @@ impl LayoutTreeBuilder { // TODO: remove this once UA styles work // TODO: handle interactions with 'float', 'position' (CSS 2.1, Section 9.7) let simulated_display = match simulate_UA_display_rules(cur_node) { - DisplayNone => return, // tree ends here if 'display: none' + CSSDisplayNone => return, // tree ends here if 'display: none' v => v }; diff --git a/src/servo/layout/display_list_builder.rs b/src/servo/layout/display_list_builder.rs index 1da4d1c2bf0..d30f402c2ce 100644 --- a/src/servo/layout/display_list_builder.rs +++ b/src/servo/layout/display_list_builder.rs @@ -2,7 +2,8 @@ export DisplayListBuilder; use au = gfx::geometry; use au::Au; -use newcss::values::{BgColor, BgColorTransparent, Specified}; +use newcss::values::Specified; +use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent}; use dom::node::{Text, NodeScope}; use dom::cow::Scope; use dvec::DVec; diff --git a/src/servo/layout/layout_task.rs b/src/servo/layout/layout_task.rs index 5a3b13a9658..0034f20fb25 100644 --- a/src/servo/layout/layout_task.rs +++ b/src/servo/layout/layout_task.rs @@ -7,7 +7,7 @@ use au = gfx::geometry; use au::Au; use content::content_task; use core::dvec::DVec; -use newcss::Stylesheet; +use newcss::stylesheet::Stylesheet; use dl = gfx::display_list; use dom::event::{Event, ReflowEvent}; use dom::node::{Node, LayoutData}; @@ -36,7 +36,7 @@ use layout::traverse::*; use comm::*; use task::*; use core::mutable::Mut; -use newcss::SelectCtx; +use newcss::select::SelectCtx; pub type LayoutTask = comm::Chan;