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");
@ -104,18 +105,32 @@ var StyleInspector = {
hbox.appendChild(resizer);
popupSet.appendChild(panel);
/**
* Iframe's onload event
*/
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);
}
}
/**
* Initialize the popup when it is first shown
*/
let panelReady = false;
function SI_popupShown() {
if (!this.cssHtmlTree) {
this.cssLogic = new CssLogic();
this.cssHtmlTree = new CssHtmlTree(iframe, this.cssLogic, this);
panelReady = true;
if (iframeReady) {
let selectedNode = this.selectedNode || null;
this.cssLogic.highlight(selectedNode);
this.cssHtmlTree.highlight(selectedNode);
Services.obs.notifyObservers(null, "StyleInspector-opened", null);
}
this.cssLogic.highlight(this.selectedNode);
this.cssHtmlTree.highlight(this.selectedNode);
Services.obs.notifyObservers(null, "StyleInspector-opened", null);
}
/**