mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Implement document.execCommand("styleWithCSS")
This commit is contained in:
parent
bb618736e9
commit
4b0d8cbfad
Notes:
github-actions[bot]
2024-11-30 16:36:59 +00:00
Author: https://github.com/gmta
Commit: 4b0d8cbfad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2655
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/yyny
3 changed files with 28 additions and 0 deletions
|
@ -19,6 +19,24 @@
|
|||
|
||||
namespace Web::Editing {
|
||||
|
||||
// https://w3c.github.io/editing/docs/execCommand/#the-stylewithcss-command
|
||||
bool command_style_with_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 false.
|
||||
// Otherwise, set the CSS styling flag to true.
|
||||
document.set_css_styling_flag(!value.equals_ignoring_ascii_case("false"sv));
|
||||
|
||||
// Either way, return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/editing/docs/execCommand/#the-stylewithcss-command
|
||||
bool command_style_with_css_state(DOM::Document const& document)
|
||||
{
|
||||
// True if the CSS styling flag is true, otherwise false.
|
||||
return document.css_styling_flag();
|
||||
}
|
||||
|
||||
// https://w3c.github.io/editing/docs/execCommand/#the-defaultparagraphseparator-command
|
||||
bool command_default_paragraph_separator_action(DOM::Document& document, String const& input_value)
|
||||
{
|
||||
|
@ -369,6 +387,7 @@ bool command_delete_action(DOM::Document& document, String const&)
|
|||
static Array const commands {
|
||||
CommandDefinition { CommandNames::delete_, command_delete_action, {}, {}, {} },
|
||||
CommandDefinition { CommandNames::defaultParagraphSeparator, command_default_paragraph_separator_action, {}, {}, command_default_paragraph_separator_value },
|
||||
CommandDefinition { CommandNames::styleWithCSS, command_style_with_css_action, {}, command_style_with_css_state, {} },
|
||||
};
|
||||
|
||||
Optional<CommandDefinition const&> find_command_definition(FlyString const& command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue