mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
55
Libraries/LibXML/DOM/Node.cpp
Normal file
55
Libraries/LibXML/DOM/Node.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibXML/DOM/Node.h>
|
||||
|
||||
namespace XML {
|
||||
|
||||
bool Node::operator==(Node const& other) const
|
||||
{
|
||||
return content.visit(
|
||||
[&](Text const& text) -> bool {
|
||||
auto other_text = other.content.get_pointer<Text>();
|
||||
if (!other_text)
|
||||
return false;
|
||||
return text.builder.string_view() == other_text->builder.string_view();
|
||||
},
|
||||
[&](Comment const& comment) -> bool {
|
||||
auto other_comment = other.content.get_pointer<Comment>();
|
||||
if (!other_comment)
|
||||
return false;
|
||||
return comment.text == other_comment->text;
|
||||
},
|
||||
[&](Element const& element) -> bool {
|
||||
auto other_element = other.content.get_pointer<Element>();
|
||||
if (!other_element)
|
||||
return false;
|
||||
if (element.name != other_element->name)
|
||||
return false;
|
||||
if (element.attributes.size() != other_element->attributes.size())
|
||||
return false;
|
||||
|
||||
for (auto& entry : element.attributes) {
|
||||
auto it = other_element->attributes.find(entry.key);
|
||||
if (it == other_element->attributes.end())
|
||||
return false;
|
||||
if (it->value != entry.value)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.children.size() != other_element->children.size())
|
||||
return false;
|
||||
for (size_t i = 0; i < element.children.size(); ++i) {
|
||||
if (element.children[i].ptr() != other_element->children[i].ptr())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue