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

Incorrect pixel calculation on Chrome 98 #5097

Closed
15 tasks
sculpt0r opened this issue Feb 19, 2022 · 4 comments · Fixed by #5109
Closed
15 tasks

Incorrect pixel calculation on Chrome 98 #5097

sculpt0r opened this issue Feb 19, 2022 · 4 comments · Fixed by #5109
Assignees
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. resolution:upstream Issue in the third-party software. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@sculpt0r
Copy link
Contributor

sculpt0r commented Feb 19, 2022

Type of report

Bug

Provide detailed reproduction steps (if any)

We have a lot of failing tests due to the fact that Chrome 98 starts produce different values in pixel calculations. The difference is 1px - but still... Below is the list if failing tests:

Expected result

What is the expected result of the above steps?

All test are passing on the Chrome 98 (same as Chrome 97)

Actual result

What is the actual result of the above steps?

Tests are failing.

Other details

We should verify is this an upstream - and what exactly?
Is that causing some serious damage to the editor? Is it crashing at some point or is useless?

  • Browser: Chrome 98
  • OS: macOS
  • CKEditor version: 4.17.2
  • Installed CKEditor plugins: (dev version)
@sculpt0r sculpt0r added type:bug A bug. status:confirmed An issue confirmed by the development team. browser:chrome The issue can only be reproduced in the Chrome browser. type:failingtest A failing test. and removed type:bug A bug. labels Feb 19, 2022
@jacekbogdanski
Copy link
Member

I took a quick look at this issue. From what I see indeed Chrome 98 changed the way it calculates units - I didn't dig what's actually happening on the Chrome side, but we are using DOM-based unit conversion in convertToPx function.

This upstream seems serious as it changes calculations for very low values like rounding points to 2px instead of 1px for table borders when pasting HTML from Word. Some time ago I've reported a ticket for using simple math for calculating absolute units instead of using DOM container - #5097. It should resolve the issue for absolute units, but not sure what about relative ones.

Nevertheless, the issue is caused mostly by convertToPx function and that it's based on browser calculation. Fixing this function solves the issue for PFW (I already checked it by using math for calculating points to pixels).

@Comandeer Comandeer self-assigned this Mar 2, 2022
@Comandeer
Copy link
Member

It seems like an upstream issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1302246

However, the workaround seems to be easy: just use the value from element#getBoundingClientRect() and do the rounding ourselves.

@Comandeer Comandeer added the resolution:upstream Issue in the third-party software. label Mar 2, 2022
@Comandeer
Copy link
Member

I've changed the type of the issue to the bug as it was actually influencing conversion of Word content inside the CKEditor 4.

@CKEditorBot
Copy link
Collaborator

Closed in #5109

@CKEditorBot CKEditorBot added this to the 4.17.3 milestone Mar 2, 2022
@jacekbogdanski jacekbogdanski changed the title Failing tests (pixel calculations) on Chrome 98 Incorrect pixel calculation on Chrome 98 May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. resolution:upstream Issue in the third-party software. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants