Bug 1137267 - Enable event-regions automatically when APZ is enabled, and allow the APZ code to assume event-regions are enabled always. r=botond,tn

This commit is contained in:
Kartikaya Gupta 2015-03-10 09:29:19 -04:00
Родитель a7954e5c2b
Коммит cf25343ea5
6 изменённых файлов: 20 добавлений и 74 удалений

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

@ -269,14 +269,11 @@ APZCTreeManager::AttachNodeToTree(HitTestingTreeNode* aNode,
static EventRegions
GetEventRegions(const LayerMetricsWrapper& aLayer)
{
if (gfxPrefs::LayoutEventRegionsEnabled()) {
if (aLayer.IsScrollInfoLayer()) {
return EventRegions(nsIntRegion(ParentLayerIntRect::ToUntyped(
RoundedToInt(aLayer.Metrics().mCompositionBounds))));
}
return aLayer.GetEventRegions();
if (aLayer.IsScrollInfoLayer()) {
return EventRegions(nsIntRegion(ParentLayerIntRect::ToUntyped(
RoundedToInt(aLayer.Metrics().mCompositionBounds))));
}
return EventRegions(aLayer.GetVisibleRegion());
return aLayer.GetEventRegions();
}
already_AddRefed<HitTestingTreeNode>
@ -1361,35 +1358,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
}
if (*aOutHitResult != HitNothing) {
if (result && !gfxPrefs::LayoutEventRegionsEnabled()) {
// When event-regions are disabled, we treat scrollinfo layers as
// regular scrollable layers. Unfortunately, their "hit region" (which
// we create from the composition bounds) is their full area, and they
// sit on top of their non-scrollinfo siblings. This means they will get
// a HitTestingTreeNode with a hit region that will aggressively match
// any input events that might be directed to sub-APZCs of their non-
// scrollinfo siblings. Therefore, we need to keep looping through to
// see if there are any other non-scrollinfo siblings that have children
// that match this input. If so, they should take priority. With event-
// regions enabled we use the actual regions from the layer, which are
// empty, and so this is unnecessary.
AsyncPanZoomController* prevSiblingApzc = nullptr;
for (HitTestingTreeNode* n = node->GetPrevSibling(); n; n = n->GetPrevSibling()) {
if (n->GetApzc()) {
prevSiblingApzc = n->GetApzc();
break;
}
}
if (result == prevSiblingApzc) {
APZCTM_LOG("Continuing search past probable scrollinfo info layer\n");
// We need to reset aOutHitResult in order to keep searching. This is
// ok because we know that we will at least hit prevSiblingApzc
// again, which is the same as result.
*aOutHitResult = HitNothing;
continue;
}
}
return result;
}
}

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

@ -197,15 +197,6 @@ HitTestingTreeNode::HitTest(const ParentLayerPoint& aPoint) const
return HitTestResult::HitNothing;
}
// When event regions are disabled and we have an APZC on this node, we are
// actually storing the touch-sensitive section of the composition bounds in
// the clip region, and we don't need to check against the mEventRegions.
// If there's no APZC, then we do need to check against the mEventRegions
// (which contains the layer's visible region) for obscuration purposes.
if (!gfxPrefs::LayoutEventRegionsEnabled() && GetApzc()) {
return HitTestResult::HitLayer;
}
// convert into Layer coordinate space
Maybe<LayerPoint> pointInLayerPixels = Untransform(aPoint);
if (!pointInLayerPixels) {

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

@ -201,9 +201,6 @@ InputQueue::MaybeRequestContentResponse(const nsRefPtr<AsyncPanZoomController>&
CancelableBlockState* aBlock)
{
bool waitForMainThread = !aBlock->IsTargetConfirmed();
if (!gfxPrefs::LayoutEventRegionsEnabled()) {
waitForMainThread |= aTarget->NeedToWaitForContent();
}
if (aBlock->AsTouchBlock() && aBlock->AsTouchBlock()->IsDuringFastMotion()) {
aBlock->SetConfirmedTargetApzc(aTarget);
waitForMainThread = false;

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

@ -2668,8 +2668,6 @@ protected:
};
TEST_F(APZEventRegionsTester, HitRegionImmediateResponse) {
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
CreateEventRegionsLayerTree1();
TestAsyncPanZoomController* root = ApzcOf(layers[0]);
@ -2723,8 +2721,6 @@ TEST_F(APZEventRegionsTester, HitRegionImmediateResponse) {
}
TEST_F(APZEventRegionsTester, HitRegionAccumulatesChildren) {
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
CreateEventRegionsLayerTree2();
int time = 0;
@ -2738,8 +2734,6 @@ TEST_F(APZEventRegionsTester, HitRegionAccumulatesChildren) {
}
TEST_F(APZEventRegionsTester, Obscuration) {
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
CreateObscuringLayerTree();
ScopedLayerTreeRegistration registration(0, root, mcc);
@ -2758,8 +2752,6 @@ TEST_F(APZEventRegionsTester, Obscuration) {
}
TEST_F(APZEventRegionsTester, Bug1119497) {
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
CreateBug1119497LayerTree();
HitTestResult result;
@ -2771,8 +2763,6 @@ TEST_F(APZEventRegionsTester, Bug1119497) {
}
TEST_F(APZEventRegionsTester, Bug1117712) {
SCOPED_GFX_PREF(LayoutEventRegionsEnabled, bool, true);
CreateBug1117712LayerTree();
TestAsyncPanZoomController* apzc2 = ApzcOf(layers[2]);

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

@ -4803,17 +4803,14 @@ nsDisplayScrollInfoLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters)
{
// Only build scrollinfo layers if event-regions are disabled, so that the
// compositor knows where the inactive scrollframes are. When event-regions
// are enabled, the dispatch-to-content regions generally provide this
// information to the APZ code. However, in some cases, there might be
// content that cannot be layerized, and so needs to scroll synchronously.
// To handle those cases (which are indicated by setting mHoisted to true), we
// still want to generate scrollinfo layers.
if (gfxPrefs::LayoutEventRegionsEnabled() && !mHoisted) {
return nullptr;
}
return nsDisplayScrollLayer::BuildLayer(aBuilder, aManager, aContainerParameters);
// In general for APZ with event-regions we no longer have a need for
// scrollinfo layers. However, in some cases, there might be content that
// cannot be layerized, and so needs to scroll synchronously. To handle those
// cases (which are indicated by setting mHoisted to true), we still want to
// generate scrollinfo layers.
return mHoisted
? nsDisplayScrollLayer::BuildLayer(aBuilder, aManager, aContainerParameters)
: nullptr;
}
LayerState
@ -4822,10 +4819,9 @@ nsDisplayScrollInfoLayer::GetLayerState(nsDisplayListBuilder* aBuilder,
const ContainerLayerParameters& aParameters)
{
// See comment in BuildLayer
if (gfxPrefs::LayoutEventRegionsEnabled() && !mHoisted) {
return LAYER_NONE;
}
return LAYER_ACTIVE_EMPTY;
return mHoisted
? LAYER_ACTIVE_EMPTY
: LAYER_NONE;
}
bool

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

@ -345,7 +345,11 @@ public:
}
bool IsBuildingLayerEventRegions()
{
return (gfxPrefs::LayoutEventRegionsEnabled() && mMode == PAINTING);
if (mMode == PAINTING) {
return (gfxPrefs::LayoutEventRegionsEnabled() ||
gfxPrefs::AsyncPanZoomEnabled());
}
return false;
}
bool IsInsidePointerEventsNoneDoc()
{