mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implemented the plumbing for paint worklets.
This commit is contained in:
parent
7e273d6c9b
commit
fd17dcd604
23 changed files with 600 additions and 156 deletions
|
@ -22,6 +22,7 @@ use values::generics::image::{EndingShape as GenericEndingShape, Gradient as Gen
|
|||
use values::generics::image::{GradientItem as GenericGradientItem, GradientKind as GenericGradientKind};
|
||||
use values::generics::image::{Image as GenericImage, ImageRect as GenericImageRect};
|
||||
use values::generics::image::{LineDirection as GenericsLineDirection, ShapeExtent};
|
||||
use values::generics::image::PaintWorklet;
|
||||
use values::generics::position::Position as GenericPosition;
|
||||
use values::specified::{Angle, CSSColor, Color, Length, LengthOrPercentage};
|
||||
use values::specified::{Number, NumberOrPercentage, Percentage};
|
||||
|
@ -98,6 +99,12 @@ impl Parse for Image {
|
|||
if let Ok(gradient) = input.try(|i| Gradient::parse(context, i)) {
|
||||
return Ok(GenericImage::Gradient(gradient));
|
||||
}
|
||||
#[cfg(feature = "servo")]
|
||||
{
|
||||
if let Ok(paint_worklet) = input.try(|i| PaintWorklet::parse(context, i)) {
|
||||
return Ok(GenericImage::PaintWorklet(paint_worklet));
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
if let Ok(mut image_rect) = input.try(|input| ImageRect::parse(context, input)) {
|
||||
|
@ -673,6 +680,18 @@ impl Parse for ColorStop {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse for PaintWorklet {
|
||||
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
input.expect_function_matching("paint")?;
|
||||
input.parse_nested_block(|i| {
|
||||
let name = i.expect_ident()?;
|
||||
Ok(PaintWorklet {
|
||||
name: Atom::from(name),
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for ImageRect {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
input.try(|i| i.expect_function_matching("-moz-image-rect"))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue