The pixel result of compositing/webgl/webgl-reflection.html shows that WebGL doesn't show in CSS reflections.
This appears to pass as of r115915
Actually it still fails. The output of NRWT is confusing when pixel testing is not active.
Specifically "Tests expected to fail but passed:" incorrectly lists tests that have expected IMAGE failure, even when pixel testing is not active.
This isn't just a problem with DRT, this does not work in Safari with a simple test.
<rdar://problem/26541236>
Created attachment 280089 [details] Testcase The attached test case shows that the background color (blue) of the WebGL <canvas> is reflected but the actual WebGL content (fuchsia).
I wonder if we should be doing extra work in PlatformCALayerCocoa::clone() so that the contentsLayer of the new newLayer is set. My guess is that the replication layer doesn't have a call to setContentsToPlatformLayer() like the replicated layer does.
(In reply to comment #7) > I wonder if we should be doing extra work in PlatformCALayerCocoa::clone() > so that the contentsLayer of the new newLayer is set. My guess is that the > replication layer doesn't have a call to setContentsToPlatformLayer() like > the replicated layer does. Without looking at the code, I would guess this should work the same as video. I think you're right that it does that via setContentsToPlatformLayer.
In PlatformCALayerRemoteCustom::clone, I also see this which looks suspicious in order to get reflections working on iOS: if (layerType() == LayerTypeWebGLLayer) { clonedLayer = adoptNS([[CALayer alloc] init]); // FIXME: currently copying WebGL contents breaks the original layer. copyContents = false; }
My current understanding of this issue is that reflections are updated to match their replicated layer's content in GraphicsLayerCA::layerDidDisplay where we iterate through the layer clones. There, we check whether the layer that displayed was the layer itself or its content layer. In the case of a <canvas> element using WebGL, we only get notifications for the layer, not the content layer. However, the content layer is the one which has its backing CALayer's contents set to the WebGLLayer's content, so without this notification the code doesn't update the content layer's clones. I'm not sure why these notifications aren't fired. As for <video> elements, their reflections work out due to specific work done in PlatformCALayerCocoa::clone to set the AVPlayer of the cloned layer (the replica) to the original layer (the replicated layer). Not sure yet if we should add WebGL-specific code in PlatformCALayerCocoa::clone or get GraphicsLayerCA::layerDidDisplay to be called with the content layer of a GraphicsLayerCA backing a WebGL <canvas> element. My hunch is the latter, which should trigger once the WebGLLayer has been drawn.
The problem was indeed the lack of GraphicsLayerCA::layerDidDisplay notification for the content layer. The issue was that the [CALayer display] override in WebGLLayer did not call dispatch the notification the way WebLayer does.
This doesn't fix iOS though, which is probably due to PlatformCALayerRemoteCustom::clone.
Created attachment 280357 [details] Patch
I raised https://bugs.webkit.org/show_bug.cgi?id=158314 for iOS support.
Comment on attachment 280357 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=280357&action=review > Source/WebCore/ChangeLog:12 > + > + * platform/graphics/mac/WebGLLayer.mm: Mention the existing test.
Created attachment 280430 [details] Patch for landing
Comment on attachment 280430 [details] Patch for landing Clearing flags on attachment: 280430 Committed r201639: <http://trac.webkit.org/changeset/201639>
All reviewed patches have been landed. Closing bug.