Bug 1557102 - Work around inline styles being ignored. r=darktrojan

For some unknown reason, inline styles in overlays are ignored until something
triggers re-evaluation of the element style. This causes inline styles to be
invisible whenever an add-on uses inline styles, but does not alter the styled
element using code.

To work around the issue, this commit forces styles to be evaluated by
setting the 'display' style to the already evaluated value. That forces any
inline styles to become visible immediately.
This commit is contained in:
Dirk Steinmetz 2019-06-17 10:09:57 +02:00
Родитель af75fcc9fe
Коммит 5c70bed0e9
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -108,6 +108,14 @@ class Overlays {
node.remove();
}
// Force a re-evaluation of inline styles to work around an issue
// causing inline styles to be initially ignored.
let styledNodes = doc.evaluate("//*[@style]", doc, null, 7, null);
for (let i = 0, len = styledNodes.snapshotLength; i < len; ++i) {
let node = styledNodes.snapshotItem(i);
node.style.display = node.style.display;
}
// Load css styles from the registry
for (let sheet of this.overlayProvider.style.get(url, false)) {
unloadedSheets.push(sheet);