Add an option to dump the layer tree, which activates the previously
unused layer tree debugging code. Also improve the output using the
PrintTree struct.
Prior to this commit, `str_join` would skip empty items at the start of
the `Iterator` until it found a non-empty item. This contradicts
`SliceConcatExt::join` which doesn't skip anything.
Brought up in:
https://github.com/servo/servo/pull/7776#issuecomment-144317281
This allows both boolean and string-type preferences. It
also implements a system where prefs that are read from a
configuration file can be reset back to their initial value,
which is useful in a number of cases e.g. when running tests
to ensure that each test starts with the same values for
the prefs.
Fix#7609, "error: unable to create file tests/ref/hello_a?foo#bar.html
(Invalid argument)" during git checkout on Windows.
Behavior change: passing an nonexistent file name on the command line
now shows a blank page (like network errors)
rather than exit with an error message.
Fail on unrecognized debug option
Refs: https://github.com/servo/servo/issues/7142
Ran some basic functional tests:
```
$ ./mach run -d -Z bubble-widths,disable-canvas-aa,trace-layout tests/ref/blur_ref.html
$ ./mach run -d -Z help
Usage: /Users/greg/servo/target/debug/servo debug option,[options,...]
where options include
Options:
bubble-widths Bubble intrinsic widths separately like other engines.
disable-text-aa Disable antialiasing of rendered text.
disable-canvas-aa Disable antialiasing on the HTML canvas element.
dump-flow-tree Print the flow tree after each layout.
dump-display-list Print the display list after each layout.
dump-display-list-json Print the display list in JSON form.
dump-display-list-optimized Print optimized display list (at paint time).
relayout-event Print notifications when there is a relayout.
profile-tasks Instrument each task, writing the output to a file.
show-compositor-borders Paint borders along layer and tile boundaries.
show-fragment-borders Paint borders along fragment boundaries.
show-parallel-paint Overlay tiles with colors showing which thread painted them.
show-parallel-layout Mark which thread laid each flow out with colors.
paint-flashing Overlay repainted areas with a random color.
trace-layout Write layout trace to an external file for debugging.
validate-display-list-geometry Display an error when display list geometry escapes overflow region.
disable-share-style-cache Disable the style sharing cache.
parallel-display-list-building Build display lists in parallel.
replace-surrogates Replace unpaires surrogates in DOM strings with U+FFFD. See https://github.com/servo/servo/issues/6564
gc-profile Log GC passes and their durations.
$ ./mach run -d -Z blah
error: unrecognized debug option: blah
Servo exited with return value 1
```
Didn't check that setting debug flags actually did anything.
Haven't written much Rust so this feels more verbose than necessary.
Added `disable-canvas-aa` to debug options help.
Should DebugOptions struct derive Clone like Opts does?
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7165)
<!-- Reviewable:end -->