Firefox screenshots enlarged by display scaling

Changed

Context

When I upload a screenshot, it appears larger than the original size.

Discovery

By default, firefox adjusts device pixel sizes using your OS's display scaling.

Other screenshot tools on linux do the same.

With mine set to 125%, the screenshots are getting enlarged by that amount.

There is a setting, layout.css.devPixelsPerPx, defaulting to -1.

Setting this to 1 will ignore device scaling, but sites will be scaled down.

Another suggestion was to use the responsive preview with scaled down dpr, but this did not work.

Firefox console screenshot command

Firefox has a console command for screenshots: :screenshot --dpr 1.

This takes a full screenshot of the viewport.

Use --fullpage to get the entire page, or --selector for an element.

There is a bug for some selectors not working: https://bugzilla.mozilla.org/show_bug.cgi?id=1482807

More firefox screenshot bugs: https://bugzilla.mozilla.org/showdependencytree.cgi?id=1483143&hide_resolved=1

Replacing files

Documentation

Uploaded file management

Drupal core

Uploaded files are impossible to replace

File Field Paths

Replace Existing Files

File entity update is allowed only for user who has uploaded the file

Orphaned file deletion

There is an old change record (2017) to no longer clean up unused files.

There is a config setting, file.settings.make_unused_managed_files_temporary, to revert the change.

However, for media embedded in wysiwyg, it seems the usage never goes down to 0.

Issues

Dealing with unexpected file deletion due to incorrect file usage

Add a reliable entity-usage system to core

Deleting an entity with revisions and file/image field does not release file usage of non-default revisions, causing files to linger

File not marked temporary and usage not updated if only used in past revisions when node is deleted

Image should be removed from the folder

File "in use" does not get set to "0" after being removed from content

File usages referencing deleted entities should be reported and made deletable

Revisions should be individually deleted when deleting entities

[PP-2] When Media entities are deleted, the associated files are not deleted

Merge the functionality of Media File Delete into the core media system

File usage is not tracked by revision, leading to private files embedded in text fields in old revisions being accessible when they shouldn't be

Instead of relying on file usage, tracking dependency to determine the deletion of files

Image Media thumbnail alt text cannot be changed without reuploading the image

modules

Media Files Handler

Audit FilesView Audit Files on Drupal.org

Analysis

This appears to be a widespread issue with OS screen scaling, and how applications use them.

The most reliable fix is to set the display scaling to 100% before taking screenshots.

Done

Added UI Scaler for HiDPI screens applet for faster switching.

Added CKEditor Media EditView CKEditor Media Edit on Drupal.org, and Media Entity File ReplaceView Media Entity File Replace on Drupal.org modules to help replace files in ckeditor media.

TODO

Adjust existing screenshots.

Test again with wayland or future versions of linux mint.

Try Media Files Handler, Audit Files modules.