mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: [refactor] Migrate NS_STYLE_MASONRY_* defines
Differential Revision: https://phabricator.services.mozilla.com/D164422
This commit is contained in:
parent
281ae0748f
commit
dc225e0b2f
2 changed files with 5 additions and 32 deletions
|
@ -76,8 +76,9 @@ pub use self::page::{PageName, PageSize, PageSizeOrientation, PaperSize};
|
|||
pub use self::percentage::{NonNegativePercentage, Percentage};
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{
|
||||
GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto,
|
||||
GridAutoFlow, GridTemplateAreas, Position, PositionOrAuto,
|
||||
};
|
||||
pub use self::position::{MasonryAutoFlow, MasonryPlacement, MasonryItemOrder};
|
||||
pub use self::position::{PositionComponent, ZIndex};
|
||||
pub use self::ratio::Ratio;
|
||||
pub use self::rect::NonNegativeLengthOrNumberRect;
|
||||
|
|
|
@ -391,6 +391,7 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
|
@ -412,6 +413,7 @@ pub enum MasonryPlacement {
|
|||
Next,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
|
@ -446,6 +448,7 @@ pub enum MasonryItemOrder {
|
|||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(C)]
|
||||
/// Controls how the Masonry layout algorithm works
|
||||
/// specifying exactly how auto-placed items get flowed in the masonry axis.
|
||||
pub struct MasonryAutoFlow {
|
||||
|
@ -525,37 +528,6 @@ impl Parse for MasonryAutoFlow {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl From<u8> for MasonryAutoFlow {
|
||||
fn from(bits: u8) -> MasonryAutoFlow {
|
||||
use crate::gecko_bindings::structs;
|
||||
let mut value = MasonryAutoFlow::initial();
|
||||
if bits & structs::NS_STYLE_MASONRY_PLACEMENT_PACK as u8 == 0 {
|
||||
value.placement = MasonryPlacement::Next;
|
||||
}
|
||||
if bits & structs::NS_STYLE_MASONRY_ORDER_DEFINITE_FIRST as u8 == 0 {
|
||||
value.order = MasonryItemOrder::Ordered;
|
||||
}
|
||||
value
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl From<MasonryAutoFlow> for u8 {
|
||||
fn from(v: MasonryAutoFlow) -> u8 {
|
||||
use crate::gecko_bindings::structs;
|
||||
|
||||
let mut result: u8 = 0;
|
||||
if v.placement == MasonryPlacement::Pack {
|
||||
result |= structs::NS_STYLE_MASONRY_PLACEMENT_PACK as u8;
|
||||
}
|
||||
if v.order == MasonryItemOrder::DefiniteFirst {
|
||||
result |= structs::NS_STYLE_MASONRY_ORDER_DEFINITE_FIRST as u8;
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Can be derived with some care.
|
||||
impl Parse for GridAutoFlow {
|
||||
/// [ row | column ] || dense
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue