/* 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 box properties.
usecrate::parser::{Parse, ParserContext}; #[cfg(feature = "gecko")] usecrate::properties::{LonghandId, PropertyDeclarationId, PropertyId}; usecrate::values::generics::box_::{
GenericContainIntrinsicSize, GenericLineClamp, GenericPerspective, GenericVerticalAlign,
VerticalAlignKeyword,
}; usecrate::values::specified::length::{LengthPercentage, NonNegativeLength}; usecrate::values::specified::{AllowQuirks, Integer, NonNegativeNumberOrPercentage}; usecrate::values::CustomIdent; use cssparser::Parser; use num_traits::FromPrimitive; use std::fmt::{self, Write}; use style_traits::{CssWriter, KeywordsCollectFn, ParseError}; use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
/// Gecko-only impl block for Display (shared stuff later in this file): #[allow(missing_docs)] #[allow(non_upper_case_globals)] impl Display { // Our u16 bits are used as follows: LOOOOOOOIIIIIIII pubconst LIST_ITEM_MASK: u16 = 0b1000000000000000; pubconst OUTSIDE_MASK: u16 = 0b0111111100000000; pubconst INSIDE_MASK: u16 = 0b0000000011111111; pubconst OUTSIDE_SHIFT: u16 = 8;
/// https://drafts.csswg.org/css-display/#the-display-properties /// ::new() inlined so cbindgen can use it pubconst None: Self = Self(((DisplayOutside::None as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::None as u16); pubconst Contents: Self = Self(
((DisplayOutside::None as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Contents as u16,
); pubconst Inline: Self = Self(((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Flow as u16); pubconst InlineBlock: Self = Self(
((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::FlowRoot as u16,
); pubconst Block: Self = Self(((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Flow as u16); #[cfg(feature = "gecko")] pubconst FlowRoot: Self = Self(
((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::FlowRoot as u16,
); pubconst Flex: Self = Self(((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Flex as u16); pubconst InlineFlex: Self = Self(((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Flex as u16); pubconst Grid: Self = Self(((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Grid as u16); pubconst InlineGrid: Self = Self(((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Grid as u16); pubconst Table: Self = Self(((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Table as u16); pubconst InlineTable: Self = Self(
((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Table as u16,
); pubconst TableCaption: Self = Self(
((DisplayOutside::TableCaption as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Flow as u16,
); #[cfg(feature = "gecko")] pubconst Ruby: Self = Self(((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::Ruby as u16); #[cfg(feature = "gecko")] pubconst WebkitBox: Self = Self(
((DisplayOutside::Block as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::WebkitBox as u16,
); #[cfg(feature = "gecko")] pubconst WebkitInlineBox: Self = Self(
((DisplayOutside::Inline as u16) << Self::OUTSIDE_SHIFT) | DisplayInside::WebkitBox as u16,
);
// Internal table boxes.
pubconst TableRowGroup: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableRowGroup as u16,
); pubconst TableHeaderGroup: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableHeaderGroup as u16,
); pubconst TableFooterGroup: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableFooterGroup as u16,
); pubconst TableColumn: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableColumn as u16,
); pubconst TableColumnGroup: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableColumnGroup as u16,
); pubconst TableRow: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableRow as u16,
); pubconst TableCell: Self = Self(
((DisplayOutside::InternalTable as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::TableCell as u16,
);
/// Internal ruby boxes. #[cfg(feature = "gecko")] pubconst RubyBase: Self = Self(
((DisplayOutside::InternalRuby as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::RubyBase as u16,
); #[cfg(feature = "gecko")] pubconst RubyBaseContainer: Self = Self(
((DisplayOutside::InternalRuby as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::RubyBaseContainer as u16,
); #[cfg(feature = "gecko")] pubconst RubyText: Self = Self(
((DisplayOutside::InternalRuby as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::RubyText as u16,
); #[cfg(feature = "gecko")] pubconst RubyTextContainer: Self = Self(
((DisplayOutside::InternalRuby as u16) << Self::OUTSIDE_SHIFT) |
DisplayInside::RubyTextContainer as u16,
);
/// Make a raw display value from <display-outside> and <display-inside> values. #[inline] constfn new(outside: DisplayOutside, inside: DisplayInside) -> Self { Self((outside as u16) << Self::OUTSIDE_SHIFT | inside as u16)
}
/// Make a display enum value from <display-outside> and <display-inside> values. #[inline] fn from3(outside: DisplayOutside, inside: DisplayInside, list_item: bool) -> Self { let v = Self::new(outside, inside); if !list_item { return v;
} Self(v.0 | Self::LIST_ITEM_MASK)
}
/// Accessor for the <display-inside> value. #[inline] pubfn inside(&self) -> DisplayInside {
DisplayInside::from_u16(self.0 & Self::INSIDE_MASK).unwrap()
}
/// Accessor for the <display-outside> value. #[inline] pubfn outside(&self) -> DisplayOutside {
DisplayOutside::from_u16((self.0 & Self::OUTSIDE_MASK) >> Self::OUTSIDE_SHIFT).unwrap()
}
/// Returns the raw underlying u16 value. #[inline] pubconstfn to_u16(&self) -> u16 { self.0
}
/// Returns whether this `display` value is some kind of list-item. #[inline] pubconstfn is_list_item(&self) -> bool {
(self.0 & Self::LIST_ITEM_MASK) != 0
}
/// Returns whether this `display` value is a ruby level container. pubfn is_ruby_level_container(&self) -> bool { match *self { #[cfg(feature = "gecko")]
Display::RubyBaseContainer | Display::RubyTextContainer => true,
_ => false,
}
}
/// Returns whether this `display` value is one of the types for ruby. pubfn is_ruby_type(&self) -> bool { matchself.inside() { #[cfg(feature = "gecko")]
DisplayInside::Ruby |
DisplayInside::RubyBase |
DisplayInside::RubyText |
DisplayInside::RubyBaseContainer |
DisplayInside::RubyTextContainer => true,
_ => false,
}
}
}
/// Shared Display impl for both Gecko and Servo. impl Display { /// The initial display value. #[inline] pubfn inline() -> Self {
Display::Inline
}
/// Returns whether this `display` value is the display of a flex or /// grid container. /// /// This is used to implement various style fixups. pubfn is_item_container(&self) -> bool { matchself.inside() {
DisplayInside::Flex => true,
DisplayInside::Grid => true,
_ => false,
}
}
/// Returns whether an element with this display type is a line /// participant, which means it may lay its children on the same /// line as itself. pubfn is_line_participant(&self) -> bool { ifself.is_inline_flow() { returntrue;
} match *self { #[cfg(feature = "gecko")]
Display::Contents | Display::Ruby | Display::RubyBaseContainer => true,
_ => false,
}
}
/// Convert this display into an equivalent block display. /// /// Also used for :root style adjustments. pubfn equivalent_block_display(&self, _is_root_element: bool) -> Self {
{ // Special handling for `contents` and `list-item`s on the root element. if _is_root_element && (self.is_contents() || self.is_list_item()) { return Display::Block;
}
}
matchself.outside() {
DisplayOutside::Inline => { let inside = matchself.inside() { // `inline-block` blockifies to `block` rather than // `flow-root`, for legacy reasons.
DisplayInside::FlowRoot => DisplayInside::Flow,
inside => inside,
};
Display::from3(DisplayOutside::Block, inside, self.is_list_item())
},
DisplayOutside::Block | DisplayOutside::None => *self,
_ => Display::Block,
}
}
/// Convert this display into an equivalent inline-outside display. /// https://drafts.csswg.org/css-display/#inlinify #[cfg(feature = "gecko")] pubfn inlinify(&self) -> Self { matchself.outside() {
DisplayOutside::Block => { let inside = matchself.inside() { // `display: block` inlinifies to `display: inline-block`, // rather than `inline`, for legacy reasons.
DisplayInside::Flow => DisplayInside::FlowRoot,
inside => inside,
};
Display::from3(DisplayOutside::Inline, inside, self.is_list_item())
},
_ => *self,
}
}
/// Returns true if the value is `Contents` #[inline] pubfn is_contents(&self) -> bool { match *self {
Display::Contents => true,
_ => false,
}
}
/// Returns true if the value is `None` #[inline] pubfn is_none(&self) -> bool {
*self == Display::None
}
}
/// A specified value for the `baseline-source` property. /// https://drafts.csswg.org/css-inline-3/#baseline-source #[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToShmem,
ToComputedValue,
ToResolvedValue,
)] #[repr(u8)] pubenum BaselineSource { /// `Last` for `inline-block`, `First` otherwise.
Auto, /// Use first baseline for alignment.
First, /// Use last baseline for alignment.
Last,
}
#[derive(
Clone,
Debug,
Default,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)] #[css(comma)] #[repr(C)] /// Provides a rendering hint to the user agent, stating what kinds of changes /// the author expects to perform on the element. /// /// `auto` is represented by an empty `features` list. /// /// <https://drafts.csswg.org/css-will-change/#will-change> pubstruct WillChange { /// The features that are supposed to change. /// /// TODO(emilio): Consider using ArcSlice since we just clone them from the /// specified value? That'd save an allocation, which could be worth it. #[css(iterable, if_empty = "auto")]
features: crate::OwnedSlice<CustomIdent>, /// A bitfield with the kind of change that the value will create, based /// on the above field. #[css(skip)]
bits: WillChangeBits,
}
impl WillChange { #[inline] /// Get default value of `will-change` as `auto` pubfn auto() -> Self { Self::default()
}
}
/// The change bits that we care about. #[derive(
Clone,
Copy,
Debug,
Default,
Eq,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(C)] pubstruct WillChangeBits(u16);
bitflags! { impl WillChangeBits: u16 { /// Whether a property which can create a stacking context **on any /// box** will change. const STACKING_CONTEXT_UNCONDITIONAL = 1 << 0; /// Whether `transform` or related properties will change. const TRANSFORM = 1 << 1; /// Whether `scroll-position` will change. const SCROLL = 1 << 2; /// Whether `contain` will change. const CONTAIN = 1 << 3; /// Whether `opacity` will change. const OPACITY = 1 << 4; /// Whether `perspective` will change. const PERSPECTIVE = 1 << 5; /// Whether `z-index` will change. const Z_INDEX = 1 << 6; /// Whether any property which creates a containing block for non-svg /// text frames will change. const FIXPOS_CB_NON_SVG = 1 << 7; /// Whether the position property will change. const POSITION = 1 << 8;
}
}
/// https://drafts.csswg.org/css-contain-2/#content-visibility #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)] #[repr(u8)] pubenum ContentVisibility { /// `auto` variant, the element turns on layout containment, style containment, and paint /// containment. In addition, if the element is not relevant to the user (such as by being /// offscreen) it also skips its content
Auto, /// `hidden` variant, the element skips its content
Hidden, /// 'visible' variant, no effect
Visible,
}
/// The value for the `appearance` property. /// /// https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance #[allow(missing_docs)] #[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(u8)] pubenum Appearance { /// No appearance at all.
None, /// Default appearance for the element. /// /// This value doesn't make sense for -moz-default-appearance, but we don't bother to guard /// against parsing it.
Auto, /// A searchfield.
Searchfield, /// A multi-line text field, e.g. HTML <textarea>.
Textarea, /// A checkbox element.
Checkbox, /// A radio element within a radio group.
Radio, /// A dropdown list.
Menulist, /// List boxes.
Listbox, /// A horizontal meter bar.
Meter, /// A horizontal progress bar.
ProgressBar, /// A typical dialog button.
Button, /// A single-line text field, e.g. HTML <input type=text>.
Textfield, /// The dropdown button(s) that open up a dropdown list.
MenulistButton, /// Various arrows that go in buttons #[parse(condition = "ParserContext::chrome_rules_enabled")]
ButtonArrowDown, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ButtonArrowNext, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ButtonArrowPrevious, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ButtonArrowUp, /// A dual toolbar button (e.g., a Back button with a dropdown) #[parse(condition = "ParserContext::chrome_rules_enabled")]
Dualbutton, /// Menu Popup background. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Menupopup, /// The meter bar's meter indicator. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Meterchunk, /// The "arrowed" part of the dropdown button that open up a dropdown list. #[parse(condition = "ParserContext::chrome_rules_enabled")]
MozMenulistArrowButton, /// For HTML's <input type=number> #[parse(condition = "ParserContext::chrome_rules_enabled")]
NumberInput, /// For HTML's <input type=password> #[parse(condition = "ParserContext::chrome_rules_enabled")]
PasswordInput, /// The progress bar's progress indicator #[parse(condition = "ParserContext::chrome_rules_enabled")]
Progresschunk, /// nsRangeFrame and its subparts #[parse(condition = "ParserContext::chrome_rules_enabled")]
Range, #[parse(condition = "ParserContext::chrome_rules_enabled")]
RangeThumb, /// The scrollbar slider #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarHorizontal, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarVertical, /// A scrollbar button (up/down/left/right). /// Keep these in order (some code casts these values to `int` in order to /// compare them against each other). #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarbuttonUp, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarbuttonDown, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarbuttonLeft, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarbuttonRight, /// The scrollbar thumb. #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarthumbHorizontal, #[parse(condition = "ParserContext::chrome_rules_enabled")]
ScrollbarthumbVertical, /// The scroll corner #[parse(condition = "ParserContext::chrome_rules_enabled")]
Scrollcorner, /// A separator. Can be horizontal or vertical. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Separator, /// A spin control (up/down control for time/date pickers). #[parse(condition = "ParserContext::chrome_rules_enabled")]
Spinner, /// The up button of a spin control. #[parse(condition = "ParserContext::chrome_rules_enabled")]
SpinnerUpbutton, /// The down button of a spin control. #[parse(condition = "ParserContext::chrome_rules_enabled")]
SpinnerDownbutton, /// The textfield of a spin control #[parse(condition = "ParserContext::chrome_rules_enabled")]
SpinnerTextfield, /// A splitter. Can be horizontal or vertical. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Splitter, /// A status bar in a main application window. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Statusbar, /// A single tab in a tab widget. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Tab, /// A single pane (inside the tabpanels container). #[parse(condition = "ParserContext::chrome_rules_enabled")]
Tabpanel, /// The tab panels container. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Tabpanels, /// The tabs scroll arrows (left/right). #[parse(condition = "ParserContext::chrome_rules_enabled")]
TabScrollArrowBack, #[parse(condition = "ParserContext::chrome_rules_enabled")]
TabScrollArrowForward, /// A single toolbar button (with no associated dropdown). #[parse(condition = "ParserContext::chrome_rules_enabled")]
Toolbarbutton, /// The dropdown portion of a toolbar button #[parse(condition = "ParserContext::chrome_rules_enabled")]
ToolbarbuttonDropdown, /// A tooltip. #[parse(condition = "ParserContext::chrome_rules_enabled")]
Tooltip,
/// Mac help button. #[parse(condition = "ParserContext::chrome_rules_enabled")]
MozMacHelpButton,
/// An appearance value for the root, so that we can get tinting and unified toolbar looks /// (which require a transparent gecko background) without really using the whole transparency /// set-up which otherwise loses window borders, see bug 1870481. #[parse(condition = "ParserContext::chrome_rules_enabled")]
MozMacWindow,
/// Serialize a legacy break-between value for `page-break-*`. /// /// See https://drafts.csswg.org/css-break/#page-break-properties. #[cfg_attr(feature = "servo", allow(unused))] pub(crate) fn to_css_legacy<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where
W: Write,
{ match *self {
BreakBetween::Auto | BreakBetween::Avoid | BreakBetween::Left | BreakBetween::Right => { self.to_css(dest)
},
BreakBetween::Page => dest.write_str("always"),
BreakBetween::Always => Ok(()),
}
}
}
/// A kind of break within a box. /// /// https://drafts.csswg.org/css-break/#break-within #[allow(missing_docs)] #[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(u8)] pubenum BreakWithin {
Auto,
Avoid,
AvoidPage,
AvoidColumn,
}
impl BreakWithin { /// Parse a legacy break-between value for `page-break-inside`. /// /// See https://drafts.csswg.org/css-break/#page-break-properties. #[cfg_attr(feature = "servo", allow(unused))] #[inline] pub(crate) fn parse_legacy<'i>(
_: &ParserContext,
input: &mut Parser<'i, '_>,
) -> Result<Self, ParseError<'i>> { let break_value = BreakWithin::parse(input)?; match break_value {
BreakWithin::Auto | BreakWithin::Avoid => Ok(break_value),
BreakWithin::AvoidPage | BreakWithin::AvoidColumn => {
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
},
}
}
/// Serialize a legacy break-between value for `page-break-inside`. /// /// See https://drafts.csswg.org/css-break/#page-break-properties. #[cfg_attr(feature = "servo", allow(unused))] pub(crate) fn to_css_legacy<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where
W: Write,
{ match *self {
BreakWithin::Auto | BreakWithin::Avoid => self.to_css(dest),
BreakWithin::AvoidPage | BreakWithin::AvoidColumn => Ok(()),
}
}
}
/// The value for the `overflow-x` / `overflow-y` properties. #[allow(missing_docs)] #[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(u8)] pubenum Overflow {
Visible,
Hidden,
Scroll,
Auto, #[cfg(feature = "gecko")]
Clip,
}
// This can be derived once we remove or keep `-moz-hidden-unscrollable` // indefinitely. impl Parse for Overflow { fn parse<'i, 't>(
_: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Ok(try_match_ident_ignore_ascii_case! { input, "visible" => Self::Visible, "hidden" => Self::Hidden, "scroll" => Self::Scroll, "auto" | "overlay" => Self::Auto, #[cfg(feature = "gecko")] "clip" => Self::Clip, #[cfg(feature = "gecko")] "-moz-hidden-unscrollable"if static_prefs::pref!("layout.css.overflow-moz-hidden-unscrollable.enabled") => {
Overflow::Clip
},
})
}
}
impl Overflow { /// Return true if the value will create a scrollable box. #[inline] pubfn is_scrollable(&self) -> bool {
matches!(*self, Self::Hidden | Self::Scroll | Self::Auto)
} /// Convert the value to a scrollable value if it's not already scrollable. /// This maps `visible` to `auto` and `clip` to `hidden`. #[inline] pubfn to_scrollable(&self) -> Self { match *self { Self::Hidden | Self::Scroll | Self::Auto => *self, Self::Visible => Self::Auto, #[cfg(feature = "gecko")] Self::Clip => Self::Hidden,
}
}
}
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)] #[repr(C)] #[css(bitflags(
single = "auto",
mixed = "stable,both-edges",
validate_mixed = "Self::has_stable"
))] /// Values for scrollbar-gutter: /// <https://drafts.csswg.org/css-overflow-3/#scrollbar-gutter-property> pubstruct ScrollbarGutter(u8);
bitflags! { impl ScrollbarGutter: u8 { /// `auto` variant. Just for convenience if there is no flag set. const AUTO = 0; /// `stable` variant. const STABLE = 1 << 0; /// `both-edges` variant. const BOTH_EDGES = 1 << 1;
}
}
/// A specified value for the zoom property. #[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, Parse, SpecifiedValueInfo, ToCss, ToShmem,
)] #[allow(missing_docs)] pubenum Zoom {
Normal, /// An internal value that resets the effective zoom to 1. Used for scrollbar parts, which /// disregard zoom. We use this name because WebKit has this value exposed to the web. #[parse(condition = "ParserContext::in_ua_sheet")]
Document,
Value(NonNegativeNumberOrPercentage),
}
impl Zoom { /// Return a particular number value of the zoom property. #[inline] pubfn new_number(n: f32) -> Self { Self::Value(NonNegativeNumberOrPercentage::new_number(n))
}
}
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.