servo: Merge #10336 - Make it possible to use preferences to configure webrender and titlebar (from paulrouget:morePrefs); r=KiChjang

It's getting tiring for browserhtml to run servo with so many options:

`servo -w -b --pref dom.mozbrowser.enabled --pref dom.forcetouch.enabled http://localhost:6060`.

We want to be able to control all of these with preferences (we have a custom pref file).

Only webrender and titlebar are not controllable via a pref. This PR makes it possible.

Source-Repo: https://github.com/servo/servo
Source-Revision: c4208e67b744b1d30f29c8ea1eb268f00b8e4ce7
This commit is contained in:
Paul Rouget 2016-04-02 05:42:46 +05:01
Родитель 7edb31d6c7
Коммит 356d7ad3b3
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -732,7 +732,13 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
(contents, url) (contents, url)
}).collect(); }).collect();
let use_webrender = opt_match.opt_present("w") && !opt_match.opt_present("z"); let do_not_use_native_titlebar =
opt_match.opt_present("b") ||
!prefs::get_pref("shell.native-titlebar.enabled").as_boolean().unwrap();
let use_webrender =
(prefs::get_pref("gfx.webrender.enabled").as_boolean().unwrap() || opt_match.opt_present("w")) &&
!opt_match.opt_present("z");
let render_api = match opt_match.opt_str("G") { let render_api = match opt_match.opt_str("G") {
Some(ref ga) if ga == "gl" => RenderApi::GL, Some(ref ga) if ga == "gl" => RenderApi::GL,
@ -789,7 +795,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
disable_share_style_cache: debug_options.disable_share_style_cache, disable_share_style_cache: debug_options.disable_share_style_cache,
convert_mouse_to_touch: debug_options.convert_mouse_to_touch, convert_mouse_to_touch: debug_options.convert_mouse_to_touch,
exit_after_load: opt_match.opt_present("x"), exit_after_load: opt_match.opt_present("x"),
no_native_titlebar: opt_match.opt_present("b"), no_native_titlebar: do_not_use_native_titlebar,
enable_vsync: !debug_options.disable_vsync, enable_vsync: !debug_options.disable_vsync,
use_webrender: use_webrender, use_webrender: use_webrender,
webrender_stats: debug_options.webrender_stats, webrender_stats: debug_options.webrender_stats,

Просмотреть файл

@ -1,6 +1,7 @@
{ {
"dom.mouseevent.which.enabled": false, "dom.mouseevent.which.enabled": false,
"dom.mozbrowser.enabled": false, "dom.mozbrowser.enabled": false,
"gfx.webrender.enabled": false,
"layout.columns.enabled": false, "layout.columns.enabled": false,
"layout.column-width.enabled": false, "layout.column-width.enabled": false,
"layout.column-count.enabled": false, "layout.column-count.enabled": false,
@ -11,5 +12,6 @@
"layout.viewport.enabled": false, "layout.viewport.enabled": false,
"layout.writing-mode.enabled": false, "layout.writing-mode.enabled": false,
"net.mime.sniff": false, "net.mime.sniff": false,
"shell.native-titlebar.enabled": true,
"shell.homepage": "http://servo.org" "shell.homepage": "http://servo.org"
} }