Bug 1181418 - Send selectionEditable info to app_text_selection_dialog. r=tlin, r=kanru, sr=smaug

This commit is contained in:
Jeremy Chen 2015-07-31 04:34:00 +08:00
parent 5e2ac88ac9
commit 9d9d551cf0
4 changed files with 10 additions and 1 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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;
};

View File

@ -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();