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

Issue 614249 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Incorrect clipping for rounded corners on nested boxes

Project Member Reported by esprehn@chromium.org, May 24 2016

Issue description

Google Chrome	52.0.2743.0 (Official Build) canary (64-bit)
Revision	2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939}
OS	Mac OS X 

See the bottom corners on the dialog here:
http://output.jsbin.com/jicanaqico

Reduction is attached as well. Firefox and Safari handle this fine. It seems to be related to the 2d transform on the element with the border-radius.
 
chrome.png
4.3 KB View Download
safari.png
4.1 KB View Download
firefox.png
4.1 KB View Download
dialog-reduction.html
752 bytes View Download
Owner: fmalita@chromium.org
Status: Assigned (was: Untriaged)
Assigning to Florin as most expert in this area. But feel free to re-assign.
Cc: chrishtr@chromium.org
Initial findings -

1) only occurs in HiDPI mode (presumably the reporter uses a Retina display); use --force-device-scale-factor=2 to repro; the repro is somewhat dependent on window size/positioning - resize to trigger (or use a higher DSF, like 4)

2) seems related to the computed clip rrect geometry in Blink; we're stroking a border-rrect centered 1px border, then insetting by 0.5 for the clip => the clip rrect is supposed to be 1px smaller in both dimension, with radii adjusted accordingly.

In regular DPI mode, the rrects look as expected:

  border: [0.5 0.5 601.5 387.5] / 19.5r  => size: 601x387
  clip:   [1   1   601   387  ] / 19r    => size: 600x386

In HiDPI mode:

  border: [0.5 0.5 601.5 385.5] / 19.5r  => size: 601x385
  clip:   [1   1   601   386  ] / 19r    => size: 600x385

Something's off with the height numbers in HiDPI mode - while we're shrinking the width/radii as expected, we're not doing the same for height => the clip rrect bottom arcs are not concentric vs. the border arcs.

Looking.

dsf6-repro.png
1.6 KB View Download
Cc: fmalita@chromium.org jchaffraix@chromium.org
Owner: chrishtr@chromium.org
I tracked this down to border rect subpixel discrepancies between the regular layer paint path and the layer descendant clip path.

When painting the border, we call ComputedStyle::getRoundedInnerBorderFor() with a borderRect.y == -0.5. This comes from the layer location, which is taken into account during content paint: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp&l=695

OTOH, when clipping layer descendants, we pass a borderRect.y == 0 to getRoundedInnerBorderFor().  This comes from the layer pagination offset, which is the only offset used for LayerClipRecorder from PaintLayerPainter::paintForegroundForFragments(): https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp&l=735


So

1) paintFragmentWithPhase uses an offset based on the layer location (which happens to have a subpixel phase, y == -0.5)
2) paintForegroundForFragments uses a descendant clipping offset based on on the layer pagination offset (which in this case yields y == 0)
3) hence the border rects passed to getRoundedInnerBorderFor are pixel-snapped differently => the border and the descendant clip rounded-rects are misaligned.

I'm not sure which of the two code paths is correct.

Attaching a reduced test (open with --force-device-scale-factor=2 and resize vertically if the problem is not immediately obvious).

Chris, do you think this is something that will get fixed in SPv2?  Either way, please reassign to someone more familiar with layer clipping vs painting voodoo.
reduced.html
650 bytes View Download
Cc: schenney@chromium.org
Owner: ----
Status: Available (was: Assigned)
Project Member

Comment 5 by sheriffbot@chromium.org, Jun 12 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -jchaffraix@chromium.org ka...@opera.com
Labels: -Hotlist-Recharge-Cold BugSource-Chromium PaintTeamTriaged-20170612
Status: Available (was: Untriaged)
The corners look decent now at almost any size, but the bottom border disappears at some sizes, no doubt due to sub-pixel border painting.

Comment 7 by ka...@opera.com, Feb 28 2018

Cc: -ka...@opera.com karloygard@chromium.org

Sign in to add a comment