Bug 1125422 - Add a flag on ContainerLayer to indicate when the entire subtree of layers needs to be in the dispatch-to-content region. r=roc

This commit is contained in:
Kartikaya Gupta 2015-02-10 16:28:07 -05:00
parent 6193a8d9da
commit f5d90daf87
4 changed files with 27 additions and 1 deletions

View File

@ -924,7 +924,8 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
mUseIntermediateSurface(false),
mSupportsComponentAlphaChildren(false),
mMayHaveReadbackChild(false),
mChildrenChanged(false)
mChildrenChanged(false),
mForceDispatchToContentRegion(false)
{
mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
}
@ -1081,6 +1082,7 @@ ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale,
mInheritedXScale, mInheritedYScale,
mPresShellResolution, mScaleToResolution,
mForceDispatchToContentRegion,
reinterpret_cast<uint64_t>(mHMDInfo.get()));
}
@ -1748,6 +1750,9 @@ ContainerLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (mScaleToResolution) {
aStream << nsPrintfCString(" [presShellResolution=%g]", mPresShellResolution).get();
}
if (mForceDispatchToContentRegion) {
aStream << " [force-dtc]";
}
if (mHMDInfo) {
aStream << nsPrintfCString(" [hmd=%p]", mHMDInfo.get()).get();
}

View File

@ -916,6 +916,10 @@ public:
* outside the dispatch-to-content region, we can initiate a gesture without
* consulting the content thread. Otherwise we must dispatch the event to
* content.
* Note that if a layer or any ancestor layer returns true for
* GetForceDispatchToContentRegion() then we must treat the dispatch-to-content
* region as encompassing the hit region, and therefore must consult the
* content thread before initiating a gesture.
*/
/**
* CONSTRUCTION PHASE ONLY
@ -1967,6 +1971,20 @@ public:
mChildrenChanged = aVal;
}
void SetForceDispatchToContentRegion(bool aVal) {
if (mForceDispatchToContentRegion == aVal) {
return;
}
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ForceDispatchToContentRegion", this));
mForceDispatchToContentRegion = aVal;
Mutated();
}
bool GetForceDispatchToContentRegion() const {
return mForceDispatchToContentRegion;
}
/**
* VR
*/
@ -2023,6 +2041,7 @@ protected:
// This is updated by ComputeDifferences. This will be true if we need to invalidate
// the intermediate surface.
bool mChildrenChanged;
bool mForceDispatchToContentRegion;
nsRefPtr<gfx::VRHMDInfo> mHMDInfo;
};

View File

@ -386,6 +386,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
attrs.presShellResolution());
containerLayer->SetForceDispatchToContentRegion(attrs.forceDispatchToContentRegion());
if (attrs.hmdInfo()) {
if (!IsSameProcess()) {

View File

@ -234,6 +234,7 @@ struct ContainerLayerAttributes {
float inheritedYScale;
float presShellResolution;
bool scaleToResolution;
bool forceDispatchToContentRegion;
// This is a bare pointer; LayerTransactionParent::RecvUpdate prevents this
// from being used when !IsSameProcess(), but we should make this truly
// cross process at some point by passing the HMDConfig