LibWeb: Check for editability and visibility of "formattable nodes"

The associated spec was only partially implemented.
This commit is contained in:
Jelle Raaijmakers 2024-12-22 22:30:45 +01:00 committed by Andreas Kling
parent 85abad30b0
commit 67800091c5
Notes: github-actions[bot] 2025-01-10 22:38:39 +00:00

View file

@ -1642,7 +1642,8 @@ bool is_extraneous_line_break(GC::Ref<DOM::Node> node)
bool is_formattable_node(GC::Ref<DOM::Node> node)
{
// A formattable node is an editable visible node that is either a Text node, an img, or a br.
return is<DOM::Text>(*node) || is<HTML::HTMLImageElement>(*node) || is<HTML::HTMLBRElement>(*node);
return node->is_editable() && is_visible_node(node)
&& (is<DOM::Text>(*node) || is<HTML::HTMLImageElement>(*node) || is<HTML::HTMLBRElement>(*node));
}
// https://w3c.github.io/editing/docs/execCommand/#in-the-same-editing-host