gecko-dev/editor
Masayuki Nakano c83d685fe9 Bug 1808906 - Make the style editor handle `<font>` at last when there are multiple preserved styles r=m_kato
Height of inline elements are considered with current `font-size` and
`line-height`.  Therefore, if content in inline elements are taller, the
`background-color` does not fill the bigger content background entirely.
For solving this issue, Chrome handles styles of `<font>` element as
outer-most style.  This is reasonable approach, let's follow this.

For solving this issue, we can change the order of `PreservedStyle`s at setting
the preserved styles.  Then, `SetInlinePropertiesAsSubAction` is called with
reversed order and apply later style first and applies newer styles to all
content in an element which is previously inserted.  Therefore, the `<font>`
element styles should be last elements of `PendingStyles::mPreservingStyles`.

When applying new style, our style editor does not reuse existing `<font>`
element, and this causes writing WPT harder.  Therefore, this patch also changes
the applying range of `<font>` style to wrapping existing `<font>` element if
and only if its content is entirely selected.

Unfortunately, this approach cannot get exactly same result as Chrome because we
insert outer-most `<font>` element first, then, try to apply `background-color`,
at this moment, our style editor applies the style to the previously inserted
`<font>` element instead of creating new `<span>` element.  This behavior is
required for compatibility in the other cases.  Additionally, changing only this
behavior requires a lot of method changes to specify how to handle it.  However,
this incompatible behavior may not cause any problems in web apps in the wild.
Therefore, this patch does not solve this incompatible issue.  I think that once
we get a bug report caused by this difference, we should redesign how to set
multiple inline styles once.

Differential Revision: https://phabricator.services.mozilla.com/D166617
2023-01-17 23:46:58 +00:00
..
composer Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
docs Bug 1802799 - [refactor] Migrate NS_STYLE_TEXT_DECORATION_STYLE_* defines r=emilio,geckoview-reviewers,ohall 2022-12-19 22:47:24 +00:00
libeditor Bug 1808906 - Make the style editor handle `<font>` at last when there are multiple preserved styles r=m_kato 2023-01-17 23:46:58 +00:00
reftests Bug 1809742 - Remove nativeThemePref annotations. r=dshin 2023-01-13 21:18:08 +00:00
spellchecker Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug 2022-12-15 19:45:01 +00:00
txmgr Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
AsyncSpellCheckTestHelper.jsm Bug 1803914 - Automatically replace Cu.reportError with console.error (misc). r=mossop 2022-12-06 14:34:57 +00:00
moz.build Bug 1769128 - Enable '-ftrivial-auto-var-init=pattern' in editor. r=glandium 2022-05-26 06:15:36 +00:00
nsIDocumentStateListener.idl
nsIEditActionListener.idl Bug 1739545 - part 2: Redesign `TextServicesDocument::DidJoinNodes()` methods r=m_kato 2021-11-09 01:09:20 +00:00
nsIEditor.idl Bug 1768315 - Get rid of `nsIEditor.transactionManager` due to unused r=m_kato 2022-10-27 22:50:07 +00:00
nsIEditorMailSupport.idl Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
nsIEditorSpellCheck.idl Bug 1402822 - Support multiple dictionaries in EditorSpellCheck; r=smaug 2022-03-23 13:53:38 +00:00
nsIHTMLAbsPosEditor.idl
nsIHTMLEditor.idl Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
nsIHTMLInlineTableEditor.idl Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
nsIHTMLObjectResizer.idl Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich 2022-12-28 09:52:44 +00:00
nsITableEditor.idl Bug 1730442 - part 1: Make all `nsITableEditor` features flush pending layout at start to handle their jobs r=m_kato 2022-05-20 07:39:51 +00:00