mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Use TraversalDecision
for multi level Node traversal methods
This adds the `SkipChildrenAndContinue` option, where traversal continues but child nodes are not included.
This commit is contained in:
parent
c57d395a48
commit
398bf10b92
Notes:
sideshowbarker
2024-07-17 08:59:18 +09:00
Author: https://github.com/tcl3
Commit: 398bf10b92
Pull-request: https://github.com/SerenityOS/serenity/pull/24207
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/shannonbooth ✅
33 changed files with 229 additions and 215 deletions
|
@ -2290,11 +2290,11 @@ Element::Directionality Element::directionality() const
|
|||
// Discard not-allowed ancestors
|
||||
for (auto* ancestor = text_node.parent(); ancestor && ancestor != this; ancestor = ancestor->parent()) {
|
||||
if (is<HTML::HTMLScriptElement>(*ancestor) || is<HTML::HTMLStyleElement>(*ancestor) || is<HTML::HTMLTextAreaElement>(*ancestor))
|
||||
return IterationDecision::Continue;
|
||||
return TraversalDecision::Continue;
|
||||
if (ancestor->is_element()) {
|
||||
auto ancestor_element = static_cast<Element const*>(ancestor);
|
||||
if (ancestor_element->dir().has_value())
|
||||
return IterationDecision::Continue;
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2304,11 +2304,11 @@ Element::Directionality Element::directionality() const
|
|||
if (first_is_one_of(bidi_class, bidirectional_class_L, bidirectional_class_AL, bidirectional_class_R)) {
|
||||
found_character = code_point;
|
||||
found_character_bidi_class = bidi_class;
|
||||
return IterationDecision::Break;
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
}
|
||||
|
||||
return IterationDecision::Continue;
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
|
||||
// If such a character is found and it is of bidirectional character type AL or R,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue