internal static CssStyles Create(string style) { CssStyles styles = new CssStyles(); styles.AddFromText(style); return(styles); }
private bool ProcessInlineStyles(ref DocumentState state, string style) { CssStyles styles = CssStyles.Create(style); bool hasStyles = ProcessStyles(ref state, styles); styles.Dispose(); return(hasStyles); }
private bool ProcessSelectorStyles(ref DocumentState state, string selector) { if (_GlobalSelectors == null) { return(false); } CssStyles styles = _GlobalSelectors.GetStyles(selector); bool hasStyles = ProcessStyles(ref state, styles); styles.Dispose(); return(hasStyles); }
private bool ProcessStyles(ref DocumentState state, CssStyles styles) { if (styles == null || styles.Count <= 0) { return(false); } string value; value = styles.Get("font-family"); if (value != string.Empty) { state.Face = value; } value = styles.Get("font-weight"); if (value != string.Empty) { state.Bold = !value.EqualsIgnoreCase("normal"); } value = styles.Get("font-style"); if (value != string.Empty) { state.Italic = value.EqualsIgnoreCase("italic"); } value = styles.Get("text-decoration"); if (value != string.Empty) { state.Underline = value.EqualsIgnoreCase("underline"); } value = styles.Get("font-size"); if (value != string.Empty) { state.Size = CssParser.ParseFontSize(value, state.Size); } value = styles.Get("color"); if (value != string.Empty) { state.Brush = value.ToColor().ToBrush(); } return(true); }
internal CssStyles GetStyles(string selector) { selector = selector.ToLower(); return(CssStyles.Create(base.ContainsKey(selector) ? base[selector] : null)); }