Closed Bug 1500862 Opened 11 months ago Closed 11 months ago

Stop using AutoTransactionBatch outside of editor instances

Categories

(Core :: Editor, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox64 --- wontfix
firefox65 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(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 masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/7bda40ae7f00
part 1: Make HTMLEditor::SetInlineProperty() remove exclusive style automatically r=m_kato
https://hg.mozilla.org/integration/autoland/rev/d2112ced49ef
part 2: Create AutoTransactionBatchExternal class which calls XPCOM methods instead of non-virtual internal methods r=m_kato
https://hg.mozilla.org/integration/autoland/rev/b7fdf387fa7b
part 3: Change all stack base helper classes which access protected members of EditorBase to nested classes of EditorBase r=m_kato
https://hg.mozilla.org/mozilla-central/rev/7bda40ae7f00
https://hg.mozilla.org/mozilla-central/rev/d2112ced49ef
https://hg.mozilla.org/mozilla-central/rev/b7fdf387fa7b
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.