Backed out changeset 75fffcce9c4d (bug 1022612)

This commit is contained in:
Carsten "Tomcat" Book 2014-07-15 10:30:36 +02:00
Родитель 73afa0f4ec
Коммит 6592473bee
2 изменённых файлов: 29 добавлений и 49 удалений

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

@ -263,7 +263,6 @@ public:
*/ */
void Accumulate(ContainerState* aState, void Accumulate(ContainerState* aState,
nsDisplayItem* aItem, nsDisplayItem* aItem,
const nsIntRegion& aClippedOpaqueRegion,
const nsIntRect& aVisibleRect, const nsIntRect& aVisibleRect,
const nsIntRect& aDrawRect, const nsIntRect& aDrawRect,
const DisplayItemClip& aClip); const DisplayItemClip& aClip);
@ -490,14 +489,12 @@ public:
FrameLayerBuilder* aLayerBuilder, FrameLayerBuilder* aLayerBuilder,
nsIFrame* aContainerFrame, nsIFrame* aContainerFrame,
nsDisplayItem* aContainerItem, nsDisplayItem* aContainerItem,
const nsRect& aContainerBounds,
ContainerLayer* aContainerLayer, ContainerLayer* aContainerLayer,
const ContainerLayerParameters& aParameters) : const ContainerLayerParameters& aParameters) :
mBuilder(aBuilder), mManager(aManager), mBuilder(aBuilder), mManager(aManager),
mLayerBuilder(aLayerBuilder), mLayerBuilder(aLayerBuilder),
mContainerFrame(aContainerFrame), mContainerFrame(aContainerFrame),
mContainerLayer(aContainerLayer), mContainerLayer(aContainerLayer),
mContainerBounds(aContainerBounds),
mParameters(aParameters), mParameters(aParameters),
mNextFreeRecycledThebesLayer(0) mNextFreeRecycledThebesLayer(0)
{ {
@ -536,6 +533,8 @@ public:
*/ */
void Finish(uint32_t *aTextContentFlags, LayerManagerData* aData); void Finish(uint32_t *aTextContentFlags, LayerManagerData* aData);
nsRect GetChildrenBounds() { return mBounds; }
nscoord GetAppUnitsPerDevPixel() { return mAppUnitsPerDevPixel; } nscoord GetAppUnitsPerDevPixel() { return mAppUnitsPerDevPixel; }
nsIntRect ScaleToNearestPixels(const nsRect& aRect) nsIntRect ScaleToNearestPixels(const nsRect& aRect)
@ -714,14 +713,13 @@ protected:
nsIFrame* mContainerReferenceFrame; nsIFrame* mContainerReferenceFrame;
const nsIFrame* mContainerAnimatedGeometryRoot; const nsIFrame* mContainerAnimatedGeometryRoot;
ContainerLayer* mContainerLayer; ContainerLayer* mContainerLayer;
nsRect mContainerBounds;
DebugOnly<nsRect> mAccumulatedChildBounds;
ContainerLayerParameters mParameters; ContainerLayerParameters mParameters;
/** /**
* The region of ThebesLayers that should be invalidated every time * The region of ThebesLayers that should be invalidated every time
* we recycle one. * we recycle one.
*/ */
nsIntRegion mInvalidThebesContent; nsIntRegion mInvalidThebesContent;
nsRect mBounds;
nsAutoTArray<nsAutoPtr<ThebesLayerData>,1> mThebesLayerDataStack; nsAutoTArray<nsAutoPtr<ThebesLayerData>,1> mThebesLayerDataStack;
/** /**
* We collect the list of children in here. During ProcessDisplayItems, * We collect the list of children in here. During ProcessDisplayItems,
@ -2110,7 +2108,6 @@ WindowHasTransparency(nsDisplayListBuilder* aBuilder)
void void
ThebesLayerData::Accumulate(ContainerState* aState, ThebesLayerData::Accumulate(ContainerState* aState,
nsDisplayItem* aItem, nsDisplayItem* aItem,
const nsIntRegion& aClippedOpaqueRegion,
const nsIntRect& aVisibleRect, const nsIntRect& aVisibleRect,
const nsIntRect& aDrawRect, const nsIntRect& aDrawRect,
const DisplayItemClip& aClip) const DisplayItemClip& aClip)
@ -2191,9 +2188,19 @@ ThebesLayerData::Accumulate(ContainerState* aState,
mDrawRegion.SimplifyOutward(4); mDrawRegion.SimplifyOutward(4);
} }
if (!aClippedOpaqueRegion.IsEmpty()) { bool snap;
nsIntRegionRectIterator iter(aClippedOpaqueRegion); nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &snap);
for (const nsIntRect* r = iter.Next(); r; r = iter.Next()) { if (!opaque.IsEmpty()) {
nsRegion opaqueClipped;
nsRegionRectIterator iter(opaque);
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
opaqueClipped.Or(opaqueClipped, aClip.ApproximateIntersectInward(*r));
}
nsIntRegion opaquePixels = aState->ScaleRegionToInsidePixels(opaqueClipped, snap);
nsIntRegionRectIterator iter2(opaquePixels);
for (const nsIntRect* r = iter2.Next(); r; r = iter2.Next()) {
// We don't use SimplifyInward here since it's not defined exactly // We don't use SimplifyInward here since it's not defined exactly
// what it will discard. For our purposes the most important case // what it will discard. For our purposes the most important case
// is a large opaque background at the bottom of z-order (e.g., // is a large opaque background at the bottom of z-order (e.g.,
@ -2518,11 +2525,8 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList,
itemDrawRect.IntersectRect(itemDrawRect, clipRect); itemDrawRect.IntersectRect(itemDrawRect, clipRect);
clipRect.MoveBy(mParameters.mOffset); clipRect.MoveBy(mParameters.mOffset);
} }
#ifdef DEBUG mBounds.UnionRect(mBounds, itemContent);
((nsRect&)mAccumulatedChildBounds).UnionRect(mAccumulatedChildBounds, itemContent);
#endif
itemVisibleRect.IntersectRect(itemVisibleRect, itemDrawRect); itemVisibleRect.IntersectRect(itemVisibleRect, itemDrawRect);
ThebesLayerData* accumulateIntoThebesLayerData = nullptr;
LayerState layerState = item->GetLayerState(mBuilder, mManager, mParameters); LayerState layerState = item->GetLayerState(mBuilder, mManager, mParameters);
if (layerState == LAYER_INACTIVE && if (layerState == LAYER_INACTIVE &&
@ -2698,50 +2702,31 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList,
topLeft, nullptr, topLeft, nullptr,
dummy); dummy);
} else { } else {
ThebesLayerData* thebesLayerData = ThebesLayerData* data =
FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft, FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
shouldFixToViewport); shouldFixToViewport);
if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) { if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
nsDisplayLayerEventRegions* eventRegions = nsDisplayLayerEventRegions* eventRegions =
static_cast<nsDisplayLayerEventRegions*>(item); static_cast<nsDisplayLayerEventRegions*>(item);
thebesLayerData->AccumulateEventRegions(eventRegions->HitRegion(), data->AccumulateEventRegions(eventRegions->HitRegion(),
eventRegions->MaybeHitRegion(), eventRegions->MaybeHitRegion(),
eventRegions->DispatchToContentHitRegion()); eventRegions->DispatchToContentHitRegion());
} else { } else {
// check to see if the new item has rounded rect clips in common with // check to see if the new item has rounded rect clips in common with
// other items in the layer // other items in the layer
thebesLayerData->UpdateCommonClipCount(itemClip); data->UpdateCommonClipCount(itemClip);
data->Accumulate(this, item, itemVisibleRect, itemDrawRect, itemClip);
nsAutoPtr<nsDisplayItemGeometry> geometry(item->AllocateGeometry(mBuilder)); nsAutoPtr<nsDisplayItemGeometry> geometry(item->AllocateGeometry(mBuilder));
InvalidateForLayerChange(item, thebesLayerData->mLayer, itemClip, topLeft, geometry); InvalidateForLayerChange(item, data->mLayer, itemClip, topLeft, geometry);
mLayerBuilder->AddThebesDisplayItem(thebesLayerData, item, itemClip, mLayerBuilder->AddThebesDisplayItem(data, item, itemClip,
mContainerFrame, mContainerFrame,
layerState, topLeft, layerState, topLeft,
geometry); geometry);
accumulateIntoThebesLayerData = thebesLayerData;
} }
} }
bool snapOpaque;
nsRegion opaque = item->GetOpaqueRegion(mBuilder, &snapOpaque);
nsRegion opaqueClipped;
if (!opaque.IsEmpty()) {
nsRegionRectIterator iter(opaque);
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
opaqueClipped.Or(opaqueClipped, itemClip.ApproximateIntersectInward(*r));
}
if (opaqueClipped.Contains(mContainerBounds)) {
aList->SetIsOpaque();
}
}
if (accumulateIntoThebesLayerData) {
nsIntRegion opaquePixels =
ScaleRegionToInsidePixels(opaqueClipped, snapOpaque);
accumulateIntoThebesLayerData->Accumulate(this, item,
opaquePixels, itemVisibleRect, itemDrawRect, itemClip);
}
} }
aList->AppendToTop(&savedItems); aList->AppendToTop(&savedItems);
@ -3149,8 +3134,6 @@ ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData)
PopThebesLayerData(); PopThebesLayerData();
} }
NS_ASSERTION(mContainerBounds.IsEqualInterior(mAccumulatedChildBounds),
"Bounds computation mismatch");
uint32_t textContentFlags = 0; uint32_t textContentFlags = 0;
// Make sure that current/existing layers are added to the parent and are // Make sure that current/existing layers are added to the parent and are
@ -3482,7 +3465,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
LayerManagerData* data = static_cast<LayerManagerData*> LayerManagerData* data = static_cast<LayerManagerData*>
(aManager->GetUserData(&gLayerManagerUserData)); (aManager->GetUserData(&gLayerManagerUserData));
nsRect bounds = aChildren->GetBounds(aBuilder); nsRect bounds;
nsIntRect pixBounds; nsIntRect pixBounds;
int32_t appUnitsPerDevPixel; int32_t appUnitsPerDevPixel;
uint32_t stateFlags = 0; uint32_t stateFlags = 0;
@ -3493,7 +3476,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
uint32_t flags; uint32_t flags;
while (true) { while (true) {
ContainerState state(aBuilder, aManager, aManager->GetLayerBuilder(), ContainerState state(aBuilder, aManager, aManager->GetLayerBuilder(),
aContainerFrame, aContainerItem, bounds, aContainerFrame, aContainerItem,
containerLayer, scaleParameters); containerLayer, scaleParameters);
state.ProcessDisplayItems(aChildren, stateFlags); state.ProcessDisplayItems(aChildren, stateFlags);
@ -3502,7 +3485,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
// This is suboptimal ... a child could have text that's over transparent // This is suboptimal ... a child could have text that's over transparent
// pixels in its own layer, but over opaque parts of previous siblings. // pixels in its own layer, but over opaque parts of previous siblings.
state.Finish(&flags, data); state.Finish(&flags, data);
bounds = state.GetChildrenBounds();
pixBounds = state.ScaleToOutsidePixels(bounds, false); pixBounds = state.ScaleToOutsidePixels(bounds, false);
appUnitsPerDevPixel = state.GetAppUnitsPerDevPixel(); appUnitsPerDevPixel = state.GetAppUnitsPerDevPixel();
@ -3525,6 +3508,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
break; break;
} }
NS_ASSERTION(bounds.IsEqualInterior(aChildren->GetBounds(aBuilder)), "Wrong bounds");
pixBounds.MoveBy(nsIntPoint(scaleParameters.mOffset.x, scaleParameters.mOffset.y)); pixBounds.MoveBy(nsIntPoint(scaleParameters.mOffset.x, scaleParameters.mOffset.y));
if (aParameters.mAncestorClipRect && !(aFlags & CONTAINER_NOT_CLIPPED_BY_ANCESTORS)) { if (aParameters.mAncestorClipRect && !(aFlags & CONTAINER_NOT_CLIPPED_BY_ANCESTORS)) {
SetVisibleRegionForLayer(containerLayer, nsIntRegion(pixBounds), SetVisibleRegionForLayer(containerLayer, nsIntRegion(pixBounds),

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

@ -1704,10 +1704,6 @@ public:
bool DidComputeVisibility() const { return mDidComputeVisibility; } bool DidComputeVisibility() const { return mDidComputeVisibility; }
#endif #endif
void SetIsOpaque()
{
mIsOpaque = true;
}
nsRect GetVisibleRect() const { return mVisibleRect; } nsRect GetVisibleRect() const { return mVisibleRect; }
private: private: