mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Stop using servo UA stylesheets for geckolib.
Gecko will provide these. This also removes the need to reference the servo resource directory.
This commit is contained in:
parent
c4aa7cd862
commit
4da1171474
4 changed files with 9 additions and 64 deletions
|
@ -19,7 +19,7 @@ pub trait SelectorImplExt : SelectorImpl + Sized {
|
|||
|
||||
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet<Self>];
|
||||
|
||||
fn get_quirks_mode_stylesheet() -> &'static Stylesheet<Self>;
|
||||
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)]
|
||||
|
@ -135,7 +135,7 @@ impl SelectorImplExt for ServoSelectorImpl {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_quirks_mode_stylesheet() -> &'static Stylesheet<Self> {
|
||||
&*QUIRKS_MODE_STYLESHEET
|
||||
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet<Self>> {
|
||||
Some(&*QUIRKS_MODE_STYLESHEET)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,9 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
|||
}
|
||||
|
||||
if self.quirks_mode {
|
||||
self.add_stylesheet(&Impl::get_quirks_mode_stylesheet());
|
||||
if let Some(s) = Impl::get_quirks_mode_stylesheet() {
|
||||
self.add_stylesheet(s);
|
||||
}
|
||||
}
|
||||
|
||||
for ref stylesheet in doc_stylesheets.iter() {
|
||||
|
|
|
@ -22,7 +22,6 @@ use style::stylesheets::Origin;
|
|||
use traversal::RecalcStyleOnly;
|
||||
use url::Url;
|
||||
use util::arc_ptr_eq;
|
||||
use util::resource_files::set_resources_path;
|
||||
use wrapper::{GeckoDocument, GeckoNode, NonOpaqueStyleData};
|
||||
|
||||
/*
|
||||
|
@ -42,10 +41,6 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
|||
};
|
||||
let data = unsafe { &mut *(raw_data as *mut PerDocumentStyleData) };
|
||||
|
||||
// FIXME(bholley): Don't hardcode resources path. We may want to use Gecko's UA stylesheets
|
||||
// anyway.
|
||||
set_resources_path(Some("/files/mozilla/stylo/servo/resources/".to_owned()));
|
||||
|
||||
let _needs_dirtying = data.stylist.update(&data.stylesheets, data.stylesheets_changed);
|
||||
data.stylesheets_changed = false;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ use style::error_reporting::StdoutErrorReporter;
|
|||
use style::selector_impl::SelectorImplExt;
|
||||
use style::stylesheets::Origin;
|
||||
use url::Url;
|
||||
use util::resource_files::read_resource_file;
|
||||
|
||||
pub type Stylist = style::selector_matching::Stylist<GeckoSelectorImpl>;
|
||||
pub type Stylesheet = style::stylesheets::Stylesheet<GeckoSelectorImpl>;
|
||||
|
@ -19,56 +18,6 @@ pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl>;
|
|||
|
||||
pub struct GeckoSelectorImpl;
|
||||
|
||||
// TODO: Replace this with Gecko's stylesheets
|
||||
lazy_static! {
|
||||
static ref USER_OR_USER_AGENT_STYLESHEETS: Vec<Stylesheet> = {
|
||||
let mut stylesheets = vec!();
|
||||
// FIXME: presentational-hints.css should be at author origin with zero specificity.
|
||||
// (Does it make a difference?)
|
||||
for &filename in &["user-agent.css", "servo.css", "presentational-hints.css"] {
|
||||
match read_resource_file(&[filename]) {
|
||||
Ok(res) => {
|
||||
let ua_stylesheet = Stylesheet::from_bytes(
|
||||
&res,
|
||||
Url::parse(&format!("chrome:///{:?}", filename)).unwrap(),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent,
|
||||
box StdoutErrorReporter);
|
||||
stylesheets.push(ua_stylesheet);
|
||||
}
|
||||
Err(..) => {
|
||||
error!("Failed to load UA stylesheet {}!", filename);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stylesheets
|
||||
};
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref QUIRKS_MODE_STYLESHEET: Stylesheet = {
|
||||
match read_resource_file(&["quirks-mode.css"]) {
|
||||
Ok(res) => {
|
||||
Stylesheet::from_bytes(
|
||||
&res,
|
||||
url!("chrome:///quirks-mode.css"),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent,
|
||||
box StdoutErrorReporter)
|
||||
},
|
||||
Err(..) => {
|
||||
error!("Stylist failed to load 'quirks-mode.css'!");
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)]
|
||||
pub enum PseudoElement {
|
||||
Before,
|
||||
|
@ -294,14 +243,13 @@ impl SelectorImplExt for GeckoSelectorImpl {
|
|||
pc.state_flag()
|
||||
}
|
||||
|
||||
// FIXME: Don't use Servo's UA stylesheets, use Gecko's instead
|
||||
#[inline]
|
||||
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet] {
|
||||
&*USER_OR_USER_AGENT_STYLESHEETS
|
||||
&[]
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_quirks_mode_stylesheet() -> &'static Stylesheet {
|
||||
&*QUIRKS_MODE_STYLESHEET
|
||||
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue