summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-07-27 13:53:42 +0100
committerBen Murdoch <benm@google.com>2011-08-16 16:40:55 +0100
commitce03c1c1203621e552d41a8b3831837636f364a9 (patch)
treed2ec3d82cadc9d5a66ea73ade2932de955e4618f /Source/WebKit
parent0f0dadb092f4aaa1a34d293f9c4b2a14e3b3e3df (diff)
downloadexternal_webkit-ce03c1c1203621e552d41a8b3831837636f364a9.zip
external_webkit-ce03c1c1203621e552d41a8b3831837636f364a9.tar.gz
external_webkit-ce03c1c1203621e552d41a8b3831837636f364a9.tar.bz2
Lazily decode assets for form controls.
Rather than decoding the graphics when we create a WebView, wait until we actually need them. This saves about 50ms on native WebView creation time. Requires frameworks/base change: I5a2e87d03d73fa74ebb00c33567783225ed97d3a Bug: 5084146 Change-Id: Ia6c17634f535ed75b2a0757ac4d53f1a0befb78a
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/RenderSkinAndroid.cpp21
-rw-r--r--Source/WebKit/android/RenderSkinAndroid.h18
-rw-r--r--Source/WebKit/android/RenderSkinButton.cpp37
-rw-r--r--Source/WebKit/android/RenderSkinButton.h12
-rw-r--r--Source/WebKit/android/RenderSkinCombo.cpp32
-rw-r--r--Source/WebKit/android/RenderSkinCombo.h15
-rw-r--r--Source/WebKit/android/RenderSkinMediaButton.cpp24
-rw-r--r--Source/WebKit/android/RenderSkinMediaButton.h6
-rw-r--r--Source/WebKit/android/RenderSkinRadio.cpp47
-rw-r--r--Source/WebKit/android/RenderSkinRadio.h8
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp5
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.h6
-rw-r--r--Source/WebKit/android/nav/WebView.cpp19
13 files changed, 142 insertions, 108 deletions
diff --git a/Source/WebKit/android/RenderSkinAndroid.cpp b/Source/WebKit/android/RenderSkinAndroid.cpp
index 9383a9c..8aedd9e 100644
--- a/Source/WebKit/android/RenderSkinAndroid.cpp
+++ b/Source/WebKit/android/RenderSkinAndroid.cpp
@@ -33,21 +33,28 @@
#include "RenderSkinRadio.h"
#include "SkImageDecoder.h"
-#include "utils/AssetManager.h"
-#include "utils/Asset.h"
+#include <utils/AssetManager.h>
+#include <utils/Asset.h>
namespace WebCore {
+String RenderSkinAndroid::s_drawableDirectory = "";
+RenderSkinAndroid::Resolution RenderSkinAndroid::s_drawableResolution = RenderSkinAndroid::MedRes;
+
RenderSkinAndroid::~RenderSkinAndroid()
{
delete m_button;
}
-RenderSkinAndroid::RenderSkinAndroid(android::AssetManager* am, String drawableDirectory)
+RenderSkinAndroid::RenderSkinAndroid(String drawableDirectory)
{
- m_button = new RenderSkinButton(am, drawableDirectory);
- RenderSkinCombo::Init(am, drawableDirectory);
- RenderSkinMediaButton::Init(am, drawableDirectory);
- RenderSkinRadio::Init(am, drawableDirectory);
+ if (s_drawableDirectory.isEmpty() && !drawableDirectory.isEmpty()) {
+ s_drawableResolution = MedRes;
+ if (drawableDirectory.endsWith("-hdpi/"))
+ s_drawableResolution = HighRes;
+
+ s_drawableDirectory = drawableDirectory;
+ }
+ m_button = new RenderSkinButton(drawableDirectory);
}
bool RenderSkinAndroid::DecodeBitmap(android::AssetManager* am, const char* fileName, SkBitmap* bitmap)
diff --git a/Source/WebKit/android/RenderSkinAndroid.h b/Source/WebKit/android/RenderSkinAndroid.h
index 73773ea..a7282e2 100644
--- a/Source/WebKit/android/RenderSkinAndroid.h
+++ b/Source/WebKit/android/RenderSkinAndroid.h
@@ -50,11 +50,12 @@ public:
kNumStates
};
- /**
- * Initialize the Android skinning system. The AssetManager may be used to find resources used
- * in rendering.
- */
- RenderSkinAndroid(android::AssetManager*, String drawableDirectory);
+ enum Resolution {
+ MedRes,
+ HighRes
+ };
+
+ RenderSkinAndroid(String drawableDirectory);
~RenderSkinAndroid();
/* DecodeBitmap determines which file to use, with the given fileName of the form
@@ -63,9 +64,14 @@ public:
*/
static bool DecodeBitmap(android::AssetManager* am, const char* fileName, SkBitmap* bitmap);
- const RenderSkinButton* renderSkinButton() const { return m_button; }
+ static String DrawableDirectory() { return s_drawableDirectory; }
+ static Resolution DrawableResolution() { return s_drawableResolution; }
+
+ RenderSkinButton* renderSkinButton() const { return m_button; }
private:
+ static String s_drawableDirectory;
+ static Resolution s_drawableResolution;
RenderSkinButton* m_button;
};
diff --git a/Source/WebKit/android/RenderSkinButton.cpp b/Source/WebKit/android/RenderSkinButton.cpp
index 6a0ae54..11e2fa8 100644
--- a/Source/WebKit/android/RenderSkinButton.cpp
+++ b/Source/WebKit/android/RenderSkinButton.cpp
@@ -42,6 +42,8 @@
#include <utils/ResourceTypes.h>
#include <wtf/text/CString.h>
+extern android::AssetManager* globalAssetManager();
+
static const char* gFiles[] = {
"btn_default_disabled_holo.9.png",
"btn_default_normal_holo.9.png",
@@ -51,29 +53,42 @@ static const char* gFiles[] = {
namespace WebCore {
-RenderSkinButton::RenderSkinButton(android::AssetManager* am, String drawableDirectory)
+RenderSkinButton::RenderSkinButton(String drawableDirectory)
+ : m_decoded(false)
+ , m_decodingAttempted(false)
+ , m_drawableDirectory(drawableDirectory)
{
- m_decoded = true;
+ // Ensure our enums properly line up with our arrays.
+ android::CompileTimeAssert<(RenderSkinAndroid::kDisabled == 0)> a1;
+ android::CompileTimeAssert<(RenderSkinAndroid::kNormal == 1)> a2;
+ android::CompileTimeAssert<(RenderSkinAndroid::kFocused == 2)> a3;
+ android::CompileTimeAssert<(RenderSkinAndroid::kPressed == 3)> a4;
+}
+
+void RenderSkinButton::decode()
+{
+ m_decodingAttempted = true;
+
+ android::AssetManager* am = globalAssetManager();
+
for (size_t i = 0; i < 4; i++) {
- String path = String(drawableDirectory.impl());
+ String path = m_drawableDirectory;
path.append(String(gFiles[i]));
if (!RenderSkinNinePatch::decodeAsset(am, path.utf8().data(), &m_buttons[i])) {
m_decoded = false;
- LOGE("RenderSkinButton::Init: button assets failed to decode\n\tBrowser buttons will not draw");
+ LOGE("RenderSkinButton::decode: button assets failed to decode\n\tWebView buttons will not draw");
return;
}
}
-
- // Ensure our enums properly line up with our arrays.
- android::CompileTimeAssert<(RenderSkinAndroid::kDisabled == 0)> a1;
- android::CompileTimeAssert<(RenderSkinAndroid::kNormal == 1)> a2;
- android::CompileTimeAssert<(RenderSkinAndroid::kFocused == 2)> a3;
- android::CompileTimeAssert<(RenderSkinAndroid::kPressed == 3)> a4;
+ m_decoded = true;
}
void RenderSkinButton::draw(SkCanvas* canvas, const IntRect& r,
- RenderSkinAndroid::State newState) const
+ RenderSkinAndroid::State newState)
{
+ if (!m_decodingAttempted)
+ decode();
+
// If we failed to decode, do nothing. This way the browser still works,
// and webkit will still draw the label and layout space for us.
if (!m_decoded) {
diff --git a/Source/WebKit/android/RenderSkinButton.h b/Source/WebKit/android/RenderSkinButton.h
index e9db74c..83c57dd 100644
--- a/Source/WebKit/android/RenderSkinButton.h
+++ b/Source/WebKit/android/RenderSkinButton.h
@@ -36,19 +36,19 @@ class IntRect;
class RenderSkinButton {
public:
- /**
- * Initialize the class before use. Uses the AssetManager to initialize any
- * bitmaps the class may use.
- */
- RenderSkinButton(android::AssetManager*, String drawableDirectory);
+ RenderSkinButton(String drawableDirectory);
/**
* Draw the skin to the canvas, using the rectangle for its bounds and the
* State to determine which skin to use, i.e. focused or not focused.
*/
- void draw(SkCanvas* , const IntRect& , RenderSkinAndroid::State) const;
+ void draw(SkCanvas* , const IntRect& , RenderSkinAndroid::State);
+
+ void decode();
private:
bool m_decoded;
+ bool m_decodingAttempted;
NinePatch m_buttons[4];
+ String m_drawableDirectory;
};
} // WebCore
diff --git a/Source/WebKit/android/RenderSkinCombo.cpp b/Source/WebKit/android/RenderSkinCombo.cpp
index b30dc29..2f8f023 100644
--- a/Source/WebKit/android/RenderSkinCombo.cpp
+++ b/Source/WebKit/android/RenderSkinCombo.cpp
@@ -33,8 +33,11 @@
#include "RenderStyle.h"
#include "SkCanvas.h"
#include "SkNinePatch.h"
+#include <utils/AssetManager.h>
#include <wtf/text/CString.h>
+extern android::AssetManager* globalAssetManager();
+
namespace WebCore {
// Indicates if the entire asset is being drawn, or if the border is being
@@ -75,24 +78,27 @@ static const int stretchTop[2] = {15, 23}; // border width for the to
// of the arrow.
static const int arrowWidth[2] = {22, 31};
-RenderSkinCombo::Resolution RenderSkinCombo::resolution = MedRes;
-
const SkIRect RenderSkinCombo::margin[2][2] = {{{ stretchMargin[MedRes], stretchTop[MedRes],
RenderSkinCombo::arrowMargin[MedRes] + stretchMargin[MedRes], stretchMargin[MedRes] },
{0, stretchTop[MedRes], 0, stretchMargin[MedRes]}},
{{ stretchMargin[HighRes], stretchTop[HighRes],
RenderSkinCombo::arrowMargin[HighRes] + stretchMargin[HighRes], stretchMargin[HighRes] },
{0, stretchTop[HighRes], 0, stretchMargin[HighRes]}}};
-static SkBitmap bitmaps[2][2]; // Collection of assets for a combo box
-static bool isDecoded; // True if all assets were decoded
+static SkBitmap bitmaps[2][2]; // Collection of assets for a combo box
+static bool isDecodingAttempted = false; // True if we've tried to decode the assets
+static bool isDecoded = false; // True if all assets were decoded
-void RenderSkinCombo::Init(android::AssetManager* am, String drawableDirectory)
+void RenderSkinCombo::Decode()
{
- if (isDecoded)
+ if (isDecodingAttempted)
return;
- if (drawableDirectory[drawableDirectory.length() - 5] == 'h')
- resolution = HighRes;
+ isDecodingAttempted = true;
+ isDecoded = false;
+
+ android::AssetManager* am = globalAssetManager();
+
+ String drawableDirectory = RenderSkinAndroid::DrawableDirectory();
isDecoded = RenderSkinAndroid::DecodeBitmap(am, (drawableDirectory + "combobox_nohighlight.png").utf8().data(), &bitmaps[kNormal][FullAsset]);
isDecoded &= RenderSkinAndroid::DecodeBitmap(am, (drawableDirectory + "combobox_disabled.png").utf8().data(), &bitmaps[kDisabled][FullAsset]);
@@ -100,19 +106,21 @@ void RenderSkinCombo::Init(android::AssetManager* am, String drawableDirectory)
int width = bitmaps[kNormal][FullAsset].width();
int height = bitmaps[kNormal][FullAsset].height();
SkIRect subset;
- subset.set(width - arrowWidth[resolution], 0, width, height);
+ subset.set(width - arrowWidth[RenderSkinAndroid::DrawableResolution()], 0, width, height);
bitmaps[kNormal][FullAsset].extractSubset(&bitmaps[kNormal][NoBorder], subset);
bitmaps[kDisabled][FullAsset].extractSubset(&bitmaps[kDisabled][NoBorder], subset);
}
-
bool RenderSkinCombo::Draw(SkCanvas* canvas, Node* element, int x, int y, int width, int height)
{
+ if (!isDecodingAttempted)
+ Decode();
+
if (!isDecoded)
return true;
State state = (element->isElementNode() && static_cast<Element*>(element)->isEnabledFormControl()) ? kNormal : kDisabled;
- height = std::max(height, (stretchMargin[resolution]<<1) + 1);
+ height = std::max(height, (stretchMargin[RenderSkinAndroid::DrawableResolution()]<<1) + 1);
SkRect bounds;
BorderStyle drawBorder = FullAsset;
@@ -139,7 +147,7 @@ bool RenderSkinCombo::Draw(SkCanvas* canvas, Node* element, int x, int y, int wi
bounds.fBottom -= SkIntToScalar(style->borderBottomWidth());
drawBorder = NoBorder;
}
- SkNinePatch::DrawNine(canvas, bounds, bitmaps[state][drawBorder], margin[resolution][drawBorder]);
+ SkNinePatch::DrawNine(canvas, bounds, bitmaps[state][drawBorder], margin[RenderSkinAndroid::DrawableResolution()][drawBorder]);
return false;
}
diff --git a/Source/WebKit/android/RenderSkinCombo.h b/Source/WebKit/android/RenderSkinCombo.h
index 38cd048..745b192 100644
--- a/Source/WebKit/android/RenderSkinCombo.h
+++ b/Source/WebKit/android/RenderSkinCombo.h
@@ -37,11 +37,8 @@ namespace WebCore {
class RenderSkinCombo : public RenderSkinAndroid
{
public:
- /**
- * Initialize the class before use. Uses the AssetManager to initialize any bitmaps the class may use.
- */
- static void Init(android::AssetManager*, String drawableDirectory);
+ static void Decode();
/**
* Draw the provided Node on the SkCanvas, using the dimensions provided by
* x,y,w,h. Return true if we did not draw, and WebKit needs to draw it,
@@ -50,15 +47,11 @@ public:
static bool Draw(SkCanvas* , Node* , int x, int y, int w, int h);
// The image is wider than the RenderObject, so this accounts for that.
- static int extraWidth() { return arrowMargin[resolution]; }
- static int padding() { return padMargin[resolution]; }
+ static int extraWidth() { return arrowMargin[RenderSkinAndroid::DrawableResolution()]; }
+ static int padding() { return padMargin[RenderSkinAndroid::DrawableResolution()]; }
+
- enum Resolution {
- MedRes,
- HighRes
- };
private:
- static Resolution resolution;
const static int arrowMargin[2];
const static int padMargin[2];
const static SkIRect margin[2][2];
diff --git a/Source/WebKit/android/RenderSkinMediaButton.cpp b/Source/WebKit/android/RenderSkinMediaButton.cpp
index 090d55e..294dec5 100644
--- a/Source/WebKit/android/RenderSkinMediaButton.cpp
+++ b/Source/WebKit/android/RenderSkinMediaButton.cpp
@@ -36,10 +36,13 @@
#include "SkCanvas.h"
#include "SkNinePatch.h"
#include "SkRect.h"
+#include <utils/AssetManager.h>
#include <utils/Debug.h>
#include <utils/Log.h>
#include <wtf/text/CString.h>
+extern android::AssetManager* globalAssetManager();
+
struct PatchData {
const char* name;
int8_t outset, margin;
@@ -64,23 +67,21 @@ static const PatchData gFiles[] =
static SkBitmap gButton[sizeof(gFiles)/sizeof(gFiles[0])];
static bool gDecoded;
-static bool gHighRes;
+static bool gDecodingFailed;
namespace WebCore {
-void RenderSkinMediaButton::Init(android::AssetManager* am, String drawableDirectory)
+void RenderSkinMediaButton::Decode()
{
- static bool gInited;
- if (gInited)
- return;
+ String drawableDirectory = RenderSkinAndroid::DrawableDirectory();
- gInited = true;
gDecoded = true;
- gHighRes = drawableDirectory[drawableDirectory.length() - 5] == 'h';
+ gDecodingFailed = false;
+ android::AssetManager* am = globalAssetManager();
for (size_t i = 0; i < sizeof(gFiles)/sizeof(gFiles[0]); i++) {
String path = drawableDirectory + gFiles[i].name;
if (!RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &gButton[i])) {
- gDecoded = false;
+ gDecodingFailed = true;
LOGD("RenderSkinButton::Init: button assets failed to decode\n\tBrowser buttons will not draw");
break;
}
@@ -90,11 +91,14 @@ void RenderSkinMediaButton::Init(android::AssetManager* am, String drawableDirec
void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType,
bool translucent, RenderObject* o)
{
+ if (!gDecoded) {
+ Decode();
+ }
+
// If we failed to decode, do nothing. This way the browser still works,
// and webkit will still draw the label and layout space for us.
- if (!gDecoded) {
+ if (gDecodingFailed)
return;
- }
bool drawsNinePatch = false;
bool drawsImage = true;
diff --git a/Source/WebKit/android/RenderSkinMediaButton.h b/Source/WebKit/android/RenderSkinMediaButton.h
index 6aa9c4e..d8b7c8d 100644
--- a/Source/WebKit/android/RenderSkinMediaButton.h
+++ b/Source/WebKit/android/RenderSkinMediaButton.h
@@ -36,11 +36,7 @@ class RenderObject;
class RenderSkinMediaButton {
public:
- /**
- * Initialize the class before use. Uses the AssetManager to initialize any
- * bitmaps the class may use.
- */
- static void Init(android::AssetManager*, String drawableDirectory);
+ static void Decode();
/**
* Draw the skin to the canvas, using the rectangle for its bounds and the
* State to determine which skin to use, i.e. focused or not focused.
diff --git a/Source/WebKit/android/RenderSkinRadio.cpp b/Source/WebKit/android/RenderSkinRadio.cpp
index 46198d3..3c29818 100644
--- a/Source/WebKit/android/RenderSkinRadio.cpp
+++ b/Source/WebKit/android/RenderSkinRadio.cpp
@@ -36,41 +36,54 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkRect.h"
+#include <utils/AssetManager.h>
#include <wtf/text/CString.h>
+extern android::AssetManager* globalAssetManager();
+
static const char* checks[] = { "btn_check_off_holo.png",
"btn_check_on_holo.png",
"btn_radio_off_holo.png",
"btn_radio_on_holo.png"};
// Matches the width of the bitmap
-static SkScalar SIZE;
+static SkScalar s_bitmapWidth;
namespace WebCore {
static SkBitmap s_bitmap[4];
-static bool s_decoded;
+static bool s_decodingAttempted = false;
+static bool s_decoded = false;
-void RenderSkinRadio::Init(android::AssetManager* am, String drawableDirectory)
-{
- if (s_decoded)
+void RenderSkinRadio::Decode() {
+ if (s_decodingAttempted)
return;
- String path = drawableDirectory + checks[0];
- s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[0]);
- path = drawableDirectory + checks[1];
- s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[1]) && s_decoded;
- path = drawableDirectory + checks[2];
- s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[2]) && s_decoded;
- path = drawableDirectory + checks[3];
- s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[3]) && s_decoded;
- SIZE = SkIntToScalar(s_bitmap[0].width());
+
+ s_decodingAttempted = true;
+ s_decoded = false;
+
+ android::AssetManager* am = globalAssetManager();
+ String drawableDir = RenderSkinAndroid::DrawableDirectory();
+ for (int i = 0; i < 4; i++) {
+ String path = drawableDir + checks[i];
+ if (!RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[i]))
+ return;
+ }
+ s_decoded = true;
+ s_bitmapWidth = SkIntToScalar(s_bitmap[0].width());
}
void RenderSkinRadio::Draw(SkCanvas* canvas, Node* element, const IntRect& ir,
bool isCheckBox)
{
- if (!s_decoded || !element) {
+ if (!element)
return;
- }
+
+ if (!s_decodingAttempted)
+ Decode();
+
+ if (!s_decoded)
+ return;
+
SkRect r(ir);
// Set up a paint to with filtering to look better.
SkPaint paint;
@@ -82,7 +95,7 @@ void RenderSkinRadio::Draw(SkCanvas* canvas, Node* element, const IntRect& ir,
paint.setAlpha(0x80);
}
SkScalar width = r.width();
- SkScalar scale = SkScalarDiv(width, SIZE);
+ SkScalar scale = SkScalarDiv(width, s_bitmapWidth);
saveScaleCount = canvas->save();
canvas->translate(r.fLeft, r.fTop);
canvas->scale(scale, scale);
diff --git a/Source/WebKit/android/RenderSkinRadio.h b/Source/WebKit/android/RenderSkinRadio.h
index f77e1be..34101cf 100644
--- a/Source/WebKit/android/RenderSkinRadio.h
+++ b/Source/WebKit/android/RenderSkinRadio.h
@@ -44,10 +44,10 @@ class IntRect;
class RenderSkinRadio
{
public:
- /**
- * Initialize the class before use. Uses the AssetManager to initialize any bitmaps the class may use.
- */
- static void Init(android::AssetManager*, String drawableDirectory);
+ static void SetDrawableDirectory(String drawableDirectory);
+
+ // Perform lazy decoding the first time this a radio/checkbox is needed.
+ static void Decode();
/**
* Draw the element to the canvas at the specified size and location.
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index a7f3897..afc251b 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -1390,11 +1390,10 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
if (directory.isEmpty())
LOGE("Can't find the drawable directory");
else {
- // Setup the asset manager.
- AssetManager* am = assetManagerForJavaObject(env, jAssetManager);
// Initialize our skinning classes
- webFrame->setRenderSkins(new WebCore::RenderSkinAndroid(am, directory));
+ webFrame->setRenderSkins(new WebCore::RenderSkinAndroid(directory));
}
+
for (int i = WebCore::PlatformBridge::FileUploadLabel;
i <= WebCore::PlatformBridge::FileUploadNoFileChosenLabel; i++)
initGlobalLocalizedName(
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.h b/Source/WebKit/android/jni/WebCoreFrameBridge.h
index f02c1e9..99ca459 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.h
@@ -158,8 +158,8 @@ class WebFrame : public WebCoreRefObject {
bool shouldSaveFormData();
void saveFormData(WebCore::HTMLFormElement*);
- const WebCore::RenderSkinAndroid* renderSkins() const { return m_renderSkins; }
- void setRenderSkins(const WebCore::RenderSkinAndroid* skins) { m_renderSkins = skins; }
+ WebCore::RenderSkinAndroid* renderSkins() const { return m_renderSkins; }
+ void setRenderSkins(WebCore::RenderSkinAndroid* skins) { m_renderSkins = skins; }
// Convert a URL from potential punycode I18nDomainName to safe to-be-displayed Unicode.
static WTF::String convertIDNToUnicode(const WebCore::KURL& kurl);
@@ -171,7 +171,7 @@ class WebFrame : public WebCoreRefObject {
WTF::String mUserAgent;
bool mBlockNetworkLoads;
bool mUserInitiatedAction;
- const WebCore::RenderSkinAndroid* m_renderSkins;
+ WebCore::RenderSkinAndroid* m_renderSkins;
};
} // namespace android
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index cf6cd65..c1cb95c 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -71,9 +71,7 @@
#include <JNIUtility.h>
#include <JNIHelp.h>
#include <jni.h>
-#include <android_runtime/android_util_AssetManager.h>
#include <ui/KeycodeLabels.h>
-#include <utils/AssetManager.h>
#include <wtf/text/AtomicString.h>
#include <wtf/text/CString.h>
@@ -141,7 +139,7 @@ struct JavaGlue {
}
} m_javaGlue;
-WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir, AssetManager* am) :
+WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir) :
m_ring((WebViewCore*) viewImpl)
{
jclass clazz = env->FindClass("android/webkit/WebView");
@@ -194,10 +192,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_ringAnimationEnd = 0;
m_baseLayer = 0;
m_glDrawFunctor = 0;
- if (drawableDir.isEmpty())
- m_buttonSkin = 0;
- else
- m_buttonSkin = new RenderSkinButton(am, drawableDir);
+ m_buttonSkin = drawableDir.isEmpty() ? 0 : new RenderSkinButton(drawableDir);
#if USE(ACCELERATED_COMPOSITING)
m_glWebViewState = 0;
m_pageSwapCallbackRegistered = false;
@@ -1536,7 +1531,7 @@ private: // local state for WebView
GLWebViewState* m_glWebViewState;
bool m_pageSwapCallbackRegistered;
#endif
- const RenderSkinButton* m_buttonSkin;
+ RenderSkinButton* m_buttonSkin;
}; // end of WebView class
@@ -1653,12 +1648,10 @@ static void nativeClearCursor(JNIEnv *env, jobject obj)
view->clearCursor();
}
-static void nativeCreate(JNIEnv *env, jobject obj, int viewImpl, jstring drawableDir,
- jobject jAssetManager)
+static void nativeCreate(JNIEnv *env, jobject obj, int viewImpl, jstring drawableDir)
{
- AssetManager* am = assetManagerForJavaObject(env, jAssetManager);
WTF::String dir = jstringToWtfString(env, drawableDir);
- WebView* webview = new WebView(env, obj, viewImpl, dir, am);
+ WebView* webview = new WebView(env, obj, viewImpl, dir);
// NEED THIS OR SOMETHING LIKE IT!
//Release(obj);
}
@@ -2652,7 +2645,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeCacheHitNodePointer },
{ "nativeClearCursor", "()V",
(void*) nativeClearCursor },
- { "nativeCreate", "(ILjava/lang/String;Landroid/content/res/AssetManager;)V",
+ { "nativeCreate", "(ILjava/lang/String;)V",
(void*) nativeCreate },
{ "nativeCursorFramePointer", "()I",
(void*) nativeCursorFramePointer },