FMX.TMSWebGMapsWebBrowser.Win and Tdcef3

Hello,

I'm using Delphi Berlin and TWebBrowser is unusable on Windows platform (just try by yourself and have a look at quality.embarcadero.com)

The only solution I've found was to use Chromium (your components already handle this). An updated version of dcef3 is available at https://github.com/hgourvest/dcef3 . This version works on both VCL and FMX frameworks, tested on Delphi Berlin / Windows 10.

TMS code should be updated to reflect changes because both FMX.TMSWebGMapsWebBrowser.Win and FMX.TMSWebBrowser.Win units fails to compile.

These events need to be updated :
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}

I've also updated TTMSFMXWinWebGMapsWebBrowser.LoadFile(AFile: String).

procedure TTMSFMXWinWebOSMapsWebBrowser.LoadFile(AFile: String);
{$IFDEF USEFMXWEBBROWSER}
var
  FileStream: TFileStream;
{$ENDIF}
begin
  {$IFDEF USECHROMIUM}
  if Assigned(FWebBrowser) and Assigned(FWebBrowser.Browser) and Assigned(FWebBrowser.Browser.MainFrame) then
    FWebBrowser.Browser.MainFrame.LoadString(AFile, 'localhost');
  {$ENDIF}
  {$IFDEF USEFMXWEBBROWSER}
  WaitForInitialization;
  FileStream := TFileStream.Create(AFile, fmOpenRead or fmShareDenyNone);
  try
    InternalLoadDocumentFromStream(FileStream);
  finally
    FileStream.Free;
  end;
  {$ENDIF}
end;

Can you mention which specific issues you are experiencing with TTMSFMXWebGMaps or TTMSFMXWebBrowser specifically?

Some errors I recall :

Component (align property set to all client) is placed inside a TTabItem (align property set to right client). Here are my issues :
- Component stay "empty" when not parented to form. I have to change the visible property to have content displayed
-  Component isn't correctly drawn when maximizing/minimizing the main form : draw twice,maximized and minimized
- When loading gmaps data (tested with TMSFMXWebBrowser) : I had a warning that browser was set to compatibility mode
- When loading gmaps data (tested with TMSFMXWebBrowser) : tiles where not loaded after closing left drawer and alter messages
- When loading gmaps data (tested with TMSFMXWebBrowser) : received Exception EOleException 80020101 when trying to navigate to another url

URL used : https://www.google.fr/maps/place/Bruxelles,+Belgique/@50.8550625,4.3053506,12z/data=!3m1!4b1!4m5!3m4!1s0x47c3a4ed73c76867:0xc18b3a66787302a7!8m2!3d50.8503396!4d4.3517103

Os : Windows 10 Pro

Ps : no errors at all when switching to DCef3

We have investigated this here but wouldn't it be better to change the CEF source in order to accomodate for the existing event handlers? Also the CEF correct function is LoadFile, not LoadString in the LoadFile call?

CEF 3 doesn't include loadstream and loadfile functions. These method was introduced in CEF 1.
CEF 1 is only maintained for bug fixing. All new features are implemented in CEF 3.

CEF 3 is multi-threaded while CEF 1 is single threaded.


What I meant was to modify the event handlers in CEF3 (ceffmx.pas) to match the ones defined in the FMX.TMSWebGMapsWebBrowser.Win source and create a LoadFile that internally calls the correct method. You can work on a copy of CEF3. This way we keep compatibility with CEF1, accommodate for other users that might still use CEF1, and then you can use CEF3 instead of using the default TWebBrowser implementation.

I see. I'll ask Herv? Gouvest. He is maintaining the DCEF3 repository.

Would it not be wiser to modify FMX.TMSWebGMapsWebBrowser.Win and FMX.TMSWebOSMapsWebBrowser.Win

{$IFNDEF CHROMIUMOFF}
{$DEFINE USECHROMIUM}
{.$DEFINE USECHROMIUM3}
{$ELSE}
...
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
    const request: ICefRequest; navType: TCefHandlerNavtype;
    isRedirect: boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer; out Result: Boolean);
    {$ENDIF}
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}
    {$IFDEF USECHROMIUM3}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}

and so on....

We will investigate if we can improve this behavior.