Different ZoomLevel for each CefBrowser ?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Different ZoomLevel for each CefBrowser ?

Postby sat » Tue May 23, 2017 8:49 am

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!
sat
Techie
 
Posts: 20
Joined: Thu Mar 26, 2015 8:59 am

Re: Different ZoomLevel for each CefBrowser ?

Postby magreenblatt » Tue May 23, 2017 9:29 am

There is a 1:1 relationship between CefBrowser and CefBrowserHost. So, calling methods on CefBrowserHost will only affect the single associated CefBrowser.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Different ZoomLevel for each CefBrowser ?

Postby sat » Tue May 23, 2017 10:00 am

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 ?
sat
Techie
 
Posts: 20
Joined: Thu Mar 26, 2015 8:59 am

Re: Different ZoomLevel for each CefBrowser ?

Postby magreenblatt » Tue May 23, 2017 10:27 am

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?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Different ZoomLevel for each CefBrowser ?

Postby sat » Tue May 23, 2017 10:40 am

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.
sat
Techie
 
Posts: 20
Joined: Thu Mar 26, 2015 8:59 am

Re: Different ZoomLevel for each CefBrowser ?

Postby sat » Thu May 25, 2017 8:52 am

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 ?
sat
Techie
 
Posts: 20
Joined: Thu Mar 26, 2015 8:59 am

Re: Different ZoomLevel for each CefBrowser ?

Postby Czarek » Thu May 25, 2017 1:05 pm

Implement CefLifeSpanHandler::OnBeforePopup and create window explicitily for popups to be independent.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Different ZoomLevel for each CefBrowser ?

Postby sat » Fri May 26, 2017 3:25 am

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
sat
Techie
 
Posts: 20
Joined: Thu Mar 26, 2015 8:59 am

Re: Different ZoomLevel for each CefBrowser ?

Postby Czarek » Fri May 26, 2017 5:12 am

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.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Different ZoomLevel for each CefBrowser ?

Postby mezdej » Tue Dec 12, 2017 4:16 am

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.
mezdej
Techie
 
Posts: 31
Joined: Tue Oct 22, 2013 3:56 am

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 29 guests