servo: Add Comment and Doctype nodes to box_builder
authorBrian Anderson <banderson@mozilla.com>
Thu, 06 Sep 2012 17:21:09 -0700
changeset 361887 2f81afdfc3e1c0dff100ad98763356197bf36dfd
parent 361886 62bd2d0a19fab81bcddf25455461cb9599b5d304
child 361888 ded35c4cc039197a9e429678c1ac0f7b510ed768
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: Add Comment and Doctype nodes to box_builder Source-Repo: https://github.com/servo/servo Source-Revision: e32da820e7eb5e25162c2f9e4f742f4b0e74bb4d
servo/src/servo/layout/box_builder.rs
--- 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, Block, Inline, DisplayNone};
-import dom::base::{ElementData, HTMLDivElement, HTMLImageElement, Element, Text, Node};
+import dom::base::{ElementData, HTMLDivElement, HTMLImageElement, Element, Text, Node, Doctype, Comment};
 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;
@@ -168,17 +168,18 @@ impl Node : PrivBoxBuilder {
                     (_, Some(Inline)) => Some(InlineBox),
                     (_, Some(DisplayNone)) => None,
                     (_, Some(_)) => Some(InlineBox),
                     (_, None) => {
                         fail ~"The specified display style should be a default instead of none"
                     }
                 }
             },
-            _ => fail ~"unstyleable node type encountered"
+          ~Doctype(*)
+          | ~Comment(*) => None
         }
     }
 }
 
 trait BoxBuilder {
     fn construct_boxes() -> Option<@Box>;
 }