internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { Debug.Assert(unloadedWindow != null, "Why are we calling this with a null window?"); if (unloadedWindow != null) { // // prune documents // if (htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] shims = new HtmlDocument.HtmlDocumentShim[htmlDocumentShims.Count]; htmlDocumentShims.Values.CopyTo(shims, 0); foreach (HtmlDocument.HtmlDocumentShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } // // prune elements // if (htmlElementShims != null) { HtmlElement.HtmlElementShim[] shims = new HtmlElement.HtmlElementShim[htmlElementShims.Count]; htmlElementShims.Values.CopyTo(shims, 0); foreach (HtmlElement.HtmlElementShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlElementShims.Remove(shim.Element); shim.Dispose(); } } } // // prune the particular window from the list. // if (htmlWindowShims != null) { if (htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim = htmlWindowShims[unloadedWindow]; htmlWindowShims.Remove(unloadedWindow); shim.Dispose(); } } } }
/// <devdoc> AddElementShim - adds a HtmlDocumentShim to list of shims to manage /// Can create a WindowShim as a side effect so it knows when to self prune from the list. ///</devdoc> public void AddElementShim(HtmlElement element) { HtmlElement.HtmlElementShim shim = null; if (htmlElementShims == null) { htmlElementShims = new Dictionary<HtmlElement,HtmlElement.HtmlElementShim>(); shim = new HtmlElement.HtmlElementShim(element); htmlElementShims[element] = shim; } else if (!htmlElementShims.ContainsKey(element)) { shim = new HtmlElement.HtmlElementShim(element); htmlElementShims[element] = shim; } if (shim != null) { OnShimAdded(shim); } }
public void AddElementShim(HtmlElement element) { HtmlElement.HtmlElementShim addedShim = null; if (this.htmlElementShims == null) { this.htmlElementShims = new Dictionary <HtmlElement, HtmlElement.HtmlElementShim>(); addedShim = new HtmlElement.HtmlElementShim(element); this.htmlElementShims[element] = addedShim; } else if (!this.htmlElementShims.ContainsKey(element)) { addedShim = new HtmlElement.HtmlElementShim(element); this.htmlElementShims[element] = addedShim; } if (addedShim != null) { this.OnShimAdded(addedShim); } }
public void AddElementShim(HtmlElement element) { HtmlElement.HtmlElementShim addedShim = null; if (this.htmlElementShims == null) { this.htmlElementShims = new Dictionary<HtmlElement, HtmlElement.HtmlElementShim>(); addedShim = new HtmlElement.HtmlElementShim(element); this.htmlElementShims[element] = addedShim; } else if (!this.htmlElementShims.ContainsKey(element)) { addedShim = new HtmlElement.HtmlElementShim(element); this.htmlElementShims[element] = addedShim; } if (addedShim != null) { this.OnShimAdded(addedShim); } }
/// <summary> AddElementShim - adds a HtmlDocumentShim to list of shims to manage /// Can create a WindowShim as a side effect so it knows when to self prune from the list. ///</summary> public void AddElementShim(HtmlElement element) { HtmlElement.HtmlElementShim shim = null; if (htmlElementShims == null) { htmlElementShims = new Dictionary <HtmlElement, HtmlElement.HtmlElementShim>(); shim = new HtmlElement.HtmlElementShim(element); htmlElementShims[element] = shim; } else if (!htmlElementShims.ContainsKey(element)) { shim = new HtmlElement.HtmlElementShim(element); htmlElementShims[element] = shim; } if (shim != null) { OnShimAdded(shim); } }
internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { if (unloadedWindow != null) { if (this.htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] array = new HtmlDocument.HtmlDocumentShim[this.htmlDocumentShims.Count]; this.htmlDocumentShims.Values.CopyTo(array, 0); foreach (HtmlDocument.HtmlDocumentShim shim in array) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { this.htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } if (this.htmlElementShims != null) { HtmlElement.HtmlElementShim[] shimArray2 = new HtmlElement.HtmlElementShim[this.htmlElementShims.Count]; this.htmlElementShims.Values.CopyTo(shimArray2, 0); foreach (HtmlElement.HtmlElementShim shim2 in shimArray2) { if (shim2.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { this.htmlElementShims.Remove(shim2.Element); shim2.Dispose(); } } } if ((this.htmlWindowShims != null) && this.htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim3 = this.htmlWindowShims[unloadedWindow]; this.htmlWindowShims.Remove(unloadedWindow); shim3.Dispose(); } } }
/// <devdoc> /// HtmlWindowShim calls back on us when it has unloaded the page. At this point we need to /// walk through our lists and make sure we've cleaned up /// </devdoc> internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { Debug.Assert(unloadedWindow != null, "Why are we calling this with a null window?"); if (unloadedWindow != null) { // // prune documents // if (htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] shims = new HtmlDocument.HtmlDocumentShim[htmlDocumentShims.Count]; htmlDocumentShims.Values.CopyTo(shims,0); foreach (HtmlDocument.HtmlDocumentShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } // // prune elements // if (htmlElementShims != null) { HtmlElement.HtmlElementShim[] shims = new HtmlElement.HtmlElementShim[htmlElementShims.Count]; htmlElementShims.Values.CopyTo(shims,0); foreach (HtmlElement.HtmlElementShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlElementShims.Remove(shim.Element); shim.Dispose(); } } } // // prune the particular window from the list. // if (htmlWindowShims != null) { if (htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim = htmlWindowShims[unloadedWindow]; htmlWindowShims.Remove(unloadedWindow); shim.Dispose(); } } } }