Closed Bug 1632021 Opened 5 years ago Closed 5 years ago

Avoid QI between transaction classes

Categories

(Core :: DOM: Editor, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Each transaction class should have GetAs*Transaction() methods for easier and faster access to concrete classes.

In a lot of places in libeditor, we do nothing if given transaction is not
our edit transaction classes' instance. Therefore, it's better to have
casting virtual method in nsITransaction for performance because QI cost
may not be cheap.

Depends on D71907

It's inherited only by PlaceholderTransaction and used only for QI.
Therefore, we can get rid of it.

Additionally, this makes storing PlaceholderTransaction and
CompositionTransaction in PlaceholderTransaction faster and safer with
WeakPtr.

Finally, this makes PlaceholderTransaction always have non-null name
because it caused a lot of useless warnings in
EditAggregationTransaction::GetName() and
PlaceholderTransaction::GetTxnName().

Depends on D71908

EditTransactionBase::GetAs*Transaction() should be used instead.

Depends on D71910

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/9e2e2b767d83 part 1: Add `GetAs*Transaction()` methods to every subclasses of `EditTransactionBase` r=m_kato https://hg.mozilla.org/integration/autoland/rev/a4a7fce9f73e part 2: Add `nsITransaction::GetAsEditTransactionBase()` r=m_kato https://hg.mozilla.org/integration/autoland/rev/946dc2965175 part 3: Get rid of `nsIAbsorbingTransaction` r=m_kato https://hg.mozilla.org/integration/autoland/rev/55abc248f524 part 4: Get rid of IID of `InsertTextTransaction` and `CompositionTransaction` r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: