diff --git a/resources/details.css b/components/layout/stylesheets/details.css similarity index 100% rename from resources/details.css rename to components/layout/stylesheets/details.css diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index d6dacac911b..1db5d035c94 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -5,10 +5,9 @@ use std::cell::{Cell, Ref}; use dom_struct::dom_struct; -use embedder_traits::resources::Resource; use html5ever::{LocalName, Prefix, local_name}; use js::rust::HandleObject; -use script_layout_interface::parse_resource_stylesheet; +use script_layout_interface::parse_details_stylesheet; use style::attr::AttrValue; use super::element::ElementCreator; @@ -138,12 +137,11 @@ impl HTMLDetailsElement { .AppendChild(link_element.upcast::(), can_gc) .unwrap(); - let details_stylesheet = parse_resource_stylesheet( + let details_stylesheet = parse_details_stylesheet( link_element .upcast::() .owner_doc() .style_shared_lock(), - Resource::DetailsCSS, ); link_element.set_stylesheet(details_stylesheet.unwrap()); diff --git a/components/shared/embedder/resources.rs b/components/shared/embedder/resources.rs index 7716fd20c92..28464a95d1a 100644 --- a/components/shared/embedder/resources.rs +++ b/components/shared/embedder/resources.rs @@ -66,7 +66,6 @@ pub fn sandbox_access_files_dirs() -> Vec { .unwrap_or_default() } -#[derive(Clone)] pub enum Resource { /// A list of GATT services that are blocked from being used by web bluetooth. /// The format of the file is a list of UUIDs, one per line, with an optional second word to specify the @@ -110,9 +109,6 @@ pub enum Resource { DirectoryListingHTML, /// A HTML page that is used for the about:memory url. AboutMemoryHTML, - /// A CSS file to style the elements inside
element UA Shadow Tree. - /// It can be empty but then
element simply wouldn't work. - DetailsCSS, } impl Resource { @@ -127,7 +123,6 @@ impl Resource { Resource::CrashHTML => "crash.html", Resource::DirectoryListingHTML => "directory-listing.html", Resource::AboutMemoryHTML => "about-memory.html", - Resource::DetailsCSS => "details.css", } } } @@ -172,7 +167,6 @@ fn resources_for_tests() -> Box { Resource::AboutMemoryHTML => { &include_bytes!("../../../resources/about-memory.html")[..] }, - Resource::DetailsCSS => &include_bytes!("../../../resources/details.css")[..], } .to_owned() } diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs index ac521c622c9..37d05c31286 100644 --- a/components/shared/script_layout/lib.rs +++ b/components/shared/script_layout/lib.rs @@ -20,7 +20,6 @@ use base::Epoch; use base::id::{BrowsingContextId, PipelineId, WebViewId}; use compositing_traits::CrossProcessCompositorApi; use constellation_traits::{LoadData, ScrollState}; -use embedder_traits::resources::{self, Resource}; use embedder_traits::{Theme, UntrustedNodeAddress, ViewportDetails}; use euclid::default::{Point2D, Rect}; use fnv::FnvHashMap; @@ -54,6 +53,9 @@ use url::Url; use webrender_api::ImageKey; use webrender_api::units::DeviceIntSize; +/// A CSS file to style
element. +static DETAILS_CSS: &[u8] = include_bytes!("../../layout/stylesheets/details.css"); + pub trait GenericLayoutDataTrait: Any + MallocSizeOfTrait { fn as_any(&self) -> &dyn Any; } @@ -671,10 +673,8 @@ pub fn parse_ua_stylesheet( .map(DocumentStyleSheet) } -pub fn parse_resource_stylesheet( +pub fn parse_details_stylesheet( shared_lock: &SharedRwLock, - resources: Resource, ) -> Result, &'static str> { - let content = &resources::read_bytes(resources.clone()); - parse_stylesheet_as_origin(shared_lock, resources.filename(), content, Origin::Author) + parse_stylesheet_as_origin(shared_lock, "details.css", DETAILS_CSS, Origin::Author) }