-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1529884 - part 5: Make Document::ExecCommand() use EditorCommand …
…directly as far as possible r=smaug Most commands are dispatched only when the `document` has `contenteditable` or in `designMode`. In such case, command context is considered with the following order: 1. `HTMLEditor` for the document. 2. `TextEditor` if the document has focus and it has `TextEditor`. 3. Other command controller table associated with window or DocShell. In the case of #1 and #2, `ExecCommand()` can use `EditorCommand` directly and we only need to send subject principal to the editor only in these cases. In the case of #3, we need to fall back to traditional path. There are 2 paths: 1. If it's "paste" command, handle it with `nsCommandManager` to dispatch "paste" event. 2. If it's "cur" or "copy", handle it with `DocShell` to dispatch "cut" or "copy" event in the window or focused sub-document. Note that clipboard "cut" and "copy" commands are special cases. Only them were handled by `DocShell` instead of `nsCommandManager` This difference caused making active element's `TextEditor` is preferred rather than `HTMLEditor`. Although this behavior is better than our traditional behavior because Chromium works as so. But for now, we should keep our behavior. Finally, this patch makes `ExecCommand()` creates `nsCommandParams` instance since now, `EditorCommand` class can take only necessary parameter without it. Differential Revision: https://phabricator.services.mozilla.com/D29632
- Loading branch information
1 parent
ed8b52a
commit c654c8e
Showing
3 changed files
with
195 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters