Make the style editor sets `color` attribute value of `<font>` to normalized color value

Currently, our editor sets `color` attribute of `<font>` to given value as-is.
However, the other browsers normalize it to `#[0-9a-z]{6}` before setting the
value, and some WTP expects the behavior.  Therefore, we need to follow it for
avoiding meaningless failures.

According to WPT, the parameter can be `"transparent"` even without
`styleWithCSS`.  Additionally, CSS color values are also allowed if
`styleWithCSS` is `true`.  Therefore, this patch includes some fixes for them
too to avoid new failures.

Differential Revision: https://phabricator.services.mozilla.com/D167500

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1811161
gecko-commit: 0659120fb8f2386bbab75f04527a2854e0e6465e
gecko-reviewers: m_kato
diff --git a/editing/data/forecolor.js b/editing/data/forecolor.js
index efca197..c3271b3 100644
--- a/editing/data/forecolor.js
+++ b/editing/data/forecolor.js
@@ -370,9 +370,13 @@
     "foo{<font color=\"#0000ff\">bar}</font>baz",
     [true,true],
     {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 255)",false,false,"rgb(0, 0, 255)"]}],
+// Once the inner <span> style is updated, it has same style as the outer one.
+// Therefore, it may be okay to use the outer one is the only container of the
+// text nodes or it may be okay to split the outer one and keep 3 <span>s.
 ["<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>",
     [["stylewithcss","true"],["forecolor","#0000FF"]],
-    "<span style=\"color:rgb(0, 0, 255)\">foo</span><span style=\"color:rgb(0, 0, 255)\">bar</span><span style=\"color:rgb(0, 0, 255)\">baz</span>",
+    ["<span style=\"color:rgb(0, 0, 255)\">foo</span><span style=\"color:rgb(0, 0, 255)\">bar</span><span style=\"color:rgb(0, 0, 255)\">baz</span>",
+     "<span style=\"color:rgb(0, 0, 255)\">foo[bar]baz</span>"],
     [true,true],
     {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}],
 ["<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>",
@@ -410,9 +414,12 @@
     "<span style=\"color:rgb(0, 0, 255)\">foo[bar]baz</span>",
     [true,true],
     {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}],
+// Use the inner <font> for the `style` attribute container.  Then, the outer
+// <font> should be split and may be serialized.
 ["<font color=blue>foo<font color=brown>[bar]</font>baz</font>",
     [["stylewithcss","true"],["forecolor","#0000FF"]],
-    "<font color=\"blue\">foo[bar]baz</font>",
+    ["<span style=\"color:rgb(0, 0, 255)\">foo</span><font style=\"color:rgb(0, 0, 255)\">bar</font><span style=\"color:rgb(0, 0, 255)\">baz</span>",
+     "<font color=\"blue\">foo</font><span style=\"color:rgb(0, 0, 255)\">bar</span><font color=\"blue\">baz</font>"],
     [true,true],
     {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}],
 ["<font color=blue>foo<font color=brown>[bar]</font>baz</font>",