Bug 779269 - Implement a TryMerge method for nsDisplayFixedPosition. r=roc

Allow nsDisplayFixedPosition items that share the same fixed-pos frame to be
merged. This avoids a bug where the Google PDF viewer document image gets
re-rendered offset on the initial frame of a scroll when layer acceleration is
enabled.
This commit is contained in:
Chris Lord 2012-08-10 09:36:33 +01:00
Родитель 4788839f6c
Коммит b2f8ecf01c
2 изменённых файлов: 13 добавлений и 0 удалений

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

@ -2528,6 +2528,17 @@ nsDisplayFixedPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
return layer.forget();
}
bool nsDisplayFixedPosition::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
if (aItem->GetType() != TYPE_FIXED_POSITION)
return false;
// Items with the same fixed position frame can be merged.
nsDisplayFixedPosition* other = static_cast<nsDisplayFixedPosition*>(aItem);
if (other->mFixedPosFrame != mFixedPosFrame)
return false;
MergeFromTrackingMergedFrames(other);
return true;
}
nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
nsIFrame* aForFrame,

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

@ -1948,6 +1948,8 @@ public:
{
return mozilla::LAYER_ACTIVE;
}
virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
NS_DISPLAY_DECL_NAME("FixedPosition", TYPE_FIXED_POSITION)
protected: