Script: Change the rest of script to not rely on Deref<str> for DOMString (#39481)

This is part of the future work of implementing LazyDOMString as
outlined in issue #39479.

We use str() method or direct implementations on DOMString for these
methods. We also change some types.
This is independent of https://github.com/servo/servo/pull/39480

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 14:27:42 +02:00 committed by GitHub
parent 9713bb9e1b
commit 1e471b9b41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 219 additions and 132 deletions

View file

@ -112,7 +112,7 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
/// <https://html.spec.whatwg.org/multipage/#dom-datatransfer-dropeffect>
fn SetDropEffect(&self, value: DOMString) {
if VALID_DROP_EFFECTS.contains(&value.as_ref()) {
if VALID_DROP_EFFECTS.contains(&value.str()) {
*self.drop_effect.borrow_mut() = value;
}
}
@ -129,7 +129,7 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
.borrow()
.as_ref()
.is_some_and(|data_store| data_store.mode() == Mode::ReadWrite) &&
VALID_EFFECTS_ALLOWED.contains(&value.as_ref())
VALID_EFFECTS_ALLOWED.contains(&value.str())
{
*self.drop_effect.borrow_mut() = value;
}
@ -187,7 +187,7 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
// Step 4 Let convert-to-URL be false.
let mut convert_to_url = false;
let type_ = match format.as_ref() {
let type_ = match format.str() {
// Step 5 If format equals "text", change it to "text/plain".
"text" => DOMString::from("text/plain"),
// Step 6 If format equals "url", change it to "text/uri-list" and set convert-to-URL to true.