Bug 1396951 - 2. Don't use getLayerView() in GeckoInputConnection; r=esawin

In GeckoInputConnection, use the current view available through
`getView()`, instead of using `GeckoAppShell.getLayerView()`.

MozReview-Commit-ID: Hc9AUz5SNEs

--HG--
extra : rebase_source : 3e55c4ac8749b75e6f5bc50a2b706f7f4ad264e8
This commit is contained in:
Jim Chen 2017-09-21 17:36:02 -04:00
Родитель d96a907c4c
Коммит 59b8506da3
1 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -72,7 +72,7 @@ class GeckoInputConnection
private String mCurrentInputMethod = "";
private final View mView;
private final GeckoView mView;
private final GeckoEditableClient mEditableClient;
protected int mBatchEditCount;
private ExtractedTextRequest mUpdateRequest;
@ -83,7 +83,7 @@ class GeckoInputConnection
// Prevent showSoftInput and hideSoftInput from causing reentrant calls on some devices.
private volatile boolean mSoftInputReentrancyGuard;
public static GeckoEditableListener create(View targetView,
public static GeckoEditableListener create(GeckoView targetView,
GeckoEditableClient editable) {
if (DEBUG)
return DebugGeckoInputConnection.create(targetView, editable);
@ -91,7 +91,7 @@ class GeckoInputConnection
return new GeckoInputConnection(targetView, editable);
}
protected GeckoInputConnection(View targetView,
protected GeckoInputConnection(GeckoView targetView,
GeckoEditableClient editable) {
super(targetView, true);
mView = targetView;
@ -204,7 +204,7 @@ class GeckoInputConnection
return extract;
}
private View getView() {
private GeckoView getView() {
return mView;
}
@ -236,7 +236,10 @@ class GeckoInputConnection
v.clearFocus();
v.requestFocus();
}
GeckoAppShell.getLayerView().getDynamicToolbarAnimator().showToolbar(/*immediately*/true);
final GeckoView view = getView();
if (view != null) {
view.getDynamicToolbarAnimator().showToolbar(/*immediately*/ true);
}
mSoftInputReentrancyGuard = true;
imm.showSoftInput(v, 0);
mSoftInputReentrancyGuard = false;
@ -359,18 +362,18 @@ class GeckoInputConnection
mCursorAnchorInfoBuilder.reset();
// Calculate Gecko logical coords to screen coords
final View v = getView();
if (v == null) {
final GeckoView view = getView();
if (view == null) {
return;
}
int[] viewCoords = new int[2];
v.getLocationOnScreen(viewCoords);
view.getLocationOnScreen(viewCoords);
DynamicToolbarAnimator animator = GeckoAppShell.getLayerView().getDynamicToolbarAnimator();
float toolbarHeight = (float)animator.getCurrentToolbarHeight();
DynamicToolbarAnimator animator = view.getDynamicToolbarAnimator();
float toolbarHeight = (float) animator.getCurrentToolbarHeight();
Matrix matrix = GeckoAppShell.getLayerView().getMatrixForLayerRectToViewRect();
Matrix matrix = view.getMatrixForLayerRectToViewRect();
if (matrix == null) {
if (DEBUG) {
Log.d(LOGTAG, "Cannot get Matrix to convert from Gecko coords to layer view coords");
@ -1034,13 +1037,13 @@ final class DebugGeckoInputConnection
private InputConnection mProxy;
private final StringBuilder mCallLevel;
private DebugGeckoInputConnection(View targetView,
private DebugGeckoInputConnection(GeckoView targetView,
GeckoEditableClient editable) {
super(targetView, editable);
mCallLevel = new StringBuilder();
}
public static GeckoEditableListener create(View targetView,
public static GeckoEditableListener create(GeckoView targetView,
GeckoEditableClient editable) {
final Class<?>[] PROXY_INTERFACES = { InputConnection.class,
InputConnectionListener.class,