mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Omit center positions in conic/radial gradient serialization.
Differential Revision: https://phabricator.services.mozilla.com/D67461
This commit is contained in:
parent
414edb5a4a
commit
d17b3cc202
4 changed files with 77 additions and 12 deletions
|
@ -13,6 +13,7 @@ use crate::str::HTML_SPACE_CHARACTERS;
|
|||
use crate::values::computed::LengthPercentage as ComputedLengthPercentage;
|
||||
use crate::values::computed::{Context, Percentage, ToComputedValue};
|
||||
use crate::values::generics::position::Position as GenericPosition;
|
||||
use crate::values::generics::position::PositionComponent as GenericPositionComponent;
|
||||
use crate::values::generics::position::PositionOrAuto as GenericPositionOrAuto;
|
||||
use crate::values::generics::position::ZIndex as GenericZIndex;
|
||||
use crate::values::specified::{AllowQuirks, Integer, LengthPercentage};
|
||||
|
@ -262,6 +263,18 @@ impl<S: Parse> PositionComponent<S> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S> GenericPositionComponent for PositionComponent<S> {
|
||||
fn is_center(&self) -> bool {
|
||||
match *self {
|
||||
PositionComponent::Center => true,
|
||||
PositionComponent::Length(LengthPercentage::Percentage(ref per)) => per.0 == 0.5,
|
||||
// 50% from any side is still the center.
|
||||
PositionComponent::Side(_, Some(LengthPercentage::Percentage(ref per))) => per.0 == 0.5,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> PositionComponent<S> {
|
||||
/// `0%`
|
||||
pub fn zero() -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue