ladybird/Libraries/LibWeb/HTML/HTMLElement.idl
Sam Atkins f9f4c36f20 LibWeb: Implement the headingoffset and headingreset attributes
:heading() now matches based on a computed heading level, which is based
on the level of the tag (h1, h2, etc) and then modified by these two new
attributes.

I'm caching this heading level on HTMLHeadingElement, based on the dom
tree version. That's more invalidation than is actually needed, but it
saves us calculating it over and over when the document hasn't changed.

The failing test cases are:
- Implicit headingreset for modal dialogs which is apparently unspecced
  and controversial.
- Not walking the flat tree properly. A flat tree ancestor of a
  slot-assigned element is its slot, which is something we don't do
  anywhere that I could find. I've made a note to look into this later.

We also don't implement the `ReflectRange` IDL attribute yet, which
means we're not clamping the read value of `headingOffset`.

Corresponds to:
e774e8e318
2025-12-15 14:08:24 +00:00

102 lines
3.4 KiB
Text

#import <CSS/ElementCSSInlineStyle.idl>
#import <HTML/DOMStringMap.idl>
#import <HTML/ElementInternals.idl>
#import <HTML/HTMLOrSVGElement.idl>
#import <DOM/Element.idl>
#import <DOM/EventHandler.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlelement
[Exposed=Window]
interface HTMLElement : Element {
[HTMLConstructor] constructor();
// metadata attributes
[Reflect, CEReactions] attribute DOMString title;
[Reflect, CEReactions] attribute DOMString lang;
[CEReactions] attribute boolean translate;
[CEReactions] attribute DOMString dir;
// user interaction
[CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
[Reflect, CEReactions] attribute boolean inert;
undefined click();
[Reflect=accesskey, CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute boolean autocorrect;
[LegacyNullToEmptyString, CEReactions] attribute Utf16DOMString innerText;
[LegacyNullToEmptyString, CEReactions] attribute Utf16DOMString outerText;
ElementInternals attachInternals();
// The popover API
[ImplementedAs=show_popover_for_bindings] undefined showPopover(optional ShowPopoverOptions options = {});
[ImplementedAs=hide_popover_for_bindings] undefined hidePopover();
boolean togglePopover(optional (TogglePopoverOptions or boolean) options = {});
[CEReactions] attribute DOMString? popover;
// FIXME: Should be `[CEReactions, Reflect, ReflectRange=(0, 8)]`
[CEReactions, Reflect, ReflectRange=(0, 8)] attribute unsigned long headingOffset;
[CEReactions, Reflect] attribute boolean headingReset;
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
readonly attribute Element? scrollParent;
readonly attribute Element? offsetParent;
readonly attribute long offsetTop;
readonly attribute long offsetLeft;
readonly attribute long offsetWidth;
readonly attribute long offsetHeight;
};
// https://html.spec.whatwg.org/multipage/dom.html#showpopoveroptions
dictionary ShowPopoverOptions {
HTMLElement source;
};
// https://html.spec.whatwg.org/multipage/dom.html#togglepopoveroptions
dictionary TogglePopoverOptions : ShowPopoverOptions {
boolean force;
};
HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
// https://html.spec.whatwg.org/multipage/interaction.html#attr-enterkeyhint
enum EnterKeyHint {
"enter",
"done",
"go",
"next",
"previous",
"search",
"send"
};
// https://html.spec.whatwg.org/multipage/interaction.html#attr-inputmode
enum InputMode {
"none",
"text",
"tel",
"url",
"email",
"numeric",
"decimal",
"search"
};
// https://html.spec.whatwg.org/multipage/interaction.html#elementcontenteditable
interface mixin ElementContentEditable {
[CEReactions] attribute DOMString contentEditable;
[Reflect=enterkeyhint, Enumerated=EnterKeyHint, CEReactions] attribute DOMString enterKeyHint;
readonly attribute boolean isContentEditable;
[Reflect=inputmode, Enumerated=InputMode, CEReactions] attribute DOMString inputMode;
};
HTMLElement includes ElementCSSInlineStyle;