Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text selection with hdpi screens (#15229) #15232

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

calixteman
Copy link
Contributor

No description provided.

@calixteman calixteman linked an issue Jul 27, 2022 that may be closed by this pull request
Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we have a couple of other measureText-usages in the code-base, are any of those similarly affected?
If so that can, and maybe even should, be handled in follow-up patches.

Also, I'm assuming that there's no particularly good way to test this?

src/display/text_layer.js Show resolved Hide resolved
@@ -595,6 +597,7 @@ class TextLayerRenderTask {
this._capability = createPromiseCapability();
this._renderTimer = null;
this._bounds = [];
this._devicePixelRatio = window.devicePixelRatio;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent issues in non-browser environments, please change this to:

Suggested change
this._devicePixelRatio = window.devicePixelRatio;
this._devicePixelRatio = globalThis.devicePixelRatio || 1;

@calixteman
Copy link
Contributor Author

calixteman commented Jul 27, 2022

Given that we have a couple of other measureText-usages in the code-base, are any of those similarly affected? If so that can, and maybe even should, be handled in follow-up patches.

Yep, I'm in favor of follow-up patches.

Also, I'm assuming that there's no particularly good way to test this?

I have no idea on how to do that.
Here's a screenshot from my HDPI screen (pixelRatio == 1.5):
image

For people having a pixel ratio equals to 1, it should be impactless and for the other it cannot be worst than it is right now.
I tested with different pixelRatio settings in the Windows parameters stuff (System > Display > Scale & Layout > Scale), and everything is ok.

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/abdfec01cf95c38/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/465981514c8de28/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/465981514c8de28/output.txt

Total script time: 25.92 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 4

Image differences available at: http://54.241.84.105:8877/465981514c8de28/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/abdfec01cf95c38/output.txt

Total script time: 28.79 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/df81b472a512af7/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/df81b472a512af7/output.txt

Total script time: 2.43 mins

Published

@Snuffleupagus Snuffleupagus merged commit 0c5afe9 into mozilla:master Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text selection is not correct on hdpi
3 participants