private void ApplyUnsetStyleValue(StylePropertyReader reader, InheritedStylesData inheritedStylesData) { if (inheritedStylesData == null) { ApplyInitialStyleValue(reader); } var specificity = reader.specificity; switch (reader.propertyID) { case StylePropertyID.Color: color = inheritedStylesData.color; color.specificity = specificity; break; case StylePropertyID.Font: unityFont = inheritedStylesData.font; unityFont.specificity = specificity; break; case StylePropertyID.FontSize: fontSize = inheritedStylesData.fontSize; fontSize.specificity = specificity; break; case StylePropertyID.FontStyleAndWeight: unityFontStyleAndWeight = inheritedStylesData.unityFontStyle; unityFontStyleAndWeight.specificity = specificity; break; case StylePropertyID.UnityTextAlign: unityTextAlign = inheritedStylesData.unityTextAlign; unityTextAlign.specificity = specificity; break; case StylePropertyID.Visibility: visibility = inheritedStylesData.visibility; visibility.specificity = specificity; break; case StylePropertyID.WhiteSpace: whiteSpace = inheritedStylesData.whiteSpace; whiteSpace.specificity = specificity; break; case StylePropertyID.Custom: RemoveCustomStyleProperty(reader.property.name); break; default: ApplyInitialStyleValue(reader.propertyID, specificity); break; } }
internal void ApplyProperties(StylePropertyReader reader, InheritedStylesData inheritedStylesData) { while (reader.IsValid()) { var styleProperty = reader.property; var propertyID = reader.propertyID; if (reader.IsKeyword(0, StyleValueKeyword.Initial)) { ApplyInitialStyleValue(reader); } else if (reader.IsKeyword(0, StyleValueKeyword.Unset) && inheritedStylesData != null) { ApplyUnsetStyleValue(reader, inheritedStylesData); } else { switch (propertyID) { case StylePropertyID.Unknown: break; case StylePropertyID.Custom: ApplyCustomStyleProperty(reader); break; case StylePropertyID.BorderColor: case StylePropertyID.BorderRadius: case StylePropertyID.BorderWidth: case StylePropertyID.Flex: case StylePropertyID.Margin: case StylePropertyID.Padding: ApplyShorthandProperty(reader); break; default: ApplyStyleProperty(reader); break; } } reader.MoveNextProperty(); } }
internal void ApplyProperties(StylePropertyReader reader, InheritedStylesData inheritedStylesData) { for (var propertyID = reader.propertyID; propertyID != StylePropertyID.Unknown; propertyID = reader.MoveNextProperty()) { var handle = reader.GetValue(0).handle; if (handle.valueType == StyleValueType.Keyword) { if ((StyleValueKeyword)handle.valueIndex == StyleValueKeyword.Initial) { ApplyInitialStyleValue(reader); continue; } else if ((StyleValueKeyword)handle.valueIndex == StyleValueKeyword.Unset) { ApplyUnsetStyleValue(reader, inheritedStylesData); continue; } } switch (propertyID) { case StylePropertyID.Unknown: break; case StylePropertyID.Custom: ApplyCustomStyleProperty(reader); break; case StylePropertyID.BorderColor: case StylePropertyID.BorderRadius: case StylePropertyID.BorderWidth: case StylePropertyID.Flex: case StylePropertyID.Margin: case StylePropertyID.Padding: ApplyShorthandProperty(reader); break; default: ApplyStyleProperty(reader); break; } } }