Bug 817553 - Fade the highlighter when sidebar is hovered, r=paul

This commit is contained in:
Girish Sharma 2012-12-18 00:59:08 +05:30
Родитель 6eec3f0ef3
Коммит 843c757bd0
2 изменённых файлов: 29 добавлений и 1 удалений

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

@ -114,6 +114,16 @@ ToolSidebar.prototype = {
return currentID;
},
/**
* Returns the requested tab based on the id.
*
* @param String id
* unique id of the requested tab.
*/
getTab: function ToolSidebar_getTab(id) {
return this._tabbox.tabpanels.querySelector("#sidebar-panel-" + id);
},
/**
* Event handler.
*/
@ -176,7 +186,7 @@ ToolSidebar.prototype = {
}
this._destroyed = true;
this._tabbox.removeEventListener("select", this, true);
this._tabbox.tabpanels.removeEventListener("select", this, true);
while (this._tabbox.tabpanels.hasChildNodes()) {
this._tabbox.tabpanels.removeChild(this._tabbox.tabpanels.firstChild);

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

@ -170,6 +170,7 @@ InspectorPanel.prototype = {
}.bind(this);
this.sidebar.on("select", this._setDefaultSidebar);
this.toggleHighlighter = this.toggleHighlighter.bind(this);
this.sidebar.addTab("ruleview",
"chrome://browser/content/devtools/cssruleview.xul",
@ -183,6 +184,10 @@ InspectorPanel.prototype = {
"chrome://browser/content/devtools/layoutview/view.xhtml",
"layoutview" == defaultTab);
let ruleViewTab = this.sidebar.getTab("ruleview");
ruleViewTab.addEventListener("mouseover", this.toggleHighlighter, false);
ruleViewTab.addEventListener("mouseout", this.toggleHighlighter, false);
this.sidebar.show();
},
@ -447,6 +452,19 @@ InspectorPanel.prototype = {
this.selection.emit("pseudoclass");
},
/**
* Toggle the highlighter when ruleview is hovered.
*/
toggleHighlighter: function InspectorPanel_toggleHighlighter(event)
{
if (event.type == "mouseover") {
this.highlighter.hide();
}
else if (event.type == "mouseout") {
this.highlighter.show();
}
},
/**
* Copy the innerHTML of the selected Node to the clipboard.
*/