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; } } }
private void ApplyCustomStyleProperty(StylePropertyReader reader) { if (m_CustomProperties == null) { m_CustomProperties = new Dictionary <string, CustomPropertyHandle>(); } var styleProperty = reader.property; var specificity = reader.specificity; CustomPropertyHandle customProp = default(CustomPropertyHandle); if (!m_CustomProperties.TryGetValue(styleProperty.name, out customProp) || specificity >= customProp.specificity) { // Custom property only support one value customProp.value = reader.GetValue(0); customProp.specificity = specificity; m_CustomProperties[styleProperty.name] = customProp; } }