ladybird/Libraries/LibWeb/DOM/ElementReference.h
Sam Atkins eb1ad8655e LibWeb/CSS: Move and rename PseudoElement types to prep for code gen
The upcoming generated types will match those for pseudo-classes: A
PseudoElementSelector type, that then holds a PseudoElement enum
defining what it is. That enum will be at the top level in the Web::CSS
namespace.

In order to keep the diffs clearer, this commit renames and moves the
types, and then a following one will replace the handwritten enum with
a generated one.
2025-03-21 12:06:37 +00:00

37 lines
834 B
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGC/Cell.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/DOM/Element.h>
namespace Web::DOM {
class ElementReference {
public:
ElementReference(GC::Ref<Element> element, Optional<CSS::PseudoElement> pseudo_element = {})
: m_element(element)
, m_pseudo_element(move(pseudo_element))
{
}
Element& element() { return m_element; }
Element const& element() const { return m_element; }
Optional<CSS::PseudoElement> pseudo_element() const { return m_pseudo_element; }
void visit(GC::Cell::Visitor& visitor) const
{
visitor.visit(m_element);
}
private:
GC::Ref<Element> m_element;
Optional<CSS::PseudoElement> m_pseudo_element;
};
}