Great problem description, thanks!

Well, the transparent webview is not supported by XWalk yet.

As you mentioned, it would take a long time to reclaim the memory after iframe 
is removed, it is not beyond my expectation since the memory reclaim happened 
in DOM tree depends on the javascript GC, we cannot anticipate the timing when 
it should be reclaimed.

I have a simple experiment with XWalkView to add/remove iframe (containing a 
canvas game) again and again, actually I don’t find the memory bloats, and the 
app runs well. So I have 3 questions about your use case:

1.       How do you remove iframe? By document.removeChild, visibility:hidden 
or display:none?

2.       Is it only one XWalkView created in your case that would crash later?

3.       Do you press ‘back’ button and resume it back before the app gets 
crashed?

Thanks…Hongbo

From: Florian Landerl [mailto:[email protected]]
Sent: Tuesday, July 8, 2014 6:57 PM
To: Min, Hongbo; [email protected]
Subject: RE: [Crosswalk-help] Transparent WebView

Hello Hongbo,

thanks for your answer!

A transparent webview for our needs is exactly as you described: elements 
(text, images) should be rendered normally but the body’s background color 
should be transparent instead of white. This used to be possible but that 
behaviour seems to be broken for quite some time. We found this bugreport from 
2011: https://code.google.com/p/android/issues/detail?id=14749

Actually using a transparent webview was an attempted workaround for a 
completely different issue we’re experiencing: we load 3rd party content 
(canvas games) inside an iframe and show custom UI partially above the game. 
Problem is that it takes a long time until the memory is reclaimed after the 
iframe has been removed. We do not see this behaviour in normal (non XWalk) 
webviews. Our idea was to load the canvas games in another webview to have that 
memory isolated & taken care of separately.

So our main problem is that the app will crash after some time because the 
memory is not properly/quickly enough freed. We haven’t found why this happens 
but we’ll continue to investigate. Do you have any idea what causes the issue 
with the iframe?

Thanks,
Florian


Am 08. Juli 2014 bei 03:16:08, Min, Hongbo 
([email protected]<mailto:[email protected]>) schrieb:
Hi Florian,

setAlpha will actually hide the whole view visually. I am not sure what is the 
right behavior of transparent webview.  Would it only render text/image in the 
page but with transparent background color instead of white color by default? 
If so, I am afraid the current XWalkView cannot do that since the background 
color is controlled by the renderer engine which doesn’t support transparent 
color rendering, there is no way to change its background color by Android SDK 
after the rendering is completed for a web page.

It would be appreciated if you could describe what the overlay webview looks 
like and what the transparent background color is in your use case. Thanks.

Hongbo

From: Florian Landerl [mailto:[email protected]]
Sent: Monday, July 7, 2014 11:14 PM
To: Min, Hongbo; 
[email protected]<mailto:[email protected]>
Subject: RE: [Crosswalk-help] Transparent WebView

Hello Hongbo,

thanks for your suggestion. Apparently, there are several limitations with the 
default SurfaceView (stacking views is not possible/advised). I already tried 
enabling ANIMATABLE_XWALK_VIEW ever since I came across the following article 
earlier today: 
https://github.com/crosswalk-project/crosswalk-website/wiki/Android-SurfaceView-vs-TextureView

setAlpha() now indeed works. However, setting the opacity is not what I’m 
looking for. We need to have a transparent background color in order to use the 
webview as an overlay. Neither setBackgroundColor(Color.TRANSPARENT), 
setBackgroundDrawable(null) nor setBackgroundResource(0) has any effect, even 
when XWalkView is using a TextureView.

Is there anything obvious I’m missing?

Thanks,
Florian

Am 07. Juli 2014 bei 16:44:00, Min, Hongbo 
([email protected]<mailto:[email protected]>) schrieb:
Florian,

You may have a try to enable animitable XWalkView, the setAlpha would work on 
an animitable XWalkView. See 
https://crosswalk-project.org/#wiki/Android-SurfaceView-vs-TextureView about 
different backend for XWalkView, and 
https://crosswalk-project.org/apis/embeddingapidocs/reference/org/xwalk/core/XWalkPreferences.html#ANIMATABLE_XWALK_VIEW
 for how to enable animitable XWalkView. Hope it can work for you.

From: Florian Landerl [mailto:[email protected]]
Sent: Monday, July 7, 2014 5:54 PM
To: Min, Hongbo; 
[email protected]<mailto:[email protected]>
Subject: RE: [Crosswalk-help] Transparent WebView

Thanks for your reply, Hongbo.

Unfortunately, calling setAlpha() does not make any difference. Also, 
setAlpha() would not yield the result we’re looking for: we need the background 
color of the Crosswalk Cordova webview to be transparent. The Cordova webview 
should act as some kind of overlay above the other webview.

We tried all of the following but none shows any effect:
* webView.setBackgroundColor(Color.TRANSPARENT);
* webView.setBackgroundDrawable(null);
* webView.setBackgroundResource(0);

Cheers,
Florian


Am 07. Juli 2014 bei 09:24:03, Min, Hongbo 
([email protected]<mailto:[email protected]>) schrieb:
Hi, Florian

Does setAlpha on XWalk webview work for you?

Regards
Hongbo
________________________________
From: Crosswalk-help [[email protected]] on 
behalf of Florian Landerl [[email protected]]
Sent: Monday, July 07, 2014 5:39 AM
To: 
[email protected]<mailto:[email protected]>
Subject: [Crosswalk-help] Transparent WebView

Hello everyone,

is it possible to have a transparent Crosswalk webview?
In our Cordova project with XWalk webview we want to add an additional XWalk 
based webview below the main Cordova view. We managed to create the second 
webview but we've found no option so far to make the main webview transparent. 
Is this possible at all?

Any help is greatly appreciated.
Thanks in advance!

Cheers,
Florian
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to