Files
ladybird/Libraries/LibWeb/DOM/StyleInvalidationReason.h
Aliaksandr Kalenik 30e4779acb AK+LibWeb: Reduce recompilation impact of DOM/Node.h
Remove includes from Node.h that are only needed for forward
declarations (AccessibilityTreeNode.h, XMLSerializer.h,
JsonObjectSerializer.h). Extract StyleInvalidationReason and
FragmentSerializationMode enums into standalone lightweight
headers so downstream headers (CSSStyleSheet.h, CSSStyleProperties.h,
HTMLParser.h) can include just the enum they need instead of all of
Node.h. Replace Node.h with forward declarations in headers that only
use Node by pointer/reference.

This breaks the circular dependency between Node.h and
AccessibilityTreeNode.h, reducing AccessibilityTreeNode.h's
recompilation footprint from ~1399 to ~25 files.
2026-02-11 20:02:28 +01:00

65 lines
2.6 KiB
C++

/*
* Copyright (c) 2018-2025, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace Web::DOM {
#define ENUMERATE_STYLE_INVALIDATION_REASONS(X) \
X(AdoptedStyleSheetsList) \
X(BaseURLChanged) \
X(CSSFontLoaded) \
X(CSSImportRule) \
X(CSSStylePropertiesRemoveProperty) \
X(CSSStylePropertiesSetProperty) \
X(CSSStylePropertiesSetPropertyStyleValue) \
X(CSSStylePropertiesTextChange) \
X(CustomElementStateChange) \
X(CustomStateSetChange) \
X(DidLoseFocus) \
X(DidReceiveFocus) \
X(EditingInsertion) \
X(EditingDeletion) \
X(ElementAttributeChange) \
X(ElementSetShadowRoot) \
X(HTMLDialogElementSetIsModal) \
X(HTMLDetailsOrDialogOpenAttributeChange) \
X(HTMLHyperlinkElementHrefChange) \
X(HTMLIFrameElementGeometryChange) \
X(HTMLInputElementSetChecked) \
X(HTMLInputElementSetIsOpen) \
X(HTMLInputElementSetType) \
X(HTMLObjectElementUpdateLayoutAndChildObjects) \
X(HTMLOptionElementSelectedChange) \
X(HTMLSelectElementSetIsOpen) \
X(MediaListSetMediaText) \
X(MediaListAppendMedium) \
X(MediaListDeleteMedium) \
X(MediaQueryChangedMatchState) \
X(NavigableSetViewportSize) \
X(NodeInsertBefore) \
X(NodeRemove) \
X(NodeSetTextContent) \
X(Other) \
X(SetSelectorText) \
X(SettingsChange) \
X(StyleSheetDeleteRule) \
X(StyleSheetInsertRule) \
X(StyleSheetListAddSheet) \
X(StyleSheetListRemoveSheet)
enum class StyleInvalidationReason {
#define __ENUMERATE_STYLE_INVALIDATION_REASON(reason) reason,
ENUMERATE_STYLE_INVALIDATION_REASONS(__ENUMERATE_STYLE_INVALIDATION_REASON)
#undef __ENUMERATE_STYLE_INVALIDATION_REASON
};
struct StyleInvalidationOptions {
bool invalidate_self { false };
};
}