This Markdown file intends to demystify some of the StyleRecalc process: TODO(crbug.com/795634): Add more details about the StyleRecalc process here.
Different StyleRecalc states
Different StyleRecalc states are stored in blink::ComputedStyleConstants in blink::StyleRecalcChange.
The states are as follows:
- NoChange -> No style recalc change is needed.
- NoInherit -> Only perform style recalc on the Node itself.
- UpdatePseudoElements -> Causes an update of just the pseudo element children in the case where the styles for the element itself were recalced, but resulted in NoChange or NoInherit.
- IndependentInherit -> Same as Inherit except style recalc stops early if only independent properties were changed. We still visit every descendant, but we apply the styles directly instead of doing selector matching to compute a new style. Independent properties are those which do not depend on and do not affect any other properties on ComputedStyle (e.g. visibility and Pointer Events).
- Inherit -> Do a full style recalc of children.
- Force -> Fallback that causes us to do a full style recalc. This is as we don't know what changes. The primary reason for it is SubtreeStyleChange.
- Reattach -> reattachLayoutTree() needs to be performed.