public static void Apply <T>(this StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleValue <T> property, HandlesApplicatorFunction <T> applicatorFunc) { if (handles[0].valueType == StyleValueType.Keyword && handles[0].valueIndex == 2) { StyleSheetApplicator.ApplyDefault <T>(specificity, ref property); } else { applicatorFunc(sheet, handles, specificity, ref property); } }
internal void ApplyCustomProperty <T>(string propertyName, ref StyleValue <T> target, StyleValueType valueType, HandlesApplicatorFunction <T> applicatorFunc) { CustomProperty property; StyleValue <T> tmp = new StyleValue <T>(); if (m_CustomProperties != null && m_CustomProperties.TryGetValue(propertyName, out property)) { // CustomProperty only support one value var handle = property.handles[0]; if (handle.valueType == valueType) { property.data.Apply(property.handles, property.specificity, ref tmp, applicatorFunc); } else { Debug.LogWarning(string.Format("Trying to read value as {0} while parsed type is {1}", valueType, handle.valueType)); } } target.Apply(tmp, StylePropertyApplyMode.CopyIfNotInline); }
public static void Apply <T>(this StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleValue <T> property, HandlesApplicatorFunction <T> applicatorFunc) { // TODO: initial value for property is sometimes different than default(T) if (handles[0].valueType == StyleValueType.Keyword && handles[0].valueIndex == (int)StyleValueKeyword.Unset) { StyleSheetApplicator.ApplyValue(specificity, ref property); } else { applicatorFunc(sheet, handles, specificity, ref property); } }