зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1782675 - Add `button` helper to FirefoxViewHandler and make `attention` a boolean attribute. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D153447
This commit is contained in:
Родитель
6b6c07c221
Коммит
7c4732f5fe
|
@ -9926,6 +9926,9 @@ var ConfirmationHint = {
|
||||||
|
|
||||||
var FirefoxViewHandler = {
|
var FirefoxViewHandler = {
|
||||||
tab: null,
|
tab: null,
|
||||||
|
get button() {
|
||||||
|
return document.getElementById("firefox-view-button");
|
||||||
|
},
|
||||||
init() {
|
init() {
|
||||||
const { FirefoxViewNotificationManager } = ChromeUtils.importESModule(
|
const { FirefoxViewNotificationManager } = ChromeUtils.importESModule(
|
||||||
"resource:///modules/firefox-view-notification-manager.sys.mjs"
|
"resource:///modules/firefox-view-notification-manager.sys.mjs"
|
||||||
|
@ -9960,9 +9963,7 @@ var FirefoxViewHandler = {
|
||||||
handleEvent(e) {
|
handleEvent(e) {
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case "TabSelect":
|
case "TabSelect":
|
||||||
document
|
this.button?.toggleAttribute("open", e.target == this.tab);
|
||||||
.getElementById("firefox-view-button")
|
|
||||||
?.toggleAttribute("open", e.target == this.tab);
|
|
||||||
this._removeNotificationDotIfTabSelected();
|
this._removeNotificationDotIfTabSelected();
|
||||||
break;
|
break;
|
||||||
case "TabClose":
|
case "TabClose":
|
||||||
|
@ -9990,7 +9991,6 @@ var FirefoxViewHandler = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_toggleNotificationDot(shouldShow) {
|
_toggleNotificationDot(shouldShow) {
|
||||||
let fxViewButton = document.getElementById("firefox-view-button");
|
this.button?.toggleAttribute("attention", shouldShow);
|
||||||
fxViewButton?.setAttribute("attention", shouldShow);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,23 +44,18 @@ async function waitForNotificationBadgeToBeShowing(fxViewButton) {
|
||||||
await BrowserTestUtils.waitForMutationCondition(
|
await BrowserTestUtils.waitForMutationCondition(
|
||||||
fxViewButton,
|
fxViewButton,
|
||||||
{ attributes: true },
|
{ attributes: true },
|
||||||
() => fxViewButton.getAttribute("attention") === "true"
|
() => fxViewButton.hasAttribute("attention")
|
||||||
);
|
);
|
||||||
return fxViewButton.getAttribute("attention") === "true";
|
return fxViewButton.hasAttribute("attention");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function waitForNotificationBadgeToBeHidden(fxViewButton) {
|
async function waitForNotificationBadgeToBeHidden(fxViewButton) {
|
||||||
await BrowserTestUtils.waitForMutationCondition(
|
await BrowserTestUtils.waitForMutationCondition(
|
||||||
fxViewButton,
|
fxViewButton,
|
||||||
{ attributes: true },
|
{ attributes: true },
|
||||||
() =>
|
() => !fxViewButton.hasAttribute("attention")
|
||||||
!fxViewButton.getAttribute("attention") ||
|
|
||||||
fxViewButton.getAttribute("attention") === "false"
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
!fxViewButton.getAttribute("attention") ||
|
|
||||||
fxViewButton.getAttribute("attention") === "false"
|
|
||||||
);
|
);
|
||||||
|
return !fxViewButton.hasAttribute("attention");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBackgroundPositionForElement(ele) {
|
function getBackgroundPositionForElement(ele) {
|
||||||
|
|
|
@ -630,7 +630,7 @@ toolbar[brighttext] {
|
||||||
|
|
||||||
.tabbrowser-tab:is([image], [pinned]) > .tab-stack > .tab-content[attention]:not([selected="true"]),
|
.tabbrowser-tab:is([image], [pinned]) > .tab-stack > .tab-content[attention]:not([selected="true"]),
|
||||||
.tabbrowser-tab > .tab-stack > .tab-content[pinned][titlechanged]:not([selected="true"]),
|
.tabbrowser-tab > .tab-stack > .tab-content[pinned][titlechanged]:not([selected="true"]),
|
||||||
#firefox-view-button[attention="true"] {
|
#firefox-view-button[attention] {
|
||||||
background-image: radial-gradient(circle, var(--tab-attention-icon-color), var(--tab-attention-icon-color) 2px, transparent 2px);
|
background-image: radial-gradient(circle, var(--tab-attention-icon-color), var(--tab-attention-icon-color) 2px, transparent 2px);
|
||||||
background-position: center bottom calc(6.5px + var(--tabs-navbar-shadow-size));
|
background-position: center bottom calc(6.5px + var(--tabs-navbar-shadow-size));
|
||||||
background-size: 4px 4px;
|
background-size: 4px 4px;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче