Bug 1258789 - Add div* token for WhitespaceAround. r=grisha draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 13 Apr 2016 11:15:00 -0700
changeset 350424 57c8e8c764f5f8fc4f0eb3e2880d741904f34a0d
parent 350423 da676dcd95f836b6ef3ba4d8465ecaf74d1e15e8
child 350425 caacb08f22c88048f9f845a8c5a76a8d57a6e340
push id15341
push usermichael.l.comella@gmail.com
push dateWed, 13 Apr 2016 18:23:14 +0000
reviewersgrisha
bugs1258789
milestone48.0a1
Bug 1258789 - Add div* token for WhitespaceAround. r=grisha Fix some cast issues while I was at it. MozReview-Commit-ID: 53ANWpnIGwk
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
mobile/android/base/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
mobile/android/base/java/org/mozilla/gecko/gfx/PanZoomController.java
mobile/android/base/java/org/mozilla/gecko/gfx/PluginLayer.java
mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java
mobile/android/base/java/org/mozilla/gecko/toolbar/BackButton.java
mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
mobile/android/base/java/org/mozilla/gecko/widget/ThumbnailView.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -56,13 +56,13 @@
         <module name="WhitespaceAround">
             <property name="allowEmptyConstructors" value="true"/>
             <property name="allowEmptyMethods" value="true"/>
             <property name="allowEmptyTypes" value="true"/>
             <property name="allowEmptyLoops" value="true"/>
             <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN,
                     LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
                     LOR, LT, NOT_EQUAL, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND,
-                    PLUS, PLUS_ASSIGN, MOD, MOD_ASSIGN, LE, LAND, GT, GE, RCURLY"/>
+                    PLUS, PLUS_ASSIGN, MOD, MOD_ASSIGN, LE, LAND, GT, GE, RCURLY, DIV, DIV_ASSIGN"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -509,17 +509,17 @@ public class GeckoAppShell
         AlarmManager am = (AlarmManager)
             getApplicationContext().getSystemService(Context.ALARM_SERVICE);
 
         Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class);
         PendingIntent pi = PendingIntent.getBroadcast(
                 getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
 
         // AlarmManager only supports millisecond precision
-        long time = ((long)aSeconds * 1000) + ((long)aNanoSeconds/1_000_000L);
+        long time = ((long) aSeconds * 1000) + ((long) aNanoSeconds / 1_000_000L);
         am.setExact(AlarmManager.RTC_WAKEUP, time, pi);
 
         return true;
     }
 
     @WrapForJNI
     public static void disableAlarm() {
         AlarmManager am = (AlarmManager)
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
@@ -317,21 +317,21 @@ public class GeckoEvent {
             // the radius is found by removing the orientation and measuring the x and y
             // radius of the resulting ellipse
             // for android orientations >= 0 and < 90, the major axis should correspond to
             // just reporting the y radius as the major one, and x as minor
             // however, for a radius < 0, we have to shift the orientation by adding 90, and
             // reverse which radius is major and minor
             if (mOrientations[index] < 0) {
                 mOrientations[index] += 90;
-                mPointRadii[index] = new Point((int)event.getToolMajor(eventIndex)/2,
-                                               (int)event.getToolMinor(eventIndex)/2);
+                mPointRadii[index] = new Point((int) event.getToolMajor(eventIndex) / 2,
+                                               (int) event.getToolMinor(eventIndex) / 2);
             } else {
-                mPointRadii[index] = new Point((int)event.getToolMinor(eventIndex)/2,
-                                               (int)event.getToolMajor(eventIndex)/2);
+                mPointRadii[index] = new Point((int) event.getToolMinor(eventIndex) / 2,
+                                               (int) event.getToolMajor(eventIndex) / 2);
             }
 
             if (!keepInViewCoordinates) {
                 // If we are converting to gecko CSS pixels, then we should adjust the
                 // radii as well
                 float zoom = GeckoAppShell.getLayerView().getViewportMetrics().zoomFactor;
                 mPointRadii[index].x /= zoom;
                 mPointRadii[index].y /= zoom;
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/Axis.java
@@ -130,17 +130,17 @@ abstract class Axis {
             @Override public void finish() {
                 setPrefs(mPrefs);
             }
         });
     }
 
     static final float MS_PER_FRAME = 1000.0f / 60.0f;
     static final long NS_PER_FRAME = Math.round(1000000000f / 60f);
-    private static final float FRAMERATE_MULTIPLIER = (1000f/60f) / MS_PER_FRAME;
+    private static final float FRAMERATE_MULTIPLIER = (1000f / 60f) / MS_PER_FRAME;
     private static final int FLING_VELOCITY_POINTS = 8;
 
     //  The values we use for friction are based on a 16.6ms frame, adjust them to currentNsPerFrame:
     static float getFrameAdjustedFriction(float baseFriction, long currentNsPerFrame) {
         float framerateMultiplier = (float)currentNsPerFrame / NS_PER_FRAME;
         return (float)Math.pow(Math.E, (Math.log(baseFriction) / framerateMultiplier));
     }
 
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/BitmapUtils.java
@@ -329,19 +329,19 @@ public final class BitmapUtils {
         }
       }
 
       // maxBin may never get updated if the image holds only transparent and/or black/white pixels.
       if (maxBin < 0)
         return Color.argb(255, 255, 255, 255);
 
       // Return a color with the average hue/saturation/value of the bin with the most colors.
-      hsv[0] = sumHue[maxBin]/colorBins[maxBin];
-      hsv[1] = sumSat[maxBin]/colorBins[maxBin];
-      hsv[2] = sumVal[maxBin]/colorBins[maxBin];
+      hsv[0] = sumHue[maxBin] / colorBins[maxBin];
+      hsv[1] = sumSat[maxBin] / colorBins[maxBin];
+      hsv[2] = sumVal[maxBin] / colorBins[maxBin];
       return Color.HSVToColor(hsv);
     }
 
     /**
      * Decodes a bitmap from a Base64 data URI.
      *
      * @param dataURI a Base64-encoded data URI string
      * @return        the decoded bitmap, or null if the data URI is invalid
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
@@ -114,17 +114,17 @@ public class ImmutableViewportMetrics {
     public RectF getViewport() {
         return new RectF(viewportRectLeft,
                          viewportRectTop,
                          viewportRectRight(),
                          viewportRectBottom());
     }
 
     public RectF getCssViewport() {
-        return RectUtils.scale(getViewport(), 1/zoomFactor);
+        return RectUtils.scale(getViewport(), 1 / zoomFactor);
     }
 
     public RectF getPageRect() {
         return new RectF(pageRectLeft, pageRectTop, pageRectRight, pageRectBottom);
     }
 
     public float getPageWidth() {
         return pageRectRight - pageRectLeft;
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -53,17 +53,17 @@ class JavaPanZoomController
 
     // Angle from axis within which we stay axis-locked
     private static final double AXIS_LOCK_ANGLE = Math.PI / 6.0; // 30 degrees
 
     // Axis-lock breakout angle
     private static final double AXIS_BREAKOUT_ANGLE = Math.PI / 8.0;
 
     // The distance the user has to pan before we consider breaking out of a locked axis
-    public static final float AXIS_BREAKOUT_THRESHOLD = 1/32f * GeckoAppShell.getDpi();
+    public static final float AXIS_BREAKOUT_THRESHOLD = 1 / 32f * GeckoAppShell.getDpi();
 
     // The maximum amount we allow you to zoom into a page
     private static final float MAX_ZOOM = 4.0f;
 
     // The maximum amount we would like to scroll with the mouse
     private static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi();
 
     // The maximum zoom factor adjustment per frame of the AUTONAV animation
@@ -262,19 +262,19 @@ class JavaPanZoomController
                 RectF cssPageRect = metrics.getCssPageRect();
 
                 RectF viewableRect = metrics.getCssViewport();
                 float y = viewableRect.top;
                 // attempt to keep zoom keep focused on the center of the viewport
                 float newHeight = viewableRect.height() * cssPageRect.width() / viewableRect.width();
                 float dh = viewableRect.height() - newHeight; // increase in the height
                 final RectF r = new RectF(0.0f,
-                                    y + dh/2,
+                                    y + dh / 2,
                                     cssPageRect.width(),
-                                    y + dh/2 + newHeight);
+                                    y + dh / 2 + newHeight);
                 if (message.optBoolean("animate", true)) {
                     mTarget.post(new Runnable() {
                         @Override
                         public void run() {
                             animatedZoomTo(r);
                         }
                     });
                 } else {
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/PanZoomController.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/PanZoomController.java
@@ -11,20 +11,20 @@ import org.mozilla.gecko.EventDispatcher
 import android.graphics.PointF;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
 
 public interface PanZoomController {
     // The distance the user has to pan before we recognize it as such (e.g. to avoid 1-pixel pans
     // between the touch-down and touch-up of a click). In units of density-independent pixels.
-    public static final float PAN_THRESHOLD = 1/16f * GeckoAppShell.getDpi();
+    public static final float PAN_THRESHOLD = 1 / 16f * GeckoAppShell.getDpi();
 
     // Threshold for sending touch move events to content
-    public static final float CLICK_THRESHOLD = 1/50f * GeckoAppShell.getDpi();
+    public static final float CLICK_THRESHOLD = 1 / 50f * GeckoAppShell.getDpi();
 
     static class Factory {
         static PanZoomController create(PanZoomTarget target, View view, EventDispatcher dispatcher) {
             if (org.mozilla.gecko.AppConstants.MOZ_ANDROID_APZ) {
                 return new NativePanZoomController(target, view);
             } else {
                 return new JavaPanZoomController(target, view, dispatcher);
             }
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/PluginLayer.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/PluginLayer.java
@@ -130,20 +130,20 @@ public class PluginLayer extends Layer {
 
             mMaxDimension = maxDimension;
             reset(rect);
         }
 
         private void clampToMaxSize() {
             if (width > mMaxDimension || height > mMaxDimension) {
                 if (width > height) {
-                    height = Math.round(((float)height/ width) * mMaxDimension);
+                    height = Math.round(((float) height / width) * mMaxDimension);
                     width = mMaxDimension;
                 } else {
-                    width = Math.round(((float)width/ height) * mMaxDimension);
+                    width = Math.round(((float) width / height) * mMaxDimension);
                     height = mMaxDimension;
                 }
             }
         }
 
         public void reset(RectF rect) {
             mRect = rect;
         }
--- a/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java
@@ -67,12 +67,12 @@ public class MenuPopup extends PopupWind
     public void showAsDropDown(View anchor) {
         // Set a height, so that the popup will not be displayed below the bottom of the screen.
         // We use the exact height of the internal content, which is the technique described in
         // http://stackoverflow.com/a/7698709
         setHeight(mPanel.getHeight());
 
         // Attempt to align the center of the popup with the center of the anchor. If the anchor is
         // near the edge of the screen, the popup will just align with the edge of the screen.
-        final int xOffset = anchor.getWidth()/2 - mPopupWidth/2;
+        final int xOffset = anchor.getWidth() / 2 - mPopupWidth / 2;
         showAsDropDown(anchor, xOffset, -mYOffset);
     }
 }
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BackButton.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BackButton.java
@@ -13,14 +13,14 @@ public class BackButton extends NavButto
         super(context, attrs);
     }
 
     @Override
     protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
         super.onSizeChanged(width, height, oldWidth, oldHeight);
 
         mPath.reset();
-        mPath.addCircle(width/2, height/2, width/2, Path.Direction.CW);
+        mPath.addCircle(width / 2, height / 2, width / 2, Path.Direction.CW);
 
         mBorderPath.reset();
-        mBorderPath.addCircle(width/2, height/2, (width/2) - (mBorderWidth/2), Path.Direction.CW);
+        mBorderPath.addCircle(width / 2, height / 2, (width / 2) - (mBorderWidth / 2), Path.Direction.CW);
     }
 }
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/SiteIdentityPopup.java
@@ -384,17 +384,17 @@ public class SiteIdentityPopup extends A
 
     private void clearSecurityStateIcon() {
         mSecurityState.setCompoundDrawablePadding(0);
         mSecurityState.setCompoundDrawables(null, null, null, null);
     }
 
     private void setSecurityStateIcon(int resource, int factor) {
         final Drawable stateIcon = ContextCompat.getDrawable(mContext, resource);
-        stateIcon.setBounds(0, 0, stateIcon.getIntrinsicWidth()/factor, stateIcon.getIntrinsicHeight()/factor);
+        stateIcon.setBounds(0, 0, stateIcon.getIntrinsicWidth() / factor, stateIcon.getIntrinsicHeight() / factor);
         mSecurityState.setCompoundDrawables(stateIcon, null, null, null);
         mSecurityState.setCompoundDrawablePadding((int) mResources.getDimension(R.dimen.doorhanger_drawable_padding));
     }
     private void updateIdentityInformation(final SiteIdentity siteIdentity) {
         String owner = siteIdentity.getOwner();
         if (owner == null) {
             mOwner.setVisibility(View.GONE);
             mOwnerSupplemental.setVisibility(View.GONE);
--- a/mobile/android/base/java/org/mozilla/gecko/widget/ThumbnailView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/ThumbnailView.java
@@ -42,17 +42,17 @@ public class ThumbnailView extends Theme
 
         Drawable d = getDrawable();
         if (mLayoutChanged) {
             int w1 = d.getIntrinsicWidth();
             int h1 = d.getIntrinsicHeight();
             int w2 = getWidth();
             int h2 = getHeight();
 
-            float scale = (w2/h2 < w1/h1) ? (float)h2/h1 : (float)w2/w1;
+            float scale = ((w2 / h2) < (w1 / h1)) ? (float) h2 / h1 : (float) w2 / w1;
             mMatrix.setScale(scale, scale);
         }
 
         int saveCount = canvas.save();
         canvas.concat(mMatrix);
         d.draw(canvas);
         canvas.restoreToCount(saveCount);
     }