mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
### Changes made This implements named grid lines (line names in `grid-template-*`), named grid areas (`grid-template-areas`), and the ability to target those using `grid-{row,column}-{start,end}`. It also includes a bunch of miscelaneous fixes for `repeat(auto-fill | auto-fit, ...)` syntax as that interacts with the specification of line names. The actual layout implementation is in Taffy. The bulk of this PR is updating Servo to translate (CSS Grid-related) Stylo types into Taffy types using a new iterator-based API which uses iterators and lazy translation for efficiency (which is more important now that we're dealing with string data, even though they're `Atom`s). ### Testing This functionality has lots of WPT tests. It fixes some seemingly random CSS Grid tests that use named lines/areas even though that's not what they're testing. ### Screenshots wikipedia.org <img width="1624" height="1056" alt="Screenshot 2025-07-27 at 20 03 16" src="https://github.com/user-attachments/assets/2c50b96f-ae36-4405-ac48-b771bfdcb515" /> bbc.co.uk: <img width="1624" height="1056" alt="Screenshot 2025-07-27 at 20 32 57" src="https://github.com/user-attachments/assets/ba84e211-65d2-4411-95fb-7b9b91bea31c" /> theguardian.com: <img width="1624" height="1056" alt="Screenshot 2025-07-27 at 20 33 29" src="https://github.com/user-attachments/assets/e85daaa6-5fb0-45d4-b9ec-b22b38b087ec" /> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
41 lines
2.1 KiB
Rust
41 lines
2.1 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/. */
|
|
|
|
//! Conversion functions from Stylo types to Taffy types
|
|
|
|
mod convert;
|
|
mod wrapper;
|
|
|
|
pub(crate) use wrapper::TaffyStyloStyle;
|
|
|
|
/// Private module of type aliases so we can refer to stylo types with nicer names
|
|
mod stylo {
|
|
pub(crate) use style::properties::generated::longhands::box_sizing::computed_value::T as BoxSizing;
|
|
pub(crate) use style::properties::longhands::aspect_ratio::computed_value::T as AspectRatio;
|
|
pub(crate) use style::properties::longhands::position::computed_value::T as Position;
|
|
pub(crate) use style::values::computed::length_percentage::Unpacked as UnpackedLengthPercentage;
|
|
pub(crate) use style::values::computed::{LengthPercentage, Percentage};
|
|
pub(crate) use style::values::generics::NonNegative;
|
|
pub(crate) use style::values::generics::length::{
|
|
GenericLengthPercentageOrNormal, GenericMargin, GenericMaxSize, GenericSize,
|
|
};
|
|
pub(crate) use style::values::generics::position::{Inset as GenericInset, PreferredRatio};
|
|
pub(crate) use style::values::specified::align::{AlignFlags, ContentDistribution};
|
|
pub(crate) use style::values::specified::box_::{
|
|
Display, DisplayInside, DisplayOutside, Overflow,
|
|
};
|
|
pub(crate) type MarginVal = GenericMargin<LengthPercentage>;
|
|
pub(crate) type InsetVal = GenericInset<Percentage, LengthPercentage>;
|
|
pub(crate) type Size = GenericSize<NonNegative<LengthPercentage>>;
|
|
pub(crate) type MaxSize = GenericMaxSize<NonNegative<LengthPercentage>>;
|
|
|
|
pub(crate) type Gap = GenericLengthPercentageOrNormal<NonNegative<LengthPercentage>>;
|
|
|
|
pub(crate) use style::computed_values::grid_auto_flow::T as GridAutoFlow;
|
|
pub(crate) use style::values::computed::GridLine;
|
|
pub(crate) use style::values::generics::grid::{
|
|
RepeatCount, TrackBreadth, TrackListValue, TrackSize,
|
|
};
|
|
pub(crate) use style::values::specified::GenericGridTemplateComponent;
|
|
}
|