Bug 1434925 - Skip drawing hidden toolbar elements; r=rbarker
authorJim Chen <nchen@mozilla.com>
Thu, 08 Feb 2018 13:55:15 -0500
changeset 752923 032ad85ded1f4a4903ffc33aed865f5c968db5d1
parent 752922 ad9f6cf50e5d1859c6056094f0d3b1dc96ec95cb
child 752924 74f5b6977fbe159d5d4ee7e4fd94a15d496ee325
push id98429
push usermak77@bonardo.net
push dateFri, 09 Feb 2018 10:14:12 +0000
reviewersrbarker
bugs1434925
milestone60.0a1
Bug 1434925 - Skip drawing hidden toolbar elements; r=rbarker Apparently a toolbar element can be zero-sized when we try to draw it to the bitmap. We should just skip drawing in that case. MozReview-Commit-ID: LlFQX5uN20h
mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/CanvasDelegate.java
@@ -30,16 +30,20 @@ class CanvasDelegate {
 
         // DST_IN masks, DST_OUT clips.
         mMode = new PorterDuffXfermode(mode);
 
         mPaint = paint;
     }
 
     void draw(Canvas canvas, Path path, int width, int height) {
+        if (width <= 0 || height <= 0) {
+            return;
+        }
+
         Bitmap offscreen = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
         Canvas offscreenCanvas = new Canvas(offscreen);
 
         // Do a default draw.
         mDrawManager.defaultDraw(offscreenCanvas);
 
         if (path != null && !path.isEmpty()) {
             // ICS added double-buffering, which made it easier for drawing the Path directly over the DST.