summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp3
-rw-r--r--WebKit/android/WebCoreSupport/WebCookieJar.cpp14
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoader.cpp4
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoader.h2
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp8
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoaderClient.h3
-rw-r--r--WebKit/android/jni/WebViewCore.cpp5
-rw-r--r--WebKit/android/nav/CachedLayer.cpp27
-rw-r--r--WebKit/android/nav/SelectText.cpp85
-rw-r--r--WebKit/android/nav/WebView.cpp13
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp4
11 files changed, 84 insertions, 84 deletions
diff --git a/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp b/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
index 3f2d9ee..7f54810 100644
--- a/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
@@ -44,7 +44,8 @@ PassRefPtr<ResourceLoaderAndroid> ResourceLoaderAndroid::start(
FrameLoaderClientAndroid* clientAndroid = static_cast<FrameLoaderClientAndroid*>(client);
#if USE(CHROME_NETWORK_STACK)
WebViewCore* webViewCore = WebViewCore::getWebViewCore(clientAndroid->getFrame()->view());
- return WebUrlLoader::start(client, handle, request, isMainResource, isSync, webViewCore->webRequestContext());
+ bool isMainFrame = !(clientAndroid->getFrame()->tree() && clientAndroid->getFrame()->tree()->parent());
+ return WebUrlLoader::start(client, handle, request, isMainResource, isMainFrame, isSync, webViewCore->webRequestContext());
#else
return clientAndroid->webFrame()->startLoadingResource(handle, request, isMainResource, isSync);
#endif
diff --git a/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
index 9c1d7fa..99de67e 100644
--- a/WebKit/android/WebCoreSupport/WebCookieJar.cpp
+++ b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
@@ -31,9 +31,16 @@
#include "WebRequestContext.h"
#include "WebUrlLoaderClient.h"
-
+#include <cutils/log.h>
#include <dirent.h>
+#undef ASSERT
+#define ASSERT(assertion, ...) do \
+ if (!(assertion)) { \
+ android_printLog(ANDROID_LOG_ERROR, __FILE__, __VA_ARGS__); \
+ } \
+while (0)
+
namespace android {
static WTF::Mutex instanceMutex;
@@ -193,16 +200,21 @@ public:
Task* callback = NewRunnableMethod(this, &FlushSemaphore::Callback);
ioThread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
monster, &net::CookieMonster::FlushStore, callback));
+ } else {
+ Callback();
}
}
// Block until the given number of callbacks has been made.
void Wait(int numCallbacks) {
AutoLock al(m_lock);
+ int lastCount = m_count;
while (m_count < numCallbacks) {
// TODO(husky): Maybe use TimedWait() here? But it's not obvious what
// to do if the flush fails. Might be okay just to let the OS kill us.
m_condition.Wait();
+ ASSERT(lastCount != m_count, "Wait finished without incrementing m_count %d %d", m_count, lastCount);
+ lastCount = m_count;
}
m_count -= numCallbacks;
}
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoader.cpp b/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
index 531619a..0c90bc5 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
+++ b/WebKit/android/WebCoreSupport/WebUrlLoader.cpp
@@ -45,7 +45,7 @@ WebUrlLoader::~WebUrlLoader()
}
PassRefPtr<WebUrlLoader> WebUrlLoader::start(FrameLoaderClient* client, WebCore::ResourceHandle* resourceHandle,
- const WebCore::ResourceRequest& resourceRequest, bool isMainResource, bool isSync, WebRequestContext* context)
+ const WebCore::ResourceRequest& resourceRequest, bool isMainResource, bool isMainFrame, bool isSync, WebRequestContext* context)
{
FrameLoaderClientAndroid* androidClient = static_cast<FrameLoaderClientAndroid*>(client);
WebFrame* webFrame = androidClient->webFrame();
@@ -58,7 +58,7 @@ PassRefPtr<WebUrlLoader> WebUrlLoader::start(FrameLoaderClient* client, WebCore:
webFrame->maybeSavePassword(androidClient->getFrame(), resourceRequest);
RefPtr<WebUrlLoader> loader = WebUrlLoader::create(webFrame, resourceHandle, resourceRequest);
- loader->m_loaderClient->start(isMainResource, isSync, context);
+ loader->m_loaderClient->start(isMainResource, isMainFrame, isSync, context);
return loader.release();
}
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoader.h b/WebKit/android/WebCoreSupport/WebUrlLoader.h
index 73c022a..dd88e73 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoader.h
+++ b/WebKit/android/WebCoreSupport/WebUrlLoader.h
@@ -39,7 +39,7 @@ class WebRequestContext;
class WebUrlLoader : public ResourceLoaderAndroid {
public:
virtual ~WebUrlLoader();
- static PassRefPtr<WebUrlLoader> start(FrameLoaderClient* client, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, bool isMainResource, bool sync, WebRequestContext*);
+ static PassRefPtr<WebUrlLoader> start(FrameLoaderClient* client, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, bool isMainResource, bool isMainFrame, bool sync, WebRequestContext*);
virtual void cancel();
virtual void downloadFile();
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
index dd1d972..05e728b 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
+++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
@@ -101,6 +101,7 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
: m_webFrame(webFrame)
, m_resourceHandle(resourceHandle)
, m_isMainResource(false)
+ , m_isMainFrame(false)
, m_isCertMimeType(false)
, m_cancelling(false)
, m_sync(false)
@@ -162,7 +163,7 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
}
}
-bool WebUrlLoaderClient::start(bool isMainResource, bool sync, WebRequestContext* context)
+bool WebUrlLoaderClient::start(bool isMainResource, bool isMainFrame, bool sync, WebRequestContext* context)
{
base::Thread* thread = ioThread();
if (!thread) {
@@ -170,6 +171,7 @@ bool WebUrlLoaderClient::start(bool isMainResource, bool sync, WebRequestContext
}
m_isMainResource = isMainResource;
+ m_isMainFrame = isMainFrame;
m_sync = sync;
if (m_sync) {
AutoLock autoLock(*syncLock());
@@ -354,8 +356,8 @@ void WebUrlLoaderClient::didReceiveResponse(PassOwnPtr<WebResponse> webResponse)
m_response = webResponse;
m_resourceHandle->client()->didReceiveResponse(m_resourceHandle.get(), m_response->createResourceResponse());
- if (m_isMainResource) {
- // If we got an SSL certificate, tell the WebView about it.
+ // Set the main page's certificate to WebView.
+ if (m_isMainResource && m_isMainFrame) {
const net::SSLInfo& ssl_info = m_response->getSslInfo();
if (ssl_info.is_valid()) {
std::vector<std::string> chain_bytes;
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h
index 59ec28b..dc101db 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h
+++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h
@@ -66,7 +66,7 @@ public:
WebUrlLoaderClient(WebFrame*, WebCore::ResourceHandle*, const WebCore::ResourceRequest&);
// Called from WebCore, will be forwarded to the IO thread
- bool start(bool isMainResource, bool sync, WebRequestContext*);
+ bool start(bool isMainResource, bool isMainFrame, bool sync, WebRequestContext*);
void cancel();
void downloadFile();
void pauseLoad(bool pause);
@@ -104,6 +104,7 @@ private:
WebFrame* m_webFrame;
RefPtr<WebCore::ResourceHandle> m_resourceHandle;
bool m_isMainResource;
+ bool m_isMainFrame;
bool m_isCertMimeType;
bool m_cancelling;
bool m_sync;
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6e6196a..66c78b5 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -3385,13 +3385,13 @@ bool WebViewCore::jsConfirm(const WTF::String& url, const WTF::String& text)
bool WebViewCore::jsPrompt(const WTF::String& url, const WTF::String& text, const WTF::String& defaultValue, WTF::String& result)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jstring jUrlStr = wtfStringToJstring(env, url);
jstring jInputStr = wtfStringToJstring(env, text);
jstring jDefaultStr = wtfStringToJstring(env, defaultValue);
- jstring jUrlStr = wtfStringToJstring(env, url);
jstring returnVal = static_cast<jstring>(env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr));
+ env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jDefaultStr);
- env->DeleteLocalRef(jUrlStr);
checkException(env);
// If returnVal is null, it means that the user cancelled the dialog.
@@ -3399,6 +3399,7 @@ bool WebViewCore::jsPrompt(const WTF::String& url, const WTF::String& text, cons
return false;
result = jstringToWtfString(env, returnVal);
+ env->DeleteLocalRef(returnVal);
return true;
}
diff --git a/WebKit/android/nav/CachedLayer.cpp b/WebKit/android/nav/CachedLayer.cpp
index d5385bd..3321797 100644
--- a/WebKit/android/nav/CachedLayer.cpp
+++ b/WebKit/android/nav/CachedLayer.cpp
@@ -55,9 +55,36 @@ IntRect CachedLayer::adjustBounds(const LayerAndroid* root,
temp.move(position.x(), position.y());
// Add in any layer translation.
+ // FIXME: Should use bounds() and apply the entire transformation matrix.
const FloatPoint& translation = aLayer->translation();
temp.move(translation.x(), translation.y());
+ SkRect clip;
+ aLayer->bounds(&clip);
+
+ // Do not try to traverse the parent chain if this is the root as the parent
+ // will not be a LayerAndroid.
+ if (aLayer != root) {
+ LayerAndroid* parent = static_cast<LayerAndroid*>(aLayer->getParent());
+ while (parent) {
+ SkRect pClip;
+ parent->bounds(&pClip);
+
+ // Move our position into our parent's coordinate space.
+ clip.offset(pClip.fLeft, pClip.fTop);
+ // Clip our visible rectangle to the parent.
+ clip.intersect(pClip);
+
+ // Stop at the root.
+ if (parent == root)
+ break;
+ parent = static_cast<LayerAndroid*>(parent->getParent());
+ }
+ }
+
+ // Intersect the result with the visible clip.
+ temp.intersect(clip);
+
IntRect result = enclosingIntRect(temp);
DBG_NAV_LOGV("root=%p aLayer=%p [%d]"
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index a07fa8c..87d1791 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -141,40 +141,6 @@ void ReverseBidi(UChar* chars, int len) {
namespace android {
-/* SpaceBounds and SpaceCanvas are used to measure the left and right side
- * bearings of two consecutive glyphs to help determine if the glyphs were
- * originally laid out with a space character between the glyphs.
- */
-class SpaceBounds : public SkBounder {
-public:
- virtual bool onIRectGlyph(const SkIRect& , const SkBounder::GlyphRec& rec)
- {
- mFirstGlyph = mLastGlyph;
- mLastGlyph = rec;
- return false;
- }
-
- SkBounder::GlyphRec mFirstGlyph;
- SkBounder::GlyphRec mLastGlyph;
-};
-
-class SpaceCanvas : public ParseCanvas {
-public:
- SpaceCanvas()
- {
- setBounder(&mBounder);
- SkBitmap bitmap;
- // Configure a very large bitmap so the pair of glyphs can be anywhere
- // on the page. Skia constrains the bitmap to be 2^31-1 bytes. The
- // bitmap is never allocated, but this constraint avoids triggering
- // a failure when the configuration is checked.
- bitmap.setConfig(SkBitmap::kA1_Config, 16383, 1048576);
- setBitmapDevice(bitmap);
- }
-
- SpaceBounds mBounder;
-};
-
#define HYPHEN_MINUS 0x2D // ASCII hyphen
#define SOLIDUS 0x2F // ASCII slash
#define REVERSE_SOLIDUS 0x5C // ASCII backslash
@@ -266,8 +232,7 @@ public:
if (mLastGlyph.fGlyphID == static_cast<uint16_t>(-1))
return true;
DBG_NAV_LOGD("mLastGlyph=((%g, %g),(%g, %g), %d)"
- " rec=((%g, %g),(%g, %g), %d)"
- " mMinSpaceWidth=%g mLastUni=0x%04x '%c'",
+ " rec=((%g, %g),(%g, %g), %d) mLastUni=0x%04x '%c'",
SkFixedToScalar(mLastGlyph.fLSB.fX),
SkFixedToScalar(mLastGlyph.fLSB.fY),
SkFixedToScalar(mLastGlyph.fRSB.fX),
@@ -275,7 +240,6 @@ public:
SkFixedToScalar(rec.fLSB.fX), SkFixedToScalar(rec.fLSB.fY),
SkFixedToScalar(rec.fRSB.fX), SkFixedToScalar(rec.fRSB.fY),
rec.fGlyphID,
- SkFixedToScalar(mMinSpaceWidth),
mLastUni, mLastUni && mLastUni < 0x7f ? mLastUni : '?');
bool newBaseLine = mLastGlyph.fLSB.fY != rec.fLSB.fY;
if (newBaseLine)
@@ -284,35 +248,24 @@ public:
SkFixed gapTwo = rec.fLSB.fX - mLastGlyph.fRSB.fX;
if (gapOne < 0 && gapTwo < 0)
return false; // overlaps
- uint16_t test[2];
- test[0] = mLastGlyph.fGlyphID;
- test[1] = rec.fGlyphID;
- SpaceCanvas spaceChecker;
- spaceChecker.drawText(test, sizeof(test),
- SkFixedToScalar(mLastGlyph.fLSB.fX),
- SkFixedToScalar(mLastGlyph.fLSB.fY), mPaint);
- const SkBounder::GlyphRec& g1 = spaceChecker.mBounder.mFirstGlyph;
- const SkBounder::GlyphRec& g2 = spaceChecker.mBounder.mLastGlyph;
- DBG_NAV_LOGD("g1=(%g, %g, %g, %g) g2=(%g, %g, %g, %g)",
- SkFixedToScalar(g1.fLSB.fX), SkFixedToScalar(g1.fLSB.fY),
- SkFixedToScalar(g1.fRSB.fX), SkFixedToScalar(g1.fRSB.fY),
- SkFixedToScalar(g2.fLSB.fX), SkFixedToScalar(g2.fLSB.fY),
- SkFixedToScalar(g2.fRSB.fX), SkFixedToScalar(g2.fRSB.fY));
- gapOne = SkFixedAbs(gapOne);
- gapTwo = SkFixedAbs(gapTwo);
- SkFixed gap = gapOne < gapTwo ? gapOne : gapTwo;
- SkFixed overlap = g2.fLSB.fX - g1.fRSB.fX;
- if (overlap < 0)
- gap -= overlap;
- DBG_NAV_LOGD("gap=%g overlap=%g gapOne=%g gapTwo=%g minSpaceWidth()=%g",
- SkFixedToScalar(gap), SkFixedToScalar(overlap),
- SkFixedToScalar(gapOne), SkFixedToScalar(gapTwo),
- SkFixedToScalar(minSpaceWidth()));
- // FIXME: the -1/8 below takes care of slop beween the computed gap
- // and the actual space width -- it's a rounding error from
- // moving from fixed to float and back and could be much smaller.
- spaceChecker.setBounder(0);
- return gap >= minSpaceWidth() - SK_Fixed1 / 8;
+ const SkBounder::GlyphRec& first = mLastGlyph.fLSB.fX < rec.fLSB.fX
+ ? mLastGlyph : rec;
+ const SkBounder::GlyphRec& second = mLastGlyph.fLSB.fX < rec.fLSB.fX
+ ? rec : mLastGlyph;
+ uint16_t firstGlyph = first.fGlyphID;
+ SkScalar firstWidth = mPaint.measureText(&firstGlyph, sizeof(firstGlyph));
+ SkFixed ceilWidth = SkIntToFixed(SkScalarCeil(firstWidth));
+ SkFixed posNoSpace = first.fLSB.fX + ceilWidth;
+ SkFixed ceilSpace = SkIntToFixed(SkFixedCeil(minSpaceWidth()));
+ SkFixed posWithSpace = posNoSpace + ceilSpace;
+ SkFixed diffNoSpace = SkFixedAbs(second.fLSB.fX - posNoSpace);
+ SkFixed diffWithSpace = SkFixedAbs(second.fLSB.fX - posWithSpace);
+ DBG_NAV_LOGD("second=%g width=%g (%g) noSpace=%g (%g) withSpace=%g (%g)",
+ SkFixedToScalar(second.fLSB.fX),
+ firstWidth, SkFixedToScalar(ceilWidth),
+ SkFixedToScalar(posNoSpace), SkFixedToScalar(diffNoSpace),
+ SkFixedToScalar(posWithSpace), SkFixedToScalar(diffWithSpace));
+ return diffWithSpace < diffNoSpace;
}
SkFixed minSpaceWidth()
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index deb2b28..edd362c 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -438,7 +438,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
m_glWebViewState = new GLWebViewState(&m_viewImpl->gButtonMutex);
if (m_baseLayer->content()) {
IntRect rect(0, 0, m_baseLayer->content()->width(), m_baseLayer->content()->height());
- m_glWebViewState->setBaseLayer(m_baseLayer, rect);
+ m_glWebViewState->setBaseLayer(m_baseLayer, rect, false);
}
}
@@ -1383,11 +1383,11 @@ static void copyScrollPositionRecursive(const LayerAndroid* from,
}
#endif
-void setBaseLayer(BaseLayerAndroid* layer, WebCore::IntRect& rect)
+void setBaseLayer(BaseLayerAndroid* layer, WebCore::IntRect& rect, bool showVisualIndicator)
{
#if USE(ACCELERATED_COMPOSITING)
if (m_glWebViewState)
- m_glWebViewState->setBaseLayer(layer, rect);
+ m_glWebViewState->setBaseLayer(layer, rect, showVisualIndicator);
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
@@ -1770,11 +1770,12 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
return false;
}
-static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject jrect)
+static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject jrect,
+ jboolean showVisualIndicator)
{
BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer);
WebCore::IntRect rect = jrect_to_webrect(env, jrect);
- GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, rect);
+ GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, rect, showVisualIndicator);
}
static void nativeReplaceBaseContent(JNIEnv *env, jobject obj, jint content)
@@ -2566,7 +2567,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetFindIsUp },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
- { "nativeSetBaseLayer", "(ILandroid/graphics/Rect;)V",
+ { "nativeSetBaseLayer", "(ILandroid/graphics/Rect;Z)V",
(void*) nativeSetBaseLayer },
{ "nativeReplaceBaseContent", "(I)V",
(void*) nativeReplaceBaseContent },
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 06506ba..be89a68 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -164,8 +164,10 @@ bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {
weakWebViewRef = env->NewWeakGlobalRef(webview);
m_layer = new WebCore::MediaLayer(weakWebViewRef);
}
- else if (model != kOpenGL_ANPDrawingModel && m_layer != 0)
+ else if (model != kOpenGL_ANPDrawingModel && m_layer != 0) {
m_layer->unref();
+ m_layer = 0;
+ }
if (m_drawingModel != model) {
// Trigger layer computation in RenderLayerCompositor