| Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
|
| index f0c5e8cdf860e31f5b2ffafd12281e6788e843ae..c64ded9e6b308b84d461e9a86cb7d215e0c802ab 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
|
| @@ -19,6 +19,15 @@ class InfoBarWrapper extends FrameLayout {
|
|
|
| private final InfoBarContainerLayout.Item mItem;
|
|
|
| + /** Whether or not the height of the layout should be restricted for animations. */
|
| + private boolean mRestrictHeightForAnimation;
|
| +
|
| + /**
|
| + * The height in px that this view will be restricted to if
|
| + * {@link #mRestrictHeightForAnimation} is set.
|
| + */
|
| + private int mHeightForAnimationPx;
|
| +
|
| /**
|
| * Constructor for inflating from Java.
|
| */
|
| @@ -33,6 +42,22 @@ class InfoBarWrapper extends FrameLayout {
|
| // setBackgroundResource() changes the padding, so call setPadding() second.
|
| setBackgroundResource(R.drawable.infobar_wrapper_bg);
|
| setPadding(0, shadowHeight, 0, 0);
|
| + setClipChildren(true);
|
| + }
|
| +
|
| + /**
|
| + * @param restrict Whether or not the height of this view should be restricted for animations.
|
| + */
|
| + public void setRestrictHeightForAnimation(boolean restrict) {
|
| + mRestrictHeightForAnimation = restrict;
|
| + }
|
| +
|
| + /**
|
| + * @param heightPx The restricted height in px that will be used if
|
| + * {@link #mRestrictHeightForAnimation} is set.
|
| + */
|
| + public void setHeightForAnimation(int heightPx) {
|
| + mHeightForAnimationPx = heightPx;
|
| }
|
|
|
| InfoBarContainerLayout.Item getItem() {
|
| @@ -40,6 +65,16 @@ class InfoBarWrapper extends FrameLayout {
|
| }
|
|
|
| @Override
|
| + public void onMeasure(int widthSpec, int heightSpec) {
|
| + if (mRestrictHeightForAnimation) {
|
| + int heightPx = Math.min(mHeightForAnimationPx, MeasureSpec.getSize(heightSpec));
|
| + heightSpec = MeasureSpec.makeMeasureSpec(heightPx, MeasureSpec.getMode(heightSpec));
|
| + }
|
| +
|
| + super.onMeasure(widthSpec, heightSpec);
|
| + }
|
| +
|
| + @Override
|
| public void onViewAdded(View child) {
|
| child.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
|
| Gravity.TOP));
|
|
|