public void ResolveStyles(Tag t)
{
// get css for this tag from resolver
IDictionary<String, String> tagCss = new Dictionary<String, String>();
if (null != cssFiles && cssFiles.HasFiles()) {
tagCss = cssFiles.GetCSS(t);
}
// get css from style attr
if (null != t.Attributes && t.Attributes.Count != 0) {
if (t.Attributes.ContainsKey(HTML.Attribute.CELLPADDING)) {
CssUtils.MapPutAll(tagCss, utils.ParseBoxValues(t.Attributes[HTML.Attribute.CELLPADDING], "cellpadding-", ""));
}
if (t.Attributes.ContainsKey(HTML.Attribute.CELLSPACING)) {
CssUtils.MapPutAll(tagCss, utils.ParseBoxValues(t.Attributes[HTML.Attribute.CELLSPACING], "cellspacing-", ""));
}
String styleAtt;
t.Attributes.TryGetValue(HTML.Attribute.STYLE, out styleAtt);
if (null != styleAtt && styleAtt.Length > 0) {
String[] styles = styleAtt.Split(';');
foreach (String s in styles) {
String[] part = s.Split(splitColon,2);
if (part.Length == 2) {
String key = part[0].Trim();
String value = utils.StripDoubleSpacesAndTrim(part[1]);
SplitRules(tagCss, key, value);
}
}
}
}
// inherit css from parent tags, as defined in provided CssInheritanceRules or if property = inherit
IDictionary<String, String> css = t.CSS;
if (MustInherit(t.Name) && null != t.Parent && null != t.Parent.CSS) {
if (null != this.inherit) {
foreach (KeyValuePair<String, String> entry in t.Parent.CSS) {
String key = entry.Key;
if ((tagCss.ContainsKey(key) && CSS.Value.INHERIT.Equals(tagCss[key]) ) || CanInherite(t, key)) {
//splitRules(css, key, entry.GetValue());
css[key] = entry.Value;
}
}
} else {
CssUtils.MapPutAll(css, t.Parent.CSS);
}
}
// overwrite properties (if value != inherit)
foreach (KeyValuePair<String, String> e in tagCss) {
if (!Util.EqualsIgnoreCase(CSS.Value.INHERIT, e.Value)) {
css[e.Key] = e.Value;
}
}
}