Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random fixups #5992

Merged
merged 4 commits into from May 12, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -9,6 +9,7 @@ use selectors::matching::{SelectorMap, Rule};
use selectors::matching::DeclarationBlock as GenericDeclarationBlock;
use selectors::parser::PseudoElement;
use selectors::tree::TNode;
use std::process;
use util::resource_files::read_resource_file;
use util::smallvec::VecLike;

@@ -59,13 +60,21 @@ impl Stylist {
// 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"].iter() {
let ua_stylesheet = Stylesheet::from_bytes(
&read_resource_file(&[filename]).unwrap(),
Url::parse(&format!("chrome:///{:?}", filename)).unwrap(),
None,
None,
Origin::UserAgent);
stylist.add_stylesheet(ua_stylesheet);
match read_resource_file(&[filename]) {
Ok(res) => {
let ua_stylesheet = Stylesheet::from_bytes(
&res,
Url::parse(&format!("chrome:///{:?}", filename)).unwrap(),
None,
None,
Origin::UserAgent);
stylist.add_stylesheet(ua_stylesheet);
}
Err(..) => {
error!("Stylist::new() failed at loading {}!", filename);
process::exit(1);
}
}
}
stylist
}
@@ -154,12 +163,20 @@ impl Stylist {
}

pub fn add_quirks_mode_stylesheet(&mut self) {
self.add_stylesheet(Stylesheet::from_bytes(
&read_resource_file(&["quirks-mode.css"]).unwrap(),
Url::parse("chrome:///quirks-mode.css").unwrap(),
None,
None,
Origin::UserAgent))
match read_resource_file(&["quirks-mode.css"]) {
Ok(res) => {
self.add_stylesheet(Stylesheet::from_bytes(
&res,
Url::parse("chrome:///quirks-mode.css").unwrap(),
None,
None,
Origin::UserAgent));
}
Err(..) => {
error!("Stylist::add_quirks_mode_stylesheet() failed at loading 'quirks-mode.css'!");
process::exit(1);
}
}
}

pub fn add_stylesheet(&mut self, stylesheet: Stylesheet) {
@@ -25,14 +25,23 @@ pub fn resources_dir_path() -> PathBuf {
// or `<servo source>/components/servo/target/release`.
let mut path = env::current_exe().ok().expect("can't get exe path");
path.pop();
path.pop();
path.pop();
path.pop();
path.push("resources");
if !path.is_dir() { // self_exe_path() is probably in .../target/release
if !path.is_dir() { // resources dir not in same dir as exe?
path.pop();
path.pop();
path.pop();
path.pop();
path.push("resources");
if !path.is_dir() { // self_exe_path() is probably in .../target/release
path.pop();
path.pop();
path.push("resources");
if !path.is_dir() { // self_exe_path() is probably in .../target/release
path.pop();
path.pop();
path.push("resources");
}
}
}
path
}
@@ -27,15 +27,6 @@ static CEF_API_HASH_PLATFORM: &'static [u8] = b"6813214accbf2ebfb6bdcf8d00654650
#[cfg(target_os="linux")]
static CEF_API_HASH_PLATFORM: &'static [u8] = b"2bc564c3871965ef3a2531b528bda3e17fa17a6d\0";

#[cfg(target_os="linux")]
fn resources_path() -> Option<String> {
Some("../../servo/resources".to_owned())
}

#[cfg(not(target_os="linux"))]
fn resources_path() -> Option<String> {
None
}

#[no_mangle]
pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
@@ -77,7 +68,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
temp_opts.headless = false;
temp_opts.hard_fail = false;
temp_opts.enable_text_antialiasing = true;
temp_opts.resources_path = resources_path();
temp_opts.resources_path = None;
opts::set(temp_opts);

return 1
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.