Closed Bug 1487591 Opened 2 years ago Closed 2 years ago

Make Selection treat AccessibleCaretEventHub as concrete class rather than nsISelectionListener

Categories

(Core :: DOM: Selection, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

AccessibleCaretEventHub is an nsISelectionListener of Selection whose type is "normal". This is added only when nsFrameSelection::Init() is called and accessible caret is enabled. Additionally, nsFrameSelection::Init() is always called immediately after creating nsFrameSelection.

Therefore, when AccessibleCaretEventHub is installed to Selection, this is always second selection listener and won't be installed multiple times. So, Selection can store pointer of AccessibleCaretEventHub only when it's enabled and the Selection needs to notify it of selection change.
AccessibleCaretEventHub is an nsISelectionListener of Selection whose type is
"normal".  This is added only when nsFrameSelection::Init() is called and
accessible caret is enabled.  Additionally, nsFrameSelection::Init() is
always called immediately after creating nsFrameSelection.

Therefore, when AccessibleCaretEventHub is installed to Selection, this is
always second selection listener and won't be installed multiple times.  So,
Selection can store pointer of AccessibleCaretEventHub directly only when
it's enabled and the Selection needs to notify it of selection change.

This patch makes Selection stores AccessibleCaretEventHub with RefPtr and
make it in cycle collection, then, makes Selection::NotifySelectionListeners()
call its OnSelectionChange() immediately after AutoCopyListener.

Unfortunately, this patch includes making of MOZ_CAN_RUN_SCRIPT_BOUNDARY and
MOZ_CAN_RUN_SCRIPT a lot since some methods of AccessibleCaretEventHub are
marked as MOZ_CAN_RUN_SCRIPT and including AccessibleCaretEventHub.h into
Selection.h causes compile the compile errors.
Comment on attachment 9005541 [details]
Bug 1487591 - Make Selection treat AccessibleCaretEventHub as concrete class rather than nsISelectionListener

Olli Pettay [:smaug] has approved the revision.
Attachment #9005541 - Flags: review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/bdbd39b2251d
Make Selection treat AccessibleCaretEventHub as concrete class rather than nsISelectionListener r=smaug
https://hg.mozilla.org/mozilla-central/rev/bdbd39b2251d
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.