Table of contents
Namespace: Com\Tecnick\Pdf\CSS
class CascadeContext
Source: src/CSS/CascadeContext.php:38
Tracks the global source position across all CSS sources (external stylesheets, embedded styles, inline styles) to keep the cascade order deterministic.
A context shared between extractions gives the rules of the first source a lower source order than the rules of the next one at equal specificity.
Constants
INLINE_STYLE_SOURCE_ORDER
Inline style source order - higher than normal rules, lower than !important
public const INLINE_STYLE_SOURCE_ORDER = 10000000
Source: src/CSS/CascadeContext.php:49
MAX_NORMAL_SOURCE_ORDER
Maximum value for normal (non-important, non-inline) source order Normal rules from stylesheets use 0 to MAX_NORMAL_SOURCE_ORDER
public const MAX_NORMAL_SOURCE_ORDER = 9999999
Source: src/CSS/CascadeContext.php:44
MIN_IMPORTANT_SOURCE_ORDER
Minimum value for !important source order (reserved range) !important rules use 100000000 and above for highest precedence
public const MIN_IMPORTANT_SOURCE_ORDER = 100000000
Source: src/CSS/CascadeContext.php:55
Methods
getCurrentSourceType()
Get current source type
public getCurrentSourceType(): string
Returns: string
Source: src/CSS/CascadeContext.php:120
getInlineStyleSourceOrder()
Get inline style source order (highest normal precedence)
public static getInlineStyleSourceOrder(): int
Returns: int
Source: src/CSS/CascadeContext.php:99
getNextImportantSourceOrder()
Get next source order value for an !important rule
public getNextImportantSourceOrder(): int
Returns: int: Global source order for this rule
Source: src/CSS/CascadeContext.php:89
getNextNormalSourceOrder()
Get next source order value for a normal rule
public getNextNormalSourceOrder(): int
Returns: int: Global source order for this rule
Source: src/CSS/CascadeContext.php:79
getTotalRulesProcessed()
Get total rules processed (normal + important)
public getTotalRulesProcessed(): int
Returns: int
Source: src/CSS/CascadeContext.php:130
reset()
Reset counters (for testing or document resets)
public reset(): void
Source: src/CSS/CascadeContext.php:140
setCurrentSourceType()
Set current source type for tracking/debugging
public setCurrentSourceType(string $type): void
Parameters:
$type(string): ’external’, ’embedded’, ‘inline’
Source: src/CSS/CascadeContext.php:110