Bug 990974 - Give PaintedLayerDataTree a generic way of restricting a PaintedLayer to exactly one display item. r=roc

This commit is contained in:
Markus Stange 2015-07-01 22:08:20 -04:00
parent f6818bbaa8
commit ec0360b2c9

View File

@ -293,6 +293,7 @@ public:
mLayer(nullptr),
mIsSolidColorInVisibleRegion(false),
mFontSmoothingBackgroundColor(NS_RGBA(0,0,0,0)),
mExclusiveToOneItem(false),
mSingleItemFixedToViewport(false),
mNeedComponentAlpha(false),
mForceTransparentSurface(false),
@ -449,6 +450,10 @@ public:
* transparent parts of the layer.
*/
nscolor mFontSmoothingBackgroundColor;
/**
* True if only one display item can be assigned to this layer.
*/
bool mExclusiveToOneItem;
/**
* True if the layer contains exactly one item that returned true for
* ShouldFixToViewport.
@ -798,7 +803,7 @@ public:
template<typename NewPaintedLayerCallbackType>
PaintedLayerData* FindPaintedLayerFor(const nsIFrame* aAnimatedGeometryRoot,
const nsIntRect& aVisibleRect,
bool aShouldFixToViewport,
bool aForceOwnLayer,
NewPaintedLayerCallbackType aNewPaintedLayerCallback);
/**
@ -2568,7 +2573,7 @@ PaintedLayerDataNode::FindPaintedLayerFor(const nsIntRect& aVisibleRect,
NewPaintedLayerCallbackType aNewPaintedLayerCallback)
{
if (!mPaintedLayerDataStack.IsEmpty()) {
if (mPaintedLayerDataStack[0].mSingleItemFixedToViewport) {
if (mPaintedLayerDataStack[0].mExclusiveToOneItem) {
MOZ_ASSERT(mPaintedLayerDataStack.Length() == 1);
SetAllDrawingAbove();
MOZ_ASSERT(mPaintedLayerDataStack.IsEmpty());
@ -2578,7 +2583,7 @@ PaintedLayerDataNode::FindPaintedLayerFor(const nsIntRect& aVisibleRect,
if (data.VisibleAboveRegionIntersects(aVisibleRect)) {
break;
}
MOZ_ASSERT(!data.mSingleItemFixedToViewport);
MOZ_ASSERT(!data.mExclusiveToOneItem);
lowestUsableLayer = &data;
if (data.VisibleRegionIntersects(aVisibleRect)) {
break;
@ -2739,16 +2744,19 @@ template<typename NewPaintedLayerCallbackType>
PaintedLayerData*
PaintedLayerDataTree::FindPaintedLayerFor(const nsIFrame* aAnimatedGeometryRoot,
const nsIntRect& aVisibleRect,
bool aShouldFixToViewport,
bool aForceOwnLayer,
NewPaintedLayerCallbackType aNewPaintedLayerCallback)
{
const nsIntRect* bounds = aShouldFixToViewport ? nullptr : &aVisibleRect;
const nsIntRect* bounds = aForceOwnLayer ? nullptr : &aVisibleRect;
FinishPotentiallyIntersectingNodes(aAnimatedGeometryRoot, bounds);
PaintedLayerDataNode* node = EnsureNodeFor(aAnimatedGeometryRoot);
if (aShouldFixToViewport) {
if (aForceOwnLayer) {
node->SetAllDrawingAbove();
}
return node->FindPaintedLayerFor(aVisibleRect, aNewPaintedLayerCallback);
PaintedLayerData* data =
node->FindPaintedLayerFor(aVisibleRect, aNewPaintedLayerCallback);
data->mExclusiveToOneItem = aForceOwnLayer;
return data;
}
void