summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk5
-rw-r--r--Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp92
-rw-r--r--Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h6
-rw-r--r--Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp4
-rw-r--r--Source/WebCore/loader/SubresourceLoader.cpp2
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp3
-rw-r--r--Source/WebCore/platform/MIMETypeRegistry.cpp1
-rw-r--r--Source/WebCore/plugins/android/PluginViewAndroid.cpp2
-rw-r--r--Source/WebCore/rendering/RenderLayer.cpp12
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp8
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h2
-rw-r--r--Source/WebKit/android/plugins/ANPWindowInterface.cpp14
-rw-r--r--Source/WebKit/android/plugins/PluginWidgetAndroid.cpp35
-rw-r--r--Source/WebKit/android/plugins/PluginWidgetAndroid.h3
-rw-r--r--Source/WebKit/android/plugins/android_npapi.h33
15 files changed, 131 insertions, 91 deletions
diff --git a/Android.mk b/Android.mk
index f79cb95..fb3a06d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -461,7 +461,10 @@ endif # JAVASCRIPT_ENGINE == jsc
# Now build the shared library using only the exported jni entry point. This
# will strip out any unused code from the entry point.
include $(CLEAR_VARS)
-# if you need to make webcore huge (for debugging), enable this line
+# Do not attempt prelink this library. Needed to keep master-gpl happy, no
+# effect in master.
+# TODO: remove this when master-gpl is updated.
+LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libwebcore
LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
diff --git a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
index 4becdfd..30e344d 100644
--- a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
+++ b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
@@ -30,7 +30,9 @@
#include "JavaInstanceV8.h"
#include "JavaNPObjectV8.h"
+#if PLATFORM(ANDROID)
#include "npruntime_impl.h"
+#endif // PLATFORM(ANDROID)
#include <wtf/text/CString.h>
namespace JSC {
@@ -46,6 +48,7 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
switch (jniType) {
case array_type:
+#if PLATFORM(ANDROID)
{
JNIEnv* env = getJNIEnv();
jobject javaArray;
@@ -55,17 +58,9 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
if (!success) {
// No length property so we don't know how many elements to put into the array.
// Treat this as an error.
-#ifdef EMULATE_JSC_BINDINGS
// JSC sends null for an array that is not an array of strings or basic types,
// do this also in the unknown length case.
memset(&result, 0, sizeof(jvalue));
-#else
- // Sending NULL as JSC does seems dangerous. (Imagine the java method that asks
- // for the length of the array it was passed). Here we send a 0 length array.
- jclass objectClass = env->FindClass("java/lang/Object");
- javaArray = env->NewObjectArray(0, objectClass, 0);
- env->DeleteLocalRef(objectClass);
-#endif
break;
}
@@ -202,28 +197,19 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
}
}
} else {
-#ifdef EMULATE_JSC_BINDINGS
// JSC sends null for an array that is not an array of strings or basic types.
memset(&result, 0, sizeof(jvalue));
break;
-#else
- // Sending NULL as JSC does seems dangerous. (Imagine the java method that asks
- // for the length of the array it was passed). Here we send a 0 length array.
- jclass objectClass = env->FindClass("java/lang/Object");
- javaArray = env->NewObjectArray(0, objectClass, 0);
- env->DeleteLocalRef(objectClass);
-#endif
}
result.l = javaArray;
}
break;
+#endif // PLATFORM(ANDROID)
case object_type:
{
- JNIEnv* env = getJNIEnv();
result.l = static_cast<jobject>(0);
- jobject javaString;
// First see if we have a Java instance.
if (type == NPVariantType_Object) {
@@ -237,6 +223,7 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
if (!result.l && !strcmp(javaClassName.data(), "java.lang.String")) {
#ifdef CONVERT_NULL_TO_EMPTY_STRING
if (type == NPVariantType_Null) {
+ JNIEnv* env = getJNIEnv();
jchar buf[2];
jobject javaString = env->functions->NewString(env, buf, 0);
result.l = javaString;
@@ -246,38 +233,32 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
#endif
{
NPString src = NPVARIANT_TO_STRING(value);
- javaString = env->NewStringUTF(src.UTF8Characters);
+ JNIEnv* env = getJNIEnv();
+ jobject javaString = env->NewStringUTF(src.UTF8Characters);
result.l = javaString;
- } else if (type == NPVariantType_Int32) {
+ }
+#if PLATFORM(ANDROID)
+ else if (type == NPVariantType_Int32) {
jint src = NPVARIANT_TO_INT32(value);
- jclass integerClass = env->FindClass("java/lang/Integer");
- jmethodID toString = env->GetStaticMethodID(integerClass, "toString", "(I)Ljava/lang/String;");
- javaString = env->CallStaticObjectMethod(integerClass, toString, src);
- result.l = javaString;
- env->DeleteLocalRef(integerClass);
+ jclass integerClass = getJNIEnv()->FindClass("java/lang/Integer");
+ jmethodID toString = getJNIEnv()->GetStaticMethodID(integerClass, "toString", "(I)Ljava/lang/String;");
+ result.l = getJNIEnv()->CallStaticObjectMethod(integerClass, toString, src);
+ getJNIEnv()->DeleteLocalRef(integerClass);
} else if (type == NPVariantType_Bool) {
jboolean src = NPVARIANT_TO_BOOLEAN(value);
- jclass booleanClass = env->FindClass("java/lang/Boolean");
- jmethodID toString = env->GetStaticMethodID(booleanClass, "toString", "(Z)Ljava/lang/String;");
- javaString = env->CallStaticObjectMethod(booleanClass, toString, src);
- result.l = javaString;
- env->DeleteLocalRef(booleanClass);
+ jclass booleanClass = getJNIEnv()->FindClass("java/lang/Boolean");
+ jmethodID toString = getJNIEnv()->GetStaticMethodID(booleanClass, "toString", "(Z)Ljava/lang/String;");
+ result.l = getJNIEnv()->CallStaticObjectMethod(booleanClass, toString, src);
+ getJNIEnv()->DeleteLocalRef(booleanClass);
} else if (type == NPVariantType_Double) {
jdouble src = NPVARIANT_TO_DOUBLE(value);
- jclass doubleClass = env->FindClass("java/lang/Double");
- jmethodID toString = env->GetStaticMethodID(doubleClass, "toString", "(D)Ljava/lang/String;");
- javaString = env->CallStaticObjectMethod(doubleClass, toString, src);
- result.l = javaString;
- env->DeleteLocalRef(doubleClass);
- }
-#ifdef EMULATE_JSC_BINDINGS
- // For the undefined value, JSC sends the String "undefined". Feels to me like we
- // should send null in this case.
- else if (!NPVARIANT_IS_NULL(value)) {
- javaString = env->NewStringUTF("undefined");
- result.l = javaString;
- }
-#endif
+ jclass doubleClass = getJNIEnv()->FindClass("java/lang/Double");
+ jmethodID toString = getJNIEnv()->GetStaticMethodID(doubleClass, "toString", "(D)Ljava/lang/String;");
+ result.l = getJNIEnv()->CallStaticObjectMethod(doubleClass, toString, src);
+ getJNIEnv()->DeleteLocalRef(doubleClass);
+ } else if (!NPVARIANT_IS_NULL(value))
+ result.l = getJNIEnv()->NewStringUTF("undefined");
+#endif // PLATFORM(ANDROID)
} else if (!result.l)
memset(&result, 0, sizeof(jvalue)); // Handle it the same as a void case
}
@@ -307,15 +288,6 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
{
if (type == NPVariantType_Int32)
result.c = static_cast<char>(NPVARIANT_TO_INT32(value));
-#ifndef EMULATE_JSC_BINDINGS
- // There is no char type in JavaScript - just strings 1 character
- // long. So just converting it to an int above doesn't work. Again,
- // we emulate the behavior for now for maximum compatability.
- else if (type == NPVariantType_String) {
- NPString str = NPVARIANT_TO_STRING(value);
- result.c = str.UTF8Characters[0];
- }
-#endif
else
memset(&result, 0, sizeof(jvalue));
}
@@ -376,6 +348,8 @@ jvalue convertNPVariantToJValue(NPVariant value, const WTF::String& javaType)
}
break;
+ break;
+
case invalid_type:
default:
case void_type:
@@ -427,17 +401,7 @@ void convertJValueToNPVariant(jvalue value, JNIType jniType, const char* javaTyp
case char_type:
{
-#ifndef EMULATE_JSC_BINDINGS
- // There is no char type in JavaScript - just strings 1 character
- // long. So just converting it to an int above doesn't work. Again,
- // we emulate the behavior for now for maximum compatability.
- if (!strcmp(javaTypeName, "char")) {
- const char c = value.c;
- const char* v = strndup(&c, 1);
- STRINGZ_TO_NPVARIANT(v, *result);
- } else
-#endif
- INT32_TO_NPVARIANT(value.c, *result);
+ INT32_TO_NPVARIANT(value.c, *result);
}
break;
diff --git a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h
index 5aa2921..df73a9e 100644
--- a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h
+++ b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h
@@ -32,12 +32,6 @@
#include "npruntime.h"
#include <wtf/text/WTFString.h>
-// FIXME: While fully implementing the bindings I noticed some differences between what
-// I wrote and seemed intuitive and what JSC does. Need to verify if my intuition is wrong
-// or there are bugs in the JSC bindings. For now, this macro makes the V8 bindings do the
-// same as the JSC bindings.
-#define EMULATE_JSC_BINDINGS 1
-
namespace JSC {
namespace Bindings {
diff --git a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
index da6cf4a..0d7c3fb 100644
--- a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
+++ b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
@@ -156,7 +156,7 @@ bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant*
if (!field)
return false;
-#ifdef EMULATE_JSC_BINDINGS
+#if PLATFORM(ANDROID)
// JSC does not seem to support returning object properties so we emulate that
// behaviour here.
jvalue value;
@@ -168,7 +168,7 @@ bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant*
field->getJNIType(),
field->name().utf8(),
field->type());
-#endif
+#endif // PLATFORM(ANDROID)
convertJValueToNPVariant(value, field->getJNIType(), field->type(), result);
return true;
diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp
index 6f6adaf..f948ec3 100644
--- a/Source/WebCore/loader/SubresourceLoader.cpp
+++ b/Source/WebCore/loader/SubresourceLoader.cpp
@@ -75,7 +75,7 @@ PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, Subresourc
FrameLoader::reportLocalLoadFailed(frame, request.url().string());
return 0;
}
-
+
if (SecurityOrigin::shouldHideReferrer(request.url(), fl->outgoingReferrer()))
newRequest.clearHTTPReferrer();
else if (!request.httpReferrer())
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 71edb1b..56715c6 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -85,11 +85,10 @@ CachedResourceLoader::CachedResourceLoader(Document* document)
, m_autoLoadImages(true)
, m_loadFinishing(false)
, m_allowStaleResources(false)
- , m_isInMethod(0)
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
, m_blockNetworkImage(false)
#endif
-
+ , m_isInMethod(0)
{
}
diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp
index 4f9be57..e76906e 100644
--- a/Source/WebCore/platform/MIMETypeRegistry.cpp
+++ b/Source/WebCore/platform/MIMETypeRegistry.cpp
@@ -113,6 +113,7 @@ static void initializeSupportedImageMIMETypes()
#elif PLATFORM(ANDROID)
static const char* types[] = {
"image/jpeg",
+ "image/webp",
"image/png",
"image/gif",
"image/bmp",
diff --git a/Source/WebCore/plugins/android/PluginViewAndroid.cpp b/Source/WebCore/plugins/android/PluginViewAndroid.cpp
index 8b737ea..78d0217 100644
--- a/Source/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/Source/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -106,6 +106,7 @@ extern void ANPSurfaceInterfaceV0_Init(ANPInterface* value);
extern void ANPTypefaceInterfaceV0_Init(ANPInterface* value);
extern void ANPWindowInterfaceV0_Init(ANPInterface* value);
extern void ANPWindowInterfaceV1_Init(ANPInterface* value);
+extern void ANPWindowInterfaceV2_Init(ANPInterface* value);
extern void ANPSystemInterfaceV0_Init(ANPInterface* value);
extern void ANPSystemInterfaceV1_Init(ANPInterface* value);
extern void ANPSystemInterfaceV2_Init(ANPInterface* value);
@@ -135,6 +136,7 @@ static const VarProcPair gVarProcs[] = {
{ VARPROCLINE(TypefaceInterfaceV0) },
{ VARPROCLINE(WindowInterfaceV0) },
{ VARPROCLINE(WindowInterfaceV1) },
+ { VARPROCLINE(WindowInterfaceV2) },
{ VARPROCLINE(SystemInterfaceV0) },
{ VARPROCLINE(SystemInterfaceV1) },
{ VARPROCLINE(SystemInterfaceV2) },
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 5f32933..bc0d440 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -2633,16 +2633,10 @@ void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer*
Vector<RenderLayer*> columnLayers;
RenderLayer* ancestorLayer = isNormalFlowOnly() ? parent() : stackingContext();
for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
- if (curr->renderer()->hasColumns())
+ if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagination(childLayer->renderer(), curr->renderBox()))
columnLayers.append(curr);
-#ifdef ANDROID
- // Bug filed: 56107
if (curr == ancestorLayer)
break;
-#else
- if (curr == ancestorLayer || (curr->parent() && curr->parent()->renderer()->isPositioned()))
- break;
-#endif
}
ASSERT(columnLayers.size());
@@ -3122,9 +3116,9 @@ RenderLayer* RenderLayer::hitTestPaginatedChildLayer(RenderLayer* childLayer, Re
Vector<RenderLayer*> columnLayers;
RenderLayer* ancestorLayer = isNormalFlowOnly() ? parent() : stackingContext();
for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
- if (curr->renderer()->hasColumns())
+ if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagination(childLayer->renderer(), curr->renderBox()))
columnLayers.append(curr);
- if (curr == ancestorLayer || (curr->parent() && curr->parent()->renderer()->isPositioned()))
+ if (curr == ancestorLayer)
break;
}
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index ded3965..601d4ee 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -391,7 +391,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;I)V");
m_javaGlue->m_formDidBlur = GetJMethod(env, clazz, "formDidBlur", "(I)V");
m_javaGlue->m_getPluginClass = GetJMethod(env, clazz, "getPluginClass", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Class;");
- m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/ViewManager$ChildView;I)V");
+ m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/ViewManager$ChildView;II)V");
m_javaGlue->m_hideFullScreenPlugin = GetJMethod(env, clazz, "hideFullScreenPlugin", "()V");
m_javaGlue->m_createSurface = GetJMethod(env, clazz, "createSurface", "(Landroid/view/View;)Landroid/webkit/ViewManager$ChildView;");
m_javaGlue->m_addSurface = GetJMethod(env, clazz, "addSurface", "(Landroid/view/View;IIII)Landroid/webkit/ViewManager$ChildView;");
@@ -3619,14 +3619,16 @@ jclass WebViewCore::getPluginClass(const WTF::String& libName, const char* class
}
}
-void WebViewCore::showFullScreenPlugin(jobject childView, NPP npp)
+void WebViewCore::showFullScreenPlugin(jobject childView, int32_t orientation, NPP npp)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject javaObject = m_javaGlue->object(env);
if (!javaObject.get())
return;
- env->CallVoidMethod(javaObject.get(), m_javaGlue->m_showFullScreenPlugin, childView, reinterpret_cast<int>(npp));
+ env->CallVoidMethod(javaObject.get(),
+ m_javaGlue->m_showFullScreenPlugin,
+ childView, orientation, reinterpret_cast<int>(npp));
checkException(env);
}
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 0e9d80f..0dd45da 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -470,7 +470,7 @@ namespace android {
jclass getPluginClass(const WTF::String& libName, const char* className);
// Creates a full screen surface for a plugin
- void showFullScreenPlugin(jobject webkitPlugin, NPP npp);
+ void showFullScreenPlugin(jobject webkitPlugin, int32_t orientation, NPP npp);
// Instructs the UI thread to discard the plugin's full-screen surface
void hideFullScreenPlugin();
diff --git a/Source/WebKit/android/plugins/ANPWindowInterface.cpp b/Source/WebKit/android/plugins/ANPWindowInterface.cpp
index a74616c..cac8f8c 100644
--- a/Source/WebKit/android/plugins/ANPWindowInterface.cpp
+++ b/Source/WebKit/android/plugins/ANPWindowInterface.cpp
@@ -79,6 +79,12 @@ static ANPRectI anp_visibleRect(NPP instance) {
return pluginWidget->visibleRect();
}
+static void anp_requestFullScreenOrientation(NPP instance, ANPScreenOrientation orientation) {
+ PluginView* pluginView = pluginViewForInstance(instance);
+ PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
+ pluginWidget->setFullScreenOrientation(orientation);
+}
+
///////////////////////////////////////////////////////////////////////////////
#define ASSIGN(obj, name) (obj)->name = anp_##name
@@ -101,3 +107,11 @@ void ANPWindowInterfaceV1_Init(ANPInterface* value) {
ANPWindowInterfaceV1* i = reinterpret_cast<ANPWindowInterfaceV1*>(value);
ASSIGN(i, visibleRect);
}
+
+void ANPWindowInterfaceV2_Init(ANPInterface* value) {
+ // initialize the functions from the previous interface
+ ANPWindowInterfaceV1_Init(value);
+ // add any new functions or override existing functions
+ ANPWindowInterfaceV2* i = reinterpret_cast<ANPWindowInterfaceV2*>(value);
+ ASSIGN(i, requestFullScreenOrientation);
+}
diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
index b8a10cc..19433ab 100644
--- a/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -45,7 +45,7 @@
#include "android_graphics.h"
#include <JNIUtility.h>
-// #define PLUGIN_DEBUG_LOCAL // controls the printing of log messages
+#define PLUGIN_DEBUG_LOCAL // controls the printing of log messages
#define DEBUG_EVENTS 0 // logs event contents, return value, and processing time
#define DEBUG_VISIBLE_RECTS 0 // temporary debug printfs and fixes
@@ -73,6 +73,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view)
m_isSurfaceClippedOut = false;
m_layer = 0;
m_powerState = kDefault_ANPPowerState;
+ m_fullScreenOrientation = -1;
}
PluginWidgetAndroid::~PluginWidgetAndroid() {
@@ -630,7 +631,8 @@ void PluginWidgetAndroid::requestFullScreen() {
m_core->destroySurface(m_embeddedView);
// add the full screen view
- m_core->showFullScreenPlugin(m_embeddedView, m_pluginView->instance());
+ m_core->showFullScreenPlugin(m_embeddedView, m_fullScreenOrientation,
+ m_pluginView->instance());
m_isFullScreen = true;
}
@@ -658,6 +660,35 @@ void PluginWidgetAndroid::exitFullScreen(bool pluginInitiated) {
m_isFullScreen = false;
}
+void PluginWidgetAndroid::setFullScreenOrientation(ANPScreenOrientation orientation) {
+
+ int internalOrienationId;
+ /* We need to validate that the input is legitimate and then convert the
+ * value from the plugin enum to the enum used by the android view system.
+ * The view system values correspond to those values for the
+ * screenOrientation attribute in R.java (see also ActivityInfo.java).
+ */
+ switch (orientation) {
+ case kFixedLandscape_ANPScreenOrientation:
+ internalOrienationId = 0;
+ break;
+ case kFixedPortrait_ANPScreenOrientation:
+ internalOrienationId = 1;
+ break;
+ case kLandscape_ANPScreenOrientation:
+ internalOrienationId = 6;
+ break;
+ case kPortrait_ANPScreenOrientation:
+ internalOrienationId = 7;
+ break;
+ default:
+ internalOrienationId = -1;
+ }
+
+ PLUGIN_LOG("%s orientation (%d)", __FUNCTION__, internalOrienationId);
+ m_fullScreenOrientation = internalOrienationId;
+}
+
void PluginWidgetAndroid::requestCenterFitZoom() {
m_core->centerFitRect(m_pluginWindow->x, m_pluginWindow->y,
m_pluginWindow->width, m_pluginWindow->height);
diff --git a/Source/WebKit/android/plugins/PluginWidgetAndroid.h b/Source/WebKit/android/plugins/PluginWidgetAndroid.h
index 5d586b1..cbebb7f 100644
--- a/Source/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/Source/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -150,6 +150,8 @@ struct PluginWidgetAndroid {
bool inFullScreen() { return m_isFullScreen; }
+ void setFullScreenOrientation(ANPScreenOrientation orientation);
+
/** Called to check if a plugin currently has document focus, which is
required for certain operations (e.g. show/hide keyboard). It returns
true if the plugin currently has focus and false otherwise.
@@ -204,6 +206,7 @@ private:
bool m_acceptEvents;
bool m_isSurfaceClippedOut;
ANPPowerState m_powerState;
+ int m_fullScreenOrientation;
/* We limit the number of rectangles to minimize storage and ensure adequate
speed.
diff --git a/Source/WebKit/android/plugins/android_npapi.h b/Source/WebKit/android/plugins/android_npapi.h
index b0c3765..4ff45c8 100644
--- a/Source/WebKit/android/plugins/android_npapi.h
+++ b/Source/WebKit/android/plugins/android_npapi.h
@@ -127,6 +127,7 @@ typedef uint32_t ANPMatrixFlag;
#define kSystemInterfaceV1_ANPGetValue ((NPNVariable)1016)
#define kSystemInterfaceV2_ANPGetValue ((NPNVariable)1017)
+#define kWindowInterfaceV2_ANPGetValue ((NPNVariable)1018)
/** queries for the drawing models supported on this device.
@@ -695,6 +696,38 @@ struct ANPWindowInterfaceV1 : ANPWindowInterfaceV0 {
ANPRectI (*visibleRect)(NPP instance);
};
+enum ANPScreenOrientations {
+ /** No preference specified: let the system decide the best orientation.
+ */
+ kDefault_ANPScreenOrientation = 0,
+ /** Would like to have the screen in a landscape orientation, but it will
+ not allow for 180 degree rotations.
+ */
+ kFixedLandscape_ANPScreenOrientation = 1,
+ /** Would like to have the screen in a portrait orientation, but it will
+ not allow for 180 degree rotations.
+ */
+ kFixedPortrait_ANPScreenOrientation = 2,
+ /** Would like to have the screen in landscape orientation, but can use the
+ sensor to change which direction the screen is facing.
+ */
+ kLandscape_ANPScreenOrientation = 3,
+ /** Would like to have the screen in portrait orientation, but can use the
+ sensor to change which direction the screen is facing.
+ */
+ kPortrait_ANPScreenOrientation = 4
+};
+typedef int32_t ANPScreenOrientation;
+
+struct ANPWindowInterfaceV2 : ANPWindowInterfaceV1 {
+ /** Called when the plugin wants to specify a particular screen orientation
+ when entering into full screen mode. The orientation must be set prior
+ to entering into full screen. After entering full screen any subsequent
+ changes will be updated the next time the plugin goes full screen.
+ */
+ void (*requestFullScreenOrientation)(NPP instance, ANPScreenOrientation orientation);
+};
+
///////////////////////////////////////////////////////////////////////////////
enum ANPSampleFormats {