A WebView with AllowsTransparency should allow transparency when a PNG is returned from captureVisibleRegion() |
||||
Issue descriptionWhat steps will reproduce the problem? (1) Use WebView.captureVisibleRegion() to capture the contents of a WebView that (i) has AllowsTransparency set, and (ii) is displaying transparent content (e.g. an SVG drawing). Request the data as a PNG image. What is the expected output? The returned PNG should retain the transparency of the contents. What do you see instead? The transparency information is discarded, and the image has a solid background. Please use labels and text to provide additional information. captureVisibleRegion for WebView was implemented in https://codereview.chromium.org/1635513003/ Comments on this issue describe this problem.
,
Apr 4 2016
,
Apr 6 2016
Wrote a test case that displays <webview> with and without transparency. The screenshot button will capture the webview's visible region and display that png in a new window (with checkerboard background to show transparency). See https://github.com/avallee/chrome-samples/tree/master/webview_transparency
,
Apr 6 2016
Here's a preview of rendering SVGs in a webview.
,
Apr 7 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/71152bea8837143acecf76d4c662b3482eeab66a commit 71152bea8837143acecf76d4c662b3482eeab66a Author: avallee <avallee@chromium.org> Date: Thu Apr 07 18:49:53 2016 <webview>: Fix missing transparency in captureVisibleRegion(). In output formats that support transparency (png), WebContentsCaptureClient::EncodeBitmap should propagate the alpha values of the WebContents if that contents has any. BUG= 600496 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Review URL: https://codereview.chromium.org/1863953002 Cr-Commit-Position: refs/heads/master@{#385821} [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/chrome/browser/extensions/api/tabs/tabs_api.cc [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/chrome/browser/extensions/api/tabs/tabs_api.h [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/extensions/browser/api/guest_view/web_view/web_view_internal_api.h [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/extensions/browser/api/web_contents_capture_client.cc [modify] https://crrev.com/71152bea8837143acecf76d4c662b3482eeab66a/extensions/browser/api/web_contents_capture_client.h
,
Apr 7 2016
,
Apr 7 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/bc79c30f2651c40d4bd5b219b22bfc6985e27679 commit bc79c30f2651c40d4bd5b219b22bfc6985e27679 Author: avallee <avallee@chromium.org> Date: Thu Apr 07 19:20:06 2016 Add webview sample for captureVisibleRegion(). App allows the webview to be created both with and without allowtransparency. BUG= 600496 Review URL: https://codereview.chromium.org/1869533002 Cr-Commit-Position: refs/heads/master@{#385834} [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/display.html [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/main.js [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/manifest.json [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/test.html [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/test.js [add] https://crrev.com/bc79c30f2651c40d4bd5b219b22bfc6985e27679/chrome/common/extensions/docs/examples/api/webview/capturevisibleregion/test2.html
,
Apr 7 2016
Thanks for fixing this bug! I will test it as soon as it hits Canary.
,
Apr 22 2016
@#8: did this resolve your issue?
,
Apr 22 2016
@#9: Yes, everything seems to work fine. I have managed to successfully replace the buggy canvas-based rasterisation code with this new API. I will open a separate bug in case I find any edge cases where it breaks. |
||||
►
Sign in to add a comment |
||||
Comment 1 by aval...@chromium.org
, Apr 4 2016