Bug 683737 - browser/devtools/styleinspector/test/browser/browser_styleinspector_webconsole.js; r=msucan

This commit is contained in:
Michael Ratcliffe 2011-09-05 15:33:01 +02:00
parent 50de76cbc2
commit dddeb8cff6

View File

@ -89,6 +89,7 @@ var StyleInspector = {
iframe.setAttribute("flex", "1");
iframe.setAttribute("tooltip", "aHTMLTooltip");
iframe.setAttribute("src", "chrome://browser/content/csshtmltree.xhtml");
iframe.addEventListener("load", SI_iframeOnload, true);
vbox.appendChild(iframe);
let hbox = win.document.createElement("hbox");
@ -105,18 +106,32 @@ var StyleInspector = {
popupSet.appendChild(panel);
/**
* Initialize the popup when it is first shown
* Iframe's onload event
*/
function SI_popupShown() {
if (!this.cssHtmlTree) {
this.cssLogic = new CssLogic();
this.cssHtmlTree = new CssHtmlTree(iframe, this.cssLogic, this);
let iframeReady = false;
function SI_iframeOnload() {
iframe.removeEventListener("load", SI_iframeOnload, true);
panel.cssLogic = new CssLogic();
panel.cssHtmlTree = new CssHtmlTree(iframe, panel.cssLogic, panel);
iframeReady = true;
if (panelReady) {
SI_popupShown.call(panel);
}
}
this.cssLogic.highlight(this.selectedNode);
this.cssHtmlTree.highlight(this.selectedNode);
/**
* Initialize the popup when it is first shown
*/
let panelReady = false;
function SI_popupShown() {
panelReady = true;
if (iframeReady) {
let selectedNode = this.selectedNode || null;
this.cssLogic.highlight(selectedNode);
this.cssHtmlTree.highlight(selectedNode);
Services.obs.notifyObservers(null, "StyleInspector-opened", null);
}
}
/**
* Hide the popup and conditionally destroy it