mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Put editing command "styleWithCSS" in alphabetical order
This commit is contained in:
parent
98df4c2b3c
commit
a62b664d0d
Notes:
github-actions[bot]
2024-12-04 05:53:22 +00:00
Author: https://github.com/gmta
Commit: a62b664d0d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2735
Reviewed-by: https://github.com/tcl3
2 changed files with 20 additions and 20 deletions
|
@ -19,24 +19,6 @@
|
||||||
|
|
||||||
namespace Web::Editing {
|
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
|
// https://w3c.github.io/editing/docs/execCommand/#the-defaultparagraphseparator-command
|
||||||
bool command_default_paragraph_separator_action(DOM::Document& document, String const& input_value)
|
bool command_default_paragraph_separator_action(DOM::Document& document, String const& input_value)
|
||||||
{
|
{
|
||||||
|
@ -384,6 +366,24 @@ bool command_delete_action(DOM::Document& document, String const&)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
static Array const commands {
|
static Array const commands {
|
||||||
CommandDefinition { CommandNames::delete_, command_delete_action, {}, {}, {} },
|
CommandDefinition { CommandNames::delete_, command_delete_action, {}, {}, {} },
|
||||||
CommandDefinition { CommandNames::defaultParagraphSeparator, command_default_paragraph_separator_action, {}, {}, command_default_paragraph_separator_value },
|
CommandDefinition { CommandNames::defaultParagraphSeparator, command_default_paragraph_separator_action, {}, {}, command_default_paragraph_separator_value },
|
||||||
|
|
|
@ -21,10 +21,10 @@ struct CommandDefinition {
|
||||||
Optional<CommandDefinition const&> find_command_definition(FlyString const&);
|
Optional<CommandDefinition const&> find_command_definition(FlyString const&);
|
||||||
|
|
||||||
// Command implementations
|
// Command implementations
|
||||||
bool command_style_with_css_action(DOM::Document&, String const&);
|
|
||||||
bool command_style_with_css_state(DOM::Document const&);
|
|
||||||
bool command_default_paragraph_separator_action(DOM::Document&, String const&);
|
bool command_default_paragraph_separator_action(DOM::Document&, String const&);
|
||||||
String command_default_paragraph_separator_value(DOM::Document const&);
|
String command_default_paragraph_separator_value(DOM::Document const&);
|
||||||
bool command_delete_action(DOM::Document&, String const&);
|
bool command_delete_action(DOM::Document&, String const&);
|
||||||
|
bool command_style_with_css_action(DOM::Document&, String const&);
|
||||||
|
bool command_style_with_css_state(DOM::Document const&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue