ladybird/Libraries/LibWeb/DOM/ElementByIdMap.h
Andreas Kling dfa796a4e4 LibJS+LibWeb: Use GC::Weak instead of AK::WeakPtr for GC-allocated types
This makes some common types like JS::Object smaller (by 8 bytes) and
yields a minor speed improvement on many benchmarks.
2025-10-17 17:22:16 +02:00

24 lines
496 B
C++

/*
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Forward.h>
namespace Web::DOM {
class ElementByIdMap {
public:
void add(FlyString const& element_id, Element&);
void remove(FlyString const& element_id, Element&);
GC::Ptr<Element> get(FlyString const& element_id) const;
private:
HashMap<FlyString, Vector<GC::Weak<Element>>> m_map;
};
}