aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <infra@servo.org>2023-05-25 19:20:50 +0200
committerGitHub <noreply@github.com>2023-05-25 19:20:50 +0200
commit867326c46a4af0b85be9ba6c67cb18e8832480a5 (patch)
tree5ba77b27e901dbb837bdb6876813b847d56142cd /components/script
parent5af3d16cb312cba9a8423af1995c9b24fe6aa05b (diff)
parent05d697323d27390eaf5537ea074cd0fe25801837 (diff)
downloadservo-867326c46a4af0b85be9ba6c67cb18e8832480a5.tar.gz
servo-867326c46a4af0b85be9ba6c67cb18e8832480a5.zip
Auto merge of #29772 - Loirooriol:sync, r=mrobinson
Backport several style changes from Gecko (2) <!-- Please describe your changes on the following line: --> This continues #29748. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/element.rs6
-rw-r--r--components/script/dom/htmlmetaelement.rs16
-rw-r--r--components/script/stylesheet_loader.rs20
3 files changed, 16 insertions, 26 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index d8b80df754a..1ceec50281d 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -733,9 +733,9 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::FontFamily(font_family::SpecifiedValue::Values(
- computed::font::FontFamilyList::new(Box::new([
- computed::font::SingleFontFamily::from_atom(font_family),
- ])),
+ computed::font::FontFamilyList {
+ list: Box::new([computed::font::SingleFontFamily::from_atom(font_family)]),
+ },
)),
));
}
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index f91e4339f1d..168c29cdb0b 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -21,7 +21,6 @@ use crate::dom::node::{
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
-use parking_lot::RwLock;
use servo_arc::Arc;
use servo_config::pref;
use std::sync::atomic::AtomicBool;
@@ -112,15 +111,12 @@ impl HTMLMetaElement {
let shared_lock = document.style_shared_lock();
let rule = CssRule::Viewport(Arc::new(shared_lock.wrap(translated_rule)));
let sheet = Arc::new(Stylesheet {
- contents: StylesheetContents {
- rules: CssRules::new(vec![rule], shared_lock),
- origin: Origin::Author,
- namespaces: Default::default(),
- 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),
- },
+ contents: StylesheetContents::from_shared_data(
+ CssRules::new(vec![rule], shared_lock),
+ Origin::Author,
+ window_from_node(self).get_url(),
+ document.quirks_mode(),
+ ),
media: Arc::new(shared_lock.wrap(MediaList::empty())),
shared_lock: shared_lock.clone(),
disabled: AtomicBool::new(false),
diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs
index 20fa6872e49..48e3016458e 100644
--- a/components/script/stylesheet_loader.rs
+++ b/components/script/stylesheet_loader.rs
@@ -29,7 +29,6 @@ use net_traits::{
FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy,
};
use net_traits::{ResourceFetchTiming, ResourceTimingType};
-use parking_lot::RwLock;
use servo_arc::Arc;
use servo_url::ImmutableOrigin;
use servo_url::ServoUrl;
@@ -41,9 +40,7 @@ use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::import_rule::ImportSheet;
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
-use style::stylesheets::{
- CssRules, ImportRule, Namespaces, Origin, Stylesheet, StylesheetContents,
-};
+use style::stylesheets::{CssRules, ImportRule, Origin, Stylesheet, StylesheetContents};
use style::values::CssUrl;
pub trait StylesheetOwner {
@@ -363,15 +360,12 @@ impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> {
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> {
let sheet = Arc::new(Stylesheet {
- contents: StylesheetContents {
- rules: CssRules::new(Vec::new(), lock),
- origin: context.stylesheet_origin,
- url_data: RwLock::new(context.url_data.clone()),
- quirks_mode: context.quirks_mode,
- namespaces: RwLock::new(Namespaces::default()),
- source_map_url: RwLock::new(None),
- source_url: RwLock::new(None),
- },
+ contents: StylesheetContents::from_shared_data(
+ CssRules::new(Vec::new(), lock),
+ context.stylesheet_origin,
+ context.url_data.clone(),
+ context.quirks_mode,
+ ),
media: media,
shared_lock: lock.clone(),
disabled: AtomicBool::new(false),