mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Merge ImageLayer and Image.
ImageLayer is almost the only usage of Image, so keeping them in the same enum makes the resulting C++ struct smaller, and makes it map more cleanly to nsStyleImage. Differential Revision: https://phabricator.services.mozilla.com/D62161
This commit is contained in:
parent
c0d67f796c
commit
149cb5f5f1
12 changed files with 62 additions and 112 deletions
|
@ -71,6 +71,10 @@ impl Parse for ClippingShape {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(ShapeSource::None);
|
||||
}
|
||||
|
||||
if is_clip_path_path_enabled(context) {
|
||||
if let Ok(p) = input.try(|i| Path::parse(context, i)) {
|
||||
return Ok(ShapeSource::Path(p));
|
||||
|
@ -91,7 +95,14 @@ impl Parse for FloatAreaShape {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
// Need to parse this here so that `Image::parse_with_cors_anonymous`
|
||||
// doesn't parse it.
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(ShapeSource::None);
|
||||
}
|
||||
|
||||
if let Ok(image) = input.try(|i| Image::parse_with_cors_anonymous(context, i)) {
|
||||
debug_assert_ne!(image, Image::None);
|
||||
return Ok(ShapeSource::ImageOrUrl(image));
|
||||
}
|
||||
|
||||
|
@ -108,10 +119,6 @@ where
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(ShapeSource::None);
|
||||
}
|
||||
|
||||
fn parse_component<U: Parse>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue