Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #17364 - asajeffrey:script-paint-worklets-properties, r…
…=jdm Implement paint worklet properties <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17364) <!-- Reviewable:end -->
- Loading branch information
Showing
29 changed files
with
353 additions
and
118 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* 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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.