This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking out of a quoted reply block by inserting a new paragraph sho…
…uld reset writing direction https://bugs.webkit.org/show_bug.cgi?id=240778 rdar://14839536 Reviewed by Devin Rousso. The process of breaking out of a `blockquote` via the "InsertNewlineInQuotedContent" editor command currently works by splitting the `blockquote` into two sibling elements underneath the same parent container, and then inserting a `br` element in between these sibling `blockquote` elements. The selection is then moved to the end of the newly created `br`, which inherits the writing direction (`dir`) of the element containing the `blockquote`. In the case of Mail, if the system language is right-to-left but the quoted content is left-to-right, this can lead to some unintuitive behavior when breaking out of quoted LTR content, since the newly created line break will inherit the right-to-left direction of its ancestor. To fix this, in the case where we're breaking out of a `blockquote` and the start of the selection is left-to-right but the element that contains the `blockquote` is right-to-left, we can wrap the `br` in another block-level container element with `dir=auto` to avoid inheriting the writing direction from the `blockquote`'s ancestor. This means that the writing direction of the newly inserted paragraph will automatically be determined by what the user types. Test: editing/execCommand/reset-direction-after-breaking-blockquote.html * LayoutTests/editing/execCommand/reset-direction-after-breaking-blockquote-expected.txt: Added. * LayoutTests/editing/execCommand/reset-direction-after-breaking-blockquote.html: Added. * Source/WebCore/editing/BreakBlockquoteCommand.cpp: (WebCore::BreakBlockquoteCommand::doApply): Canonical link: https://commits.webkit.org/250901@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294714 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing 3 changed files with 79 additions and 5 deletions.