mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09:00
LibWeb: Implement the "useCSS" editing command
This commit is contained in:
parent
70af48c18b
commit
98ec1825de
Notes:
github-actions[bot]
2025-01-10 22:34:32 +00:00
Author: https://github.com/gmta
Commit: 98ec1825de
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
2 changed files with 17 additions and 0 deletions
|
@ -2448,6 +2448,17 @@ bool command_unlink_action(DOM::Document& document, String const&)
|
||||||
return true;
|
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 {
|
static Array const commands {
|
||||||
// https://w3c.github.io/editing/docs/execCommand/#the-backcolor-command
|
// https://w3c.github.io/editing/docs/execCommand/#the-backcolor-command
|
||||||
CommandDefinition {
|
CommandDefinition {
|
||||||
|
@ -2671,6 +2682,11 @@ static Array const commands {
|
||||||
.command = CommandNames::unlink,
|
.command = CommandNames::unlink,
|
||||||
.action = command_unlink_action,
|
.action = command_unlink_action,
|
||||||
},
|
},
|
||||||
|
// https://w3c.github.io/editing/docs/execCommand/#the-usecss-command
|
||||||
|
CommandDefinition {
|
||||||
|
.command = CommandNames::useCSS,
|
||||||
|
.action = command_use_css_action,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Optional<CommandDefinition const&> find_command_definition(FlyString const& command)
|
Optional<CommandDefinition const&> find_command_definition(FlyString const& command)
|
||||||
|
|
|
@ -85,5 +85,6 @@ bool command_superscript_action(DOM::Document&, String const&);
|
||||||
bool command_superscript_indeterminate(DOM::Document const&);
|
bool command_superscript_indeterminate(DOM::Document const&);
|
||||||
bool command_underline_action(DOM::Document&, String const&);
|
bool command_underline_action(DOM::Document&, String const&);
|
||||||
bool command_unlink_action(DOM::Document&, String const&);
|
bool command_unlink_action(DOM::Document&, String const&);
|
||||||
|
bool command_use_css_action(DOM::Document&, String const&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue