Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Fix incorrectly reported width when measuring lines - #9383

Merged
nathansobo merged 1 commit into
masterfrom
as-bad-positioning
Nov 2, 2015
Merged

nathansobo merged 1 commit into
masterfrom
as-bad-positioning

Conversation

@as-cii

@as-cii as-cii commented Nov 1, 2015

Copy link
Copy Markdown
Contributor

This commit fixes what seems to be a bug in Chromium. Fixes #9382.

Before:

before

After:

screen shot 2015-11-01 at 19 33 27

When measuring lines (and with a special character sequence), it could happen
that Range(0, 0). getBoundingClientRect().width reports a number greater than 0.
This seems to happen when the font size is smaller than 12px and it's probably
due to subpixel font scaling. To solve it we've explicitly included a guard
clause that prevents this problem to happen.

/cc: @nathansobo @50Wliu @thomasjo @atom/feedback for 👀

This commit fixes what seems to be a bug in Chromium.

When measuring lines (and with a special character sequence), it could happen
that Range(0, 0). getBoundingClientRect().width reports a number greater than 0.
This seems to happen when the font size is smaller than 12px and it's probably
due to subpixel font scaling. To solve it we've explicitly included a guard
clause that prevents this problem to happen.
nathansobo pushed a commit that referenced this pull request Nov 2, 2015
Fix incorrectly reported width when measuring lines
@nathansobo
nathansobo merged commit 252aed0 into master Nov 2, 2015
@nathansobo

Copy link
Copy Markdown
Contributor

@as-cii Does this affect beta or stable?

@as-cii

as-cii commented Nov 2, 2015

Copy link
Copy Markdown
Contributor Author

I think it affects stable, as it's most likely related to the enablement of subpixel font-scaling.

@as-cii

as-cii commented Nov 2, 2015

Copy link
Copy Markdown
Contributor Author

For posterity, after double checking this we've concluded this affects only beta and not stable.

@as-cii
as-cii deleted the as-bad-positioning branch November 2, 2015 17:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursors are slightly off when font-size is smaller than 12px

2 participants