Supported selector matching for application-owned prepared developer mappings.
More...
Supported selector matching for application-owned prepared developer mappings.
Supports type/class/ID/universal selectors, descendant/child relations and hover/active/focus/disabled/enabled/checked/root states. This is a mapping vocabulary, NOT a validator for the developer's stylesheet. The compiler reports unsupported selector consumers and leaves them unmapped without discarding the annotated exported setting; Unity still owns ordinary USS.
REQUIRED MAINTENANCE BOUNDARY: preserve the accepted selector/cache behavior unless a change is explicitly authorized. Do not expand this into a second CSS engine, introduce private Unity stylesheet access, or repeatedly tokenize/regex-parse selectors on pointer or focus events.
HOW IT WORKS: Specificity() checks one proposed mapping selector and computes its ordering weight. Each DeveloperThemeBinding creates one Compiled instance per distinct prepared selector in that lease. The constructor converts text to terms and child/descendant relationships once. Matches() then checks existing element names, classes, type ancestry and relevant states using those retained terms; it does not discover all controls or read player files.
ignoreStates is used for initial/owner target discovery so hover, disabled and checked consumers remain discoverable even while their state is inactive. Normal matching evaluates those states when choosing an applied rule. Ancestor matching is bounded by the explicit scope. Hover/active sets belong to the binding lease; focus/enabled/checked come from the actual controls.
There is no global retained selector cache, reflected property setter or reflection-created control. Cache lifetime follows the selected theme's binding lease. The public string Matches() convenience method constructs a selector for that call; repeated runtime work must use the binding's retained Compiled instances instead.