-webkit-blend-mode fails for accelerated parents with overflow:hidden, for example: <div class="parent" style="overflow:hidden; -webkit-transform: translateZ(0)"> <div class="blendedChild" style="-webkit-blend-mode: difference"></div> <div class="nonBlendedChild"></div> </div> For this particular case, the parent element creates a clipping layer (m_childContainmentLayer), meaning that the blended child won't get an m_ancestorClippingLayer, breaking the previous functionality. Setting the blend mode on the parent clipping layer is wrong because it would cause all of the parent's children to blend, instead of just the ones that have blending set. To address this problem, I've found the following solution, which I've managed to validate with a prototype: When detecting an element that should create a clipping layer, while also having blended children, we disallow the clipping layer creation and mark the element. For each child layer, we check whether it has a blend mode or a subtree with a blended child. If so, we create an ancestor clipping layer (m_ancestorClippingLayer) and set its size/location according the what the clipping layer for the parent should have been. Otherwise, we have detected a child that doesn't have blending (neither the current element, nor its children), so we create a clipping layer. When setting the blend mode for the layer, we check for the existence of an ancestor clipping layer. If it exists, we set the CAFilter on it, otherwise we set the filter on the main graphics layer.
Created attachment 219914 [details] Test case showing the problem
Created attachment 225367 [details] Screenshot of expected versus current behaviour Use case: Composited parent with overflow:hidden. Two children, the second child is composited, overlaps the first child and has mix-blend-mode applied. This screenshot shows the current versus the desired behaviour: the second child should blend with both the parent and its sibling. This currently fails.
Created attachment 225369 [details] Prototype: not for review This is a solution discussed with Simon Fraser when initially implementing composited mix-blend-mode. For this use case, the parent creates a descendant clipping layer, which prevents blending for the second child. The proposed solution, (prototyped in this patch) is: If a layer has clipping, is composited and has a blended child, it propagates clipping by setting ancestor clipping layers for each child, instead of setting a descendant clipping layer on itself. If you have the following structure, for example: <parent overflow:hidden composited> <child1> <child2> <blended child> <child3> the parent would no longer create a descendant clipping layer. Instead, child1 and child2 would get ancestor clipping layers. Note that this patch is just a proof of concept, it should be a starting point and only provides minimal tested functionality.
Created attachment 227422 [details] Usecase with overflow:scroll
Created attachment 228829 [details] fix #1
Created attachment 230811 [details] Patch
Created attachment 230812 [details] Patch
Comment on attachment 230812 [details] Patch Attachment 230812 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6243960724914176 New failing tests: css3/compositing/blend-mode-clip-accelerated-blending-canvas.html media/W3C/video/networkState/networkState_during_loadstart.html
Created attachment 230814 [details] Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-12 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 230812 [details] Patch Attachment 230812 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4910260368179200 New failing tests: css3/compositing/blend-mode-clip-accelerated-blending-canvas.html compositing/geometry/video-opacity-overlay.html
Created attachment 230816 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 230812 [details] Patch Attachment 230812 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5721422387216384 New failing tests: css3/compositing/blend-mode-clip-accelerated-blending-canvas.html
Created attachment 230818 [details] Archive of layout-test-results from webkit-ews-03 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-03 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Created attachment 230820 [details] Patch
Comment on attachment 230820 [details] Patch Clearing flags on attachment: 230820 Committed r168314: <http://trac.webkit.org/changeset/168314>
All reviewed patches have been landed. Closing bug.