LibWeb: Factor out HTMLOrSVGElement

This is a mixin in the IDL, so let's treat it as a mixin in our code and
let both SVGElement and MathMLElement reuse the implementations that we
wrote for HTMLElement.
This commit is contained in:
Jelle Raaijmakers 2024-10-29 11:07:02 +01:00
commit 5f84c2c3af
Notes: github-actions[bot] 2024-10-31 09:47:30 +00:00
14 changed files with 130 additions and 117 deletions

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/HTML/DOMStringMap.h>
namespace Web::HTML {
template<typename ElementBase>
class HTMLOrSVGElement {
public:
[[nodiscard]] JS::NonnullGCPtr<DOMStringMap> dataset();
void focus();
void blur();
protected:
void visit_edges(JS::Cell::Visitor&);
// https://html.spec.whatwg.org/multipage/dom.html#dom-dataset-dev
JS::GCPtr<DOMStringMap> m_dataset;
// https://html.spec.whatwg.org/multipage/interaction.html#locked-for-focus
bool m_locked_for_focus { false };
};
}