Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to draw the titlebar and clip the window in HTML #7659

Closed
paulrouget opened this issue Sep 17, 2015 · 2 comments
Closed

Make it possible to draw the titlebar and clip the window in HTML #7659

paulrouget opened this issue Sep 17, 2015 · 2 comments

Comments

@paulrouget
Copy link
Contributor

For browser.html, we want to draw the titlebar ourselves.

On osx, we need to be able to draw a window with rounded corners. the browser.html HTML page would use html {border-radius:6px}. To support that, we need to:

  • add an option to start servo with no titlebar
  • create the glutin window with with_decorations(false).with_transparency(true);
  • in rust-layers, render_scene should use a transparent clear color;
  • glutin needs to expose a invalidate_window_shape method, or something like that, that would call the cocoa method window.invalidateShadow() to invalidate the shadow once the border radius has been painted. Edit: see Make it possible to draw the titlebar and clip the window in HTML #7659 (comment)

With all of this, it appears to work:

screen shot 2015-09-17 at 18 04 38

There are some more issues (the border radius doesn't clip its content, see #7575, and for some reasons vertical coordinates are messed up), but these can be fixed later.

Can someone tell me if this approach makes sense?

Letting HTML define the shape of the window is nice, but it's not a hard requirement. Maybe instead of using border-radius, we can clip the window in the compositor directly, or expose a function in Glutin to clip the window, or maybe always add rounded corner to decoration-less windows.

PS: we will need more things to make the titlebar fully functional:

@paulrouget paulrouget changed the title Make it possible to draw the titlebar and clip the window in HTML (need feedback) Make it possible to draw the titlebar and clip the window in HTML\ Sep 21, 2015
@paulrouget paulrouget changed the title Make it possible to draw the titlebar and clip the window in HTML\ Make it possible to draw the titlebar and clip the window in HTM Sep 21, 2015
@paulrouget paulrouget changed the title Make it possible to draw the titlebar and clip the window in HTM Make it possible to draw the titlebar and clip the window in HTML Sep 21, 2015
@paulrouget
Copy link
Contributor Author

Started working on this.

Found a better way to properly draw decoration-less cocoa windows: rust-windowing/glutin#606

@paulrouget
Copy link
Contributor Author

Fixed by #7778 and rust-windowing/glutin#606.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants