зеркало из https://github.com/mozilla/gecko-dev.git
Bug 937415 - UITour: Add ability to highlight the selected tab's icon in Australis. r=Unfocused
This commit is contained in:
Родитель
7788e81f76
Коммит
4ea705f5f8
|
@ -4643,6 +4643,7 @@
|
|||
role="presentation"
|
||||
layer="true" />
|
||||
<xul:image xbl:inherits="src=image,fadein,pinned,selected"
|
||||
anonid="tab-icon-image"
|
||||
class="tab-icon-image"
|
||||
validate="never"
|
||||
role="presentation"/>
|
||||
|
|
|
@ -64,6 +64,18 @@ this.UITour = {
|
|||
},
|
||||
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", {
|
||||
query: "#urlbar",
|
||||
widgetName: "urlbar-container",
|
||||
|
@ -489,6 +501,10 @@ this.UITour = {
|
|||
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.targetIsInAppMenu(aTarget),
|
||||
showHighlightPanel.bind(this, aTarget.node));
|
||||
|
@ -527,6 +543,10 @@ this.UITour = {
|
|||
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.targetIsInAppMenu(aAnchor),
|
||||
showInfoPanel.bind(this, aAnchor.node));
|
||||
|
@ -615,3 +635,8 @@ this.UITour = {
|
|||
aWindow.gBrowser.selectedTab = tab;
|
||||
},
|
||||
};
|
||||
|
||||
function _isElementVisible(aElement) {
|
||||
let targetStyle = aElement.ownerDocument.defaultView.getComputedStyle(aElement);
|
||||
return (targetStyle.display != "none" && targetStyle.visibility == "visible");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче