New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 607993 link

Starred by 24 users

Issue metadata

Status: Fixed
Owner:
not on Chrome anymore
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug

Blocking:
issue 605745



Sign in to add a comment

At certain resolutions in hidpi a black 1 pixel border is visible at the edge of the chrome

Project Member Reported by bsep@chromium.org, Apr 29 2016

Issue description

Version: 52.0.2720.0 (Official Build) canary (64-bit)
OS: Windows 10

At any device scale factor >1 if you resize the browser to certain resolutions you can see a 1 pixel black border on the right and bottom edges, between the chrome and the Windows 10 border (see attached image).

I originally thought that odd resolutions would exhibit the border and even resolutions wouldn't (some kind of rounding error) but I doubled-checked with spyxx and that's not true, so I don't know exactly what triggers it. If you can't see the border you can usually get it by resizing the window by 1 pixel.
 
that-dang-border.PNG
23.4 KB View Download

Comment 1 by bsep@chromium.org, Apr 29 2016

Cc: abodenha@chromium.org ananta@chromium.org sky@chromium.org bsep@chromium.org jsc...@chromium.org osh...@chromium.org
 Issue 581797  has been merged into this issue.
Huh! I'm surprised it's not even/odd.
At 1.5x, it seems like it's % 3, bizarrely. (Alt-Space, S, Ctrl-Arrow to confirm)
At 2x it's even/odd, which is a bit less wacky.

Gathered some data at different dsfs: https://docs.google.com/spreadsheets/d/1Rs4qlfKKtcRBT4wSqx057O_D-tSRmvPdCqmDfiizeAs/edit?usp=sharing

It's clearly periodic based on the pixels=>dips conversion remainder, likely because content width is in integral dips (I think?)

But it's not just the width. I guess there's some offset from the left also related to dsf.
I think the correct fix is to only allow window sizes that will result in an integral content window size in WM_SIZING. (It looks like Mac does the equivalent of that, or maybe the OS does it).

But I'm still not certain how to calculate that width.
Owner: scottmg@chromium.org
Status: Started (was: Untriaged)
Obsessiveness triumphed, and I figured out what's wrong here.

It's "just" that the client area needs to be an integral multiple of the DSF. (The rects above were looking at the window rect which was confusing.)

There's sort of two different things at play here:

1. The client area (pixels) needs to be a *multiple* of the DSF so that when blink's size is set to an integral number of dips it can match.

2. The client area (pixels) needs to be an *integral* multiple of the DSF because the window size can't be a fraction, of course.

This means:
At dsf=1.5x, width needs to be % 3.
At dsf=2x, width needs to be % 2
At dsf=1.75x, width needs to be % 7.
At dsf=2.5x, width needs to be % 5.
At dsf=πx, still calculating.

(I think the multiple required is... the numerator of the DSF expressed as a reduced improper fraction (?) Maybe there's a clearer way to express/calculate that.)
https://codereview.chromium.org/1935883002/ fixes it during sizing, yay! But I need to do something at initial window creation time too. (I have to use WM_SIZING rather than WM_WINDOWPOSCHANGING to handle resizes on the left/top, I think.)

Comment 8 by sky@chromium.org, May 2 2016

7 pixels is a lot! Did you try not forcing the size to change, but rounding up how big we think the client area is? This would result in not seeing part of the painting, but that seems better than forcing to sizes that need to change based on scale factor.
I don't think that's a good idea, we're just going to end up with different weird artifacts. 7 pixels isn't really that much in hidpi.

Comment 10 by sky@chromium.org, May 2 2016

Can't users type in any scale factor, that may not not map nicely at all to an integer?
Only with a command line flag, not in normal use that I know of. Windows 10 only does 0.25 increments.

I guess instead of calculating, I could only apply the clamp only for a known set of scales? Would just be a table of 1.25-3.5 by 25, and then if someone typed in a weird one manually, they'd just still have the black line artifact.
Am I wrong in thinking the real long-term fix here is for views to do all its layout in pixels instead of dips (or, equivalently, use dips but have them be non-integral so that they can convey sub-dip precision), so the content area can take on any integral pixel size at any scale factor?

For example, even if you fix the size to be an integral dip size, you also need to do similarly with the window position.  The position issue results in problems everywhere we convert back and forth between native screen coordinates in pixels and dip-based coordinates; for example, the omnibox dropdown content can be mis-positioned because it's placed absolutely in screen coordinates that go through this conversion.

And all these are just hacks to get around the precision loss issue.  Long term, presumably, we need to address that.

Comment 13 by bsep@chromium.org, Aug 9 2016

Labels: Hotlist-Win10FrontendPolish
Project Member

Comment 14 by bugdroid1@chromium.org, Aug 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e94bb783688613f83f8ba7c6a9b006e751f28aa3

commit e94bb783688613f83f8ba7c6a9b006e751f28aa3
Author: jbauman <jbauman@chromium.org>
Date: Mon Aug 22 19:46:51 2016

Use enclosing rect to find WindowTreeHost size.

This was using the floored size, so with fractional device scale factors
the right and bottom pixels sometimes aren't drawn. The resulting black
area looks ugly with opaque windows (e.g. with a theme on the browser
window).

BUG= 607993 

Review-Url: https://codereview.chromium.org/2263453002
Cr-Commit-Position: refs/heads/master@{#413515}

[modify] https://crrev.com/e94bb783688613f83f8ba7c6a9b006e751f28aa3/ui/aura/BUILD.gn
[modify] https://crrev.com/e94bb783688613f83f8ba7c6a9b006e751f28aa3/ui/aura/window_tree_host.cc
[add] https://crrev.com/e94bb783688613f83f8ba7c6a9b006e751f28aa3/ui/aura/window_tree_host_unittest.cc

Comment 15 by bsep@chromium.org, Aug 25 2016

Status: Fixed (was: Started)
Is this fixed? It looks fixed to me. If it actually isn't feel free to reopen.
Owner: jbau...@chromium.org
Yeah, lgtm. Thanks John!
Cc: robliao@chromium.org ranjitkan@chromium.org jbau...@chromium.org foolip@chromium.org rnimmagadda@chromium.org
 Issue 462857  has been merged into this issue.

Sign in to add a comment