Skip to content

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

Closed

Description

@paulrouget

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:

Activity

  1. 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\[/+] on Sep 21, 2015
  2. 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[/+] on Sep 21, 2015
  3. 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[/+] on Sep 21, 2015
  4. paulrouget commented on Sep 21, 2015

    @paulrouget
    ContributorAuthor

    Started working on this.

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

  5. paulrouget commented on Sep 30, 2015

    @paulrouget
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions