From 42d8ba4f857cb2326ae9e44d245af095c5e069f0 Mon Sep 17 00:00:00 2001 From: salvadordf Date: Wed, 17 May 2023 11:56:49 +0200 Subject: [PATCH] Update to CEF 113.1.5 --- README.md | 14 ++--- .../WebpageSnapshot/uCEFBrowserThread.pas | 55 +++++++++++++++++++ .../WebpageSnapshot/uWebpageSnapshot.dfm | 38 ++++++++++--- .../WebpageSnapshot/uWebpageSnapshot.pas | 10 ++++ packages/cef4delphi_lazarus.lpk | 2 +- source/uCEFVersion.inc | 4 +- update_CEF4Delphi.json | 4 +- 7 files changed, 107 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 960c5b2d..16d9d89b 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file. -CEF4Delphi uses CEF 113.1.4 which includes Chromium 113.0.5672.63. +CEF4Delphi uses CEF 113.1.5 which includes Chromium 113.0.5672.93. The CEF binaries used by CEF4Delphi are available for download at Spotify : -* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_windows32.tar.bz2) -* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_windows64.tar.bz2) -* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_linux64.tar.bz2) -* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_linuxarm.tar.bz2) -* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_linuxarm64.tar.bz2) -* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.4%2Bg327635f%2Bchromium-113.0.5672.63_macosx64.tar.bz2) +* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_windows32.tar.bz2) +* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_windows64.tar.bz2) +* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_linux64.tar.bz2) +* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_linuxarm.tar.bz2) +* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_linuxarm64.tar.bz2) +* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_113.1.5%2Bge452d82%2Bchromium-113.0.5672.93_macosx64.tar.bz2) CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/demos/Delphi_VCL/WebpageSnapshot/uCEFBrowserThread.pas b/demos/Delphi_VCL/WebpageSnapshot/uCEFBrowserThread.pas index 21e7c6ac..3b5900f5 100644 --- a/demos/Delphi_VCL/WebpageSnapshot/uCEFBrowserThread.pas +++ b/demos/Delphi_VCL/WebpageSnapshot/uCEFBrowserThread.pas @@ -68,19 +68,23 @@ type FDefaultURL : ustring; FDelayMs : integer; FOnSnapshotAvailable : TNotifyEvent; + FOnHTMLAvailable : TNotifyEvent; FOnError : TNotifyEvent; FErrorCode : integer; FErrorText : ustring; FFailedUrl : ustring; FPendingUrl : ustring; FSyncEvents : boolean; + FHTMLcopy : ustring; function GetErrorCode : integer; function GetErrorText : ustring; function GetFailedUrl : ustring; + function GetHTMLcopy : ustring; function GetInitialized : boolean; procedure SetErrorText(const aValue : ustring); + procedure SetHTMLcopy(const aValue : ustring); procedure Browser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser); procedure Browser_OnPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer); @@ -93,9 +97,11 @@ type procedure Browser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure Browser_OnLoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); procedure Browser_OnLoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); + procedure Browser_OnTextResultAvailable(Sender: TObject; const aText : ustring); procedure DoOnError; procedure DoOnSnapshotAvailable; + procedure DoOnHTMLAvailable; procedure Resize; function CreateBrowser : boolean; procedure CloseBrowser; @@ -120,8 +126,10 @@ type property Initialized : boolean read GetInitialized; property Closing : boolean read FClosing; property SyncEvents : boolean read FSyncEvents write FSyncEvents; + property HTMLcopy : ustring read GetHTMLcopy write SetHTMLcopy; property OnSnapshotAvailable : TNotifyEvent read FOnSnapshotAvailable write FOnSnapshotAvailable; + property OnHTMLAvailable : TNotifyEvent read FOnHTMLAvailable write FOnHTMLAvailable; property OnError : TNotifyEvent read FOnError write FOnError; end; @@ -154,6 +162,7 @@ begin FBrowserInfoCS := nil; FDelayMs := aDelayMs; FOnSnapshotAvailable := nil; + FOnHTMLAvailable := nil; FOnError := nil; FClosing := False; FSyncEvents := False; @@ -206,6 +215,7 @@ begin FBrowser.OnBeforeClose := Browser_OnBeforeClose; FBrowser.OnLoadError := Browser_OnLoadError; FBrowser.OnLoadingStateChange := Browser_OnLoadingStateChange; + FBrowser.OnTextResultAvailable := Browser_OnTextResultAvailable; end; function TCEFBrowserThread.GetErrorCode : integer; @@ -247,6 +257,19 @@ begin Result := ''; end; +function TCEFBrowserThread.GetHTMLcopy : ustring; +begin + if assigned(FBrowserInfoCS) then + try + FBrowserInfoCS.Acquire; + Result := FHTMLcopy; + finally + FBrowserInfoCS.Release; + end + else + Result := ''; +end; + function TCEFBrowserThread.GetInitialized : boolean; begin Result := False; @@ -271,6 +294,17 @@ begin end; end; +procedure TCEFBrowserThread.SetHTMLcopy(const aValue : ustring); +begin + if assigned(FBrowserInfoCS) then + try + FBrowserInfoCS.Acquire; + FHTMLcopy := aValue; + finally + FBrowserInfoCS.Release; + end; +end; + function TCEFBrowserThread.CopySnapshot(var aSnapshot : TBitmap) : boolean; begin Result := False; @@ -566,6 +600,19 @@ begin PostThreadMessage(ThreadID, CEF_WEBPAGE_LOADED_MSG, 0, 0); end; +procedure TCEFBrowserThread.Browser_OnTextResultAvailable(Sender: TObject; const aText : ustring); +begin + HTMLcopy := aText; + + if assigned(FOnHTMLAvailable) then + begin + if FSyncEvents then + Synchronize(DoOnHTMLAvailable) + else + DoOnHTMLAvailable; + end; +end; + procedure TCEFBrowserThread.Resize; begin if FClosing or Terminated or not(Initialized) then exit; @@ -620,6 +667,9 @@ begin if (FDelayMs > 0) then sleep(FDelayMs); + if assigned(FOnHTMLAvailable) then + FBrowser.RetrieveHTML(); + if assigned(FOnSnapshotAvailable) then begin if FSyncEvents then @@ -659,6 +709,11 @@ begin FOnSnapshotAvailable(self); end; +procedure TCEFBrowserThread.DoOnHTMLAvailable; +begin + FOnHTMLAvailable(self); +end; + procedure TCEFBrowserThread.InitError; begin ErrorText := 'There was an error initializing the CEF browser.'; diff --git a/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.dfm b/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.dfm index 0ef9c072..ffb1b143 100644 --- a/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.dfm +++ b/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.dfm @@ -18,15 +18,25 @@ object WebpageSnapshotFrm: TWebpageSnapshotFrm Left = 0 Top = 25 Width = 1028 - Height = 692 + Height = 532 Align = alClient AutoSize = True Center = True Proportional = True ExplicitLeft = 104 ExplicitTop = 112 - ExplicitWidth = 105 - ExplicitHeight = 105 + ExplicitWidth = 777 + ExplicitHeight = 329 + end + object Splitter1: TSplitter + Left = 0 + Top = 557 + Width = 1028 + Height = 3 + Cursor = crVSplit + Align = alBottom + ExplicitTop = 25 + ExplicitWidth = 535 end object StatusBar1: TStatusBar Left = 0 @@ -37,8 +47,8 @@ object WebpageSnapshotFrm: TWebpageSnapshotFrm item Width = 1000 end> - ExplicitTop = 718 - ExplicitWidth = 1032 + ExplicitTop = 716 + ExplicitWidth = 1024 end object NavigationPnl: TPanel Left = 0 @@ -52,9 +62,9 @@ object WebpageSnapshotFrm: TWebpageSnapshotFrm Padding.Right = 2 Padding.Bottom = 2 TabOrder = 1 - ExplicitWidth = 1032 + ExplicitWidth = 1024 object GoBtn: TButton - Left = 955 + Left = 951 Top = 2 Width = 75 Height = 21 @@ -62,15 +72,27 @@ object WebpageSnapshotFrm: TWebpageSnapshotFrm Caption = 'Go' TabOrder = 0 OnClick = GoBtnClick + ExplicitLeft = 947 end object AddressEdt: TEdit Left = 2 Top = 2 - Width = 953 + Width = 949 Height = 21 Align = alClient TabOrder = 1 Text = 'https://www.google.com' + ExplicitWidth = 945 end end + object Memo1: TMemo + Left = 0 + Top = 560 + Width = 1028 + Height = 157 + Align = alBottom + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 2 + end end diff --git a/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.pas b/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.pas index 4ebd0a6d..4b8e4cb9 100644 --- a/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.pas +++ b/demos/Delphi_VCL/WebpageSnapshot/uWebpageSnapshot.pas @@ -58,6 +58,8 @@ type NavigationPnl: TPanel; GoBtn: TButton; AddressEdt: TEdit; + Memo1: TMemo; + Splitter1: TSplitter; procedure GoBtnClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); @@ -67,6 +69,7 @@ type procedure Thread_OnError(Sender: TObject); procedure Thread_OnSnapshotAvailable(Sender: TObject); + procedure Thread_OnHTMLAvailable(Sender: TObject); end; var @@ -114,6 +117,7 @@ begin FThread := TCEFBrowserThread.Create(AddressEdt.Text, 1024, 768); FThread.OnError := Thread_OnError; FThread.OnSnapshotAvailable := Thread_OnSnapshotAvailable; + FThread.OnHTMLAvailable := Thread_OnHTMLAvailable; FThread.SyncEvents := True; FThread.Start; end @@ -162,4 +166,10 @@ begin StatusBar1.Panels[0].Text := 'There was an error copying the snapshot'; end; +procedure TWebpageSnapshotFrm.Thread_OnHTMLAvailable(Sender: TObject); +begin + if (FThread <> nil) then + Memo1.Lines.Add(FThread.HTMLcopy); +end; + end. diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index 2d357c34..90014e06 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ - + diff --git a/source/uCEFVersion.inc b/source/uCEFVersion.inc index 7fcb2657..fa44a1d8 100644 --- a/source/uCEFVersion.inc +++ b/source/uCEFVersion.inc @@ -1,9 +1,9 @@ CEF_SUPPORTED_VERSION_MAJOR = 113; CEF_SUPPORTED_VERSION_MINOR = 1; - CEF_SUPPORTED_VERSION_RELEASE = 4; + CEF_SUPPORTED_VERSION_RELEASE = 5; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_RELEASE = 5672; - CEF_CHROMEELF_VERSION_BUILD = 63; + CEF_CHROMEELF_VERSION_BUILD = 93; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index cb8c3709..bef79c5c 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 485, + "InternalVersion" : 486, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "113.1.4" + "Version" : "113.1.5" } ], "UpdatePackageData" : {