cssRulesStructurallyEqual function
Implementation
bool cssRulesStructurallyEqual(CSSRule? left, CSSRule? right) {
if (identical(left, right)) return true;
if (left == null || right == null) return left == right;
if (left.runtimeType != right.runtimeType) return false;
if (left is CSSStyleRule && right is CSSStyleRule) {
return left.selectorGroup.structurallyEquals(right.selectorGroup) &&
left.layerPath.length == right.layerPath.length &&
_stringListsEqual(left.layerPath, right.layerPath) &&
left.declaration.structurallyEquals(right.declaration);
}
if (left is CSSLayerStatementRule && right is CSSLayerStatementRule) {
return _layerNamePathsEqual(left.layerNamePaths, right.layerNamePaths);
}
if (left is CSSLayerBlockRule && right is CSSLayerBlockRule) {
return left.name == right.name &&
_stringListsEqual(left.layerNamePath, right.layerNamePath) &&
cssRuleListsStructurallyEqual(left.cssRules, right.cssRules);
}
if (left is CSSImportRule && right is CSSImportRule) {
return left.href == right.href && left.media == right.media;
}
if (left is CSSKeyframesRule && right is CSSKeyframesRule) {
return left.name == right.name &&
_keyframesEqual(left.keyframes, right.keyframes);
}
if (left is CSSFontFaceRule && right is CSSFontFaceRule) {
return left.declarations.structurallyEquals(right.declarations);
}
if (left is CSSMediaDirective && right is CSSMediaDirective) {
return _mediaQueriesEqual(left.cssMediaQuery, right.cssMediaQuery) &&
cssRuleListsStructurallyEqual(
left.rules ?? const <CSSRule>[], right.rules ?? const <CSSRule>[]);
}
return left.cssText == right.cssText;
}