SetZoomLevel

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.

SetZoomLevel

Postby mezdej » Tue Jan 20, 2015 2:27 am

Hi,

I have problem with SetZoomLevel (cef_binary_3.1750.1738_windows32). When i change zoom for one CefBrowser object it does the change but for every other browser!
I don't suppose it should work that way...

Same thing is with popup windows even in cefclient example - just open some page with popup and run zoom in / out test.
mezdej
Techie
 
Posts: 31
Joined: Tue Oct 22, 2013 3:56 am

Re: SetZoomLevel

Postby magreenblatt » Tue Jan 20, 2015 12:32 pm

Zoom is applied on a per-origin (scheme + domain) basis. It behaves the same in Google Chrome. For example, open this website in 2 tabs and apply zoom to the first tab. The same zoom will be shown in both tabs.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: SetZoomLevel

Postby mezdej » Thu Jan 22, 2015 1:39 am

Thanks but can I force one browser to have specific zoom? or this is impossible from the api?
mezdej
Techie
 
Posts: 31
Joined: Tue Oct 22, 2013 3:56 am

Re: SetZoomLevel

Postby Czarek » Thu Jan 22, 2015 3:10 am

mezdej wrote:Thanks but can I force one browser to have specific zoom? or this is impossible from the api?

Create a unique request context for each browser and pass it to CreateBrowser(). Browser objects with different request contexts will never be hosted in the same render process. Browsers in different renderer processes do not share the same zoom level. If you want an independent zoom level also in popup windows then implement LifespanHandler::OnBeforePopup and cancel the implicit creation of popup by CEF and create it yourself with a unique request context.
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: SetZoomLevel

Postby magreenblatt » Thu Jan 22, 2015 11:19 am

Czarek wrote:If you want an independent zoom level also in popup windows then implement LifespanHandler::OnBeforePopup and cancel the implicit creation of popup by CEF and create it yourself with a unique request context.

Note that if you do this the popup window and parent window will not be able to script each other.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: SetZoomLevel

Postby mezdej » Fri Jan 23, 2015 5:38 am

Thanks!

Dzięki Czarek! ;)
mezdej
Techie
 
Posts: 31
Joined: Tue Oct 22, 2013 3:56 am


Return to Support Forum

Who is online

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