mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Auto merge of #18136 - upsuper:shadow-color, r=emilio
Use Option<RGBA> for color in shadow This fixes [bug 1390697](https://bugzilla.mozilla.org/show_bug.cgi?id=1390697) by downgrading the support of currentcolor in shadow to what Gecko currently supports. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18136) <!-- Reviewable:end -->
This commit is contained in:
commit
0b45a4f651
5 changed files with 26 additions and 26 deletions
|
@ -17,13 +17,14 @@ use values::generics::effects::BoxShadow as GenericBoxShadow;
|
|||
use values::generics::effects::Filter as GenericFilter;
|
||||
use values::generics::effects::SimpleShadow as GenericSimpleShadow;
|
||||
use values::specified::{Angle, NumberOrPercentage};
|
||||
use values::specified::color::Color;
|
||||
use values::specified::color::RGBAColor;
|
||||
use values::specified::length::{Length, NonNegativeLength};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
/// A specified value for a single shadow of the `box-shadow` property.
|
||||
pub type BoxShadow = GenericBoxShadow<Option<Color>, Length, Option<NonNegativeLength>, Option<Length>>;
|
||||
pub type BoxShadow = GenericBoxShadow<Option<RGBAColor>, Length,
|
||||
Option<NonNegativeLength>, Option<Length>>;
|
||||
|
||||
/// A specified value for a single `filter`.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -67,7 +68,7 @@ impl ToComputedValue for Factor {
|
|||
}
|
||||
|
||||
/// A specified value for the `drop-shadow()` filter.
|
||||
pub type SimpleShadow = GenericSimpleShadow<Option<Color>, Length, Option<NonNegativeLength>>;
|
||||
pub type SimpleShadow = GenericSimpleShadow<Option<RGBAColor>, Length, Option<NonNegativeLength>>;
|
||||
|
||||
impl Parse for BoxShadow {
|
||||
fn parse<'i, 't>(
|
||||
|
@ -104,7 +105,7 @@ impl Parse for BoxShadow {
|
|||
}
|
||||
}
|
||||
if color.is_none() {
|
||||
if let Ok(value) = input.try(|i| Color::parse(context, i)) {
|
||||
if let Ok(value) = input.try(|i| RGBAColor::parse(context, i)) {
|
||||
color = Some(value);
|
||||
continue;
|
||||
}
|
||||
|
@ -184,11 +185,11 @@ impl Parse for SimpleShadow {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let color = input.try(|i| Color::parse(context, i)).ok();
|
||||
let color = input.try(|i| RGBAColor::parse(context, i)).ok();
|
||||
let horizontal = Length::parse(context, input)?;
|
||||
let vertical = Length::parse(context, input)?;
|
||||
let blur = input.try(|i| Length::parse_non_negative(context, i)).ok();
|
||||
let color = color.or_else(|| input.try(|i| Color::parse(context, i)).ok());
|
||||
let color = color.or_else(|| input.try(|i| RGBAColor::parse(context, i)).ok());
|
||||
Ok(SimpleShadow {
|
||||
color: color,
|
||||
horizontal: horizontal,
|
||||
|
@ -204,8 +205,7 @@ impl ToComputedValue for SimpleShadow {
|
|||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
ComputedSimpleShadow {
|
||||
color:
|
||||
self.color.as_ref().unwrap_or(&Color::CurrentColor).to_computed_value(context),
|
||||
color: self.color.to_computed_value(context),
|
||||
horizontal: self.horizontal.to_computed_value(context),
|
||||
vertical: self.vertical.to_computed_value(context),
|
||||
blur:
|
||||
|
@ -216,7 +216,7 @@ impl ToComputedValue for SimpleShadow {
|
|||
#[inline]
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
SimpleShadow {
|
||||
color: Some(ToComputedValue::from_computed_value(&computed.color)),
|
||||
color: ToComputedValue::from_computed_value(&computed.color),
|
||||
horizontal: ToComputedValue::from_computed_value(&computed.horizontal),
|
||||
vertical: ToComputedValue::from_computed_value(&computed.vertical),
|
||||
blur: Some(ToComputedValue::from_computed_value(&computed.blur)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue