diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 33d6181e7c7c..5a5ebe4c893d 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -438,6 +438,12 @@ nsGridContainerFrame::PlaceGridItems(const nsStylePosition* aStyle) for (nsFrameList::Enumerator e(PrincipalChildList()); !e.AtEnd(); e.Next()) { nsIFrame* child = e.get(); const GridArea& area = PlaceDefinite(child, aStyle); + GridArea* prop = GetGridAreaForChild(child); + if (prop) { + *prop = area; + } else { + child->Properties().Set(GridAreaProperty(), new GridArea(area)); + } if (area.IsDefinite()) { InflateGridFor(area); } diff --git a/layout/generic/nsGridContainerFrame.h b/layout/generic/nsGridContainerFrame.h index 28ac9a2b1a0d..caaea7f974a0 100644 --- a/layout/generic/nsGridContainerFrame.h +++ b/layout/generic/nsGridContainerFrame.h @@ -203,6 +203,15 @@ protected: return areas && areas->Contains(aName); } + NS_DECLARE_FRAME_PROPERTY(GridAreaProperty, DeleteValue) + + /** + * A convenience method to get the stored GridArea* for a frame. + */ + static GridArea* GetGridAreaForChild(nsIFrame* aChild) { + return static_cast(aChild->Properties().Get(GridAreaProperty())); + } + #ifdef DEBUG void SanityCheckAnonymousGridItems() const; #endif // DEBUG