mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1199161 - Add selectedTextContent to CaretStateChangedEvent. r=kanru, sr=smaug
The old SelectionStateChangedEvent dispatched by SelectionChanged had this field, but it has not being ported to CaretStateChangedEvent. We should include selected text in the event so that Gaia could have a chance to enhance user experience. --HG-- extra : rebase_source : 7304b71e251e2ee081192340b8f86f22bf6e03a6
This commit is contained in:
parent
05364ae706
commit
63aeeea1b1
@ -72,7 +72,8 @@ var CopyPasteAssistent = {
|
||||
collapsed: e.collapsed,
|
||||
caretVisible: e.caretVisible,
|
||||
selectionVisible: e.selectionVisible,
|
||||
selectionEditable: e.selectionEditable
|
||||
selectionEditable: e.selectionEditable,
|
||||
selectedTextContent: e.selectedTextContent
|
||||
};
|
||||
|
||||
// Get correct geometry information if we have nested iframe.
|
||||
|
@ -459,6 +459,8 @@ BrowserElementParent.prototype = {
|
||||
// - caretVisible: Indicate the caret visiibility.
|
||||
// - selectionVisible: Indicate current selection is visible or not.
|
||||
// - selectionEditable: Indicate current selection is editable or not.
|
||||
// - selectedTextContent: Contains current selected text content, which is
|
||||
// equivalent to the string returned by Selection.toString().
|
||||
_handleCaretStateChanged: function(data) {
|
||||
let evt = this._createEvent('caretstatechanged', data.json,
|
||||
/* cancelable = */ false);
|
||||
|
@ -20,6 +20,7 @@ dictionary CaretStateChangedEventInit : EventInit {
|
||||
boolean caretVisible = false;
|
||||
boolean selectionVisible = false;
|
||||
boolean selectionEditable = false;
|
||||
DOMString selectedTextContent = "";
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, optional CaretStateChangedEventInit eventInit),
|
||||
@ -31,4 +32,5 @@ interface CaretStateChangedEvent : Event {
|
||||
readonly attribute boolean caretVisible;
|
||||
readonly attribute boolean selectionVisible;
|
||||
readonly attribute boolean selectionEditable;
|
||||
readonly attribute DOMString selectedTextContent;
|
||||
};
|
||||
|
@ -953,6 +953,7 @@ AccessibleCaretManager::DispatchCaretStateChangedEvent(CaretChangedReason aReaso
|
||||
init.mCollapsed = sel->IsCollapsed();
|
||||
init.mCaretVisible = mFirstCaret->IsLogicallyVisible() ||
|
||||
mSecondCaret->IsLogicallyVisible();
|
||||
sel->Stringify(init.mSelectedTextContent);
|
||||
|
||||
nsRefPtr<CaretStateChangedEvent> event =
|
||||
CaretStateChangedEvent::Constructor(doc, NS_LITERAL_STRING("mozcaretstatechanged"), init);
|
||||
|
Loading…
Reference in New Issue
Block a user