mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Implement style system support for Masonry layout.
This implements support for this CSS Masonry layout proposal: https://github.com/w3c/csswg-drafts/issues/4650 I've intentionally left out a shorthand (place-tracks?) for now until we have a draft CSS spec for this. Differential Revision: https://phabricator.services.mozilla.com/D67061
This commit is contained in:
parent
21d48e00cc
commit
6f58c66589
11 changed files with 295 additions and 30 deletions
|
@ -295,6 +295,18 @@ fn allow_grid_template_subgrids() -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
#[inline]
|
||||
fn allow_grid_template_masonry() -> bool {
|
||||
static_prefs::pref!("layout.css.grid-template-masonry-value.enabled")
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[inline]
|
||||
fn allow_grid_template_masonry() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
impl Parse for GridTemplateComponent<LengthPercentage, Integer> {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
|
@ -319,7 +331,11 @@ impl GridTemplateComponent<LengthPercentage, Integer> {
|
|||
return Ok(GridTemplateComponent::Subgrid(Box::new(t)));
|
||||
}
|
||||
}
|
||||
|
||||
if allow_grid_template_masonry() {
|
||||
if input.try(|i| i.expect_ident_matching("masonry")).is_ok() {
|
||||
return Ok(GridTemplateComponent::Masonry);
|
||||
}
|
||||
}
|
||||
let track_list = TrackList::parse(context, input)?;
|
||||
Ok(GridTemplateComponent::TrackList(Box::new(track_list)))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue