Backout b87113ff33ff (bug 721741) for Android build failures
authorEd Morley <bmo@edmorley.co.uk>
Tue, 31 Jan 2012 16:19:00 +0000
changeset 85871 a6aa3112c2e689b9a61818d42c9d5755dbb1ef4b
parent 85870 d9eab22ce37a589e2d3ded6a9100350c4f16f848
child 85872 1a1685737184ee4769611370256199e9bf3a330d
push id496
push usertim.taubert@gmx.de
push dateThu, 02 Feb 2012 09:03:44 +0000
treeherderfx-team@1cdef0321abd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs721741
milestone12.0a1
backs outb87113ff33ff547c3f0049c4d8d19f886f558067
Backout b87113ff33ff (bug 721741) for Android build failures
dom/plugins/base/Makefile.in
dom/plugins/base/android/ANPAudio.cpp
dom/plugins/base/android/ANPBase.h
dom/plugins/base/android/ANPNativeWindow.cpp
dom/plugins/base/android/ANPOpenGL.cpp
dom/plugins/base/android/ANPSystem.cpp
dom/plugins/base/android/ANPVideo.cpp
dom/plugins/base/android/ANPWindow.cpp
dom/plugins/base/android/Makefile.in
dom/plugins/base/android/android_npapi.h
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginInstanceOwner.h
layout/generic/nsObjectFrame.cpp
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/Makefile.in
mobile/android/base/Tab.java
mobile/android/base/Tabs.java
mobile/android/base/gfx/Layer.java
mobile/android/base/gfx/LayerRenderer.java
mobile/android/base/gfx/LayerView.java
mobile/android/base/gfx/SurfaceTextureLayer.java
mobile/android/base/gfx/TextureGenerator.java
mobile/android/base/gfx/TextureReaper.java
mobile/android/base/ui/PanZoomController.java
other-licenses/skia-npapi/Makefile.in
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidMediaLayer.cpp
widget/android/AndroidMediaLayer.h
widget/android/Makefile.in
widget/android/nsWindow.cpp
--- a/dom/plugins/base/Makefile.in
+++ b/dom/plugins/base/Makefile.in
@@ -133,17 +133,16 @@ endif
 endif
 
 ifdef MOZ_JAVA_COMPOSITOR
 DEFINES += -DMOZ_JAVA_COMPOSITOR
 endif
 
 LOCAL_INCLUDES += \
   -DSK_BUILD_FOR_ANDROID_NDK \
-  -I$(topsrcdir)/widget/android \
   -I$(topsrcdir)/xpcom/base/ \
   -I$(topsrcdir)/gfx/skia/include/core \
   -I$(topsrcdir)/gfx/skia/include/config \
   $(MOZ_CAIRO_CFLAGS) \
   $(NULL)
 
 include $(topsrcdir)/dom/dom-config.mk
 include $(topsrcdir)/config/config.mk
--- a/dom/plugins/base/android/ANPAudio.cpp
+++ b/dom/plugins/base/android/ANPAudio.cpp
@@ -301,16 +301,17 @@ void
 anp_audio_start(ANPAudioTrack* s)
 {
   if (s == NULL || s->output_unit == NULL) {
     return;
   }
   
   if (s->keepGoing) {
     // we are already playing.  Ignore.
+    LOG("anp_audio_start called twice!");
     return;
   }
 
   JNIEnv *jenv = GetJNIForThread();
   if (!jenv)
     return;
 
   jenv->CallVoidMethod(s->output_unit, at.play);
@@ -353,35 +354,17 @@ anp_audio_stop(ANPAudioTrack* s)
 }
 
 bool
 anp_audio_isStopped(ANPAudioTrack* s)
 {
   return s->isStopped;
 }
 
-uint32_t
-anp_audio_trackLatency(ANPAudioTrack* s) {
-  // Bug 721835
-  NOT_IMPLEMENTED();
-  return 1;
-}
-
-void InitAudioTrackInterfaceV0(ANPAudioTrackInterfaceV0 *i) {
+void InitAudioTrackInterface(ANPAudioTrackInterfaceV0 *i) {
   _assert(i->inSize == sizeof(*i));
   ASSIGN(i, newTrack);
   ASSIGN(i, deleteTrack);
   ASSIGN(i, start);
   ASSIGN(i, pause);
   ASSIGN(i, stop);
   ASSIGN(i, isStopped);
 }
-
-void InitAudioTrackInterfaceV1(ANPAudioTrackInterfaceV1 *i) {
-  _assert(i->inSize == sizeof(*i));
-  ASSIGN(i, newTrack);
-  ASSIGN(i, deleteTrack);
-  ASSIGN(i, start);
-  ASSIGN(i, pause);
-  ASSIGN(i, stop);
-  ASSIGN(i, isStopped);
-  ASSIGN(i, trackLatency);
-}
--- a/dom/plugins/base/android/ANPBase.h
+++ b/dom/plugins/base/android/ANPBase.h
@@ -31,46 +31,37 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "android_npapi.h"
 #include <stdlib.h>
-#include "android_npapi.h"
 #include "nsAutoPtr.h"
 #include "nsISupportsImpl.h"
 
 #define NOT_IMPLEMENTED_FATAL() do {                                    \
     __android_log_print(ANDROID_LOG_ERROR, "GeckoPlugins",              \
                         "%s not implemented %s, %d",                    \
                         __PRETTY_FUNCTION__, __FILE__, __LINE__);       \
     abort();                                                            \
   } while(0)
 
 #define NOT_IMPLEMENTED()                                               \
     __android_log_print(ANDROID_LOG_ERROR, "GeckoPlugins",              \
                         "!!!!!!!!!!!!!!  %s not implemented %s, %d",    \
                         __PRETTY_FUNCTION__, __FILE__, __LINE__);       \
 
-void InitAudioTrackInterfaceV0(ANPAudioTrackInterfaceV0 *i);
-void InitAudioTrackInterfaceV1(ANPAudioTrackInterfaceV1* i);
+void InitAudioTrackInterface(ANPAudioTrackInterfaceV0 *i);
 void InitBitmapInterface(ANPBitmapInterfaceV0 *i);
 void InitCanvasInterface(ANPCanvasInterfaceV0 *i);
 void InitEventInterface(ANPEventInterfaceV0 *i);
 void InitLogInterface(ANPLogInterfaceV0 *i);
 void InitMatrixInterface(ANPMatrixInterfaceV0 *i);
 void InitPaintInterface(ANPPaintInterfaceV0 *i);
 void InitPathInterface(ANPPathInterfaceV0 *i);
 void InitSurfaceInterface(ANPSurfaceInterfaceV0 *i);
 void InitSystemInterface(ANPSystemInterfaceV0 *i);
-void InitSystemInterfaceV1(ANPSystemInterfaceV1 *i);
-void InitSystemInterfaceV2(ANPSystemInterfaceV2 *i);
 void InitTypeFaceInterface(ANPTypefaceInterfaceV0 *i);
 void InitWindowInterface(ANPWindowInterfaceV0 *i);
-void InitWindowInterfaceV1(ANPWindowInterfaceV1 *i);
-void InitWindowInterfaceV2(ANPWindowInterfaceV2 *i);
-void InitVideoInterfaceV0(ANPVideoInterfaceV0 *i);
-void InitVideoInterfaceV1(ANPVideoInterfaceV1 *i);
-void InitOpenGLInterface(ANPOpenGLInterfaceV0 *i);
-void InitNativeWindowInterface(ANPNativeWindowInterfaceV0 *i);
deleted file mode 100644
--- a/dom/plugins/base/android/ANPNativeWindow.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Android NPAPI support code
- *
- * The Initial Developer of the Original Code is
- * the Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// must include config.h first for webkit to fiddle with new/delete
-#include <android/log.h>
-#include "AndroidBridge.h"
-#include "AndroidMediaLayer.h"
-#include "ANPBase.h"
-#include "nsIPluginInstanceOwner.h"
-#include "nsPluginInstanceOwner.h"
-#include "nsNPAPIPluginInstance.h"
-#include "gfxRect.h"
-
-using namespace mozilla;
-using namespace mozilla;
-
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
-#define ASSIGN(obj, name)   (obj)->name = anp_native_window_##name
-
-static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) {
-  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  nsPluginInstanceOwner* owner;
-  if (NS_FAILED(pinst->GetOwner((nsIPluginInstanceOwner**)&owner))) {
-    return NULL;
-  }
-
-
-  ANPNativeWindow window = owner->Layer()->GetNativeWindowForContent();
-  owner->Invalidate();
-
-  return window;
-}
-
-static void anp_native_window_invertPluginContent(NPP instance, bool isContentInverted) {
-  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  nsPluginInstanceOwner* owner;
-  if (NS_FAILED(pinst->GetOwner((nsIPluginInstanceOwner**)&owner))) {
-    return;
-  }
-
-  owner->Layer()->SetInverted(isContentInverted);
-}
-
-
-void InitNativeWindowInterface(ANPNativeWindowInterfaceV0* i) {
-    ASSIGN(i, acquireNativeWindow);
-    ASSIGN(i, invertPluginContent);
-}
deleted file mode 100644
--- a/dom/plugins/base/android/ANPOpenGL.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* The Original Code is Android NPAPI support code
- *
- * The Initial Developer of the Original Code is
- * the Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <dlfcn.h>
-#include <android/log.h>
-#include "AndroidBridge.h"
-#include "ANPBase.h"
-#include "GLContextProvider.h"
-#include "nsNPAPIPluginInstance.h"
-
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
-#define ASSIGN(obj, name)   (obj)->name = anp_opengl_##name
-
-using namespace mozilla;
-using namespace mozilla::gl;
-
-static ANPEGLContext anp_opengl_acquireContext(NPP inst) {
-    // Bug 687267
-    NOT_IMPLEMENTED();
-    return NULL;
-}
-
-static ANPTextureInfo anp_opengl_lockTexture(NPP instance) {
-    ANPTextureInfo info = { 0, 0, 0, 0 };
-    NOT_IMPLEMENTED();
-    return info;
-}
-
-static void anp_opengl_releaseTexture(NPP instance, const ANPTextureInfo* info) {
-    NOT_IMPLEMENTED();
-}
-
-static void anp_opengl_invertPluginContent(NPP instance, bool isContentInverted) {
-    NOT_IMPLEMENTED();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void InitOpenGLInterface(ANPOpenGLInterfaceV0* i) {
-    ASSIGN(i, acquireContext);
-    ASSIGN(i, lockTexture);
-    ASSIGN(i, releaseTexture);
-    ASSIGN(i, invertPluginContent);
-}
--- a/dom/plugins/base/android/ANPSystem.cpp
+++ b/dom/plugins/base/android/ANPSystem.cpp
@@ -57,22 +57,16 @@ anp_system_getApplicationDataDirectory()
   if (!dir) {
     dir = getenv("ANDROID_PLUGIN_DATADIR");
   }
 
   LOG("getApplicationDataDirectory return %s", dir);
   return dir;
 }
 
-const char*
-anp_system_getApplicationDataDirectory(NPP instance)
-{
-  return anp_system_getApplicationDataDirectory();
-}
-
 jclass anp_system_loadJavaClass(NPP instance, const char* className)
 {
   LOG("%s", __PRETTY_FUNCTION__);
 
   JNIEnv* env = GetJNIForThread();
   if (!env)
     return nsnull;
 
@@ -89,32 +83,13 @@ jclass anp_system_loadJavaClass(NPP inst
   lib->GetLibraryPath(libName);
 
   jstring jclassName = env->NewStringUTF(className);
   jstring jlibName = env->NewStringUTF(libName.get());
   jobject obj = env->CallStaticObjectMethod(cls, method, jclassName, jlibName);
   return reinterpret_cast<jclass>(obj);
 }
 
-void anp_system_setPowerState(NPP instance, ANPPowerState powerState)
-{
-  NOT_IMPLEMENTED();
-}
-
 void InitSystemInterface(ANPSystemInterfaceV0 *i) {
   _assert(i->inSize == sizeof(*i));
   ASSIGN(i, getApplicationDataDirectory);
   ASSIGN(i, loadJavaClass);
 }
-
-void InitSystemInterfaceV1(ANPSystemInterfaceV1 *i) {
-  _assert(i->inSize == sizeof(*i));
-  ASSIGN(i, getApplicationDataDirectory);
-  ASSIGN(i, loadJavaClass);
-  ASSIGN(i, setPowerState);
-}
-
-void InitSystemInterfaceV2(ANPSystemInterfaceV2 *i) {
-  _assert(i->inSize == sizeof(*i));
-  ASSIGN(i, getApplicationDataDirectory);
-  ASSIGN(i, loadJavaClass);
-  ASSIGN(i, setPowerState);
-}
deleted file mode 100644
--- a/dom/plugins/base/android/ANPVideo.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* The Original Code is Android NPAPI support code
- *
- * The Initial Developer of the Original Code is
- * the Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <android/log.h>
-#include "ANPBase.h"
-#include "AndroidMediaLayer.h"
-#include "nsIPluginInstanceOwner.h"
-#include "nsPluginInstanceOwner.h"
-#include "nsNPAPIPluginInstance.h"
-#include "gfxRect.h"
-
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
-#define ASSIGN(obj, name)   (obj)->name = anp_video_##name
-
-using namespace mozilla;
-
-static AndroidMediaLayer* GetLayerForInstance(NPP instance) {
-  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  nsPluginInstanceOwner* owner;
-  if (NS_FAILED(pinst->GetOwner((nsIPluginInstanceOwner**)&owner))) {
-    return NULL;
-  }
-
-  return owner->Layer();
-}
-
-static void Invalidate(NPP instance) {
-  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  nsPluginInstanceOwner* owner;
-  if (NS_FAILED(pinst->GetOwner((nsIPluginInstanceOwner**)&owner)))
-    return;
-
-  owner->Invalidate();
-}
-
-static ANPNativeWindow anp_video_acquireNativeWindow(NPP instance) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return NULL;
-
-  return layer->RequestNativeWindowForVideo();
-}
-
-static void anp_video_setWindowDimensions(NPP instance, const ANPNativeWindow window,
-        const ANPRectF* dimensions) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return;
-
-  gfxRect rect(dimensions->left, dimensions->top,
-               dimensions->right - dimensions->left,
-               dimensions->bottom - dimensions->top);
-
-  layer->SetNativeWindowDimensions(window, rect);
-  Invalidate(instance);
-}
-
-
-static void anp_video_releaseNativeWindow(NPP instance, ANPNativeWindow window) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return;
-
-  layer->ReleaseNativeWindowForVideo(window);
-  Invalidate(instance);
-}
-
-static void anp_video_setFramerateCallback(NPP instance, const ANPNativeWindow window, ANPVideoFrameCallbackProc callback) {
-  // Bug 722682
-  NOT_IMPLEMENTED();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void InitVideoInterfaceV0(ANPVideoInterfaceV0* i) {
-    ASSIGN(i, acquireNativeWindow);
-    ASSIGN(i, setWindowDimensions);
-    ASSIGN(i, releaseNativeWindow);
-}
-
-void InitVideoInterfaceV1(ANPVideoInterfaceV1* i) {
-    ASSIGN(i, acquireNativeWindow);
-    ASSIGN(i, setWindowDimensions);
-    ASSIGN(i, releaseNativeWindow);
-    ASSIGN(i, setFramerateCallback);
-}
--- a/dom/plugins/base/android/ANPWindow.cpp
+++ b/dom/plugins/base/android/ANPWindow.cpp
@@ -34,26 +34,20 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "assert.h"
 #include "ANPBase.h"
 #include <android/log.h>
-#include "AndroidBridge.h"
-#include "nsNPAPIPluginInstance.h"
-#include "nsIPluginInstanceOwner.h"
-#include "nsPluginInstanceOwner.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_window_##name
 
-using namespace mozilla;
-
 void
 anp_window_setVisibleRects(NPP instance, const ANPRectI rects[], int32_t count)
 {
   NOT_IMPLEMENTED();
 }
 
 void
 anp_window_clearVisibleRects(NPP instance)
@@ -80,67 +74,18 @@ anp_window_exitFullScreen(NPP instance)
 }
 
 void
 anp_window_requestCenterFitZoom(NPP instance)
 {
   NOT_IMPLEMENTED();
 }
 
-ANPRectI
-anp_window_visibleRect(NPP instance)
-{
-  ANPRectI rect = { 0, 0, 0, 0 };
-
-  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  nsPluginInstanceOwner* owner;
-  if (NS_FAILED(pinst->GetOwner((nsIPluginInstanceOwner**)&owner))) {
-    return rect;
-  }
-
-  nsIntRect visibleRect = owner->GetVisibleRect();
-  rect.left = visibleRect.x;
-  rect.top = visibleRect.y;
-  rect.right = visibleRect.x + visibleRect.width;
-  rect.bottom = visibleRect.y + visibleRect.height;
-
-  return rect;
-}
-
-void anp_window_requestFullScreenOrientation(NPP instance, ANPScreenOrientation orientation)
-{
-  NOT_IMPLEMENTED();
-}
-
 void InitWindowInterface(ANPWindowInterfaceV0 *i) {
   _assert(i->inSize == sizeof(*i));
   ASSIGN(i, setVisibleRects);
   ASSIGN(i, clearVisibleRects);
   ASSIGN(i, showKeyboard);
   ASSIGN(i, requestFullScreen);
   ASSIGN(i, exitFullScreen);
   ASSIGN(i, requestCenterFitZoom);
 }
 
-void InitWindowInterfaceV1(ANPWindowInterfaceV1 *i) {
-  _assert(i->inSize == sizeof(*i));
-  ASSIGN(i, setVisibleRects);
-  ASSIGN(i, clearVisibleRects);
-  ASSIGN(i, showKeyboard);
-  ASSIGN(i, requestFullScreen);
-  ASSIGN(i, exitFullScreen);
-  ASSIGN(i, requestCenterFitZoom);
-  ASSIGN(i, visibleRect);
-}
-
-void InitWindowInterfaceV2(ANPWindowInterfaceV2 *i) {
-  _assert(i->inSize == sizeof(*i));
-  ASSIGN(i, setVisibleRects);
-  ASSIGN(i, clearVisibleRects);
-  ASSIGN(i, showKeyboard);
-  ASSIGN(i, requestFullScreen);
-  ASSIGN(i, exitFullScreen);
-  ASSIGN(i, requestCenterFitZoom);
-  ASSIGN(i, visibleRect);
-  ASSIGN(i, requestFullScreenOrientation);
-}
-
--- a/dom/plugins/base/android/Makefile.in
+++ b/dom/plugins/base/android/Makefile.in
@@ -58,26 +58,21 @@ EXPORTS = \
 
 CPPSRCS += ANPAudio.cpp    \
            ANPEvent.cpp    \
            ANPMatrix.cpp   \
            ANPSystem.cpp   \
            ANPWindow.cpp   \
            ANPBitmap.cpp   \
            ANPLog.cpp      \
-           ANPNativeWindow.cpp \
            ANPSurface.cpp  \
-           ANPVideo.cpp    \
-           ANPOpenGL.cpp   \
            $(NULL)
 
 LOCAL_INCLUDES += \
-  -I$(topsrcdir)/widget/android \
   -I$(topsrcdir)/dom/plugins/base \
   -I$(topsrcdir)/dom/plugins/base/android/include \
-  -I$(topsrcdir)/gfx/gl \
   $(MOZ_CAIRO_CFLAGS) \
   $(NULL)
 
 DEFINES += -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
 
 include $(topsrcdir)/config/rules.mk
 
--- a/dom/plugins/base/android/android_npapi.h
+++ b/dom/plugins/base/android/android_npapi.h
@@ -31,19 +31,18 @@
     To minimize what native libraries the plugin links against, some
     functionality is provided via function-ptrs (e.g. time, sound)
  */
 
 #ifndef android_npapi_H
 #define android_npapi_H
 
 #include <stdint.h>
+#include "npapi.h"
 #include <jni.h>
-#include "npapi.h"
-#include "GLDefs.h"
 
 ///////////////////////////////////////////////////////////////////////////////
 // General types
 
 enum ANPBitmapFormats {
     kUnknown_ANPBitmapFormat    = 0,
     kRGBA_8888_ANPBitmapFormat  = 1,
     kRGB_565_ANPBitmapFormat    = 2
@@ -116,26 +115,16 @@ typedef uint32_t ANPMatrixFlag;
 #define kPathInterfaceV0_ANPGetValue        ((NPNVariable)1005)
 #define kTypefaceInterfaceV0_ANPGetValue    ((NPNVariable)1006)
 #define kWindowInterfaceV0_ANPGetValue      ((NPNVariable)1007)
 #define kBitmapInterfaceV0_ANPGetValue      ((NPNVariable)1008)
 #define kSurfaceInterfaceV0_ANPGetValue     ((NPNVariable)1009)
 #define kSystemInterfaceV0_ANPGetValue      ((NPNVariable)1010)
 #define kEventInterfaceV0_ANPGetValue       ((NPNVariable)1011)
 
-#define kAudioTrackInterfaceV1_ANPGetValue  ((NPNVariable)1012)
-#define kOpenGLInterfaceV0_ANPGetValue      ((NPNVariable)1013)
-#define kWindowInterfaceV1_ANPGetValue      ((NPNVariable)1014)
-#define kVideoInterfaceV0_ANPGetValue       ((NPNVariable)1015)
-#define kSystemInterfaceV1_ANPGetValue      ((NPNVariable)1016)
-#define kSystemInterfaceV2_ANPGetValue      ((NPNVariable)1017)
-#define kWindowInterfaceV2_ANPGetValue      ((NPNVariable)1018)
-#define kNativeWindowInterfaceV0_ANPGetValue ((NPNVariable)1019)
-#define kVideoInterfaceV1_ANPGetValue       ((NPNVariable)1020)
-
 /** queries for the drawing models supported on this device.
 
     NPN_GetValue(inst, kSupportedDrawingModel_ANPGetValue, uint32_t* bits)
  */
 #define kSupportedDrawingModel_ANPGetValue  ((NPNVariable)2000)
 
 /** queries for the context (android.content.Context) of the plugin. If no
     instance is specified the application's context is returned. If the instance
@@ -186,17 +175,16 @@ enum ANPDrawingModels {
         ANPSurfaceInterface.  This interface can be used to manipulate Java
         objects that extend Surface.class by allowing them to access the
         surface's underlying bitmap in native code.  For instance, if a raster
         surface is used the plugin can lock, draw directly into the bitmap, and
         unlock the surface in native code without making JNI calls to the Java
         surface object.
      */
     kSurface_ANPDrawingModel = 1 << 1,
-    kOpenGL_ANPDrawingModel  = 1 << 2,
 };
 typedef int32_t ANPDrawingModel;
 
 /** Request to receive/disable events. If the pointer is NULL then all flags will
     be disabled. Otherwise, the event type will be enabled iff its corresponding
     bit in the EventFlags bit field is set.
 
     NPN_SetValue(inst, ANPAcceptEvents, (void*)EventFlags)
@@ -685,35 +673,16 @@ struct ANPWindowInterfaceV0 : ANPInterfa
         the plugin's full screen view will be discarded by the view system.
      */
     void    (*exitFullScreen)(NPP instance);
     /** Called when a plugin wishes to be zoomed and centered in the current view.
      */
     void    (*requestCenterFitZoom)(NPP instance);
 };
 
-struct ANPWindowInterfaceV1 : ANPWindowInterfaceV0 {
-    /** Returns a rectangle representing the visible area of the plugin on
-        screen. The coordinates are relative to the size of the plugin in the
-        document and therefore will never be negative or exceed the plugin's size.
-     */
-    ANPRectI (*visibleRect)(NPP instance);
-};
-
-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 {
     kUnknown_ANPSamleFormat     = 0,
     kPCM16Bit_ANPSampleFormat   = 1,
     kPCM8Bit_ANPSampleFormat    = 2
 };
 typedef int32_t ANPSampleFormat;
@@ -788,22 +757,16 @@ struct ANPAudioTrackInterfaceV0 : ANPInt
     void (*pause)(ANPAudioTrack*);
     void (*stop)(ANPAudioTrack*);
     /** Returns true if the track is not playing (e.g. pause or stop was called,
         or start was never called.
      */
     bool (*isStopped)(ANPAudioTrack*);
 };
 
-struct ANPAudioTrackInterfaceV1 : ANPAudioTrackInterfaceV0 {
-    /** Returns the track's latency in milliseconds. */
-    uint32_t (*trackLatency)(ANPAudioTrack*);
-};
-
-
 ///////////////////////////////////////////////////////////////////////////////
 // DEFINITION OF VALUES PASSED THROUGH NPP_HandleEvent
 
 enum ANPEventTypes {
     kNull_ANPEventType          = 0,
     kKey_ANPEventType           = 1,
     /** Mouse events are triggered by either clicking with the navigational pad
         or by tapping the touchscreen (if the kDown_ANPTouchAction is handled by
@@ -954,26 +917,22 @@ struct ANPEvent {
         } lifecycle;
         struct {
             ANPDrawingModel model;
             // relative to (0,0) in top-left of your plugin
             ANPRectI        clip;
             // use based on the value in model
             union {
                 ANPBitmap   bitmap;
-                struct {
-                    int32_t width;
-                    int32_t height;
-                } surfaceSize;
             } data;
         } draw;
+        int32_t     other[8];
     } data;
 };
 
-
 struct ANPEventInterfaceV0 : ANPInterface {
     /** Post a copy of the specified event to the plugin. The event will be
         delivered to the plugin in its main thread (the thread that receives
         other ANPEvents). If, after posting before delivery, the NPP instance
         is torn down, the event will be discarded.
      */
     void (*postEvent)(NPP inst, const ANPEvent* event);
 };
@@ -1012,122 +971,9 @@ struct ANPSurfaceInterfaceV0 : ANPInterf
   void (*unlock)(JNIEnv* env, jobject surface);
 };
 
 typedef int32_t   int32;
 typedef uint32_t uint32;
 typedef int16_t   int16;
 typedef uint16_t uint16;
 
-/**
- * TODO should we not use EGL and GL data types for ABI safety?
- */
-struct ANPTextureInfo {
-    GLuint      textureId;
-    uint32_t    width;
-    uint32_t    height;
-    GLenum      internalFormat;
-};
-
-typedef void* ANPEGLContext;
-
-struct ANPOpenGLInterfaceV0 : ANPInterface {
-    ANPEGLContext (*acquireContext)(NPP instance);
-
-    ANPTextureInfo (*lockTexture)(NPP instance);
-
-    void (*releaseTexture)(NPP instance, const ANPTextureInfo*);
-
-    /**
-     * Invert the contents of the plugin on the y-axis.
-     * default is to not be inverted (i.e. use OpenGL coordinates)
-     */
-    void (*invertPluginContent)(NPP instance, bool isContentInverted);
-};
-
-enum ANPPowerStates {
-    kDefault_ANPPowerState  = 0,
-    kScreenOn_ANPPowerState = 1
-};
-typedef int32_t ANPPowerState;
-
-struct ANPSystemInterfaceV1 : ANPSystemInterfaceV0 {
-    void (*setPowerState)(NPP instance, ANPPowerState powerState);
-};
-
-struct ANPSystemInterfaceV2 : ANPInterface {
-    /** Return the path name for the current Application's plugin data directory,
-        or NULL if not supported. This directory will change depending on whether
-        or not the plugin is found within an incognito tab.
-     */
-    const char* (*getApplicationDataDirectory)(NPP instance);
-
-    // redeclaration of existing features
-    jclass (*loadJavaClass)(NPP instance, const char* className);
-    void (*setPowerState)(NPP instance, ANPPowerState powerState);
-};
-
-typedef void* ANPNativeWindow;
-
-struct ANPVideoInterfaceV0 : ANPInterface {
-
-    /**
-     * Constructs a new native window to be used for rendering video content.
-     *
-     * Subsequent calls will produce new windows, but may also return NULL after
-     * n attempts if the browser has reached it's limit. Further, if the browser
-     * is unable to acquire the window quickly it may also return NULL in order
-     * to not prevent the plugin from executing. A subsequent call will then
-     * return the window if it is avaiable.
-     *
-     * NOTE: The hardware may fail if you try to decode more than the allowable
-     * number of videos supported on that device.
-     */
-    ANPNativeWindow (*acquireNativeWindow)(NPP instance);
-
-    /**
-     * Sets the rectangle that specifies where the video content is to be drawn.
-     * The dimensions are in document space. Further, if the rect is NULL the
-     * browser will not attempt to draw the window, therefore do not set the
-     * dimensions until you queue the first buffer in the window.
-     */
-    void (*setWindowDimensions)(NPP instance, const ANPNativeWindow window, const ANPRectF* dimensions);
-
-    /**
-     */
-    void (*releaseNativeWindow)(NPP instance, ANPNativeWindow window);
-};
-
-/** Called to notify the plugin that a video frame has been composited by the
-*  browser for display.  This will be called in a separate thread and as such
-*  you cannot call releaseNativeWindow from the callback.
-*
-*  The timestamp is in nanoseconds, and is monotonically increasing.
-*/
-typedef void (*ANPVideoFrameCallbackProc)(ANPNativeWindow* window, int64_t timestamp);
-
-struct ANPVideoInterfaceV1 : ANPVideoInterfaceV0 {
-    /** Set a callback to be notified when an ANPNativeWindow is composited by
-     *  the browser.
-     */
-    void (*setFramerateCallback)(NPP instance, const ANPNativeWindow window, ANPVideoFrameCallbackProc);
-};
-
-struct ANPNativeWindowInterfaceV0 : ANPInterface {
-    /**
-     * Constructs a new native window to be used for rendering plugin content.
-     *
-     * Subsequent calls will return the original constructed window. Further, if
-     * the browser is unable to acquire the window quickly it may return NULL in
-     * order to not block the plugin indefinitely. A subsequent call will then
-     * return the window if it is available.
-     */
-    ANPNativeWindow (*acquireNativeWindow)(NPP instance);
-
-    /**
-     * Invert the contents of the plugin on the y-axis.
-     * default is to not be inverted (e.g. use OpenGL coordinates)
-     */
-    void (*invertPluginContent)(NPP instance, bool isContentInverted);
-};
-
-
 #endif
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -127,20 +127,19 @@ using mozilla::plugins::PluginModulePare
 #include "mozilla/X11Util.h"
 #endif
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include <android/log.h>
-#include "android_npapi.h"
 #include "ANPBase.h"
 #include "AndroidBridge.h"
+#include <android/log.h>
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #endif
 
 using namespace mozilla;
 using namespace mozilla::plugins::parent;
 
 // We should make this const...
 static NPNetscapeFuncs sBrowserFuncs = {
@@ -2344,31 +2343,32 @@ NPError NP_CALLBACK
       ANPWindowInterfaceV0 *i = (ANPWindowInterfaceV0 *) result;
       InitWindowInterface(i);
       return NPERR_NO_ERROR;
     }
 
     case kAudioTrackInterfaceV0_ANPGetValue: {
       LOG("get audio interface");
       ANPAudioTrackInterfaceV0 *i = (ANPAudioTrackInterfaceV0 *) result;
-      InitAudioTrackInterfaceV0(i);
+      InitAudioTrackInterface(i);
       return NPERR_NO_ERROR;
     }
 
     case kEventInterfaceV0_ANPGetValue: {
       LOG("get event interface");
       ANPEventInterfaceV0 *i = (ANPEventInterfaceV0 *) result;
       InitEventInterface(i);
       return NPERR_NO_ERROR;
     }
 
     case kSystemInterfaceV0_ANPGetValue: {
       LOG("get system interface");
       ANPSystemInterfaceV0* i = reinterpret_cast<ANPSystemInterfaceV0*>(result);
       InitSystemInterface(i);
+      LOG("done system interface");
       return NPERR_NO_ERROR;
     }
 
     case kSurfaceInterfaceV0_ANPGetValue: {
       LOG("get surface interface");
       ANPSurfaceInterfaceV0 *i = (ANPSurfaceInterfaceV0 *) result;
       InitSurfaceInterface(i);
       return NPERR_NO_ERROR;
@@ -2390,81 +2390,16 @@ NPError NP_CALLBACK
       jclass cls     = env->FindClass("org/mozilla/gecko/GeckoApp");
       jfieldID field = env->GetStaticFieldID(cls, "mAppContext",
                                              "Lorg/mozilla/gecko/GeckoApp;");
       jobject ret = env->GetStaticObjectField(cls, field);
       int32_t* i  = reinterpret_cast<int32_t*>(result);
       *i = reinterpret_cast<int32_t>(ret);
       return NPERR_NO_ERROR;
     }
-
-    case kAudioTrackInterfaceV1_ANPGetValue: {
-      LOG("get audio interface v1");
-      ANPAudioTrackInterfaceV1 *i = (ANPAudioTrackInterfaceV1 *) result;
-      InitAudioTrackInterfaceV1(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kNativeWindowInterfaceV0_ANPGetValue: {
-      LOG("get native window interface v0");
-      ANPNativeWindowInterfaceV0* i = (ANPNativeWindowInterfaceV0 *) result;
-      InitNativeWindowInterface(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kOpenGLInterfaceV0_ANPGetValue: {
-      LOG("get openGL interface");
-      ANPOpenGLInterfaceV0 *i = (ANPOpenGLInterfaceV0*) result;
-      InitOpenGLInterface(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kWindowInterfaceV1_ANPGetValue: {
-      LOG("get Window interface V1");
-      ANPWindowInterfaceV1 *i = (ANPWindowInterfaceV1 *) result;
-      InitWindowInterfaceV1(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kWindowInterfaceV2_ANPGetValue: {
-      LOG("get Window interface V2");
-      ANPWindowInterfaceV2 *i = (ANPWindowInterfaceV2 *) result;
-      InitWindowInterfaceV2(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kVideoInterfaceV0_ANPGetValue: {
-      LOG("get video interface");
-      ANPVideoInterfaceV0 *i = (ANPVideoInterfaceV0*) result;
-      InitVideoInterfaceV0(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kVideoInterfaceV1_ANPGetValue: {
-      LOG("get video interface");
-      ANPVideoInterfaceV1 *i = (ANPVideoInterfaceV1*) result;
-      InitVideoInterfaceV1(i);
-      return NPERR_NO_ERROR;
-    }
-
-
-    case kSystemInterfaceV1_ANPGetValue: {
-      LOG("get system interface v1");
-      ANPSystemInterfaceV1* i = reinterpret_cast<ANPSystemInterfaceV1*>(result);
-      InitSystemInterfaceV1(i);
-      return NPERR_NO_ERROR;
-    }
-
-    case kSystemInterfaceV2_ANPGetValue: {
-      LOG("get system interface v2");
-      ANPSystemInterfaceV2* i = reinterpret_cast<ANPSystemInterfaceV2*>(result);
-      InitSystemInterfaceV2(i);
-      return NPERR_NO_ERROR;
-    }
-
 #endif
 
   // we no longer hand out any XPCOM objects
   case NPNVDOMElement:
     // fall through
   case NPNVDOMWindow:
     // fall through
   case NPNVserviceManager:
--- a/dom/plugins/base/nsNPAPIPluginInstance.h
+++ b/dom/plugins/base/nsNPAPIPluginInstance.h
@@ -147,18 +147,16 @@ public:
 #ifdef XP_MACOSX
   void SetDrawingModel(NPDrawingModel aModel);
   void SetEventModel(NPEventModel aModel);
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
   PRUint32 GetANPDrawingModel() { return mANPDrawingModel; }
   void SetANPDrawingModel(PRUint32 aModel);
-
-  // This stuff is for kSurface_ANPDrawingModel
   void* GetJavaSurface();
   void SetJavaSurface(void* aSurface);
   void RequestJavaSurface();
 #endif
 
   nsresult NewStreamListener(const char* aURL, void* notifyData,
                              nsIPluginStreamListener** listener);
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -115,17 +115,16 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
 #include <gtk/gtk.h>
 #include "gfxXlibNativeRenderer.h"
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "ANPBase.h"
 #include "android_npapi.h"
 #include "AndroidBridge.h"
-#include "AndroidMediaLayer.h"
 using namespace mozilla::dom;
 
 #include <android/log.h>
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #endif
 
 using namespace mozilla;
 
@@ -327,19 +326,18 @@ nsPluginInstanceOwner::nsPluginInstanceO
 #else
   mEventModel = NPEventModelCocoa;
 #endif
 #endif
 
   mWaitingForPaint = false;
 
 #ifdef MOZ_WIDGET_ANDROID
-  mOnScreen = false;
-  mInverted = false;
-  mLayer = new AndroidMediaLayer();
+  mPluginViewAdded = false;
+  mLastPluginRect = gfxRect(0, 0, 0, 0);
 #endif
 }
 
 nsPluginInstanceOwner::~nsPluginInstanceOwner()
 {
   PRInt32 cnt;
 
   if (mWaitingForPaint) {
@@ -385,23 +383,16 @@ nsPluginInstanceOwner::~nsPluginInstance
   // clean up plugin native window object
   nsCOMPtr<nsIPluginHost> pluginHostCOM = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
   nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
   if (pluginHost) {
     pluginHost->DeletePluginNativeWindow(mPluginWindow);
     mPluginWindow = nsnull;
   }
 
-#ifdef MOZ_WIDGET_ANDROID
-  if (mLayer) {
-    delete mLayer;
-    mLayer = nsnull;
-  }
-#endif
-
   if (mInstance) {
     mInstance->InvalidateOwner();
   }
 }
 
 NS_IMPL_ISUPPORTS3(nsPluginInstanceOwner,
                    nsIPluginInstanceOwner,
                    nsIPluginTagInfo,
@@ -1670,61 +1661,29 @@ void nsPluginInstanceOwner::ScrollPositi
       }
       pluginWidget->EndDrawPlugin();
     }
   }
 #endif
 }
 
 #ifdef MOZ_WIDGET_ANDROID
-
-void nsPluginInstanceOwner::SendSize(int width, int height)
-{
-  if (!mInstance)
-    return;
-
-  PRInt32 model = mInstance->GetANPDrawingModel();
-
-  if (model != kOpenGL_ANPDrawingModel)
-    return;
-
-  ANPEvent event;
-  event.inSize = sizeof(ANPEvent);
-  event.eventType = kDraw_ANPEventType;
-  event.data.draw.model = kOpenGL_ANPDrawingModel;
-  event.data.draw.data.surfaceSize.width = width;
-  event.data.draw.data.surfaceSize.height = height;
-
-  mInstance->HandleEvent(&event, nsnull);
-}
-
-void nsPluginInstanceOwner::SendOnScreenEvent(bool onScreen)
-{
-  if (!mInstance)
-    return;
-
-  if ((onScreen && !mOnScreen) || (!onScreen && mOnScreen)) {
-    ANPEvent event;
-    event.inSize = sizeof(ANPEvent);
-    event.eventType = kLifecycle_ANPEventType;
-    event.data.lifecycle.action = onScreen ? kOnScreen_ANPLifecycleAction : kOffScreen_ANPLifecycleAction;
-    mInstance->HandleEvent(&event, nsnull);
-
-    mOnScreen = onScreen;
-  }
-}
-
 bool nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect)
 {
   void* javaSurface = mInstance->GetJavaSurface();
   if (!javaSurface) {
     mInstance->RequestJavaSurface();
     return false;
   }
 
+  if (aRect.IsEqualEdges(mLastPluginRect)) {
+    // Already added and in position, no work to do
+    return true;
+  }
+
   JNIEnv* env = GetJNIForThread();
   if (!env)
     return false;
 
   AndroidBridge::AutoLocalJNIFrame frame(env, 1);
 
   jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
 
@@ -1757,52 +1716,58 @@ bool nsPluginInstanceOwner::AddPluginVie
                             method,
                             javaSurface,
                             aRect.x,
                             aRect.y,
                             aRect.width,
                             aRect.height);
 #endif
 
-  SendOnScreenEvent(true);
+  if (!mPluginViewAdded) {
+    ANPEvent event;
+    event.inSize = sizeof(ANPEvent);
+    event.eventType = kLifecycle_ANPEventType;
+    event.data.lifecycle.action = kOnScreen_ANPLifecycleAction;
+    mInstance->HandleEvent(&event, nsnull);
+
+    mPluginViewAdded = true;
+  }
 
   return true;
 }
 
 void nsPluginInstanceOwner::RemovePluginView()
 {
-  if (!mInstance || !mObjectFrame | !mOnScreen)
+  if (!mInstance || !mObjectFrame | !mPluginViewAdded)
     return;
 
+  mPluginViewAdded = false;
+
   void* surface = mInstance->GetJavaSurface();
   if (!surface)
     return;
 
   JNIEnv* env = GetJNIForThread();
   if (!env)
     return;
 
   AndroidBridge::AutoLocalJNIFrame frame(env, 1);
 
   jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
   jmethodID method = env->GetStaticMethodID(cls,
                                             "removePluginView",
                                             "(Landroid/view/View;)V");
   env->CallStaticVoidMethod(cls, method, surface);
-  SendOnScreenEvent(false);
+
+    ANPEvent event;
+    event.inSize = sizeof(ANPEvent);
+    event.eventType = kLifecycle_ANPEventType;
+    event.data.lifecycle.action = kOffScreen_ANPLifecycleAction;
+    mInstance->HandleEvent(&event, nsnull);
 }
-
-void nsPluginInstanceOwner::Invalidate() {
-  NPRect rect;
-  rect.left = rect.top = 0;
-  rect.right = mPluginWindow->width;
-  rect.bottom = mPluginWindow->height;
-  InvalidateRect(&rect);
-}
-
 #endif
 
 nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
 {
 #ifdef MOZ_WIDGET_ANDROID
   {
     ANPEvent event;
     event.inSize = sizeof(ANPEvent);
@@ -2817,25 +2782,17 @@ nsPluginInstanceOwner::PrepareToStop(boo
     // parent.
     mWidget->SetParent(nsnull);
 
     mDestroyWidget = true;
   }
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-
-  PRInt32 model = mInstance->GetANPDrawingModel();
-  if (model == kSurface_ANPDrawingModel) {
-    RemovePluginView();
-  } else if (model == kOpenGL_ANPDrawingModel && mLayer) {
-    delete mLayer;
-    mLayer = nsnull;
-  }
-
+  RemovePluginView();
 #endif
 
   // Unregister scroll position listeners
   for (nsIFrame* f = mObjectFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
     nsIScrollableFrame* sf = do_QueryFrame(f);
     if (sf) {
       sf->RemoveScrollPositionListener(this);
     }
@@ -2937,31 +2894,25 @@ void nsPluginInstanceOwner::Paint(gfxCon
 {
   if (!mInstance || !mObjectFrame)
     return;
 
   PRInt32 model = mInstance->GetANPDrawingModel();
 
   if (model == kSurface_ANPDrawingModel) {
     if (!AddPluginView(aFrameRect)) {
-      Invalidate();
+      NPRect rect;
+      rect.left = rect.top = 0;
+      rect.right = aFrameRect.width;
+      rect.bottom = aFrameRect.height;
+      InvalidateRect(&rect);
     }
     return;
   }
 
-  if (model == kOpenGL_ANPDrawingModel) {
-    // FIXME: this is gross
-    float zoomLevel = aFrameRect.width / (float)mPluginWindow->width;
-    mLayer->UpdatePosition(aFrameRect, zoomLevel);
-
-    SendOnScreenEvent(true);
-    SendSize((int)aFrameRect.width, (int)aFrameRect.height);
-    return;
-  }
-
   if (model != kBitmap_ANPDrawingModel)
     return;
 
 #ifdef ANP_BITMAP_DRAWING_MODEL
   static nsRefPtr<gfxImageSurface> pluginSurface;
 
   if (pluginSurface == nsnull ||
       aFrameRect.width  != pluginSurface->Width() ||
@@ -3642,26 +3593,18 @@ void nsPluginInstanceOwner::UpdateWindow
   mPluginWindow->clipRect.top = 0;
 
   if (mPluginWindowVisible && mPluginDocumentActiveState) {
     mPluginWindow->clipRect.right = mPluginWindow->width;
     mPluginWindow->clipRect.bottom = mPluginWindow->height;
   } else {
     mPluginWindow->clipRect.right = 0;
     mPluginWindow->clipRect.bottom = 0;
-#if 0 //MOZ_WIDGET_ANDROID
-    if (mInstance) {
-      PRInt32 model = mInstance->GetANPDrawingModel();
-
-      if (model == kSurface_ANPDrawingModel) {
-        RemovePluginView();
-      } else if (model == kOpenGL_ANPDrawingModel) {
-        HidePluginLayer();
-      }
-    }
+#ifdef MOZ_WIDGET_ANDROID
+    RemovePluginView();
 #endif
   }
 
   if (!aSetWindow)
     return;
 
   if (mPluginWindow->x               != oldWindow.x               ||
       mPluginWindow->y               != oldWindow.y               ||
--- a/dom/plugins/base/nsPluginInstanceOwner.h
+++ b/dom/plugins/base/nsPluginInstanceOwner.h
@@ -89,22 +89,16 @@ class gfxXlibSurface;
 #endif
 
 #ifdef XP_OS2
 #define INCL_PM
 #define INCL_GPI
 #include <os2.h>
 #endif
 
-#ifdef MOZ_WIDGET_ANDROID
-namespace mozilla {
-  class AndroidMediaLayer;
-}
-#endif
-
 // X.h defines KeyPress
 #ifdef KeyPress
 #undef KeyPress
 #endif
 
 class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
                               public nsIPluginTagInfo,
                               public nsIDOMEventListener,
@@ -298,60 +292,33 @@ public:
   // Methods to update the background image we send to async plugins.
   // The eventual target of these operations is PluginInstanceParent,
   // but it takes several hops to get there.
   void SetBackgroundUnknown();
   already_AddRefed<gfxContext> BeginUpdateBackground(const nsIntRect& aRect);
   void EndUpdateBackground(gfxContext* aContext, const nsIntRect& aRect);
   
   bool UseAsyncRendering();
-
-#ifdef ANDROID
-  nsIntRect GetVisibleRect() {
-    return nsIntRect(0, 0, mPluginWindow->width, mPluginWindow->height);
-  }
-
-  void SetInverted(bool aInverted) {
-    mInverted = aInverted;
-  }
-
-  bool Inverted() {
-    return mInverted;
-  }
-
-  mozilla::AndroidMediaLayer* Layer() {
-    return mLayer;
-  }
-
-  void Invalidate();
-#endif
   
 private:
   
   // return FALSE if LayerSurface dirty (newly created and don't have valid plugin content yet)
   bool IsUpToDate()
   {
     nsIntSize size;
     return NS_SUCCEEDED(mInstance->GetImageSize(&size)) &&
     size == nsIntSize(mPluginWindow->width, mPluginWindow->height);
   }
   
   void FixUpURLS(const nsString &name, nsAString &value);
 #ifdef ANDROID
-  void SendSize(int width, int height);
-  void SendOnScreenEvent(bool onScreen);
-
   bool AddPluginView(const gfxRect& aRect);
   void RemovePluginView();
-
-  bool mOnScreen;
-  bool mInverted;
-
-  // For kOpenGL_ANPDrawingModel
-  mozilla::AndroidMediaLayer *mLayer;
+  bool mPluginViewAdded;
+  gfxRect mLastPluginRect;
 #endif 
  
   nsPluginNativeWindow       *mPluginWindow;
   nsRefPtr<nsNPAPIPluginInstance> mInstance;
   nsObjectFrame              *mObjectFrame; // owns nsPluginInstanceOwner
   nsCOMPtr<nsIContent>        mContent;
   nsCString                   mDocumentBase;
   char                       *mTagText;
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -1724,16 +1724,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
 
     gfxMatrix matrix2d;
     if (!matrix3d.Is2D(&matrix2d))
       return;
 
     // The matrix includes the frame's position, so we need to transform
     // from 0,0 to get the correct coordinates.
     frameGfxRect.MoveTo(0, 0);
+    matrix2d.NudgeToIntegers();
 
     mInstanceOwner->Paint(ctx, matrix2d.Transform(frameGfxRect), dirtyGfxRect);
     return;
   }
 #endif
 
   // Screen painting code
 #if defined(XP_MACOSX)
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -35,26 +35,23 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 package org.mozilla.gecko;
 
-import org.mozilla.gecko.gfx.BufferedCairoImage;
 import org.mozilla.gecko.gfx.FloatSize;
 import org.mozilla.gecko.gfx.GeckoSoftwareLayerClient;
 import org.mozilla.gecko.gfx.IntSize;
-import org.mozilla.gecko.gfx.Layer;
 import org.mozilla.gecko.gfx.LayerController;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.gfx.PlaceholderLayerClient;
 import org.mozilla.gecko.gfx.RectUtils;
-import org.mozilla.gecko.gfx.SurfaceTextureLayer;
 import org.mozilla.gecko.gfx.ViewportMetrics;
 import org.mozilla.gecko.Tab.HistoryEntry;
 
 import java.io.*;
 import java.util.*;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import java.util.zip.*;
@@ -214,19 +211,18 @@ abstract public class GeckoApp
 
     private static final String PLUGIN_SYSTEM_LIB = "/system/lib/plugins/";
 
     private static final String PLUGIN_TYPE = "type";
     private static final String TYPE_NATIVE = "native";
     public ArrayList<PackageInfo> mPackageInfoCache = new ArrayList<PackageInfo>();
 
     String[] getPluginDirectories() {
-        // we don't support Honeycomb
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB &&
-            Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+        // we don't support Honeycomb and later
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
             return new String[0];
 
         Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - start of getPluginDirectories");
 
         ArrayList<String> directories = new ArrayList<String>();
         PackageManager pm = mAppContext.getPackageManager();
         List<ResolveInfo> plugins = pm.queryIntentServices(new Intent(PLUGIN_ACTION),
                 PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
@@ -740,17 +736,17 @@ abstract public class GeckoApp
                     mBrowserToolbar.setTitle(uri);
                     mBrowserToolbar.setFavicon(null);
                     mBrowserToolbar.setSecurityMode("unknown");
                     mDoorHangerPopup.updatePopup();
                     mBrowserToolbar.setShadowVisibility(!(tab.getURL().startsWith("about:")));
                     mLayerController.setWaitForTouchListeners(false);
 
                     if (tab != null)
-                        hidePlugins(tab, true);
+                        hidePluginViews(tab);
                 }
             }
         });
     }
 
     void handleSecurityChange(final int tabId, final String mode) {
         final Tab tab = Tabs.getInstance().getTab(tabId);
         if (tab == null)
@@ -1364,28 +1360,29 @@ abstract public class GeckoApp
 
     void addPluginView(final View view,
                        final int x, final int y,
                        final int w, final int h,
                        final String metadata) {
         mMainHandler.post(new Runnable() { 
             public void run() {
                 PluginLayoutParams lp;
+                JSONObject viewportObject;
+                ViewportMetrics pluginViewport;
 
                 Tabs tabs = Tabs.getInstance();
                 Tab tab = tabs.getSelectedTab();
 
                 if (tab == null)
                     return;
 
                 ViewportMetrics targetViewport = mLayerController.getViewportMetrics();
-                ViewportMetrics pluginViewport;
                 
                 try {
-                    JSONObject viewportObject = new JSONObject(metadata);
+                    viewportObject = new JSONObject(metadata);
                     pluginViewport = new ViewportMetrics(viewportObject);
                 } catch (JSONException e) {
                     Log.e(LOGTAG, "Bad viewport metadata: ", e);
                     return;
                 }
 
                 if (mPluginContainer.indexOfChild(view) == -1) {
                     lp = new PluginLayoutParams(x, y, w, h, pluginViewport);
@@ -1430,138 +1427,38 @@ abstract public class GeckoApp
                         return;
 
                     tab.removePluginView(view);
                 } catch (Exception e) {}
             }
         });
     }
 
-    public Surface createSurface() {
-        Tabs tabs = Tabs.getInstance();
-        Tab tab = tabs.getSelectedTab();
-        if (tab == null)
-            return null;
-
-        SurfaceTextureLayer layer = SurfaceTextureLayer.create();
-        if (layer == null)
-            return null;
-
-        Surface surface = layer.getSurface();
-        tab.addPluginLayer(surface, layer);
-        return surface;
-    }
-
-    public void destroySurface(Surface surface) {
-        Tabs tabs = Tabs.getInstance();
-        Tab tab = tabs.getSelectedTab();
-        if (tab == null)
-            return;
-
-        tab.removePluginLayer(surface);
-    }
-
-    public void showSurface(Surface surface, int x, int y,
-                            int w, int h, boolean inverted, boolean blend,
-                            String metadata) {
-        Tabs tabs = Tabs.getInstance();
-        Tab tab = tabs.getSelectedTab();
-        if (tab == null)
-            return;
-
-        ViewportMetrics metrics;
-        try {
-            metrics = new ViewportMetrics(new JSONObject(metadata));
-        } catch (JSONException e) {
-            Log.e(LOGTAG, "Bad viewport metadata: ", e);
-            return;
-        }
-
-        PointF origin = metrics.getDisplayportOrigin();
-        x = x + (int)origin.x;
-        y = y + (int)origin.y;
-
-        LayerView layerView = mLayerController.getView();
-        SurfaceTextureLayer layer = (SurfaceTextureLayer)tab.getPluginLayer(surface);
-        if (layer == null)
-            return;
-
-        layer.update(new Point(x, y), new IntSize(w, h), metrics.getZoomFactor(), inverted, blend);
-        layerView.addLayer(layer);
-
-        // FIXME: shouldn't be necessary, layer will request
-        // one when it gets first frame
-        layerView.requestRender();
-    }
-    
-    private void hidePluginLayer(Layer layer) {
-        LayerView layerView = mLayerController.getView();
-        layerView.removeLayer(layer);
-        layerView.requestRender();
-    }
-
-    private void showPluginLayer(Layer layer) {
-        LayerView layerView = mLayerController.getView();
-        layerView.addLayer(layer);
-        layerView.requestRender();
-    }
-
-    public void hideSurface(Surface surface) {
-        Tabs tabs = Tabs.getInstance();
-        Tab tab = tabs.getSelectedTab();
-        if (tab == null)
-            return;
-
-        Layer layer = tab.getPluginLayer(surface);
-        if (layer == null)
-            return;
-
-        hidePluginLayer(layer);
-    }
-
-    public void requestRender() {
-        mLayerController.getView().requestRender();
-    }
-
-    public void hidePlugins(boolean hideLayers) {
+    public void hidePluginViews() {
         Tabs tabs = Tabs.getInstance();
         Tab tab = tabs.getSelectedTab();
 
         if (tab == null)
             return;
 
-        hidePlugins(tab, hideLayers);
+        hidePluginViews(tab);
     }
 
-    public void hidePlugins(Tab tab, boolean hideLayers) {
+    public void hidePluginViews(Tab tab) {
         for (View view : tab.getPluginViews()) {
             view.setVisibility(View.GONE);
         }
-
-        if (hideLayers) {
-            for (Layer layer : tab.getPluginLayers()) {
-                hidePluginLayer(layer);
-            }
-
-            requestRender();
-        }
     }
 
-    public void showPlugins() {
+    public void showPluginViews() {
         repositionPluginViews(true);
     }
 
-    public void showPlugins(Tab tab) {
+    public void showPluginViews(Tab tab) {
         repositionPluginViews(tab, true);
-
-        for (Layer layer : tab.getPluginLayers()) {
-            showPluginLayer(layer);
-        }
-
-        requestRender();
     }
 
     public void repositionPluginViews(boolean setVisible) {
         Tabs tabs = Tabs.getInstance();
         Tab tab = tabs.getSelectedTab();
 
         if (tab == null)
             return;
@@ -2708,20 +2605,18 @@ class PluginLayoutParams extends Absolut
             } else {
                 width = (int)(((float)width/(float)height) * MAX_DIMENSION);
                 height = MAX_DIMENSION;
             }
         }
     }
 
     public void reset(int aX, int aY, int aWidth, int aHeight, ViewportMetrics aViewport) {
-        PointF origin = aViewport.getDisplayportOrigin();
-
-        x = mOriginalX = aX + (int)origin.x;
-        y = mOriginalY = aY + (int)origin.y;
+        x = mOriginalX = aX;
+        y = mOriginalY = aY;
         width = mOriginalWidth = aWidth;
         height = mOriginalHeight = aHeight;
         mOriginalViewport = aViewport;
         mLastResolution = aViewport.getZoomFactor();
 
         clampToMaxSize();
     }
 
@@ -2742,13 +2637,9 @@ class PluginLayoutParams extends Absolut
         PointF targetOrigin = viewport.getDisplayportOrigin();
         PointF originalOrigin = mOriginalViewport.getDisplayportOrigin();
 
         Point offset = new Point(Math.round(originalOrigin.x - targetOrigin.x),
                                  Math.round(originalOrigin.y - targetOrigin.y));
 
         reposition(offset, viewport.getZoomFactor());
     }
-
-    public float getLastResolution() {
-        return mLastResolution;
-    }
 }
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -221,17 +221,16 @@ public class GeckoAppShell
     // Get a Handler for a looper thread, or create one if it doesn't exist yet
     public static Handler getHandler() {
         if (sHandler == null) {
             LooperThread lt = new LooperThread();
             lt.start();
             try {
                 sHandler = lt.mHandlerQueue.take();
             } catch (InterruptedException ie) {}
-
         }
         return sHandler;
     }
 
     public static File getCacheDir() {
         if (sCacheFile == null)
             sCacheFile = GeckoApp.mAppContext.getCacheDir();
         return sCacheFile;
@@ -563,17 +562,17 @@ public class GeckoAppShell
     // Block the current thread until the Gecko event loop is caught up
     synchronized public static void geckoEventSync() {
         sGeckoPendingAcks = new CountDownLatch(1);
         GeckoAppShell.sendEventToGecko(
             new GeckoEvent(GeckoEvent.GECKO_EVENT_SYNC));
         while (sGeckoPendingAcks.getCount() != 0) {
             try {
                 sGeckoPendingAcks.await();
-            } catch(InterruptedException e) {}
+            } catch (InterruptedException e) {}
         }
         sGeckoPendingAcks = null;
     }
 
     // Signal the Java thread that it's time to wake up
     public static void acknowledgeEventSync() {
         CountDownLatch tmp = sGeckoPendingAcks;
         if (tmp != null)
@@ -1387,50 +1386,20 @@ public class GeckoAppShell
                                      int w, int h,
                                      String metadata)
     {
         Log.i(LOGTAG, "addPluginView:" + view + " @ x:" + x + " y:" + y + " w:" + w + " h:" + h + " metadata: " + metadata);
         GeckoApp.mAppContext.addPluginView(view, x, y, w, h, metadata);
     }
 
     public static void removePluginView(View view) {
-        Log.i(LOGTAG, "removePluginView:" + view);
+        Log.i(LOGTAG, "remove view:" + view);
         GeckoApp.mAppContext.removePluginView(view);
     }
 
-    public static Surface createSurface() {
-        Log.i(LOGTAG, "createSurface");
-        return GeckoApp.mAppContext.createSurface();
-    }
-
-    public static void showSurface(Surface surface,
-                                   int x, int y,
-                                   int w, int h,
-                                   boolean inverted,
-                                   boolean blend,
-                                   String metadata)
-    {
-        Log.i(LOGTAG, "showSurface:" + surface + " @ x:" + x + " y:" + y + " w:" + w + " h:" + h + " inverted: " + inverted + " blend: " + blend + " metadata: " + metadata);
-        try {
-            GeckoApp.mAppContext.showSurface(surface, x, y, w, h, inverted, blend, metadata);
-        } catch (Exception e) {
-            Log.i(LOGTAG, "Error in showSurface:", e);
-        }
-    }
-
-    public static void hideSurface(Surface surface) {
-        Log.i(LOGTAG, "hideSurface:" + surface);
-        GeckoApp.mAppContext.hideSurface(surface);
-    }
-
-    public static void destroySurface(Surface surface) {
-        Log.i(LOGTAG, "destroySurface:" + surface);
-        GeckoApp.mAppContext.destroySurface(surface);
-    }
-
     public static Class<?> loadPluginClass(String className, String libName) {
         Log.i(LOGTAG, "in loadPluginClass... attempting to access className, then libName.....");
         Log.i(LOGTAG, "className: " + className);
         Log.i(LOGTAG, "libName: " + libName);
 
         try {
             String packageName = GeckoApp.mAppContext.getPluginPackage(libName);
             Log.i(LOGTAG, "load \"" + className + "\" from \"" + packageName + 
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -119,19 +119,17 @@ FENNEC_JAVA_FILES = \
   gfx/MultiTileLayer.java \
   gfx/NinePatchTileLayer.java \
   gfx/PanningPerfAPI.java \
   gfx/PlaceholderLayerClient.java \
   gfx/PointUtils.java \
   gfx/RectUtils.java \
   gfx/ScrollbarLayer.java \
   gfx/SingleTileLayer.java \
-  gfx/SurfaceTextureLayer.java \
   gfx/TextLayer.java \
-  gfx/TextureGenerator.java \
   gfx/TextureReaper.java \
   gfx/TileLayer.java \
   gfx/ViewportMetrics.java \
   gfx/WidgetTileLayer.java \
   ui/Axis.java \
   ui/PanZoomController.java \
   ui/SimpleScaleGestureDetector.java \
   ui/SubdocumentScrollHelper.java \
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -39,26 +39,23 @@ package org.mozilla.gecko;
 
 import android.content.ContentResolver;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.AsyncTask;
 import android.util.DisplayMetrics;
 import android.util.Log;
-import android.view.Surface;
 import android.view.View;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.gecko.db.BrowserDB;
-import org.mozilla.gecko.gfx.Layer;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 
 public final class Tab {
     private static final String LOGTAG = "GeckoTab";
     private static final int kThumbnailWidth = 136;
     private static final int kThumbnailHeight = 77;
 
@@ -81,17 +78,16 @@ public final class Tab {
     private boolean mBookmark;
     private HashMap<String, DoorHanger> mDoorHangers;
     private long mFaviconLoadId;
     private CheckBookmarkTask mCheckBookmarkTask;
     private String mDocumentURI;
     private String mContentType;
     private boolean mHasTouchListeners;
     private ArrayList<View> mPluginViews;
-    private HashMap<Surface, Layer> mPluginLayers;
 
     public static final class HistoryEntry {
         public String mUri;         // must never be null
         public String mTitle;       // must never be null
 
         public HistoryEntry(String uri, String title) {
             mUri = uri;
             mTitle = title;
@@ -115,17 +111,16 @@ public final class Tab {
         mHistory = new ArrayList<HistoryEntry>();
         mHistoryIndex = -1;
         mBookmark = false;
         mDoorHangers = new HashMap<String, DoorHanger>();
         mFaviconLoadId = 0;
         mDocumentURI = "";
         mContentType = "";
         mPluginViews = new ArrayList<View>();
-        mPluginLayers = new HashMap<Surface, Layer>();
     }
 
     public int getId() {
         return mId;
     }
 
     public int getParentId() {
         return mParentId;
@@ -558,25 +553,9 @@ public final class Tab {
 
     public void removePluginView(View view) {
         mPluginViews.remove(view);
     }
 
     public View[] getPluginViews() {
         return mPluginViews.toArray(new View[mPluginViews.size()]);
     }
-
-    public void addPluginLayer(Surface surface, Layer layer) {
-        mPluginLayers.put(surface, layer);
-    }
-
-    public Layer getPluginLayer(Surface surface) {
-        return mPluginLayers.get(surface);
-    }
-
-    public Collection<Layer> getPluginLayers() {
-        return mPluginLayers.values();
-    }
-
-    public Layer removePluginLayer(Surface surface) {
-        return mPluginLayers.remove(surface);
-    }
 }
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -131,17 +131,17 @@ public class Tabs implements GeckoEventL
                     GeckoApp.mBrowserToolbar.setTitle(tab.getDisplayTitle());
                     GeckoApp.mBrowserToolbar.setFavicon(tab.getFavicon());
                     GeckoApp.mBrowserToolbar.setSecurityMode(tab.getSecurityMode());
                     GeckoApp.mBrowserToolbar.setProgressVisibility(tab.isLoading());
                     GeckoApp.mDoorHangerPopup.updatePopup();
                     GeckoApp.mBrowserToolbar.setShadowVisibility(!(tab.getURL().startsWith("about:")));
 
                     if (oldTab != null)
-                        GeckoApp.mAppContext.hidePlugins(oldTab, true);
+                        GeckoApp.mAppContext.hidePluginViews(oldTab);
                 }
             }
         });
 
         // Pass a message to Gecko to update tab state in BrowserApp
         GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Selected", String.valueOf(tab.getId())));
         return selectedTab = tab;
     }
@@ -195,17 +195,17 @@ public class Tabs implements GeckoEventL
         tab.removeAllDoorHangers();
 
         final Tab closedTab = tab;
         GeckoApp.mAppContext.mMainHandler.post(new Runnable() { 
             public void run() {
                 GeckoApp.mAppContext.onTabsChanged(closedTab);
                 GeckoApp.mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
                 GeckoApp.mDoorHangerPopup.updatePopup();
-                GeckoApp.mAppContext.hidePlugins(closedTab, true);
+                GeckoApp.mAppContext.hidePluginViews(closedTab);
             }
         });
 
         // Pass a message to Gecko to update tab state in BrowserApp
         GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Closed", String.valueOf(tabId)));
     }
 
     /** Return the tab that will be selected by default after this one is closed */
--- a/mobile/android/base/gfx/Layer.java
+++ b/mobile/android/base/gfx/Layer.java
@@ -44,23 +44,22 @@ import android.graphics.RectF;
 import android.util.Log;
 import java.util.concurrent.locks.ReentrantLock;
 import javax.microedition.khronos.opengles.GL10;
 import org.mozilla.gecko.FloatUtils;
 
 public abstract class Layer {
     private final ReentrantLock mTransactionLock;
     private boolean mInTransaction;
+    private Point mOrigin;
     private Point mNewOrigin;
+    private float mResolution;
     private float mNewResolution;
     private LayerView mView;
 
-    protected Point mOrigin;
-    protected float mResolution;
-
     public Layer() {
         mTransactionLock = new ReentrantLock();
         mOrigin = new Point(0, 0);
         mResolution = 1.0f;
     }
 
     /**
      * Updates the layer. This returns false if there is still work to be done
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -41,34 +41,32 @@ package org.mozilla.gecko.gfx;
 import org.mozilla.gecko.gfx.BufferedCairoImage;
 import org.mozilla.gecko.gfx.IntSize;
 import org.mozilla.gecko.gfx.Layer.RenderContext;
 import org.mozilla.gecko.gfx.LayerController;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.gfx.NinePatchTileLayer;
 import org.mozilla.gecko.gfx.SingleTileLayer;
 import org.mozilla.gecko.gfx.TextureReaper;
-import org.mozilla.gecko.gfx.TextureGenerator;
 import org.mozilla.gecko.gfx.TextLayer;
 import org.mozilla.gecko.gfx.TileLayer;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.opengl.GLSurfaceView;
 import android.os.SystemClock;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.WindowManager;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 import java.nio.IntBuffer;
-import java.util.ArrayList;
 
 /**
  * The layer renderer implements the rendering logic for a layer view.
  */
 public class LayerRenderer implements GLSurfaceView.Renderer {
     private static final String LOGTAG = "GeckoLayerRenderer";
 
     /*
@@ -87,18 +85,16 @@ public class LayerRenderer implements GL
     private final NinePatchTileLayer mShadowLayer;
     private final TextLayer mFrameRateLayer;
     private final ScrollbarLayer mHorizScrollLayer;
     private final ScrollbarLayer mVertScrollLayer;
     private final FadeRunnable mFadeRunnable;
     private RenderContext mLastPageContext;
     private int mMaxTextureSize;
 
-    private ArrayList<Layer> mExtraLayers = new ArrayList<Layer>();
-
     // Dropped frames display
     private int[] mFrameTimings;
     private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames;
     private boolean mShowFrameRate;
 
     /* Used by robocop for testing purposes */
     private IntBuffer mPixelBuffer;
 
@@ -151,52 +147,29 @@ public class LayerRenderer implements GL
 
         gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
         gl.glDisable(GL10.GL_DITHER);
         gl.glEnable(GL10.GL_TEXTURE_2D);
 
         int maxTextureSizeResult[] = new int[1];
         gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSizeResult, 0);
         mMaxTextureSize = maxTextureSizeResult[0];
-
-        TextureGenerator.get().fill();
     }
 
     public int getMaxTextureSize() {
         return mMaxTextureSize;
     }
 
-    public void addLayer(Layer layer) {
-        LayerController controller = mView.getController();
-
-        synchronized (controller) {
-            if (mExtraLayers.contains(layer)) {
-                mExtraLayers.remove(layer);
-            }
-
-            mExtraLayers.add(layer);
-        }
-    }
-
-    public void removeLayer(Layer layer) {
-        LayerController controller = mView.getController();
-
-        synchronized (controller) {
-            mExtraLayers.remove(layer);
-        }
-    }
-
     /**
      * Called whenever a new frame is about to be drawn.
      */
     public void onDrawFrame(GL10 gl) {
         long frameStartTime = SystemClock.uptimeMillis();
 
         TextureReaper.get().reap(gl);
-        TextureGenerator.get().fill();
 
         LayerController controller = mView.getController();
         RenderContext screenContext = createScreenContext();
 
         boolean updated = true;
 
         synchronized (controller) {
             Layer rootLayer = controller.getRoot();
@@ -220,19 +193,16 @@ public class LayerRenderer implements GL
             if (rootLayer != null) updated &= rootLayer.update(gl, pageContext);
             updated &= mBackgroundLayer.update(gl, screenContext);
             updated &= mShadowLayer.update(gl, pageContext);
             updateCheckerboardLayer(gl, screenContext);
             updated &= mFrameRateLayer.update(gl, screenContext);
             updated &= mVertScrollLayer.update(gl, pageContext);
             updated &= mHorizScrollLayer.update(gl, pageContext);
 
-            for (Layer layer : mExtraLayers)
-                updated &= layer.update(gl, pageContext);
-
             /* Draw the background. */
             mBackgroundLayer.draw(screenContext);
 
             /* Draw the drop shadow, if we need to. */
             Rect pageRect = getPageRect();
             RectF untransformedPageRect = new RectF(0.0f, 0.0f, pageRect.width(),
                                                     pageRect.height());
             if (!untransformedPageRect.contains(controller.getViewport()))
@@ -247,20 +217,16 @@ public class LayerRenderer implements GL
             mCheckerboardLayer.draw(screenContext);
 
             /* Draw the layer the client added to us. */
             if (rootLayer != null)
                 rootLayer.draw(pageContext);
 
             gl.glDisable(GL10.GL_SCISSOR_TEST);
 
-            /* Draw any extra layers that were added (likely plugins) */
-            for (Layer layer : mExtraLayers)
-                layer.draw(pageContext);
-
             /* Draw the vertical scrollbar. */
             IntSize screenSize = new IntSize(controller.getViewportSize());
             if (pageRect.height() > screenSize.height)
                 mVertScrollLayer.draw(pageContext);
 
             /* Draw the horizontal scrollbar. */
             if (pageRect.width() > screenSize.width)
                 mHorizScrollLayer.draw(pageContext);
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -219,24 +219,16 @@ public class LayerView extends GLSurface
         synchronized(this) {
             if (!mRenderTimeReset) {
                 mRenderTimeReset = true;
                 mRenderTime = System.nanoTime();
             }
         }
     }
 
-    public void addLayer(Layer layer) {
-        mRenderer.addLayer(layer);
-    }
-
-    public void removeLayer(Layer layer) {
-        mRenderer.removeLayer(layer);
-    }
-
     /**
      * Returns the time elapsed between the first call of requestRender() after
      * the last call of getRenderTime(), in nanoseconds.
      */
     public long getRenderTime() {
         synchronized(this) {
             mRenderTimeReset = false;
             return System.nanoTime() - mRenderTime;
deleted file mode 100644
--- a/mobile/android/base/gfx/SurfaceTextureLayer.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Android code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2009-2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.GeckoApp;
-
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.SurfaceTexture;
-import android.opengl.GLES11;
-import android.opengl.GLES11Ext;
-import android.opengl.Matrix;
-import android.util.Log;
-import android.view.Surface;
-import javax.microedition.khronos.opengles.GL10;
-import javax.microedition.khronos.opengles.GL11Ext;
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-import android.hardware.Camera;
-
-public class SurfaceTextureLayer extends Layer implements SurfaceTexture.OnFrameAvailableListener {
-    private static final String LOGTAG = "SurfaceTextureLayer";
-    private static final int LOCAL_GL_TEXTURE_EXTERNAL_OES = 0x00008d65; // This is only defined in API level 15 for some reason (Android 4.0.3)
-
-    private final SurfaceTexture mSurfaceTexture;
-    private final Surface mSurface;
-    private int mTextureId;
-    private boolean mHaveFrame;
-
-    private IntSize mSize;
-    private IntSize mNewSize;
-
-    private boolean mInverted;
-    private boolean mNewInverted;
-    private boolean mBlend;
-    private boolean mNewBlend;
-
-	private FloatBuffer textureBuffer;
-    private FloatBuffer textureBufferInverted;
-
-    public SurfaceTextureLayer(int textureId) {
-        mTextureId = textureId;
-        mHaveFrame = true;
-        mInverted = false;
-
-        mSurfaceTexture = new SurfaceTexture(mTextureId);
-        mSurfaceTexture.setOnFrameAvailableListener(this);
-
-        mSurface = new Surface(mSurfaceTexture);
-
-        float textureMap[] = {
-                0.0f, 1.0f,	// top left
-                0.0f, 0.0f,	// bottom left
-                1.0f, 1.0f,	// top right
-                1.0f, 0.0f,	// bottom right
-        };
-
-        textureBuffer = createBuffer(textureMap);
-
-        float textureMapInverted[] = {
-                0.0f, 0.0f,	// bottom left
-                0.0f, 1.0f,	// top left
-                1.0f, 0.0f,	// bottom right
-                1.0f, 1.0f,	// top right
-        };
-
-        textureBufferInverted = createBuffer(textureMapInverted);
-    }
-
-    public static SurfaceTextureLayer create() {
-        int textureId = TextureGenerator.get().take();
-        if (textureId == 0)
-            return null;
-
-        return new SurfaceTextureLayer(textureId);
-    }
-
-    // For SurfaceTexture.OnFrameAvailableListener
-    public void onFrameAvailable(SurfaceTexture texture) {
-        // FIXME: for some reason this doesn't get called
-        mHaveFrame = true;
-        GeckoApp.mAppContext.requestRender();
-    }
-
-    private FloatBuffer createBuffer(float[] input) {
-        // a float has 4 bytes so we allocate for each coordinate 4 bytes
-		ByteBuffer byteBuffer = ByteBuffer.allocateDirect(input.length * 4);
-		byteBuffer.order(ByteOrder.nativeOrder());
-
-        FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
-        floatBuffer.put(input);
-		floatBuffer.position(0);
-
-        return floatBuffer;
-    }
-
-    public void update(Point origin, IntSize size, float resolution, boolean inverted, boolean blend) {
-        beginTransaction(null);
-
-        setOrigin(origin);
-        setResolution(resolution);
-
-        mNewSize = size;
-        mNewInverted = inverted;
-        mNewBlend = blend;
-
-        endTransaction();
-    }
-
-    @Override
-    public IntSize getSize() { return mSize; }
-
-    @Override
-    protected void finalize() throws Throwable {
-        if (mSurfaceTexture != null)
-            mSurfaceTexture.release();
-
-        if (mTextureId > 0)
-            TextureReaper.get().add(mTextureId);
-    }
-
-    @Override
-    protected boolean performUpdates(GL10 gl, RenderContext context) {
-        super.performUpdates(gl, context);
-
-        if (mNewSize != null) {
-            mSize = mNewSize;
-            mNewSize = null;
-        }
-
-        mInverted = mNewInverted;
-        mBlend = mNewBlend;
-
-        gl.glEnable(LOCAL_GL_TEXTURE_EXTERNAL_OES);
-        gl.glBindTexture(LOCAL_GL_TEXTURE_EXTERNAL_OES, mTextureId);
-        mSurfaceTexture.updateTexImage();
-        gl.glDisable(LOCAL_GL_TEXTURE_EXTERNAL_OES);
-
-        // FIXME: we should return true and rely on onFrameAvailable, but
-        // that isn't working for some reason
-        return false;
-    }
-
-    private float mapToGLCoords(float input, float viewport, boolean flip) {
-        if (flip) input = viewport - input;
-        return ((input / viewport) * 2.0f) - 1.0f;
-    }
-
-    @Override
-    public void draw(RenderContext context) {
-
-        // Enable GL_TEXTURE_EXTERNAL_OES and bind our texture
-        GLES11.glEnable(LOCAL_GL_TEXTURE_EXTERNAL_OES);
-        GLES11.glBindTexture(LOCAL_GL_TEXTURE_EXTERNAL_OES, mTextureId);
-
-        // Enable vertex and texture coordinate buffers
-        GLES11.glEnableClientState(GL10.GL_VERTEX_ARRAY);
-        GLES11.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
-
-        // Load whatever texture transform the SurfaceMatrix needs
-        float[] matrix = new float[16];
-        mSurfaceTexture.getTransformMatrix(matrix);
-        GLES11.glMatrixMode(GLES11.GL_TEXTURE);
-        GLES11.glLoadMatrixf(matrix, 0);
-
-        // Figure out vertices to put the texture in the right spot on the screen
-        IntSize size = getSize();
-        RectF bounds = getBounds(context, new FloatSize(size));
-        RectF viewport = context.viewport;
-        bounds.offset(-viewport.left, -viewport.top);
-
-        float vertices[] = new float[8];
-
-        // Bottom left
-        vertices[0] = mapToGLCoords(bounds.left, viewport.width(), false);
-        vertices[1] = mapToGLCoords(bounds.bottom, viewport.height(), true);
-
-        // Top left
-        vertices[2] = mapToGLCoords(bounds.left, viewport.width(), false);
-        vertices[3] = mapToGLCoords(bounds.top, viewport.height(), true);
-
-        // Bottom right
-        vertices[4] = mapToGLCoords(bounds.right, viewport.width(), false);
-        vertices[5] = mapToGLCoords(bounds.bottom, viewport.height(), true);
-
-        // Top right
-        vertices[6] = mapToGLCoords(bounds.right, viewport.width(), false);
-        vertices[7] = mapToGLCoords(bounds.top, viewport.height(), true);
-
-        // Set texture and vertex buffers
-        GLES11.glVertexPointer(2, GL10.GL_FLOAT, 0, createBuffer(vertices));
-        GLES11.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mInverted ? textureBufferInverted : textureBuffer);
-
-        if (mBlend) {
-            GLES11.glEnable(GL10.GL_BLEND);
-            GLES11.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
-        }
-
-        // Draw the vertices as triangle strip
-        GLES11.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 2);
-
-        // Clean up
-        GLES11.glDisableClientState(GL10.GL_VERTEX_ARRAY);
-        GLES11.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
-        GLES11.glDisable(LOCAL_GL_TEXTURE_EXTERNAL_OES);
-        GLES11.glLoadIdentity();
-
-        if (mBlend) {
-            GLES11.glDisable(GL10.GL_BLEND);
-        }
-    }
-
-    public SurfaceTexture getSurfaceTexture() {
-        return mSurfaceTexture;
-    }
-
-    public Surface getSurface() {
-        return mSurface;
-    }
-}
-
deleted file mode 100644
--- a/mobile/android/base/gfx/TextureGenerator.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Android code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2009-2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package org.mozilla.gecko.gfx;
-
-import android.opengl.GLES10;
-import java.util.Stack;
-
-public class TextureGenerator {
-    private static final int MIN_TEXTURES = 5;
-
-    private static TextureGenerator sSharedInstance;
-    private Stack<Integer> mTextureIds;
-
-    private TextureGenerator() { mTextureIds = new Stack<Integer>(); }
-
-    public static TextureGenerator get() {
-        if (sSharedInstance == null)
-            sSharedInstance = new TextureGenerator();
-        return sSharedInstance;
-    }
-
-    public synchronized int take() {
-        if (mTextureIds.empty())
-            return 0;
-
-        return (int)mTextureIds.pop();
-    }
-
-    public synchronized void fill() {
-        int[] textures = new int[1];
-        while (mTextureIds.size() < MIN_TEXTURES) {
-            GLES10.glGenTextures(1, textures, 0);
-            mTextureIds.push(textures[0]);
-        }
-    }
-}
-
-
--- a/mobile/android/base/gfx/TextureReaper.java
+++ b/mobile/android/base/gfx/TextureReaper.java
@@ -50,21 +50,17 @@ public class TextureReaper {
     public static TextureReaper get() {
         if (sSharedInstance == null)
             sSharedInstance = new TextureReaper();
         return sSharedInstance;
     }
 
     public void add(int[] textureIDs) {
         for (int textureID : textureIDs)
-            add(textureID);
-    }
-
-    public void add(int textureID) {
-        mDeadTextureIDs.add(textureID);
+            mDeadTextureIDs.add(textureID);
     }
 
     public void reap(GL10 gl) {
         int[] deadTextureIDs = new int[mDeadTextureIDs.size()];
         for (int i = 0; i < deadTextureIDs.length; i++)
             deadTextureIDs[i] = mDeadTextureIDs.get(i);
         mDeadTextureIDs.clear();
 
--- a/mobile/android/base/ui/PanZoomController.java
+++ b/mobile/android/base/ui/PanZoomController.java
@@ -288,17 +288,16 @@ public class PanZoomController
             // should never happen
             Log.e(LOGTAG, "Received impossible touch move while in " + mState);
             return false;
         case TOUCHING:
             if (panDistance(event) < PAN_THRESHOLD * GeckoAppShell.getDpi()) {
                 return false;
             }
             cancelTouch();
-            GeckoApp.mAppContext.hidePlugins(false /* don't hide layers */);
             // fall through
         case PANNING_HOLD_LOCKED:
             GeckoApp.mAppContext.mAutoCompletePopup.hide();
             mState = PanZoomState.PANNING_LOCKED;
             // fall through
         case PANNING_LOCKED:
             track(event);
             return true;
@@ -470,18 +469,16 @@ public class PanZoomController
 
     /* Starts the fling or bounce animation. */
     private void startAnimationTimer(final AnimationRunnable runnable) {
         if (mAnimationTimer != null) {
             Log.e(LOGTAG, "Attempted to start a new fling without canceling the old one!");
             stopAnimationTimer();
         }
 
-        GeckoApp.mAppContext.hidePlugins(false /* don't hide layers */);
-
         mAnimationTimer = new Timer("Animation Timer");
         mAnimationRunnable = runnable;
         mAnimationTimer.scheduleAtFixedRate(new TimerTask() {
             @Override
             public void run() { mController.post(runnable); }
         }, 0, 1000L/60L);
     }
 
@@ -490,18 +487,16 @@ public class PanZoomController
         if (mAnimationTimer != null) {
             mAnimationTimer.cancel();
             mAnimationTimer = null;
         }
         if (mAnimationRunnable != null) {
             mAnimationRunnable.terminate();
             mAnimationRunnable = null;
         }
-
-        GeckoApp.mAppContext.showPlugins();
     }
 
     private float getVelocity() {
         float xvel = mX.getRealVelocity();
         float yvel = mY.getRealVelocity();
         return FloatMath.sqrt(xvel * xvel + yvel * yvel);
     }
 
@@ -581,16 +576,17 @@ public class PanZoomController
                 advanceBounce();
                 return;
             }
 
             /* Finally, if there's nothing else to do, complete the animation and go to sleep. */
             finishBounce();
             finishAnimation();
             mState = PanZoomState.NOTHING;
+            GeckoApp.mAppContext.showPluginViews();
         }
 
         /* Performs one frame of a bounce animation. */
         private void advanceBounce() {
             synchronized (mController) {
                 float t = EASE_OUT_ANIMATION_FRAMES[mBounceFrame];
                 ViewportMetrics newMetrics = mBounceStartMetrics.interpolate(mBounceEndMetrics, t);
                 mController.setViewportMetrics(newMetrics);
@@ -660,17 +656,16 @@ public class PanZoomController
 
     private void finishAnimation() {
         checkMainThread();
 
         Log.d(LOGTAG, "Finishing animation at " + mController.getViewportMetrics());
         stopAnimationTimer();
 
         // Force a viewport synchronisation
-        GeckoApp.mAppContext.showPlugins();
         mController.setForceRedraw();
         mController.notifyLayerClientOfGeometryChange();
     }
 
     /* Returns the nearest viewport metrics with no overscroll visible. */
     private ViewportMetrics getValidViewportMetrics() {
         ViewportMetrics viewportMetrics = new ViewportMetrics(mController.getViewportMetrics());
         Log.d(LOGTAG, "generating valid viewport using " + viewportMetrics);
@@ -741,17 +736,17 @@ public class PanZoomController
     public boolean onScaleBegin(SimpleScaleGestureDetector detector) {
         Log.d(LOGTAG, "onScaleBegin in " + mState);
 
         if (mState == PanZoomState.ANIMATED_ZOOM)
             return false;
 
         mState = PanZoomState.PINCHING;
         mLastZoomFocus = new PointF(detector.getFocusX(), detector.getFocusY());
-        GeckoApp.mAppContext.hidePlugins(false /* don't hide layers, only views */);
+        GeckoApp.mAppContext.hidePluginViews();
         GeckoApp.mAppContext.mAutoCompletePopup.hide();
         cancelTouch();
 
         return true;
     }
 
     @Override
     public boolean onScale(SimpleScaleGestureDetector detector) {
@@ -806,19 +801,19 @@ public class PanZoomController
 
         if (mState == PanZoomState.ANIMATED_ZOOM)
             return;
 
         // switch back to the touching state
         startTouch(detector.getFocusX(), detector.getFocusY(), detector.getEventTime());
 
         // Force a viewport synchronisation
-        GeckoApp.mAppContext.showPlugins();
         mController.setForceRedraw();
         mController.notifyLayerClientOfGeometryChange();
+        GeckoApp.mAppContext.showPluginViews();
     }
 
     public boolean getRedrawHint() {
         return (mState == PanZoomState.NOTHING || mState == PanZoomState.FLING);
     }
 
     private void sendPointToGecko(String event, MotionEvent motionEvent) {
         String json;
@@ -862,16 +857,17 @@ public class PanZoomController
     }
 
     public void cancelTouch() {
         GeckoEvent e = new GeckoEvent("Gesture:CancelTouch", "");
         GeckoAppShell.sendEventToGecko(e);
     }
 
     private boolean animatedZoomTo(RectF zoomToRect) {
+        GeckoApp.mAppContext.hidePluginViews();
         GeckoApp.mAppContext.mAutoCompletePopup.hide();
 
         mState = PanZoomState.ANIMATED_ZOOM;
         final float startZoom = mController.getZoomFactor();
         final PointF startPoint = mController.getOrigin();
 
         RectF viewport = mController.getViewport();
 
--- a/other-licenses/skia-npapi/Makefile.in
+++ b/other-licenses/skia-npapi/Makefile.in
@@ -51,17 +51,16 @@ DEFINES += \
   -DSK_BUILD_FOR_ANDROID_NDK \
   $(NULL)
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/dom/plugins/base \
   -I$(topsrcdir)/dom/plugins/base/android \
   -I$(topsrcdir)/gfx/skia/include/core \
   -I$(topsrcdir)/gfx/skia/include/config \
-  -I$(topsrcdir)/gfx/gl \
   $(NULL)
 
 
 CPPSRCS = \
   SkANP.cpp \
   ANPCanvas.cpp \
   ANPPaint.cpp \
   ANPPath.cpp \
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1704,19 +1704,19 @@ AndroidBridge::ReleaseNativeWindow(void 
 {
     if (!window)
         return;
 
     ANativeWindow_release(window);
 }
 
 bool
-AndroidBridge::SetNativeWindowFormat(void *window, int width, int height, int format)
+AndroidBridge::SetNativeWindowFormat(void *window, int format)
 {
-    return ANativeWindow_setBuffersGeometry(window, width, height, format) == 0;
+    return ANativeWindow_setBuffersGeometry(window, 0, 0, format) == 0;
 }
 
 bool
 AndroidBridge::LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride)
 {
     /* Copied from native_window.h in Android NDK (platform-9) */
     typedef struct ANativeWindow_Buffer {
         // The number of pixels that are show horizontally.
@@ -1852,90 +1852,8 @@ extern "C" {
             PR_SetThreadPrivate(sJavaEnvThreadIndex, jEnv);
         }
         if (!jEnv) {
             __android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "returning NULL");
         }
         return jEnv;
     }
 }
-
-jobject
-AndroidBridge::CreateSurface()
-{
-#ifndef MOZ_JAVA_COMPOSITOR
-  return NULL;
-#else
-  AutoLocalJNIFrame frame(1);
-
-  JNIEnv* env = GetJNIForThread();
-  jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
-
-  jmethodID method = env->GetStaticMethodID(cls,
-                                            "createSurface",
-                                            "()Landroid/view/Surface;");
-
-  jobject surface = env->CallStaticObjectMethod(cls, method);
-  if (surface)
-    env->NewGlobalRef(surface);
-  
-  return surface;
-#endif
-}
-
-void
-AndroidBridge::DestroySurface(jobject surface)
-{
-#ifdef MOZ_JAVA_COMPOSITOR
-  AutoLocalJNIFrame frame(1);
-
-  JNIEnv* env = GetJNIForThread();
-  jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
-
-  jmethodID method = env->GetStaticMethodID(cls,
-                                            "destroySurface",
-                                            "(Landroid/view/Surface;)V");
-  env->CallStaticVoidMethod(cls, method, surface);
-  env->DeleteGlobalRef(surface);
-#endif
-}
-
-void
-AndroidBridge::ShowSurface(jobject surface, const gfxRect& aRect, bool aInverted, bool aBlend)
-{
-#ifdef MOZ_JAVA_COMPOSITOR
-  AutoLocalJNIFrame frame;
-
-  JNIEnv* env = GetJNIForThread();
-  jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
-
-  nsAutoString metadata;
-  nsCOMPtr<nsIAndroidDrawMetadataProvider> metadataProvider = GetDrawMetadataProvider();
-  metadataProvider->GetDrawMetadata(metadata);
-
-  jstring jMetadata = env->NewString(nsPromiseFlatString(metadata).get(), metadata.Length());
-
-  jmethodID method = env->GetStaticMethodID(cls,
-                                            "showSurface",
-                                            "(Landroid/view/Surface;IIIIZZLjava/lang/String;)V");
-
-  env->CallStaticVoidMethod(cls, method, surface,
-                            (int)aRect.x, (int)aRect.y,
-                            (int)aRect.width, (int)aRect.height,
-                            aInverted, aBlend, jMetadata);
-#endif
-}
-
-void
-AndroidBridge::HideSurface(jobject surface)
-{
-#ifdef MOZ_JAVA_COMPOSITOR
-  AutoLocalJNIFrame frame(1);
-
-  JNIEnv* env = GetJNIForThread();
-  jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
-
-  jmethodID method = env->GetStaticMethodID(cls,
-                                            "hideSurface",
-                                            "(Landroid/view/Surface;)V");
-  env->CallStaticVoidMethod(cls, method, surface);
-#endif
-}
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -49,17 +49,16 @@
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 
 #include "AndroidJavaWrappers.h"
 
 #include "nsIMutableArray.h"
 #include "nsIMIMEInfo.h"
 #include "nsColor.h"
-#include "gfxRect.h"
 
 #include "nsIAndroidBridge.h"
 
 // Some debug #defines
 // #define DEBUG_ANDROID_EVENTS
 // #define DEBUG_ANDROID_WIDGET
 
 class nsWindow;
@@ -337,17 +336,17 @@ public:
         WINDOW_FORMAT_RGBX_8888          = 2,
         WINDOW_FORMAT_RGB_565            = 4,
     };
 
     bool HasNativeWindowAccess();
 
     void *AcquireNativeWindow(jobject surface);
     void ReleaseNativeWindow(void *window);
-    bool SetNativeWindowFormat(void *window, int width, int height, int format);
+    bool SetNativeWindowFormat(void *window, int format);
 
     bool LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride);
     bool UnlockWindow(void *window);
     
     void HandleGeckoMessage(const nsAString& message, nsAString &aRet);
 
     nsCOMPtr<nsIAndroidDrawMetadataProvider> GetDrawMetadataProvider();
 
@@ -374,21 +373,16 @@ public:
     void ClearMessageList(PRInt32 aListId);
 
     bool IsTablet();
 
     void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
     void EnableNetworkNotifications();
     void DisableNetworkNotifications();
 
-    jobject CreateSurface();
-    void DestroySurface(jobject surface);
-    void ShowSurface(jobject surface, const gfxRect& aRect, bool aInverted, bool aBlend);
-    void HideSurface(jobject surface);
-
 protected:
     static AndroidBridge *sBridge;
 
     // the global JavaVM
     JavaVM *mJavaVM;
 
     // the JNIEnv for the main thread
     JNIEnv *mJNIEnv;
deleted file mode 100644
--- a/widget/android/AndroidMediaLayer.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <android/log.h>
-#include "AndroidMediaLayer.h"
-#include "AndroidBridge.h"
-
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "AndroidMediaLayer" , ## args)
-
-
-namespace mozilla {
-
-AndroidMediaLayer::AndroidMediaLayer()
-  : mInverted(false) {
-}
-
-AndroidMediaLayer::~AndroidMediaLayer() {
-  if (mContentData.window) {
-    AndroidBridge::Bridge()->ReleaseNativeWindow(mContentData.window);
-    mContentData.window = NULL;
-  }
-
-  if (mContentData.surface) {
-    AndroidBridge::Bridge()->DestroySurface(mContentData.surface);
-    mContentData.surface = NULL;
-  }
-
-  std::map<void*, SurfaceData*>::iterator it;
-
-  for (it = mVideoSurfaces.begin(); it != mVideoSurfaces.end(); it++) {
-    SurfaceData* data = it->second;
-
-    AndroidBridge::Bridge()->ReleaseNativeWindow(data->window);
-    AndroidBridge::Bridge()->DestroySurface(data->surface);
-    delete data;
-  }
-
-  mVideoSurfaces.clear();
-}
-
-bool AndroidMediaLayer::EnsureContentSurface() {
-  if (!mContentData.surface) {
-    mContentData.surface = AndroidBridge::Bridge()->CreateSurface();
-    if (mContentData.surface) {
-      mContentData.window = AndroidBridge::Bridge()->AcquireNativeWindow(mContentData.surface);
-      AndroidBridge::Bridge()->SetNativeWindowFormat(mContentData.window, 0, 0, AndroidBridge::WINDOW_FORMAT_RGBA_8888);
-    }
-  }
-
-  return mContentData.surface && mContentData.window;
-}
-
-void* AndroidMediaLayer::GetNativeWindowForContent() {
-  if (!EnsureContentSurface())
-    return NULL;
-
-  return mContentData.window;
-}
-
-void* AndroidMediaLayer::RequestNativeWindowForVideo() {
-  jobject surface = AndroidBridge::Bridge()->CreateSurface();
-  if (surface) {
-    void* window = AndroidBridge::Bridge()->AcquireNativeWindow(surface);
-    if (window) {
-      AndroidBridge::Bridge()->SetNativeWindowFormat(window, 0, 0, AndroidBridge::WINDOW_FORMAT_RGBA_8888);
-      mVideoSurfaces[window] = new SurfaceData(surface, window);
-      return window;
-    } else {
-      LOG("Failed to create native window from surface");
-
-      // Cleanup
-      AndroidBridge::Bridge()->DestroySurface(surface);
-    }
-  }
-
-  return NULL;
-}
-
-void AndroidMediaLayer::ReleaseNativeWindowForVideo(void* aWindow) {
-  if (mVideoSurfaces.find(aWindow) == mVideoSurfaces.end())
-    return;
-
-  SurfaceData* data = mVideoSurfaces[aWindow];
-
-  AndroidBridge::Bridge()->ReleaseNativeWindow(data->window);
-  AndroidBridge::Bridge()->DestroySurface(data->surface);
-
-  mVideoSurfaces.erase(aWindow);
-  delete data;
-}
-
-void AndroidMediaLayer::SetNativeWindowDimensions(void* aWindow, const gfxRect& aDimensions) {
-  if (mVideoSurfaces.find(aWindow) == mVideoSurfaces.end())
-    return;
-
-  SurfaceData* data = mVideoSurfaces[aWindow];
-  data->dimensions = aDimensions;
-}
-
-void AndroidMediaLayer::UpdatePosition(const gfxRect& aRect, float aZoomLevel) {
-
-  std::map<void*, SurfaceData*>::iterator it;
-
-  if (EnsureContentSurface())
-    AndroidBridge::Bridge()->ShowSurface(mContentData.surface, aRect, mInverted, true);
-
-  for (it = mVideoSurfaces.begin(); it != mVideoSurfaces.end(); it++) {
-    SurfaceData* data = it->second;
-
-    // The video window dimension we get is not adjusted by zoom factor (unlike the
-    // content window). Fix it up here.
-    gfxRect scaledDimensions = data->dimensions;
-    scaledDimensions.Scale(aZoomLevel);
-
-    gfxRect videoRect(aRect.x + scaledDimensions.x, aRect.y + scaledDimensions.y,
-                      scaledDimensions.width, scaledDimensions.height);
-    AndroidBridge::Bridge()->ShowSurface(data->surface, videoRect, mInverted, false);
-  }
-}
-
-} /* mozilla */
deleted file mode 100644
--- a/widget/android/AndroidMediaLayer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   James Willcox <jwillcox@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef AndroidMediaLayer_h_
-#define AndroidMediaLayer_h_
-
-#include <map>
-#include <jni.h>
-#include "gfxRect.h"
-
-namespace mozilla {
-
-class AndroidMediaLayer
-{
-public:
-
-  AndroidMediaLayer();
-  virtual ~AndroidMediaLayer();
-  
-  void* GetNativeWindowForContent();
-
-  void* RequestNativeWindowForVideo();
-  void  ReleaseNativeWindowForVideo(void* aWindow);
-
-  void SetNativeWindowDimensions(void* aWindow, const gfxRect& aDimensions);
-
-  void UpdatePosition(const gfxRect& aRect, float aZoomLevel);
-
-  bool Inverted() {
-    return mInverted;
-  }
-
-  void SetInverted(bool aInverted) {
-    mInverted = aInverted;
-  }
-
-private:
-  bool mInverted;
-
-  class SurfaceData {
-    public:
-      SurfaceData() :
-        surface(NULL), window(NULL) {
-      }
-
-      SurfaceData(jobject aSurface, void* aWindow) :
-        surface(aSurface), window(aWindow) {
-      }
-
-      jobject surface;
-      void* window;
-      gfxRect dimensions;
-  };
-
-  bool EnsureContentSurface();
-
-  SurfaceData mContentData;
-  std::map<void*, SurfaceData*> mVideoSurfaces;
-};
-
-} /* mozilla */
-#endif /* AndroidMediaLayer_h_ */
--- a/widget/android/Makefile.in
+++ b/widget/android/Makefile.in
@@ -63,17 +63,16 @@ CPPSRCS	= \
 	GfxInfo.cpp \
 	nsWidgetFactory.cpp \
 	nsAppShell.cpp \
 	AndroidJavaWrappers.cpp \
 	AndroidBridge.cpp \
 	AndroidDirectTexture.cpp \
 	AndroidGraphicBuffer.cpp \
 	AndroidJNI.cpp \
-	AndroidMediaLayer.cpp \
 	nsWindow.cpp \
 	nsLookAndFeel.cpp \
 	nsScreenManagerAndroid.cpp \
 	nsIdleServiceAndroid.cpp \
 	nsClipboard.cpp \
 	nsFilePicker.cpp \
 	nsIMEPicker.cpp \
 	nsDeviceContextAndroid.cpp \
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1014,17 +1014,17 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
             sSurfaceExists = true;
 
             if (AndroidBridge::Bridge()->HasNativeWindowAccess()) {
                 AndroidGeckoSurfaceView& sview(AndroidBridge::Bridge()->SurfaceView());
                 jobject surface = sview.GetSurface();
                 if (surface) {
                     sNativeWindow = AndroidBridge::Bridge()->AcquireNativeWindow(surface);
                     if (sNativeWindow) {
-                        AndroidBridge::Bridge()->SetNativeWindowFormat(sNativeWindow, 0, 0, AndroidBridge::WINDOW_FORMAT_RGB_565);
+                        AndroidBridge::Bridge()->SetNativeWindowFormat(sNativeWindow, AndroidBridge::WINDOW_FORMAT_RGB_565);
                     }
                 }
             }
             break;
 
         case AndroidGeckoEvent::SURFACE_DESTROYED:
             if (sGLContext && sValidSurface) {
                 sGLContext->ReleaseSurface();