Skip to content

Blank page with scale other than 100% #5285

Description

@ovidiumchis

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

151.3.170

Operating System

Windows 11

Architecture

x64

.Net Version

.NET 4.8.1

Implementation

WinForms

Reproduction Steps

Right Click on Desktop -> Display Settings -> Set the scale to 200%.
Run the application, load a webpage.

public void InitializeCefSharp()
{
        var cefSettings = new CefSettings();
        cefSettings.CefCommandLineArgs.Add("disable-gpu", "1"); // Disable GPU acceleration
        cefSettings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); //Disable GPU vsync
        cefSettings.CefCommandLineArgs.Add("do-not-de-elevate", "1");
        cefSettings.CefCommandLineArgs.Add("no-proxy-server", "1");
        cefSettings.CefCommandLineArgs.Add("content-shell-hide-toolbar", "1");
        Cef.Initialize(cefSettings);
        Cef.GetGlobalCookieManager().DeleteCookies("", "");
}

Expected behavior

Elements should scale correctly.

Actual behavior

A blank (white) page is displayed. Elements are there, as I can see the mouse icon change when I hover over certain areas of the page, where buttons/text usually is.

Regression?

This worked perfectly on 138.0.340.
Any other version after that, it did not work.

Known Workarounds

Tried several possible workarounds, nothing worked.

Does this problem also occur in the CEF Sample Application

No

Other information

I tried setting the DPI Awarness programatically, but it still didn't work.

internal static class NativeMethods
{
    [DllImport("user32.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool SetProcessDpiAwarenessContext(IntPtr value);

    // DPI_AWARENESS_CONTEXT_UNAWARE = ((DPI_AWARENESS_CONTEXT)-1)
    public static readonly IntPtr DPI_AWARENESS_CONTEXT_UNAWARE = new(-1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions