diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index efcfb8bdd4ef..30a974ca11ce 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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(aItem); + if (other->mFixedPosFrame != mFixedPosFrame) + return false; + MergeFromTrackingMergedFrames(other); + return true; +} + nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder, nsDisplayList* aList, nsIFrame* aForFrame, diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index df3471911737..750811e114c3 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -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: