mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Add a ValueInfo trait for exposing types needed by devtools.
Most of types just derive it using proc_macro directly. Some of value types need manual impl. In my current plan, this new trait will be used in bug 1434130 to expose values as well. Bug: 1455576 Reviewed-by: emilio MozReview-Commit-ID: LI7fy45VkRw
This commit is contained in:
parent
276fb7e04b
commit
7fe7b2ffb1
66 changed files with 615 additions and 249 deletions
|
@ -16,7 +16,7 @@ bitflags! {
|
|||
/// Constants shared by multiple CSS Box Alignment properties
|
||||
///
|
||||
/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
#[derive(MallocSizeOf, ToComputedValue)]
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue)]
|
||||
pub struct AlignFlags: u8 {
|
||||
// Enumeration stored in the lower 5 bits:
|
||||
/// 'auto'
|
||||
|
@ -135,7 +135,8 @@ pub enum AxisDirection {
|
|||
/// Shared value for the `align-content` and `justify-content` properties.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#content-distribution>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct ContentDistribution {
|
||||
primary: AlignFlags,
|
||||
|
@ -232,7 +233,8 @@ impl ContentDistribution {
|
|||
/// Value for the `align-content` property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-content>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for AlignContent {
|
||||
|
@ -264,7 +266,8 @@ impl From<AlignContent> for u16 {
|
|||
/// Value for the `justify-content` property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-content>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct JustifyContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for JustifyContent {
|
||||
|
@ -294,7 +297,8 @@ impl From<JustifyContent> for u16 {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct SelfAlignment(pub AlignFlags);
|
||||
|
||||
impl SelfAlignment {
|
||||
|
@ -344,7 +348,8 @@ impl SelfAlignment {
|
|||
/// The specified value of the align-self property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-align-self>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignSelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for AlignSelf {
|
||||
|
@ -374,7 +379,8 @@ impl From<AlignSelf> for u8 {
|
|||
/// The specified value of the justify-self property.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#propdef-justify-self>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct JustifySelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for JustifySelf {
|
||||
|
@ -404,7 +410,8 @@ impl From<JustifySelf> for u8 {
|
|||
/// Value of the `align-items` property
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignItems(pub AlignFlags);
|
||||
|
||||
impl AlignItems {
|
||||
|
@ -443,7 +450,8 @@ impl Parse for AlignItems {
|
|||
/// Value of the `justify-items` property
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#justify-items-property>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub struct JustifyItems(pub AlignFlags);
|
||||
|
||||
impl JustifyItems {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue