diff --git a/Cargo.lock b/Cargo.lock
index cd08ec8f173..3f3d372e45c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1483,6 +1483,7 @@ dependencies = [
"servo_config 0.0.1",
"servo_geometry 0.0.1",
"servo_url 0.0.1",
+ "size_of_test 0.0.1",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
@@ -1491,14 +1492,6 @@ dependencies = [
"webrender_api 0.56.1 (git+https://github.com/servo/webrender)",
]
-[[package]]
-name = "layout_tests"
-version = "0.0.1"
-dependencies = [
- "layout 0.0.1",
- "size_of_test 0.0.1",
-]
-
[[package]]
name = "layout_thread"
version = "0.0.1"
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index 60cf29ca3c2..14532a1da52 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -8,6 +8,8 @@ publish = false
[lib]
name = "layout"
path = "lib.rs"
+test = false
+doctest = false
[dependencies]
app_units = "0.6.1"
@@ -46,3 +48,6 @@ style_traits = {path = "../style_traits"}
unicode-bidi = {version = "0.3", features = ["with_serde"]}
unicode-script = {version = "0.1", features = ["harfbuzz"]}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
+
+[dev-dependencies]
+size_of_test = {path = "../size_of_test"}
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 79d72c8471c..807bac242cc 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -140,22 +140,22 @@ pub struct InlineFragmentsConstructionResult {
///
/// The resulting `ConstructionItem` for the outer `span` will be:
///
-/// ```ignore
+/// ```rust,ignore
/// ConstructionItem::InlineFragments(
-/// InlineFragmentsConstructionResult{
+/// InlineFragmentsConstructionResult {
/// splits: linked_list![
-/// InlineBlockSplit{
-/// predecessors: IntermediateInlineFragments{
+/// InlineBlockSplit {
+/// predecessors: IntermediateInlineFragments {
/// fragments: linked_list![A],
-/// absolute_descendents: AbsoluteDescendents{
+/// absolute_descendents: AbsoluteDescendents {
/// descendant_links: vec![]
-/// }
+/// },
/// },
-/// flow: B
+/// flow: B,
/// }
/// ],
/// fragments: linked_list![C],
-/// }
+/// },
/// )
/// ```
#[derive(Clone)]
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index b145aef0ad6..e42871dfa24 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -552,11 +552,13 @@ pub trait MutableOwnedFlowUtils {
/// Sets the flow as the containing block for all absolute descendants that have been marked
/// as having reached their containing block. This is needed in order to handle cases like:
///
- ///
- ///
- ///
- ///
- ///
+ /// ```html
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// ```
fn take_applicable_absolute_descendants(&mut self,
absolute_descendants: &mut AbsoluteDescendants);
}
@@ -742,12 +744,14 @@ pub struct AbsoluteDescendantInfo {
/// Whether the absolute descendant has reached its containing block. This exists so that we
/// can handle cases like the following:
///
- ///
- /// foo
- ///
- /// bar
- ///
- ///
+ /// ```html
+ ///
+ /// foo
+ ///
+ /// bar
+ ///
+ ///
+ /// ```
///
/// When we go to create the `InlineFlow` for the outer `div`, our absolute descendants will
/// be `a` and `b`. At this point, we need a way to distinguish between the two, because the
@@ -1343,11 +1347,13 @@ impl MutableOwnedFlowUtils for FlowRef {
/// Sets the flow as the containing block for all absolute descendants that have been marked
/// as having reached their containing block. This is needed in order to handle cases like:
///
- ///
- ///
- ///
- ///
- ///
+ /// ```html
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// ```
fn take_applicable_absolute_descendants(&mut self,
absolute_descendants: &mut AbsoluteDescendants) {
let mut applicable_absolute_descendants = AbsoluteDescendants::new();
diff --git a/tests/unit/layout/size_of.rs b/components/layout/tests/size_of.rs
similarity index 79%
rename from tests/unit/layout/size_of.rs
rename to components/layout/tests/size_of.rs
index 6b40be0fd86..54b5ef39830 100644
--- a/tests/unit/layout/size_of.rs
+++ b/components/layout/tests/size_of.rs
@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#![cfg(target_pointer_width = "64")]
+
+extern crate layout;
+#[macro_use] extern crate size_of_test;
+
use layout::Fragment;
use layout::SpecificFragmentInfo;
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 21ff295ac11..56cf12124b0 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -231,7 +231,7 @@ class MachCommands(CommandBase):
else:
test_patterns.append(test)
- self_contained_tests = ["gfx", "msg", "selectors"]
+ self_contained_tests = ["gfx", "layout", "msg", "selectors"]
if not packages:
packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit"))) - set(['.DS_Store'])
packages |= set(self_contained_tests)
diff --git a/tests/unit/layout/Cargo.toml b/tests/unit/layout/Cargo.toml
deleted file mode 100644
index d84754912db..00000000000
--- a/tests/unit/layout/Cargo.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[package]
-name = "layout_tests"
-version = "0.0.1"
-authors = ["The Servo Project Developers"]
-license = "MPL-2.0"
-
-[lib]
-name = "layout_tests"
-path = "lib.rs"
-doctest = false
-
-[dependencies]
-layout = {path = "../../../components/layout"}
-size_of_test = {path = "../../../components/size_of_test"}
diff --git a/tests/unit/layout/lib.rs b/tests/unit/layout/lib.rs
deleted file mode 100644
index d9e72841199..00000000000
--- a/tests/unit/layout/lib.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#[cfg(all(test, target_pointer_width = "64"))] extern crate layout;
-#[cfg(all(test, target_pointer_width = "64"))] #[macro_use] extern crate size_of_test;
-#[cfg(all(test, target_pointer_width = "64"))] mod size_of;