mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-29 17:40:42 +00:00
Backed out changeset 507a811671f8 (bug 1618997) for causing bustages CLOSED TREE
This commit is contained in:
parent
2c62d81ee6
commit
28d3eea9d2
@ -9,7 +9,6 @@
|
||||
|
||||
use crate::values::computed::{Integer, LengthPercentage, Percentage};
|
||||
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;
|
||||
pub use crate::values::specified::position::{GridAutoFlow, GridTemplateAreas};
|
||||
@ -57,14 +56,5 @@ impl ToCss for Position {
|
||||
}
|
||||
}
|
||||
|
||||
impl GenericPositionComponent for LengthPercentage {
|
||||
fn is_center(&self) -> bool {
|
||||
match self.to_percentage() {
|
||||
Some(Percentage(0.5)) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A computed value for the `z-index` property.
|
||||
pub type ZIndex = GenericZIndex<Integer>;
|
||||
|
@ -13,7 +13,6 @@ use crate::Zero;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::generics::position::PositionComponent;
|
||||
|
||||
/// An `<image> | none` value.
|
||||
///
|
||||
@ -331,7 +330,7 @@ where
|
||||
LP: ToCss,
|
||||
NL: ToCss,
|
||||
NLP: ToCss,
|
||||
P: PositionComponent + ToCss,
|
||||
P: ToCss,
|
||||
A: ToCss,
|
||||
AoP: ToCss,
|
||||
C: ToCss,
|
||||
@ -380,59 +379,36 @@ where
|
||||
EndingShape::Ellipse(Ellipse::Extent(ShapeExtent::FarthestCorner)) => true,
|
||||
_ => false,
|
||||
};
|
||||
let omit_position = position.is_center();
|
||||
if compat_mode == GradientCompatMode::Modern {
|
||||
if !omit_shape {
|
||||
shape.to_css(dest)?;
|
||||
if !omit_position {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
}
|
||||
if !omit_position {
|
||||
dest.write_str("at ")?;
|
||||
position.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
dest.write_str("at ")?;
|
||||
position.to_css(dest)?;
|
||||
} else {
|
||||
if !omit_position {
|
||||
position.to_css(dest)?;
|
||||
if !omit_shape {
|
||||
dest.write_str(", ")?;
|
||||
}
|
||||
}
|
||||
position.to_css(dest)?;
|
||||
if !omit_shape {
|
||||
dest.write_str(", ")?;
|
||||
shape.to_css(dest)?;
|
||||
}
|
||||
}
|
||||
let mut skip_comma = omit_shape && omit_position;
|
||||
for item in &**items {
|
||||
if !skip_comma {
|
||||
dest.write_str(", ")?;
|
||||
}
|
||||
skip_comma = false;
|
||||
dest.write_str(", ")?;
|
||||
item.to_css(dest)?;
|
||||
}
|
||||
},
|
||||
Gradient::Conic { ref angle, ref position, ref items, .. } => {
|
||||
dest.write_str("conic-gradient(")?;
|
||||
let omit_angle = angle.is_zero();
|
||||
let omit_position = position.is_center();
|
||||
if !omit_angle {
|
||||
if !angle.is_zero() {
|
||||
dest.write_str("from ")?;
|
||||
angle.to_css(dest)?;
|
||||
if !omit_position {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
if !omit_position {
|
||||
dest.write_str("at ")?;
|
||||
position.to_css(dest)?;
|
||||
}
|
||||
let mut skip_comma = omit_angle && omit_position;
|
||||
dest.write_str("at ")?;
|
||||
position.to_css(dest)?;
|
||||
for item in &**items {
|
||||
if !skip_comma {
|
||||
dest.write_str(", ")?;
|
||||
}
|
||||
skip_comma = false;
|
||||
dest.write_str(", ")?;
|
||||
item.to_css(dest)?;
|
||||
}
|
||||
},
|
||||
|
@ -31,17 +31,6 @@ pub struct GenericPosition<H, V> {
|
||||
pub vertical: V,
|
||||
}
|
||||
|
||||
impl<H, V> PositionComponent for Position<H, V>
|
||||
where
|
||||
H: PositionComponent,
|
||||
V: PositionComponent,
|
||||
{
|
||||
#[inline]
|
||||
fn is_center(&self) -> bool {
|
||||
self.horizontal.is_center() && self.vertical.is_center()
|
||||
}
|
||||
}
|
||||
|
||||
pub use self::GenericPosition as Position;
|
||||
|
||||
impl<H, V> Position<H, V> {
|
||||
@ -54,13 +43,6 @@ impl<H, V> Position<H, V> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implements a method that checks if the position is centered.
|
||||
pub trait PositionComponent {
|
||||
/// Returns if the position component is 50% or center.
|
||||
/// For pixel lengths, it always returns false.
|
||||
fn is_center(&self) -> bool;
|
||||
}
|
||||
|
||||
/// A generic type for representing an `Auto | <position>`.
|
||||
/// This is used by <offset-anchor> for now.
|
||||
/// https://drafts.fxtf.org/motion-1/#offset-anchor-property
|
||||
|
@ -13,7 +13,6 @@ 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};
|
||||
@ -263,18 +262,6 @@ 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 {
|
||||
|
@ -1,2 +1 @@
|
||||
leak-threshold: [default:51200]
|
||||
prefs: [layout.css.conic-gradient.enabled:true]
|
||||
|
@ -26,34 +26,10 @@ test_computed_value("background-image", 'none, url("http://{{host}}/")');
|
||||
|
||||
test_computed_value('background-image', 'linear-gradient(to left bottom, red, blue)', 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
|
||||
test_computed_value('background-image', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(at center, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(at 50%, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-side, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-side at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-corner, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-corner at center, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-corner at 50%, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(farthest-corner at 10px 10px, red, blue)', 'radial-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
|
||||
test_computed_value('background-image', 'radial-gradient(10px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(circle calc(-0.5em + 10px) at calc(-1em + 10px) calc(-2em + 10px), red, blue)', 'radial-gradient(0px at -30px -70px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(ellipse calc(-0.5em + 10px) calc(0.5em + 10px) at 20px 30px, red, blue)', 'radial-gradient(0px 30px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'radial-gradient(ellipse calc(0.5em + 10px) calc(-0.5em + 10px) at 20px 30px, red, blue)', 'radial-gradient(30px 0px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
|
||||
test_computed_value('background-image', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(at center, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(at 50%, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 0deg, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 0deg at center, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 0deg at 50%, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 0deg at 10px 10px, red, blue)', 'conic-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 45deg at center, red, blue)', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 45deg at 50%, red, blue)', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
test_computed_value('background-image', 'conic-gradient(from 45deg at 10px 10px, red, blue)', 'conic-gradient(from 45deg at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user