public void Merge(CssRuleSetGroup another) { //merge //------------ if (another._assignments != null) { if (this._assignments == null) { this._assignments = new CssPropertyAssignmentCollection(this); } //merge decl this._assignments.MergeProperties(another._assignments); } //find subgroup if (another._subGroups != null) { if (this._subGroups == null) { this._subGroups = new List <CssRuleSetGroup>(); } foreach (CssRuleSetGroup ruleSetGroup in another._subGroups) { //merge to this group CssRuleSetGroup exiting = GetOrCreateSubgroup(ruleSetGroup._originalSelector); exiting.Merge(ruleSetGroup); } } }
public void AddRuleSet(CssPropertyAssignmentCollection otherAssignments) { //assignment in this ruleset //if (dbugId == 170) //{ //} if (this._assignments == null) { //share this._assignments = otherAssignments; } else if (this._assignments != otherAssignments) { //then copy each css property assignment //from other Assignment and add to this assignment if (this._assignments.OriginalOwner != this) { this._assignments = this._assignments.Clone(this); } this._assignments.MergeProperties(otherAssignments); } else { } }
public void MergeProperties(CssPropertyAssignmentCollection sourceCollection) { Dictionary <WellknownCssPropertyName, CssPropertyDeclaration> fromDic = sourceCollection._myAssignments; Dictionary <WellknownCssPropertyName, CssPropertyDeclaration> targetDic = this._myAssignments; foreach (CssPropertyDeclaration sourceAssignment in fromDic.Values) { //add or replace targetDic[sourceAssignment.WellknownPropertyName] = sourceAssignment; } }
public CssPropertyAssignmentCollection Clone(object newOwner) { CssPropertyAssignmentCollection newclone = new CssPropertyAssignmentCollection(newOwner); Dictionary <WellknownCssPropertyName, WebDom.CssPropertyDeclaration> newCloneDic = newclone._myAssignments; foreach (var kp in this._myAssignments) { newCloneDic.Add(kp.Key, kp.Value); } return(newclone); }
void AddRuleSet(WebDom.CssRuleSet ruleset) { List<CssRuleSetGroup> relatedRuleSets = new List<CssRuleSetGroup>(); ExpandSelector(relatedRuleSets, ruleset.GetSelector()); CssPropertyAssignmentCollection assignmentCollection = new CssPropertyAssignmentCollection(null); assignmentCollection.LoadRuleSet(ruleset); foreach (var ruleSetGroup in relatedRuleSets) { //start with share*** rule set ruleSetGroup.AddRuleSet(assignmentCollection); } }
void AddRuleSet(WebDom.CssRuleSet ruleset) { List <CssRuleSetGroup> relatedRuleSets = new List <CssRuleSetGroup>(); ExpandSelector(relatedRuleSets, ruleset.GetSelector()); CssPropertyAssignmentCollection assignmentCollection = new CssPropertyAssignmentCollection(null); assignmentCollection.LoadRuleSet(ruleset); foreach (var ruleSetGroup in relatedRuleSets) { //start with share*** rule set ruleSetGroup.AddRuleSet(assignmentCollection); } }
public void MergeProperties(CssPropertyAssignmentCollection sourceCollection) { Dictionary<WellknownCssPropertyName, CssPropertyDeclaration> fromDic = sourceCollection._myAssignments; Dictionary<WellknownCssPropertyName, CssPropertyDeclaration> targetDic = this._myAssignments; foreach (CssPropertyDeclaration sourceAssignment in fromDic.Values) { //add or replace targetDic[sourceAssignment.WellknownPropertyName] = sourceAssignment; } }
public CssPropertyAssignmentCollection Clone(object newOwner) { CssPropertyAssignmentCollection newclone = new CssPropertyAssignmentCollection(newOwner); Dictionary<WellknownCssPropertyName, WebDom.CssPropertyDeclaration> newCloneDic = newclone._myAssignments; foreach (var kp in this._myAssignments) { newCloneDic.Add(kp.Key, kp.Value); } return newclone; }
public void Merge(CssRuleSetGroup another) { //merge //------------ if (another._assignments != null) { if (this._assignments == null) { this._assignments = new CssPropertyAssignmentCollection(this); } //merge decl this._assignments.MergeProperties(another._assignments); } //find subgroup if (another._subGroups != null) { if (this._subGroups == null) { this._subGroups = new List<CssRuleSetGroup>(); } foreach (CssRuleSetGroup ruleSetGroup in another._subGroups) { //merge to this group CssRuleSetGroup exiting = GetOrCreateSubgroup(ruleSetGroup._originalSelector); exiting.Merge(ruleSetGroup); } } }
public void AddRuleSet(CssPropertyAssignmentCollection otherAssignments) { //assignment in this ruleset if (this._assignments == null) { //share this._assignments = otherAssignments; } else if (this._assignments != otherAssignments) { //then copy each css property assignment //from other Assignment and add to this assignment if (this._assignments.OriginalOwner != this) { this._assignments = this._assignments.Clone(this); } this._assignments.MergeProperties(otherAssignments); } else { } }