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.

Re: Different ZoomLevel for each CefBrowser ?

Postby chupAkabRRa » Wed Mar 28, 2018 9:01 am

Curious, why this thread stopped. I tried the latest cefclient branch (3.3325.1751) and still can see that changing zoom level of one browser window changes the zoom level of another. Steps to reproduce:
1. Start cefclient application
2. Open new window (Tests -> New Window)
3. Change zoom level of any window. Another window will be affected.
Is it supposed to work like that?
chupAkabRRa
Techie
 
Posts: 10
Joined: Wed Jul 06, 2016 7:48 am

Re: Different ZoomLevel for each CefBrowser ?

Postby ndesktop » Wed Mar 28, 2018 9:27 am

SetZoomLevel ends up in content\browser\host_zoom_map_impl.cc in
Code: Select all
void HostZoomMap::SetZoomLevel(const WebContents* web_contents, double level) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
      HostZoomMap::GetForWebContents(web_contents));
  host_zoom_map->SetZoomLevelForWebContents(
      *static_cast<const WebContentsImpl*>(web_contents), level);
}

which continues to HostZoomMapImpl::SetZoomLevelForWebContents => SetZoomLevelForHostInternal => SendZoomLevelChange, which seems to set the zoom for scheme/host.
Indeed this ends (finally) in WebContentsImpl::UpdateZoomIfNecessary, which operates on a single WebContentsImpl, but it's the SendZoomLevelChange which looks lie changing it for all WebContents having the same scheme/host. Most likely the popup shares the same scheme and host with the parent window.

Plugin hosts seems to be excepted, as well as those views with temporary zoom levels.
A (nasty) hack could be to call somehow from CEF into SetTemporaryZoomLevel for every view needed to operate zoom independently, so SendZoomLevelChange will skip it in the enumeration.

Which I won't recommend unless one needs to employ a quick hack.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Different ZoomLevel for each CefBrowser ?

Postby Czarek » Wed Mar 28, 2018 10:24 am

It works the same in Google Chrome. Changing zoom level for a domain changes it in all windows that load urls for that domain.
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

Previous

Return to Support Forum

Who is online

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

cron