mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Return true if invalid color was provided to an editing command
Both Chrome and Firefox return `true` whenever the value string provided is an invalid color or the current color. Spec issue raised: https://github.com/w3c/editing/issues/476
This commit is contained in:
parent
2b7ff194f8
commit
0c854f9afc
Notes:
github-actions[bot]
2025-01-24 22:54:37 +00:00
Author: https://github.com/gmta
Commit: 0c854f9afc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3352
3 changed files with 10 additions and 4 deletions
|
@ -35,9 +35,10 @@ bool command_back_color_action(DOM::Document& document, String const& value)
|
|||
resulting_value = MUST(String::formatted("#{}", resulting_value));
|
||||
|
||||
// 2. If value is still not a valid CSS color, or if it is currentColor, return false.
|
||||
// AD-HOC: No browser does this. They always return true.
|
||||
if (!Color::from_string(resulting_value).has_value()) {
|
||||
// FIXME: Also return false in case of currentColor.
|
||||
return false;
|
||||
// FIXME: Also return true in case of currentColor.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,9 +603,10 @@ bool command_fore_color_action(DOM::Document& document, String const& value)
|
|||
resulting_value = MUST(String::formatted("#{}", resulting_value));
|
||||
|
||||
// 2. If value is still not a valid CSS color, or if it is currentColor, return false.
|
||||
// AD-HOC: No browser does this. They always return true.
|
||||
if (!Color::from_string(resulting_value).has_value()) {
|
||||
// FIXME: Also return false in case of currentColor.
|
||||
return false;
|
||||
// FIXME: Also return true in case of currentColor.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue