mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 23:59:53 +00:00
LibWeb: Use as_if
in Editing API where useful
This arguably improves readability in a couple of places. No functional changes.
This commit is contained in:
parent
d40ccb97ec
commit
2cee6aeba3
Notes:
github-actions[bot]
2025-01-21 17:51:18 +00:00
Author: https://github.com/gmta
Commit: 2cee6aeba3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3337
Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 18 additions and 21 deletions
|
@ -146,8 +146,8 @@ bool Document::query_command_enabled(FlyString const& command)
|
|||
|
||||
// NOTE: Commands can define additional conditions for being enabled, and currently the only condition mentioned in
|
||||
// the spec is that certain commands must not be enabled if the editing host is in the plaintext-only state.
|
||||
if (is<HTML::HTMLElement>(start_node_editing_host.ptr())
|
||||
&& static_cast<HTML::HTMLElement&>(*start_node_editing_host).content_editable_state() == HTML::ContentEditableState::PlaintextOnly
|
||||
if (auto const* html_element = as_if<HTML::HTMLElement>(start_node_editing_host.ptr()); html_element
|
||||
&& html_element->content_editable_state() == HTML::ContentEditableState::PlaintextOnly
|
||||
&& command.is_one_of(
|
||||
Editing::CommandNames::backColor,
|
||||
Editing::CommandNames::bold,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue