diff --git a/dom/browser-element/BrowserElementCopyPaste.js b/dom/browser-element/BrowserElementCopyPaste.js index ae5a8f091bf..919179a7a60 100644 --- a/dom/browser-element/BrowserElementCopyPaste.js +++ b/dom/browser-element/BrowserElementCopyPaste.js @@ -71,7 +71,8 @@ let CopyPasteAssistent = { reason: e.reason, collapsed: e.collapsed, caretVisible: e.caretVisible, - selectionVisible: e.selectionVisible + selectionVisible: e.selectionVisible, + selectionEditable: e.selectionEditable }; // Get correct geometry information if we have nested iframe. diff --git a/dom/browser-element/BrowserElementParent.js b/dom/browser-element/BrowserElementParent.js index b563a95ce92..ee1ecd1e7b4 100644 --- a/dom/browser-element/BrowserElementParent.js +++ b/dom/browser-element/BrowserElementParent.js @@ -452,6 +452,7 @@ BrowserElementParent.prototype = { // - collapsed: Indicate current selection is collapsed or not. // - caretVisible: Indicate the caret visiibility. // - selectionVisible: Indicate current selection is visible or not. + // - selectionEditable: Indicate current selection is editable or not. _handleCaretStateChanged: function(data) { let evt = this._createEvent('caretstatechanged', data.json, /* cancelable = */ false); diff --git a/dom/webidl/CaretStateChangedEvent.webidl b/dom/webidl/CaretStateChangedEvent.webidl index 45a4e38d301..d016513ca0e 100644 --- a/dom/webidl/CaretStateChangedEvent.webidl +++ b/dom/webidl/CaretStateChangedEvent.webidl @@ -19,6 +19,7 @@ dictionary CaretStateChangedEventInit : EventInit { CaretChangedReason reason = "visibilitychange"; boolean caretVisible = false; boolean selectionVisible = false; + boolean selectionEditable = false; }; [Constructor(DOMString type, optional CaretStateChangedEventInit eventInit), @@ -29,4 +30,5 @@ interface CaretStateChangedEvent : Event { readonly attribute CaretChangedReason reason; readonly attribute boolean caretVisible; readonly attribute boolean selectionVisible; + readonly attribute boolean selectionEditable; }; diff --git a/layout/base/AccessibleCaretManager.cpp b/layout/base/AccessibleCaretManager.cpp index ce286e59088..edd2b6a5ba7 100644 --- a/layout/base/AccessibleCaretManager.cpp +++ b/layout/base/AccessibleCaretManager.cpp @@ -941,6 +941,11 @@ AccessibleCaretManager::DispatchCaretStateChangedEvent(CaretChangedReason aReaso init.mSelectionVisible = true; } + // Send isEditable info w/ event detail. This info can help determine + // whether to show cut command on selection dialog or not. + init.mSelectionEditable = commonAncestorFrame && + commonAncestorFrame->GetContent()->GetEditingHost(); + init.mBoundingClientRect = domRect; init.mReason = aReason; init.mCollapsed = sel->IsCollapsed();