Skip to content

Commit

Permalink
(ast/values) implement logical properties
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 9, 2024
1 parent 50ad2d2 commit d27f87b
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 531 deletions.
14 changes: 14 additions & 0 deletions crates/hdx_ast/src/css/values/box/impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
pub(crate) use crate::traits::StyleValue;
pub(crate) use hdx_proc_macro::*;

use super::types::LengthPercentage;
use super::{MarginTop, PaddingTop};

// shortcuts for logical properties to resolve to 0
impl MarginTop {
#[allow(non_upper_case_globals)]
pub const Zero: MarginTop = MarginTop::LengthPercentage(LengthPercentage::Zero);
}

impl PaddingTop {
#[allow(non_upper_case_globals)]
pub const Zero: PaddingTop = PaddingTop(LengthPercentage::Zero);
}

#[cfg(test)]
mod tests {
use super::super::*;
Expand Down
28 changes: 28 additions & 0 deletions crates/hdx_ast/src/css/values/logical/impls.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
pub(crate) use crate::traits::StyleValue;
pub(crate) use hdx_proc_macro::*;

#[cfg(test)]
mod tests {
use super::super::*;
use crate::test_helpers::*;

#[test]
fn size_test() {
assert_size!(BlockSize, 12);
assert_size!(InlineSize, 12);
assert_size!(MinBlockSize, 12);
assert_size!(MinInlineSize, 12);
assert_size!(MaxBlockSize, 12);
assert_size!(MaxInlineSize, 12);
assert_size!(MarginBlockStart, 8);
assert_size!(MarginBlockEnd, 8);
assert_size!(MarginInlineStart, 8);
assert_size!(MarginInlineEnd, 8);
assert_size!(MarginBlock, 16);
assert_size!(MarginInline, 16);
assert_size!(PaddingBlockStart, 8);
assert_size!(PaddingBlockEnd, 8);
assert_size!(PaddingInlineStart, 8);
assert_size!(PaddingInlineEnd, 8);
assert_size!(PaddingBlock, 16);
assert_size!(PaddingInline, 16);
}
}
Loading

0 comments on commit d27f87b

Please sign in to comment.