Bug 937415 - UITour: Add ability to highlight the selected tab's icon in Australis. r=Unfocused

This commit is contained in:
Matthew Noorenberghe 2014-01-13 16:28:18 +01:00
Родитель 7788e81f76
Коммит 4ea705f5f8
2 изменённых файлов: 26 добавлений и 0 удалений

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

@ -4643,6 +4643,7 @@
role="presentation" role="presentation"
layer="true" /> layer="true" />
<xul:image xbl:inherits="src=image,fadein,pinned,selected" <xul:image xbl:inherits="src=image,fadein,pinned,selected"
anonid="tab-icon-image"
class="tab-icon-image" class="tab-icon-image"
validate="never" validate="never"
role="presentation"/> role="presentation"/>

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

@ -64,6 +64,18 @@ this.UITour = {
}, },
widgetName: "search-container", widgetName: "search-container",
}], }],
["selectedTabIcon", {
query: (aDocument) => {
let selectedtab = aDocument.defaultView.gBrowser.selectedTab;
let element = aDocument.getAnonymousElementByAttribute(selectedtab,
"anonid",
"tab-icon-image");
if (!element || !_isElementVisible(element)) {
return null;
}
return element;
},
}],
["urlbar", { ["urlbar", {
query: "#urlbar", query: "#urlbar",
widgetName: "urlbar-container", widgetName: "urlbar-container",
@ -489,6 +501,10 @@ this.UITour = {
highlighter.parentElement.openPopup(aTargetEl, "overlap", offsetX, offsetY); highlighter.parentElement.openPopup(aTargetEl, "overlap", offsetX, offsetY);
} }
// Prevent showing a panel at an undefined position.
if (!_isElementVisible(aTarget.node))
return;
this._setAppMenuStateForAnnotation(aTarget.node.ownerDocument.defaultView, "highlight", this._setAppMenuStateForAnnotation(aTarget.node.ownerDocument.defaultView, "highlight",
this.targetIsInAppMenu(aTarget), this.targetIsInAppMenu(aTarget),
showHighlightPanel.bind(this, aTarget.node)); showHighlightPanel.bind(this, aTarget.node));
@ -527,6 +543,10 @@ this.UITour = {
tooltip.openPopup(aAnchorEl, alignment); tooltip.openPopup(aAnchorEl, alignment);
} }
// Prevent showing a panel at an undefined position.
if (!_isElementVisible(aAnchor.node))
return;
this._setAppMenuStateForAnnotation(aAnchor.node.ownerDocument.defaultView, "info", this._setAppMenuStateForAnnotation(aAnchor.node.ownerDocument.defaultView, "info",
this.targetIsInAppMenu(aAnchor), this.targetIsInAppMenu(aAnchor),
showInfoPanel.bind(this, aAnchor.node)); showInfoPanel.bind(this, aAnchor.node));
@ -615,3 +635,8 @@ this.UITour = {
aWindow.gBrowser.selectedTab = tab; aWindow.gBrowser.selectedTab = tab;
}, },
}; };
function _isElementVisible(aElement) {
let targetStyle = aElement.ownerDocument.defaultView.getComputedStyle(aElement);
return (targetStyle.display != "none" && targetStyle.visibility == "visible");
}