Backed out changeset 3de27f6dcd31 (bug 1022612)

This commit is contained in:
Carsten "Tomcat" Book 2014-07-15 10:29:55 +02:00
parent ead89dc956
commit b21012d2de
5 changed files with 92 additions and 44 deletions

View File

@ -1046,7 +1046,8 @@ nsDisplayList::ComputeVisibilityForRoot(nsDisplayListBuilder* aBuilder,
nsRegion r;
r.And(*aVisibleRegion, GetBounds(aBuilder));
return ComputeVisibilityForSublist(aBuilder, aVisibleRegion,
r.GetBounds(), aDisplayPortFrame);
r.GetBounds(), r.GetBounds(),
aDisplayPortFrame);
}
static nsRegion
@ -1085,6 +1086,7 @@ bool
nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aListVisibleBounds,
const nsRect& aAllowVisibleRegionExpansion,
nsIFrame* aDisplayPortFrame) {
#ifdef DEBUG
nsRegion r;
@ -1106,7 +1108,8 @@ nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder,
itemVisible.And(*aVisibleRegion, bounds);
item->mVisibleRect = itemVisible.GetBounds();
if (item->ComputeVisibility(aBuilder, aVisibleRegion)) {
if (item->ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion.Intersect(bounds))) {
anyVisible = true;
nsRegion opaque = TreatAsOpaque(item, aBuilder);
@ -1608,7 +1611,8 @@ nsDisplayItem::ZIndex() const
bool
nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion)
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
return !mVisibleRect.IsEmpty() &&
!IsInvisibleInRect(aVisibleRegion->GetBounds());
@ -1626,7 +1630,7 @@ nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
// When we recompute visibility within layers we don't need to
// expand the visible region for content behind plugins (the plugin
// is not in the layer).
if (!ComputeVisibility(aBuilder, aVisibleRegion)) {
if (!ComputeVisibility(aBuilder, aVisibleRegion, nsRect())) {
mVisibleRect = nsRect();
return false;
}
@ -2039,9 +2043,11 @@ nsDisplayBackgroundImage::HitTest(nsDisplayListBuilder* aBuilder,
bool
nsDisplayBackgroundImage::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion)
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion)) {
return false;
}
@ -2786,8 +2792,10 @@ nsDisplayBoxShadowOuter::IsInvisibleInRect(const nsRect& aRect)
bool
nsDisplayBoxShadowOuter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion)) {
return false;
}
@ -2846,8 +2854,10 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder,
bool
nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion)) {
return false;
}
@ -2950,7 +2960,8 @@ nsDisplayWrapList::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
bool
nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
// Convert the passed in visible region to our appunits.
nsRegion visibleRegion;
// mVisibleRect has been clipped to GetClippedBounds
@ -2959,7 +2970,8 @@ nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
bool retval =
mList.ComputeVisibilityForSublist(aBuilder, &visibleRegion,
mVisibleRect);
mVisibleRect,
aAllowVisibleRegionExpansion);
nsRegion removed;
// removed = originalVisibleRegion - visibleRegion
@ -3232,7 +3244,8 @@ nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
bool
nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
// Our children are translucent so we should not allow them to subtract
// area from aVisibleRegion. We do need to find out what is visible under
// our children in the temporary compositing buffer, because if our children
@ -3241,8 +3254,10 @@ nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect bounds = GetClippedBounds(aBuilder);
nsRegion visibleUnderChildren;
visibleUnderChildren.And(*aVisibleRegion, bounds);
nsRect allowExpansion = bounds.Intersect(aAllowVisibleRegionExpansion);
return
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren);
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren,
allowExpansion);
}
bool nsDisplayOpacity::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
@ -3320,7 +3335,8 @@ nsDisplayMixBlendMode::BuildLayer(nsDisplayListBuilder* aBuilder,
}
bool nsDisplayMixBlendMode::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
// Our children are need their backdrop so we should not allow them to subtract
// area from aVisibleRegion. We do need to find out what is visible under
// our children in the temporary compositing buffer, because if our children
@ -3329,7 +3345,10 @@ bool nsDisplayMixBlendMode::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect bounds = GetClippedBounds(aBuilder);
nsRegion visibleUnderChildren;
visibleUnderChildren.And(*aVisibleRegion, bounds);
return nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren);
nsRect allowExpansion = bounds.Intersect(aAllowVisibleRegionExpansion);
return
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren,
allowExpansion);
}
bool nsDisplayMixBlendMode::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
@ -3502,14 +3521,16 @@ nsDisplaySubDocument::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
bool
nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion)
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
nsRect displayport;
bool usingDisplayPort =
nsLayoutUtils::ViewportHasDisplayPort(mFrame->PresContext(), &displayport);
if (!(mFlags & GENERATE_SCROLLABLE_LAYER) || !usingDisplayPort) {
return nsDisplayWrapList::ComputeVisibility(aBuilder, aVisibleRegion);
return nsDisplayWrapList::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion);
}
nsRegion childVisibleRegion;
@ -3520,8 +3541,9 @@ nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect boundedRect =
childVisibleRegion.GetBounds().Intersect(mList.GetBounds(aBuilder));
nsRect allowExpansion = boundedRect.Intersect(aAllowVisibleRegionExpansion);
bool visible = mList.ComputeVisibilityForSublist(
aBuilder, &childVisibleRegion, boundedRect,
aBuilder, &childVisibleRegion, boundedRect, allowExpansion,
usingDisplayPort ? mFrame : nullptr);
// We don't allow this computation to influence aVisibleRegion, on the
// assumption that the layer can be asynchronously scrolled so we'll
@ -3808,7 +3830,8 @@ nsDisplayScrollLayer::ShouldBuildLayerEvenIfInvisible(nsDisplayListBuilder* aBui
bool
nsDisplayScrollLayer::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion)
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
nsRect displayport;
bool usingDisplayPort =
@ -3817,9 +3840,10 @@ nsDisplayScrollLayer::ComputeVisibility(nsDisplayListBuilder* aBuilder,
usingDisplayPort ? &displayport : nullptr);
nsRect boundedRect = scrolledContentRect.Intersect(mList.GetBounds(aBuilder));
nsRect allowExpansion = boundedRect.Intersect(aAllowVisibleRegionExpansion);
nsRegion childVisibleRegion = scrolledContentRect;
bool visible = mList.ComputeVisibilityForSublist(
aBuilder, &childVisibleRegion, boundedRect,
aBuilder, &childVisibleRegion, boundedRect, allowExpansion,
usingDisplayPort ? mScrollFrame : nullptr);
// We don't allow this computation to influence aVisibleRegion, on the
// assumption that the layer can be asynchronously scrolled so we'll
@ -4077,7 +4101,8 @@ void nsDisplayZoom::Paint(nsDisplayListBuilder* aBuilder,
}
bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion)
nsRegion *aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
// Convert the passed in visible region to our appunits.
nsRegion visibleRegion;
@ -4088,6 +4113,8 @@ bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRect transformedVisibleRect =
mVisibleRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
nsRect allowExpansion =
aAllowVisibleRegionExpansion.ConvertAppUnitsRoundIn(mParentAPD, mAPD);
bool retval;
// If we are to generate a scrollable layer we call
// nsDisplaySubDocument::ComputeVisibility to make the necessary adjustments
@ -4097,10 +4124,12 @@ bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
if (!(mFlags & GENERATE_SCROLLABLE_LAYER) || !usingDisplayPort) {
retval =
mList.ComputeVisibilityForSublist(aBuilder, &visibleRegion,
transformedVisibleRect);
transformedVisibleRect,
allowExpansion);
} else {
retval =
nsDisplaySubDocument::ComputeVisibility(aBuilder, &visibleRegion);
nsDisplaySubDocument::ComputeVisibility(aBuilder, &visibleRegion,
allowExpansion);
}
nsRegion removed;
@ -4735,7 +4764,8 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
}
bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion)
nsRegion *aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
/* As we do this, we need to be sure to
* untransform the visible rect, since we want everything that's painting to
@ -5201,7 +5231,8 @@ nsDisplaySVGEffects::BuildLayer(nsDisplayListBuilder* aBuilder,
}
bool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
nsPoint offset = ToReferenceFrame();
nsRect dirtyRect =
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(mFrame,
@ -5212,7 +5243,7 @@ bool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
// not allow them to subtract area from aVisibleRegion.
nsRegion childrenVisible(dirtyRect);
nsRect r = dirtyRect.Intersect(mList.GetBounds(aBuilder));
mList.ComputeVisibilityForSublist(aBuilder, &childrenVisible, r);
mList.ComputeVisibilityForSublist(aBuilder, &childrenVisible, r, nsRect());
return true;
}

View File

@ -1184,7 +1184,8 @@ public:
* is visible.
*/
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion);
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion);
/**
* Try to merge with the other item (which is below us in the display
@ -1265,7 +1266,7 @@ public:
* -- Subtracts bounds from aVisibleRegion if the item is opaque
*/
bool RecomputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion);
nsRegion* aVisibleRegion);
/**
* Returns the result of aBuilder->ToReferenceFrame(GetUnderlyingFrame())
@ -1549,6 +1550,7 @@ public:
bool ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aListVisibleBounds,
const nsRect& aAllowVisibleRegionExpansion,
nsIFrame* aDisplayPortFrame = nullptr);
/**
@ -2120,7 +2122,8 @@ public:
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aSnap) MOZ_OVERRIDE;
virtual bool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) MOZ_OVERRIDE;
@ -2324,7 +2327,8 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) MOZ_OVERRIDE;
virtual bool IsInvisibleInRect(const nsRect& aRect) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
@ -2367,7 +2371,8 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE
@ -2537,7 +2542,8 @@ public:
virtual bool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) MOZ_OVERRIDE;
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) MOZ_OVERRIDE {
return false;
}
@ -2668,7 +2674,8 @@ public:
LayerManager* aManager,
const ContainerLayerParameters& aParameters) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) MOZ_OVERRIDE;
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
@ -2716,7 +2723,8 @@ public:
LayerManager* aManager,
const ContainerLayerParameters& aParameters) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) MOZ_OVERRIDE;
virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE {
return false;
@ -2840,7 +2848,8 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool ShouldBuildLayerEvenIfInvisible(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE;
@ -2957,7 +2966,8 @@ public:
}
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
@ -3056,7 +3066,8 @@ public:
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters) MOZ_OVERRIDE
@ -3097,7 +3108,8 @@ public:
return mEffectsBounds + ToReferenceFrame();
}
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool TryMerge(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem) MOZ_OVERRIDE;
virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE {
@ -3201,7 +3213,8 @@ public:
const ContainerLayerParameters& aContainerParameters) MOZ_OVERRIDE;
virtual bool ShouldBuildLayerEvenIfInvisible(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion) MOZ_OVERRIDE;
nsRegion *aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
virtual bool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem) MOZ_OVERRIDE;
virtual uint32_t GetPerFrameKey() MOZ_OVERRIDE { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }

View File

@ -155,7 +155,8 @@ public:
}
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE
{
return NS_GET_A(mColor) > 0;
}

View File

@ -959,7 +959,8 @@ nsDisplayPlugin::Paint(nsDisplayListBuilder* aBuilder,
bool
nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion)
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
if (aBuilder->IsForPluginGeometry()) {
nsObjectFrame* f = static_cast<nsObjectFrame*>(mFrame);
@ -998,7 +999,8 @@ nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
}
}
return nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion);
return nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion);
}
nsRegion

View File

@ -319,7 +319,8 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) MOZ_OVERRIDE;
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)