public void SortedRangeListChangeStampTest()
        {
            SortedRangeList <TestRange> list = new SortedRangeList <TestRange>();

            int stamp = list.ChangeStamp;

            list.ForceUpdateChangeStamp();
            Assert.AreNotEqual(stamp, list.ChangeStamp);
            stamp = list.ChangeStamp;

            list.Clear();
            Assert.AreEqual(stamp, list.ChangeStamp);

            list.Add(new TestRange(5, 1));
            list.Add(new TestRange(6, 1));
            Assert.AreNotEqual(stamp, list.ChangeStamp);
            stamp = list.ChangeStamp;

            list.IndexOf(list[0]);
            Assert.AreEqual(stamp, list.ChangeStamp);

            list.Remove(list[0]);
            Assert.AreNotEqual(stamp, list.ChangeStamp);
            stamp = list.ChangeStamp;

            list.Clear();
            Assert.AreNotEqual(stamp, list.ChangeStamp);
        }
        /// <summary>
        /// Always called after parsing is done (full or incremental)
        /// </summary>
        public override void UpdateCachedChildren()
        {
            _declarations.Clear();
            _directives.Clear();

            int childCount = Children.Count;

            for (int i = 0; i < childCount; i++)
            {
                ParseItem child = Children[i];
                if (child is Declaration)
                {
                    if (_declarations == _emptyDeclarations)
                    {
                        _declarations = new SortedRangeList <Declaration>();
                    }

                    _declarations.Add((Declaration)child);
                }
                else if (child is AtDirective)
                {
                    if (_directives == _emptyDirectives)
                    {
                        _directives = new SortedRangeList <AtDirective>();
                    }

                    _directives.Add((AtDirective)child);
                }
            }

            base.UpdateCachedChildren();

            // tell the stylesheet to update in case we have new CustomProperties
            StyleSheet?.UpdateCachedChildren();
        }
Beispiel #3
0
 private void TreeUpdated(object sender, CssTreeUpdateEventArgs e)
 {
     _cache.Clear();
     UpdateCache(e.Tree.StyleSheet);
 }
 private void TreeUpdated(object sender, CssTreeUpdateEventArgs e)
 {
     Cache.Clear();
     UpdateDeclarationCache(e.Tree.StyleSheet);
 }