Page 1 of 2

Different ZoomLevel for each CefBrowser ?

PostPosted: Tue May 23, 2017 8:49 am
by sat
Is it possible to somehow set different zoom levels for each CefBrowser instances created from same CefBrowserHost ?
I am trying to add High DPI support and using own browser for each window. But windows can be moved to different screens with different DPI which means that each browser have to use it's own zoomlevel.
Any tip/suggestions are welcome!

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Tue May 23, 2017 9:29 am
by magreenblatt
There is a 1:1 relationship between CefBrowser and CefBrowserHost. So, calling methods on CefBrowserHost will only affect the single associated CefBrowser.

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Tue May 23, 2017 10:00 am
by sat
magreenblatt wrote:There is a 1:1 relationship between CefBrowser and CefBrowserHost. So, calling methods on CefBrowserHost will only affect the single associated CefBrowser.

You're right. But it seems that popups share browserHost with parent CefBrowser. Anything I can do to support different zoom level for browser and it's popups ?

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Tue May 23, 2017 10:27 am
by magreenblatt
Are you saying that calling SetZoomLevel on the parent browser will also change the zoom level on the popup browser, and you don't want that behavior?

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Tue May 23, 2017 10:40 am
by sat
magreenblatt wrote:Are you saying that calling SetZoomLevel on the parent browser will also change the zoom level on the popup browser, and you don't want that behavior?

Exactly. Cause popup window could be on other monitor.

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Thu May 25, 2017 8:52 am
by sat
magreenblatt wrote:There is a 1:1 relationship between CefBrowser and CefBrowserHost. So, calling methods on CefBrowserHost will only affect the single associated CefBrowser.

I rechecked this and it seems that when i change scale factor for one cefBrowser, it changes for all CefBrowsers created in my process. Any ideas what can cause this behaviour ? I am using off-screen rendering.
Also I checked pointer of CefBrowserHost each time I am changing scale factor and it always different from the previous for same CefBrowser instance.
Even cefclient has same behavior when 'New Window' is created. ZoomIn in first window also affects all other windows, can it be changed to affected only browser I call this function for ?

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Thu May 25, 2017 1:05 pm
by Czarek
Implement CefLifeSpanHandler::OnBeforePopup and create window explicitily for popups to be independent.

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Fri May 26, 2017 3:25 am
by sat
Czarek wrote:Implement CefLifeSpanHandler::OnBeforePopup and create window explicitily for popups to be independent.

It appears that issue does not related to popup/new window thing. Behavior is same for both of em

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Fri May 26, 2017 5:12 am
by Czarek
sat wrote:
Czarek wrote:Implement CefLifeSpanHandler::OnBeforePopup and create window explicitily for popups to be independent.

It appears that issue does not related to popup/new window thing. Behavior is same for both of em

Did you return true to cancel popup creation? Create a new window and browser for popup in such case.

Re: Different ZoomLevel for each CefBrowser ?

PostPosted: Tue Dec 12, 2017 4:16 am
by mezdej
Multiple context are not best choice if you want to run js cooperating with those popups.
And we have find out that version:
CEF 3.3112.1656.g9ec3e42
Chromium 60.0.3112.90

opens pages two times slower with multiple contexts.

Second problem with multiple context are separated cookies.