コード例 #1
0
        internal void ApplyProperties(StylePropertyReader reader, InheritedStylesData inheritedStylesData)
        {
            while (reader.IsValid())
            {
                var styleProperty = reader.property;
                var propertyID    = reader.propertyID;

                if (reader.IsKeyword(0, StyleValueKeyword.Initial))
                {
                    ApplyInitialStyleValue(reader);
                }
                else if (reader.IsKeyword(0, StyleValueKeyword.Unset) && inheritedStylesData != null)
                {
                    ApplyUnsetStyleValue(reader, inheritedStylesData);
                }
                else
                {
                    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;
                    }
                }

                reader.MoveNextProperty();
            }
        }
コード例 #2
0
        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;
                }
            }
        }