Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
OSR Bug with Iframe
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
This is a similar example inside an iframe :
https://www.w3schools.com/js/tryit.asp? ... reen_width
Chromium shows the real screen size even when the script was executed inside the lower-right iframe.
Perhaps the CEF 3.3029 branch had a bug and it returned the viewport size instead of the screen size.
https://www.w3schools.com/js/tryit.asp? ... reen_width
Chromium shows the real screen size even when the script was executed inside the lower-right iframe.
Perhaps the CEF 3.3029 branch had a bug and it returned the viewport size instead of the screen size.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
Thanks!
I'll take a look as soon as I can.
I'll take a look as soon as I can.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
The official CEF3 sample application and the SimpleOSRBrowser demo set the "screenInfo" parameter in the TChromium.OnGetScreenInfo event with the same values : the viewport size instead of the screen size.
Usually I translate to Delphi all the CEF3 code whenever is possible because the CEF3 maintainer has a deep knowledge of how Chromium works internally.
The code comments for that event are these :
The TCefScreenInfo type is defined like this in CEF3 :
If you don't use the TChromium.OnGetScreenInfo event then CEF will use the information given by the TChromium.OnGetViewRect event.
I can't find any information about why the CEF sample application uses the viewport size for both events but if your application needs to see the real screen size then set TCefScreenInfo.rect and TCefScreenInfo.available_rect with the real screen rect.
Usually I translate to Delphi all the CEF3 code whenever is possible because the CEF3 maintainer has a deep knowledge of how Chromium works internally.
The code comments for that event are these :
Code: Select all
///
// Called to allow the client to fill in the CefScreenInfo object with
// appropriate values. Return true (1) if the |screen_info| structure has been
// modified.
//
// If the screen info rectangle is left NULL the rectangle from GetViewRect
// will be used. If the rectangle is still NULL or invalid popups may not be
// drawn correctly.
///
Code: Select all
///
// Screen information used when window rendering is disabled. This structure is
// passed as a parameter to CefRenderHandler::GetScreenInfo and should be filled
// in by the client.
///
typedef struct _cef_screen_info_t {
///
// Device scale factor. Specifies the ratio between physical and logical
// pixels.
///
float device_scale_factor;
///
// The screen depth in bits per pixel.
///
int depth;
///
// The bits per color component. This assumes that the colors are balanced
// equally.
///
int depth_per_component;
///
// This can be true for black and white printers.
///
int is_monochrome;
///
// This is set from the rcMonitor member of MONITORINFOEX, to whit:
// "A RECT structure that specifies the display monitor rectangle,
// expressed in virtual-screen coordinates. Note that if the monitor
// is not the primary display monitor, some of the rectangle's
// coordinates may be negative values."
//
// The |rect| and |available_rect| properties are used to determine the
// available surface for rendering popup views.
///
cef_rect_t rect;
///
// This is set from the rcWork member of MONITORINFOEX, to whit:
// "A RECT structure that specifies the work area rectangle of the
// display monitor that can be used by applications, expressed in
// virtual-screen coordinates. Windows uses this rectangle to
// maximize an application on the monitor. The rest of the area in
// rcMonitor contains system windows such as the task bar and side
// bars. Note that if the monitor is not the primary display monitor,
// some of the rectangle's coordinates may be negative values".
//
// The |rect| and |available_rect| properties are used to determine the
// available surface for rendering popup views.
///
cef_rect_t available_rect;
} cef_screen_info_t;
I can't find any information about why the CEF sample application uses the viewport size for both events but if your application needs to see the real screen size then set TCefScreenInfo.rect and TCefScreenInfo.available_rect with the real screen rect.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
After more tests I finally see the error. Sorry for the misunderstanding.
For some reason the iframes from a different domain ignore the screen information given in the TChromium.OnGetScreenInfo event while the iframes with the same origin don't have that problem.
I'll try to fix this as soon as I can.
Thanks for reporting it!
For some reason the iframes from a different domain ignore the screen information given in the TChromium.OnGetScreenInfo event while the iframes with the same origin don't have that problem.
I'll try to fix this as soon as I can.
Thanks for reporting it!
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
Confirmed in the official CEF application.
Thanks for reporting this issue. Very good catch!!!
Thanks for reporting this issue. Very good catch!!!

- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
I merged this issue in the CEF4Delphi project and reported it to CEF3 :
https://bitbucket.org/chromiumembedded/ ... er-process
https://bitbucket.org/chromiumembedded/ ... er-process
Re: OSR Bug with Iframe
Hello!
Found same problem with 79 and 80 builds.
Works fine when globalCEFApp.SingleProcess:=True; anybody know why??
Found same problem with 79 and 80 builds.
Works fine when globalCEFApp.SingleProcess:=True; anybody know why??
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OSR Bug with Iframe
The site isolation feature still has some issues with frames in CEF.
Try adding this code line before the GlobalCEFApp.StartMainProcess call in the DPR file.
Please, use the single process mode only for debugging purposes. That mode is not supported and it causes unexpected issues.
Try adding this code line before the GlobalCEFApp.StartMainProcess call in the DPR file.
Code: Select all
GlobalCEFApp.DisableSiteIsolationTrials := True;