Merge layout and layout_tests

This commit is contained in:
Anthony Ramine 2018-01-19 12:12:47 +01:00
parent c2ed7c9632
commit a311e0f569
8 changed files with 42 additions and 54 deletions

View file

@ -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"}

View file

@ -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)]

View file

@ -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:
///
/// <div>
/// <span style="position: relative">
/// <span style="position: absolute; ..."></span>
/// </span>
/// </div>
/// ```html
/// <div>
/// <span style="position: relative">
/// <span style="position: absolute; ..."></span>
/// </span>
/// </div>
/// ```
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:
///
/// <div>
/// <span id=a style="position: absolute; ...">foo</span>
/// <span style="position: relative">
/// <span id=b style="position: absolute; ...">bar</span>
/// </span>
/// </div>
/// ```html
/// <div>
/// <span id=a style="position: absolute; ...">foo</span>
/// <span style="position: relative">
/// <span id=b style="position: absolute; ...">bar</span>
/// </span>
/// </div>
/// ```
///
/// 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:
///
/// <div>
/// <span style="position: relative">
/// <span style="position: absolute; ..."></span>
/// </span>
/// </div>
/// ```html
/// <div>
/// <span style="position: relative">
/// <span style="position: absolute; ..."></span>
/// </span>
/// </div>
/// ```
fn take_applicable_absolute_descendants(&mut self,
absolute_descendants: &mut AbsoluteDescendants) {
let mut applicable_absolute_descendants = AbsoluteDescendants::new();

View file

@ -0,0 +1,14 @@
/* 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(target_pointer_width = "64")]
extern crate layout;
#[macro_use] extern crate size_of_test;
use layout::Fragment;
use layout::SpecificFragmentInfo;
size_of_test!(test_size_of_fragment, Fragment, 160);
size_of_test!(test_size_of_specific_fragment_info, SpecificFragmentInfo, 24);