Bug 1389143 - Refactor to extract helper method. r=jrmuizel

MozReview-Commit-ID: 5FxrP280i5m

--HG--
extra : rebase_source : 5ca1f3f42d013b1b5adfa64caf061b170e700092
This commit is contained in:
Kartikaya Gupta 2017-08-18 13:06:30 -04:00
parent 89677ada26
commit 975c4c2802
3 changed files with 37 additions and 14 deletions

View File

@ -51,6 +51,26 @@ CSSFilter ToCSSFilter(const nsStyleFilter& filter)
}
}
EventRegions::EventRegions(const nsIntRegion& aHitRegion,
const nsIntRegion& aMaybeHitRegion,
const nsIntRegion& aDispatchToContentRegion,
const nsIntRegion& aNoActionRegion,
const nsIntRegion& aHorizontalPanRegion,
const nsIntRegion& aVerticalPanRegion)
{
mHitRegion = aHitRegion;
mNoActionRegion = aNoActionRegion;
mHorizontalPanRegion = aHorizontalPanRegion;
mVerticalPanRegion = aVerticalPanRegion;
// Points whose hit-region status we're not sure about need to be dispatched
// to the content thread. If a point is in both maybeHitRegion and hitRegion
// then it's not a "maybe" any more, and doesn't go into the dispatch-to-
// content region.
mDispatchToContentHitRegion.Sub(aMaybeHitRegion, mHitRegion);
mDispatchToContentHitRegion.OrWith(aDispatchToContentRegion);
mHitRegion.OrWith(aMaybeHitRegion);
}
} // namespace layers
} // namespace mozilla

View File

@ -110,6 +110,16 @@ struct EventRegions {
{
}
// This constructor takes the maybe-hit region and uses it to update the
// hit region and dispatch-to-content region. It is useful from converting
// from the display item representation to the layer representation.
EventRegions(const nsIntRegion& aHitRegion,
const nsIntRegion& aMaybeHitRegion,
const nsIntRegion& aDispatchToContentRegion,
const nsIntRegion& aNoActionRegion,
const nsIntRegion& aHorizontalPanRegion,
const nsIntRegion& aVerticalPanRegion);
bool operator==(const EventRegions& aRegions) const
{
return mHitRegion == aRegions.mHitRegion &&

View File

@ -3396,20 +3396,13 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
containingPaintedLayerData->CombinedTouchActionRegion());
}
} else {
EventRegions regions;
regions.mHitRegion = ScaleRegionToOutsidePixels(data->mHitRegion);
regions.mNoActionRegion = ScaleRegionToOutsidePixels(data->mNoActionRegion);
regions.mHorizontalPanRegion = ScaleRegionToOutsidePixels(data->mHorizontalPanRegion);
regions.mVerticalPanRegion = ScaleRegionToOutsidePixels(data->mVerticalPanRegion);
// Points whose hit-region status we're not sure about need to be dispatched
// to the content thread. If a point is in both maybeHitRegion and hitRegion
// then it's not a "maybe" any more, and doesn't go into the dispatch-to-
// content region.
nsIntRegion maybeHitRegion = ScaleRegionToOutsidePixels(data->mMaybeHitRegion);
regions.mDispatchToContentHitRegion.Sub(maybeHitRegion, regions.mHitRegion);
regions.mDispatchToContentHitRegion.OrWith(
ScaleRegionToOutsidePixels(data->mDispatchToContentHitRegion));
regions.mHitRegion.OrWith(maybeHitRegion);
EventRegions regions(
ScaleRegionToOutsidePixels(data->mHitRegion),
ScaleRegionToOutsidePixels(data->mMaybeHitRegion),
ScaleRegionToOutsidePixels(data->mDispatchToContentHitRegion),
ScaleRegionToOutsidePixels(data->mNoActionRegion),
ScaleRegionToOutsidePixels(data->mHorizontalPanRegion),
ScaleRegionToOutsidePixels(data->mVerticalPanRegion));
Matrix mat = layer->GetTransform().As2D();
mat.Invert();