mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Handle keywords for color values.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 5GvIHSeQuCX
This commit is contained in:
parent
20398491cc
commit
0021c70c08
2 changed files with 21 additions and 3 deletions
|
@ -14,7 +14,7 @@ use parser::{Parse, ParserContext};
|
|||
use properties::longhands::system_colors::SystemColor;
|
||||
use std::fmt::{self, Write};
|
||||
use std::io::Write as IoWrite;
|
||||
use style_traits::{CssType, CssWriter, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{SpecifiedValueInfo, ToCss, ValueParseErrorKind};
|
||||
use super::AllowQuirks;
|
||||
use values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
||||
|
@ -429,6 +429,15 @@ impl From<Color> for RGBAColor {
|
|||
|
||||
impl SpecifiedValueInfo for Color {
|
||||
const SUPPORTED_TYPES: u8 = CssType::COLOR;
|
||||
|
||||
fn collect_completion_keywords(f: KeywordsCollectFn) {
|
||||
// We are not going to insert all the color names here. Caller and
|
||||
// devtools should take care of them. XXX Actually, transparent
|
||||
// should probably be handled that way as well.
|
||||
// XXX `currentColor` should really be `currentcolor`. But let's
|
||||
// keep it consistent with the old system for now.
|
||||
f(&["rgb", "rgba", "hsl", "hsla", "currentColor", "transparent"]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Specified value for the "color" property, which resolves the `currentcolor`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue