Closed Bug 1609860 Opened 5 years ago Closed 5 years ago

Redesign AutoStyleCacheArray

Categories

(Core :: DOM: Editor, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

AutoStyleCacheArray creates 19 StyleCache instances from constructor. StyleCache has nsString member variable and most of the nsString instance are not used in most cases. Therefore, we should make it create StyleCache instance when it's necessary.

Currently, AutoStyleCacheArray has style information of all 19 styles.
However, its element type, StyleCache has nsString instance. Therefore,
the initializing cost is not reasonable since in most cases most of the
StyleCache instances are not used actually.

This patch makes HTMLEditor::GetInlineStyles() append elements only for
applied styles and HTMLEditor::ReapplyCachedStyles() look for current
value from an instance with new IndexOf() method. Therefore, this patch
may make slower if a lot of styles are applied. However, we can expect that
it's rare case.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/6d5b9108896d Make `AutoStyleCacheArray` cache only applied styles r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: