Bug 1017242 - Part 3: remove API 8 code from gfx. r=kats
authorRichard Newman <rnewman@mozilla.com>
Fri, 18 Jul 2014 16:47:08 -0700
changeset 216974 5a01eb70b82c3b279de71f92f4a4c9a976b63dcc
parent 216973 4ed35c44168f28bcc5766cd6cf1bf9ef8f702342
child 216975 5be4171df6916924f538d0fd6040ec88e37994b9
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1017242
milestone33.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 1017242 - Part 3: remove API 8 code from gfx. r=kats
mobile/android/base/gfx/LayerView.java
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -1,57 +1,55 @@
 /* -*- 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 java.nio.IntBuffer;
+import java.util.ArrayList;
+
 import org.mozilla.gecko.AndroidGamepadManager;
+import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAccessibility;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.PrefsHelper;
-import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.TouchEventInterceptor;
 import org.mozilla.gecko.ZoomConstraints;
+import org.mozilla.gecko.mozglue.RobocopTarget;
 import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
-import org.mozilla.gecko.mozglue.RobocopTarget;
-import org.mozilla.gecko.EventDispatcher;
 
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
 import android.os.Build;
 import android.os.Handler;
 import android.util.AttributeSet;
-import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.TextureView;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputConnection;
 import android.widget.FrameLayout;
 
-import java.nio.IntBuffer;
-import java.util.ArrayList;
-
 /**
  * A view rendered by the layer compositor.
  *
  * Note that LayerView is accessed by Robocop via reflection.
  */
 public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener {
     private static String LOGTAG = "GeckoLayerView";
 
@@ -137,26 +135,19 @@ public class LayerView extends FrameLayo
         mInputConnectionHandler = null;
 
         setFocusable(true);
         setFocusableInTouchMode(true);
 
         GeckoAccessibility.setDelegate(this);
     }
 
-    private Point getEventRadius(MotionEvent event) {
-        if (Build.VERSION.SDK_INT >= 9) {
-            return new Point((int)event.getToolMajor()/2,
-                             (int)event.getToolMinor()/2);
-        }
-
-        float size = event.getSize();
-        DisplayMetrics displaymetrics = getContext().getResources().getDisplayMetrics();
-        size = size * Math.min(displaymetrics.heightPixels, displaymetrics.widthPixels);
-        return new Point((int)size, (int)size);
+    private static Point getEventRadius(MotionEvent event) {
+        return new Point((int)event.getToolMajor() / 2,
+                         (int)event.getToolMinor() / 2);
     }
 
     public void geckoConnected() {
         // See if we want to force 16-bit colour before doing anything
         PrefsHelper.getPref("gfx.android.rgb16.force", new PrefsHelper.PrefHandlerBase() {
             @Override public void prefValue(String pref, boolean force16bit) {
                 if (force16bit) {
                     GeckoAppShell.setScreenDepthOverride(16);
@@ -662,34 +653,29 @@ public class LayerView extends FrameLayo
 
     @RobocopTarget
     public static interface DrawListener {
         public void drawFinished();
     }
 
     @Override
     public void setOverScrollMode(int overscrollMode) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
-            super.setOverScrollMode(overscrollMode);
-        }
+        super.setOverScrollMode(overscrollMode);
         if (mPanZoomController != null) {
             mPanZoomController.setOverScrollMode(overscrollMode);
         }
     }
 
     @Override
     public int getOverScrollMode() {
         if (mPanZoomController != null) {
             return mPanZoomController.getOverScrollMode();
         }
 
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
-            return super.getOverScrollMode();
-        }
-        return View.OVER_SCROLL_ALWAYS;
+        return super.getOverScrollMode();
     }
 
     @Override
     public void onFocusChanged (boolean gainFocus, int direction, Rect previouslyFocusedRect) {
         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
         GeckoAccessibility.onLayerViewFocusChanged(this, gainFocus);
     }