зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f1409901573a
This commit is contained in:
Родитель
f71a2c994d
Коммит
828b754804
|
@ -208,6 +208,7 @@ Highlighter.prototype = {
|
|||
aParent.appendChild(closeButton);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Destroy the nodes.
|
||||
*/
|
||||
|
@ -839,26 +840,6 @@ var InspectorUI = {
|
|||
*/
|
||||
initTools: function IUI_initTools()
|
||||
{
|
||||
// Style inspector
|
||||
if (Services.prefs.getBoolPref("devtools.styleinspector.enabled") &&
|
||||
!this.toolRegistered("styleinspector")) {
|
||||
let stylePanel = this.StyleInspector.createPanel(true);
|
||||
this.registerTool({
|
||||
id: "styleinspector",
|
||||
label: InspectorUI.StyleInspector.l10n("style.highlighter.button.label"),
|
||||
tooltiptext: InspectorUI.StyleInspector.l10n("style.highlighter.button.tooltip"),
|
||||
accesskey: InspectorUI.StyleInspector.l10n("style.highlighter.accesskey"),
|
||||
context: stylePanel,
|
||||
get isOpen() stylePanel.isOpen(),
|
||||
onSelect: stylePanel.selectNode,
|
||||
show: stylePanel.showTool,
|
||||
hide: stylePanel.hideTool,
|
||||
dim: stylePanel.dimTool,
|
||||
panel: stylePanel,
|
||||
unregister: stylePanel.destroy,
|
||||
});
|
||||
this.stylePanel = stylePanel;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -985,7 +966,6 @@ var InspectorUI = {
|
|||
|
||||
this.treePanel.hidePopup();
|
||||
delete this.treePanel;
|
||||
delete this.stylePanel;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1002,7 +982,6 @@ var InspectorUI = {
|
|||
document.getElementById("inspector-inspect-toolbutton").checked = true;
|
||||
this.attachPageListeners();
|
||||
this.inspecting = true;
|
||||
this.toolsDim(true);
|
||||
this.highlighter.veilContainer.removeAttribute("locked");
|
||||
},
|
||||
|
||||
|
@ -1021,7 +1000,6 @@ var InspectorUI = {
|
|||
document.getElementById("inspector-inspect-toolbutton").checked = false;
|
||||
this.detachPageListeners();
|
||||
this.inspecting = false;
|
||||
this.toolsDim(false);
|
||||
if (this.highlighter.node) {
|
||||
this.select(this.highlighter.node, true, true, !aPreventScroll);
|
||||
} else {
|
||||
|
@ -1181,12 +1159,10 @@ var InspectorUI = {
|
|||
this.ioBox.toggleObject(node);
|
||||
} else {
|
||||
if (this.inspecting) {
|
||||
this.toolsSelect();
|
||||
this.stopInspecting(true);
|
||||
} else {
|
||||
this.select(node, true, false);
|
||||
this.highlighter.highlightNode(node);
|
||||
this.toolsSelect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1655,7 +1631,6 @@ var InspectorUI = {
|
|||
* onSelect: object.method,
|
||||
* show: object.method, called to show the tool when button is pressed.
|
||||
* hide: object.method, called to hide the tool when button is pressed.
|
||||
* dim: object.method, called to disable a tool during highlighting.
|
||||
* unregister: object.method, called when tool should be destroyed.
|
||||
* panel: myTool.panel
|
||||
* }
|
||||
|
@ -1818,19 +1793,6 @@ var InspectorUI = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Dim or undim each tool in the tools collection
|
||||
* @param aState true = dim, false = undim
|
||||
*/
|
||||
toolsDim: function IUI_toolsDim(aState)
|
||||
{
|
||||
this.toolsDo(function IUI_toolsOnSelect(aTool) {
|
||||
if (aTool.isOpen && "dim" in aTool) {
|
||||
aTool.dim.call(aTool.context, aState);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loop through all registered tools and pass each into the provided function
|
||||
* @param aFunction The function to which each tool is to be passed
|
||||
|
@ -2098,9 +2060,3 @@ XPCOMUtils.defineLazyGetter(InspectorUI, "strings", function () {
|
|||
createBundle("chrome://browser/locale/inspector.properties");
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(InspectorUI, "StyleInspector", function () {
|
||||
var obj = {};
|
||||
Cu.import("resource:///modules/devtools/StyleInspector.jsm", obj);
|
||||
return obj.StyleInspector;
|
||||
});
|
||||
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Joe Walker (jwalker@mozilla.com) (Original Author)
|
||||
* Joe Walker (jwalker@mozilla.com) (original author)
|
||||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
* Michael Ratcliffe <mratcliffe@mozilla.com>
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Ratcliffe <mratcliffe@mozilla.com> (Original Author)
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
* Mike Ratcliffe <mratcliffe@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -110,6 +109,8 @@ var StyleInspector = {
|
|||
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);
|
||||
|
@ -123,10 +124,6 @@ var StyleInspector = {
|
|||
function SI_popupShown() {
|
||||
panelReady = true;
|
||||
if (iframeReady) {
|
||||
if (!this.cssLogic) {
|
||||
this.cssLogic = new CssLogic();
|
||||
this.cssHtmlTree = new CssHtmlTree(iframe, this.cssLogic, this);
|
||||
}
|
||||
let selectedNode = this.selectedNode || null;
|
||||
this.cssLogic.highlight(selectedNode);
|
||||
this.cssHtmlTree.highlight(selectedNode);
|
||||
|
@ -165,9 +162,12 @@ var StyleInspector = {
|
|||
panel.selectNode = function SI_selectNode(aNode)
|
||||
{
|
||||
this.selectedNode = aNode;
|
||||
if (this.isOpen() && !this.hasAttribute("dimmed")) {
|
||||
if (this.isOpen()) {
|
||||
this.cssLogic.highlight(aNode);
|
||||
this.cssHtmlTree.highlight(aNode);
|
||||
} else {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
this.openPopup(win.gBrowser.selectedBrowser, "end_before", 0, 0, false, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -176,10 +176,6 @@ var StyleInspector = {
|
|||
*/
|
||||
panel.destroy = function SI_destroy()
|
||||
{
|
||||
if (!this.cssLogic)
|
||||
return;
|
||||
if (this.isOpen())
|
||||
this.hideTool();
|
||||
this.cssLogic = null;
|
||||
this.cssHtmlTree = null;
|
||||
this.removeEventListener("popupshown", SI_popupShown);
|
||||
|
@ -188,37 +184,6 @@ var StyleInspector = {
|
|||
Services.obs.notifyObservers(null, "StyleInspector-closed", null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Dim or undim a panel by setting or removing a dimmed attribute.
|
||||
*
|
||||
* @param aState
|
||||
* true = dim, false = undim
|
||||
*/
|
||||
panel.dimTool = function SI_dimTool(aState)
|
||||
{
|
||||
if (!this.isOpen())
|
||||
return;
|
||||
|
||||
if (aState) {
|
||||
this.setAttribute("dimmed", "true");
|
||||
} else if (this.hasAttribute("dimmed")) {
|
||||
this.removeAttribute("dimmed");
|
||||
}
|
||||
};
|
||||
|
||||
panel.showTool = function SI_showTool(aSelection)
|
||||
{
|
||||
this.selectNode(aSelection);
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
this.openPopup(win.gBrowser.selectedBrowser, "end_before", 0, 0,
|
||||
false, false);
|
||||
};
|
||||
|
||||
panel.hideTool = function SI_hideTool()
|
||||
{
|
||||
this.hidePopup();
|
||||
};
|
||||
|
||||
/**
|
||||
* Is the Style Inspector initialized?
|
||||
* @returns {Boolean} true or false
|
||||
|
|
|
@ -174,18 +174,26 @@ function styleInspectorClosedFromConsole1()
|
|||
{
|
||||
Services.obs.removeObserver(styleInspectorClosedFromConsole1,
|
||||
"StyleInspector-closed", false);
|
||||
info("Style Inspector 1 and 2 closed");
|
||||
info("Style Inspector 1 closed");
|
||||
Services.obs.addObserver(styleInspectorClosedFromConsole2,
|
||||
"StyleInspector-closed", false);
|
||||
}
|
||||
|
||||
function styleInspectorClosedFromConsole2()
|
||||
{
|
||||
Services.obs.removeObserver(styleInspectorClosedFromConsole2,
|
||||
"StyleInspector-closed", false);
|
||||
info("Style Inspector 2 closed");
|
||||
executeSoon(cleanUp);
|
||||
}
|
||||
|
||||
function cleanUp()
|
||||
{
|
||||
let panels = document.querySelector("panel[hudToolId]");
|
||||
ok(!panels,
|
||||
let popupSet = document.getElementById("mainPopupSet");
|
||||
ok(!popupSet.lastChild.hasAttribute("hudToolId"),
|
||||
"all style inspector panels are now detached and ready for garbage collection");
|
||||
|
||||
info("cleaning up");
|
||||
|
||||
doc = hudBox = stylePanels = jsterm = null;
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -4438,7 +4438,7 @@ function JSTermHelper(aJSTerm)
|
|||
if (!errstr) {
|
||||
let stylePanel = StyleInspector.createPanel();
|
||||
stylePanel.setAttribute("hudToolId", aJSTerm.hudId);
|
||||
stylePanel.showTool(aNode);
|
||||
stylePanel.selectNode(aNode);
|
||||
} else {
|
||||
aJSTerm.writeOutput(errstr + "\n", CATEGORY_OUTPUT, SEVERITY_ERROR);
|
||||
}
|
||||
|
|
|
@ -41,9 +41,3 @@ group.Positioning_and_Page_Flow=Positioning and Page Flow
|
|||
group.Borders=Borders
|
||||
group.Lists=Lists
|
||||
group.Effects_and_Other=Effects and Other
|
||||
|
||||
# LOCALIZATION NOTE (style.highlighter.button): These strings are used inside
|
||||
# html tree of the highlighter for the style inspector button
|
||||
style.highlighter.button.label=Style
|
||||
style.highlighter.accesskey=S
|
||||
style.highlighter.button.tooltip=Inspect element styles
|
||||
|
|
Загрузка…
Ссылка в новой задаче