Bug 699475 - Backed out changeset b878369ab3c8, testfailures and a

bug. a=orange
This commit is contained in:
Rob Campbell 2011-11-03 19:55:02 -03:00
Родитель 9173e82b00
Коммит 0ec46b8057
4 изменённых файлов: 4 добавлений и 131 удалений

Просмотреть файл

@ -1008,9 +1008,6 @@ pref("devtools.inspector.enabled", true);
// Enable the style inspector
pref("devtools.styleinspector.enabled", true);
// Enable the rules view
pref("devtools.ruleview.enabled", true);
// Enable the Scratchpad tool.
pref("devtools.scratchpad.enabled", true);

Просмотреть файл

@ -50,7 +50,6 @@ var EXPORTED_SYMBOLS = ["InspectorUI"];
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/TreePanel.jsm");
Cu.import("resource:///modules/devtools/CssRuleView.jsm");
const INSPECTOR_INVISIBLE_ELEMENTS = {
"head": true,
@ -741,7 +740,6 @@ InspectorUI.prototype = {
toolEvents: null,
inspecting: false,
treePanelEnabled: true,
ruleViewEnabled: true,
isDirty: false,
store: null,
@ -893,11 +891,6 @@ InspectorUI.prototype = {
this.treePanel = new TreePanel(this.chromeWin, this);
}
if (Services.prefs.getBoolPref("devtools.ruleview.enabled") &&
!this.toolRegistered("ruleview")) {
this.registerRuleView();
}
if (Services.prefs.getBoolPref("devtools.styleinspector.enabled") &&
!this.toolRegistered("styleinspector")) {
this.stylePanel = new StyleInspector(this.chromeWin, this);
@ -917,28 +910,6 @@ InspectorUI.prototype = {
this.initializeHighlighter();
},
registerRuleView: function IUI_registerRuleView()
{
let isOpen = this.isRuleViewOpen.bind(this);
this.ruleViewObject = {
id: "ruleview",
label: this.strings.GetStringFromName("ruleView.label"),
tooltiptext: this.strings.GetStringFromName("ruleView.tooltiptext"),
accesskey: this.strings.GetStringFromName("ruleView.accesskey"),
context: this,
get isOpen() isOpen(),
show: this.openRuleView,
hide: this.closeRuleView,
onSelect: this.selectInRuleView,
panel: null,
unregister: this.destroyRuleView,
sidebar: true,
};
this.registerTool(this.ruleViewObject);
},
/**
* Register and initialize any included tools.
*/
@ -1300,80 +1271,6 @@ InspectorUI.prototype = {
}
},
/////////////////////////////////////////////////////////////////////////
//// CssRuleView methods
/**
* Is the cssRuleView open?
*/
isRuleViewOpen: function IUI_isRuleViewOpen()
{
return this.isSidebarOpen && this.ruleButton.hasAttribute("checked") &&
(this.sidebarDeck.selectedPanel == this.getToolIframe(this.ruleViewObject));
},
/**
* Convenience getter to retrieve the Rule Button.
*/
get ruleButton()
{
return this.chromeDoc.getElementById(
this.getToolbarButtonId(this.ruleViewObject.id));
},
/**
* Open the CssRuleView.
*/
openRuleView: function IUI_openRuleView()
{
let iframe = this.getToolIframe(this.ruleViewObject);
let boundLoadListener = function() {
iframe.removeEventListener("load", boundLoadListener, true);
let doc = iframe.contentDocument;
this.ruleView = new CssRuleView(doc);
let body = doc.getElementById("ruleview-body");
body.appendChild(this.ruleView.element);
this.ruleView.highlight(this.selection);
}.bind(this);
iframe.addEventListener("load", boundLoadListener, true);
iframe.setAttribute("src", "chrome://browser/content/cssruleview.xhtml");
},
/**
* Stub to Close the CSS Rule View. Does nothing currently because the
* Rule View lives in the sidebar.
*/
closeRuleView: function IUI_closeRuleView()
{
// do nothing for now
},
/**
* Update the selected node in the Css Rule View.
* @param {nsIDOMnode} the selected node.
*/
selectInRuleView: function IUI_selectInRuleView(aNode)
{
if (this.ruleView)
this.ruleView.highlight(aNode);
},
/**
* Destroy the rule view.
*/
destroyRuleView: function IUI_destroyRuleView()
{
let iframe = this.getToolIframe(this.ruleViewObject);
iframe.parentNode.removeChild(iframe);
if (this.ruleView) {
this.ruleView.clear();
delete this.ruleView;
}
},
/////////////////////////////////////////////////////////////////////////
//// Utility Methods
@ -1657,7 +1554,7 @@ InspectorUI.prototype = {
this.bindToolEvent(btn, "click", function showIframe() {
let visible = this.sidebarDeck.selectedPanel == iframe;
if (!visible) {
this.sidebarDeck.selectedPanel = iframe;
sidebarDeck.selectedPanel = iframe;
}
this.toolShow(aRegObj);
}.bind(this));

Просмотреть файл

@ -95,34 +95,22 @@ function treePanelTests()
executeSoon(function() {
InspectorUI.showSidebar();
document.getElementById(InspectorUI.getToolbarButtonId("styleinspector")).click();
});
}
function stylePanelTests()
{
Services.obs.removeObserver(stylePanelTests, "StyleInspector-opened");
Services.obs.addObserver(runContextMenuTest,
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(InspectorUI.isSidebarOpen, "Inspector Sidebar is open");
ok(InspectorUI.stylePanel.cssHtmlTree, "Style Panel has a cssHtmlTree");
InspectorUI.ruleButton.click();
executeSoon(function() {
ruleViewTests();
});
}
function ruleViewTests()
{
Services.obs.addObserver(runContextMenuTest,
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
ok(InspectorUI.isRuleViewOpen(), "Rule View is open");
ok(InspectorUI.ruleView, "InspectorUI has a cssRuleView");
executeSoon(function() {
InspectorUI.closeInspectorUI();
});
}
function runContextMenuTest()
@ -205,10 +193,6 @@ function finishInspectorTests()
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
ok(!InspectorUI.isSidebarOpen, "Inspector Sidebar is closed");
ok(!InspectorUI.stylePanel, "Inspector Style Panel is gone");
ok(!InspectorUI.ruleView, "Inspector Rule View is gone");
is(InspectorUI.sidebarToolbar.children.length, 0, "No items in the Sidebar toolbar");
is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck");
ok(!InspectorUI.toolbar, "toolbar is hidden");
gBrowser.removeCurrentTab();

Просмотреть файл

@ -23,8 +23,3 @@ htmlPanel.tooltiptext=HTML panel
# toolbar button.
htmlPanel.accesskey=H
# LOCALIZATION NOTE (ruleView.*): Button label, accesskey and tooltip text
# associated with the Highlighter's CSS Rule View in the Style Sidebar.
ruleView.label=Rules
ruleView.accesskey=R
ruleView.tooltiptext=View and Edit CSS