mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibWeb: Don't try to set selection with anchor/focus in different roots
If the anchor and focus nodes are not within the same document, we can't use them for a selection range. Found by Domato.
This commit is contained in:
parent
4e0edd42b9
commit
416c478876
Notes:
github-actions[bot]
2024-07-20 07:31:52 +00:00
Author: https://github.com/awesomekling
Commit: 416c478876
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/721
3 changed files with 13 additions and 1 deletions
|
@ -307,7 +307,7 @@ WebIDL::ExceptionOr<void> Selection::set_base_and_extent(JS::NonnullGCPtr<DOM::N
|
|||
return WebIDL::IndexSizeError::create(realm(), "Focus offset points outside of the focus node"_fly_string);
|
||||
|
||||
// 2. If document associated with this is not a shadow-including inclusive ancestor of anchorNode or focusNode, abort these steps.
|
||||
if (!(m_document->is_shadow_including_inclusive_ancestor_of(anchor_node) || m_document->is_shadow_including_inclusive_ancestor_of(focus_node)))
|
||||
if (!m_document->is_shadow_including_inclusive_ancestor_of(anchor_node) || !m_document->is_shadow_including_inclusive_ancestor_of(focus_node))
|
||||
return {};
|
||||
|
||||
// 3. Let anchor be the boundary point (anchorNode, anchorOffset) and let focus be the boundary point (focusNode, focusOffset).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue