Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
 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
     {
     }
 }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
        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);
                }
            }
        }
Esempio n. 10
0
        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
            {

            }

        }