зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1396951 - 3. Move GeckoAppShell.viewSizeChanged() to GeckoLayerClient; r=rbarker
Let `GeckoLayerClient` directly deal with scroll-to-input on resize, instead of going through `GeckoAppShell` and relying on `getLayerView()`. This is a necessary fix to let us remove `getLayerView()`, and in a follow-up bug we should actually fix scroll-to-input to work on any GeckoView. MozReview-Commit-ID: 1xsHh2vg08M --HG-- extra : rebase_source : 3061623d3ed0309fff42c6dc66d0246e1d3000a3
This commit is contained in:
Родитель
d4b6b64543
Коммит
a6188cfc76
|
@ -1584,21 +1584,6 @@ public class GeckoAppShell
|
|||
return HardwareUtils.isTablet();
|
||||
}
|
||||
|
||||
private static boolean sImeWasEnabledOnLastResize = false;
|
||||
public static void viewSizeChanged() {
|
||||
GeckoView v = (GeckoView) getLayerView();
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
boolean imeIsEnabled = v.isIMEEnabled();
|
||||
if (imeIsEnabled && !sImeWasEnabledOnLastResize) {
|
||||
// The IME just came up after not being up, so let's scroll
|
||||
// to the focused input.
|
||||
EventDispatcher.getInstance().dispatch("ScrollTo:FocusedInput", null);
|
||||
}
|
||||
sImeWasEnabledOnLastResize = imeIsEnabled;
|
||||
}
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
private static double[] getCurrentNetworkInformation() {
|
||||
return GeckoNetworkManager.getInstance().getCurrentInformation();
|
||||
|
|
|
@ -751,7 +751,8 @@ public class GeckoView extends LayerView {
|
|||
mInputConnectionListener.onKeyMultiple(keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
/* package */ boolean isIMEEnabled() {
|
||||
@Override
|
||||
public boolean isIMEEnabled() {
|
||||
return mInputConnectionListener != null &&
|
||||
mInputConnectionListener.isIMEEnabled();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class GeckoLayerClient implements LayerView.Listener
|
|||
private IntSize mWindowSize;
|
||||
|
||||
private boolean mForceRedraw;
|
||||
private boolean mImeWasEnabledOnLastResize;
|
||||
|
||||
/* The current viewport metrics.
|
||||
* This is volatile so that we can read and write to it from different threads.
|
||||
|
@ -153,7 +154,13 @@ class GeckoLayerClient implements LayerView.Listener
|
|||
// the following call also sends gecko a message, which will be processed after the resize
|
||||
// message above has updated the viewport. this message ensures that if we have just put
|
||||
// focus in a text field, we scroll the content so that the text field is in view.
|
||||
GeckoAppShell.viewSizeChanged();
|
||||
final boolean imeIsEnabled = mView.isIMEEnabled();
|
||||
if (imeIsEnabled && !mImeWasEnabledOnLastResize) {
|
||||
// The IME just came up after not being up, so let's scroll
|
||||
// to the focused input.
|
||||
EventDispatcher.getInstance().dispatch("ScrollTo:FocusedInput", null);
|
||||
}
|
||||
mImeWasEnabledOnLastResize = imeIsEnabled;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -824,5 +824,9 @@ public class LayerView extends FrameLayout {
|
|||
if (isCompositorReady()) {
|
||||
mCompositor.setDefaultClearColor(mDefaultClearColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIMEEnabled() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче