compositing: In borderless mode, don't show the window until the page

has loaded.

This avoids a flash of unstyled content, which looks especially bad in
browser.html since unstyled content is white and browser.html has a
transparent background.

Closes #9996.
This commit is contained in:
Patrick Walton 2016-03-15 22:06:03 -07:00
parent 1a60e07ee8
commit c2581d5cef
7 changed files with 23 additions and 13 deletions

View file

@ -374,7 +374,7 @@ impl WindowMethods for Window {
}
}
fn load_end(&self, back: bool, forward: bool) {
fn load_end(&self, back: bool, forward: bool, _: bool) {
// FIXME(pcwalton): The status code 200 is a lie.
let browser = self.cef_browser.borrow();
let browser = match *browser {

View file

@ -93,13 +93,20 @@ impl Window {
parent: Option<glutin::WindowID>) -> Rc<Window> {
let width = window_size.to_untyped().width;
let height = window_size.to_untyped().height;
// If there's no chrome, start off with the window invisible. It will be set to visible in
// `load_end()`. This avoids an ugly flash of unstyled content (especially important since
// unstyled content is white and chrome often has a transparent background). See issue
// #9996.
let visible = is_foreground && !opts::get().no_native_titlebar;
let mut builder =
glutin::WindowBuilder::new().with_title("Servo".to_string())
.with_decorations(!opts::get().no_native_titlebar)
.with_transparency(opts::get().no_native_titlebar)
.with_dimensions(width, height)
.with_gl(Window::gl_version())
.with_visibility(is_foreground)
.with_visibility(visible)
.with_parent(parent)
.with_multitouch();
@ -613,7 +620,10 @@ impl WindowMethods for Window {
fn load_start(&self, _: bool, _: bool) {
}
fn load_end(&self, _: bool, _: bool) {
fn load_end(&self, _: bool, _: bool, root: bool) {
if root && opts::get().no_native_titlebar {
self.window.show()
}
}
fn load_error(&self, _: NetError, _: String) {
@ -869,7 +879,7 @@ impl WindowMethods for Window {
fn load_start(&self, _: bool, _: bool) {
}
fn load_end(&self, _: bool, _: bool) {
fn load_end(&self, _: bool, _: bool, _: bool) {
}
fn load_error(&self, _: NetError, _: String) {
}

View file

@ -820,7 +820,7 @@ impl WindowMethods for Window {
fn load_start(&self, _: bool, _: bool) {
}
fn load_end(&self, _: bool, _: bool) {
fn load_end(&self, _: bool, _: bool, _: bool) {
}
fn load_error(&self, _: NetError, _: String) {