private void ApplyInitialStyleValue(StylePropertyID propertyID, int specificity) { switch (propertyID) { case StylePropertyID.Unknown: case StylePropertyID.Custom: { Debug.LogAssertion($"Unexpected style property ID {propertyID.ToString()}."); break; } case StylePropertyID.BorderColor: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderLeftColor); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderTopColor); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderRightColor); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderBottomColor); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.BorderRadius: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderTopLeftRadius); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderTopRightRadius); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderBottomLeftRadius); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderBottomRightRadius); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.BorderWidth: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderLeftWidth); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderTopWidth); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderRightWidth); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.BorderBottomWidth); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.Flex: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.FlexGrow); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.FlexShrink); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.FlexBasis); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.Margin: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.MarginLeft); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.MarginTop); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.MarginRight); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.MarginBottom); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.Padding: { StyleValue sv = StyleSheetCache.GetInitialValue(StylePropertyID.PaddingLeft); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.PaddingTop); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.PaddingRight); ApplyStyleValue(sv.id, sv, specificity); sv = StyleSheetCache.GetInitialValue(StylePropertyID.PaddingBottom); ApplyStyleValue(sv.id, sv, specificity); break; } case StylePropertyID.Cursor: { ApplyStyleCursor(new StyleCursor(), specificity); break; } default: { StyleValue sv = StyleSheetCache.GetInitialValue(propertyID); Debug.Assert(sv.keyword != StyleKeyword.Initial, "Recursive apply initial value"); ApplyStyleValue(sv.id, sv, specificity); break; } } }
public InheritedStylesData() { color = StyleSheetCache.GetInitialValue(StylePropertyID.Color).color; }