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);
        }
예제 #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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 /// <undoc/>
 public bool Equals(StyleEnum <T> other)
 {
     return(other == this);
 }
예제 #5
0
 public StyleEnum(StyleKeyword keyword)
 {
     this = new StyleEnum <T>(default(T), keyword);
 }
예제 #6
0
 public StyleEnum(T v)
 {
     this = new StyleEnum <T>(v, StyleKeyword.Undefined);
 }