зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1f9ec3827494 (bug 1383367)
This commit is contained in:
Родитель
5c3abe8aab
Коммит
4588f63d76
|
@ -8714,7 +8714,7 @@ var ToolbarIconColor = {
|
|||
// to avoid unnecessary calls to getComputedStyle
|
||||
_toolbarLuminanceCache: new Map(),
|
||||
|
||||
async inferFromText(reason, reasonValue) {
|
||||
inferFromText(reason, reasonValue) {
|
||||
if (!this._initialized)
|
||||
return;
|
||||
function parseRGB(aColorString) {
|
||||
|
@ -8751,22 +8751,20 @@ var ToolbarIconColor = {
|
|||
// two loops to avoid flushing layout and making it dirty repeatedly.
|
||||
let cachedLuminances = this._toolbarLuminanceCache;
|
||||
let luminances = new Map();
|
||||
await BrowserUtils.promiseLayoutFlushed(document, "style", () => {
|
||||
for (let toolbar of document.querySelectorAll(toolbarSelector)) {
|
||||
// toolbars *should* all have ids, but guard anyway to avoid blowing up
|
||||
let cacheKey = toolbar.id && toolbar.id + JSON.stringify(this._windowState);
|
||||
// lookup cached luminance value for this toolbar in this window state
|
||||
let luminance = cacheKey && cachedLuminances.get(cacheKey);
|
||||
if (isNaN(luminance)) {
|
||||
let [r, g, b] = parseRGB(getComputedStyle(toolbar).color);
|
||||
luminance = 0.2125 * r + 0.7154 * g + 0.0721 * b;
|
||||
if (cacheKey) {
|
||||
cachedLuminances.set(cacheKey, luminance);
|
||||
}
|
||||
for (let toolbar of document.querySelectorAll(toolbarSelector)) {
|
||||
// toolbars *should* all have ids, but guard anyway to avoid blowing up
|
||||
let cacheKey = toolbar.id && toolbar.id + JSON.stringify(this._windowState);
|
||||
// lookup cached luminance value for this toolbar in this window state
|
||||
let luminance = cacheKey && cachedLuminances.get(cacheKey);
|
||||
if (isNaN(luminance)) {
|
||||
let [r, g, b] = parseRGB(getComputedStyle(toolbar).color);
|
||||
luminance = 0.2125 * r + 0.7154 * g + 0.0721 * b;
|
||||
if (cacheKey) {
|
||||
cachedLuminances.set(cacheKey, luminance);
|
||||
}
|
||||
luminances.set(toolbar, luminance);
|
||||
}
|
||||
});
|
||||
luminances.set(toolbar, luminance);
|
||||
}
|
||||
|
||||
for (let [toolbar, luminance] of luminances) {
|
||||
if (luminance <= 110)
|
||||
|
|
|
@ -34,10 +34,8 @@ if (Services.appinfo.OS == "Linux") {
|
|||
EXPECTED_REFLOWS.push({
|
||||
stack: [
|
||||
"handleEvent@chrome://browser/content/tabbrowser.xml",
|
||||
"inferFromText/<@chrome://browser/content/browser.js",
|
||||
"promiseReflowed/</<@resource://gre/modules/BrowserUtils.jsm",
|
||||
"_onReflow@resource://gre/modules/BrowserUtils.jsm",
|
||||
"reflowInterruptible@resource://gre/modules/BrowserUtils.jsm",
|
||||
"inferFromText@chrome://browser/content/browser.js",
|
||||
"handleEvent@chrome://browser/content/browser.js",
|
||||
],
|
||||
});
|
||||
}
|
||||
|
@ -47,10 +45,8 @@ if (Services.appinfo.OS == "Darwin") {
|
|||
EXPECTED_REFLOWS.push({
|
||||
stack: [
|
||||
"handleEvent@chrome://browser/content/tabbrowser.xml",
|
||||
"inferFromText/<@chrome://browser/content/browser.js",
|
||||
"promiseReflowed/</<@resource://gre/modules/BrowserUtils.jsm",
|
||||
"_onReflow@resource://gre/modules/BrowserUtils.jsm",
|
||||
"reflowInterruptible@resource://gre/modules/BrowserUtils.jsm",
|
||||
"inferFromText@chrome://browser/content/browser.js",
|
||||
"handleEvent@chrome://browser/content/browser.js",
|
||||
],
|
||||
});
|
||||
}
|
||||
|
@ -70,10 +66,8 @@ if (Services.appinfo.OS == "WINNT") {
|
|||
{
|
||||
stack: [
|
||||
"handleEvent@chrome://browser/content/tabbrowser.xml",
|
||||
"inferFromText/<@chrome://browser/content/browser.js",
|
||||
"promiseReflowed/</<@resource://gre/modules/BrowserUtils.jsm",
|
||||
"_onReflow@resource://gre/modules/BrowserUtils.jsm",
|
||||
"reflowInterruptible@resource://gre/modules/BrowserUtils.jsm",
|
||||
"inferFromText@chrome://browser/content/browser.js",
|
||||
"handleEvent@chrome://browser/content/browser.js",
|
||||
],
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче