mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
style: Rename CaretColor to ColorOrAuto for reusing.
Bug: 1460456 Reviewed-by: heycam MozReview-Commit-ID: LD6PlNI60GC
This commit is contained in:
parent
4e6b100c7e
commit
1b236bf620
7 changed files with 19 additions and 45 deletions
|
@ -9,25 +9,14 @@ use parser::{Parse, ParserContext};
|
|||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::cursor::CursorKind;
|
||||
use values::{Auto, Either};
|
||||
use values::generics::ui as generics;
|
||||
use values::specified::Number;
|
||||
use values::specified::color::Color;
|
||||
use values::specified::url::SpecifiedImageUrl;
|
||||
|
||||
/// A specified value for the `caret-color` property.
|
||||
pub type CaretColor = generics::CaretColor<Color>;
|
||||
|
||||
impl Parse for CaretColor {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("auto")).is_ok() {
|
||||
return Ok(generics::CaretColor::Auto);
|
||||
}
|
||||
Ok(generics::CaretColor::Color(Color::parse(context, input)?))
|
||||
}
|
||||
}
|
||||
/// auto | <color>
|
||||
pub type ColorOrAuto = Either<Color, Auto>;
|
||||
|
||||
/// A specified value for the `cursor` property.
|
||||
pub type Cursor = generics::Cursor<CursorImage>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue