diff --git a/components/style/properties/build.py b/components/style/properties/build.py index 97ad10408ea..6df38fcefe3 100644 --- a/components/style/properties/build.py +++ b/components/style/properties/build.py @@ -37,6 +37,7 @@ STYLE_STRUCT_LIST = [ "list", "margin", "outline", + "page", "padding", "position", "svg", diff --git a/components/style/properties/counted_unknown_properties.py b/components/style/properties/counted_unknown_properties.py index 047d129a2ff..577547d099d 100644 --- a/components/style/properties/counted_unknown_properties.py +++ b/components/style/properties/counted_unknown_properties.py @@ -19,7 +19,6 @@ COUNTED_UNKNOWN_PROPERTIES = [ "text-size-adjust", "-webkit-font-feature-settings", "-webkit-user-drag", - "size", "-webkit-clip-path", "orphans", "widows", diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 9bb13eb62b0..7a864c06d27 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -781,6 +781,9 @@ fn static_assert() { % endfor +<%self:impl_trait style_struct_name="Page"> + + <% skip_position_longhands = " ".join(x.ident for x in SIDES) %> <%self:impl_trait style_struct_name="Position" skip_longhands="${skip_position_longhands} diff --git a/components/style/properties/longhands/page.mako.rs b/components/style/properties/longhands/page.mako.rs new file mode 100644 index 00000000000..298456cb753 --- /dev/null +++ b/components/style/properties/longhands/page.mako.rs @@ -0,0 +1,21 @@ +/* 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/. */ + +<%namespace name="helpers" file="/helpers.mako.rs" /> +<% from data import PAGE_RULE %> + +<% data.new_style_struct("Page", inherited=False) %> + +${helpers.predefined_type( + "size", + "PageSize", + "computed::PageSize::auto()", + engines="gecko", + gecko_pref="layout.css.page-size.enabled", + initial_specified_value="specified::PageSize::auto()", + spec="https://drafts.csswg.org/css-page-3/#page-size-prop", + boxed=True, + animation_value_type="none", + rule_types_allowed=PAGE_RULE, +)} diff --git a/components/style/values/computed/page.rs b/components/style/values/computed/page.rs index 4dd8804596e..d8ef03c1f6d 100644 --- a/components/style/values/computed/page.rs +++ b/components/style/values/computed/page.rs @@ -11,4 +11,4 @@ use crate::values::generics::size::Size2D; pub use generics::page::Orientation; pub use generics::page::PaperSize; /// Computed value of the @page size descriptor -pub type PageSize = generics::page::PageSize>; +pub type PageSize = generics::page::GenericPageSize>; diff --git a/components/style/values/generics/page.rs b/components/style/values/generics/page.rs index fc771062333..35ffee7b97e 100644 --- a/components/style/values/generics/page.rs +++ b/components/style/values/generics/page.rs @@ -86,7 +86,7 @@ pub enum Orientation { ToShmem, )] #[repr(C, u8)] -pub enum PageSize { +pub enum GenericPageSize { /// Page dimensions. Size(S), /// Paper size with no orientation. @@ -99,6 +99,8 @@ pub enum PageSize { Auto, } +pub use self::GenericPageSize as PageSize; + impl PageSize { /// `auto` value. #[inline]