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

@ -58,7 +58,7 @@ impl Kind {
}
}
fn text_type_matches(&self, text_type: &str) -> bool {
fn text_type_matches(&self, text_type: &DOMString) -> bool {
matches!(self, Kind::Text { type_, .. } if type_.eq(text_type))
}
@ -153,7 +153,7 @@ impl DragDataStore {
types
}
pub(crate) fn find_matching_text(&self, type_: &str) -> Option<DOMString> {
pub(crate) fn find_matching_text(&self, type_: &DOMString) -> Option<DOMString> {
self.item_list
.values()
.find(|item| item.text_type_matches(type_))
@ -277,7 +277,7 @@ fn normalize_mime(mut format: DOMString) -> DOMString {
// Convert format to ASCII lowercase.
format.make_ascii_lowercase();
match format.as_ref() {
match format.str() {
// If format equals "text", change it to "text/plain".
"text" => DOMString::from("text/plain"),
// If format equals "url", change it to "text/uri-list".