예제 #1
0
        private bool SetStyleValue(StylePropertyId id, StyleColor inlineValue, StyleColor sharedValue)
        {
            var sv = new StyleValue();

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

            sv.id      = id;
            sv.keyword = inlineValue.keyword;
            sv.color   = inlineValue.value;

            SetStyleValue(sv);

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

            ApplyStyleValue(sv);
            return(true);
        }
        private bool SetInlineStyle(StylePropertyID id, StyleColor inlineValue, StyleColor sharedValue)
        {
            var sv = new StyleValue();

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

            sv.id      = id;
            sv.keyword = inlineValue.keyword;
            sv.color   = inlineValue.value;

            SetInlineStyle(sv);

            int specificity = StyleValueExtensions.InlineSpecificity;

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

            ApplyStyleValue(sv, specificity);
            return(true);
        }
        public StyleColor GetStyleColor(StylePropertyId id)
        {
            StyleValue styleValue = default(StyleValue);
            bool       flag       = this.TryGetStyleValue(id, ref styleValue);
            StyleColor result;

            if (flag)
            {
                result = new StyleColor(styleValue.color, styleValue.keyword);
            }
            else
            {
                result = StyleKeyword.Null;
            }
            return(result);
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            bool flag = !(obj is StyleColor);
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                StyleColor lhs = (StyleColor)obj;
                result = (lhs == this);
            }
            return(result);
        }
예제 #5
0
 public bool Equals(StyleColor other)
 {
     return(other == this);
 }
예제 #6
0
        public static bool operator==(StyleColor lhs, Color rhs)
        {
            var styleColor = new StyleColor(rhs);

            return(lhs == styleColor);
        }
예제 #7
0
        public static bool operator ==(StyleColor lhs, Color rhs)
        {
            StyleColor rhs2 = new StyleColor(rhs);

            return(lhs == rhs2);
        }
예제 #8
0
 public StyleColor(StyleKeyword keyword)
 {
     this = new StyleColor(Color.clear, keyword);
 }
예제 #9
0
 public StyleColor(Color v)
 {
     this = new StyleColor(v, StyleKeyword.Undefined);
 }