mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
Script: Change script/dom/{bluetooth,canvas,html} to not rely on Deref<str> for DOMString (#39480)
This is part of the future work of implementing LazyDOMString as outlined in https://github.com/servo/servo/issues/39479. We use str() method or direct implementations on DOMString for these methods. We also change some types. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com> Testing: This is essentially just renaming a method and a type and should not change functionality. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
1e471b9b41
commit
a4c8ffe753
23 changed files with 97 additions and 95 deletions
|
@ -1298,7 +1298,7 @@ impl CanvasState {
|
|||
repetition.push_str("repeat");
|
||||
}
|
||||
|
||||
if let Ok(rep) = RepetitionStyle::from_str(&repetition) {
|
||||
if let Ok(rep) = RepetitionStyle::from_str(repetition.str()) {
|
||||
let size = snapshot.size();
|
||||
Ok(Some(CanvasPattern::new(
|
||||
global,
|
||||
|
@ -1357,7 +1357,7 @@ impl CanvasState {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalcompositeoperation
|
||||
pub(super) fn set_global_composite_operation(&self, op_str: DOMString) {
|
||||
if let Ok(op) = CompositionOrBlending::from_str(&op_str) {
|
||||
if let Ok(op) = CompositionOrBlending::from_str(op_str.str()) {
|
||||
self.state.borrow_mut().global_composition = op;
|
||||
}
|
||||
}
|
||||
|
@ -2506,9 +2506,9 @@ impl UnshapedTextRun<'_> {
|
|||
|
||||
pub(super) fn parse_color(
|
||||
canvas: Option<&HTMLCanvasElement>,
|
||||
string: &str,
|
||||
string: &DOMString,
|
||||
) -> Result<AbsoluteColor, ()> {
|
||||
let mut input = ParserInput::new(string);
|
||||
let mut input = ParserInput::new(string.str());
|
||||
let mut parser = Parser::new(&mut input);
|
||||
let url = Url::parse("about:blank").unwrap().into();
|
||||
let context = ParserContext::new(
|
||||
|
|
|
@ -297,7 +297,7 @@ impl OffscreenCanvasMethods<crate::DomTypeHolder> for OffscreenCanvas {
|
|||
return Err(Error::InvalidState);
|
||||
}
|
||||
|
||||
match &*id {
|
||||
match id.str() {
|
||||
"2d" => Ok(self
|
||||
.get_or_init_2d_context(can_gc)
|
||||
.map(RootedOffscreenRenderingContext::OffscreenCanvasRenderingContext2D)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue