mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Remove the paper size variant of GenericPageSize and add an implied default to the paper size and orientation variant
Differential Revision: https://phabricator.services.mozilla.com/D119915
This commit is contained in:
parent
45d6e64d51
commit
c2a50c92fa
3 changed files with 21 additions and 20 deletions
|
@ -23,15 +23,15 @@ impl Parse for PageSize {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
// Try to parse as <page-size> [ <orientation> ]
|
||||
if let Ok(paper_size) = input.try_parse(PaperSize::parse) {
|
||||
if let Ok(orientation) = input.try_parse(Orientation::parse) {
|
||||
return Ok(PageSize::PaperSizeAndOrientation(paper_size, orientation));
|
||||
}
|
||||
return Ok(PageSize::PaperSize(paper_size));
|
||||
let orientation = input
|
||||
.try_parse(Orientation::parse)
|
||||
.unwrap_or(Orientation::Portrait);
|
||||
return Ok(PageSize::PaperSize(paper_size, orientation));
|
||||
}
|
||||
// Try to parse as <orientation> [ <page-size> ]
|
||||
if let Ok(orientation) = input.try_parse(Orientation::parse) {
|
||||
if let Ok(paper_size) = input.try_parse(PaperSize::parse) {
|
||||
return Ok(PageSize::PaperSizeAndOrientation(paper_size, orientation));
|
||||
return Ok(PageSize::PaperSize(paper_size, orientation));
|
||||
}
|
||||
return Ok(PageSize::Orientation(orientation));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue