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:
Narfinger 2025-09-25 17:53:21 +02:00 committed by GitHub
parent 1e471b9b41
commit a4c8ffe753
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 97 additions and 95 deletions

View file

@ -121,7 +121,7 @@ impl HTMLStyleElement {
global,
self.upcast(),
InlineCheckType::Style,
&node.child_text_content(),
node.child_text_content().str(),
)
{
return;
@ -132,14 +132,14 @@ impl HTMLStyleElement {
.GetTextContent()
.expect("Element.textContent must be a string");
let shared_lock = node.owner_doc().style_shared_lock().clone();
let mq = Arc::new(shared_lock.wrap(self.create_media_list(&self.Media())));
let mq = Arc::new(shared_lock.wrap(self.create_media_list(self.Media().str())));
let loader = StylesheetLoader::for_element(self.upcast());
let stylesheetcontents_create_callback = || {
#[cfg(feature = "tracing")]
let _span = tracing::trace_span!("ParseStylesheet", servo_profiling = true).entered();
StylesheetContents::from_str(
&data,
data.str(),
UrlExtraData(window.get_url().get_arc()),
Origin::Author,
&shared_lock,
@ -156,7 +156,7 @@ impl HTMLStyleElement {
// stylo's `CascadeDataCache` can now be significantly improved. When shared `StylesheetContents`
// is modified, copy-on-write will occur, see `CSSStyleSheet::will_modify`.
let (cache_key, contents) = StylesheetContentsCache::get_or_insert_with(
&data,
data.str(),
&shared_lock,
UrlExtraData(window.get_url().get_arc()),
doc.quirks_mode(),