servo/components/layout_2020/lib.rs
Martin Robinson 585a25a212
Use std::cell::OnceCell and remove mitochondria dependency (#30207)
`OnceCell` is now part of the standard library and we'll be able to use
it once we upgrade rust. For now we can use the version that's shipped
behind a feature flag in rust. This removes a dependency on one crate.
2023-08-25 14:09:55 +00:00

59 lines
1.3 KiB
Rust

/* 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 https://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)]
#![feature(once_cell)]
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde;
mod cell;
pub mod context;
pub mod display_list;
pub mod dom;
mod dom_traversal;
mod flexbox;
pub mod flow;
mod formatting_contexts;
mod fragment_tree;
pub mod geom;
#[macro_use]
pub mod layout_debug;
mod lists;
mod positioned;
pub mod query;
mod replaced;
mod sizing;
mod style_ext;
pub mod traversal;
pub use flow::BoxTree;
pub use fragment_tree::FragmentTree;
use crate::geom::flow_relative::Vec2;
use style::properties::ComputedValues;
use style::values::computed::{Length, LengthOrAuto};
pub struct ContainingBlock<'a> {
inline_size: Length,
block_size: LengthOrAuto,
style: &'a ComputedValues,
}
struct DefiniteContainingBlock<'a> {
size: Vec2<Length>,
style: &'a ComputedValues,
}
impl<'a> From<&'_ DefiniteContainingBlock<'a>> for ContainingBlock<'a> {
fn from(definite: &DefiniteContainingBlock<'a>) -> Self {
ContainingBlock {
inline_size: definite.size.inline,
block_size: LengthOrAuto::LengthPercentage(definite.size.block),
style: definite.style,
}
}
}