mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 20:26:53 +00:00
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:
parent
d9124c8058
commit
5f84c2c3af
Notes:
github-actions[bot]
2024-10-31 09:47:30 +00:00
Author: https://github.com/gmta
Commit: 5f84c2c3af
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2036
Reviewed-by: https://github.com/tcl3
14 changed files with 130 additions and 117 deletions
33
Userland/Libraries/LibWeb/HTML/HTMLOrSVGElement.h
Normal file
33
Userland/Libraries/LibWeb/HTML/HTMLOrSVGElement.h
Normal 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 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue