Files
ladybird/Libraries/LibWeb/Internals/Internals.idl
Andreas Kling a72fae8d36 LibWeb: Add test-only counters for :has() invalidation work
Introduce a small set of counters on Document that track the work done
while processing :has() invalidation: how often the upward walk runs,
how many elements it visits, how often matches_has_pseudo_class() is
invoked, how well the per-pass result cache performs, and how many
elements transition from clean to needs-style-update.

Expose the counters through internals so tests can assert precise bounds
on the invalidation work triggered by a mutation, which regular
reference tests cannot express.

Add a css-has-invalidation test suite that covers subject-position,
non-subject-position, sibling-combinator, and no-:has() cases. The
baseline tests share a helper script so later coverage can reuse the
same counter-printing path.

The counters are test-only observation; they do not affect style
computation itself.
2026-04-20 13:20:41 +02:00

99 lines
3.8 KiB
Plaintext

#import <DOM/EventTarget.idl>
#import <HTML/HTMLElement.idl>
#import <Internals/InternalAnimationTimeline.idl>
#import <Internals/InternalGamepad.idl>
[Exposed=Nobody]
interface Internals {
undefined signalTestIsDone(DOMString text);
undefined setTestTimeout(double milliseconds);
undefined loadReferenceTestMetadata();
undefined loadTestVariants();
DOMString setTimeZone(DOMString timeZone);
undefined gc();
Promise<undefined> gcAsync();
object hitTest(double x, double y);
const unsigned short MOD_NONE = 0;
const unsigned short MOD_ALT = 1;
const unsigned short MOD_CTRL = 2;
const unsigned short MOD_SHIFT = 4;
const unsigned short MOD_SUPER = 8;
const unsigned short MOD_KEYPAD = 16;
const unsigned short BUTTON_LEFT = 0;
const unsigned short BUTTON_MIDDLE = 1;
const unsigned short BUTTON_RIGHT = 2;
undefined sendText(HTMLElement target, DOMString text, optional unsigned short modifiers = 0);
undefined sendKey(HTMLElement target, DOMString keyName, optional unsigned short modifiers = 0);
undefined paste(HTMLElement target, Utf16DOMString text);
undefined commitText();
// Low-level mouse primitives
undefined mouseDown(double x, double y, optional unsigned short clickCount = 1, optional unsigned short button = 0, optional unsigned short modifiers = 0);
undefined mouseUp(double x, double y, optional unsigned short button = 0, optional unsigned short modifiers = 0);
undefined mouseMove(double x, double y, optional unsigned short modifiers = 0);
// High-level mouse conveniences
undefined click(double x, double y, optional unsigned short clickCount = 1, optional unsigned short button = 0, optional unsigned short modifiers = 0);
undefined clickAndHold(double x, double y, optional unsigned short clickCount = 1, optional unsigned short button = 0, optional unsigned short modifiers = 0);
undefined wheel(double x, double y, double deltaX, double deltaY);
undefined pinch(double x, double y, double scaleDelta);
DOMString currentCursor();
boolean dispatchUserActivatedEvent(EventTarget target, Event event);
undefined spoofCurrentURL(USVString url);
InternalAnimationTimeline createInternalAnimationTimeline();
undefined simulateDragStart(double x, double y, DOMString mimeType, DOMString contents);
undefined simulateDragMove(double x, double y);
undefined simulateDrop(double x, double y);
undefined expireCookiesWithTimeOffset(long long seconds);
boolean setHttpMemoryCacheEnabled(boolean enabled);
DOMString getComputedRole(Element element);
DOMString getComputedLabel(Element element);
DOMString getComputedAriaLevel(Element element);
unsigned short getEchoServerPort();
undefined setBrowserZoom(double factor);
undefined setDevicePixelRatio(double ratio);
readonly attribute boolean headless;
DOMString dumpDisplayList();
DOMString dumpLayoutTree(Node node);
DOMString dumpPaintableTree(Node node);
DOMString dumpStackingContextTree();
DOMString dumpGCGraph();
DOMString dumpSessionHistory();
// Returns the shadow root of the element, if it has one, even if it's not normally accessible to JS.
ShadowRoot? getShadowRoot(Element element);
undefined handleSDLInputEvents();
undefined setEnvironmentsTopLevelURL(USVString url);
InternalGamepad connectVirtualGamepad();
undefined setHighlightedNode(Node? node);
undefined clearElement(HTMLElement element);
// Returns a snapshot of the style-invalidation counters for the current document.
// Keys: hasAncestorWalkInvocations, hasAncestorWalkVisits, hasMatchInvocations,
// hasResultCacheHits, hasResultCacheMisses.
object getStyleInvalidationCounters();
undefined resetStyleInvalidationCounters();
};