summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/RenderSkinMediaButton.cpp10
-rw-r--r--WebKit/android/RenderSkinMediaButton.h2
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp31
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.h6
-rw-r--r--WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp157
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp5
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h2
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp1
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp3
-rw-r--r--WebKit/android/jni/WebStorage.cpp7
-rw-r--r--WebKit/android/jni/WebViewCore.cpp25
-rw-r--r--WebKit/android/jni/WebViewCore.h8
-rw-r--r--WebKit/android/nav/SelectText.cpp41
-rw-r--r--WebKit/android/nav/SelectText.h3
14 files changed, 223 insertions, 78 deletions
diff --git a/WebKit/android/RenderSkinMediaButton.cpp b/WebKit/android/RenderSkinMediaButton.cpp
index a04f36c..f9da7cf 100644
--- a/WebKit/android/RenderSkinMediaButton.cpp
+++ b/WebKit/android/RenderSkinMediaButton.cpp
@@ -81,7 +81,7 @@ void RenderSkinMediaButton::Init(android::AssetManager* am, String drawableDirec
}
}
-void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType)
+void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType, bool translucent)
{
// 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.
@@ -99,7 +99,12 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT
SkRect bounds(r);
SkScalar imageMargin = 8;
SkPaint paint;
- SkColor backgroundColor = SkColorSetARGB(255, 34, 34, 34);
+
+ int alpha = 255;
+ if (translucent)
+ alpha = 190;
+
+ SkColor backgroundColor = SkColorSetARGB(alpha, 34, 34, 34);
paint.setColor(backgroundColor);
switch (buttonType) {
@@ -115,6 +120,7 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT
}
case BACKGROUND_SLIDER:
{
+ drawsBackgroundColor = false;
drawsImage = false;
break;
}
diff --git a/WebKit/android/RenderSkinMediaButton.h b/WebKit/android/RenderSkinMediaButton.h
index 27a4e41..124db32 100644
--- a/WebKit/android/RenderSkinMediaButton.h
+++ b/WebKit/android/RenderSkinMediaButton.h
@@ -44,7 +44,7 @@ public:
* 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.
*/
- static void Draw(SkCanvas* , const IntRect& , int buttonType);
+ static void Draw(SkCanvas* , const IntRect& , int buttonType, bool translucent = false);
/**
* Button types
*/
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index 980c03e..ca28932 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -37,7 +37,10 @@
#include "FrameLoader.h"
#include "FrameView.h"
#include "Geolocation.h"
+#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
#include "Icon.h"
+#include "LayerAndroid.h"
#include "Page.h"
#include "PopupMenuAndroid.h"
#include "ScriptController.h"
@@ -557,4 +560,32 @@ void ChromeClientAndroid::webAppCanBeInstalled()
}
#endif
+#if ENABLE(VIDEO)
+bool ChromeClientAndroid::supportsFullscreenForNode(const Node* node)
+{
+ return node->hasTagName(HTMLNames::videoTag);
+}
+
+void ChromeClientAndroid::enterFullscreenForNode(Node* node)
+{
+ if (!node->hasTagName(HTMLNames::videoTag))
+ return;
+
+ HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node);
+ LayerAndroid* layer = videoElement->platformLayer();
+ if (!layer)
+ return;
+
+ FrameView* frameView = m_webFrame->page()->mainFrame()->view();
+ android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView);
+ if (core)
+ core->enterFullscreenForVideoLayer(layer->uniqueId());
+}
+
+void ChromeClientAndroid::exitFullscreenForNode(Node* node)
+{
+}
+#endif
+
+
}
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
index 6c8aef1..2b6f68a 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
@@ -187,6 +187,12 @@ namespace android {
virtual void webAppCanBeInstalled();
#endif
+#if ENABLE(VIDEO)
+ virtual bool supportsFullscreenForNode(const WebCore::Node*);
+ virtual void enterFullscreenForNode(WebCore::Node*);
+ virtual void exitFullscreenForNode(WebCore::Node*);
+#endif
+
private:
android::WebFrame* m_webFrame;
// The Geolocation permissions manager.
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index f5dd567..8f84c2f 100644
--- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -28,29 +28,34 @@
#if ENABLE(VIDEO)
+#include "BaseLayerAndroid.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "SkiaUtils.h"
+#include "VideoLayerAndroid.h"
#include "WebCoreJni.h"
#include "WebViewCore.h"
-
#include <GraphicsJNI.h>
#include <JNIHelp.h>
#include <JNIUtility.h>
#include <SkBitmap.h>
+#include <gui/SurfaceTexture.h>
using namespace android;
+// Forward decl
+namespace android {
+sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz);
+};
namespace WebCore {
static const char* g_ProxyJavaClass = "android/webkit/HTML5VideoViewProxy";
static const char* g_ProxyJavaClassAudio = "android/webkit/HTML5Audio";
-struct MediaPlayerPrivate::JavaGlue
-{
+struct MediaPlayerPrivate::JavaGlue {
jobject m_javaProxy;
jmethodID m_play;
jmethodID m_teardown;
@@ -67,6 +72,8 @@ struct MediaPlayerPrivate::JavaGlue
MediaPlayerPrivate::~MediaPlayerPrivate()
{
+ // m_videoLayer is reference counted, unref is enough here.
+ m_videoLayer->unref();
if (m_glue->m_javaProxy) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (env) {
@@ -120,8 +127,8 @@ void MediaPlayerPrivate::seek(float time)
checkException(env);
}
-
-void MediaPlayerPrivate::prepareToPlay() {
+void MediaPlayerPrivate::prepareToPlay()
+{
// We are about to start playing. Since our Java VideoView cannot
// buffer any data, we just simply transition to the HaveEnoughData
// state in here. This will allow the MediaPlayer to transition to
@@ -136,7 +143,7 @@ void MediaPlayerPrivate::prepareToPlay() {
MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
: m_player(player),
m_glue(0),
- m_duration(6000),
+ m_duration(1), // keep this minimal to avoid initial seek problem
m_currentTime(0),
m_paused(true),
m_hasVideo(false),
@@ -145,35 +152,38 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
m_poster(0),
m_naturalSize(100, 100),
m_naturalSizeUnknown(true),
- m_isVisible(false)
+ m_isVisible(false),
+ m_videoLayer(new VideoLayerAndroid())
{
}
-void MediaPlayerPrivate::onEnded() {
+void MediaPlayerPrivate::onEnded()
+{
m_currentTime = duration();
m_player->timeChanged();
m_paused = true;
m_hasVideo = false;
m_networkState = MediaPlayer::Idle;
- m_readyState = MediaPlayer::HaveNothing;
}
-void MediaPlayerPrivate::onPaused() {
+void MediaPlayerPrivate::onPaused()
+{
m_paused = true;
m_hasVideo = false;
m_networkState = MediaPlayer::Idle;
- m_readyState = MediaPlayer::HaveNothing;
m_player->playbackStateChanged();
}
-void MediaPlayerPrivate::onTimeupdate(int position) {
+void MediaPlayerPrivate::onTimeupdate(int position)
+{
m_currentTime = position / 1000.0f;
m_player->timeChanged();
}
class MediaPlayerVideoPrivate : public MediaPlayerPrivate {
public:
- void load(const String& url) {
+ void load(const String& url)
+ {
m_url = url;
// Cheat a bit here to make sure Window.onLoad event can be triggered
// at the right time instead of real video play time, since only full
@@ -185,7 +195,8 @@ public:
m_player->readyStateChanged();
}
- void play() {
+ void play()
+ {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env || !m_url.length() || !m_glue->m_javaProxy)
return;
@@ -201,13 +212,16 @@ public:
m_currentTime = 0;
jstring jUrl = wtfStringToJstring(env, m_url);
- env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl, static_cast<jint>(m_currentTime * 1000.0f));
+ env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl,
+ static_cast<jint>(m_currentTime * 1000.0f),
+ m_videoLayer->uniqueId());
env->DeleteLocalRef(jUrl);
checkException(env);
}
bool canLoadPoster() const { return true; }
- void setPoster(const String& url) {
+ void setPoster(const String& url)
+ {
if (m_posterUrl == url)
return;
@@ -220,7 +234,8 @@ public:
env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_loadPoster, jUrl);
env->DeleteLocalRef(jUrl);
}
- void paint(GraphicsContext* ctxt, const IntRect& r) {
+ void paint(GraphicsContext* ctxt, const IntRect& r)
+ {
if (ctxt->paintingDisabled())
return;
@@ -244,7 +259,8 @@ public:
canvas->drawBitmapRect(*m_poster, 0, targetRect, 0);
}
- void onPosterFetched(SkBitmap* poster) {
+ void onPosterFetched(SkBitmap* poster)
+ {
m_poster = poster;
if (m_naturalSizeUnknown) {
// We had to fake the size at startup, or else our paint
@@ -258,7 +274,8 @@ public:
}
}
- void onPrepared(int duration, int width, int height) {
+ void onPrepared(int duration, int width, int height)
+ {
m_duration = duration / 1000.0f;
m_naturalSize = IntSize(width, height);
m_naturalSizeUnknown = false;
@@ -269,8 +286,10 @@ public:
bool hasAudio() { return false; } // do not display the audio UI
bool hasVideo() { return m_hasVideo; }
+ bool suppportsFullscreen() { return true; }
- MediaPlayerVideoPrivate(MediaPlayer* player) : MediaPlayerPrivate(player) {
+ MediaPlayerVideoPrivate(MediaPlayer* player) : MediaPlayerPrivate(player)
+ {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
@@ -283,18 +302,19 @@ public:
m_glue = new JavaGlue;
m_glue->m_getInstance = env->GetStaticMethodID(clazz, "getInstance", "(Landroid/webkit/WebViewCore;I)Landroid/webkit/HTML5VideoViewProxy;");
m_glue->m_loadPoster = env->GetMethodID(clazz, "loadPoster", "(Ljava/lang/String;)V");
- m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;I)V");
+ m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;II)V");
m_glue->m_teardown = env->GetMethodID(clazz, "teardown", "()V");
m_glue->m_seek = env->GetMethodID(clazz, "seek", "(I)V");
m_glue->m_pause = env->GetMethodID(clazz, "pause", "()V");
- m_glue->m_javaProxy = NULL;
+ m_glue->m_javaProxy = 0;
env->DeleteLocalRef(clazz);
// An exception is raised if any of the above fails.
checkException(env);
}
- void createJavaPlayerIfNeeded() {
+ void createJavaPlayerIfNeeded()
+ {
// Check if we have been already created.
if (m_glue->m_javaProxy)
return;
@@ -308,7 +328,7 @@ public:
if (!clazz)
return;
- jobject obj = NULL;
+ jobject obj = 0;
FrameView* frameView = m_player->frameView();
if (!frameView)
@@ -335,14 +355,16 @@ public:
checkException(env);
}
- float maxTimeSeekable() const {
+ float maxTimeSeekable() const
+ {
return m_duration;
}
};
class MediaPlayerAudioPrivate : public MediaPlayerPrivate {
public:
- void load(const String& url) {
+ void load(const String& url)
+ {
m_url = url;
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env || !m_url.length())
@@ -360,7 +382,8 @@ public:
checkException(env);
}
- void play() {
+ void play()
+ {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env || !m_url.length())
return;
@@ -376,8 +399,11 @@ public:
}
bool hasAudio() { return true; }
+ bool hasVideo() { return false; }
+ bool suppportsFullscreen() { return false; }
- float maxTimeSeekable() const {
+ float maxTimeSeekable() const
+ {
if (m_glue->m_javaProxy) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (env) {
@@ -390,7 +416,8 @@ public:
return 0;
}
- MediaPlayerAudioPrivate(MediaPlayer* player) : MediaPlayerPrivate(player) {
+ MediaPlayerAudioPrivate(MediaPlayer* player) : MediaPlayerPrivate(player)
+ {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
@@ -408,13 +435,14 @@ public:
m_glue->m_teardown = env->GetMethodID(clazz, "teardown", "()V");
m_glue->m_seek = env->GetMethodID(clazz, "seek", "(I)V");
m_glue->m_pause = env->GetMethodID(clazz, "pause", "()V");
- m_glue->m_javaProxy = NULL;
+ m_glue->m_javaProxy = 0;
env->DeleteLocalRef(clazz);
// An exception is raised if any of the above fails.
checkException(env);
}
- void createJavaPlayerIfNeeded() {
+ void createJavaPlayerIfNeeded()
+ {
// Check if we have been already created.
if (m_glue->m_javaProxy)
return;
@@ -428,7 +456,7 @@ public:
if (!clazz)
return;
- jobject obj = NULL;
+ jobject obj = 0;
// Get the HTML5Audio instance
obj = env->NewObject(clazz, m_glue->m_newInstance, this);
@@ -441,7 +469,8 @@ public:
checkException(env);
}
- void onPrepared(int duration, int width, int height) {
+ void onPrepared(int duration, int width, int height)
+ {
// Android media player gives us a duration of 0 for a live
// stream, so in that case set the real duration to infinity.
// We'll still be able to handle the case that we genuinely
@@ -469,28 +498,32 @@ MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
namespace android {
-static void OnPrepared(JNIEnv* env, jobject obj, int duration, int width, int height, int pointer) {
+static void OnPrepared(JNIEnv* env, jobject obj, int duration, int width, int height, int pointer)
+{
if (pointer) {
WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
player->onPrepared(duration, width, height);
}
}
-static void OnEnded(JNIEnv* env, jobject obj, int pointer) {
+static void OnEnded(JNIEnv* env, jobject obj, int pointer)
+{
if (pointer) {
WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
player->onEnded();
}
}
-static void OnPaused(JNIEnv* env, jobject obj, int pointer) {
+static void OnPaused(JNIEnv* env, jobject obj, int pointer)
+{
if (pointer) {
WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
player->onPaused();
}
}
-static void OnPosterFetched(JNIEnv* env, jobject obj, jobject poster, int pointer) {
+static void OnPosterFetched(JNIEnv* env, jobject obj, jobject poster, int pointer)
+{
if (!pointer || !poster)
return;
@@ -501,20 +534,62 @@ static void OnPosterFetched(JNIEnv* env, jobject obj, jobject poster, int pointe
player->onPosterFetched(posterNative);
}
-static void OnBuffering(JNIEnv* env, jobject obj, int percent, int pointer) {
+static void OnBuffering(JNIEnv* env, jobject obj, int percent, int pointer)
+{
if (pointer) {
WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
- //TODO: player->onBuffering(percent);
+ // TODO: player->onBuffering(percent);
}
}
-static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer) {
+static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer)
+{
if (pointer) {
WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
player->onTimeupdate(position);
}
}
+// This is called on the UI thread only.
+// The video layers are composited on the webkit thread and then copied over
+// to the UI thread with the same ID. For rendering, we are only using the
+// video layers on the UI thread. Therefore, on the UI thread, we have to use
+// the videoLayerId from Java side to find the exact video layer in the tree
+// to set the surface texture.
+// Every time a play call into Java side, the videoLayerId will be sent and
+// saved in Java side. Then every time setBaseLayer call, the saved
+// videoLayerId will be passed to this function to find the Video Layer.
+// Return value: true when the video layer is found.
+static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex,
+ int baseLayer, int videoLayerId,
+ int textureName, bool updateTexture) {
+ if (!surfTex)
+ return false;
+
+ sp<SurfaceTexture> texture = android::SurfaceTexture_getSurfaceTexture(env, surfTex);
+ if (!texture.get())
+ return false;
+
+ BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(baseLayer);
+ if (!layerImpl)
+ return false;
+ if (!layerImpl->countChildren())
+ return false;
+ LayerAndroid* compositedRoot = static_cast<LayerAndroid*>(layerImpl->getChild(0));
+ if (!compositedRoot)
+ return false;
+
+ VideoLayerAndroid* videoLayer =
+ static_cast<VideoLayerAndroid*>(compositedRoot->findById(videoLayerId));
+ if (!videoLayer)
+ return false;
+
+ // Set the SurfaceTexture to the layer we found
+ videoLayer->setSurfaceTexture(texture, textureName, updateTexture);
+ return true;
+}
+
+
/*
* JNI registration
*/
@@ -527,6 +602,8 @@ static JNINativeMethod g_MediaPlayerMethods[] = {
(void*) OnPaused },
{ "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V",
(void*) OnPosterFetched },
+ { "nativeSendSurfaceTexture", "(Landroid/graphics/SurfaceTexture;IIIZ)Z",
+ (void*) SendSurfaceTexture },
{ "nativeOnTimeupdate", "(II)V",
(void*) OnTimeupdate },
};
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index a14036f..a7321da 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -71,6 +71,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web
, m_runnableFactory(this)
, m_wantToPause(false)
, m_isPaused(false)
+ , m_isSync(false)
{
GURL gurl(m_url);
@@ -96,6 +97,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web
, m_runnableFactory(this)
, m_wantToPause(false)
, m_isPaused(false)
+ , m_isSync(false)
{
}
@@ -196,6 +198,9 @@ void WebRequest::updateLoadFlags(int& loadFlags)
loadFlags |= net::LOAD_BYPASS_CACHE;
if (m_cacheMode == 3) // LOAD_CACHE_ONLY
loadFlags |= net::LOAD_ONLY_FROM_CACHE;
+
+ if (m_isSync)
+ loadFlags |= net::LOAD_IGNORE_LIMITS;
}
void WebRequest::start()
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index dba7559..252267b 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -88,6 +88,7 @@ public:
const std::string& getUrl() const;
const std::string& getUserAgent() const;
+ void setSync(bool sync) { m_isSync = sync; }
private:
void startReading();
bool read(int* bytesRead);
@@ -113,6 +114,7 @@ private:
ScopedRunnableMethodFactory<WebRequest> m_runnableFactory;
bool m_wantToPause;
bool m_isPaused;
+ bool m_isSync;
#ifdef LOG_REQUESTS
time_t m_startTime;
#endif
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
index 19f4f34..fcfb4ca 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
+++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
@@ -175,6 +175,7 @@ bool WebUrlLoaderClient::start(bool isMainResource, bool isMainFrame, bool sync,
m_sync = sync;
if (m_sync) {
AutoLock autoLock(*syncLock());
+ m_request->setSync(sync);
m_request->setRequestContext(context);
thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::start));
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 6683fb2..49eac3c 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -1206,9 +1206,6 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
pageClients.deviceOrientationClient = deviceOrientationC;
WebCore::Page* page = new WebCore::Page(pageClients);
- // css files without explicit MIMETYPE is treated as generic text files in
- // the Java side. So we can't enforce CSS MIMETYPE.
- page->settings()->setEnforceCSSMIMETypeInNoQuirksMode(false);
editorC->setPage(page);
page->setGroupName("android.webkit");
diff --git a/WebKit/android/jni/WebStorage.cpp b/WebKit/android/jni/WebStorage.cpp
index ebe840b..ca3ccc6 100644
--- a/WebKit/android/jni/WebStorage.cpp
+++ b/WebKit/android/jni/WebStorage.cpp
@@ -29,6 +29,7 @@
#include "JavaSharedClient.h"
#include "KURL.h"
+#include "PageGroup.h"
#include "WebCoreJni.h"
#include <JNIHelp.h>
@@ -137,6 +138,12 @@ static void DeleteAllData(JNIEnv* env, jobject obj)
int size = manifestUrls.size();
for (int i = 0; i < size; ++i)
WebCore::cacheStorage().deleteCacheGroup(manifestUrls[i]);
+
+ // FIXME: this is a workaround for eliminating any DOM Storage data (both
+ // session and local storage) as there is no functionality inside WebKit at the
+ // moment to do it. That functionality is a WIP in https://bugs.webkit.org/show_bug.cgi?id=51878
+ // and when that patch lands and we merge it, we should move towards that approach instead.
+ WebCore::PageGroup::clearDomStorage();
}
static void SetAppCacheMaximumSize(JNIEnv* env, jobject obj, unsigned long long size)
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 05f33cf..834120d 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -299,6 +299,7 @@ struct WebViewCore::JavaGlue {
jmethodID m_centerFitRect;
jmethodID m_setScrollbarModes;
jmethodID m_setInstallableWebApp;
+ jmethodID m_enterFullscreenForVideoLayer;
jmethodID m_setWebTextViewAutoFillable;
jmethodID m_selectAt;
AutoJObject object(JNIEnv* env) {
@@ -344,7 +345,6 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
#endif
m_isPaused = false;
m_screenOnCounter = 0;
- m_onlyScrollIfImeIsShowing = false;
m_shouldPaintCaret = true;
LOG_ASSERT(m_mainFrame, "Uh oh, somehow a frameview was made without an initial frame!");
@@ -397,6 +397,9 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_centerFitRect = GetJMethod(env, clazz, "centerFitRect", "(IIII)V");
m_javaGlue->m_setScrollbarModes = GetJMethod(env, clazz, "setScrollbarModes", "(II)V");
m_javaGlue->m_setInstallableWebApp = GetJMethod(env, clazz, "setInstallableWebApp", "()V");
+#if ENABLE(VIDEO)
+ m_javaGlue->m_enterFullscreenForVideoLayer = GetJMethod(env, clazz, "enterFullscreenForVideoLayer", "(I)V");
+#endif
m_javaGlue->m_setWebTextViewAutoFillable = GetJMethod(env, clazz, "setWebTextViewAutoFillable", "(ILjava/lang/String;)V");
m_javaGlue->m_selectAt = GetJMethod(env, clazz, "selectAt", "(II)V");
env->DeleteLocalRef(clazz);
@@ -948,7 +951,7 @@ void WebViewCore::scrollTo(int x, int y, bool animate)
JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollTo,
- x, y, animate, m_onlyScrollIfImeIsShowing);
+ x, y, animate, false);
checkException(env);
}
@@ -1316,14 +1319,6 @@ void WebViewCore::setSizeScreenWidthAndScale(int width, int height,
}
}
- // If this was in response to touching a textfield and showing the IME,
- // the IME may now cover textfield. Bring it back into view.
- // If the scale changed, however, this was the result of a zoom.
- if (oldScale == m_scale && osh > screenHeight) {
- m_onlyScrollIfImeIsShowing = true;
- revealSelection();
- m_onlyScrollIfImeIsShowing = false;
- }
// update the currently visible screen as perceived by the plugin
sendPluginVisibleScreen();
}
@@ -3639,6 +3634,16 @@ void WebViewCore::notifyWebAppCanBeInstalled()
checkException(env);
}
+#if ENABLE(VIDEO)
+void WebViewCore::enterFullscreenForVideoLayer(int layerId)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_enterFullscreenForVideoLayer, layerId);
+ checkException(env);
+}
+#endif
+
void WebViewCore::setWebTextViewAutoFillable(int queryId, const string16& previewSummary)
{
#if ENABLE(WEB_AUTOFILL)
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 40087c2..59efe35 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -539,6 +539,11 @@ namespace android {
void splitContent(PictureSet*);
void notifyWebAppCanBeInstalled();
+
+#if ENABLE(VIDEO)
+ void enterFullscreenForVideoLayer(int layerId);
+#endif
+
void setWebTextViewAutoFillable(int queryId, const string16& previewSummary);
DeviceMotionAndOrientationManager* deviceMotionAndOrientationManager() { return &m_deviceMotionAndOrientationManager; }
@@ -608,9 +613,6 @@ namespace android {
int m_blurringNodePointer;
int m_lastFocusedSelStart;
int m_lastFocusedSelEnd;
- // Pass along with a scroll message to tell the UI thread to only
- // scroll the page if the IME is showing.
- bool m_onlyScrollIfImeIsShowing;
PictureSet m_content; // the set of pictures to draw
SkRegion m_addInval; // the accumulated inval region (not yet drawn)
SkRegion m_rebuildInval; // the accumulated region for rebuilt pictures
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index bae0feb..f8ea799 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -1308,12 +1308,11 @@ static WTF::String text(const SkPicture& picture, const SkIRect& area,
#define CONTROL_WIDTH 21
#define STROKE_WIDTH 1.0f
#define STROKE_OUTSET 3.5f
-
+#define STROKE_I_OUTSET 4 // (int) ceil(STROKE_OUTSET)
#define STROKE_COLOR 0x66000000
#define OUTER_COLOR 0x33000000
#define INNER_COLOR 0xe6aae300
-#define DROP_HEIGHT 4
#define SLOP 35
SelectText::SelectText()
@@ -1459,18 +1458,18 @@ void SelectText::drawSelectionPointer(SkCanvas* canvas, IntRect* inval)
static void addStart(SkRegion* diff, const SkIRect& rect)
{
SkIRect bounds;
- bounds.set(rect.fLeft - CONTROL_WIDTH - STROKE_WIDTH,
- rect.fBottom - STROKE_WIDTH, rect.fLeft + STROKE_WIDTH,
- rect.fBottom + CONTROL_HEIGHT + DROP_HEIGHT + STROKE_WIDTH);
+ bounds.set(rect.fLeft - CONTROL_WIDTH - STROKE_I_OUTSET,
+ rect.fBottom - STROKE_I_OUTSET, rect.fLeft + STROKE_I_OUTSET,
+ rect.fBottom + CONTROL_HEIGHT + STROKE_I_OUTSET);
diff->op(bounds, SkRegion::kUnion_Op);
}
static void addEnd(SkRegion* diff, const SkIRect& rect)
{
SkIRect bounds;
- bounds.set(rect.fLeft - STROKE_WIDTH, rect.fBottom - STROKE_WIDTH,
- rect.fLeft + CONTROL_WIDTH + STROKE_WIDTH,
- rect.fBottom + CONTROL_HEIGHT + DROP_HEIGHT + STROKE_WIDTH);
+ bounds.set(rect.fRight - STROKE_I_OUTSET, rect.fBottom - STROKE_I_OUTSET,
+ rect.fRight + CONTROL_WIDTH + STROKE_I_OUTSET,
+ rect.fBottom + CONTROL_HEIGHT + STROKE_I_OUTSET);
diff->op(bounds, SkRegion::kUnion_Op);
}
@@ -1486,7 +1485,9 @@ void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
m_selStart.fLeft, m_selStart.fTop, m_selStart.fRight, m_selStart.fBottom,
m_selEnd.fLeft, m_selEnd.fTop, m_selEnd.fRight, m_selEnd.fBottom,
ivisBounds.fLeft, ivisBounds.fTop, ivisBounds.fRight, ivisBounds.fBottom);
- SkRegion diff(m_selRegion);
+ if (m_lastSelRegion != m_selRegion)
+ m_lastSelRegion.set(m_selRegion);
+ SkRegion diff(m_lastSelRegion);
m_selRegion.setEmpty();
m_flipped = buildSelection(*m_picture, ivisBounds, m_selStart, m_startBase,
m_selEnd, m_endBase, &m_selRegion);
@@ -1517,20 +1518,20 @@ void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
DBG_NAV_LOGD("lastStart=(%d,%d,r=%d,b=%d) m_lastEnd=(%d,%d,r=%d,b=%d)",
m_lastStart.fLeft, m_lastStart.fTop, m_lastStart.fRight, m_lastStart.fBottom,
m_lastEnd.fLeft, m_lastEnd.fTop, m_lastEnd.fRight, m_lastEnd.fBottom);
+ if (!m_lastDrawnStart.isEmpty())
+ addStart(&diff, m_lastDrawnStart);
if (m_lastStart != m_selStart) {
- if (!m_lastStart.isEmpty()) {
- addStart(&diff, m_lastStart);
- m_lastStart = m_selStart;
- }
- addStart(&diff, m_selStart);
+ m_lastDrawnStart = m_lastStart;
+ m_lastStart = m_selStart;
}
+ addStart(&diff, m_selStart);
+ if (!m_lastDrawnEnd.isEmpty())
+ addEnd(&diff, m_lastDrawnEnd);
if (m_lastEnd != m_selEnd) {
- if (!m_lastEnd.isEmpty()) {
- addEnd(&diff, m_lastEnd);
- m_lastEnd = m_selEnd;
- }
- addEnd(&diff, m_selEnd);
+ m_lastDrawnEnd = m_lastEnd;
+ m_lastEnd = m_selEnd;
}
+ addEnd(&diff, m_selEnd);
SkIRect iBounds = diff.getBounds();
DBG_NAV_LOGD("diff=(%d,%d,r=%d,b=%d)",
iBounds.fLeft, iBounds.fTop, iBounds.fRight, iBounds.fBottom);
@@ -1799,8 +1800,10 @@ void SelectText::reset()
DBG_NAV_LOG("m_extendSelection=false");
m_selStart.setEmpty();
m_lastStart.setEmpty();
+ m_lastDrawnStart.setEmpty();
m_selEnd.setEmpty();
m_lastEnd.setEmpty();
+ m_lastDrawnEnd.setEmpty();
m_extendSelection = false;
m_startSelection = false;
SkSafeUnref(m_picture);
diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h
index 3b15c0b..42239cf 100644
--- a/WebKit/android/nav/SelectText.h
+++ b/WebKit/android/nav/SelectText.h
@@ -84,11 +84,14 @@ private:
SkIRect m_selEnd;
SkIRect m_lastStart;
SkIRect m_lastEnd;
+ SkIRect m_lastDrawnStart;
+ SkIRect m_lastDrawnEnd;
SkIRect m_wordBounds;
int m_startBase;
int m_endBase;
int m_layerId;
SkIRect m_visibleRect; // constrains picture computations to visible area
+ SkRegion m_lastSelRegion;
SkRegion m_selRegion; // computed from sel start, end
SkPicture m_startControl;
SkPicture m_endControl;