mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 696319 - Scroll window as needed when soft keyboard is up [r=mfinkle]
Send an event to scroll to the focused input field when the soft keyboard comes up. Ensure that this happens *after* the viewport change event is sent to Gecko, so that Gecko actually knows that browser viewport is smaller and doesn't just no-op the scroll request.
This commit is contained in:
parent
e5c4a68d11
commit
ca310383d4
@ -1572,4 +1572,10 @@ public class GeckoAppShell
|
||||
|
||||
accessibilityManager.sendAccessibilityEvent(event);
|
||||
}
|
||||
|
||||
public static void viewSizeChanged() {
|
||||
if (mInputConnection != null && mInputConnection.isIMEEnabled()) {
|
||||
sendEventToGecko(new GeckoEvent("ScrollTo:FocusedInput", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -911,6 +911,10 @@ public class GeckoInputConnection
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isIMEEnabled() {
|
||||
// make sure this picks up PASSWORD and PLUGIN states as well
|
||||
return mIMEState != IME_STATE_DISABLED;
|
||||
}
|
||||
|
||||
public void notifyIME(int type, int state) {
|
||||
|
||||
|
@ -85,6 +85,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
||||
private static final long MIN_VIEWPORT_CHANGE_DELAY = 350L;
|
||||
private long mLastViewportChangeTime;
|
||||
private boolean mPendingViewportAdjust;
|
||||
private boolean mViewportSizeChanged;
|
||||
|
||||
public GeckoSoftwareLayerClient(Context context) {
|
||||
mContext = context;
|
||||
@ -227,6 +228,11 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
||||
render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viewportSizeChanged() {
|
||||
mViewportSizeChanged = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
adjustViewportWithThrottling();
|
||||
@ -266,6 +272,10 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
||||
|
||||
GeckoEvent event = new GeckoEvent("Viewport:Change", viewportMetrics.toJSON());
|
||||
GeckoAppShell.sendEventToGecko(event);
|
||||
if (mViewportSizeChanged) {
|
||||
mViewportSizeChanged = false;
|
||||
GeckoAppShell.viewSizeChanged();
|
||||
}
|
||||
|
||||
mLastViewportChangeTime = System.currentTimeMillis();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public abstract class LayerClient {
|
||||
private LayerController mLayerController;
|
||||
|
||||
public abstract void geometryChanged();
|
||||
public abstract void viewportSizeChanged();
|
||||
protected abstract void render();
|
||||
|
||||
public LayerController getLayerController() { return mLayerController; }
|
||||
|
@ -162,6 +162,9 @@ public class LayerController {
|
||||
mViewportMetrics.setSize(size);
|
||||
setForceRedraw();
|
||||
|
||||
if (mLayerClient != null)
|
||||
mLayerClient.viewportSizeChanged();
|
||||
|
||||
notifyLayerClientOfGeometryChange();
|
||||
mPanZoomController.geometryChanged(false);
|
||||
mView.requestRender();
|
||||
|
@ -142,6 +142,8 @@ public class PlaceholderLayerClient extends LayerClient {
|
||||
@Override
|
||||
public void geometryChanged() { /* no-op */ }
|
||||
@Override
|
||||
public void viewportSizeChanged() { /* no-op */ }
|
||||
@Override
|
||||
public void render() { /* no-op */ }
|
||||
|
||||
@Override
|
||||
|
@ -518,8 +518,10 @@ var BrowserApp = {
|
||||
if (!doc)
|
||||
return;
|
||||
let focused = doc.activeElement;
|
||||
if ((focused instanceof HTMLInputElement && focused.mozIsTextField(false)) || (focused instanceof HTMLTextAreaElement))
|
||||
if ((focused instanceof HTMLInputElement && focused.mozIsTextField(false)) || (focused instanceof HTMLTextAreaElement)) {
|
||||
focused.scrollIntoView(false);
|
||||
BrowserApp.getTabForBrowser(aBrowser).sendViewportUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
getDrawMetadata: function getDrawMetadata() {
|
||||
|
Loading…
Reference in New Issue
Block a user