Bug 1773155 - Ensure highlighter iframe for parent process is transparent. r=nchevobbe

By ensuring that it has color-scheme: light in both the embedder and the
embedded page.

Usually only the outer styling is necessary, but we generally assume
that chrome pages follow the OS color-scheme, so we need to make sure
both are set as light.

This might be able to go away depending on the resolution of
https://github.com/mozilla/wg-decisions/issues/774

Differential Revision: https://phabricator.services.mozilla.com/D148585
This commit is contained in:
Emilio Cobos Álvarez 2022-06-08 11:14:19 +00:00
Родитель 1b76ade349
Коммит 8d4a737d44
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -62,6 +62,7 @@ const XUL_HIGHLIGHTER_STYLES_SHEET = `data:text/css;charset=utf-8,
width: 100%;
height: 100%;
z-index: 2;
color-scheme: light;
}`;
const STYLESHEET_URI =
@ -295,6 +296,11 @@ CanvasFrameAnonymousContentHelper.prototype = {
if (!this._iframe) {
this._iframe = window.document.createElement("iframe");
// We need the color-scheme shenanigans to ensure that the iframe is
// transparent, see bug 1773155, bug 1738380, and
// https://github.com/mozilla/wg-decisions/issues/774.
this._iframe.srcdoc =
"<!doctype html><meta name=color-scheme content=light>";
this._iframe.classList.add("devtools-highlighter-renderer");
// If iframe is used for the first time, add ref count of one to its
// numberOfHighlighters data attribute.