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::parser::ParserContext;
10use crate::shared_lock::{Locked, SharedRwLock};
11use crate::stylesheets::import_rule::{ImportLayer, ImportRule, ImportSupportsCondition};
12use crate::values::CssUrl;
13use cssparser::SourceLocation;
14use servo_arc::Arc;
15
16/// The stylesheet loader is the abstraction used to trigger network requests
17/// for `@import` rules.
18pub trait StylesheetLoader {
19    /// Request a stylesheet after parsing a given `@import` rule, and return
20    /// the constructed `@import` rule.
21    fn request_stylesheet(
22        &self,
23        url: CssUrl,
24        location: SourceLocation,
25        context: &ParserContext,
26        lock: &SharedRwLock,
27        media: Arc<Locked<MediaList>>,
28        supports: Option<ImportSupportsCondition>,
29        layer: ImportLayer,
30    ) -> Arc<Locked<ImportRule>>;
31}