1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibWeb: Make the Node.compareDocumentPosition() return value enum public

This will allow other parts of LibWeb to understand these values.
This commit is contained in:
Andreas Kling 2023-03-30 11:14:26 +02:00
parent a925c2dcf2
commit d4b2544dc5
2 changed files with 11 additions and 10 deletions

View file

@ -927,16 +927,6 @@ void Node::remove_all_children(bool suppress_observers)
// https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
u16 Node::compare_document_position(JS::GCPtr<Node> other)
{
enum Position : u16 {
DOCUMENT_POSITION_EQUAL = 0,
DOCUMENT_POSITION_DISCONNECTED = 1,
DOCUMENT_POSITION_PRECEDING = 2,
DOCUMENT_POSITION_FOLLOWING = 4,
DOCUMENT_POSITION_CONTAINS = 8,
DOCUMENT_POSITION_CONTAINED_BY = 16,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32,
};
// 1. If this is other, then return zero.
if (this == other.ptr())
return DOCUMENT_POSITION_EQUAL;

View file

@ -101,6 +101,17 @@ public:
void insert_before(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child, bool suppress_observers = false);
void remove(bool suppress_observers = false);
void remove_all_children(bool suppress_observers = false);
enum DocumentPosition : u16 {
DOCUMENT_POSITION_EQUAL = 0,
DOCUMENT_POSITION_DISCONNECTED = 1,
DOCUMENT_POSITION_PRECEDING = 2,
DOCUMENT_POSITION_FOLLOWING = 4,
DOCUMENT_POSITION_CONTAINS = 8,
DOCUMENT_POSITION_CONTAINED_BY = 16,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32,
};
u16 compare_document_position(JS::GCPtr<Node> other);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> replace_child(JS::NonnullGCPtr<Node> node, JS::NonnullGCPtr<Node> child);