diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index a38bf049ad0..1d40275db80 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -81,7 +81,7 @@ pub use self::list::ListStyleType; pub use self::list::Quotes; pub use self::motion::{OffsetPath, OffsetRotate}; pub use self::outline::OutlineStyle; -pub use self::page::{PageName, PageOrientation, PageSize, PaperSize}; +pub use self::page::{PageName, PageSize, PageSizeOrientation, PaperSize}; pub use self::percentage::{NonNegativePercentage, Percentage}; pub use self::position::AspectRatio; pub use self::position::{ diff --git a/components/style/values/computed/page.rs b/components/style/values/computed/page.rs index 5daf6bbcde8..d54fca329b4 100644 --- a/components/style/values/computed/page.rs +++ b/components/style/values/computed/page.rs @@ -11,7 +11,7 @@ use crate::values::generics::size::Size2D; use crate::values::specified::page as specified; pub use generics::page::GenericPageSize; -pub use generics::page::PageOrientation; +pub use generics::page::PageSizeOrientation; pub use generics::page::PaperSize; pub use specified::PageName; @@ -26,7 +26,7 @@ pub enum PageSize { /// Specified size, paper size, or paper size and orientation. Size(Size2D), /// `landscape` or `portrait` value, no specified size. - Orientation(PageOrientation), + Orientation(PageSizeOrientation), /// `auto` value Auto, } @@ -37,11 +37,11 @@ impl ToComputedValue for specified::PageSize { fn to_computed_value(&self, ctx: &Context) -> Self::ComputedValue { match &*self { Self::Size(s) => PageSize::Size(s.to_computed_value(ctx)), - Self::PaperSize(p, PageOrientation::Landscape) => PageSize::Size(Size2D { + Self::PaperSize(p, PageSizeOrientation::Landscape) => PageSize::Size(Size2D { width: p.long_edge().to_computed_value(ctx), height: p.short_edge().to_computed_value(ctx), }), - Self::PaperSize(p, PageOrientation::Portrait) => PageSize::Size(Size2D { + Self::PaperSize(p, PageSizeOrientation::Portrait) => PageSize::Size(Size2D { width: p.short_edge().to_computed_value(ctx), height: p.long_edge().to_computed_value(ctx), }), diff --git a/components/style/values/generics/page.rs b/components/style/values/generics/page.rs index efb67e0812d..ed81c9e5349 100644 --- a/components/style/values/generics/page.rs +++ b/components/style/values/generics/page.rs @@ -87,7 +87,7 @@ impl PaperSize { ToShmem, )] #[repr(u8)] -pub enum PageOrientation { +pub enum PageSizeOrientation { /// Portrait orientation Portrait, /// Landscape orientation @@ -95,8 +95,8 @@ pub enum PageOrientation { } #[inline] -fn is_portrait(orientation: &PageOrientation) -> bool { - *orientation == PageOrientation::Portrait +fn is_portrait(orientation: &PageSizeOrientation) -> bool { + *orientation == PageSizeOrientation::Portrait } /// Page size property @@ -110,9 +110,9 @@ pub enum GenericPageSize { /// Page dimensions. Size(S), /// An orientation with no size. - Orientation(PageOrientation), + Orientation(PageSizeOrientation), /// Paper size by name - PaperSize(PaperSize, #[css(skip_if = "is_portrait")] PageOrientation), + PaperSize(PaperSize, #[css(skip_if = "is_portrait")] PageSizeOrientation), } pub use self::GenericPageSize as PageSize; diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 7fa2c57549a..9dbf0ec3852 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -72,7 +72,7 @@ pub use self::list::ListStyleType; pub use self::list::Quotes; pub use self::motion::{OffsetPath, OffsetRotate}; pub use self::outline::OutlineStyle; -pub use self::page::{PageName, PageOrientation, PageSize, PaperSize}; +pub use self::page::{PageName, PageSize, PageSizeOrientation, PaperSize}; pub use self::percentage::{NonNegativePercentage, Percentage}; pub use self::position::AspectRatio; pub use self::position::{ diff --git a/components/style/values/specified/page.rs b/components/style/values/specified/page.rs index e660b435327..f8727a9c1d3 100644 --- a/components/style/values/specified/page.rs +++ b/components/style/values/specified/page.rs @@ -11,7 +11,7 @@ use crate::values::{generics, CustomIdent}; use cssparser::Parser; use style_traits::ParseError; -pub use generics::page::PageOrientation; +pub use generics::page::PageSizeOrientation; pub use generics::page::PaperSize; /// Specified value of the @page size descriptor pub type PageSize = generics::page::PageSize>; @@ -24,12 +24,12 @@ impl Parse for PageSize { // Try to parse as [ ] if let Ok(paper_size) = input.try_parse(PaperSize::parse) { let orientation = input - .try_parse(PageOrientation::parse) - .unwrap_or(PageOrientation::Portrait); + .try_parse(PageSizeOrientation::parse) + .unwrap_or(PageSizeOrientation::Portrait); return Ok(PageSize::PaperSize(paper_size, orientation)); } // Try to parse as [ ] - if let Ok(orientation) = input.try_parse(PageOrientation::parse) { + if let Ok(orientation) = input.try_parse(PageSizeOrientation::parse) { if let Ok(paper_size) = input.try_parse(PaperSize::parse) { return Ok(PageSize::PaperSize(paper_size, orientation)); }