mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb: Make Node.normalize() ignore CDATASection nodes
We hadn't modeled the "exclusive text node" concept correctly.
This commit is contained in:
parent
6fc06f45c2
commit
ab0dc83d28
Notes:
github-actions[bot]
2024-11-20 15:12:01 +00:00
Author: https://github.com/awesomekling
Commit: ab0dc83d28
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2458
4 changed files with 101 additions and 9 deletions
|
@ -235,10 +235,7 @@ WebIDL::ExceptionOr<void> Node::normalize()
|
|||
Vector<Text*> nodes;
|
||||
|
||||
auto* current_node = node.previous_sibling();
|
||||
while (current_node) {
|
||||
if (!current_node->is_text())
|
||||
break;
|
||||
|
||||
while (current_node && current_node->is_exclusive_text()) {
|
||||
nodes.append(static_cast<Text*>(current_node));
|
||||
current_node = current_node->previous_sibling();
|
||||
}
|
||||
|
@ -247,10 +244,7 @@ WebIDL::ExceptionOr<void> Node::normalize()
|
|||
nodes.reverse();
|
||||
|
||||
current_node = node.next_sibling();
|
||||
while (current_node) {
|
||||
if (!current_node->is_text())
|
||||
break;
|
||||
|
||||
while (current_node && current_node->is_exclusive_text()) {
|
||||
nodes.append(static_cast<Text*>(current_node));
|
||||
current_node = current_node->next_sibling();
|
||||
}
|
||||
|
@ -291,7 +285,7 @@ WebIDL::ExceptionOr<void> Node::normalize()
|
|||
auto* current_node = node.next_sibling();
|
||||
|
||||
// 6. While currentNode is an exclusive Text node:
|
||||
while (current_node && is<Text>(*current_node)) {
|
||||
while (current_node && current_node->is_exclusive_text()) {
|
||||
// 1. For each live range whose start node is currentNode, add length to its start offset and set its start node to node.
|
||||
for (auto& range : Range::live_ranges()) {
|
||||
if (range->start_container() == current_node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue