servo: Get rendering back to parity with master
authorPatrick Walton <pcwalton@mimiga.net>
Thu, 28 Feb 2013 15:38:34 -0800
changeset 380004 57f6af9c97c0901e3e59d93b92af98f5b8a8b22a
parent 380003 66cf21ddfa73149771a6e341b9c601f08528ea5d
child 380005 db33cf0fc0fab119319be2a9c901617936e1a993
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Get rendering back to parity with master Source-Repo: https://github.com/servo/servo Source-Revision: 416e8703853293d4297559bccac30294a1f14ec8
servo/src/servo-gfx/display_list.rs
servo/src/servo/dom/node.rs
servo/src/servo/layout/box.rs
servo/src/servo/layout/box_builder.rs
servo/src/servo/layout/display_list_builder.rs
--- a/servo/src/servo-gfx/display_list.rs
+++ b/servo/src/servo-gfx/display_list.rs
@@ -39,30 +39,34 @@ impl DisplayItem {
             Text(ref d, _, _, _) => d,
             Image(ref d, _) => d,
             Border(ref d, _, _) => d
         }
     }
     
     fn draw_into_context(&self, ctx: &RenderContext) {
         match self {
-            &SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color),
+            &SolidColor(_, color) => {
+                ctx.draw_solid_color(&self.d().bounds, color)
+            }
             &Text(_, ref run, ref range, color) => {
                 debug!("drawing text at %?", self.d().bounds);
                 let new_run = @run.deserialize(ctx.font_ctx);
                 let font = new_run.font;
                 let origin = self.d().bounds.origin;
                 let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
                 font.draw_text_into_context(ctx, new_run, range, baseline_origin, color);
             },
             &Image(_, ref img) => {
                 debug!("drawing image at %?", self.d().bounds);
                 ctx.draw_image(self.d().bounds, clone_arc(img));
             }
-            &Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color),
+            &Border(_, width, color) => {
+                ctx.draw_border(&self.d().bounds, width, color)
+            }
         }
 
         debug!("%?", {
         ctx.draw_border(&self.d().bounds, Au::from_px(1), rgb(150, 150, 150));
         () });
     }
 
     static pure fn new_SolidColor(bounds: &Rect<Au>, color: Color) -> DisplayItem {
--- a/servo/src/servo/dom/node.rs
+++ b/servo/src/servo/dom/node.rs
@@ -119,17 +119,17 @@ impl Comment {
 pub struct Text {
     parent: Node,
     text: ~str,
 }
 
 impl Text {
     static pub fn new(text: ~str) -> Text {
         Text {
-            parent: Node::new(CommentNodeTypeId),
+            parent: Node::new(TextNodeTypeId),
             text: text
         }
     }
 }
 
 impl AbstractNode {
     //
     // Convenience accessors
@@ -181,16 +181,17 @@ impl AbstractNode {
                         do last_child.with_mut_node |last_child_n| {
                             assert last_child_n.next_sibling.is_none();
                             last_child_n.next_sibling = Some(child);
                         }
                     }
                 }
 
                 child_n.prev_sibling = parent_n.last_child;
+                parent_n.last_child = Some(child);
             }
         }
     }
 
     //
     // Tree traversal
     //
     // FIXME: Fold this into util::tree.
--- a/servo/src/servo/layout/box.rs
+++ b/servo/src/servo/layout/box.rs
@@ -425,18 +425,17 @@ impl RenderBox  {
                         
                         list.append_item(~DisplayItem::new_Border(&baseline,
                                                                   Au::from_px(1),
                                                                   rgb(0, 200, 0).to_gfx_color()));
                         ; ()});
                 }
             },
             // TODO: items for background, border, outline
-            @GenericBox(_) => {
-            },
+            @GenericBox(_) => {}
             @ImageBox(_, ref i) => {
                 match i.get_image() {
                     Some(image) => {
                         do list.borrow_mut |list| {
                             debug!("(building display list) building image box");
                             list.append_item(~DisplayItem::new_Image(&abs_box_bounds,
                                                                      arc::clone(&image)));
                         }
--- a/servo/src/servo/layout/box_builder.rs
+++ b/servo/src/servo/layout/box_builder.rs
@@ -275,18 +275,18 @@ impl BuilderContext {
     }
 }
 
 impl LayoutTreeBuilder {
     /* Debug-only ids */
     fn next_box_id(&self) -> int { self.next_bid += 1; self.next_bid }
     fn next_flow_id(&self) -> int { self.next_cid += 1; self.next_cid }
 
-    /** Creates necessary box(es) and flow context(s) for the current DOM node,
-    and recurses on its children. */
+    /// Creates necessary box(es) and flow context(s) for the current DOM node,
+    /// and recurses on its children.
     fn construct_recursively(&self,
                              layout_ctx: &LayoutContext,
                              cur_node: AbstractNode,
                              parent_ctx: &BuilderContext) {
         debug!("Considering node: %s", cur_node.debug_str());
 
         let this_ctx = match parent_ctx.containing_context_for_node(cur_node, self) {
             Some(ctx) => ctx,
--- a/servo/src/servo/layout/display_list_builder.rs
+++ b/servo/src/servo/layout/display_list_builder.rs
@@ -69,8 +69,9 @@ impl FlowDisplayListBuilderMethods for F
         if dirty.intersects(&abs_flow_bounds) {
             debug!("build_display_list_for_child: intersected. recursing into child flow...");
             child_flow.build_display_list_recurse(builder, dirty, &adj_offset, list);
         } else {
             debug!("build_display_list_for_child: Did not intersect...");
         }
     }
 }
+