Bug 1536781, use the same paint suppression delay on mobile and desktop, r=emilio

Differential Revision: https://phabricator.services.mozilla.com//D24804

--HG--
extra : rebase_source : 5fcdd643e253dcad6ab2f0c94ed3addd48724249
This commit is contained in:
Olli Pettay 2019-03-25 14:44:56 +02:00
parent d34f886b2d
commit 6143d2b90d
3 changed files with 17 additions and 5 deletions

View File

@ -56,11 +56,7 @@ typedef nsTHashtable<nsPtrHashKey<nsIFrame>> VisibleFrames;
// This is actually pref-controlled, but we use this value if we fail
// to get the pref for any reason.
#ifdef MOZ_WIDGET_ANDROID
# define PAINTLOCK_EVENT_DELAY 250
#else
# define PAINTLOCK_EVENT_DELAY 5
#endif
#define PAINTLOCK_EVENT_DELAY 5
class PresShell final : public nsIPresShell,
public nsISelectionController,

View File

@ -124,6 +124,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
cleanupTabs();
});
function waitForPaint(tab) {
return new Promise(function(resolve, reject) {
tab.browser.contentWindow.requestAnimationFrame(() => {
tab.browser.contentWindow.requestAnimationFrame(() => {
resolve();
});
});
});
}
add_task(async function test_fontInflationPrecedence() {
// Check that we're starting out with the default values
is(sharedPrefs.getBoolPref(ANDROID_PREF), false, "System font size scaling is disabled");
@ -133,6 +143,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
is(getSystemFontScale(), 1.0, "system font scale is default");
tab = BrowserApp.addTab(URL_desktop, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tab.browser, "load");
await waitForPaint(tab);
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
1.0, "text zoom is default value");
@ -143,6 +155,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
tab.reloadWithMode(tab.desktopMode);
await promiseBrowserEvent(tab.browser, "load");
await waitForPaint(tab);
let fontInflationOn = snapshotWindow(tab.browser.contentWindow);
assertSnapshots(noZoom, fontInflationOn, false, null, "noZoom", "fontInflationOn");
@ -151,6 +164,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
setSystemFontScale(2.0);
tab.reloadWithMode(tab.desktopMode);
await promiseBrowserEvent(tab.browser, "load");
await waitForPaint(tab);
is(getSystemFontScale(), 2.0, "system font scale is enabled");
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
@ -162,6 +176,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
Services.prefs.setIntPref(GECKO_PREF_FONT_INFLATION, 0);
tab.reloadWithMode(tab.desktopMode);
await promiseBrowserEvent(tab.browser, "load");
await waitForPaint(tab);
is(tab.browser.markupDocumentViewer.effectiveTextZoom, 2.0,
"text zoom set through system font scale zooming");

View File

@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
height: 2000px;