How can I specify the size of the browser and window?

Test - https://browsersize.com/
OSR
Current:
Browser window size: 0 x 366
Screen size: 0 x 0
Real browser
Current:
Browser window size: 1488 x 751
Screen size: 1920 x 1080
OSR
Current:
Browser window size: 0 x 366
Screen size: 0 x 0
Real browser
Current:
Browser window size: 1488 x 751
Screen size: 1920 x 1080
I tested this in the official CEF3 application (cefclient) and it has the same behavior when it uses the OSR mode.Demo
Current:
Browser window size: 366 x 366
Screen size: 366 x 366
Screen size not?
salvadordf wrote: Sun Jul 08, 2018 8:48 pm If you ignore the TChromium.OnPaint event or you replace TBufferPanel then you can set any size in the TChromium.OnGetViewRect and TChromium.OnGetScreenInfo events.
The window and browser sizes are not important if you give a custom size in the TChromium.OnGetViewRect and TChromium.OnGetScreenInfo events.
Code: Select all
procedure TFormGL.Chromium1GetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
var
TempRect : TCEFRect;
begin
if (GlobalCEFApp <> nil) then
begin
TempRect.x := 0;
TempRect.y := 0;
TempRect.width := 1080;
TempRect.height := 1680;
screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor;
screenInfo.depth := 0;
screenInfo.depth_per_component := 0;
screenInfo.is_monochrome := Ord(False);
screenInfo.rect := TempRect;
screenInfo.available_rect := TempRect;
Result := True;
end
else
Result := False;
end;
procedure TFormGL.Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect; out Result: Boolean);
begin
if (GlobalCEFApp <> nil) then
begin
rect.x := 0;
rect.y := 0;
rect.width := 1000;
rect.height := 600;
Result := True;
end
else
Result := False;
end;