mirror of
https://github.com/servo/servo
synced 2026-05-14 10:56:44 +02:00
This way we always serialize in the shortest form, and take less space. This is useful because when serializing uncomputed values we'd like to compare to the initial value to avoid serializing parts of a shorthand, but with the existing implementation we would generate always a second keyword, which means that we'll never match it. This also matches Chrome and WebKit, incidentally, so I'm pretty confident the behavior change when serializing specified style is web-compatible. Differential Revision: https://phabricator.services.mozilla.com/D11941
24 lines
899 B
Rust
24 lines
899 B
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//! Computed types for CSS values related to backgrounds.
|
|
|
|
use crate::values::computed::length::NonNegativeLengthOrPercentageOrAuto;
|
|
use crate::values::generics::background::BackgroundSize as GenericBackgroundSize;
|
|
|
|
pub use crate::values::specified::background::BackgroundRepeat;
|
|
|
|
/// A computed value for the `background-size` property.
|
|
pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>;
|
|
|
|
impl BackgroundSize {
|
|
/// Returns `auto auto`.
|
|
pub fn auto() -> Self {
|
|
GenericBackgroundSize::Explicit {
|
|
width: NonNegativeLengthOrPercentageOrAuto::auto(),
|
|
height: NonNegativeLengthOrPercentageOrAuto::auto(),
|
|
}
|
|
}
|
|
}
|