gecko-dev/editor
Masayuki Nakano 66d2f119a5 Bug 1906559 - Make `AutoInlineStyleSetter::OnHandled()` never set point in `aContent` if it's not a container r=m_kato
When `HTMLEditor::InsertLinkAroundSelectionAsAction()` calls
`HTMLEditor::SetInlinePropertiesAsSubAction()`, it adds 2 elements to the array.
One is for `_moz_dirty` attribute and the other is for `href` attribute because
`InsertTagCommand::DoCommandParam()` uses
`HTMLEditor::CreateElementWithDefaults()`.

Then, `HTMLEditor::SetInlinePropertiesAsSubAction()` wraps the `<img>` into
`<a _moz_dirty="">` with calling `AutoInlineStyleSetter::ApplyStyle()`. Then,
it calls `OnHandle()` with the `<img>` and it collapse the applied range into
the `<img>`.  Therefore, when `SetInlinePropertiesAsSubAction()` handles `href`,
there is only collapsed range and it just puts the style into the cache for
applying the style when the user types new text.

So, first, `OnHandle()` should not set the boundary points of the applied range
into non-container node. And also `InsertLinkAroundSelectionAsAction()` should
ignore `_moz_dirty` attribute because if it's truly required,
`AutoInlineStyleSetter` should set the attribute to every new element.

Note that this causes new failure in `editing/run/fontname.html?1001-200`,
but it was accidentally passed.  The case is, `queryCommandValue("fontname")`
result after calling `execCommand("fontname", false, "sans-serif")` for
`foo<tt>{<br></tt>}bar`.  The result of the DOM tree is
`foo<tt><font face="sans-serif"><br></font></tt>bar` and `Selection` was
collapsed in the `<br>` before, but with this patch, the `<br>` is selected.
Therefore, the result is changed but similar cases in the tests fail too. So I
believe that it accidentally passed with odd `Selection`.

Differential Revision: https://phabricator.services.mozilla.com/D219127
2024-08-19 00:35:33 +00:00
..
composer Bug 1864896: Autofix unused function arguments (editor). r=masayuki 2024-03-01 18:28:33 +00:00
docs Bug 1842986 - Remove dom.forms.inputmode pref r=emilio 2023-09-15 16:49:21 +00:00
libeditor Bug 1906559 - Make `AutoInlineStyleSetter::OnHandled()` never set point in `aContent` if it's not a container r=m_kato 2024-08-19 00:35:33 +00:00
reftests Bug 1879538 - cleanup unnecessary and redundant reftest conditions. r=aryx,jgilbert 2024-02-22 23:04:45 +00:00
spellchecker Bug 1864896: Autofix unused function arguments (editor). r=masayuki 2024-03-01 18:28:33 +00:00
txmgr Bug 1856795 - Remove redundant member init r=emilio 2023-10-15 15:29:02 +00:00
AsyncSpellCheckTestHelper.sys.mjs Bug 1864896: Autofix unused function arguments (editor). r=masayuki 2024-03-01 18:28:33 +00:00
moz.build
nsIDocumentStateListener.idl
nsIEditActionListener.idl Bug 1859245 - part 3: Make `JoinNodesTransaction` and `SplitNodeTransaction` handle only the new direction mode r=m_kato 2023-10-27 01:57:29 +00:00
nsIEditor.idl Bug 1809713 - Use ClipboardType in editor. r=masayuki 2024-07-29 11:52:33 +00:00
nsIEditorMailSupport.idl Bug 1839814 - Move `nsIEditor.wrapWidth` to `nsIEditorMailSupport` r=m_kato 2023-06-27 05:47:55 +00:00
nsIEditorSpellCheck.idl
nsIHTMLAbsPosEditor.idl
nsIHTMLEditor.idl Bug 1851951 - Make `HTMLEditor` refer computed `display` instead of the HTML default style at considering block or inline element r=m_kato 2023-09-27 03:01:26 +00:00
nsIHTMLInlineTableEditor.idl
nsIHTMLObjectResizer.idl
nsITableEditor.idl