mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #7013 - servo:user-stylesheets, r=mbrubeck
Make the Ahem font available to test-css and test-wpt tests. Add support for user stylesheets, and provide one to tests with an `@font-face` rule for it. Fix #6195. Many previously-failing tests now pass, and a few previously-passing now fail. Among the latter, `font-family-013.htm` and `fonts-013.htm` are testing that the Ahem font is not used for characters it doesn’t have a glyph for. They were passing because Ahem was not available at all, and now fail because we don’t implement font fallback correctly. The others also use Ahem, but I don’t understand yet what’s going on exactly. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7013) <!-- Reviewable:end -->
This commit is contained in:
commit
08987e3eda
505 changed files with 173 additions and 1536 deletions
|
@ -297,6 +297,14 @@ impl<'a> DerefMut for RWGuard<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_font_face_rules(stylesheet: &Stylesheet, device: &Device, font_cache_task: &FontCacheTask) {
|
||||||
|
for font_face in stylesheet.effective_rules(&device).font_face() {
|
||||||
|
for source in font_face.sources.iter() {
|
||||||
|
font_cache_task.add_web_font(font_face.family.clone(), source.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl LayoutTask {
|
impl LayoutTask {
|
||||||
/// Creates a new `LayoutTask` structure.
|
/// Creates a new `LayoutTask` structure.
|
||||||
fn new(id: PipelineId,
|
fn new(id: PipelineId,
|
||||||
|
@ -336,6 +344,11 @@ impl LayoutTask {
|
||||||
let image_cache_receiver =
|
let image_cache_receiver =
|
||||||
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_image_cache_receiver);
|
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_image_cache_receiver);
|
||||||
|
|
||||||
|
let stylist = box Stylist::new(device);
|
||||||
|
for user_or_user_agent_stylesheet in stylist.stylesheets() {
|
||||||
|
add_font_face_rules(user_or_user_agent_stylesheet, &stylist.device, &font_cache_task);
|
||||||
|
}
|
||||||
|
|
||||||
LayoutTask {
|
LayoutTask {
|
||||||
id: id,
|
id: id,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -362,7 +375,7 @@ impl LayoutTask {
|
||||||
constellation_chan: constellation_chan,
|
constellation_chan: constellation_chan,
|
||||||
screen_size: screen_size,
|
screen_size: screen_size,
|
||||||
stacking_context: None,
|
stacking_context: None,
|
||||||
stylist: box Stylist::new(device),
|
stylist: stylist,
|
||||||
parallel_traversal: parallel_traversal,
|
parallel_traversal: parallel_traversal,
|
||||||
dirty: Rect::zero(),
|
dirty: Rect::zero(),
|
||||||
generation: 0,
|
generation: 0,
|
||||||
|
@ -735,11 +748,7 @@ impl LayoutTask {
|
||||||
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
|
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
|
||||||
|
|
||||||
if mq.evaluate(&rw_data.stylist.device) {
|
if mq.evaluate(&rw_data.stylist.device) {
|
||||||
for font_face in sheet.effective_rules(&rw_data.stylist.device).font_face() {
|
add_font_face_rules(&sheet, &rw_data.stylist.device, &self.font_cache_task);
|
||||||
for source in font_face.sources.iter() {
|
|
||||||
self.font_cache_task.add_web_font(font_face.family.clone(), source.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rw_data.stylist.add_stylesheet(sheet);
|
rw_data.stylist.add_stylesheet(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
components/servo/Cargo.lock
generated
9
components/servo/Cargo.lock
generated
|
@ -462,6 +462,14 @@ dependencies = [
|
||||||
"winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getopts"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gfx"
|
name = "gfx"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
@ -1521,6 +1529,7 @@ dependencies = [
|
||||||
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"html5ever 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"html5ever 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
|
||||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||||
|
|
|
@ -12,6 +12,7 @@ use selectors::Element;
|
||||||
use std::process;
|
use std::process;
|
||||||
use smallvec::VecLike;
|
use smallvec::VecLike;
|
||||||
use util::resource_files::read_resource_file;
|
use util::resource_files::read_resource_file;
|
||||||
|
use util::opts;
|
||||||
|
|
||||||
use legacy::PresentationalHintSynthesis;
|
use legacy::PresentationalHintSynthesis;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
|
@ -76,9 +77,18 @@ impl Stylist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for &(ref contents, ref url) in &opts::get().user_stylesheets {
|
||||||
|
stylist.add_stylesheet(Stylesheet::from_bytes(
|
||||||
|
&contents, url.clone(), None, None, Origin::User));
|
||||||
|
}
|
||||||
stylist
|
stylist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn stylesheets(&self) -> &[Stylesheet] {
|
||||||
|
&self.stylesheets
|
||||||
|
}
|
||||||
|
|
||||||
pub fn constrain_viewport(&self) -> Option<ViewportConstraints> {
|
pub fn constrain_viewport(&self) -> Option<ViewportConstraints> {
|
||||||
let cascaded_rule = self.stylesheets.iter()
|
let cascaded_rule = self.stylesheets.iter()
|
||||||
.flat_map(|s| s.effective_rules(&self.device).viewport())
|
.flat_map(|s| s.effective_rules(&self.device).viewport())
|
||||||
|
|
|
@ -53,3 +53,4 @@ serde = "0.4"
|
||||||
serde_macros = "0.4"
|
serde_macros = "0.4"
|
||||||
string_cache = "0.1"
|
string_cache = "0.1"
|
||||||
lazy_static = "0.1"
|
lazy_static = "0.1"
|
||||||
|
getopts = "0.2.11"
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
#![feature(path_ext)]
|
#![feature(path_ext)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![feature(rustc_private)]
|
|
||||||
#![feature(slice_splits)]
|
#![feature(slice_splits)]
|
||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(step_trait)]
|
#![feature(step_trait)]
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
use geometry::ScreenPx;
|
use geometry::ScreenPx;
|
||||||
|
|
||||||
use euclid::size::{Size2D, TypedSize2D};
|
use euclid::size::{Size2D, TypedSize2D};
|
||||||
use getopts;
|
use getopts::Options;
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::fs::PathExt;
|
use std::fs::{File, PathExt};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
|
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
|
||||||
|
@ -66,6 +66,8 @@ pub struct Opts {
|
||||||
/// won't be loaded
|
/// won't be loaded
|
||||||
pub userscripts: Option<String>,
|
pub userscripts: Option<String>,
|
||||||
|
|
||||||
|
pub user_stylesheets: Vec<(Vec<u8>, Url)>,
|
||||||
|
|
||||||
pub output_file: Option<String>,
|
pub output_file: Option<String>,
|
||||||
|
|
||||||
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
||||||
|
@ -172,9 +174,9 @@ pub struct Opts {
|
||||||
pub exit_after_load: bool,
|
pub exit_after_load: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
|
fn print_usage(app: &str, opts: &Options) {
|
||||||
let message = format!("Usage: {} [ options ... ] [URL]\n\twhere options include", app);
|
let message = format!("Usage: {} [ options ... ] [URL]\n\twhere options include", app);
|
||||||
println!("{}", getopts::usage(&message, opts));
|
println!("{}", opts.usage(&message));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_debug_usage(app: &str) -> ! {
|
pub fn print_debug_usage(app: &str) -> ! {
|
||||||
|
@ -241,6 +243,7 @@ pub fn default_opts() -> Opts {
|
||||||
nonincremental_layout: false,
|
nonincremental_layout: false,
|
||||||
nossl: false,
|
nossl: false,
|
||||||
userscripts: None,
|
userscripts: None,
|
||||||
|
user_stylesheets: Vec::new(),
|
||||||
output_file: None,
|
output_file: None,
|
||||||
replace_surrogates: false,
|
replace_surrogates: false,
|
||||||
gc_profile: false,
|
gc_profile: false,
|
||||||
|
@ -278,37 +281,38 @@ pub fn default_opts() -> Opts {
|
||||||
pub fn from_cmdline_args(args: &[String]) {
|
pub fn from_cmdline_args(args: &[String]) {
|
||||||
let (app_name, args) = args.split_first().unwrap();
|
let (app_name, args) = args.split_first().unwrap();
|
||||||
|
|
||||||
let opts = vec!(
|
let mut opts = Options::new();
|
||||||
getopts::optflag("c", "cpu", "CPU painting (default)"),
|
opts.optflag("c", "cpu", "CPU painting (default)");
|
||||||
getopts::optflag("g", "gpu", "GPU painting"),
|
opts.optflag("g", "gpu", "GPU painting");
|
||||||
getopts::optopt("o", "output", "Output file", "output.png"),
|
opts.optopt("o", "output", "Output file", "output.png");
|
||||||
getopts::optopt("s", "size", "Size of tiles", "512"),
|
opts.optopt("s", "size", "Size of tiles", "512");
|
||||||
getopts::optopt("", "device-pixel-ratio", "Device pixels per px", ""),
|
opts.optopt("", "device-pixel-ratio", "Device pixels per px", "");
|
||||||
getopts::optflag("e", "experimental", "Enable experimental web features"),
|
opts.optflag("e", "experimental", "Enable experimental web features");
|
||||||
getopts::optopt("t", "threads", "Number of paint threads", "1"),
|
opts.optopt("t", "threads", "Number of paint threads", "1");
|
||||||
getopts::optflagopt("p", "profile", "Profiler flag and output interval", "10"),
|
opts.optflagopt("p", "profile", "Profiler flag and output interval", "10");
|
||||||
getopts::optflagopt("m", "memory-profile", "Memory profiler flag and output interval", "10"),
|
opts.optflagopt("m", "memory-profile", "Memory profiler flag and output interval", "10");
|
||||||
getopts::optflag("x", "exit", "Exit after load flag"),
|
opts.optflag("x", "exit", "Exit after load flag");
|
||||||
getopts::optopt("y", "layout-threads", "Number of threads to use for layout", "1"),
|
opts.optopt("y", "layout-threads", "Number of threads to use for layout", "1");
|
||||||
getopts::optflag("i", "nonincremental-layout", "Enable to turn off incremental layout."),
|
opts.optflag("i", "nonincremental-layout", "Enable to turn off incremental layout.");
|
||||||
getopts::optflag("", "no-ssl", "Disables ssl certificate verification."),
|
opts.optflag("", "no-ssl", "Disables ssl certificate verification.");
|
||||||
getopts::optflagopt("", "userscripts",
|
opts.optflagopt("", "userscripts",
|
||||||
"Uses userscripts in resources/user-agent-js, or a specified full path",""),
|
"Uses userscripts in resources/user-agent-js, or a specified full path","");
|
||||||
getopts::optflag("z", "headless", "Headless mode"),
|
opts.optmulti("", "user-stylesheet",
|
||||||
getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"),
|
"A user stylesheet to be added to every document", "file.css");
|
||||||
getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"),
|
opts.optflag("z", "headless", "Headless mode");
|
||||||
getopts::optflagopt("", "webdriver", "Start remote WebDriver server on port", "7000"),
|
opts.optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure");
|
||||||
getopts::optopt("", "resolution", "Set window resolution.", "800x600"),
|
opts.optflagopt("", "devtools", "Start remote devtools server on port", "6000");
|
||||||
getopts::optopt("u", "user-agent", "Set custom user agent string", "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"),
|
opts.optflagopt("", "webdriver", "Start remote WebDriver server on port", "7000");
|
||||||
getopts::optflag("M", "multiprocess", "Run in multiprocess mode"),
|
opts.optopt("", "resolution", "Set window resolution.", "800x600");
|
||||||
getopts::optopt("Z", "debug",
|
opts.optopt("u", "user-agent", "Set custom user agent string", "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)");
|
||||||
"A comma-separated string of debug options. Pass help to show available options.", ""),
|
opts.optflag("M", "multiprocess", "Run in multiprocess mode");
|
||||||
getopts::optflag("h", "help", "Print this message"),
|
opts.optopt("Z", "debug",
|
||||||
getopts::optopt("", "resources-path", "Path to find static resources", "/home/servo/resources"),
|
"A comma-separated string of debug options. Pass help to show available options.", "");
|
||||||
getopts::optflag("", "sniff-mime-types" , "Enable MIME sniffing"),
|
opts.optflag("h", "help", "Print this message");
|
||||||
);
|
opts.optopt("", "resources-path", "Path to find static resources", "/home/servo/resources");
|
||||||
|
opts.optflag("", "sniff-mime-types" , "Enable MIME sniffing");
|
||||||
|
|
||||||
let opt_match = match getopts::getopts(args, &opts) {
|
let opt_match = match opts.parse(args) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => args_fail(&f.to_string()),
|
Err(f) => args_fail(&f.to_string()),
|
||||||
};
|
};
|
||||||
|
@ -330,12 +334,12 @@ pub fn from_cmdline_args(args: &[String]) {
|
||||||
print_debug_usage(app_name)
|
print_debug_usage(app_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cwd = env::current_dir().unwrap();
|
||||||
let url = if opt_match.free.is_empty() {
|
let url = if opt_match.free.is_empty() {
|
||||||
print_usage(app_name, &opts);
|
print_usage(app_name, &opts);
|
||||||
args_fail("servo asks that you provide a URL")
|
args_fail("servo asks that you provide a URL")
|
||||||
} else {
|
} else {
|
||||||
let ref url = opt_match.free[0];
|
let ref url = opt_match.free[0];
|
||||||
let cwd = env::current_dir().unwrap();
|
|
||||||
match Url::parse(url) {
|
match Url::parse(url) {
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
Err(url::ParseError::RelativeUrlWithoutBase) => {
|
Err(url::ParseError::RelativeUrlWithoutBase) => {
|
||||||
|
@ -407,6 +411,17 @@ pub fn from_cmdline_args(args: &[String]) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let user_stylesheets = opt_match.opt_strs("user-stylesheet").iter().map(|filename| {
|
||||||
|
let path = cwd.join(filename);
|
||||||
|
let url = Url::from_file_path(&path).unwrap();
|
||||||
|
let mut contents = Vec::new();
|
||||||
|
File::open(path)
|
||||||
|
.unwrap_or_else(|err| args_fail(&format!("Couldn’t open {}: {}", filename, err)))
|
||||||
|
.read_to_end(&mut contents)
|
||||||
|
.unwrap_or_else(|err| args_fail(&format!("Couldn’t read {}: {}", filename, err)));
|
||||||
|
(contents, url)
|
||||||
|
}).collect();
|
||||||
|
|
||||||
let opts = Opts {
|
let opts = Opts {
|
||||||
url: Some(url),
|
url: Some(url),
|
||||||
paint_threads: paint_threads,
|
paint_threads: paint_threads,
|
||||||
|
@ -420,6 +435,7 @@ pub fn from_cmdline_args(args: &[String]) {
|
||||||
nonincremental_layout: nonincremental_layout,
|
nonincremental_layout: nonincremental_layout,
|
||||||
nossl: nossl,
|
nossl: nossl,
|
||||||
userscripts: opt_match.opt_default("userscripts", ""),
|
userscripts: opt_match.opt_default("userscripts", ""),
|
||||||
|
user_stylesheets: user_stylesheets,
|
||||||
output_file: opt_match.opt_str("o"),
|
output_file: opt_match.opt_str("o"),
|
||||||
replace_surrogates: debug_options.contains(&"replace-surrogates"),
|
replace_surrogates: debug_options.contains(&"replace-surrogates"),
|
||||||
gc_profile: debug_options.contains(&"gc-profile"),
|
gc_profile: debug_options.contains(&"gc-profile"),
|
||||||
|
|
4
resources/ahem.css
Normal file
4
resources/ahem.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: Ahem;
|
||||||
|
src: url(ahem/AHEM____.TTF);
|
||||||
|
}
|
1
resources/ahem/Ahem.ps
Normal file
1
resources/ahem/Ahem.ps
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/ahem/Ahem.sit
Normal file
BIN
resources/ahem/Ahem.sit
Normal file
Binary file not shown.
1
resources/ahem/COPIED-FROM
Normal file
1
resources/ahem/COPIED-FROM
Normal file
|
@ -0,0 +1 @@
|
||||||
|
The files in this directory are copied from http://www.w3.org/Style/CSS/Test/Fonts/Ahem/
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(../fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
font-size: 100px;
|
font-size: 100px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url('fonts/ahem/ahem.ttf');
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
font-size: 100px;
|
font-size: 100px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url('fonts/ahem/ahem.ttf');
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
font-size: 100px;
|
font-size: 100px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
.fr {
|
.fr {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
font-size: 400px;
|
font-size: 400px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
font-size: 100px;
|
font-size: 100px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
.large-border {
|
.large-border {
|
||||||
border-left: 100px solid red;
|
border-left: 100px solid red;
|
||||||
border-right: 100px solid blue;
|
border-right: 100px solid blue;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
<head>
|
<head>
|
||||||
<!-- Tests that font fallback occurs on a per-glyph basis. -->
|
<!-- Tests that font fallback occurs on a per-glyph basis. -->
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Ahem, sans-serif;
|
font-family: Ahem, sans-serif;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
<head>
|
<head>
|
||||||
<!-- Tests that font fallback occurs on a per-glyph basis. -->
|
<!-- Tests that font fallback occurs on a per-glyph basis. -->
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Ahem, sans-serif;
|
font-family: Ahem, sans-serif;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@font-face {
|
|
||||||
font-family: 'ahem';
|
|
||||||
src: url(fonts/ahem/ahem.ttf);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: 'ahem';
|
font-family: 'ahem';
|
||||||
|
|
2
tests/reftest.rs
vendored
2
tests/reftest.rs
vendored
|
@ -19,6 +19,7 @@
|
||||||
extern crate png;
|
extern crate png;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
extern crate util;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
@ -257,6 +258,7 @@ fn capture(reftest: &Reftest, side: usize) -> (u32, u32, Vec<u8>) {
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
.args(&reftest.servo_args[..])
|
.args(&reftest.servo_args[..])
|
||||||
|
.arg("--user-stylesheet").arg(util::resource_files::resources_dir_path().join("ahem.css"))
|
||||||
// Allows pixel perfect rendering of Ahem font and the HTML canvas for reftests.
|
// Allows pixel perfect rendering of Ahem font and the HTML canvas for reftests.
|
||||||
.arg("-Z")
|
.arg("-Z")
|
||||||
.arg("disable-text-aa,disable-canvas-aa")
|
.arg("disable-text-aa,disable-canvas-aa")
|
||||||
|
|
|
@ -142,7 +142,7 @@ Reftest results can be analyzed from a raw log file. To generate this run
|
||||||
with the `--log-raw` option e.g.
|
with the `--log-raw` option e.g.
|
||||||
|
|
||||||
./mach test-css --log-raw css.log
|
./mach test-css --log-raw css.log
|
||||||
|
|
||||||
This file can then be fed into the
|
This file can then be fed into the
|
||||||
[reftest analyzer](http://hoppipolla.co.uk/410/reftest-analyser-structured.xhtml)
|
[reftest analyzer](http://hoppipolla.co.uk/410/reftest-analyser-structured.xhtml)
|
||||||
which will show all failing tests (not just those with unexpected results).
|
which will show all failing tests (not just those with unexpected results).
|
||||||
|
|
|
@ -26,7 +26,8 @@ def check_args(**kwargs):
|
||||||
|
|
||||||
def browser_kwargs(**kwargs):
|
def browser_kwargs(**kwargs):
|
||||||
return {"binary": kwargs["binary"],
|
return {"binary": kwargs["binary"],
|
||||||
"debug_info": kwargs["debug_info"]}
|
"debug_info": kwargs["debug_info"],
|
||||||
|
"user_stylesheets": kwargs.get("user_stylesheets")}
|
||||||
|
|
||||||
|
|
||||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||||
|
@ -44,11 +45,13 @@ def env_options():
|
||||||
|
|
||||||
|
|
||||||
class ServoBrowser(NullBrowser):
|
class ServoBrowser(NullBrowser):
|
||||||
def __init__(self, logger, binary, debug_info=None):
|
def __init__(self, logger, binary, debug_info=None, user_stylesheets=None):
|
||||||
NullBrowser.__init__(self, logger)
|
NullBrowser.__init__(self, logger)
|
||||||
self.binary = binary
|
self.binary = binary
|
||||||
self.debug_info = debug_info
|
self.debug_info = debug_info
|
||||||
|
self.user_stylesheets = user_stylesheets or []
|
||||||
|
|
||||||
def executor_browser(self):
|
def executor_browser(self):
|
||||||
return ExecutorBrowser, {"binary": self.binary,
|
return ExecutorBrowser, {"binary": self.binary,
|
||||||
"debug_info": self.debug_info}
|
"debug_info": self.debug_info,
|
||||||
|
"user_stylesheets": self.user_stylesheets}
|
||||||
|
|
|
@ -62,9 +62,10 @@ class ServoTestharnessExecutor(ProcessTestExecutor):
|
||||||
self.result_data = None
|
self.result_data = None
|
||||||
self.result_flag = threading.Event()
|
self.result_flag = threading.Event()
|
||||||
|
|
||||||
debug_args, command = browser_command(self.binary,
|
args = ["--cpu", "--hard-fail", "-u", "Servo/wptrunner", "-z", self.test_url(test)]
|
||||||
["--cpu", "--hard-fail", "-u", "Servo/wptrunner", "-z", self.test_url(test)],
|
for stylesheet in self.browser.user_stylesheets:
|
||||||
self.debug_info)
|
args += ["--user-stylesheet", stylesheet]
|
||||||
|
debug_args, command = browser_command(self.binary, args, self.debug_info)
|
||||||
|
|
||||||
self.command = command
|
self.command = command
|
||||||
|
|
||||||
|
@ -192,6 +193,8 @@ class ServoRefTestExecutor(ProcessTestExecutor):
|
||||||
self.command = [self.binary, "--cpu", "--hard-fail", "--exit",
|
self.command = [self.binary, "--cpu", "--hard-fail", "--exit",
|
||||||
"-u", "Servo/wptrunner", "-Z", "disable-text-aa",
|
"-u", "Servo/wptrunner", "-Z", "disable-text-aa",
|
||||||
"--output=%s" % output_path, full_url]
|
"--output=%s" % output_path, full_url]
|
||||||
|
for stylesheet in self.browser.user_stylesheets:
|
||||||
|
self.command += ["--user-stylesheet", stylesheet]
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["HOST_FILE"] = self.hosts_path
|
env["HOST_FILE"] = self.hosts_path
|
||||||
|
|
|
@ -159,6 +159,11 @@ def create_parser(product_choices=None):
|
||||||
b2g_group.add_argument("--b2g-no-backup", action="store_true", default=False,
|
b2g_group.add_argument("--b2g-no-backup", action="store_true", default=False,
|
||||||
help="Don't backup device before testrun with --product=b2g")
|
help="Don't backup device before testrun with --product=b2g")
|
||||||
|
|
||||||
|
servo_group = parser.add_argument_group("Servo-specific")
|
||||||
|
servo_group.add_argument("--user-stylesheet",
|
||||||
|
default=[], action="append", dest="user_stylesheets",
|
||||||
|
help="Inject a user CSS stylesheet into every test.")
|
||||||
|
|
||||||
parser.add_argument("test_list", nargs="*",
|
parser.add_argument("test_list", nargs="*",
|
||||||
help="List of URLs for tests to run, or paths including tests to run. "
|
help="List of URLs for tests to run, or paths including tests to run. "
|
||||||
"(equivalent to --include)")
|
"(equivalent to --include)")
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-121.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-153.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-169.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-185.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-201.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vlr-217.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-014.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-038.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-050.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-062.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-074.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-086.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-120.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-152.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-168.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-184.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-200.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[abs-pos-non-replaced-vrl-216.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-height-002.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-height-007.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-max-height-002.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-003.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-004.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-006.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-008.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-010.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-011.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-013.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-014.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[absolute-non-replaced-width-016.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[anonymous-boxes-inheritance-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-049.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-052.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-053.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-054.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-070.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-073.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-074.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-075.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-090.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-093.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-094.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-095.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-110.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-113.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-114.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[background-color-115.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-010.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-011.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-012.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-014.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-015.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-016.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-017.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-018.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-023.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-024.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-025.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-026.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-027.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-028.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-029.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-030.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[bidi-box-model-032.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue