Bug 1180295 - Update the FormAssistPopup to account for the new dynamic toolbar model. r=rbarker

This commit is contained in:
Kartikaya Gupta 2015-08-18 14:27:20 -04:00
parent 6788df042c
commit c0fe57f305
2 changed files with 17 additions and 4 deletions

View File

@ -1552,6 +1552,10 @@ public class BrowserApp extends GeckoApp
final float offset = getResources().getDimensionPixelOffset(R.dimen.progress_bar_scroll_offset);
final float progressTranslationY = Math.min(aToolbarTranslation, mToolbarHeight - offset);
ViewHelper.setTranslationY(progressView, -progressTranslationY);
if (mFormAssistPopup != null) {
mFormAssistPopup.onTranslationChanged();
}
}
@Override
@ -1560,8 +1564,9 @@ public class BrowserApp extends GeckoApp
return;
}
if (mFormAssistPopup != null)
if (mFormAssistPopup != null) {
mFormAssistPopup.onMetricsChanged(aMetrics);
}
}
@Override

View File

@ -5,6 +5,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.gfx.FloatSize;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.util.GeckoEventListener;
@ -284,12 +285,11 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
}
float zoom = aMetrics.zoomFactor;
PointF offset = aMetrics.getMarginOffset();
// These values correspond to the input box for which we want to
// display the FormAssistPopup.
int left = (int) (mX * zoom - aMetrics.viewportRectLeft + offset.x);
int top = (int) (mY * zoom - aMetrics.viewportRectTop + offset.y);
int left = (int) (mX * zoom - aMetrics.viewportRectLeft);
int top = (int) (mY * zoom - aMetrics.viewportRectTop + ViewHelper.getTranslationY(GeckoAppShell.getLayerView()));
int width = (int) (mW * zoom);
int height = (int) (mH * zoom);
@ -383,6 +383,14 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
broadcastGeckoEvent("FormAssist:Blocklisted", String.valueOf(blocklisted));
}
void onTranslationChanged() {
ThreadUtils.assertOnUiThread();
if (!isShown()) {
return;
}
positionAndShowPopup();
}
void onMetricsChanged(final ImmutableViewportMetrics aMetrics) {
if (!isShown()) {
return;