mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
script: Implement CSS.registerProperty
(#38682)
The implementation is mostly equivalent to https://searchfox.org/mozilla-central/source/servo/ports/geckolib/glue.rs#9480. Testing: New web platform tests start to pass --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
3a0e8fefde
commit
43da933247
9 changed files with 185 additions and 46 deletions
|
@ -54,7 +54,7 @@ use style::media_queries::Device;
|
|||
use style::properties::PropertyId;
|
||||
use style::properties::style_structs::Font;
|
||||
use style::selector_parser::{PseudoElement, RestyleDamage, Snapshot};
|
||||
use style::stylesheets::Stylesheet;
|
||||
use style::stylesheets::{Stylesheet, UrlExtraData};
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::units::{DeviceIntSize, LayoutPoint, LayoutVector2D};
|
||||
use webrender_api::{ExternalScrollId, ImageKey};
|
||||
|
@ -206,6 +206,24 @@ pub struct LayoutConfig {
|
|||
pub theme: Theme,
|
||||
}
|
||||
|
||||
pub struct PropertyRegistration {
|
||||
pub name: String,
|
||||
pub syntax: String,
|
||||
pub initial_value: Option<String>,
|
||||
pub inherits: bool,
|
||||
pub url_data: UrlExtraData,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum RegisterPropertyError {
|
||||
InvalidName,
|
||||
AlreadyRegistered,
|
||||
InvalidSyntax,
|
||||
InvalidInitialValue,
|
||||
InitialValueNotComputationallyIndependent,
|
||||
NoInitialValue,
|
||||
}
|
||||
|
||||
pub trait LayoutFactory: Send + Sync {
|
||||
fn create(&self, config: LayoutConfig) -> Box<dyn Layout>;
|
||||
}
|
||||
|
@ -299,6 +317,10 @@ pub trait Layout {
|
|||
point: LayoutPoint,
|
||||
flags: ElementsFromPointFlags,
|
||||
) -> Vec<ElementsFromPointResult>;
|
||||
fn register_custom_property(
|
||||
&mut self,
|
||||
property_registration: PropertyRegistration,
|
||||
) -> Result<(), RegisterPropertyError>;
|
||||
}
|
||||
|
||||
/// This trait is part of `layout_api` because it depends on both `script_traits`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue