Page 1 of 1

Re: OSR Bug with Iframe

Posted: Mon Nov 26, 2018 3:54 pm
by salvadordf
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.

Re: OSR Bug with Iframe

Posted: Tue Nov 27, 2018 1:00 pm
by salvadordf
Thanks!

I'll take a look as soon as I can.

Re: OSR Bug with Iframe

Posted: Wed Nov 28, 2018 10:20 am
by salvadordf
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 :

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.
  ///
The TCefScreenInfo type is defined like this in CEF3 :

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;
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.

Re: OSR Bug with Iframe

Posted: Wed Nov 28, 2018 2:27 pm
by salvadordf
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!

Re: OSR Bug with Iframe

Posted: Fri Nov 30, 2018 2:19 pm
by salvadordf
Confirmed in the official CEF application.

Thanks for reporting this issue. Very good catch!!! :D

Re: OSR Bug with Iframe

Posted: Fri Nov 30, 2018 2:46 pm
by salvadordf
I merged this issue in the CEF4Delphi project and reported it to CEF3 :
https://bitbucket.org/chromiumembedded/ ... er-process

Re: OSR Bug with Iframe

Posted: Tue Mar 10, 2020 2:25 pm
by SafirEar
Hello!

Found same problem with 79 and 80 builds.

Works fine when globalCEFApp.SingleProcess:=True; anybody know why??

Re: OSR Bug with Iframe

Posted: Tue Mar 10, 2020 2:43 pm
by salvadordf
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.

Code: Select all

GlobalCEFApp.DisableSiteIsolationTrials := True;
Please, use the single process mode only for debugging purposes. That mode is not supported and it causes unexpected issues.

Re: OSR Bug with Iframe

Posted: Wed Mar 11, 2020 12:27 pm
by SafirEar
Great! Thank you!