mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Implement the hashless color quirk (fixes #15341)
This commit is contained in:
parent
1afc89e944
commit
9964b328b1
10 changed files with 119 additions and 33 deletions
|
@ -10,7 +10,9 @@ ${helpers.predefined_type("background-color", "CSSColor",
|
|||
"::cssparser::Color::RGBA(::cssparser::RGBA::transparent())",
|
||||
initial_specified_value="SpecifiedValue::transparent()",
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
|
||||
animation_value_type="IntermediateColor", complex_color=True)}
|
||||
animation_value_type="IntermediateColor",
|
||||
complex_color=True,
|
||||
allow_quirks=True)}
|
||||
|
||||
${helpers.predefined_type("background-image", "ImageLayer",
|
||||
initial_value="Either::First(None_)",
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
"::cssparser::Color::CurrentColor",
|
||||
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"),
|
||||
spec=maybe_logical_spec(side, "color"),
|
||||
animation_value_type="IntermediateColor", logical = side[1])}
|
||||
animation_value_type="IntermediateColor",
|
||||
logical=side[1],
|
||||
allow_quirks=not side[1])}
|
||||
|
||||
${helpers.predefined_type("border-%s-style" % side[0], "BorderStyle",
|
||||
"specified::BorderStyle::none",
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
use cssparser::RGBA;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::specified::{Color, CSSColor, CSSRGBA};
|
||||
use values::specified::{AllowQuirks, Color, CSSColor, CSSRGBA};
|
||||
|
||||
impl ToComputedValue for SpecifiedValue {
|
||||
type ComputedValue = computed_value::T;
|
||||
|
@ -50,7 +50,7 @@
|
|||
RGBA::new(0, 0, 0, 255) // black
|
||||
}
|
||||
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
CSSColor::parse(context, input).map(SpecifiedValue)
|
||||
CSSColor::parse_quirky(context, input, AllowQuirks::Yes).map(SpecifiedValue)
|
||||
}
|
||||
|
||||
// FIXME(#15973): Add servo support for system colors
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
background-attachment background-image background-size background-origin
|
||||
background-clip"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#the-background">
|
||||
use properties::longhands::{background_color, background_position_x, background_position_y, background_repeat};
|
||||
use properties::longhands::{background_position_x, background_position_y, background_repeat};
|
||||
use properties::longhands::{background_attachment, background_image, background_size, background_origin};
|
||||
use properties::longhands::background_clip;
|
||||
use properties::longhands::background_clip::single_value::computed_value::T as Clip;
|
||||
use properties::longhands::background_origin::single_value::computed_value::T as Origin;
|
||||
use values::specified::{Position, PositionComponent};
|
||||
use values::specified::{CSSColor, Position, PositionComponent};
|
||||
use parser::Parse;
|
||||
|
||||
impl From<background_origin::single_value::SpecifiedValue> for background_clip::single_value::SpecifiedValue {
|
||||
|
@ -43,7 +43,7 @@
|
|||
let mut ${name} = None;
|
||||
% endfor
|
||||
loop {
|
||||
if let Ok(value) = input.try(|input| background_color::parse(context, input)) {
|
||||
if let Ok(value) = input.try(|i| CSSColor::parse(context, i)) {
|
||||
if background_color.is_none() {
|
||||
background_color = Some(value);
|
||||
continue
|
||||
|
@ -109,7 +109,7 @@
|
|||
}));
|
||||
|
||||
Ok(Longhands {
|
||||
background_color: unwrap_or_initial!(background_color),
|
||||
background_color: background_color.unwrap_or(CSSColor::transparent()),
|
||||
background_image: background_image,
|
||||
background_position_x: background_position_x,
|
||||
background_position_y: background_position_y,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue