script: Don't use StyleSheet::update_from_str. (#40024)

I want to remove this stylo API and this is the only consumer. Instead
just parse a new style stylesheet.

Shouldn't change behavior.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez
2025-10-21 18:20:12 +02:00
committed by GitHub
parent 90e7a2276a
commit 87e397cd76
11 changed files with 158 additions and 153 deletions

View File

@@ -13,7 +13,9 @@ use script_bindings::root::Dom;
use servo_arc::Arc;
use style::media_queries::MediaList as StyleMediaList;
use style::shared_lock::DeepCloneWithLock;
use style::stylesheets::{AllowImportRules, Origin, Stylesheet, StylesheetContents, UrlExtraData};
use style::stylesheets::{
AllowImportRules, Origin, Stylesheet, StylesheetContents, StylesheetInDocument, UrlExtraData,
};
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@@ -164,7 +166,7 @@ impl HTMLStyleElement {
);
let sheet = Arc::new(Stylesheet {
contents,
contents: shared_lock.wrap(contents),
shared_lock,
media: mq,
disabled: AtomicBool::new(false),
@@ -248,11 +250,11 @@ impl HTMLStyleElement {
let lock = stylesheet_with_shared_contents.shared_lock.clone();
let guard = stylesheet_with_shared_contents.shared_lock.read();
let stylesheet_with_owned_contents = Arc::new(Stylesheet {
contents: Arc::new(
contents: lock.wrap(Arc::new(
stylesheet_with_shared_contents
.contents
.contents(&guard)
.deep_clone_with_lock(&lock, &guard),
),
)),
shared_lock: lock,
media: stylesheet_with_shared_contents.media.clone(),
disabled: AtomicBool::new(