mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 11:45:37 +00:00
Bug 1334642 - Cache luminance values for each toolbar in ToolbarIconColor. r=dao,mconley
* Track window states: active, fullscreen and tabsintitlebar for each window * Use toolbar.id and window state to store and retrieve values from cache * Note: As each window has its own ToolbarIconColor object, the cache is not currently shared across windows * inferFromText callers pass in a reason and associated value, which is used to update the state we track, and potentially clear out the cache * Create new windows test directory for browser-window-specific tests like this * Test for the ToolbarIconColor changes to avoid sync style flushes when windows activate/deactivate * Skip test for windows 8, follow-up filed as bug 1356684 MozReview-Commit-ID: JDJ3RtL4Lge --HG-- extra : rebase_source : e97bb5c09b2e6d7b264363ccba1b34bf666f31e9
This commit is contained in:
parent
836518e179
commit
b29b823ee9
@ -636,7 +636,8 @@ var FullScreen = {
|
||||
}
|
||||
}
|
||||
|
||||
ToolbarIconColor.inferFromText();
|
||||
ToolbarIconColor.inferFromText("fullscreen", aEnterFS);
|
||||
|
||||
|
||||
// For Lion fullscreen, all fullscreen controls are hidden, don't
|
||||
// bother to touch them. If we don't stop here, the following code
|
||||
|
@ -247,7 +247,8 @@ var TabsInTitlebar = {
|
||||
menubar.style.paddingBottom = "";
|
||||
}
|
||||
|
||||
ToolbarIconColor.inferFromText();
|
||||
ToolbarIconColor.inferFromText("tabsintitlebar", TabsInTitlebar.enabled);
|
||||
|
||||
if (CustomizationHandler.isCustomizing()) {
|
||||
gCustomizeMode.updateLWTStyling();
|
||||
}
|
||||
|
7
browser/base/content/test/windows/.eslintrc.js
Normal file
7
browser/base/content/test/windows/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/browser-test"
|
||||
]
|
||||
};
|
2
browser/base/content/test/windows/browser.ini
Normal file
2
browser/base/content/test/windows/browser.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[DEFAULT]
|
||||
[browser_toolbariconcolor_restyles.js]
|
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Ensure redundant style flushes are not triggered when switching between windows
|
||||
*/
|
||||
add_task(function* test_toolbar_element_restyles_on_activation() {
|
||||
if (AppConstants.platform != "win" && AppConstants.version == 8) {
|
||||
ok(true, "Skipping this test for windows 8");
|
||||
return;
|
||||
}
|
||||
|
||||
let restyles = {
|
||||
win1: {},
|
||||
win2: {}
|
||||
};
|
||||
|
||||
// create a window and snapshot the elementsStyled
|
||||
let win1 = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
let utils1 = SpecialPowers.getDOMWindowUtils(win1);
|
||||
restyles.win1.initial = utils1.elementsRestyled;
|
||||
|
||||
// create a 2nd window and snapshot the elementsStyled
|
||||
let win2 = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
let utils2 = SpecialPowers.getDOMWindowUtils(win2);
|
||||
restyles.win2.initial = utils2.elementsRestyled;
|
||||
|
||||
// switch back to 1st window, and snapshot elementsStyled
|
||||
win1.focus();
|
||||
restyles.win1.activate = utils1.elementsRestyled;
|
||||
restyles.win2.deactivate = utils2.elementsRestyled;
|
||||
|
||||
// switch back to 2nd window, and snapshot elementsStyled
|
||||
win2.focus();
|
||||
restyles.win2.activate = utils2.elementsRestyled;
|
||||
restyles.win1.deactivate = utils1.elementsRestyled;
|
||||
|
||||
is(restyles.win1.activate - restyles.win1.deactivate, 0,
|
||||
"No elements restyled when re-activating/deactivating a window");
|
||||
is(restyles.win2.activate - restyles.win2.deactivate, 0,
|
||||
"No elements restyled when re-activating/deactivating a window");
|
||||
|
||||
yield BrowserTestUtils.closeWindow(win1);
|
||||
yield BrowserTestUtils.closeWindow(win2);
|
||||
});
|
@ -35,6 +35,7 @@ BROWSER_CHROME_MANIFESTS += [
|
||||
'content/test/urlbar/browser.ini',
|
||||
'content/test/webextensions/browser.ini',
|
||||
'content/test/webrtc/browser.ini',
|
||||
'content/test/windows/browser.ini',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_UPDATER']:
|
||||
|
Loading…
Reference in New Issue
Block a user