Backout changeset e8f5182d94c5 (Bug 805343) for regressing android talos tests

This commit is contained in:
Matt Woodrow 2012-12-14 11:50:57 +13:00
Родитель fd3f035caf
Коммит 716946b5d9
3 изменённых файлов: 50 добавлений и 87 удалений

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

@ -49,7 +49,6 @@ FrameLayerBuilder::DisplayItemData::DisplayItemData(LayerManagerData* aParent, u
, mLayerState(aLayerState)
, mUsed(true)
, mIsInvalid(false)
, mIsVisible(true)
{
}
@ -67,7 +66,6 @@ FrameLayerBuilder::DisplayItemData::DisplayItemData(DisplayItemData &toCopy)
mContainerLayerGeneration = toCopy.mContainerLayerGeneration;
mLayerState = toCopy.mLayerState;
mUsed = toCopy.mUsed;
mIsVisible = toCopy.mIsVisible;
}
void
@ -1100,7 +1098,7 @@ FrameLayerBuilder::HasVisibleRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplay
}
void
FrameLayerBuilder::IterateVisibleRetainedDataFor(nsIFrame* aFrame, DisplayItemDataCallback aCallback)
FrameLayerBuilder::IterateRetainedDataFor(nsIFrame* aFrame, DisplayItemDataCallback aCallback)
{
nsTArray<DisplayItemData*> *array =
reinterpret_cast<nsTArray<DisplayItemData*>*>(aFrame->Properties().Get(LayerManagerDataProperty()));
@ -1110,8 +1108,7 @@ FrameLayerBuilder::IterateVisibleRetainedDataFor(nsIFrame* aFrame, DisplayItemDa
for (uint32_t i = 0; i < array->Length(); i++) {
DisplayItemData* data = array->ElementAt(i);
if (data->mDisplayItemKey != nsDisplayItem::TYPE_ZERO &&
data->IsVisibleInLayer()) {
if (data->mDisplayItemKey != nsDisplayItem::TYPE_ZERO) {
aCallback(aFrame, data);
}
}
@ -1827,7 +1824,7 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState,
nsRegion opaqueClipped;
nsRegionRectIterator iter(opaque);
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
opaqueClipped.Or(opaqueClipped, aClip.ApproximateIntersectInner(*r));
opaqueClipped.Or(opaqueClipped, aClip.ApproximateIntersect(*r));
}
nsIntRegion opaquePixels = aState->ScaleRegionToInsidePixels(opaqueClipped, snap);
@ -2429,8 +2426,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
}
}
DisplayItemData* displayItemData =
AddLayerDisplayItem(aLayer, aItem, aClip, aLayerState, aTopLeft, tempManager, aGeometry);
AddLayerDisplayItem(aLayer, aItem, aClip, aLayerState, aTopLeft, tempManager, aGeometry);
ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
if (entry) {
@ -2497,7 +2493,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
}
}
ClippedDisplayItem* cdi =
entry->mItems.AppendElement(ClippedDisplayItem(aItem, displayItemData, aClip,
entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip,
mContainerLayerGeneration));
cdi->mInactiveLayerManager = tempManager;
}
@ -2572,7 +2568,7 @@ FrameLayerBuilder::ClippedDisplayItem::~ClippedDisplayItem()
}
}
FrameLayerBuilder::DisplayItemData*
void
FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
nsDisplayItem* aItem,
const Clip& aClip,
@ -2582,7 +2578,7 @@ FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
nsAutoPtr<nsDisplayItemGeometry> aGeometry)
{
if (aLayer->Manager() != mRetainingManager)
return nullptr;
return;
DisplayItemData *data = StoreDataForFrame(aItem, aLayer, aLayerState);
ThebesLayer *t = aLayer->AsThebesLayer();
@ -2591,7 +2587,6 @@ FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
data->mClip = aClip;
}
data->mInactiveManager = aManager;
return data;
}
nsIntPoint
@ -3236,29 +3231,15 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
uint32_t i;
// Update visible rects in display items to reflect visibility
// just considering items in this ThebesLayer. This is different from the
// original visible rects, which describe which part of each item
// is visible in the window. These can be larger than the original
// visible rect, because we may be asked to draw into part of a
// ThebesLayer that isn't actually visible in the window (e.g.,
// because a ThebesLayer expanded its visible region to a rectangle
// internally, or because we're caching prerendered content).
// We also compute the intersection of those visible rects with
// aRegionToDraw. These are the rectangles of each display item
// that actually need to be drawn now.
// Treat as visible everything this layer already contains or will
// contain.
nsIntRegion layerRegion;
layerRegion.Or(aLayer->GetValidRegion(), aRegionToDraw);
nsRegion visible = layerRegion.ToAppUnits(appUnitsPerDevPixel);
// Update visible regions. We need perform visibility analysis again
// because we may be asked to draw into part of a ThebesLayer that
// isn't actually visible in the window (e.g., because a ThebesLayer
// expanded its visible region to a rectangle internally), in which
// case the mVisibleRect stored in the display item may be wrong.
nsRegion visible = aRegionToDraw.ToAppUnits(appUnitsPerDevPixel);
visible.MoveBy(NSIntPixelsToAppUnits(offset.x, appUnitsPerDevPixel),
NSIntPixelsToAppUnits(offset.y, appUnitsPerDevPixel));
visible.ScaleInverseRoundOut(userData->mXScale, userData->mYScale);
nsRegion toDraw = aRegionToDraw.ToAppUnits(appUnitsPerDevPixel);
toDraw.MoveBy(NSIntPixelsToAppUnits(offset.x, appUnitsPerDevPixel),
NSIntPixelsToAppUnits(offset.y, appUnitsPerDevPixel));
toDraw.ScaleInverseRoundOut(userData->mXScale, userData->mYScale);
for (i = items.Length(); i > 0; --i) {
ClippedDisplayItem* cdi = &items[i - 1];
@ -3274,29 +3255,30 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
(cdi->mClip.mRoundedClipRects.IsEmpty() &&
cdi->mClip.mClipRect.Contains(visible.GetBounds()))) {
cdi->mItem->RecomputeVisibility(builder, &visible);
} else {
// Do a little dance to account for the fact that we're clipping
// to cdi->mClipRect
nsRegion clipped;
clipped.And(visible, cdi->mClip.mClipRect);
nsRegion finalClipped = clipped;
cdi->mItem->RecomputeVisibility(builder, &finalClipped);
// If we have rounded clip rects, don't subtract from the visible
// region since we aren't displaying everything inside the rect.
if (cdi->mClip.mRoundedClipRects.IsEmpty()) {
nsRegion removed;
removed.Sub(clipped, finalClipped);
nsRegion newVisible;
newVisible.Sub(visible, removed);
// Don't let the visible region get too complex.
if (newVisible.GetNumRects() <= 15) {
visible = newVisible;
}
}
if (!cdi->mClip.IsRectClippedByRoundedCorner(cdi->mItem->GetVisibleRect())) {
cdi->mClip.RemoveRoundedCorners();
continue;
}
// Do a little dance to account for the fact that we're clipping
// to cdi->mClipRect
nsRegion clipped;
clipped.And(visible, cdi->mClip.mClipRect);
nsRegion finalClipped = clipped;
cdi->mItem->RecomputeVisibility(builder, &finalClipped);
// If we have rounded clip rects, don't subtract from the visible
// region since we aren't displaying everything inside the rect.
if (cdi->mClip.mRoundedClipRects.IsEmpty()) {
nsRegion removed;
removed.Sub(clipped, finalClipped);
nsRegion newVisible;
newVisible.Sub(visible, removed);
// Don't let the visible region get too complex.
if (newVisible.GetNumRects() <= 15) {
visible = newVisible;
}
}
if (!cdi->mClip.IsRectClippedByRoundedCorner(cdi->mItem->GetVisibleRect())) {
cdi->mClip.RemoveRoundedCorners();
}
}
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
@ -3308,13 +3290,8 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
for (i = 0; i < items.Length(); ++i) {
ClippedDisplayItem* cdi = &items[i];
if (cdi->mData) {
cdi->mData->SetIsVisibleInLayer(!cdi->mItem->GetVisibleRect().IsEmpty());
}
if (!toDraw.Intersects(cdi->mItem->GetVisibleRect())) {
if (cdi->mItem->GetVisibleRect().IsEmpty())
continue;
}
// If the new desired clip state is different from the current state,
// update the clip.
@ -3492,7 +3469,7 @@ FrameLayerBuilder::Clip::AddRoundedRectPathTo(gfxContext* aContext,
}
nsRect
FrameLayerBuilder::Clip::ApproximateIntersectInner(const nsRect& aRect) const
FrameLayerBuilder::Clip::ApproximateIntersect(const nsRect& aRect) const
{
nsRect r = aRect;
if (mHaveClipRect) {

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

@ -96,7 +96,6 @@ public:
typedef layers::ThebesLayer ThebesLayer;
typedef layers::ImageLayer ImageLayer;
typedef layers::LayerManager LayerManager;
class DisplayItemData;
FrameLayerBuilder() :
mRetainingManager(nullptr),
@ -264,13 +263,13 @@ public:
* then this is the temporary layer manager to draw with.
*/
struct Clip;
DisplayItemData* AddLayerDisplayItem(Layer* aLayer,
nsDisplayItem* aItem,
const Clip& aClip,
LayerState aLayerState,
const nsPoint& aTopLeft,
LayerManager* aManager,
nsAutoPtr<nsDisplayItemGeometry> aGeometry);
void AddLayerDisplayItem(Layer* aLayer,
nsDisplayItem* aItem,
const Clip& aClip,
LayerState aLayerState,
const nsPoint& aTopLeft,
LayerManager* aManager,
nsAutoPtr<nsDisplayItemGeometry> aGeometry);
/**
* Record aItem as a display item that is rendered by the ThebesLayer
@ -320,9 +319,10 @@ public:
*/
static bool HasVisibleRetainedDataFor(nsIFrame* aFrame, uint32_t aDisplayItemKey);
class DisplayItemData;
typedef void (*DisplayItemDataCallback)(nsIFrame *aFrame, DisplayItemData* aItem);
static void IterateVisibleRetainedDataFor(nsIFrame* aFrame, DisplayItemDataCallback aCallback);
static void IterateRetainedDataFor(nsIFrame* aFrame, DisplayItemDataCallback aCallback);
/**
* Save transform that was in aLayer when we last painted, and the position
@ -417,7 +417,7 @@ public:
// Return a rectangle contained in the intersection of aRect with this
// clip region. Tries to return the largest possible rectangle, but may
// not succeed.
nsRect ApproximateIntersectInner(const nsRect& aRect) const;
nsRect ApproximateIntersect(const nsRect& aRect) const;
// Returns false if aRect is definitely not clipped by a rounded corner in
// this clip. Returns true if aRect is clipped by a rounded corner in this
@ -477,9 +477,6 @@ public:
uint32_t GetDisplayItemKey() { return mDisplayItemKey; }
Layer* GetLayer() { return mLayer; }
void Invalidate() { mIsInvalid = true; }
bool IsVisibleInLayer() { return mIsVisible; }
void SetIsVisibleInLayer(bool aIsVisible) { mIsVisible = aIsVisible; }
protected:
DisplayItemData(LayerManagerData* aParent, uint32_t aKey, Layer* aLayer, LayerState aLayerState, uint32_t aGeneration);
@ -528,15 +525,7 @@ public:
* paint) has been updated in the current paint.
*/
bool mUsed;
/**
* True if the entire display item needs to be invalidated.
*/
bool mIsInvalid;
/**
* True if the display item is visible in its layer, otherwise
* it's completely covered by opaque content in its ThebesLayer.
*/
bool mIsVisible;
};
protected:
@ -603,17 +592,14 @@ protected:
* mItem always has an underlying frame.
*/
struct ClippedDisplayItem {
ClippedDisplayItem(nsDisplayItem* aItem, DisplayItemData* aData,
const Clip& aClip, uint32_t aGeneration)
: mItem(aItem), mData(aData), mClip(aClip),
mContainerLayerGeneration(aGeneration)
ClippedDisplayItem(nsDisplayItem* aItem, const Clip& aClip, uint32_t aGeneration)
: mItem(aItem), mClip(aClip), mContainerLayerGeneration(aGeneration)
{
}
~ClippedDisplayItem();
nsDisplayItem* mItem;
DisplayItemData* mData;
/**
* If the display item is being rendered as an inactive

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

@ -341,7 +341,7 @@ ImageLoader::DoRedraw(FrameSet* aFrameSet)
nsIFrame* frame = aFrameSet->ElementAt(i);
if (frame->GetStyleVisibility()->IsVisible()) {
FrameLayerBuilder::IterateVisibleRetainedDataFor(frame, InvalidateImagesCallback);
FrameLayerBuilder::IterateRetainedDataFor(frame, InvalidateImagesCallback);
}
}
}