gecko-dev/dom/events
Masayuki Nakano 5c2c570f9b Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug
When setting value of <input type="text">, nsTextEditorState removes all
ranges of normal selection first.  Then, TextEditor sets the value.  Finally,
TextEditor collapses the selection at the end of the text.

In bug 1386471, we got that there are some problems to remove the call of
Selection::RemoveAllRanges() in nsTextEditorState.  Therefore, we need another
approach to improve Selection::Collapse().

The approach of this patch is, when removing all ranges from normal selection,
Selection can cache an nsRange instance if there is an instance which is not
referenced from other than the Selection (i.e., it'll be removed when
Selection::Clear() is called).  Then, Selection::Collapse() can reuse it.  With
this fix, Selection::Collapse() can reduce allocation cost and may reduce some
other cost like adding it to mutation observer.

However, keeping nsRange instance may cause increasing mutation observer's cost
since nsRange will be adjusted its start node/offset and end node/offset with
mutation observer to guarantee that the range is always valid.  So, we can
cache such range only when the caller (or its callee) will set selection range
later.  Therefore, this patch adds Selection::RemoveAllRangesTemporarily()
and make only nsTextEditorState::SetValue() and
ContentEventHandler::OnSelectionEvent() use it.

MozReview-Commit-ID: FjWrbz4S1ld

--HG--
extra : rebase_source : 83677640525e0b1a84bdd7fce63ff4704b9cc22b
2017-08-25 19:21:39 +09:00
..
crashtests
test Bug 1376895 - Disable preloaded browser in two mochitests. r=me 2017-08-16 13:00:04 +02:00
AnimationEvent.cpp
AnimationEvent.h Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj 2017-08-16 16:48:52 -07:00
AsyncEventDispatcher.cpp Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
AsyncEventDispatcher.h Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
BeforeUnloadEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
BeforeUnloadEvent.h
ClipboardEvent.cpp
ClipboardEvent.h
CommandEvent.cpp
CommandEvent.h
CompositionEvent.cpp
CompositionEvent.h
ContentEventHandler.cpp Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug 2017-08-25 19:21:39 +09:00
ContentEventHandler.h Bug 1375502 - part2: Add nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t) r=mats 2017-06-26 17:26:27 +09:00
CustomEvent.cpp
CustomEvent.h
DataTransfer.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
DataTransfer.h Bug 1327798 - Part 1. PasteNoFormatting shouldn't set text/html to clipboard event on paste. r=enndeakin 2017-02-22 18:34:45 +09:00
DataTransferItem.cpp Bug 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron. 2017-08-04 14:40:52 +10:00
DataTransferItem.h Bug 1342057 - Part 1: Use correct MIME type for files as DataTransferItem.type, r=baku 2017-03-07 18:18:42 -05:00
DataTransferItemList.cpp Bug 1342057 - Part 1: Use correct MIME type for files as DataTransferItem.type, r=baku 2017-03-07 18:18:42 -05:00
DataTransferItemList.h
DeviceMotionEvent.cpp Bug 1261894 - Update InitDeviceMotionEvent to handle high-res timestamps. r=smaug 2017-02-28 16:50:15 -06:00
DeviceMotionEvent.h Bug 1287006 - Don't pass Nullable by value in various places, rather by const&. r=bz 2017-02-13 09:07:40 -08:00
DOMEventTargetHelper.cpp Bug 1389460 - Remove @deprecated nsIDOMEventTarget.DispatchDOMEvent. r=smaug 2017-08-07 02:28:52 +09:00
DOMEventTargetHelper.h Bug 1354599 - Implement DOMEventTargetHelper::KeepAliveIfHasListenersFor, r=smaug 2017-04-18 13:51:27 +02:00
DragEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
DragEvent.h
Event.cpp Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj. 2017-07-31 14:28:48 +10:00
Event.h Bug 1217238 - Reduce time precision when privacy.resistFingerprinting is on. r=mystor 2017-06-06 11:45:14 +08:00
EventDispatcher.cpp Bug 1388119 - Drop support for createEvent("ErrorEvent"/"PopStateEvent"); r=smaug 2017-08-07 21:19:59 +03:00
EventDispatcher.h Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
EventListenerManager.cpp Bug 1386825 - Part 1: Remove MOZ_B2G from dom. r=bkelly 2017-08-08 14:41:05 -07:00
EventListenerManager.h Bug 1385071 - Add another method to EventTarget for detecting only non-passive key listeners. r=smaug 2017-07-27 19:46:44 -04:00
EventListenerService.cpp Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
EventListenerService.h
EventNameList.h Bug 1386825 - Part 1: Remove MOZ_B2G from dom. r=bkelly 2017-08-08 14:41:05 -07:00
EventStateManager.cpp Bug 1385666, ensure layout is flushed when editor gets focus, r=masayuki 2017-08-03 19:36:58 +03:00
EventStateManager.h Backed out changeset 284af26c1b53 (bug 1351148) 2017-07-28 09:20:27 +02:00
EventStates.h Bug 1385478 - Part 2: Change Required/IsRequired() to look at NS_EVENT_STATE_REQUIRED instead. r=bz 2017-08-03 01:27:00 -04:00
EventTarget.cpp Bug 1385071 - Add another method to EventTarget for detecting only non-passive key listeners. r=smaug 2017-07-27 19:46:44 -04:00
EventTarget.h Bug 1385071 - Add another method to EventTarget for detecting only non-passive key listeners. r=smaug 2017-07-27 19:46:44 -04:00
FocusEvent.cpp
FocusEvent.h
ImageCaptureError.cpp
ImageCaptureError.h
IMEContentObserver.cpp Bug 1385666, ensure layout is flushed when editor gets focus, r=masayuki 2017-08-03 19:36:58 +03:00
IMEContentObserver.h Bug 1385666, ensure layout is flushed when editor gets focus, r=masayuki 2017-08-03 19:36:58 +03:00
IMEStateManager.cpp Bug 1388647 - part1: IMEStateManager::OnChangeFocusInternal() shouldn't request to commit composition with sFocusedIMETabParent r=m_kato 2017-08-09 18:04:28 +09:00
IMEStateManager.h Bug 1266683 - Part 2 - Add private browsing mode info to InputContext. r=masayuki 2017-07-30 19:45:03 +02:00
InputEvent.cpp
InputEvent.h
InternalMutationEvent.h
JSEventHandler.cpp Bug 1345996. Change event handler invocation to only do the "true return cancels" for onerror handlers handed ErrorEvents, and only on globals. r=smaug 2017-03-10 23:53:09 -05:00
JSEventHandler.h
KeyboardEvent.cpp Bug 1387828 - Reinstate support for initKeyboardEvent; r=smaug 2017-08-06 16:52:39 +03:00
KeyboardEvent.h Bug 1387828 - Reinstate support for initKeyboardEvent; r=smaug 2017-08-06 16:52:39 +03:00
KeyNameList.h Bug 1386825 - Part 1: Remove MOZ_B2G from dom. r=bkelly 2017-08-08 14:41:05 -07:00
MessageEvent.cpp Bug 1311324 P2 Replace usage of ServiceWorkerMessageEvent with MessageEvent. r=bz 2017-03-09 20:50:13 -05:00
MessageEvent.h Bug 1311324 P2 Replace usage of ServiceWorkerMessageEvent with MessageEvent. r=bz 2017-03-09 20:50:13 -05:00
MouseEvent.cpp Bug 1339758, click() and similar can return 0 from various coordinate properties, r=masayuki 2017-03-23 12:57:44 +02:00
MouseEvent.h
MouseScrollEvent.cpp
MouseScrollEvent.h
moz.build Bug 1251198 - Remove various obsolete events from document.createEvent r=smaug 2017-04-20 15:45:37 +03:00
MutationEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
MutationEvent.h
NotifyPaintEvent.cpp Bug 1302071 - Part 3: Remove flags parameter to NotifyInvalidation since it's unused. r=tnikkel 2017-02-17 11:50:58 +13:00
NotifyPaintEvent.h Bug 1302071 - Part 3: Remove flags parameter to NotifyInvalidation since it's unused. r=tnikkel 2017-02-17 11:50:58 +13:00
nsIEventListenerService.idl
PaintRequest.cpp Bug 1302071 - Part 3: Remove flags parameter to NotifyInvalidation since it's unused. r=tnikkel 2017-02-17 11:50:58 +13:00
PaintRequest.h Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
PhysicalKeyCodeNameList.h
PointerEvent.cpp Bug 1292064 - [Pointer Event] Add digitizer/pen tangential (barrel) pressure and twist. r=smaug 2017-02-09 10:49:00 +08:00
PointerEvent.h Bug 1292064 - [Pointer Event] Add digitizer/pen tangential (barrel) pressure and twist. r=smaug 2017-02-09 10:49:00 +08:00
ScrollAreaEvent.cpp
ScrollAreaEvent.h
SimpleGestureEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
SimpleGestureEvent.h
SpeechRecognitionError.cpp
SpeechRecognitionError.h
StorageEvent.cpp
StorageEvent.h Bug 1285898 - [e10s-multi] Localstorage "storage" event is not fired with multiple content processes. r=asuth 2017-02-19 22:16:48 -05:00
TextClause.cpp
TextClause.h
TextComposition.cpp Bug 1384584 - TextComposition::DispatchCompositionEvent() shouldn't send composition events to focused TabParent after its RequestIMEToCommitComposition() synthesizes eCompositionCommit(AsIs) event synchronously r=m_kato 2017-07-26 23:23:38 +09:00
TextComposition.h Bug 1377672 - part3: IMEStateManager::NotifyIME() should ignore notifications and requests which comes from unexpected process r=m_kato,smaug 2017-07-06 00:47:40 +09:00
Touch.cpp Bug 1382499 - Enhance fingerprinting resistance for Touch API r=arthuredelstein,bz 2017-07-31 17:30:38 +08:00
Touch.h Bug 1382499 - Enhance fingerprinting resistance for Touch API r=arthuredelstein,bz 2017-07-31 17:30:38 +08:00
TouchEvent.cpp Bug 1386825 - Part 1: Remove MOZ_B2G from dom. r=bkelly 2017-08-08 14:41:05 -07:00
TouchEvent.h Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj 2017-08-16 16:48:52 -07:00
TransitionEvent.cpp
TransitionEvent.h Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj 2017-08-16 16:48:52 -07:00
UIEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
UIEvent.h Bug 1347073 Get rid of UIEvent.isChar since it's not initialized properly on most platforms and the other browsers don't support this r=smaug 2017-03-14 18:29:39 +09:00
VirtualKeyCodeList.h
WheelEvent.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
WheelEvent.h
WheelHandlingHelper.cpp Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
WheelHandlingHelper.h Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
XULCommandEvent.cpp Bug 1371219 - Add an inputSource attribute to XULCommandEvent. r=smaug 2017-07-20 17:45:56 +02:00
XULCommandEvent.h Bug 1371219 - Add an inputSource attribute to XULCommandEvent. r=smaug 2017-07-20 17:45:56 +02:00