CSS reference clip-path gets coordinate system (and more) wrong |
||||
Issue descriptionVersion: ToT, probably for as long as we've supported it OS: All What steps will reproduce the problem? Compare results for LayoutTests/compositing/overflow/accelerated-scrolling-with-clip-path.html and compositing/overflow/accelerated-scrolling-with-clip-reference.html, in test mode and in a browser What is the expected output? The tests should have identical output, and they pretty much do in the test suite where we force the scroll layer to be composited. What do you see instead? In the browser on a low DPI screen, or if we suppress composited scrolling for clipped layers to fix another bug, the output differs. And it differs differently in the browser and the test suite. Furthermore, according to the spec the clip path should ignore any display:none on the SVG content, but instead we do not apply the clip at all if the SVG is display:none. This is bad, because you really want to display:none the SVG you are using only to provide resources for CSS content. Instead we set width/height=0 which is limiting. And for completeness, the bug fix that revealed this is that CSS clips do not clip scrollbars when the scroller is composited. See fast/clip/014.html on a high-dpi device in the browser, or force composited scrolling.
,
Jun 4 2016
This reminds me of issue 373358 , which already has some discussion on what the "user coordinate space" might be. It also happens to start from the exact same tests (AFAICS) =). IIRC, the reason <shape> and url(...) differ currently is because the former (always) uses the offset of the layer bounds (when resolving the shape) while the same offset isn't applied in a way such that it'd affect the local coordinate space in which the clip-path (url, reference) would be.
,
Jun 6 2016
The definition of the two SVG unit types, converted to the CSS box model, is over in the Images 4 delta spec <https://drafts.csswg.org/css-images-4/#paint-sources>. It doesn't look like the spec has a good definition of which box to use as the bounds. I suggest following the clip-path default of border-box, which is a good approximation to what SVG does.
,
Jun 23 2016
Issue 373358 has been merged into this issue.
,
Jun 23 2016
http://jsbin.com/soveso/edit is producing very odd results.
,
Jun 23 2016
A guess would be that we apply the clip-path twice (once via PaintLayer and once via SVGPaintContext) for the root (outermost) <svg>. Try checking for isSVGRoot in the else-branch in SVGPaintContext::applyClipIfNecessary.
,
Jun 23 2016
...and those two callsites will use two different references boxes (the oBB in the latter case, which will be <100, 100, 400, 400>.)
,
Jun 23 2016
I bet that's it, yes. So the follow on fix for that might be not applying it in PaintLayer if the target is SVG.
,
Jun 23 2016
I'd suggest the opposite, since that's we're heading (i.e things that have a CSS layout box uses PaintLayer while the rest of the lot does something else.) That's also how we deal with opacity and blend-mode for the outermost root.
,
Jun 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e6cc64ba85ee2f7927578efb8d91641db367c2f0 commit e6cc64ba85ee2f7927578efb8d91641db367c2f0 Author: schenney <schenney@chromium.org> Date: Thu Jun 23 17:24:46 2016 Fix positioning of CSS reference clips in composited layers. When painting into composited scrolling layers, clip paths must use an offset from the root location to account for the origin of the the layer's paint coordinate system. SVG clips referenced by CSS, with the default UserSpaceOnUse coordinate system were not applying this offset as required. When the clip is in ObjectBoundingBox coordinates the offset was applied as a side effect of the object's bounding box. This patch corrects the position by adding the necessary offset when the clip coordinate system is UserSpaceOnUse. R=fs@opera.com BUG= 617265 Review-Url: https://codereview.chromium.org/2078343005 Cr-Commit-Position: refs/heads/master@{#401642} [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/LayoutTests/TestExpectations [add] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-scrolling-with-clip-path-text.html [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-scrolling-with-clip-path.html [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-scrolling-with-clip-reference.html [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/LayoutTests/css3/masking/clip-path-reference-userSpaceOnUse.html [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/Source/core/paint/SVGClipPainter.cpp [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/Source/core/paint/SVGClipPainter.h [modify] https://crrev.com/e6cc64ba85ee2f7927578efb8d91641db367c2f0/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
,
Jun 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee commit 7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee Author: Rebaseline Bot <blink-rebaseline-bot@chromium.org> Date: Thu Jun 23 19:02:25 2016 Auto-rebaseline for r401642 https://chromium.googlesource.com/chromium/src/+/e6cc64ba8 BUG= 617265 TBR=schenney@chromium.org Review URL: https://codereview.chromium.org/2097613002 . Cr-Commit-Position: refs/heads/master@{#401668} [modify] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/TestExpectations [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.png [add] https://crrev.com/7e91aa148b5d7b40b1f5035d6f2e6d805ef412ee/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-scrolling-with-clip-path-text-expected.txt
,
Jul 6 2016
,
Jul 6 2016
What's left to do here?
,
Jul 6 2016
We still have the issue that defs are not available to CSS when defined inside "display: none" SVG content. According to spec they should be. It could be a separate bug.
,
Jul 6 2016
We have issue 258029. (We also some seemingly conflicting bugs, like issue 231552...)
,
Jul 6 2016
The other bugs aren't really conflicting. It's more that we screw it up in different ways for different situations. And given I migrated the bugs, it's sad I don't remember. I'll close this one in favor of the others. |
||||
►
Sign in to add a comment |
||||
Comment 1 by schenney@chromium.org
, Jun 3 2016