mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Refactor "editable" and "editing host" concepts
The DOM spec defines what it means for an element to be an "editing host", and the Editing spec does the same for the "editable" concept. Replace our `Node::is_editable()` implementation with these spec-compliant algorithms. An editing host is an element that has the properties to make its contents effectively editable. Editable elements are descendants of an editing host. Concepts like the inheritable contenteditable attribute are propagated through the editable algorithm.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
f88c13a58c
commit
1c55153d43
@@ -564,7 +564,12 @@ void paint_cursor_if_needed(PaintContext& context, TextPaintable const& paintabl
|
||||
if (cursor_position->offset() < (unsigned)fragment.start() || cursor_position->offset() > (unsigned)(fragment.start() + fragment.length()))
|
||||
return;
|
||||
|
||||
if (!fragment.layout_node().dom_node() || !fragment.layout_node().dom_node()->is_editable())
|
||||
auto active_element = document.active_element();
|
||||
auto active_element_is_editable = is<HTML::FormAssociatedTextControlElement>(active_element)
|
||||
&& dynamic_cast<HTML::FormAssociatedTextControlElement const&>(*active_element).is_mutable();
|
||||
|
||||
auto dom_node = fragment.layout_node().dom_node();
|
||||
if (!dom_node || (!dom_node->is_editable() && !active_element_is_editable))
|
||||
return;
|
||||
|
||||
auto fragment_rect = fragment.absolute_rect();
|
||||
|
||||
Reference in New Issue
Block a user