Closed Bug 1500862 Opened 2 years ago Closed 2 years ago

Stop using AutoTransactionBatch outside of editor instances


(Core :: DOM: Editor, defect)

Not set



Tracking Status
firefox64 --- wontfix
firefox65 --- fixed


(Reporter: masayuki, Assigned: masayuki)




(3 files)

AutoTransactionBatch is used by TextServicesDocument and HTMLEditorCommands even though it accesses protected members of EditorBase.  So, each part should be implemented by EditorBase and all such stack base helper classes should be nested classes of EditorBase.
Oh, I'll fix a regression of bug 742884 in StyleUpdatingCommand::ToggleState()...
Blocks: 742884
StyleUpdatingCommand::ToggleState() removes exclusive style when it sets
superscript style or subscript style.  However, it accesses protected
members of EditorBase via AutoTransactionBatch even though it's outside
of editor classes.

This patch moves the removing exclusive style code from the method to
HTMLEditor::SetInlineProperty() and rename it "AsAction".
Unfortunately, TextServicesDocument::InsertText() is too complicated to
do it with both editor class and TextServicesDocument separately.
Therefore, this patch adds AutoTransactionBatchExternal class which is
almost same as AutoTransactionBatch but uses XPCOM methods to begin/end
transaction.  This change helps editor to manage whether it starts to
handle new edit action or not when BeginTransaction() is called explicitly.
AutoTransactionBatch, AutoPlaceholderBatch, AutoSelectionRestorer,
AutoTopLevelEditSubActionNotifier, AutoTransactionsConserveSelection and
AutoUpdateViewBatch access protected members of EditorBase.  The access
scope management assume that they are used only by EditorBase or its
subclasses or TextEditRules or its inherited class (i.e., HTMLEditRules).

For guaranteeing this at build-time, we should change them to nested classes
of EditorBase.  Then, EditorBase and its subclasses and friends can use them.
Pushed by
part 1: Make HTMLEditor::SetInlineProperty() remove exclusive style automatically r=m_kato
part 2: Create AutoTransactionBatchExternal class which calls XPCOM methods instead of non-virtual internal methods r=m_kato
part 3: Change all stack base helper classes which access protected members of EditorBase to nested classes of EditorBase r=m_kato
You need to log in before you can comment on or make changes to this bug.