mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Update to CEF 73.1.12
- Added context menu option in JSDemo to get the vertical scroll position. - Now TChromium uses the same keyboard events for the browser and the DevTools. - Fixed a MiniBrowser issue with the F12 keyboard shortcut. Now you can press F12 to hide and show the DevTools correctly.
This commit is contained in:
parent
15ac7120e4
commit
4682fe3a19
@ -50,15 +50,18 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, EncdDecd,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants;
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $101;
|
||||
MINIBROWSER_EVALJSCODE = WM_APP + $102;
|
||||
MINIBROWSER_JSBINPARAM = WM_APP + $103;
|
||||
MINIBROWSER_GETSCROLLPOS = WM_APP + $104;
|
||||
|
||||
MINIBROWSER_CONTEXTMENU_EVALJSCODE = MENU_ID_USER_FIRST + 1;
|
||||
MINIBROWSER_CONTEXTMENU_JSBINPARAM = MENU_ID_USER_FIRST + 2;
|
||||
MINIBROWSER_CONTEXTMENU_EVALJSCODE = MENU_ID_USER_FIRST + 1;
|
||||
MINIBROWSER_CONTEXTMENU_JSBINPARAM = MENU_ID_USER_FIRST + 2;
|
||||
MINIBROWSER_CONTEXTMENU_GETSCROLLPOS = MENU_ID_USER_FIRST + 3;
|
||||
|
||||
EVAL_JS = 'JSContextEvalDemo';
|
||||
BINARY_PARAM_JS = 'JSBinaryParameter';
|
||||
@ -112,6 +115,7 @@ type
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure ShowTextViewerMsg(var aMessage : TMessage); message MINIBROWSER_SHOWTEXTVIEWER;
|
||||
procedure EvalJSCodeMsg(var aMessage : TMessage); message MINIBROWSER_EVALJSCODE;
|
||||
procedure GetScrollPosMsg(var aMessage : TMessage); message MINIBROWSER_GETSCROLLPOS;
|
||||
procedure EvalJSBinParamMsg(var aMessage : TMessage); message MINIBROWSER_JSBINPARAM;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
@ -194,8 +198,9 @@ procedure TJSEvalFrm.Chromium1BeforeContextMenu(Sender : TObject;
|
||||
const params : ICefContextMenuParams;
|
||||
const model : ICefMenuModel);
|
||||
begin
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_EVALJSCODE, 'Evaluate JavaScript code...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_JSBINPARAM, 'Send JPEG image...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_EVALJSCODE, 'Evaluate JavaScript code...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_GETSCROLLPOS, 'Get vertical scroll position...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_JSBINPARAM, 'Send JPEG image...');
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.Chromium1BeforePopup(Sender: TObject;
|
||||
@ -228,8 +233,9 @@ begin
|
||||
Result := False;
|
||||
|
||||
case commandId of
|
||||
MINIBROWSER_CONTEXTMENU_EVALJSCODE : PostMessage(Handle, MINIBROWSER_EVALJSCODE, 0, 0);
|
||||
MINIBROWSER_CONTEXTMENU_JSBINPARAM : PostMessage(Handle, MINIBROWSER_JSBINPARAM, 0, 0);
|
||||
MINIBROWSER_CONTEXTMENU_EVALJSCODE : PostMessage(Handle, MINIBROWSER_EVALJSCODE, 0, 0);
|
||||
MINIBROWSER_CONTEXTMENU_JSBINPARAM : PostMessage(Handle, MINIBROWSER_JSBINPARAM, 0, 0);
|
||||
MINIBROWSER_CONTEXTMENU_GETSCROLLPOS : PostMessage(Handle, MINIBROWSER_GETSCROLLPOS, 0, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -326,6 +332,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.GetScrollPosMsg(var aMessage : TMessage);
|
||||
var
|
||||
TempMsg : ICefProcessMessage;
|
||||
begin
|
||||
TempMsg := TCefProcessMessageRef.New(EVAL_JS);
|
||||
|
||||
if TempMsg.ArgumentList.SetString(0, 'window.pageYOffset') then
|
||||
Chromium1.SendProcessMessage(PID_RENDERER, TempMsg);
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.EvalJSBinParamMsg(var aMessage : TMessage);
|
||||
var
|
||||
TempMsg : ICefProcessMessage;
|
||||
|
@ -65,6 +65,9 @@ begin
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
|
||||
GlobalCEFApp.EnableMediaStream := False;
|
||||
GlobalCEFApp.EnableSpeechInput := False;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
Application.Initialize;
|
||||
|
@ -573,8 +573,6 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not(Chromium1.IsSameBrowser(browser)) then exit;
|
||||
|
||||
if (event <> nil) and (osEvent <> nil) then
|
||||
case osEvent.Message of
|
||||
WM_KEYUP :
|
||||
@ -728,8 +726,7 @@ procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if Chromium1.IsSameBrowser(browser) and
|
||||
(event <> nil) and
|
||||
if (event <> nil) and
|
||||
(event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and
|
||||
(event.windows_key_code = VK_F12) then
|
||||
isKeyboardShortcut := True;
|
||||
@ -940,6 +937,7 @@ end;
|
||||
procedure TMiniBrowserFrm.HideDevToolsMsg(var aMessage : TMessage);
|
||||
begin
|
||||
HideDevTools;
|
||||
Chromium1.SetFocus(True);
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Inczoom1Click(Sender: TObject);
|
||||
|
@ -62,7 +62,7 @@ uses
|
||||
const
|
||||
CEF_SUPPORTED_VERSION_MAJOR = 73;
|
||||
CEF_SUPPORTED_VERSION_MINOR = 1;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 11;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 12;
|
||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||
|
||||
CEF_CHROMEELF_VERSION_MAJOR = 73;
|
||||
|
@ -3122,7 +3122,14 @@ begin
|
||||
InitializeSettings(FDevBrowserSettings);
|
||||
InitializeDevToolsWindowInfo(aDevTools);
|
||||
|
||||
TempClient := TCefClientOwn.Create;
|
||||
TempClient := TCustomClientHandler.Create(Self, False, False,
|
||||
False, False,
|
||||
MustCreateKeyboardHandler,
|
||||
False, False,
|
||||
False, False,
|
||||
False, False,
|
||||
False, False,
|
||||
False);
|
||||
|
||||
if (inspectElementAt.x <> low(integer)) and
|
||||
(inspectElementAt.y <> low(integer)) then
|
||||
|
Loading…
Reference in New Issue
Block a user