Support transparent window in Views framework (follow up issue #2315)

#267 · Created  · Last updated


Hi Team,


What I need is very similar to the issue #2315. I would like to provide my changes for the case.

First of all, the requirement I have is to create a non-rectangular window. One solution is implementing OSR to have parent window with transparent background. Another solution is creating a translucent window via Views frameworks, which is what this PR did.


The major changes are:

  1. Configure opacity to views::Widget::InitParams::TRANSLUCENT_WINDOW while initializing the Widget controlled by CefWindowDelegate::IsTranslucent()

  2. Set the background color of CefWindow to transparent if above is configured

  3. Configure CefSettings.transparent_painting to true. It controls accepting alpha component while configuring the background in CefContext::GetBackgroundColor(). It is required for deciding the default background of WebView in renderer.

CefSettings.windowless_rendering_enabled is renamed to CefSettings.transparent_painting because I consider the flag only controlling the background color calculation logic.

I created a testing page using the Views framework as below:

The page can be launched by

1 cefclient --use-views --transparent-painting-enabled --hide-frame --hide-controls

Thank you for any feedback/comments in advance.

0 attachments

Loading commits...