diff --git a/components/script/dom/execcommand/contenteditable/node.rs b/components/script/dom/execcommand/contenteditable/node.rs index bfa3dfaca26..b5496231a29 100644 --- a/components/script/dom/execcommand/contenteditable/node.rs +++ b/components/script/dom/execcommand/contenteditable/node.rs @@ -1281,8 +1281,10 @@ impl Node { // set the "text-decoration" property of new parent to "underline". CommandName::Underline => { if new_value == "underline" && - self.effective_command_value(&CommandName::Underline) - .is_some_and(|value| value == "underline") + new_parent + .upcast::() + .effective_command_value(&CommandName::Underline) + .is_none_or(|value| value != "underline") { CssPropertyName::TextDecorationLine.set_for_element( cx, diff --git a/tests/wpt/meta/editing/run/underline.html.ini b/tests/wpt/meta/editing/run/underline.html.ini index de691bdefbc..12d0cdd4875 100644 --- a/tests/wpt/meta/editing/run/underline.html.ini +++ b/tests/wpt/meta/editing/run/underline.html.ini @@ -2,96 +2,54 @@ [[["stylewithcss","true"\],["underline",""\]\] "

[foo

bar\]

" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

[foo

bar\]

" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "[foo bar\]" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "[foo bar\]" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "[foo bar\]" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "

[foo

bar

baz\]

" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

[foo

bar

baz\]

" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "

[foo

bar

baz\]

" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "

[foo


bar\]" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

[foo


bar\]" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "

[foo


bar\]" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[barbaz\]qozquz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[barbaz\]qozquz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[barbaz\]qozquz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[barbaz\]qozquz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "{

foo

}" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "{

foo

}" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foob[a\]rbaz
" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foob[a\]rbaz
" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "
foobarbaz
" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "{
foobarbaz
}" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "{
foobarbaz
}" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL @@ -134,60 +92,33 @@ [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

foo[bar\]baz

" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

foo[bar\]baz

" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

[foo

bar\]

" queryCommandState("stylewithcss") before] expected: FAIL @@ -206,6 +137,21 @@ [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] expected: FAIL + [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] + expected: FAIL + + [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] + expected: FAIL + + [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] + expected: FAIL + + [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] + expected: FAIL + + [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] + expected: FAIL + [underline.html?2001-last] [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] @@ -262,6 +208,9 @@ [[["stylewithcss","false"\],["underline",""\]\] "fo[ob\]ar" queryCommandState("underline") after] expected: FAIL + [[["stylewithcss","true"\],["underline",""\]\] "fo[ob\]ar" queryCommandState("underline") after] + expected: FAIL + [underline.html?1001-2000] [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] @@ -270,69 +219,36 @@ [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL @@ -357,66 +273,39 @@ [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

foo[bar\]baz

" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "

foo[bar\]baz

" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foo[bar\]baz" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" compare innerHTML] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "foob[a\]rbaz" queryCommandState("underline") after] - expected: FAIL - [[["underline",""\]\] "fo[ob\]arbaz" queryCommandIndeterm("underline") before] expected: FAIL @@ -432,9 +321,6 @@ [[["stylewithcss","true"\],["underline",""\]\] "fo[obarb\]az" queryCommandIndeterm("underline") before] expected: FAIL - [[["stylewithcss","true"\],["underline",""\]\] "fo[obarb\]az" queryCommandState("underline") after] - expected: FAIL - [[["stylewithcss","false"\],["underline",""\]\] "fo[obarb\]az" queryCommandIndeterm("underline") before] expected: FAIL @@ -470,3 +356,6 @@ [[["stylewithcss","false"\],["underline",""\]\] "fooba[r\]baz" queryCommandState("underline") after] expected: FAIL + + [[["stylewithcss","true"\],["underline",""\]\] "fooba[r\]baz" queryCommandState("underline") after] + expected: FAIL