From 0809809c23d91c8646b8eaa528e47af4d5b874cd Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 12 Aug 2016 16:15:15 -0700 Subject: [PATCH] Add test for #11818 --- components/constellation/pipeline.rs | 5 ++-- components/util/opts.rs | 29 ++++++++++--------- .../wptrunner/executors/executorservo.py | 4 +-- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++ .../meta/css/direction_style_caching.html.ini | 3 ++ .../tests/css/direction_style_caching.html | 28 ++++++++++++++++++ .../css/direction_style_caching_ref.html | 19 ++++++++++++ 7 files changed, 95 insertions(+), 17 deletions(-) create mode 100644 tests/wpt/mozilla/meta/css/direction_style_caching.html.ini create mode 100644 tests/wpt/mozilla/tests/css/direction_style_caching.html create mode 100644 tests/wpt/mozilla/tests/css/direction_style_caching_ref.html diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 677068b2d58..efd5c377875 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -162,7 +162,7 @@ impl Pipeline { pipeline_port: pipeline_port, layout_to_constellation_chan: state.layout_to_constellation_chan.clone(), content_process_shutdown_chan: layout_content_process_shutdown_chan.clone(), - layout_threads: opts::get().layout_threads, + layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize, }; if let Err(e) = script_chan.send(ConstellationControlMsg::AttachLayout(new_layout_info)) { @@ -474,7 +474,8 @@ impl UnprivilegedPipelineContent { self.mem_profiler_chan, self.layout_content_process_shutdown_chan, self.webrender_api_sender, - opts::get().layout_threads); + self.prefs.get("layout.threads").expect("exists").value() + .as_u64().expect("count") as usize); if wait_for_completion { let _ = self.script_content_process_shutdown_port.recv(); diff --git a/components/util/opts.rs b/components/util/opts.rs index 6395e134147..e49775d3480 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -55,10 +55,6 @@ pub struct Opts { /// and cause it to produce output on that interval (`-m`). pub mem_profiler_period: Option, - /// The number of threads to use for layout (`-y`). Defaults to 1, which results in a recursive - /// sequential algorithm. - pub layout_threads: usize, - pub nonincremental_layout: bool, /// Where to load userscripts from, if any. An empty string will load from @@ -473,7 +469,6 @@ pub fn default_opts() -> Opts { time_profiling: None, time_profiler_trace_path: None, mem_profiler_period: None, - layout_threads: 1, nonincremental_layout: false, userscripts: None, user_stylesheets: Vec::new(), @@ -662,7 +657,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { Ok(interval) => Some(OutputOptions::Stdout(interval)) , Err(_) => Some(OutputOptions::FileName(argument)), }, - None => Some(OutputOptions::Stdout(5 as f64)), + None => Some(OutputOptions::Stdout(5.0 as f64)), } } else { // if the p option doesn't exist: @@ -682,11 +677,11 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { period.parse().unwrap_or_else(|err| args_fail(&format!("Error parsing option: -m ({})", err))) }); - let mut layout_threads: usize = match opt_match.opt_str("y") { - Some(layout_threads_str) => layout_threads_str.parse() - .unwrap_or_else(|err| args_fail(&format!("Error parsing option: -y ({})", err))), - None => cmp::max(num_cpus::get() * 3 / 4, 1), - }; + let mut layout_threads: Option = opt_match.opt_str("y") + .map(|layout_threads_str| { + layout_threads_str.parse() + .unwrap_or_else(|err| args_fail(&format!("Error parsing option: -y ({})", err))) + }); let nonincremental_layout = opt_match.opt_present("i"); @@ -705,7 +700,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { let mut bubble_inline_sizes_separately = debug_options.bubble_widths; if debug_options.trace_layout { paint_threads = 1; - layout_threads = 1; + layout_threads = Some(1); bubble_inline_sizes_separately = true; } @@ -777,7 +772,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { time_profiling: time_profiling, time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"), mem_profiler_period: mem_profiler_period, - layout_threads: layout_threads, nonincremental_layout: nonincremental_layout, userscripts: opt_match.opt_default("userscripts", ""), user_stylesheets: user_stylesheets, @@ -845,6 +839,15 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { }; } + if let Some(layout_threads) = layout_threads { + PREFS.set("layout.threads", PrefValue::Number(layout_threads as f64)); + } else if let Some(layout_threads) = PREFS.get("layout.threads").as_string() { + PREFS.set("layout.threads", PrefValue::Number(layout_threads.parse::().unwrap())); + } else if *PREFS.get("layout.threads") == PrefValue::Missing { + let layout_threads = cmp::max(num_cpus::get() * 3 / 4, 1); + PREFS.set("layout.threads", PrefValue::Number(layout_threads as f64)); + } + ArgumentParsingResult::ChromeProcess } diff --git a/tests/wpt/harness/wptrunner/executors/executorservo.py b/tests/wpt/harness/wptrunner/executors/executorservo.py index 7f5e9067319..ca684d4ef22 100644 --- a/tests/wpt/harness/wptrunner/executors/executorservo.py +++ b/tests/wpt/harness/wptrunner/executors/executorservo.py @@ -211,8 +211,8 @@ class ServoRefTestExecutor(ProcessTestExecutor): for stylesheet in self.browser.user_stylesheets: command += ["--user-stylesheet", stylesheet] - for pref in test.environment.get('prefs', {}): - command += ["--pref", pref] + for pref, value in test.environment.get('prefs', {}).iteritems(): + command += ["--pref", "%s=%s" % (pref, value)] if viewport_size: command += ["--resolution", viewport_size] diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 63ff32d5b95..da98ef5f303 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -1344,6 +1344,18 @@ "url": "/_mozilla/css/data_img_a.html" } ], + "css/direction_style_caching.html": [ + { + "path": "css/direction_style_caching.html", + "references": [ + [ + "/_mozilla/css/direction_style_caching_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/direction_style_caching.html" + } + ], "css/empty_cells_a.html": [ { "path": "css/empty_cells_a.html", @@ -10552,6 +10564,18 @@ "url": "/_mozilla/css/data_img_a.html" } ], + "css/direction_style_caching.html": [ + { + "path": "css/direction_style_caching.html", + "references": [ + [ + "/_mozilla/css/direction_style_caching_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/direction_style_caching.html" + } + ], "css/empty_cells_a.html": [ { "path": "css/empty_cells_a.html", diff --git a/tests/wpt/mozilla/meta/css/direction_style_caching.html.ini b/tests/wpt/mozilla/meta/css/direction_style_caching.html.ini new file mode 100644 index 00000000000..b04e9dc858f --- /dev/null +++ b/tests/wpt/mozilla/meta/css/direction_style_caching.html.ini @@ -0,0 +1,3 @@ +prefs: [layout.threads:1] +[direction_style_caching.html] + type: reftest diff --git a/tests/wpt/mozilla/tests/css/direction_style_caching.html b/tests/wpt/mozilla/tests/css/direction_style_caching.html new file mode 100644 index 00000000000..0f53b4a1204 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/direction_style_caching.html @@ -0,0 +1,28 @@ + + +Style caching with directions + + +
+

+

+

+

+

+

+

+

+
diff --git a/tests/wpt/mozilla/tests/css/direction_style_caching_ref.html b/tests/wpt/mozilla/tests/css/direction_style_caching_ref.html new file mode 100644 index 00000000000..b59a15a973d --- /dev/null +++ b/tests/wpt/mozilla/tests/css/direction_style_caching_ref.html @@ -0,0 +1,19 @@ + + +
+

+

+