Bug 1358771 - Don't set the resolution on the main-thread from an APZ repaint request that was triggered by a main-thread update. r=tnikkel

Conceptually, a repaint request that arrives in APZCCallbackHelper with
!GetScrollOffsetUpdated() is a repaint request that the APZ is sending in
response to a main-thread update it received. The purpose of the repaint
request is mainly to update the displayport margins; the scroll position
and resolution should not have changed. Therefore actively trying to set
the scroll position or resolution as a result of these repaint requests
should at best be a no-op but often triggers unnecessary clobbering of things
that are in-flight, or extra reflows. This can result in buggy behaviour.
Bug 1286179 avoided doing this for the scroll position, and this patch does
the equivalent thing for zooming.

MozReview-Commit-ID: 91RbRP0ZHBe

--HG--
extra : rebase_source : 7bb97075619f5435705d369a695d37aa1c972278
This commit is contained in:
Kartikaya Gupta 2017-08-21 12:51:43 -04:00
Родитель b5d5c3a9d9
Коммит fda8ec623e
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -251,11 +251,17 @@ APZCCallbackHelper::UpdateRootFrame(FrameMetrics& aMetrics)
MOZ_ASSERT(aMetrics.GetUseDisplayPortMargins());
if (gfxPrefs::APZAllowZooming()) {
if (gfxPrefs::APZAllowZooming() && aMetrics.GetScrollOffsetUpdated()) {
// If zooming is disabled then we don't really want to let APZ fiddle
// with these things. In theory setting the resolution here should be a
// no-op, but setting the SPCSPS is bad because it can cause a stale value
// to be returned by window.innerWidth/innerHeight (see bug 1187792).
//
// We also skip this codepath unless the metrics has a scroll offset update
// type other eNone, because eNone just means that this repaint request
// was triggered by APZ in response to a main-thread update. In this
// scenario we don't want to update the main-thread resolution because
// it can trigger unnecessary reflows.
float presShellResolution = shell->GetResolution();