Make all editor command classes use Command enum instead of command name (const char*) for performance
Categories
(Core :: DOM: Editor, task)
Tracking
()
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*
.
Assignee | ||
Comment 1•5 years ago
|
||
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.
Assignee | ||
Comment 2•5 years ago
|
||
The used commands are listed up from:
- https://searchfox.org/mozilla-central/rev/d143f8ce30d1bcfee7a1227c27bf876a85f8cede/editor/libeditor/EditorController.cpp#31-32,34-38,40-41,43,45-51,53-57,67-112
- https://searchfox.org/mozilla-central/rev/ec489aa170b6486891cf3625717d6fa12bcd11c1/editor/libeditor/HTMLEditorController.cpp#26-28,31-39,48,51-52,55-58,60-63,65-73,76-80,83-88,90-91,93-94,97-100,102-104
Assignee | ||
Comment 3•5 years ago
|
||
Now, we don't have any utility method to get Command
value for XUL command
name. This patch creates it into mozilla
namespace.
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
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
Comment 6•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2392ec437b0b
https://hg.mozilla.org/mozilla-central/rev/6d9207d2881a
https://hg.mozilla.org/mozilla-central/rev/197014526816
https://hg.mozilla.org/mozilla-central/rev/1e0e71568ab6
Description
•