RESOLVED FIXED Bug 113732
[Texmap] Hierarchy of layers with opacity may result in wrong blending.
https://bugs.webkit.org/show_bug.cgi?id=113732
Summary [Texmap] Hierarchy of layers with opacity may result in wrong blending.
Bruno Abinader (history only)
Reported 2013-04-01 16:44:50 PDT
Created attachment 196038 [details] Test When working on a layout test for bug 50418, I have noticed that composited layers with a mixed set of layout positioning methods (fixed, absolute, relative, float) causes some visual artifacts with layout and rendering (see attached test). In Chrome it behaves correctly, while on both EFL and Qt running MiniBrowser I observed the same issues.
Attachments
Test (1.89 KB, text/html)
2013-04-01 16:44 PDT, Bruno Abinader (history only)
no flags
Expected result (3.47 KB, image/png)
2013-04-01 16:45 PDT, Bruno Abinader (history only)
no flags
Actual result (4.10 KB, image/png)
2013-04-01 16:46 PDT, Bruno Abinader (history only)
no flags
Much simplified test case (564 bytes, text/html)
2013-04-05 08:37 PDT, Noam Rosenthal
no flags
Exploratory patch (841 bytes, application/octet-stream)
2013-04-09 05:37 PDT, Bruno Abinader (history only)
no flags
Patch (13.52 KB, patch)
2013-04-09 09:25 PDT, Noam Rosenthal
no flags
Patch (13.81 KB, patch)
2013-04-09 10:12 PDT, Noam Rosenthal
no flags
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (557.15 KB, application/zip)
2013-04-09 14:15 PDT, Build Bot
no flags
Patch (14.53 KB, patch)
2013-04-10 01:18 PDT, Noam Rosenthal
no flags
Patch (14.54 KB, patch)
2013-04-10 01:19 PDT, Noam Rosenthal
no flags
Bruno Abinader (history only)
Comment 1 2013-04-01 16:45:55 PDT
Created attachment 196039 [details] Expected result Expected result as obtained from Chrome.
Bruno Abinader (history only)
Comment 2 2013-04-01 16:46:54 PDT
Created attachment 196040 [details] Actual result Actual (buggy) result from both Qt and EFL builds (might also be happening on other AC-enabled ports).
Bruno Abinader (history only)
Comment 3 2013-04-03 06:04:05 PDT
I found out yesterday two things: 1. If we change both location and size of the tileRect passed to paintWithIntermediateSurface to be IntPoint(0,0) and maxTextureSize, respectively, the texture layers are properly rendered but with messy opacity blending. 2. When using "-webkit-transform-style: preserve-3d;" on all composited layers, the issue disappears. My guess is that this makes shouldBlend() return false, thus forcing codepath to not enter paintUsingOverlapRegions().
Noam Rosenthal
Comment 4 2013-04-03 06:23:48 PDT
Yes, the bug is probably in the overlap region calculation then.
Noam Rosenthal
Comment 5 2013-04-05 08:37:42 PDT
Created attachment 196637 [details] Much simplified test case
Bruno Abinader (history only)
Comment 6 2013-04-09 05:33:37 PDT
(In reply to comment #5) > Created an attachment (id=196637) [details] > Much simplified test case No'am, I haven't noticed any issues with your testcase, at least not on EFL port. I have a fix for the surface positioning issue (see below), however opacity blending results are still wrong. diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index 5911513..70c98be 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -412,7 +412,10 @@ void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOp mainSurface = replicaSurface; } - commitSurface(options, mainSurface, rect, options.opacity); + // Offset needs to be reset when committing to surface. + TextureMapperPaintOptions surfaceOptions(options); + surfaceOptions.offset = IntSize(); + commitSurface(surfaceOptions, mainSurface, rect, options.opacity); } void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options) Can you please test this on your environment to see if it works? I'll attach it as a patch to make it easy to apply.
Bruno Abinader (history only)
Comment 7 2013-04-09 05:37:53 PDT
Created attachment 197035 [details] Exploratory patch When committing the surface, resetting the offset value makes the painted surfaces being correctly positioned. However, the opacity blending still have incorrect values when compared to non-composited result.
Bruno Abinader (history only)
Comment 8 2013-04-09 05:52:04 PDT
Comment on attachment 197035 [details] Exploratory patch As Noam commented on IRC, this fix is wrong (only affects the provided test-case).
Noam Rosenthal
Comment 9 2013-04-09 09:25:28 PDT
Allan Sandfeld Jensen
Comment 10 2013-04-09 09:51:43 PDT
Comment on attachment 197136 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=197136&action=review > Source/WebCore/platform/graphics/texmap/TextureMapperGL.h:100 > + enum MirrorMode { > + ShouldNotMirror, > + ShouldMirror > + }; Could you add a comment about what MirrorMode represents?
Noam Rosenthal
Comment 11 2013-04-09 10:12:24 PDT
Build Bot
Comment 12 2013-04-09 14:15:33 PDT
Comment on attachment 197141 [details] Patch Attachment 197141 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-commit-queue.appspot.com/results/17690016 New failing tests: compositing/overlap-blending/nested-overlap.html
Build Bot
Comment 13 2013-04-09 14:15:35 PDT
Created attachment 197174 [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.2
Noam Rosenthal
Comment 14 2013-04-10 01:18:22 PDT
Noam Rosenthal
Comment 15 2013-04-10 01:19:36 PDT
WebKit Commit Bot
Comment 16 2013-04-10 04:47:02 PDT
Comment on attachment 197221 [details] Patch Clearing flags on attachment: 197221 Committed r148090: <http://trac.webkit.org/changeset/148090>
WebKit Commit Bot
Comment 17 2013-04-10 04:47:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.