Bug 1421885 - Part 1: Don't let mNoActionRegion get complex when we've already added it to mDispatchToContentRegion. r=kats

MozReview-Commit-ID: 11gi2u4bAdJ

--HG--
extra : rebase_source : b3dc98930fb623244689fa15ff6a5275bc212312
This commit is contained in:
Matt Woodrow 2018-07-09 16:12:54 +12:00
Родитель 4e4ecfddb6
Коммит 3988cf0afa
1 изменённых файлов: 17 добавлений и 16 удалений

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

@ -659,6 +659,8 @@ public:
* mDispatchToContentHitRegion.
*/
nsRegion mVerticalPanRegion;
bool mCollapsedTouchActions = false;
/**
* Scaled versions of the bounds of mHitRegion and mMaybeHitRegion.
* We store these because FindPaintedLayerFor() needs to consume them
@ -3877,8 +3879,21 @@ PaintedLayerData::AccumulateHitTestInfo(ContainerState* aState,
auto touchFlags = hitTestInfo & CompositorHitTestInfo::eTouchActionMask;
if (touchFlags) {
// something was disabled
if (touchFlags == CompositorHitTestInfo::eTouchActionMask) {
// If there are multiple touch-action areas, there are multiple elements with
// touch-action properties. We don't know what the relationship is between
// those elements in terms of DOM ancestry, and so we don't know how to
// combine the regions properly. Instead, we just add all the areas to the
// dispatch-to-content region, so that the APZ knows to check with the
// main thread. See bug 1286957.
if (mCollapsedTouchActions) {
mDispatchToContentHitRegion.OrWith(area);
} else if (!CombinedTouchActionRegion().IsEmpty()) {
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
mNoActionRegion.SetEmpty();
mHorizontalPanRegion.SetEmpty();
mVerticalPanRegion.SetEmpty();
mCollapsedTouchActions = true;
} else if (touchFlags == CompositorHitTestInfo::eTouchActionMask) {
// everything was disabled, so touch-action:none
mNoActionRegion.OrWith(area);
} else {
@ -3914,20 +3929,6 @@ PaintedLayerData::AccumulateHitTestInfo(ContainerState* aState,
}
}
// If there are multiple touch-action areas, there are multiple elements with
// touch-action properties. We don't know what the relationship is between
// those elements in terms of DOM ancestry, and so we don't know how to
// combine the regions properly. Instead, we just add all the areas to the
// dispatch-to-content region, so that the APZ knows to check with the
// main thread. See bug 1286957.
const int alreadyHadRegions = mNoActionRegion.GetNumRects() +
mHorizontalPanRegion.GetNumRects() +
mVerticalPanRegion.GetNumRects();
if (alreadyHadRegions > 1) {
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
}
// Avoid quadratic performance as a result of the region growing to include
// and arbitrarily large number of rects, which can happen on some pages.
mMaybeHitRegion.SimplifyOutward(8);