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

@ -356,7 +356,7 @@ impl CSSStyleDeclaration {
id
},
PotentiallyParsedPropertyId::NotParsed(unparsed) => {
match PropertyId::parse_enabled_for_all_content(&unparsed) {
match PropertyId::parse_enabled_for_all_content(unparsed.str()) {
Ok(id) => id,
Err(..) => return Ok(()),
}
@ -374,7 +374,7 @@ impl CSSStyleDeclaration {
// Step 4. If priority is not the empty string and is not an ASCII case-insensitive
// match for the string "important", then return.
let importance = match &*priority {
let importance = match priority.str() {
"" => Importance::Normal,
p if p.eq_ignore_ascii_case("important") => Importance::Important,
_ => {
@ -390,7 +390,7 @@ impl CSSStyleDeclaration {
let result = parse_one_declaration_into(
&mut declarations,
id,
&value,
value.str(),
Origin::Author,
&UrlExtraData(self.owner.base_url().get_arc()),
window.css_error_reporter(),
@ -481,7 +481,7 @@ impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
fn GetPropertyValue(&self, property: DOMString) -> DOMString {
let id = match PropertyId::parse_enabled_for_all_content(&property) {
let id = match PropertyId::parse_enabled_for_all_content(property.str()) {
Ok(id) => id,
Err(..) => return DOMString::new(),
};
@ -494,7 +494,7 @@ impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
// Readonly style declarations are used for getComputedStyle.
return DOMString::new();
}
let id = match PropertyId::parse_enabled_for_all_content(&property) {
let id = match PropertyId::parse_enabled_for_all_content(property.str()) {
Ok(id) => id,
Err(..) => return DOMString::new(),
};
@ -532,7 +532,7 @@ impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
return Err(Error::NoModificationAllowed);
}
let id = match PropertyId::parse_enabled_for_all_content(&property) {
let id = match PropertyId::parse_enabled_for_all_content(property.str()) {
Ok(id) => id,
Err(..) => return Ok(DOMString::new()),
};
@ -609,7 +609,7 @@ impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
|pdb, _changed| {
// Step 3
*pdb = parse_style_attribute(
&value,
value.str(),
&UrlExtraData(self.owner.base_url().get_arc()),
window.css_error_reporter(),
quirks_mode,