<!-- Please describe your changes on the following line: --> This is the final PR to get basic paint worklet support. It adds support for paint worklet properties (https://drafts.css-houdini.org/css-paint-api/#paint-definition-input-properties). When a paint worklet is registered, it specifies a list of CSS properties, and is provided with their computed values when it is invoked. This is a dependent PR: * "Implemented paint worklets invoking worklet scripts" is #17239. * "Implemented paint worklets rendering contexts" is #17326. There should be tests added for this, hopefully the existing wpt houdini tests. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #16839 - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bc44246fc682d9f2362eaca6bba07b45c293eb42
47 lines
1.5 KiB
Rust
47 lines
1.5 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
use dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods;
|
|
use dom::bindings::codegen::Bindings::CSSStyleValueBinding::Wrap;
|
|
use dom::bindings::js::Root;
|
|
use dom::bindings::reflector::Reflector;
|
|
use dom::bindings::reflector::reflect_dom_object;
|
|
use dom::bindings::str::DOMString;
|
|
use dom::globalscope::GlobalScope;
|
|
use dom_struct::dom_struct;
|
|
|
|
#[dom_struct]
|
|
pub struct CSSStyleValue {
|
|
reflector: Reflector,
|
|
value: String,
|
|
}
|
|
|
|
impl CSSStyleValue {
|
|
fn new_inherited(value: String) -> CSSStyleValue {
|
|
CSSStyleValue {
|
|
reflector: Reflector::new(),
|
|
value: value,
|
|
}
|
|
}
|
|
|
|
pub fn new(global: &GlobalScope, value: String) -> Root<CSSStyleValue> {
|
|
reflect_dom_object(box CSSStyleValue::new_inherited(value), global, Wrap)
|
|
}
|
|
}
|
|
|
|
impl CSSStyleValueMethods for CSSStyleValue {
|
|
/// https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior
|
|
fn Stringifier(&self) -> DOMString {
|
|
DOMString::from(&*self.value)
|
|
}
|
|
|
|
/// This attribute is no longer part of the `CSSStyleValue` interface,
|
|
/// but is still used in some examples.
|
|
/// https://github.com/GoogleChrome/houdini-samples/issues/16
|
|
// check-tidy: no specs after this line
|
|
fn CssText(&self) -> DOMString {
|
|
self.Stringifier()
|
|
}
|
|
}
|