Bug 817134 - Delete dead code in java-land to display checkerboarding. r=blassey
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 15 Dec 2012 10:43:57 -0500
changeset 125250 0f45583754caff7d7d940bcea9a5a272c861edcb
parent 125249 35a2b968dc98511f21a4c402ef00272db225d636
child 125251 5cab33f5bfbd655e21f0417f4ec644f52da0c7fe
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs817134
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 817134 - Delete dead code in java-land to display checkerboarding. r=blassey
mobile/android/app/mobile.js
mobile/android/base/GeckoApp.java
mobile/android/base/Makefile.in
mobile/android/base/Tab.java
mobile/android/base/gfx/CheckerboardImage.java
mobile/android/base/gfx/GeckoLayerClient.java
mobile/android/base/gfx/LayerRenderer.java
mobile/android/base/gfx/LayerView.java
mobile/android/base/gfx/ScreenshotLayer.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -605,19 +605,16 @@ pref("media.realtime_decoder.enabled", t
 pref("dom.report_all_js_exceptions", true);
 pref("javascript.options.showInConsole", true);
 
 pref("full-screen-api.enabled", true);
 
 pref("direct-texture.force.enabled", false);
 pref("direct-texture.force.disabled", false);
 
-// show checkerboard pattern on android; we use background colour instead
-pref("gfx.show_checkerboard_pattern", true);
-
 // This fraction in 1000ths of velocity remains after every animation frame when the velocity is low.
 pref("ui.scrolling.friction_slow", -1);
 // This fraction in 1000ths of velocity remains after every animation frame when the velocity is high.
 pref("ui.scrolling.friction_fast", -1);
 // The maximum velocity change factor between events, per ms, in 1000ths.
 // Direction changes are excluded.
 pref("ui.scrolling.max_event_acceleration", -1);
 // The rate of deceleration when the surface has overscrolled, in 1000ths.
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -833,27 +833,27 @@ abstract public class GeckoApp
                 final String duration = message.getString("duration");
                 handleShowToast(msg, duration);
             } else if (event.equals("DOMContentLoaded")) {
                 final int tabId = message.getInt("tabID");
                 final String backgroundColor = message.getString("bgColor");
                 handleContentLoaded(tabId);
                 Tab tab = Tabs.getInstance().getTab(tabId);
                 if (backgroundColor != null) {
-                    tab.setCheckerboardColor(backgroundColor);
+                    tab.setBackgroundColor(backgroundColor);
                 } else {
                     // Default to white if no color is given
-                    tab.setCheckerboardColor(Color.WHITE);
+                    tab.setBackgroundColor(Color.WHITE);
                 }
 
                 // Sync up the layer view and the tab if the tab is
                 // currently displayed.
                 LayerView layerView = mLayerView;
                 if (layerView != null && Tabs.getInstance().isSelectedTab(tab)) {
-                    layerView.setCheckerboardColor(tab.getCheckerboardColor());
+                    layerView.setBackgroundColor(tab.getBackgroundColor());
                 }
             } else if (event.equals("DOMTitleChanged")) {
                 final int tabId = message.getInt("tabID");
                 final String title = message.getString("title");
                 handleTitleChanged(tabId, title);
             } else if (event.equals("DOMLinkAdded")) {
                 final int tabId = message.getInt("tabID");
                 final String rel = message.getString("rel");
@@ -1127,18 +1127,16 @@ abstract public class GeckoApp
     void handleDocumentStart(int tabId, final boolean showProgress, String uri) {
         final Tab tab = Tabs.getInstance().getTab(tabId);
         if (tab == null)
             return;
 
         tab.setState(shouldShowProgress(uri) ? Tab.STATE_SUCCESS : Tab.STATE_LOADING);
         tab.updateIdentityData(null);
         tab.setReaderEnabled(false);
-        if (Tabs.getInstance().isSelectedTab(tab))
-            mLayerView.getRenderer().resetCheckerboard();
         Tabs.getInstance().notifyListeners(tab, Tabs.TabEvents.START, showProgress);
     }
 
     void handleDocumentStop(int tabId, boolean success) {
         final Tab tab = Tabs.getInstance().getTab(tabId);
         if (tab == null)
             return;
 
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -144,17 +144,16 @@ FENNEC_JAVA_FILES = \
   ThumbnailHelper.java \
   WebAppAllocator.java \
   ZoomConstraints.java \
   gfx/BitmapUtils.java \
   gfx/BufferedCairoImage.java \
   gfx/CairoGLInfo.java \
   gfx/CairoImage.java \
   gfx/CairoUtils.java \
-  gfx/CheckerboardImage.java \
   gfx/DisplayPortCalculator.java \
   gfx/DisplayPortMetrics.java \
   gfx/DrawTimingQueue.java \
   gfx/FloatSize.java \
   gfx/GeckoLayerClient.java \
   gfx/GfxInfoThread.java \
   gfx/GLController.java \
   gfx/ImmutableViewportMetrics.java \
@@ -164,17 +163,16 @@ FENNEC_JAVA_FILES = \
   gfx/LayerRenderer.java \
   gfx/LayerView.java \
   gfx/PluginLayer.java \
   gfx/NinePatchTileLayer.java \
   gfx/PanningPerfAPI.java \
   gfx/PointUtils.java \
   gfx/ProgressiveUpdateData.java \
   gfx/RectUtils.java \
-  gfx/ScreenshotLayer.java \
   gfx/ScrollbarLayer.java \
   gfx/SingleTileLayer.java \
   gfx/TextLayer.java \
   gfx/TextureGenerator.java \
   gfx/TextureReaper.java \
   gfx/TileLayer.java \
   gfx/TouchEventHandler.java \
   gfx/ViewTransform.java \
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -55,17 +55,17 @@ public class Tab {
     private String mDocumentURI;
     private String mContentType;
     private boolean mHasTouchListeners;
     private ZoomConstraints mZoomConstraints;
     private ArrayList<View> mPluginViews;
     private HashMap<Object, Layer> mPluginLayers;
     private ContentResolver mContentResolver;
     private ContentObserver mContentObserver;
-    private int mCheckerboardColor = Color.WHITE;
+    private int mBackgroundColor = Color.WHITE;
     private int mState;
     private Bitmap mThumbnailBitmap;
     private boolean mDesktopMode;
     private boolean mEnteringReaderMode;
 
     public static final int STATE_DELAYED = 0;
     public static final int STATE_LOADING = 1;
     public static final int STATE_SUCCESS = 2;
@@ -504,17 +504,17 @@ public class Tab {
 
         setContentType(message.getString("contentType"));
         clearFavicon();
         updateTitle(null);
         updateIdentityData(null);
         setReaderEnabled(false);
         setZoomConstraints(new ZoomConstraints(true));
         setHasTouchListeners(false);
-        setCheckerboardColor(Color.WHITE);
+        setBackgroundColor(Color.WHITE);
 
         Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, uri);
     }
 
     protected void saveThumbnailToDB() {
         try {
             String url = getURL();
             if (url == null)
@@ -557,28 +557,28 @@ public class Tab {
     }
 
     public Layer removePluginLayer(Object surfaceOrView) {
         synchronized(mPluginLayers) {
             return mPluginLayers.remove(surfaceOrView);
         }
     }
 
-    public int getCheckerboardColor() {
-        return mCheckerboardColor;
+    public int getBackgroundColor() {
+        return mBackgroundColor;
     }
 
-    /** Sets a new color for the checkerboard. */
-    public void setCheckerboardColor(int color) {
-        mCheckerboardColor = color;
+    /** Sets a new color for the background. */
+    public void setBackgroundColor(int color) {
+        mBackgroundColor = color;
     }
 
-    /** Parses and sets a new color for the checkerboard. */
-    public void setCheckerboardColor(String newColor) {
-        setCheckerboardColor(parseColorFromGecko(newColor));
+    /** Parses and sets a new color for the background. */
+    public void setBackgroundColor(String newColor) {
+        setBackgroundColor(parseColorFromGecko(newColor));
     }
 
     // Parses a color from an RGB triple of the form "rgb([0-9]+, [0-9]+, [0-9]+)". If the color
     // cannot be parsed, returns white.
     private static int parseColorFromGecko(String string) {
         if (sColorPattern == null) {
             sColorPattern = Pattern.compile("rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)");
         }
deleted file mode 100644
--- a/mobile/android/base/gfx/CheckerboardImage.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.mozglue.DirectBufferAllocator;
-
-import android.graphics.Color;
-import android.util.Log;
-
-import java.nio.ByteBuffer;
-import java.nio.ShortBuffer;
-import java.util.Arrays;
-
-/** A Cairo image that displays a tinted checkerboard. */
-public class CheckerboardImage extends CairoImage {
-    // The width and height of the checkerboard tile.
-    private static final int SIZE = 16;
-    // The pixel format of the checkerboard tile.
-    private static final int FORMAT = CairoImage.FORMAT_RGB16_565;
-    // The color to mix in to tint the background color.
-    private static final int TINT_COLOR = Color.GRAY;
-    // The amount to mix in.
-    private static final float TINT_OPACITY = 0.4f;
-
-    private static String LOGTAG = "GeckoCheckerboardImage";
-
-    private ByteBuffer mBuffer;
-    private int mMainColor;
-    private boolean mShowChecks;
-
-    /** Creates a new checkerboard image. */
-    public CheckerboardImage() {
-        int bpp = CairoUtils.bitsPerPixelForCairoFormat(FORMAT);
-        mBuffer = DirectBufferAllocator.allocate(SIZE * SIZE * bpp / 8);
-        update(true, Color.WHITE);
-    }
-
-    /** Returns the current color of the checkerboard. */
-    public int getColor() {
-        return mMainColor;
-    }
-
-    /** Returns whether or not we are currently showing checks on the checkerboard. */
-    public boolean getShowChecks() {
-        return mShowChecks;
-    }
-
-    /** Updates the checkerboard image. If showChecks is true, then create a
-        checkerboard image that is tinted to the color. Otherwise just return a flat
-        image of the color. */
-    public void update(boolean showChecks, int color) {
-        mMainColor = color;
-        mShowChecks = showChecks;
-
-        short mainColor16 = convertTo16Bit(mMainColor);
-
-        mBuffer.rewind();
-        ShortBuffer shortBuffer = mBuffer.asShortBuffer();
-
-        if (!mShowChecks) {
-            short color16 = convertTo16Bit(mMainColor);
-            short[] fillBuffer = new short[SIZE];
-            Arrays.fill(fillBuffer, color16);
-
-            for (int i = 0; i < SIZE; i++) {
-                shortBuffer.put(fillBuffer);
-            }
-
-            return;
-        }
-
-        short tintColor16 = convertTo16Bit(tint(mMainColor));
-
-        short[] mainPattern = new short[SIZE / 2], tintPattern = new short[SIZE / 2];
-        Arrays.fill(mainPattern, mainColor16);
-        Arrays.fill(tintPattern, tintColor16);
-
-        // The checkerboard pattern looks like this:
-        //
-        // +---+---+
-        // | N | T |  N = normal
-        // +---+---+  T = tinted
-        // | T | N |
-        // +---+---+
-
-        for (int i = 0; i < SIZE / 2; i++) {
-            shortBuffer.put(mainPattern);
-            shortBuffer.put(tintPattern);
-        }
-        for (int i = SIZE / 2; i < SIZE; i++) {
-            shortBuffer.put(tintPattern);
-            shortBuffer.put(mainPattern);
-        }
-    }
-
-    // Tints the given color appropriately and returns the tinted color.
-    private int tint(int color) {
-        float negTintOpacity = 1.0f - TINT_OPACITY;
-        float r = Color.red(color) * negTintOpacity + Color.red(TINT_COLOR) * TINT_OPACITY;
-        float g = Color.green(color) * negTintOpacity + Color.green(TINT_COLOR) * TINT_OPACITY;
-        float b = Color.blue(color) * negTintOpacity + Color.blue(TINT_COLOR) * TINT_OPACITY;
-        return Color.rgb(Math.round(r), Math.round(g), Math.round(b));
-    }
-
-    // Converts a 32-bit ARGB color to 16-bit R5G6B5, truncating values and discarding the alpha
-    // channel.
-    private short convertTo16Bit(int color) {
-        int r = Color.red(color) >> 3, g = Color.green(color) >> 2, b = Color.blue(color) >> 3;
-        int c = ((r << 11) | (g << 5) | b);
-        // Swap endianness.
-        return (short)((c >> 8) | ((c & 0xff) << 8));
-    }
-
-    @Override
-    public void destroy() {
-        try {
-            DirectBufferAllocator.free(mBuffer);
-            mBuffer = null;
-        } catch (Exception ex) {
-            Log.e(LOGTAG, "error clearing buffer: ", ex);
-        }
-    }
-
-    @Override
-    public ByteBuffer getBuffer() {
-        return mBuffer;
-    }
-
-    @Override
-    public IntSize getSize() {
-        return new IntSize(SIZE, SIZE);
-    }
-
-    @Override
-    public int getFormat() {
-        return FORMAT;
-    }
-}
-
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -11,40 +11,37 @@ import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.GeckoApp;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.ZoomConstraints;
 import org.mozilla.gecko.ui.PanZoomController;
 import org.mozilla.gecko.ui.PanZoomTarget;
 import org.mozilla.gecko.util.EventDispatcher;
 import org.mozilla.gecko.util.FloatUtils;
-import org.mozilla.gecko.util.GeckoEventListener;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.content.Context;
 import android.graphics.PointF;
 import android.graphics.RectF;
 import android.os.SystemClock;
 import android.util.DisplayMetrics;
 import android.util.Log;
 
 import java.util.HashMap;
 import java.util.Map;
 
-public class GeckoLayerClient
-        implements GeckoEventListener, LayerView.Listener, PanZoomTarget
+public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
 {
     private static final String LOGTAG = "GeckoLayerClient";
 
     private LayerRenderer mLayerRenderer;
     private boolean mLayerRendererInitialized;
 
-    private final EventDispatcher mEventDispatcher;
     private Context mContext;
     private IntSize mScreenSize;
     private IntSize mWindowSize;
     private DisplayPortMetrics mDisplayPort;
 
     private boolean mRecordDrawTimes;
     private final DrawTimingQueue mDrawTimingQueue;
 
@@ -102,17 +99,16 @@ public class GeckoLayerClient
     private boolean mGeckoIsReady;
 
     private final PanZoomController mPanZoomController;
     private LayerView mView;
 
     public GeckoLayerClient(Context context, LayerView view, EventDispatcher eventDispatcher) {
         // we can fill these in with dummy values because they are always written
         // to before being read
-        mEventDispatcher = eventDispatcher;
         mContext = context;
         mScreenSize = new IntSize(0, 0);
         mWindowSize = new IntSize(0, 0);
         mDisplayPort = new DisplayPortMetrics();
         mRecordDrawTimes = true;
         mDrawTimingQueue = new DrawTimingQueue();
         mCurrentViewTransform = new ViewTransform(0, 0, 1);
         mProgressiveUpdateData = new ProgressiveUpdateData();
@@ -121,46 +117,35 @@ public class GeckoLayerClient
         mProgressiveUpdateWasInDanger = false;
         mCompositorCreated = false;
 
         mForceRedraw = true;
         DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
         mViewportMetrics = new ImmutableViewportMetrics(displayMetrics);
         mZoomConstraints = new ZoomConstraints(false);
 
-        mPanZoomController = new PanZoomController(this, mEventDispatcher);
+        mPanZoomController = new PanZoomController(this, eventDispatcher);
         mView = view;
     }
 
     /** Attaches to root layer so that Gecko appears. */
     public void notifyGeckoReady() {
         mGeckoIsReady = true;
 
         mRootLayer = new VirtualLayer(new IntSize(mView.getWidth(), mView.getHeight()));
         mLayerRenderer = mView.getRenderer();
 
-        registerEventListener("Checkerboard:Toggle");
-
         mView.setListener(this);
         sendResizeEventIfNecessary(true);
 
         DisplayPortCalculator.initPrefs();
     }
 
     public void destroy() {
         mPanZoomController.destroy();
-        unregisterEventListener("Checkerboard:Toggle");
-    }
-
-    private void registerEventListener(String event) {
-        mEventDispatcher.registerEventListener(event, this);
-    }
-
-    private void unregisterEventListener(String event) {
-        mEventDispatcher.unregisterEventListener(event, this);
     }
 
     /**
      * Returns true if this client is fine with performing a redraw operation or false if it
      * would prefer that the action didn't take place.
      */
     private boolean getRedrawHint() {
         if (mForceRedraw) {
@@ -447,27 +432,16 @@ public class GeckoLayerClient
         // Abort drawing stale low-precision content if there's a more recent
         // display-port in the pipeline.
         if (lowPrecision && !aHasPendingNewThebesContent) {
           mProgressiveUpdateData.abort = true;
         }
         return mProgressiveUpdateData;
     }
 
-    /** Implementation of GeckoEventResponder/GeckoEventListener. */
-    public void handleMessage(String event, JSONObject message) {
-        try {
-            if ("Checkerboard:Toggle".equals(event)) {
-                mView.setCheckerboardShouldShowChecks(message.getBoolean("value"));
-            }
-        } catch (JSONException e) {
-            Log.e(LOGTAG, "Error decoding JSON in " + event + " handler", e);
-        }
-    }
-
     void setZoomConstraints(ZoomConstraints constraints) {
         mZoomConstraints = constraints;
     }
 
     /** This function is invoked by Gecko via JNI; be careful when modifying signature.
       * The compositor invokes this function just before compositing a frame where the document
       * is different from the document composited on the last frame. In these cases, the viewport
       * information we have in Java is no longer valid and needs to be replaced with the new
@@ -490,17 +464,17 @@ public class GeckoLayerClient
             post(new Runnable() {
                 public void run() {
                     mGeckoViewport = newMetrics;
                 }
             });
             setViewportMetrics(newMetrics);
 
             Tab tab = Tabs.getInstance().getSelectedTab();
-            mView.setCheckerboardColor(tab.getCheckerboardColor());
+            mView.setBackgroundColor(tab.getBackgroundColor());
             setZoomConstraints(tab.getZoomConstraints());
 
             // At this point, we have just switched to displaying a different document than we
             // we previously displaying. This means we need to abort any panning/zooming animations
             // that are in progress and send an updated display port request to browser.js as soon
             // as possible. We accomplish this by passing true to abortPanZoomAnimation, which
             // sends the request after aborting the animation. The display port request is actually
             // a full viewport update, which is fine because if browser.js has somehow moved to
@@ -510,17 +484,16 @@ public class GeckoLayerClient
             // Indicate that the document is about to be composited so the
             // LayerView background can be removed.
             if (mView.getPaintState() == LayerView.PAINT_START) {
                 mView.setPaintState(LayerView.PAINT_BEFORE_FIRST);
             }
         }
         DisplayPortCalculator.resetPageState();
         mDrawTimingQueue.reset();
-        mView.getRenderer().resetCheckerboard();
     }
 
     /** This function is invoked by Gecko via JNI; be careful when modifying signature.
       * The compositor invokes this function whenever it determines that the page rect
       * has changed (based on the information it gets from layout). If setFirstPaintViewport
       * is invoked on a frame, then this function will not be. For any given frame, this
       * function will be invoked before syncViewportInfo.
       */
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -44,17 +44,16 @@ public class LayerRenderer implements Ta
      */
     private static final int MAX_FRAME_TIME = 16;   /* 1000 ms / 60 FPS */
 
     private static final int FRAME_RATE_METER_WIDTH = 128;
     private static final int FRAME_RATE_METER_HEIGHT = 32;
 
     private final LayerView mView;
     private final SingleTileLayer mBackgroundLayer;
-    private final ScreenshotLayer mScreenshotLayer;
     private final NinePatchTileLayer mShadowLayer;
     private TextLayer mFrameRateLayer;
     private final ScrollbarLayer mHorizScrollLayer;
     private final ScrollbarLayer mVertScrollLayer;
     private final FadeRunnable mFadeRunnable;
     private ByteBuffer mCoordByteBuffer;
     private FloatBuffer mCoordBuffer;
     private RenderContext mLastPageContext;
@@ -121,28 +120,22 @@ public class LayerRenderer implements Ta
     public static final String DEFAULT_FRAGMENT_SHADER =
         "precision highp float;\n" +
         "varying vec2 vTexCoord;\n" +
         "uniform sampler2D sTexture;\n" +
         "void main() {\n" +
         "    gl_FragColor = texture2D(sTexture, vTexCoord);\n" +
         "}\n";
 
-    public void resetCheckerboard() {
-        mScreenshotLayer.reset();
-    }
-
     public LayerRenderer(LayerView view) {
         mView = view;
 
         CairoImage backgroundImage = new BufferedCairoImage(view.getBackgroundPattern());
         mBackgroundLayer = new SingleTileLayer(true, backgroundImage);
 
-        mScreenshotLayer = ScreenshotLayer.create();
-
         CairoImage shadowImage = new BufferedCairoImage(view.getShadowPattern());
         mShadowLayer = new NinePatchTileLayer(shadowImage);
 
         mHorizScrollLayer = ScrollbarLayer.create(this, false);
         mVertScrollLayer = ScrollbarLayer.create(this, true);
         mFadeRunnable = new FadeRunnable();
 
         mFrameTimings = new int[60];
@@ -156,17 +149,16 @@ public class LayerRenderer implements Ta
 
         Tabs.registerOnTabsChangedListener(this);
     }
 
     public void destroy() {
         DirectBufferAllocator.free(mCoordByteBuffer);
         mCoordByteBuffer = null;
         mCoordBuffer = null;
-        mScreenshotLayer.destroy();
         mBackgroundLayer.destroy();
         mShadowLayer.destroy();
         mHorizScrollLayer.destroy();
         mVertScrollLayer.destroy();
         if (mFrameRateLayer != null) {
             mFrameRateLayer.destroy();
         }
     }
@@ -452,17 +444,16 @@ public class LayerRenderer implements Ta
                 }
             }
             mLastPageContext = mPageContext;
 
             /* Update layers. */
             if (rootLayer != null) mUpdated &= rootLayer.update(mPageContext);  // called on compositor thread
             mUpdated &= mBackgroundLayer.update(mScreenContext);    // called on compositor thread
             mUpdated &= mShadowLayer.update(mPageContext);  // called on compositor thread
-            mUpdated &= mScreenshotLayer.update(mPageContext);   // called on compositor thread
             if (mFrameRateLayer != null) mUpdated &= mFrameRateLayer.update(mScreenContext); // called on compositor thread
             mUpdated &= mVertScrollLayer.update(mPageContext);  // called on compositor thread
             mUpdated &= mHorizScrollLayer.update(mPageContext); // called on compositor thread
 
             for (Layer layer : mExtraLayers)
                 mUpdated &= layer.update(mPageContext); // called on compositor thread
         }
 
@@ -505,17 +496,17 @@ public class LayerRenderer implements Ta
             return mask;
         }
 
         /** This function is invoked via JNI; be careful when modifying signature. */
         public void drawBackground() {
             GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
 
             /* Update background color. */
-            mBackgroundColor = mView.getCheckerboardColor();
+            mBackgroundColor = mView.getBackgroundColor();
 
             /* Clear to the page background colour. The bits set here need to
              * match up with those used in gfx/layers/opengl/LayerManagerOGL.cpp.
              */
             GLES20.glClearColor(((mBackgroundColor>>16)&0xFF) / 255.0f,
                                 ((mBackgroundColor>>8)&0xFF) / 255.0f,
                                 (mBackgroundColor&0xFF) / 255.0f,
                                 0.0f);
@@ -524,31 +515,16 @@ public class LayerRenderer implements Ta
 
             /* Draw the background. */
             mBackgroundLayer.setMask(mPageRect);
             mBackgroundLayer.draw(mScreenContext);
 
             /* Draw the drop shadow, if we need to. */
             if (!new RectF(mAbsolutePageRect).contains(mFrameMetrics.getViewport()))
                 mShadowLayer.draw(mPageContext);
-
-            /* Draw the 'checkerboard'. We use gfx.show_checkerboard_pattern to
-             * determine whether to draw the screenshot layer.
-             */
-            if (mView.checkerboardShouldShowChecks()) {
-                /* Find the area the root layer will render into, to mask the checkerboard layer */
-                Rect rootMask = getMaskForLayer(mView.getLayerClient().getRoot());
-                mScreenshotLayer.setMask(rootMask);
-
-                /* Scissor around the page-rect, in case the page has shrunk
-                 * since the screenshot layer was last updated.
-                 */
-                setScissorRect(); // Calls glEnable(GL_SCISSOR_TEST))
-                mScreenshotLayer.draw(mPageContext);
-            }
         }
 
         // Draws the layer the client added to us.
         void drawRootLayer() {
             Layer rootLayer = mView.getLayerClient().getRoot();
             if (rootLayer == null) {
                 return;
             }
@@ -640,13 +616,13 @@ public class LayerRenderer implements Ta
 
     @Override
     public void onTabChanged(final Tab tab, Tabs.TabEvents msg, Object data) {
         // Sets the background of the newly selected tab. This background color
         // gets cleared in endDrawing(). This function runs on the UI thread,
         // but other code that touches the paint state is run on the compositor
         // thread, so this may need to be changed if any problems appear.
         if (msg == Tabs.TabEvents.SELECTED) {
-            mView.getChildAt(0).setBackgroundColor(tab.getCheckerboardColor());
+            mView.getChildAt(0).setBackgroundColor(tab.getBackgroundColor());
             mView.setPaintState(LayerView.PAINT_START);
         }
     }
 }
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -47,18 +47,17 @@ public class LayerView extends FrameLayo
 
     private GeckoLayerClient mLayerClient;
     private TouchEventHandler mTouchEventHandler;
     private GLController mGLController;
     private InputConnectionHandler mInputConnectionHandler;
     private LayerRenderer mRenderer;
     /* Must be a PAINT_xxx constant */
     private int mPaintState;
-    private int mCheckerboardColor;
-    private boolean mCheckerboardShouldShowChecks;
+    private int mBackgroundColor;
     private boolean mFullScreen;
 
     private SurfaceView mSurfaceView;
     private TextureView mTextureView;
 
     private Listener mListener;
 
     /* Flags used to determine when to show the painted surface. */
@@ -89,18 +88,17 @@ public class LayerView extends FrameLayo
         } */
     }
 
     public LayerView(Context context, AttributeSet attrs) {
         super(context, attrs);
 
         mGLController = new GLController(this);
         mPaintState = PAINT_START;
-        mCheckerboardColor = Color.WHITE;
-        mCheckerboardShouldShowChecks = true;
+        mBackgroundColor = Color.WHITE;
     }
 
     public void initializeView(EventDispatcher eventDispatcher) {
         mLayerClient = new GeckoLayerClient(getContext(), this, eventDispatcher);
 
         mTouchEventHandler = new TouchEventHandler(getContext(), this, mLayerClient);
         mRenderer = new LayerRenderer(this);
         mInputConnectionHandler = null;
@@ -183,31 +181,22 @@ public class LayerView extends FrameLayo
     public void abortPanning() {
         mLayerClient.getPanZoomController().abortPanning();
     }
 
     public PointF convertViewPointToLayerPoint(PointF viewPoint) {
         return mLayerClient.convertViewPointToLayerPoint(viewPoint);
     }
 
-    int getCheckerboardColor() {
-        return mCheckerboardColor;
+    int getBackgroundColor() {
+        return mBackgroundColor;
     }
 
-    public void setCheckerboardColor(int newColor) {
-        mCheckerboardColor = newColor;
-        requestRender();
-    }
-
-    boolean checkerboardShouldShowChecks() {
-        return mCheckerboardShouldShowChecks;
-    }
-
-    void setCheckerboardShouldShowChecks(boolean value) {
-        mCheckerboardShouldShowChecks = value;
+    public void setBackgroundColor(int newColor) {
+        mBackgroundColor = newColor;
         requestRender();
     }
 
     public void setZoomConstraints(ZoomConstraints constraints) {
         mLayerClient.setZoomConstraints(constraints);
     }
 
     public void setViewportSize(int width, int height) {
deleted file mode 100644
--- a/mobile/android/base/gfx/ScreenshotLayer.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.mozglue.DirectBufferAllocator;
-
-import android.graphics.Bitmap;
-import android.graphics.Rect;
-import android.util.Log;
-
-import java.nio.ByteBuffer;
-
-public class ScreenshotLayer extends SingleTileLayer {
-    private static final int SCREENSHOT_SIZE_LIMIT = 1048576;
-    private static final int BYTES_FOR_16BPP = 2;
-    private ScreenshotImage mImage;
-    // Size of the image buffer
-    private IntSize mBufferSize;
-    // The size of the bitmap painted in the buffer
-    // (may be smaller than mBufferSize due to power of 2 padding)
-    private IntSize mImageSize;
-    // Whether we have an up-to-date image to draw
-    private boolean mHasImage;
-    private static String LOGTAG = "GeckoScreenshot";
-
-    public void reset() {
-        mHasImage = false;
-    }
-
-    void setBitmap(ByteBuffer data, int width, int height, Rect rect) throws IllegalArgumentException {
-        mImageSize = new IntSize(width, height);
-        if (IntSize.isPowerOfTwo(width) && IntSize.isPowerOfTwo(height)) {
-            mBufferSize = mImageSize;
-            mHasImage = true;
-            mImage.setBitmap(data, width, height, CairoImage.FORMAT_RGB16_565, rect);
-        } else {
-            throw new IllegalArgumentException("### unexpected size in setBitmap: w="+width+" h="+height);
-        }
-    }
-    
-    void setBitmap(Bitmap bitmap) throws IllegalArgumentException {
-        mImageSize = new IntSize(bitmap.getWidth(), bitmap.getHeight());
-        int width = IntSize.nextPowerOfTwo(bitmap.getWidth());
-        int height = IntSize.nextPowerOfTwo(bitmap.getHeight());
-        mBufferSize = new IntSize(width, height);
-        mImage.setBitmap(bitmap, width, height, CairoImage.FORMAT_RGB16_565);
-        mHasImage = true;
-    }
-
-    public static ScreenshotLayer create() {
-        return ScreenshotLayer.create(new IntSize(4, 4));
-    }
-
-    public static ScreenshotLayer create(IntSize size) {
-        Bitmap bitmap = Bitmap.createBitmap(size.width, size.height, Bitmap.Config.RGB_565);
-        ScreenshotLayer sl = create(bitmap);
-        sl.reset();
-        return sl;
-    }
-
-    public static ScreenshotLayer create(Bitmap bitmap) {
-        IntSize size = new IntSize(bitmap.getWidth(), bitmap.getHeight());
-        // allocate a buffer that can hold our max screenshot size
-        ByteBuffer buffer = DirectBufferAllocator.allocate(SCREENSHOT_SIZE_LIMIT * BYTES_FOR_16BPP);
-        // construct the screenshot layer
-        ScreenshotLayer sl =  new ScreenshotLayer(new ScreenshotImage(buffer, size.width, size.height, CairoImage.FORMAT_RGB16_565), size);
-        // paint the passed in bitmap into the buffer
-        try {
-            sl.setBitmap(bitmap);
-        } catch (IllegalArgumentException ex) {
-            Log.e(LOGTAG, "error setting bitmap: ", ex);
-        }
-        return sl;
-    }
-
-    private ScreenshotLayer(ScreenshotImage image, IntSize size) {
-        super(image, TileLayer.PaintMode.NORMAL);
-        mBufferSize = size;
-        mImage = image;
-    }
-
-    @Override
-    public void draw(RenderContext context) {
-        if (mHasImage)
-            super.draw(context);
-    }
-
-    /** A Cairo image that simply saves a buffer of pixel data. */
-    static class ScreenshotImage extends CairoImage {
-        private ByteBuffer mBuffer;
-        private IntSize mSize;
-        private int mFormat;
-
-        /** Creates a buffered Cairo image from a byte buffer. */
-        public ScreenshotImage(ByteBuffer inBuffer, int inWidth, int inHeight, int inFormat) {
-            mBuffer = inBuffer;
-            mSize = new IntSize(inWidth, inHeight);
-            mFormat = inFormat;
-        }
-
-        @Override
-        public synchronized void destroy() {
-            try {
-                DirectBufferAllocator.free(mBuffer);
-                mBuffer = null;
-            } catch (Exception ex) {
-                Log.e(LOGTAG, "error clearing buffers: ", ex);
-            }
-        }
-
-        private void copyBuffer(ByteBuffer src, ByteBuffer dst, Rect rect, int stride) {
-            int start = (rect.top * stride) + (rect.left * BYTES_FOR_16BPP);
-            int end = ((rect.bottom - 1) * stride) + (rect.right * BYTES_FOR_16BPP);
-            // clamp stuff just to be safe
-            start = Math.max(0, Math.min(dst.limit(), Math.min(src.limit(), start)));
-            end = Math.max(start, Math.min(dst.limit(), Math.min(src.capacity(), end)));
-            dst.position(start);
-            src.position(start).limit(end);
-            // This allocates a lot of memory and can fail sometimes. Handling the
-            // exception is better than crashing.
-            try {
-                dst.put(src);
-            } catch (OutOfMemoryError e) {
-            }
-        }
-
-        synchronized void setBitmap(ByteBuffer data, int width, int height, int format, Rect rect) {
-            if (mBuffer == null) {
-                return;
-            }
-            mSize = new IntSize(width, height);
-            mFormat = format;
-            copyBuffer(data.asReadOnlyBuffer(), mBuffer.duplicate(), rect, width * BYTES_FOR_16BPP);
-        }
-
-        synchronized void setBitmap(Bitmap bitmap, int width, int height, int format) throws IllegalArgumentException {
-            if (mBuffer == null) {
-                return;
-            }
-            mSize = new IntSize(width, height);
-            mFormat = format;
-            if (width == bitmap.getWidth() && height == bitmap.getHeight()) {
-                bitmap.copyPixelsToBuffer(mBuffer.asIntBuffer());
-            } else {
-                throw new IllegalArgumentException("### unexpected size in setBitmap: w="+width+" h="+height);
-            }
-        }
-
-        @Override
-        synchronized public ByteBuffer getBuffer() { return mBuffer; }
-        @Override
-        synchronized public IntSize getSize() { return mSize; }
-        @Override
-        synchronized public int getFormat() { return mFormat; }
-    }
-}
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -290,24 +290,16 @@ var BrowserApp = {
 
     // notify java that gecko has loaded
     sendMessageToJava({
       gecko: {
         type: "Gecko:Ready"
       }
     });
 
-    // after gecko has loaded, set the checkerboarding pref once at startup (for testing only)
-    sendMessageToJava({
-      gecko: {
-        "type": "Checkerboard:Toggle",
-        "value": Services.prefs.getBoolPref("gfx.show_checkerboard_pattern")
-      }
-    });
-
 #ifdef MOZ_SAFE_BROWSING
     // Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
     setTimeout(function() { SafeBrowsing.init(); }, 5000);
 #endif
   },
 
   isAppUpdated: function() {
     let savedmstone = null;