Bug 95917
Summary: | [chromium] Need a API to upload Android image resources from the embedder | ||
---|---|---|---|
Product: | WebKit | Reporter: | Tien-Ren Chen <trchen> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | enne, jamesr, peter, sievers |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Tien-Ren Chen
The edge effect layers need to acquire the glow textures from Android framework. (and potentially the shadow decoration needs it too? sievers@)
We can't do it from the WebKit side due to the lack of Dalvik VM access, so we need an API to upload it from the embedder side. Currently in my downstream code I add a new callback in WebWidgetClient like this:
class WebWidgetClient {
// Android only. Used to retrieve drawable resources from system theme.
virtual void getDrawableResources(WebImage* out, const char* name) { }
};
WebViewImpl::WebViewImpl(WebViewClient* client)
{
WebImage glowImage;
client->getDrawableResources(&glowImage, "android:drawable/overscroll_glow");
m_edgeEffectPlatformLayer = EdgeEffectLayerChromiumAndroid::create(glowImage.getSkBitmap());
}
Not sure if it is the best way to implement the thing. Let's discuss how to upstream this.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
James Robinson
Adrienne has a design doc about how to approach this for the compositor. We also have a general mechanism for loading resources into WebKit used by the theming logic on all platforms (including android). I would look at those and see if they meet your needs before proposing something new.
Tien-Ren Chen
(In reply to comment #1)
> Adrienne has a design doc about how to approach this for the compositor. We also have a general mechanism for loading resources into WebKit used by the theming logic on all platforms (including android). I would look at those and see if they meet your needs before proposing something new.
For the compositor part I believe you're referring to the DecorationManager thing? Yes that would definitely be useful.
Could you give me a pointer what to look for the theming logic? Is it the WebKitPlatformSupport class? Thanks!
James Robinson
http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Source/Platform/chromium/public/Platform.h&exact_package=chromium&q=Platform.h&l=261 exists and it used by, for instance, Image::loadPlatformResource() which looks similar to your need.
Tien-Ren Chen
(In reply to comment #3)
> http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Source/Platform/chromium/public/Platform.h&exact_package=chromium&q=Platform.h&l=261 exists and it used by, for instance, Image::loadPlatformResource() which looks similar to your need.
Sounds good. I think I don't need WebKit-side change then.
I will do something like this instead:
chrome/webkit/glue/webkitplatformsupport_impl.cc:
WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
....
#if defined(OS_ANDROID)
if (!strncmp(name, "android:drawable/", 17))
return loadAndroidDrawable(name);
#endif
....
}
Or do you prefer me to subclass it as WebKitPlatformSupportImplAndroid?
Another thing I'm not sure about is how to pass a decoded bitmap in WebData. The API seems to be designed to load raw files. I could pack the bitmap in some simple struct then pass it as the WebData payload, but I feel it will become a maintenance WTF later on.
Peter Beverloo
Resolving as WontFix given that Chromium moved to Blink.