chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.09k stars 450 forks source link

Black border bands with CEF flag --force-device-scale-factor=0.75 on 4K monitors for Chrome 116 #3715

Closed AlbertKong closed 2 weeks ago

AlbertKong commented 2 weeks ago

Describe the bug

Previously we had CEF Chrome 75 installed that primarily did Graphical Information System stuff with Google maps background on 4K monitors. However recent versions of Google maps required an update to Chrome (>79) for it to work and older Google maps api versions were deprecated. We had no choice but to update CEF which we did to Chrome 116. Google maps came back. But we found that icons and labels were now much larger than before, because icons were already programmatically scaled up for 4K monitors on our end. This is because Chrome 116 had dpi awareness enabled (from version 108, it is understood) so icons etc. were now doubly scaled up. So we used --force-device-scale-factor=0.75 to scale back the icons. This worked (icons were now smaller) but had an unexpected effect. There were now black borders on the right and bottom of the window that was proportionate to the scaled back amount. The black borders appear initially on window creation, but fixes itself on window resize.

Black borders are not there if no --force-device-scale-factor flag is used. It also is not there if the factor used is greater than 1.0. Only for factors less than one. And the size of the black borders appear proportional to the amount of scale back.

Tried disabling the GPU compositing using flag --disable_gpu_compositing to see if perhaps it was an issue with that. No luck.

This can be easily fixed on our end, by taking out our programmatic DPI scaling and letting the new CEF dpi awareness for more recent versions kick in, whereby the --force-device-scale-factor=0.75 would not be needed (thus no black bands). But the next version update for our code might be months away. If there is an easier and quicker fix by updating CEF, that would be great.

The screenshot attached shows the black border on the right. There is also a border at the bottom of the map not shown.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Use --force-device-scale-factor=0.75 for CEF window on 4K monitor, for Linux machine.

Expected behavior

Without the --force-device-scale-factor=0.75 flag the maps appear O.K., no black bands, but the icons are too large. With --force-device-scale-factor=0.75 the icons are smaller, but there are the black bands. Black bands disappear and the maps are O.K. once window is resized.

Screenshots image

Versions (please complete the following information):

Linux 7.x and 8.x (Centos, RHEL, Almalinux) CEF 116.0.14

Additional context Does the problem reproduce with the cefclient or cefsimple sample application at the same version?

Have not tired. Would be difficult to set up the same configuration.

Does the problem reproduce with Google Chrome at the same version?

Have not tired. Would be difficult to set up the same configuration.

Add any other context about the problem here.

magreenblatt commented 2 weeks ago

This can be easily fixed on our end, by taking out our programmatic DPI scaling and letting the new CEF dpi awareness for more recent versions kick in

Looks like you already know the correct solution.