mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
style: Rename page::PageOrientation to page::PageSizeOrientation
The @page rule may contain both 'page-orientation' and 'size' properties. The 'size' property can contain an orientation component which was being represented as 'PageOrientation' prior to this patch. This patch changes that to 'PageSizeOrientation' so that 'PageOrientation' can be used for 'page-orientation' in a subsequent patch. Differential Revision: https://phabricator.services.mozilla.com/D160790
This commit is contained in:
parent
b2ab136cd9
commit
2c1799a8df
5 changed files with 15 additions and 15 deletions
|
@ -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::{
|
||||
|
|
|
@ -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<NonNegativeLength>),
|
||||
/// `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),
|
||||
}),
|
||||
|
|
|
@ -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<S> {
|
|||
/// 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;
|
||||
|
|
|
@ -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::{
|
||||
|
|
|
@ -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<Size2D<NonNegativeLength>>;
|
||||
|
@ -24,12 +24,12 @@ impl Parse for PageSize {
|
|||
// Try to parse as <page-size> [ <orientation> ]
|
||||
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 <orientation> [ <page-size> ]
|
||||
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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue