Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-05-12 21:12:16 +02:00
parent 1ddd3b09c2
commit 4df282dab7
2 changed files with 13 additions and 23 deletions

View file

@ -21,7 +21,6 @@ use crate::dom::node::{
use crate::dom::virtualmethods::VirtualMethods; use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix}; use html5ever::{LocalName, Prefix};
use parking_lot::RwLock;
use servo_arc::Arc; use servo_arc::Arc;
use servo_config::pref; use servo_config::pref;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
@ -112,15 +111,12 @@ impl HTMLMetaElement {
let shared_lock = document.style_shared_lock(); let shared_lock = document.style_shared_lock();
let rule = CssRule::Viewport(Arc::new(shared_lock.wrap(translated_rule))); let rule = CssRule::Viewport(Arc::new(shared_lock.wrap(translated_rule)));
let sheet = Arc::new(Stylesheet { let sheet = Arc::new(Stylesheet {
contents: StylesheetContents { contents: StylesheetContents::from_shared_data(
rules: CssRules::new(vec![rule], shared_lock), CssRules::new(vec![rule], shared_lock),
origin: Origin::Author, Origin::Author,
namespaces: Default::default(), window_from_node(self).get_url(),
quirks_mode: document.quirks_mode(), document.quirks_mode(),
url_data: RwLock::new(window_from_node(self).get_url()), ),
source_map_url: RwLock::new(None),
source_url: RwLock::new(None),
},
media: Arc::new(shared_lock.wrap(MediaList::empty())), media: Arc::new(shared_lock.wrap(MediaList::empty())),
shared_lock: shared_lock.clone(), shared_lock: shared_lock.clone(),
disabled: AtomicBool::new(false), disabled: AtomicBool::new(false),

View file

@ -29,7 +29,6 @@ use net_traits::{
FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy, FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy,
}; };
use net_traits::{ResourceFetchTiming, ResourceTimingType}; use net_traits::{ResourceFetchTiming, ResourceTimingType};
use parking_lot::RwLock;
use servo_arc::Arc; use servo_arc::Arc;
use servo_url::ImmutableOrigin; use servo_url::ImmutableOrigin;
use servo_url::ServoUrl; use servo_url::ServoUrl;
@ -41,9 +40,7 @@ use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock}; use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::import_rule::ImportSheet; use style::stylesheets::import_rule::ImportSheet;
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use style::stylesheets::{ use style::stylesheets::{CssRules, ImportRule, Origin, Stylesheet, StylesheetContents};
CssRules, ImportRule, Namespaces, Origin, Stylesheet, StylesheetContents,
};
use style::values::CssUrl; use style::values::CssUrl;
pub trait StylesheetOwner { pub trait StylesheetOwner {
@ -363,15 +360,12 @@ impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> {
media: Arc<Locked<MediaList>>, media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> { ) -> Arc<Locked<ImportRule>> {
let sheet = Arc::new(Stylesheet { let sheet = Arc::new(Stylesheet {
contents: StylesheetContents { contents: StylesheetContents::from_shared_data(
rules: CssRules::new(Vec::new(), lock), CssRules::new(Vec::new(), lock),
origin: context.stylesheet_origin, context.stylesheet_origin,
url_data: RwLock::new(context.url_data.clone()), context.url_data.clone(),
quirks_mode: context.quirks_mode, context.quirks_mode,
namespaces: RwLock::new(Namespaces::default()), ),
source_map_url: RwLock::new(None),
source_url: RwLock::new(None),
},
media: media, media: media,
shared_lock: lock.clone(), shared_lock: lock.clone(),
disabled: AtomicBool::new(false), disabled: AtomicBool::new(false),