/// <summary>Called when this element got removed from the DOM.</summary>
        internal override void RemovedFromDOM()
        {
            Css.ReflowDocument reflowDocument = document as Css.ReflowDocument;

            if (reflowDocument.AttributeIndex != null)
            {
                // Remove this from the DOM attribute cache:
                reflowDocument.RemoveCachedElement(this);
            }

            // Remove handler:
            // OnRemovedFromDOM();

            // Let the style know we went offscreen:
            RenderableData renderable = RenderData;

            renderable.WentOffScreen();

            // Apply to all virtual elements:
            VirtualElements virts = renderable.Virtuals;

            if (virts != null)
            {
                foreach (KeyValuePair <int, Node> kvp in virts.Elements)
                {
                    // Remove it:
                    kvp.Value.RemovedFromDOM();
                }
            }

            base.RemovedFromDOM();

            // Request a layout:
            reflowDocument.RequestLayout();
        }
Beispiel #2
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // Request a shortform redraw:
            style.RequestFastLayout();

            // Grab the virtual elements:
            VirtualElements virts = style.RenderData.Virtuals;

            // Update them:
            if (virts != null)
            {
                // H:
                HtmlScrollbarElement scroll = virts.Get(ComputedStyle.HorizontalScrollPriority) as HtmlScrollbarElement;

                if (scroll != null)
                {
                    scroll.ElementScrolled();
                }

                // V:
                scroll = virts.Get(ComputedStyle.VerticalScrollPriority) as HtmlScrollbarElement;

                if (scroll != null)
                {
                    scroll.ElementScrolled();
                }
            }

            // Ok!
            return(ApplyState.Ok);
        }
        /// <summary>Called when this element goes offscreen.</summary>
        public void WentOffScreen()
        {
            RenderableData renderable = RenderData;

            renderable.WentOffScreen();

            // Apply to all virtual elements:
            VirtualElements virts = renderable.Virtuals;

            if (virts != null)
            {
                foreach (KeyValuePair <int, Node> kvp in virts.Elements)
                {
                    // Tell it that it's gone offscreen:
                    IRenderableNode irn = (kvp.Value as IRenderableNode);

                    if (irn != null)
                    {
                        irn.WentOffScreen();
                    }
                }
            }

            if (childNodes_ != null)
            {
                for (int i = 0; i < childNodes_.length; i++)
                {
                    // Get as a HTML node:
                    IRenderableNode htmlNode = (childNodes_[i] as IRenderableNode);

                    if (htmlNode == null)
                    {
                        return;
                    }

                    // Call offscreen:
                    htmlNode.WentOffScreen();
                }
            }
        }