Make the choice of layout runtime setting

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Martin Robinson 2023-06-28 10:07:08 +02:00
parent f11c6045e3
commit d31cdb682f
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
262 changed files with 1740 additions and 3700 deletions

View file

@ -27,6 +27,9 @@ pub struct Opts {
/// The initial URL to load.
pub url: Option<ServoUrl>,
/// Whether or not the legacy layout system is enabled.
pub legacy_layout: bool,
/// The maximum size of each tile in pixels (`-s`).
pub tile_size: usize,
@ -376,6 +379,7 @@ pub fn default_opts() -> Opts {
Opts {
is_running_problem_test: false,
url: None,
legacy_layout: false,
tile_size: 512,
time_profiling: None,
time_profiler_trace_path: None,
@ -410,6 +414,7 @@ pub fn default_opts() -> Opts {
pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingResult {
let (app_name, args) = args.split_first().unwrap();
opts.optflag("", "legacy-layout", "Use the legacy layout engine");
opts.optflag("c", "cpu", "CPU painting");
opts.optflag("g", "gpu", "GPU painting");
opts.optopt("o", "output", "Output file", "output.png");
@ -731,10 +736,17 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
let legacy_layout = opt_match.opt_present("legacy-layout");
if legacy_layout {
set_pref!(layout.legacy_layout, true);
set_pref!(layout.flexbox.enabled, true);
}
let opts = Opts {
debug: debug_options.clone(),
is_running_problem_test,
url: url_opt,
legacy_layout,
tile_size,
time_profiling,
time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"),