mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1200181 - Zoomed view and Form Assistant should not be displayed at the same time. r=mcomella
This commit is contained in:
parent
c16b4428e3
commit
616a353f75
@ -78,6 +78,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
private int containterSize; // shadow, margin, ...
|
||||
private Point lastPosition;
|
||||
private boolean shouldSetVisibleOnUpdate;
|
||||
private boolean isBlockedFromAppearing; // Prevent the display of the zoomedview while FormAssistantPopup is visible
|
||||
private PointF returnValue;
|
||||
private final PointF animationStart;
|
||||
private ImageView closeButton;
|
||||
@ -228,6 +229,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
public ZoomedView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
isSimplifiedUI = true;
|
||||
isBlockedFromAppearing = false;
|
||||
getPrefs();
|
||||
currentZoomFactorIndex = 0;
|
||||
returnValue = new PointF();
|
||||
@ -241,7 +243,8 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
touchListener = new ZoomedViewTouchListener();
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener(this,
|
||||
"Gesture:clusteredLinksClicked", "Window:Resize", "Content:LocationChange",
|
||||
"Gesture:CloseZoomedView", "Browser:ZoomToPageWidth", "Browser:ZoomToRect");
|
||||
"Gesture:CloseZoomedView", "Browser:ZoomToPageWidth", "Browser:ZoomToRect",
|
||||
"FormAssist:AutoComplete", "FormAssist:Hide");
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
@ -250,7 +253,8 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
ThreadUtils.removeCallbacksFromUiThread(requestRenderRunnable);
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
|
||||
"Gesture:clusteredLinksClicked", "Window:Resize", "Content:LocationChange",
|
||||
"Gesture:CloseZoomedView", "Browser:ZoomToPageWidth", "Browser:ZoomToRect");
|
||||
"Gesture:CloseZoomedView", "Browser:ZoomToPageWidth", "Browser:ZoomToRect",
|
||||
"FormAssist:AutoComplete", "FormAssist:Hide");
|
||||
}
|
||||
|
||||
// This method (onFinishInflate) is called only when the zoomed view class is used inside
|
||||
@ -541,6 +545,9 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
}
|
||||
|
||||
private void startZoomDisplay(LayerView aLayerView, final int leftFromGecko, final int topFromGecko) {
|
||||
if (isBlockedFromAppearing) {
|
||||
return;
|
||||
}
|
||||
if (layerView == null) {
|
||||
layerView = aLayerView;
|
||||
layerView.addZoomedViewListener(this);
|
||||
@ -625,6 +632,11 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
event.equals("Browser:ZoomToPageWidth") ||
|
||||
event.equals("Browser:ZoomToRect")) {
|
||||
stopZoomDisplay(true);
|
||||
} else if (event.equals("FormAssist:AutoComplete")) {
|
||||
isBlockedFromAppearing = true;
|
||||
stopZoomDisplay(true);
|
||||
} else if (event.equals("FormAssist:Hide")) {
|
||||
isBlockedFromAppearing = false;
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e(LOGTAG, "JSON exception", e);
|
||||
|
@ -4808,10 +4808,12 @@ var BrowserEventHandler = {
|
||||
break;
|
||||
|
||||
case "Gesture:SingleTap": {
|
||||
let focusedElement = null;
|
||||
try {
|
||||
// If the element was previously focused, show the caret attached to it.
|
||||
let element = this._highlightElement;
|
||||
if (element && element == BrowserApp.getFocusedInput(BrowserApp.selectedBrowser)) {
|
||||
focusedElement = BrowserApp.getFocusedInput(BrowserApp.selectedBrowser);
|
||||
if (element && element == focusedElement) {
|
||||
let result = SelectionHandler.attachCaret(element);
|
||||
if (result !== SelectionHandler.ERROR_NONE) {
|
||||
dump("Unexpected failure during caret attach: " + result);
|
||||
@ -4825,6 +4827,17 @@ var BrowserEventHandler = {
|
||||
let {x, y} = data;
|
||||
|
||||
if (this._inCluster && this._clickInZoomedView != true) {
|
||||
// If there is a focused element, the display of the zoomed view won't remove the focus.
|
||||
// In this case, the form assistant linked to the focused element will never be closed.
|
||||
// To avoid this situation, the focus is moved and the form assistant is closed.
|
||||
if (focusedElement) {
|
||||
try {
|
||||
Services.focus.moveFocus(BrowserApp.selectedBrowser.contentWindow, null, Services.focus.MOVEFOCUS_ROOT, 0);
|
||||
} catch(e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
Messaging.sendRequest({ type: "FormAssist:Hide" });
|
||||
}
|
||||
this._clusterClicked(x, y);
|
||||
} else {
|
||||
if (this._clickInZoomedView != true) {
|
||||
|
Loading…
Reference in New Issue
Block a user