mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Ladybird: Calculate the 'physical pixels' for screens
Previously the 'device independent pixels' (which consider scaling) were used, and then scaling would be applied again when calculating the screen width for CSS.
This commit is contained in:
parent
d4f08fb0a1
commit
b7bd3fd920
Notes:
sideshowbarker
2024-07-17 03:51:15 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/SerenityOS/serenity/commit/b7bd3fd920 Pull-request: https://github.com/SerenityOS/serenity/pull/24063
1 changed files with 4 additions and 1 deletions
|
@ -568,8 +568,11 @@ void WebContentView::initialize_client(WebView::ViewImplementation::CreateNewCli
|
||||||
if (!screens.empty()) {
|
if (!screens.empty()) {
|
||||||
Vector<Web::DevicePixelRect> screen_rects;
|
Vector<Web::DevicePixelRect> screen_rects;
|
||||||
for (auto const& screen : screens) {
|
for (auto const& screen : screens) {
|
||||||
|
// NOTE: QScreen::geometry() returns the 'device-independent pixels', we multiply
|
||||||
|
// by the device pixel ratio to get the 'physical pixels' of the display.
|
||||||
auto geometry = screen->geometry();
|
auto geometry = screen->geometry();
|
||||||
screen_rects.append(Web::DevicePixelRect(geometry.x(), geometry.y(), geometry.width(), geometry.height()));
|
auto device_pixel_ratio = screen->devicePixelRatio();
|
||||||
|
screen_rects.append(Web::DevicePixelRect(geometry.x(), geometry.y(), geometry.width() * device_pixel_ratio, geometry.height() * device_pixel_ratio));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Update the screens again when QGuiApplication::screenAdded/Removed signals are emitted
|
// FIXME: Update the screens again when QGuiApplication::screenAdded/Removed signals are emitted
|
||||||
|
|
Loading…
Reference in a new issue