mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1463576 - 8. Hide selection actions on pagehide; r=snorp
When the page navigates away, we should hide any active selection actions. MozReview-Commit-ID: 2LojAuPxyyl --HG-- extra : rebase_source : 26240a67d036f313bece348a6b6106fd893fc853
This commit is contained in:
parent
510abaf834
commit
f5ea78407f
@ -18,7 +18,7 @@ class GeckoViewSelectionActionContent extends GeckoViewContentModule {
|
||||
|
||||
this._seqNo = 0;
|
||||
this._isActive = false;
|
||||
this._previousMessage = {};
|
||||
this._previousMessage = "";
|
||||
|
||||
this._actions = [{
|
||||
id: "org.mozilla.geckoview.CUT",
|
||||
@ -97,18 +97,31 @@ class GeckoViewSelectionActionContent extends GeckoViewContentModule {
|
||||
onEnable() {
|
||||
debug `onEnable`;
|
||||
addEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
|
||||
addEventListener("pagehide", this, { capture: true, mozSystemGroup: true });
|
||||
}
|
||||
|
||||
onDisable() {
|
||||
debug `onDisable`;
|
||||
removeEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
|
||||
removeEventListener("pagehide", this, { capture: true, mozSystemGroup: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive and act on AccessibleCarets caret state-change
|
||||
* (mozcaretstatechanged) events.
|
||||
* (mozcaretstatechanged and pagehide) events.
|
||||
*/
|
||||
handleEvent(aEvent) {
|
||||
if (aEvent.type === "pagehide") {
|
||||
// Hide any selection actions on page hide.
|
||||
aEvent = {
|
||||
reason: "visibilitychange",
|
||||
caretVisibile: false,
|
||||
selectionVisible: false,
|
||||
collapsed: true,
|
||||
selectionEditable: false,
|
||||
};
|
||||
}
|
||||
|
||||
let reason = aEvent.reason;
|
||||
|
||||
if (this._isActive && !aEvent.caretVisible) {
|
||||
|
Loading…
Reference in New Issue
Block a user