style/stylesheets/loader.rs
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5//! The stylesheet loader is the abstraction used to trigger network requests
6//! for `@import` rules.
7
8use crate::media_queries::MediaList;
9use crate::shared_lock::{Locked, SharedRwLock};
10use crate::stylesheets::import_rule::{ImportLayer, ImportRule, ImportSupportsCondition};
11use crate::values::CssUrl;
12use cssparser::SourceLocation;
13use servo_arc::Arc;
14
15/// The stylesheet loader is the abstraction used to trigger network requests
16/// for `@import` rules.
17pub trait StylesheetLoader {
18 /// Request a stylesheet after parsing a given `@import` rule, and return
19 /// the constructed `@import` rule.
20 fn request_stylesheet(
21 &self,
22 url: CssUrl,
23 location: SourceLocation,
24 lock: &SharedRwLock,
25 media: Arc<Locked<MediaList>>,
26 supports: Option<ImportSupportsCondition>,
27 layer: ImportLayer,
28 ) -> Arc<Locked<ImportRule>>;
29}