summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp9
-rw-r--r--Source/WebKit/android/jni/ViewStateSerializer.cpp3
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp30
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp18
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h2
-rw-r--r--Source/WebKit/android/nav/CacheBuilder.cpp2
-rw-r--r--Source/WebKit/android/nav/CachedNode.cpp15
-rw-r--r--Source/WebKit/android/nav/CachedNode.h4
-rw-r--r--Source/WebKit/android/nav/WebView.cpp49
9 files changed, 58 insertions, 74 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 3134a44..0be31eb 100644
--- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -919,9 +919,13 @@ void FrameLoaderClientAndroid::transitionToCommittedFromCachedFrame(WebCore::Cac
#ifdef ANDROID_META_SUPPORT
platformData->restoreMetadata(m_frame->settings());
#endif
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+#else
WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view());
webViewCore->clearContent();
+#endif
m_webFrame->transitionToCommitted(m_frame);
}
@@ -956,7 +960,12 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() {
// Create a new WebFrameView for the new FrameView
WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore);
+
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+#else
webViewCore->clearContent();
+#endif
+
newFrameView->setLocation(bounds.x(), bounds.y());
newFrameView->setSize(bounds.width(), bounds.height());
newFrameView->setVisibleSize(visBounds.width(), visBounds.height());
diff --git a/Source/WebKit/android/jni/ViewStateSerializer.cpp b/Source/WebKit/android/jni/ViewStateSerializer.cpp
index c896637..93f4375 100644
--- a/Source/WebKit/android/jni/ViewStateSerializer.cpp
+++ b/Source/WebKit/android/jni/ViewStateSerializer.cpp
@@ -27,6 +27,7 @@
#include "BaseLayerAndroid.h"
#include "CreateJavaOutputStreamAdaptor.h"
+#include "ImagesManager.h"
#include "Layer.h"
#include "LayerAndroid.h"
#include "PictureSet.h"
@@ -302,7 +303,7 @@ void serializeLayer(LayerAndroid* layer, SkWStream* stream)
SkFlattenableWriteBuffer buffer(1024);
buffer.setFlags(SkFlattenableWriteBuffer::kCrossProcess_Flag);
ImageTexture* imagetexture =
- TilesManager::instance()->getTextureForImage(layer->m_imageRef, false);
+ ImagesManager::instance()->getTextureForImage(layer->m_imageRef, false);
if (imagetexture && imagetexture->bitmap())
imagetexture->bitmap()->flatten(buffer);
stream->write32(buffer.size());
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index 7f791ea..bb28d28 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -983,7 +983,7 @@ WebFrame::didReceiveAuthenticationChallenge(WebUrlLoaderClient* client, const st
}
void
-WebFrame::reportSslCertError(WebUrlLoaderClient* client, int cert_error, const std::string& cert, const std::string& url)
+WebFrame::reportSslCertError(WebUrlLoaderClient* client, int error, const std::string& cert, const std::string& url)
{
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
@@ -994,16 +994,14 @@ WebFrame::reportSslCertError(WebUrlLoaderClient* client, int cert_error, const s
return;
int jHandle = reinterpret_cast<int>(client);
+ // Don't copy the null terminator.
int len = cert.length();
- jbyteArray jCert = env->NewByteArray(len);
- jbyte* bytes = env->GetByteArrayElements(jCert, NULL);
- cert.copy(reinterpret_cast<char*>(bytes), len);
+ ScopedLocalRef<jbyteArray> jCert(env, env->NewByteArray(len));
+ env->SetByteArrayRegion(jCert.get(), 0, len, reinterpret_cast<const jbyte*>(cert.c_str()));
- jstring jUrl = env->NewStringUTF(url.c_str());
+ ScopedLocalRef<jstring> jUrl(env, env->NewStringUTF(url.c_str()));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mReportSslCertError, jHandle, cert_error, jCert, jUrl);
- env->DeleteLocalRef(jCert);
- env->DeleteLocalRef(jUrl);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mReportSslCertError, jHandle, error, jCert.get(), jUrl.get());
checkException(env);
}
@@ -1057,12 +1055,10 @@ WebFrame::didReceiveData(const char* data, int size) {
if (!javaFrame.get())
return;
- jbyteArray jData = env->NewByteArray(size);
- jbyte* bytes = env->GetByteArrayElements(jData, NULL);
- memcpy(reinterpret_cast<char*>(bytes), data, size);
+ ScopedLocalRef<jbyteArray> jData(env, env->NewByteArray(size));
+ env->SetByteArrayRegion(jData.get(), 0, size, reinterpret_cast<const jbyte*>(data));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mDidReceiveData, jData, size);
- env->DeleteLocalRef(jData);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mDidReceiveData, jData.get(), size);
checkException(env);
}
@@ -1091,13 +1087,11 @@ void WebFrame::setCertificate(const std::string& cert)
return;
int len = cert.length();
- jbyteArray jCert = env->NewByteArray(len);
- jbyte* bytes = env->GetByteArrayElements(jCert, NULL);
- cert.copy(reinterpret_cast<char*>(bytes), len);
+ ScopedLocalRef<jbyteArray> jCert(env, env->NewByteArray(len));
+ env->SetByteArrayRegion(jCert.get(), 0, len, reinterpret_cast<const jbyte*>(cert.c_str()));
- env->CallVoidMethod(javaFrame.get(), mJavaFrame->mSetCertificate, jCert);
+ env->CallVoidMethod(javaFrame.get(), mJavaFrame->mSetCertificate, jCert.get());
- env->DeleteLocalRef(jCert);
checkException(env);
}
#endif // USE(CHROME_NETWORK_STACK)
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 134408a..f35f768 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -945,20 +945,22 @@ bool WebViewCore::updateLayers(LayerAndroid* layers)
return true;
}
-BaseLayerAndroid* WebViewCore::createBaseLayer()
+BaseLayerAndroid* WebViewCore::createBaseLayer(SkRegion* region)
{
BaseLayerAndroid* base = new BaseLayerAndroid();
base->setContent(m_content);
- m_skipContentDraw = true;
- bool layoutSucceeded = layoutIfNeededRecursive(m_mainFrame);
- m_skipContentDraw = false;
- // Layout only fails if called during a layout.
- LOG_ASSERT(layoutSucceeded, "Can never be called recursively");
+ if (!region->isEmpty()) {
+ m_skipContentDraw = true;
+ bool layoutSucceeded = layoutIfNeededRecursive(m_mainFrame);
+ m_skipContentDraw = false;
+ // Layout only fails if called during a layout.
+ LOG_ASSERT(layoutSucceeded, "Can never be called recursively");
+ }
#if USE(ACCELERATED_COMPOSITING)
// We set the background color
- if (m_mainFrame && m_mainFrame->document()
+ if (!region->isEmpty() && m_mainFrame && m_mainFrame->document()
&& m_mainFrame->document()->body()) {
Document* document = m_mainFrame->document();
RefPtr<RenderStyle> style = document->styleForElementIgnoringPendingStylesheets(document->body());
@@ -1013,7 +1015,7 @@ BaseLayerAndroid* WebViewCore::recordContent(SkRegion* region, SkIPoint* point)
region->getBounds().fBottom);
DBG_SET_LOG("end");
- return createBaseLayer();
+ return createBaseLayer(region);
}
void WebViewCore::splitContent(PictureSet* content)
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 491a0ad..ea57c11 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -527,7 +527,7 @@ namespace android {
// This creates a new BaseLayerAndroid by copying the current m_content
// and doing a copy of the layers. The layers' content may be updated
// as we are calling layersSync().
- BaseLayerAndroid* createBaseLayer();
+ BaseLayerAndroid* createBaseLayer(SkRegion*);
bool updateLayers(LayerAndroid*);
int textWrapWidth() const { return m_textWrapWidth; }
diff --git a/Source/WebKit/android/nav/CacheBuilder.cpp b/Source/WebKit/android/nav/CacheBuilder.cpp
index a4bc758..623d2cb 100644
--- a/Source/WebKit/android/nav/CacheBuilder.cpp
+++ b/Source/WebKit/android/nav/CacheBuilder.cpp
@@ -1406,7 +1406,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
else if (cachedNode.clip(clip) == false)
continue; // skip this node if outside of the clip
}
- cachedNode.setNavableRects();
cachedNode.setColorIndex(colorIndex);
cachedNode.setExport(exported);
cachedNode.setHasCursorRing(hasCursorRing);
@@ -1478,7 +1477,6 @@ bool CacheBuilder::CleanUpContainedNodes(CachedRoot* cachedRoot,
lastNode->hasTagName(HTMLNames::formTag)) {
lastCached->setBounds(IntRect(0, 0, 0, 0));
lastCached->mCursorRing.clear();
- lastCached->setNavableRects();
return false;
}
CachedNode* onlyChildCached = cachedFrame->lastNode();
diff --git a/Source/WebKit/android/nav/CachedNode.cpp b/Source/WebKit/android/nav/CachedNode.cpp
index 86c2a38..e500875 100644
--- a/Source/WebKit/android/nav/CachedNode.cpp
+++ b/Source/WebKit/android/nav/CachedNode.cpp
@@ -92,10 +92,9 @@ void CachedNode::cursorRings(const CachedFrame* frame,
WebCore::IntRect CachedNode::cursorRingBounds(const CachedFrame* frame) const
{
- int partMax = mNavableRects;
- ASSERT(partMax > 0);
- WebCore::IntRect bounds = mCursorRing[0];
- for (int partIndex = 1; partIndex < partMax; partIndex++)
+ int partMax = navableRects();
+ WebCore::IntRect bounds;
+ for (int partIndex = 0; partIndex < partMax; partIndex++)
bounds.unite(mCursorRing[partIndex]);
bounds.inflate(CURSOR_RING_HIT_TEST_RADIUS);
return mIsInLayer ? frame->adjustBounds(this, bounds) : bounds;
@@ -116,7 +115,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame)
mUseHitBounds = true;
return;
}
- if (mNavableRects <= 1)
+ if (navableRects() <= 1)
return;
// if there is more than 1 rect, and the bounds doesn't intersect
// any other cursor ring bounds, use it
@@ -290,8 +289,8 @@ void CachedNode::move(int x, int y)
bool CachedNode::partRectsContains(const CachedNode* other) const
{
int outerIndex = 0;
- int outerMax = mNavableRects;
- int innerMax = other->mNavableRects;
+ int outerMax = navableRects();
+ int innerMax = other->navableRects();
do {
const WebCore::IntRect& outerBounds = mCursorRing[outerIndex];
int innerIndex = 0;
@@ -403,7 +402,7 @@ void CachedNode::Debug::print() const
DUMP_NAV_LOGD("// void* mParentGroup=%p; // (%d) \n", b->mParentGroup, mParentGroupIndex);
DUMP_NAV_LOGD("// int mDataIndex=%d;\n", b->mDataIndex);
DUMP_NAV_LOGD("// int mIndex=%d;\n", b->mIndex);
- DUMP_NAV_LOGD("// int mNavableRects=%d;\n", b->mNavableRects);
+ DUMP_NAV_LOGD("// int navableRects()=%d;\n", b->navableRects());
DUMP_NAV_LOGD("// int mParentIndex=%d;\n", b->mParentIndex);
DUMP_NAV_LOGD("// int mTabIndex=%d;\n", b->mTabIndex);
DUMP_NAV_LOGD("// int mColorIndex=%d;\n", b->mColorIndex);
diff --git a/Source/WebKit/android/nav/CachedNode.h b/Source/WebKit/android/nav/CachedNode.h
index 602dda6..321b7fd 100644
--- a/Source/WebKit/android/nav/CachedNode.h
+++ b/Source/WebKit/android/nav/CachedNode.h
@@ -136,7 +136,7 @@ public:
WebCore::IntRect localHitBounds(const CachedFrame* ) const;
WebCore::IntRect localRing(const CachedFrame* , size_t part) const;
void move(int x, int y);
- int navableRects() const { return mNavableRects; }
+ int navableRects() const { return mCursorRing.size(); }
void* nodePointer() const { return mNode; }
bool noSecondChance() const { return mCondition > SECOND_CHANCE_END; }
const WebCore::IntRect& originalAbsoluteBounds() const {
@@ -169,7 +169,6 @@ public:
void setIsTransparent(bool isTransparent) { mIsTransparent = isTransparent; }
void setIsUnclipped(bool unclipped) { mIsUnclipped = unclipped; }
void setLast() { mLast = true; }
- void setNavableRects() { mNavableRects = mCursorRing.size(); }
void setParentGroup(void* group) { mParentGroup = group; }
void setParentIndex(int parent) { mParentIndex = parent; }
void setSingleImage(bool single) { mSingleImage = single; }
@@ -195,7 +194,6 @@ private:
void* mParentGroup; // WebCore::Node*, only used to match pointers
int mDataIndex; // child frame if a frame; input data index; or -1
int mIndex; // index of itself, to find first in array (document)
- int mNavableRects; // FIXME: could be bitfield once I limit max number of rects
int mParentIndex;
int mTabIndex;
int mColorIndex; // index to ring color and other stylable properties
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index d062db3..0876db6 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -570,24 +570,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
}
unsigned int pic = m_glWebViewState->currentPictureCounter();
-
- if (extra == &m_ring) {
- if (m_ring.m_isButton || root != m_ring.m_frame) {
- // TODO: Fix the navcache to work with layers correctly
- // In the meantime, this works around the bug. However, the rings
- // it produces are not as nice for some reason, thus we use
- // m_ring.rings() as produced by navcache for the base layer and
- // for layers we generate a new ring set
- m_ring.rings().clear();
- for (size_t i = 0; i < m_ring.m_node->rings().size(); i++) {
- IntRect rect = m_ring.m_node->rings().at(i);
- rect = m_ring.m_frame->adjustBounds(m_ring.m_node, rect);
- if (!m_ring.m_isButton)
- rect.inflate(4);
- m_ring.rings().append(rect);
- }
- }
- }
m_glWebViewState->glExtras()->setDrawExtra(extra);
LayerAndroid* compositeLayer = compositeRoot();
@@ -1934,15 +1916,16 @@ static jint nativeDraw(JNIEnv *env, jobject obj, jobject canv, jint color,
return reinterpret_cast<jint>(GET_NATIVE_VIEW(env, obj)->draw(canvas, color, extras, split));
}
-static jint nativeGetDrawGLFunction(JNIEnv *env, jobject obj, jobject jrect, jobject jviewrect,
- jfloat scale, jint extras) {
+static jint nativeGetDrawGLFunction(JNIEnv *env, jobject obj, jint nativeView,
+ jobject jrect, jobject jviewrect,
+ jfloat scale, jint extras) {
WebCore::IntRect viewRect;
if (jrect == NULL) {
viewRect = WebCore::IntRect();
} else {
viewRect = jrect_to_webrect(env, jrect);
}
- WebView *wvInstance = GET_NATIVE_VIEW(env, obj);
+ WebView *wvInstance = (WebView*) nativeView;
GLDrawFunctor* functor = new GLDrawFunctor(wvInstance, &android::WebView::drawGL,
viewRect, scale, extras);
wvInstance->setFunctor((Functor*) functor);
@@ -1982,10 +1965,10 @@ static void nativeUpdateDrawGLFunction(JNIEnv *env, jobject obj, jobject jrect,
}
}
-static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
+static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj, jint nativeView)
{
#if USE(ACCELERATED_COMPOSITING)
- LayerAndroid* root = GET_NATIVE_VIEW(env, obj)->compositeRoot();
+ LayerAndroid* root = ((WebView*)nativeView)->compositeRoot();
if (root)
return root->evaluateAnimations();
#endif
@@ -2303,10 +2286,10 @@ static bool nativeMoveCursor(JNIEnv *env, jobject obj,
return view->moveCursor(key, count, ignoreScroll);
}
-static void nativeRecordButtons(JNIEnv* env, jobject obj, bool hasFocus,
- bool pressed, bool invalidate)
+static void nativeRecordButtons(JNIEnv* env, jobject obj, jint nativeView,
+ bool hasFocus, bool pressed, bool invalidate)
{
- WebView* view = GET_NATIVE_VIEW(env, obj);
+ WebView* view = (WebView*) nativeView;
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
view->nativeRecordButtons(hasFocus, pressed, invalidate);
}
@@ -2566,10 +2549,10 @@ static jint nativeSelectionY(JNIEnv *env, jobject obj)
return GET_NATIVE_VIEW(env, obj)->selectionY();
}
-static void nativeSetSelectionPointer(JNIEnv *env, jobject obj, jboolean set,
- jfloat scale, jint x, jint y)
+static void nativeSetSelectionPointer(JNIEnv *env, jobject obj, jint nativeView,
+ jboolean set, jfloat scale, jint x, jint y)
{
- GET_NATIVE_VIEW(env, obj)->setSelectionPointer(set, scale, x, y);
+ ((WebView*)nativeView)->setSelectionPointer(set, scale, x, y);
}
static void nativeRegisterPageSwapCallback(JNIEnv *env, jobject obj)
@@ -2809,13 +2792,13 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeDestroy },
{ "nativeDraw", "(Landroid/graphics/Canvas;IIZ)I",
(void*) nativeDraw },
- { "nativeGetDrawGLFunction", "(Landroid/graphics/Rect;Landroid/graphics/Rect;FI)I",
+ { "nativeGetDrawGLFunction", "(ILandroid/graphics/Rect;Landroid/graphics/Rect;FI)I",
(void*) nativeGetDrawGLFunction },
{ "nativeUpdateDrawGLFunction", "(Landroid/graphics/Rect;Landroid/graphics/Rect;)V",
(void*) nativeUpdateDrawGLFunction },
{ "nativeDumpDisplayTree", "(Ljava/lang/String;)V",
(void*) nativeDumpDisplayTree },
- { "nativeEvaluateLayersAnimations", "()Z",
+ { "nativeEvaluateLayersAnimations", "(I)Z",
(void*) nativeEvaluateLayersAnimations },
{ "nativeExtendSelection", "(II)V",
(void*) nativeExtendSelection },
@@ -2893,7 +2876,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeMoveSelection },
{ "nativePointInNavCache", "(III)Z",
(void*) nativePointInNavCache },
- { "nativeRecordButtons", "(ZZZ)V",
+ { "nativeRecordButtons", "(IZZZ)V",
(void*) nativeRecordButtons },
{ "nativeResetSelection", "()V",
(void*) nativeResetSelection },
@@ -2929,7 +2912,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeCopyBaseContentToPicture },
{ "nativeHasContent", "()Z",
(void*) nativeHasContent },
- { "nativeSetSelectionPointer", "(ZFII)V",
+ { "nativeSetSelectionPointer", "(IZFII)V",
(void*) nativeSetSelectionPointer },
{ "nativeShowCursorTimed", "()V",
(void*) nativeShowCursorTimed },