Closed Bug 1546839 Opened 5 years ago Closed 5 years ago

Make all editor command classes use Command enum instead of command name (const char*) for performance

Categories

(Core :: DOM: Editor, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(4 files)

When I rewrite nsHTMLDocument::ExecCommand(), it can access each editor command class directly and at that time, it knows Command value for given HTML command. So, internal public methods added by bug 1546578 should take Command instead of command name which is represented as const char*.

If I remember correctly, enum class was not allowed when I added
enum Command. Now, we can make it enum class for better type check at
compile time.

Now, we don't have any utility method to get Command value for XUL command
name. This patch creates it into mozilla namespace.

Attachment #9061315 - Attachment description: Bug 1546839 - part 1: Change `enum Command` to `enum class Command` and drop "Command" prefix from each item → Bug 1546839 - part 2: Define commands which are handled by editor

strcmp may be slow due to checking null character. Therefore, internal
methods of them should use command as far as possible. This patch makes
them take/use Command instead of const char*.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/2392ec437b0b
part 1: Change `enum Command` to `enum class Command` and drop "Command" prefix from each item r=smaug
https://hg.mozilla.org/integration/autoland/rev/6d9207d2881a
part 2: Define commands which are handled by editor r=smaug
https://hg.mozilla.org/integration/autoland/rev/197014526816
part 3: Create methods which retrieve `Command` value for XUL command name r=smaug
https://hg.mozilla.org/integration/autoland/rev/1e0e71568ab6
part 4: Make all editor command classes use Command instead of command name r=smaug
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: