Example #1
0
        /// <summary>
        /// 解析 CSS 样式属性
        /// </summary>
        /// <param name="styleExpression">CSS 样式设置表达式</param>
        /// <param name="specification">所需要采用的 CSS 规范</param>
        /// <returns>CSS 样式属性</returns>
        public static CssStyle ParseCssStyle(string styleExpression, CssStyleSpecificationBase specification = null)
        {
            var style = new CssStyle(specification ?? new Css21StyleSpecification());

            style.SetProperties(ParseProperties(styleExpression));
            return(style);
        }
        /// <summary>
        /// 获取缩写形式的样式属性
        /// </summary>
        /// <param name="name">样式属性名</param>
        /// <param name="style">所有的样式设置</param>
        /// <returns>返回缩写形式,如果可能</returns>
        public CssStyleProperty TryGetShorthandProperty(string name, CssStyle style)
        {
            if (StyleShorthandRules.Contains(name))
            {
                var rule = StyleShorthandRules[name];
                return(rule.TryGetShorthandProperty(style));
            }

            else
            {
                return(null);
            }
        }
Example #3
0
 public CssStyleProperty TryGetShorthandProperty(CssStyle cssStyle)
 {
     return(null);
 }