예제 #1
0
        /// <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();
        }
예제 #2
0
        /// <summary>Called when this element got added to the DOM.</summary>
        internal override void AddedToDOM()
        {
            Css.ReflowDocument doc = document as Css.ReflowDocument;

            if (doc != null)
            {
                if (doc.AttributeIndex != null)
                {
                    // Index element if needed:
                    AddToAttributeLookups();
                }

                // Make sure the stylesheet is present:
                doc.RequireStyleSheet(this);
            }

            // Update its css by telling it the parent changed.
            // This affects inherit, height/width etc.
            Style.Computed.ParentChanged();

            if (doc != null)
            {
                // Request a layout:
                doc.RequestLayout();
            }
        }