Bug 1801615 - Remove GeckoSession.SelectionActionDelegate.Selection.clientRect r=geckoview-reviewers,m_kato

Differential Revision: https://phabricator.services.mozilla.com/D170259
This commit is contained in:
Arturo Mejia 2023-02-22 01:39:28 +00:00
parent cb1b4fb0eb
commit 7e62be4d03
5 changed files with 6 additions and 96 deletions

View File

@ -192,53 +192,6 @@ class SelectionActionDelegateChild extends GeckoViewActorChild {
);
}
_getFrameOffset(aEvent) {
// Get correct offset in case of nested iframe.
const offset = {
left: 0,
top: 0,
};
let currentWindow = aEvent.target.defaultView;
while (currentWindow.realFrameElement) {
const frameElement = currentWindow.realFrameElement;
currentWindow = frameElement.ownerGlobal;
// The offset of the iframe window relative to the parent window
// includes the iframe's border, and the iframe's origin in its
// containing document.
const currentRect = frameElement.getBoundingClientRect();
const style = currentWindow.getComputedStyle(frameElement);
const borderLeft = parseFloat(style.borderLeftWidth) || 0;
const borderTop = parseFloat(style.borderTopWidth) || 0;
const paddingLeft = parseFloat(style.paddingLeft) || 0;
const paddingTop = parseFloat(style.paddingTop) || 0;
offset.left += currentRect.left + borderLeft + paddingLeft;
offset.top += currentRect.top + borderTop + paddingTop;
const targetDocShell = currentWindow.docShell;
if (targetDocShell.isMozBrowser) {
break;
}
}
// Now we have coordinates relative to the root content document's
// layout viewport. Subtract the offset of the visual viewport
// relative to the layout viewport, to get coordinates relative to
// the visual viewport.
var offsetX = {};
var offsetY = {};
currentWindow.windowUtils.getVisualViewportOffsetRelativeToLayoutViewport(
offsetX,
offsetY
);
offset.left -= offsetX.value;
offset.top -= offsetY.value;
return offset;
}
_getDefaultMagnifierPoint(aEvent) {
const rect = lazy.LayoutUtils.rectToScreenRect(aEvent.target.ownerGlobal, {
left: aEvent.clientX,
@ -401,23 +354,6 @@ class SelectionActionDelegateChild extends GeckoViewActorChild {
};
})();
const clientRect = (() => {
const boundingRect = aEvent.boundingClientRect;
if (!boundingRect) {
return null;
}
const offset = this._getFrameOffset(aEvent);
return {
left: aEvent.boundingClientRect.left + offset.left,
top: aEvent.boundingClientRect.top + offset.top,
right: aEvent.boundingClientRect.right + offset.left,
bottom:
aEvent.boundingClientRect.bottom +
offset.top +
this._accessiblecaretHeight,
};
})();
const password = this._isPasswordField(aEvent);
const msg = {
@ -425,8 +361,6 @@ class SelectionActionDelegateChild extends GeckoViewActorChild {
editable: aEvent.selectionEditable,
password,
selection: password ? "" : aEvent.selectedTextContent,
// clientRect is deprecated
clientRect,
screenRect,
actions: actions.map(action => action.id),
};

View File

@ -394,8 +394,6 @@ package org.mozilla.geckoview {
field protected boolean mRepopulatedMenu;
field @Nullable protected GeckoSession.SelectionActionDelegate.Selection mSelection;
field @Nullable protected GeckoSession mSession;
field @Deprecated @DeprecationSchedule(id="selection-fission",version=112) @NonNull protected final Matrix mTempMatrix;
field @Deprecated @DeprecationSchedule(id="selection-fission",version=112) @NonNull protected final RectF mTempRect;
field protected final boolean mUseFloatingToolbar;
}
@ -1542,7 +1540,6 @@ package org.mozilla.geckoview {
method @AnyThread public void selectAll();
method @AnyThread public void unselect();
field @NonNull public final Collection<String> availableActions;
field @Deprecated @DeprecationSchedule(id="selection-fission",version=112) @Nullable public final RectF clientRect;
field public final int flags;
field @Nullable public final RectF screenRect;
field @NonNull public final String text;

View File

@ -13,10 +13,8 @@ import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.os.TransactionTooLargeException;
import android.text.TextUtils;
@ -73,14 +71,6 @@ public class BasicSelectionActionDelegate
protected final @NonNull Activity mActivity;
protected final boolean mUseFloatingToolbar;
@Deprecated
@DeprecationSchedule(id = "selection-fission", version = 112)
protected final @NonNull Matrix mTempMatrix = new Matrix();
@Deprecated
@DeprecationSchedule(id = "selection-fission", version = 112)
protected final @NonNull RectF mTempRect = new RectF();
private boolean mExternalActionsEnabled;
protected @Nullable ActionMode mActionMode;
@ -477,10 +467,6 @@ public class BasicSelectionActionDelegate
return;
}
// mTempMatrix and mTempRect are deprecated.
mSession.getClientToScreenMatrix(mTempMatrix);
mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
mSelection.screenRect.roundOut(outRect);
}

View File

@ -3589,16 +3589,6 @@ public class GeckoSession {
*/
public final @NonNull String text;
/**
* The bounds of the current selection in client coordinates. Use {@link
* GeckoSession#getClientToScreenMatrix} to perform transformation to screen coordinates.
*
* @deprecated Use {@link #screenRect}.
*/
@Deprecated
@DeprecationSchedule(id = "selection-fission", version = 112)
public final @Nullable RectF clientRect;
/** The bounds of the current selection in screen coordinates. */
public final @Nullable RectF screenRect;
@ -3618,7 +3608,6 @@ public class GeckoSession {
| (bundle.getBoolean("editable") ? SelectionActionDelegate.FLAG_IS_EDITABLE : 0)
| (bundle.getBoolean("password") ? SelectionActionDelegate.FLAG_IS_PASSWORD : 0);
text = bundle.getString("selection");
clientRect = bundle.getRectF("clientRect");
screenRect = bundle.getRectF("screenRect");
availableActions = actions;
mActionId = bundle.getString("actionId");
@ -3629,7 +3618,6 @@ public class GeckoSession {
protected Selection() {
flags = 0;
text = "";
clientRect = null;
screenRect = null;
availableActions = new HashSet<>();
mActionId = null;

View File

@ -14,6 +14,8 @@ exclude: true
⚠️ breaking change and deprecation notices
## v111
- Removed deprecated [`SelectionActionDelegate.Selection.clientRect`][111.10], [`BasicSelectionActionDelegate.mTempMatrix`][111.11] and [`BasicSelectionActionDelegate.mTempRect`][111.12], ([bug 1801615]({{bugzilla}}1801615))
- Added [`GeckoSession.ContentDelegate.cookieBannerHandlingDetectOnlyMode`][111.2] see ([bug 1810742]({{bugzilla}}1810742))
- ⚠️ Deprecated [`CookieBannerMode.COOKIE_BANNER_MODE_DETECT_ONLY`][111.1]
- Added [`GeckoView.ActivityContextDelegate`][111.3], `setActivityContextDelegate`, and `getActivityContextDelegate` to `GeckoView`
@ -29,6 +31,9 @@ exclude: true
[111.7]: {{javadoc_uri}}/GeckoSession.PdfSaveResult.html
[111.8]: {{javadoc_uri}}/SessionPdfFileSaver.html
[111.9]: {{javadoc_uri}}/GeckoSession.html#isPdfJs--
[111.10]: {{javadoc_uri}}/GeckoSession.SelectionActionDelegate.Selection.html#clientRect
[111.11]: {{javadoc_uri}}/BasicSelectionActionDelegate.html#mTempMatrix
[111.12]: {{javadoc_uri}}/BasicSelectionActionDelegate.html#mTempRect
## v110
- Added [`GeckoSession.ContentDelegate.onCookieBannerDetected`][110.1] and [`GeckoSession.ContentDelegate.onCookieBannerHandled`][110.2]
@ -1313,4 +1318,4 @@ to allow adding gecko profiler markers.
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport(android.content.Context,android.os.Bundle,java.lang.String)
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: 3fdeffc1d5ce3a27e27dbbcfdc77ee1aa901ebdb
[api-version]: 5c6f2bfdee45037ef4de5b47ecf3c775b738a9ed