mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make grid-template-areas animatable
This commit is contained in:
parent
dc244ad9e9
commit
4dcc2d1c9d
2 changed files with 46 additions and 3 deletions
|
@ -1726,6 +1726,49 @@ fn static_assert() {
|
|||
pub fn reset_grid_template_areas(&mut self, other: &Self) {
|
||||
self.copy_grid_template_areas_from(other)
|
||||
}
|
||||
|
||||
pub fn clone_grid_template_areas(&self) -> longhands::grid_template_areas::computed_value::T {
|
||||
use properties::longhands::grid_template_areas::{NamedArea, TemplateAreas};
|
||||
use std::ops::Range;
|
||||
use values::None_;
|
||||
|
||||
if self.gecko.mGridTemplateAreas.mRawPtr.is_null() {
|
||||
return Either::Second(None_);
|
||||
}
|
||||
|
||||
let gecko_grid_template_areas = self.gecko.mGridTemplateAreas.mRawPtr;
|
||||
let areas = unsafe {
|
||||
let vec: Vec<NamedArea> =
|
||||
(*gecko_grid_template_areas).mNamedAreas.iter().map(|gecko_name_area| {
|
||||
let name = gecko_name_area.mName.to_string().into_boxed_str();
|
||||
let rows = Range {
|
||||
start: gecko_name_area.mRowStart,
|
||||
end: gecko_name_area.mRowEnd
|
||||
};
|
||||
let columns = Range {
|
||||
start: gecko_name_area.mColumnStart,
|
||||
end: gecko_name_area.mColumnEnd
|
||||
};
|
||||
NamedArea{ name, rows, columns }
|
||||
}).collect();
|
||||
vec.into_boxed_slice()
|
||||
};
|
||||
|
||||
let strings = unsafe {
|
||||
let vec: Vec<Box<str>> =
|
||||
(*gecko_grid_template_areas).mTemplates.iter().map(|gecko_template| {
|
||||
gecko_template.to_string().into_boxed_str()
|
||||
}).collect();
|
||||
vec.into_boxed_slice()
|
||||
};
|
||||
|
||||
let width = unsafe {
|
||||
(*gecko_grid_template_areas).mNColumns
|
||||
};
|
||||
|
||||
Either::First(TemplateAreas{ areas, strings, width })
|
||||
}
|
||||
|
||||
</%self:impl_trait>
|
||||
|
||||
<% skip_outline_longhands = " ".join("outline-style outline-width".split() +
|
||||
|
|
|
@ -416,7 +416,7 @@ ${helpers.predefined_type("object-position",
|
|||
<%helpers:longhand name="grid-template-areas"
|
||||
spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-areas"
|
||||
products="gecko"
|
||||
animation_value_type="none"
|
||||
animation_value_type="discrete"
|
||||
disable_when_testing="True"
|
||||
boxed="True">
|
||||
use std::collections::HashMap;
|
||||
|
@ -442,14 +442,14 @@ ${helpers.predefined_type("object-position",
|
|||
SpecifiedValue::parse(context, input)
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct TemplateAreas {
|
||||
pub areas: Box<[NamedArea]>,
|
||||
pub strings: Box<[Box<str>]>,
|
||||
pub width: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct NamedArea {
|
||||
pub name: Box<str>,
|
||||
pub rows: Range<u32>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue