private bool SetInlineStyle <T>(StylePropertyID id, StyleEnum <T> inlineValue, StyleInt sharedValue) where T : struct, IConvertible
        {
            var sv       = new StyleValue();
            int intValue = inlineValue.value.ToInt32(CultureInfo.InvariantCulture);

            if (TryGetInlineStyleValue(id, ref sv))
            {
                if (sv.number == intValue && sv.keyword == inlineValue.keyword)
                {
                    return(false);
                }
            }

            sv.id      = id;
            sv.keyword = inlineValue.keyword;
            sv.number  = intValue;

            SetInlineStyle(sv);

            int specificity = StyleValueExtensions.InlineSpecificity;

            if (inlineValue.keyword == StyleKeyword.Null)
            {
                specificity = sharedValue.specificity;
                sv.keyword  = sharedValue.keyword;
                sv.number   = sharedValue.value;
            }

            ApplyStyleValue(sv, specificity);
            return(true);
        }
Exemple #2
0
        private bool SetStyleValue <T>(StylePropertyId id, StyleEnum <T> inlineValue, StyleEnum <T> sharedValue) where T : struct, IConvertible
        {
            var sv       = new StyleValue();
            int intValue = UnsafeUtility.EnumToInt(inlineValue.value);

            if (TryGetStyleValue(id, ref sv))
            {
                if (sv.number == intValue && sv.keyword == inlineValue.keyword)
                {
                    return(false);
                }
            }
            else if (inlineValue.keyword == StyleKeyword.Null)
            {
                return(false);
            }

            sv.id      = id;
            sv.keyword = inlineValue.keyword;
            sv.number  = intValue;

            SetStyleValue(sv);

            if (inlineValue.keyword == StyleKeyword.Null)
            {
                sv.keyword = sharedValue.keyword;
                sv.number  = UnsafeUtility.EnumToInt(sharedValue.value);
            }

            ApplyStyleValue(sv);
            return(true);
        }
        public override bool Equals(object obj)
        {
            bool flag = !(obj is StyleEnum <T>);
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                StyleEnum <T> lhs = (StyleEnum <T>)obj;
                result = (lhs == this);
            }
            return(result);
        }
Exemple #4
0
 /// <undoc/>
 public bool Equals(StyleEnum <T> other)
 {
     return(other == this);
 }
 public StyleEnum(StyleKeyword keyword)
 {
     this = new StyleEnum <T>(default(T), keyword);
 }
 public StyleEnum(T v)
 {
     this = new StyleEnum <T>(v, StyleKeyword.Undefined);
 }