Bug 1645520 - Ensure an MVM operating in VisualViewportOnly mode knows about display resizes. r=tnikkel

This is important because if the apz.allow_zooming pref is enabled (and
eventually even without that pref), VisualViewportOnly-type MVMs do set
the visual viewport size based on the display size and zoom, and so need
to be updated when those change.

Differential Revision: https://phabricator.services.mozilla.com/D79594
This commit is contained in:
Kartikaya Gupta 2020-06-13 11:41:40 +00:00
Родитель f3d007c8fd
Коммит fa92ff33df
4 изменённых файлов: 29 добавлений и 26 удалений

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

@ -540,9 +540,29 @@ void MobileViewportManager::RefreshVisualViewportSize() {
ScreenIntSize displaySize = ViewAs<ScreenPixel>(
mDisplaySize, PixelCastJustification::LayoutDeviceIsScreenForBounds);
if (displaySize.width == 0 || displaySize.height == 0) {
return;
}
UpdateVisualViewportSize(displaySize, GetZoom());
}
void MobileViewportManager::NotifyResizeReflow() {
// If there's a resize-reflow, the visual viewport may need to be recomputed
// for a new display size, so let's do that.
if (Maybe<LayoutDeviceIntSize> newDisplaySize =
mContext->GetContentViewerSize()) {
// Note that we intentionally don't short-circuit here if the display size
// (in LD units) is unchanged, because a resize-reflow may also be triggered
// by a change in the CSS/LD pixel ratio which would affect GetZoom() and
// therefore the computed visual viewport.
mDisplaySize = *newDisplaySize;
MVM_LOG("%p: Display size updated to %s\n", this,
Stringify(mDisplaySize).c_str());
RefreshVisualViewportSize();
}
}
void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) {
// This function gets called by the various triggers that may result in a
// change of the CSS viewport. In some of these cases (e.g. the meta-viewport

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

@ -74,6 +74,12 @@ class MobileViewportManager final : public nsIDOMEventListener,
void SetRestoreResolution(float aResolution);
public:
/* Notify the MobileViewportManager that a resize-reflow is about to happen,
* possibly indicating a change in the display size or some other quantity
* that the visual viewport depends on.
*/
void NotifyResizeReflow();
/* Notify the MobileViewportManager that a reflow was requested in the
* presShell.*/
void RequestReflow(bool aForceAdjustResolution);

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

@ -1955,6 +1955,9 @@ nsresult PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight,
mMobileViewportManager->RequestReflow(false);
return NS_OK;
}
if (mMobileViewportManager) {
mMobileViewportManager->NotifyResizeReflow();
}
return ResizeReflowIgnoreOverride(aWidth, aHeight, aOptions);
}

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

@ -1,26 +0,0 @@
[start-edge-in-block-layout-direction.html]
[Vertical-RL LTR.]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL
[Horizontal RTL.]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL
[Vertical-LR LTR.]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL
[Vertical-RL RTL.]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL
[Vertical-LR RTL.]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL