Bug 1652190 - Set nsPresContext::mDynamicToolbarHeight in nsPresContext::SetDynamicTo...
commita6522ef178bd199e989d1f6341a850b7f0e14cf6
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Tue, 21 Jul 2020 02:52:51 +0000 (21 02:52 +0000)
committerHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Tue, 21 Jul 2020 02:52:51 +0000 (21 02:52 +0000)
treee8761f4272ebab94b9e30af71b534a1562dc2d8c
parent1082fc269ab1870918ff5aaad4d430798b4fa3ac
Bug 1652190 - Set nsPresContext::mDynamicToolbarHeight in nsPresContext::SetDynamicToolbarMaxHeight. r=botond

nsPreContext::mDynamicToolbarHeight is representing the state of the dynamic
toolbar in transition or is being collapsed. So if we leave the value as it is,
we misrecognize the state, the visual viewport width/height are significantly
affected by the misrecognition, it returns 0 because in the collapsed or the
transition state, it returns the special value [1] which is never properly set
without calling nsPresContext::UpdateDynamicToolbarOffset.

This mismatching state doesn't much matter in the real sites since we don't
often change the max height of the dynamic toolbar but in automated tests it's
a big problem. In fact a test case which will be introduced in the next commit
will not work properly without this fix.

[1] https://searchfox.org/mozilla-central/rev/1b95a0179507a4dc7d4b0c94c2df420dc1a72885/dom/base/VisualViewport.cpp#78

Differential Revision: https://phabricator.services.mozilla.com/D83902
dom/base/test/file_domwindowutils_dynamic_toolbar.html [new file with mode: 0644]
dom/base/test/mochitest.ini
dom/base/test/test_domwindowutils.html
layout/base/PresShell.cpp
layout/base/nsPresContext.cpp