/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Specified types for CSS values related to backgrounds.
usecrate::derives::*; usecrate::parser::{Parse, ParserContext}; usecrate::typed_om::{KeywordValue, ToTyped, TypedValue}; usecrate::values::generics::background::BackgroundSize as GenericBackgroundSize; usecrate::values::specified::length::{
NonNegativeLengthPercentage, NonNegativeLengthPercentageOrAuto,
}; use cssparser::{match_ignore_ascii_case, Parser}; use selectors::parser::SelectorParseErrorKind; use std::fmt::{self, Write}; use style_traits::{CssString, CssWriter, ParseError, StyleParseErrorKind, ToCss}; use thin_vec::ThinVec;
/// A specified value for the `background-size` property. pubtype BackgroundSize = GenericBackgroundSize<NonNegativeLengthPercentage>;
/// One of the keywords for `background-repeat`. #[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
ToTyped,
)] #[allow(missing_docs)] #[value_info(other_values = "repeat-x,repeat-y")] pubenum BackgroundRepeatKeyword {
Repeat,
Space,
Round,
NoRepeat,
}
/// The value of the `background-repeat` property, with `repeat-x` / `repeat-y` /// represented as the combination of `no-repeat` and `repeat` in the opposite /// axes. /// /// https://drafts.csswg.org/css-backgrounds/#the-background-repeat #[derive(
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] pubstruct BackgroundRepeat(pub BackgroundRepeatKeyword, pub BackgroundRepeatKeyword);
/// The specified value of the `background-clip` and `mask-clip` properties. /// /// This is the union of the keywords both properties accept; each property restricts the set it /// actually allows during parsing (see `valid_for_background` / `valid_for_mask`). /// /// https://drafts.csswg.org/css-backgrounds-4/#background-clip /// https://drafts.fxtf.org/css-masking-1/#propdef-mask-clip #[allow(missing_docs)] #[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
ToTyped,
)] #[repr(u8)] pubenum BackgroundClip {
BorderBox,
PaddingBox,
ContentBox, // TODO(emilio): We should expose the svg values in SpecifiedValueInfo or so but only for // mask-clip... Maybe we need a newtype thing, or to rejigger the painting code / storage // further. #[value_info(skip)]
FillBox, #[value_info(skip)]
StrokeBox, #[value_info(skip)]
ViewBox, #[value_info(skip)]
NoClip, // TODO: text and border-area are supposed to combine in backgrounds-4...
Text, #[parse(condition = "background_clip_border_area_enabled")] #[value_info(skip)]
BorderArea,
}
bitflags! { /// Whether a value is valid for background-clip, mask-clip, or both. #[derive(Clone, Copy)] struct ClipValidity: u8 { const BACKGROUND = 1 << 0; const MASK = 1 << 1; const BOTH = Self::BACKGROUND.bits() | Self::MASK.bits();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.