diff --git a/source/uCEFBrowser.pas b/source/uCEFBrowser.pas index 113a712c..b2599e19 100644 --- a/source/uCEFBrowser.pas +++ b/source/uCEFBrowser.pas @@ -615,12 +615,12 @@ end; function TCefBrowserHostRef.IsMouseCursorChangeDisabled: Boolean; begin - Result := PCefBrowserHost(FData)^.is_mouse_cursor_change_disabled(FData) <> 0 + Result := PCefBrowserHost(FData)^.is_mouse_cursor_change_disabled(FData) <> 0; end; function TCefBrowserHostRef.IsWindowRenderingDisabled: Boolean; begin - Result := PCefBrowserHost(FData)^.is_window_rendering_disabled(FData) <> 0 + Result := PCefBrowserHost(FData)^.is_window_rendering_disabled(FData) <> 0; end; procedure TCefBrowserHostRef.NotifyMoveOrResizeStarted; diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas index 39bc6a7c..14106e98 100644 --- a/source/uCEFChromium.pas +++ b/source/uCEFChromium.pas @@ -2971,28 +2971,42 @@ end; procedure TChromium.ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl); var - TempPoint : TCefPoint; + TempPoint : TCefPoint; + TempClient : ICefClient; + TempPPoint : PCefPoint; begin - if not(Initialized) or HasDevTools then Exit; + try + try + if Initialized then + begin + InitializeSettings(FDevBrowserSettings); - InitializeSettings(FDevBrowserSettings); + if (aDevTools <> nil) then + WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name) + else + WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME); - if (aDevTools <> nil) then - WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name) - else - WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME); + TempClient := TCefClientOwn.Create; + if (inspectElementAt.x <> low(integer)) and + (inspectElementAt.y <> low(integer)) then + begin + TempPoint.x := inspectElementAt.x; + TempPoint.y := inspectElementAt.y; + TempPPoint := @TempPoint; + end + else + TempPPoint := nil; - if (inspectElementAt.x <> low(integer)) and - (inspectElementAt.y <> low(integer)) then - begin - TempPoint.x := inspectElementAt.x; - TempPoint.y := inspectElementAt.y; - - FBrowser.Host.ShowDevTools(@FDevWindowInfo, TCefClientOwn.Create as ICefClient, @FDevBrowserSettings, @TempPoint); - end - else - FBrowser.Host.ShowDevTools(@FDevWindowInfo, TCefClientOwn.Create as ICefClient, @FDevBrowserSettings, nil); + FBrowser.Host.ShowDevTools(@FDevWindowInfo, TempClient, @FDevBrowserSettings, TempPPoint); + end; + except + on e : exception do + if CustomExceptionHandler('TChromium.ShowDevTools', e) then raise; + end; + finally + TempClient := nil; + end; end; procedure TChromium.CloseDevTools(const aDevTools : TWinControl); diff --git a/source/uCEFWriteHandler.pas b/source/uCEFWriteHandler.pas index 20c6aadc..6cd542ea 100644 --- a/source/uCEFWriteHandler.pas +++ b/source/uCEFWriteHandler.pas @@ -98,6 +98,11 @@ type implementation uses + {$IFDEF DELPHI16_UP} + System.Math, + {$ELSE} + Math, + {$ENDIF} uCEFMiscFunctions, uCEFLibFunctions; @@ -246,18 +251,21 @@ end; function TCefBytesWriteHandler.Write(const ptr: Pointer; size, n: NativeUInt): NativeUInt; var TempPointer : pointer; + TempSize : int64; begin EnterCriticalSection(FCriticalSection); - if ((FOffset + (size * n)) >= FBufferSize) and (Grow(size * n) = 0) then + TempSize := size * n; + + if ((FOffset + TempSize) >= FBufferSize) and (Grow(TempSize) = 0) then Result := 0 else begin TempPointer := Pointer(cardinal(FBuffer) + FOffset); - CopyMemory(TempPointer, ptr, size * n); + CopyMemory(TempPointer, ptr, TempSize); - FOffset := FOffset + (size * n); + FOffset := FOffset + TempSize; Result := n; end; @@ -337,21 +345,21 @@ end; function TCefBytesWriteHandler.Grow(size : NativeUInt) : NativeUInt; var - s : NativeUInt; + TempTotal : int64; begin - EnterCriticalSection(FCriticalSection); + try + EnterCriticalSection(FCriticalSection); - if (size > FGrow) then - s := size - else - s := FGrow; + TempTotal := max(size, FGrow); + inc(TempTotal, FBufferSize); - ReallocMem(FBuffer, FBufferSize + s); + ReallocMem(FBuffer, TempTotal); - FBufferSize := FBufferSize + s; - Result := FBufferSize; - - LeaveCriticalSection(FCriticalSection); + FBufferSize := TempTotal; + Result := FBufferSize; + finally + LeaveCriticalSection(FCriticalSection); + end; end; end.