servoshell: Do not override HiDPI ratio when taking screenshots (#39501)

This override is meant to force reftests to always run with a device
pixel ratio of 1.0. Reftests are always run in headless mode which uses
a device pixel ratio of 1.0 regardless (unless you override it).
Removing this particular override allows taking screenshots in the
system DPI when taking them in headed mode, which is actually a bit
useful.

Testing: A test verifying the old behavior is removed. This causes 
`/css/pixel_snapping_position_a.html` to start passing.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-09-30 19:44:14 +02:00 committed by GitHub
parent e9d0a8f95d
commit d0dd9d7e3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 14 deletions

View file

@ -645,12 +645,6 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
preferences.js_ion_enabled = false; preferences.js_ion_enabled = false;
} }
let device_pixel_ratio_override = if cmd_args.output.is_some() {
Some(1.0)
} else {
cmd_args.device_pixel_ratio
};
// Make sure the default window size is not larger than any provided screen size. // Make sure the default window size is not larger than any provided screen size.
let default_window_size = Size2D::new(1024, 740); let default_window_size = Size2D::new(1024, 740);
let default_window_size = cmd_args let default_window_size = cmd_args
@ -662,7 +656,7 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
let servoshell_preferences = ServoShellPreferences { let servoshell_preferences = ServoShellPreferences {
url: Some(cmd_args.url), url: Some(cmd_args.url),
no_native_titlebar: cmd_args.no_native_titlebar, no_native_titlebar: cmd_args.no_native_titlebar,
device_pixel_ratio_override, device_pixel_ratio_override: cmd_args.device_pixel_ratio,
clean_shutdown: cmd_args.clean_shutdown, clean_shutdown: cmd_args.clean_shutdown,
headless: cmd_args.headless, headless: cmd_args.headless,
tracing_filter: cmd_args.tracing_filter, tracing_filter: cmd_args.tracing_filter,
@ -881,11 +875,6 @@ fn test_profiling_args() {
#[test] #[test]
fn test_servoshell_cmd() { fn test_servoshell_cmd() {
assert_eq!(
test_parse("-o foo.png").2.device_pixel_ratio_override,
Some(1.0)
);
assert_eq!( assert_eq!(
test_parse("--screen-size=1000x1000") test_parse("--screen-size=1000x1000")
.2 .2

View file

@ -1,2 +0,0 @@
[pixel_snapping_position_a.html]
expected: FAIL