Bug 1667887: fix Remove Dead Code in HighContrastCheck in the Screenshots UI r=emalysz

Differential Revision: https://phabricator.services.mozilla.com/D112263
This commit is contained in:
Falguni Islam 2021-04-28 21:41:31 +00:00
Родитель 2460ffe976
Коммит 959874613b
2 изменённых файлов: 20 добавлений и 31 удалений

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

@ -253,9 +253,11 @@ window.inlineSelectionCss = `
position: absolute;
inset-inline-end: 0;
top: 0; }
body.hcm .hover-highlight {
background-color: white;
opacity: 0.2; }
/* When prefers contrast is fully supported, we should change these quereies to cover both high and low prefers contrast cases */
@media (forced-colors: active) {
.hover-highlight {
background-color: white;
opacity: 0.2; } }
.mover-target.direction-topLeft {
cursor: nwse-resize;
@ -357,9 +359,11 @@ window.inlineSelectionCss = `
background-color: rgba(0, 0, 0, 0.7);
position: absolute;
z-index: 9999999999; }
body.hcm .bghighlight {
background-color: black;
opacity: 0.7; }
/* When prefers contrast is fully supported, we should change these quereies to cover both high and low prefers contrast cases */
@media (forced-colors: active) {
.bghighlight {
background-color: black;
opacity: 0.7; } }
.preview-overlay {
align-items: center;
@ -374,9 +378,11 @@ window.inlineSelectionCss = `
top: 0;
width: 100%;
z-index: 9999999999; }
body.hcm .preview-overlay {
background-color: black;
opacity: 0.7; }
/* When prefers contrast is fully supported, we should change these quereies to cover both high and low prefers contrast cases */
@media (forced-colors: active) {
.preview-overlay {
background-color: black;
opacity: 0.7; } }
.precision-cursor {
cursor: crosshair; }
@ -388,9 +394,11 @@ window.inlineSelectionCss = `
cursor: move;
position: absolute;
z-index: 9999999999; }
body.hcm .highlight {
border: 2px dashed white;
opacity: 1.0; }
/* When prefers contrast is fully supported, we should change these quereies to cover both high and low prefers contrast cases */
@media (forced-colors: active) {
.highlight {
border: 2px dashed white;
opacity: 1.0; } }
.highlight-buttons {
display: flex;

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

@ -58,19 +58,6 @@ this.ui = (function() {
);
}
function highContrastCheck(win) {
const doc = win.document;
const el = doc.createElement("div");
el.style.backgroundImage = "url('#')";
el.style.display = "none";
doc.body.appendChild(el);
const computed = win.getComputedStyle(el);
doc.body.removeChild(el);
// When Windows is in High Contrast mode, Firefox replaces background
// image URLs with the string "none".
return computed && computed.backgroundImage === "none";
}
function initializeIframe() {
const el = document.createElement("iframe");
el.src = browser.extension.getURL("blank.html");
@ -150,9 +137,6 @@ this.ui = (function() {
catcher.watchPromise(
callBackground("sendEvent", "internal", "unhide-selection-frame")
);
if (highContrastCheck(this.element.contentWindow)) {
this.element.contentDocument.body.classList.add("hcm");
}
this.initSizeWatch();
this.element.focus();
},
@ -362,9 +346,6 @@ this.ui = (function() {
catcher.watchPromise(
callBackground("sendEvent", "internal", "unhide-preselection-frame")
);
if (highContrastCheck(this.element.contentWindow)) {
this.element.contentDocument.body.classList.add("hcm");
}
this.element.focus();
},