-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a bunch more fixes that I can't be bothered to separate into individu…
…al commits
- Loading branch information
Showing
15 changed files
with
327 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub type MaxHeight = super::super::Todo; | ||
pub type MaxHeight = super::MaxWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,50 @@ | ||
pub type MaxWidth = super::super::Todo; | ||
#[cfg(feature = "serde")] | ||
use serde::Serialize; | ||
|
||
use super::super::units::LengthPercentage; | ||
use crate::{Parsable, Writable}; | ||
|
||
// https://drafts.csswg.org/css-sizing-4/#sizing-values | ||
#[derive(Parsable, Writable, Default, Debug, PartialEq, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "kebab-case"))] | ||
pub enum MaxWidth { | ||
#[default] | ||
None, // atom!("none") | ||
MinContent, // atom!("min-content") | ||
MaxContent, // atom!("max-content") TODO: `intrinsic` non standard | ||
// https://drafts.csswg.org/css-sizing-4/#sizing-values | ||
Stretch, // atom!("stretch") TODO: -webkit-fill-available, -moz-available | ||
FitContent, // atom!("fit-content") | ||
Contain, // atom!("contain") | ||
|
||
#[parsable(DimensionOrZero, FromToken, Check::Positive)] | ||
LengthPercentage(LengthPercentage), | ||
#[parsable(Function, FromToken, Check::Positive, atom = "fit-content")] | ||
#[writable(as_function = "fit-content")] | ||
FitContentFunction(LengthPercentage), | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use oxc_allocator::Allocator; | ||
|
||
use super::*; | ||
use crate::test_helpers::test_write; | ||
|
||
#[test] | ||
fn size_test() { | ||
use std::mem::size_of; | ||
assert_eq!(size_of::<MaxWidth>(), 12); | ||
} | ||
|
||
#[test] | ||
fn test_writes() { | ||
let allocator = Allocator::default(); | ||
test_write::<MaxWidth>(&allocator, "0", "0"); | ||
test_write::<MaxWidth>(&allocator, "1px", "1px"); | ||
test_write::<MaxWidth>(&allocator, "none", "none"); | ||
test_write::<MaxWidth>(&allocator, "fit-content", "fit-content"); | ||
test_write::<MaxWidth>(&allocator, "fit-content(20rem)", "fit-content(20rem)"); | ||
test_write::<MaxWidth>(&allocator, "fit-content(0)", "fit-content(0)"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub type MinHeight = super::super::Todo; | ||
pub type MinHeight = super::MaxWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub type MinWidth = super::super::Todo; | ||
pub type MinWidth = super::MaxWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.