зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1683612 - Don't use mobile display size where dom.meta-viewport.enable pref is false. r=botond
If the pref is false, we don't trigger auto-shrink machinery so that we shouldn't use the display size to layout scrollbars. Differential Revision: https://phabricator.services.mozilla.com/D100312
This commit is contained in:
Родитель
3c4c9413c1
Коммит
2e6e03771b
|
@ -28,3 +28,7 @@ support-files =
|
|||
apz_test_native_event_utils.js
|
||||
apz_test_utils.js
|
||||
helper_test_reset_scaling_zoom.html
|
||||
[browser_test_scrollbar_in_extension_popup_window.js]
|
||||
support-files =
|
||||
!/browser/components/extensions/test/browser/head.js
|
||||
!/browser/components/extensions/test/browser/head_browserAction.js
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/browser/components/extensions/test/browser/head.js",
|
||||
this
|
||||
);
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/browser/components/extensions/test/browser/head_browserAction.js",
|
||||
this
|
||||
);
|
||||
|
||||
add_task(async () => {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
browser_action: {
|
||||
default_popup: "popup.html",
|
||||
browser_style: true,
|
||||
},
|
||||
},
|
||||
|
||||
files: {
|
||||
"popup.html": `
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
height: 400px;
|
||||
width: 200px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
li {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30vh;
|
||||
font-size: 200%;
|
||||
}
|
||||
li:nth-child(even){
|
||||
background-color: #ccc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>1</li>
|
||||
<li>2</li>
|
||||
<li>3</li>
|
||||
<li>4</li>
|
||||
<li>5</li>
|
||||
<li>6</li>
|
||||
<li>7</li>
|
||||
<li>8</li>
|
||||
<li>9</li>
|
||||
<li>10</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>`,
|
||||
},
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
SpecialPowers.clearUserPref("apz.popups.enabled");
|
||||
});
|
||||
|
||||
async function takeSnapshot(browserWin) {
|
||||
let browser = await openBrowserActionPanel(extension, browserWin, true);
|
||||
const snapshot = await SpecialPowers.spawn(browser, [], async () => {
|
||||
await SpecialPowers.snapshotWindow(
|
||||
content.window,
|
||||
false /* withCaret */,
|
||||
undefined /* use the default rect */,
|
||||
undefined /* use the default bgcolor */,
|
||||
{ DRAWWINDOW_DRAW_VIEW: true } /* to capture scrollbars */
|
||||
)
|
||||
.toDataURL()
|
||||
.toString();
|
||||
});
|
||||
|
||||
const popup = getBrowserActionPopup(extension, browserWin);
|
||||
await closeBrowserAction(extension, browserWin);
|
||||
is(popup.state, "closed", "browserAction popup has been closed");
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
// First, take a snapshot with disabling APZ in the popup window, we assume
|
||||
// scrollbars are rendered properly there.
|
||||
await SpecialPowers.setBoolPref("apz.popups.enabled", false);
|
||||
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const reference = await takeSnapshot(newWin);
|
||||
await BrowserTestUtils.closeWindow(newWin);
|
||||
|
||||
// Then take a snapshot with enabling APZ.
|
||||
await SpecialPowers.setBoolPref("apz.popups.enabled", true);
|
||||
const anotherWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const test = await takeSnapshot(anotherWin);
|
||||
await BrowserTestUtils.closeWindow(anotherWin);
|
||||
|
||||
is(
|
||||
test,
|
||||
reference,
|
||||
"Contents in popup window opened by extension should be same regardless of the APZ state in the window"
|
||||
);
|
||||
|
||||
await extension.unload();
|
||||
});
|
|
@ -6247,27 +6247,31 @@ class MOZ_RAII AutoMinimumScaleSizeChangeDetector final {
|
|||
};
|
||||
|
||||
nsSize ScrollFrameHelper::TrueOuterSize(nsDisplayListBuilder* aBuilder) const {
|
||||
if (RefPtr<MobileViewportManager> manager =
|
||||
mOuter->PresShell()->GetMobileViewportManager()) {
|
||||
LayoutDeviceIntSize displaySize = manager->DisplaySize();
|
||||
|
||||
MOZ_ASSERT(aBuilder);
|
||||
// In case of WebRender, we expand the outer size to include the dynamic
|
||||
// toolbar area here.
|
||||
// In case of non WebRender, we expand the size dynamically in
|
||||
// MoveScrollbarForLayerMargin in AsyncCompositionManager.cpp.
|
||||
LayerManager* layerManager = aBuilder->GetWidgetLayerManager();
|
||||
if (layerManager &&
|
||||
layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
displaySize.height += ViewAs<LayoutDevicePixel>(
|
||||
mOuter->PresContext()->GetDynamicToolbarMaxHeight(),
|
||||
PixelCastJustification::LayoutDeviceIsScreenForBounds);
|
||||
}
|
||||
|
||||
return LayoutDeviceSize::ToAppUnits(
|
||||
displaySize, mOuter->PresContext()->AppUnitsPerDevPixel());
|
||||
if (!mOuter->PresShell()->UsesMobileViewportSizing()) {
|
||||
return mOuter->GetSize();
|
||||
}
|
||||
return mOuter->GetSize();
|
||||
|
||||
RefPtr<MobileViewportManager> manager =
|
||||
mOuter->PresShell()->GetMobileViewportManager();
|
||||
MOZ_ASSERT(manager);
|
||||
|
||||
LayoutDeviceIntSize displaySize = manager->DisplaySize();
|
||||
|
||||
MOZ_ASSERT(aBuilder);
|
||||
// In case of WebRender, we expand the outer size to include the dynamic
|
||||
// toolbar area here.
|
||||
// In case of non WebRender, we expand the size dynamically in
|
||||
// MoveScrollbarForLayerMargin in AsyncCompositionManager.cpp.
|
||||
LayerManager* layerManager = aBuilder->GetWidgetLayerManager();
|
||||
if (layerManager &&
|
||||
layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
displaySize.height += ViewAs<LayoutDevicePixel>(
|
||||
mOuter->PresContext()->GetDynamicToolbarMaxHeight(),
|
||||
PixelCastJustification::LayoutDeviceIsScreenForBounds);
|
||||
}
|
||||
|
||||
return LayoutDeviceSize::ToAppUnits(
|
||||
displaySize, mOuter->PresContext()->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
void ScrollFrameHelper::UpdateMinimumScaleSize(
|
||||
|
|
Загрузка…
Ссылка в новой задаче