Bug 1211654 - Force opacity layers that were only created for APZ hit-testing information to always be inactive. r=mstange

This commit is contained in:
Matt Woodrow 2015-10-15 15:15:16 +13:00
parent 0735fa738c
commit 3355c46862
3 changed files with 23 additions and 7 deletions

View File

@ -3821,9 +3821,12 @@ nsresult nsDisplayWrapper::WrapListsInPlace(nsDisplayListBuilder* aBuilder,
}
nsDisplayOpacity::nsDisplayOpacity(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList)
nsIFrame* aFrame, nsDisplayList* aList,
bool aForEventsOnly)
: nsDisplayWrapList(aBuilder, aFrame, aList)
, mOpacity(aFrame->StyleDisplay()->mOpacity) {
, mOpacity(aFrame->StyleDisplay()->mOpacity)
, mForEventsOnly(aForEventsOnly)
{
MOZ_COUNT_CTOR(nsDisplayOpacity);
}
@ -3954,6 +3957,14 @@ nsDisplayItem::LayerState
nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters) {
// If we only created this item so that we'd get correct nsDisplayEventRegions for child
// frames, then force us to inactive to avoid unnecessary layerization changes for content
// that won't ever be painted.
if (mForEventsOnly) {
MOZ_ASSERT(mOpacity == 0);
return LAYER_INACTIVE;
}
if (NeedsActiveLayer(aBuilder))
return LAYER_ACTIVE;

View File

@ -3167,7 +3167,7 @@ protected:
class nsDisplayOpacity : public nsDisplayWrapList {
public:
nsDisplayOpacity(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList);
nsDisplayList* aList, bool aForEventsOnly);
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayOpacity();
#endif
@ -3202,6 +3202,7 @@ public:
private:
float mOpacity;
bool mForEventsOnly;
};
class nsDisplayMixBlendMode : public nsDisplayWrapList {

View File

@ -1920,13 +1920,17 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
// need to have display items built for them.
bool needEventRegions = aBuilder->IsBuildingLayerEventRegions() &&
StyleVisibility()->GetEffectivePointerEvents(this) != NS_STYLE_POINTER_EVENTS_NONE;
bool opacityItemForEventsOnly = false;
if (disp->mOpacity == 0.0 && aBuilder->IsForPainting() &&
!aBuilder->WillComputePluginGeometry() &&
!(disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) &&
!nsLayoutUtils::HasCurrentAnimationOfProperty(this,
eCSSProperty_opacity) &&
!needEventRegions) {
return;
eCSSProperty_opacity)) {
if (needEventRegions) {
opacityItemForEventsOnly = true;
} else {
return;
}
}
if (disp->mWillChangeBitField != 0) {
@ -2135,7 +2139,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
DisplayListClipState::AutoSaveRestore opacityClipState(aBuilder);
opacityClipState.Clear();
resultList.AppendNewToTop(
new (aBuilder) nsDisplayOpacity(aBuilder, this, &resultList));
new (aBuilder) nsDisplayOpacity(aBuilder, this, &resultList, opacityItemForEventsOnly));
}
/* If we have sticky positioning, wrap it in a sticky position item.
*/