diff --git a/Libraries/LibWeb/Editing/Commands.cpp b/Libraries/LibWeb/Editing/Commands.cpp index 5592019192f..504062509de 100644 --- a/Libraries/LibWeb/Editing/Commands.cpp +++ b/Libraries/LibWeb/Editing/Commands.cpp @@ -2448,6 +2448,17 @@ bool command_unlink_action(DOM::Document& document, String const&) return true; } +// https://w3c.github.io/editing/docs/execCommand/#the-usecss-command +bool command_use_css_action(DOM::Document& document, String const& value) +{ + // If value is an ASCII case-insensitive match for the string "false", set the CSS styling flag to true. + // Otherwise, set the CSS styling flag to false. + document.set_css_styling_flag(value.equals_ignoring_ascii_case("false"sv)); + + // Either way, return true. + return true; +} + static Array const commands { // https://w3c.github.io/editing/docs/execCommand/#the-backcolor-command CommandDefinition { @@ -2671,6 +2682,11 @@ static Array const commands { .command = CommandNames::unlink, .action = command_unlink_action, }, + // https://w3c.github.io/editing/docs/execCommand/#the-usecss-command + CommandDefinition { + .command = CommandNames::useCSS, + .action = command_use_css_action, + }, }; Optional find_command_definition(FlyString const& command) diff --git a/Libraries/LibWeb/Editing/Commands.h b/Libraries/LibWeb/Editing/Commands.h index 611b3eb781a..2c4e15da17f 100644 --- a/Libraries/LibWeb/Editing/Commands.h +++ b/Libraries/LibWeb/Editing/Commands.h @@ -85,5 +85,6 @@ bool command_superscript_action(DOM::Document&, String const&); bool command_superscript_indeterminate(DOM::Document const&); bool command_underline_action(DOM::Document&, String const&); bool command_unlink_action(DOM::Document&, String const&); +bool command_use_css_action(DOM::Document&, String const&); }