servo: Update rust-css, rust-netsurfcss
authorBrian Anderson <banderson@mozilla.com>
Sat, 03 Nov 2012 21:17:48 -0700
changeset 333201 056bc68c7200de6b9a6d29da6ab3db5b03d4a150
parent 333200 8c96d66d21c7e14657a31dc30df18737eaf04bdd
child 333202 633062529a343a347ed88121647782c239125155
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Update rust-css, rust-netsurfcss Source-Repo: https://github.com/servo/servo Source-Revision: c3efff57bf13e8b8f14001899e0dc5c458e84282
servo/src/servo/content/content_task.rs
servo/src/servo/css/compute.rs
servo/src/servo/css/matching.rs
servo/src/servo/css/node_util.rs
servo/src/servo/css/select_handler.rs
servo/src/servo/dom/document.rs
servo/src/servo/dom/node.rs
servo/src/servo/html/cssparse.rs
servo/src/servo/html/hubbub_html_parser.rs
servo/src/servo/layout/box.rs
servo/src/servo/layout/box_builder.rs
servo/src/servo/layout/display_list_builder.rs
servo/src/servo/layout/layout_task.rs
--- a/servo/src/servo/content/content_task.rs
+++ b/servo/src/servo/content/content_task.rs
@@ -18,17 +18,17 @@ use dom::document::Document;
 use dom::node::{Node, NodeScope, define_bindings};
 use dom::event::{Event, ResizeEvent, ReflowEvent};
 use dom::window::Window;
 use geom::size::Size2D;
 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};
 use js::global::{global_class, debug_fns};
 
 use either::{Either, Left, Right};
 
 use dom::bindings::utils::rust_box;
--- a/servo/src/servo/css/compute.rs
+++ b/servo/src/servo/css/compute.rs
@@ -2,18 +2,20 @@
 Calculates computed Node styles, based on CSS SelectResults.
 
 These methods mostly defer to the Node's ComputedStyle object.
 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;
     fn compute_border_top_width(&self) -> CSSBorderWidth;
     fn compute_border_right_width(&self) -> CSSBorderWidth;
     fn compute_border_bottom_width(&self) -> CSSBorderWidth;
     fn compute_border_left_width(&self) -> CSSBorderWidth;
     fn compute_border_top_color(&self) -> Color;
@@ -23,29 +25,29 @@ pub trait ComputeStyles {
 }
 
 impl Node: ComputeStyles {
     fn compute_background_color(&self) -> Color {
         resolve(self, rgba(0, 0, 0, 0.0), |cs| cs.background_color() )
     }
 
     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 {
         resolve(self, rgba(255, 255, 255, 0.0), |cs| cs.border_top_color() )
     }
 
     fn compute_border_right_color(&self) -> Color {
         resolve(self, rgba(255, 255, 255, 0.0), |cs| cs.border_right_color() )
@@ -63,11 +65,10 @@ impl Node: ComputeStyles {
 
 fn resolve<T>(node: &Node, default: T, get: &fn(cs: ComputedStyle) -> CSSValue<T>) -> T {
     let style = node.get_style();
     let computed = style.computed_style();
     let value = get(computed);
     match move value {
         Inherit => /* FIXME: need inheritance */ move default,
         Specified(move value) => move value,
-        _ => fail
     }
 }
\ No newline at end of file
--- a/servo/src/servo/css/matching.rs
+++ b/servo/src/servo/css/matching.rs
@@ -1,14 +1,14 @@
 /**
  * High-level interface to CSS selector matching.
  */
 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;
 
 trait MatchMethods {
     fn restyle_subtree(select_ctx: &SelectCtx);
 }
 
 impl Node : MatchMethods {
--- a/servo/src/servo/css/node_util.rs
+++ b/servo/src/servo/css/node_util.rs
@@ -1,10 +1,10 @@
 use dom::node::Node;
-use newcss::SelectResults;
+use newcss::select::SelectResults;
 use std::cell::Cell;
 
 trait NodeUtil {
     fn get_style() -> &self/SelectResults;
     fn set_style(decl : SelectResults);
 }
 
 impl Node: NodeUtil {
--- a/servo/src/servo/css/select_handler.rs
+++ b/servo/src/servo/css/select_handler.rs
@@ -1,10 +1,10 @@
 use dom::node::{Node, NodeData, NodeTree, Doctype, Comment, Element, Text};
-use newcss::SelectHandler;
+use newcss::select::SelectHandler;
 use util::tree;
 
 pub struct NodeSelectHandler {
     node: Node
 }
 
 /// Placeholder names
 fn unnamed_node(name: &str) -> ~str {
--- a/servo/src/servo/dom/document.rs
+++ b/servo/src/servo/dom/document.rs
@@ -1,9 +1,9 @@
-use newcss::values::Stylesheet;
+use newcss::stylesheet::Stylesheet;
 use dom::node::{NodeScope, Node};
 use std::arc::ARC;
 
 struct Document {
     root: Node,
     scope: NodeScope,
 }
 
--- a/servo/src/servo/dom/node.rs
+++ b/servo/src/servo/dom/node.rs
@@ -1,10 +1,10 @@
 /* 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};
 use dom::window::Window;
 use geom::size::Size2D;
 use js::crust::*;
 use js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
 use js::jsapi::{JSClass, JSObject, JSPropertySpec, JSContext, jsid, JSVal, JSBool};
--- a/servo/src/servo/html/cssparse.rs
+++ b/servo/src/servo/html/cssparse.rs
@@ -1,16 +1,16 @@
 /*!
 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<Stylesheet> {
     let result_port = comm::Port();
     let result_chan = comm::Chan(&result_port);
     do task::spawn |move url, copy resource_task| {
         
         let sheet = Stylesheet::new(copy url, data_stream(copy url, resource_task));
--- a/servo/src/servo/html/hubbub_html_parser.rs
+++ b/servo/src/servo/html/hubbub_html_parser.rs
@@ -1,11 +1,11 @@
 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};
 use dom::node::{Comment, Doctype, DoctypeData, Text,
                 Element, Node, NodeScope};
 use resource::image_cache_task::ImageCacheTask;
 use resource::image_cache_task;
 use resource::resource_task::{Done, Load, Payload, ResourceTask};
--- a/servo/src/servo/layout/box.rs
+++ b/servo/src/servo/layout/box.rs
@@ -4,19 +4,20 @@ use newcss::color::rgb;
 use arc = std::arc;
 use arc::ARC;
 use au = gfx::geometry;
 use au::Au;
 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};
 use geom::rect::Rect;
 use geom::size::Size2D;
 use geom::point::Point2D;
 use gfx::display_list::{DisplayItem, DisplayList, DisplayListBuilder};
 use image::{Image, ImageHolder};
@@ -437,20 +438,20 @@ impl RenderBox : RenderBoxMethods {
 
     fn add_border_to_list(list: &mut DisplayList, abs_bounds: &Rect<Au>) {
         let top_width = self.d().node.compute_border_top_width();
         let right_width = self.d().node.compute_border_right_width();
         let bottom_width = self.d().node.compute_border_bottom_width();
         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);
                 let left_au = au::from_frac_px(left);
 
                 let all_widths_equal = [top_au, right_au, bottom_au].all(|a| *a == left_au);
 
                 if all_widths_equal {
@@ -469,20 +470,20 @@ impl RenderBox : RenderBoxMethods {
                     let top_color = self.d().node.compute_border_top_color();
                     let color = top_color.to_gfx_color(); // FIXME
                     list.append_item(~DisplayItem::new_Border(&bounds, border_width, color));
                     
                 } else {
                     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");
             }
             _ => fail ~"unimplemented border widths"
         }
     }
 }
 
--- a/servo/src/servo/layout/box_builder.rs
+++ b/servo/src/servo/layout/box_builder.rs
@@ -1,13 +1,13 @@
 /** 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;
 use layout::box::*;
 use layout::block::BlockFlowData;
 use layout::context::LayoutContext;
 use layout::flow::*;
 use layout::inline::InlineFlowData;
@@ -47,33 +47,33 @@ priv fn simulate_UA_display_rules(node: 
 
     // FIXME
     /*let resolved = do node.aux |nd| {
         match nd.style.display_type {
             Inherit | Initial => DisplayInline, // TODO: remove once resolve works
             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
             }
         }
     }
 }
 
 impl BoxGenerator {
     static pure fn new(flow: @FlowContext) -> BoxGenerator {
@@ -218,25 +218,25 @@ impl BuilderContext {
 
     priv fn clear_inline_collector() {
         self.inline_collector = None;
     }
 
     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()
         }
     }
 }
 
 impl LayoutTreeBuilder {
     /* Debug-only ids */
     fn next_box_id() -> int { self.next_bid += 1; self.next_bid }
@@ -246,17 +246,17 @@ impl LayoutTreeBuilder {
     and recurses on its children. */
     fn construct_recursively(layout_ctx: &LayoutContext, cur_node: Node, parent_ctx: &BuilderContext) {
         // DEBUG
         debug!("Considering node: %?", fmt!("%?", cur_node.read(|n| copy n.kind )));
 
         // 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
         };
 
         let this_ctx = parent_ctx.containing_context_for_display(simulated_display, &self);
         this_ctx.default_collector.push_node(layout_ctx, &self, cur_node);
 
         // recurse on child nodes.
         for tree::each_child(&NodeTree, &cur_node) |child_node| {
--- a/servo/src/servo/layout/display_list_builder.rs
+++ b/servo/src/servo/layout/display_list_builder.rs
@@ -1,13 +1,14 @@
 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;
 use either::{Left, Right};
 use geom::point::Point2D;
 use geom::rect::Rect;
 use geom::size::Size2D;
 use gfx::display_list::DisplayList;
--- a/servo/src/servo/layout/layout_task.rs
+++ b/servo/src/servo/layout/layout_task.rs
@@ -2,17 +2,17 @@
     The layout task. Performs layout on the DOM, builds display lists and sends them to be
     rendered.
 */
 
 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};
 use geom::point::Point2D;
 use geom::rect::Rect;
 use geom::size::Size2D;
 use gfx::display_list::DisplayList;
 use gfx::render_task;
@@ -31,17 +31,17 @@ use std::arc::ARC;
 use std::net::url::Url;
 use core::util::replace;
 use util::time::time;
 use std::cell::Cell;
 use layout::traverse::*;
 use comm::*;
 use task::*;
 use core::mutable::Mut;
-use newcss::SelectCtx;
+use newcss::select::SelectCtx;
 
 pub type LayoutTask = comm::Chan<Msg>;
 
 pub enum LayoutQuery {
     ContentBox(Node)
 }
 
 pub type LayoutQueryResponse = Result<LayoutQueryResponse_, ()>;