Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab099c49 authored by Alan Viverette's avatar Alan Viverette
Browse files

Correctly handle child drawables with no intrinsic size

If a child drawable has no intrinsic width or height, don't attempt to
apply padding and insets to the child during the parent layer drawable's
intrinsic width and height calculations.

Bug: 25461370
Change-Id: Idf616bde0449231f38156da53feb858e1ae41c47
parent 978db409
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1601,8 +1601,10 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
                insetR = r.mInsetE == UNDEFINED_INSET ? r.mInsetR : r.mInsetE;
            }

            // Don't apply padding and insets for children that don't have
            // an intrinsic dimension.
            final int minWidth = r.mWidth < 0 ? r.mDrawable.getIntrinsicWidth() : r.mWidth;
            final int w = minWidth + insetL + insetR + padL + padR;
            final int w = minWidth < 0 ? -1 : minWidth + insetL + insetR + padL + padR;
            if (w > width) {
                width = w;
            }
@@ -1631,8 +1633,10 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
                continue;
            }

            // Don't apply padding and insets for children that don't have
            // an intrinsic dimension.
            final int minHeight = r.mHeight < 0 ? r.mDrawable.getIntrinsicHeight() : r.mHeight;
            final int h = minHeight + r.mInsetT + r.mInsetB + padT + padB;
            final int h = minHeight < 0 ? -1 : minHeight + r.mInsetT + r.mInsetB + padT + padB;
            if (h > height) {
                height = h;
            }