From 53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 06:09:37 -0400 Subject: Bug 1377648 - Fix HTMLSummaryElement::IsSummary() on removing the element * Use inFlowFrame to check the target frame is summary and its parent is details * Check summary frame instead of summary element on removing the summary Tag #1375 --- layout/generic/DetailsFrame.cpp | 9 +++++++++ layout/generic/DetailsFrame.h | 6 ++++++ 2 files changed, 15 insertions(+) (limited to 'layout/generic') diff --git a/layout/generic/DetailsFrame.cpp b/layout/generic/DetailsFrame.cpp index 1d28bbe96..389a476cb 100644 --- a/layout/generic/DetailsFrame.cpp +++ b/layout/generic/DetailsFrame.cpp @@ -129,3 +129,12 @@ DetailsFrame::AppendAnonymousContentTo(nsTArray& aElements, aElements.AppendElement(mDefaultSummary); } } + +bool +DetailsFrame::HasMainSummaryFrame(nsIFrame* aSummaryFrame) +{ + nsIFrame* firstChild = + nsPlaceholderFrame::GetRealFrameFor(mFrames.FirstChild()); + + return aSummaryFrame == firstChild; +} diff --git a/layout/generic/DetailsFrame.h b/layout/generic/DetailsFrame.h index 1eb4ea87b..4ae177f16 100644 --- a/layout/generic/DetailsFrame.h +++ b/layout/generic/DetailsFrame.h @@ -54,6 +54,12 @@ public: void AppendAnonymousContentTo(nsTArray& aElements, uint32_t aFilter) override; + // Returns true if |aSummaryFrame| is the main summary (i.e. the first child + // of this details frame). + // This function is used when the summary element is removed from the parent + // details element since at that moment the summary element has been already + // removed from the details element children. + bool HasMainSummaryFrame(nsIFrame* aSummaryFrame); private: nsCOMPtr mDefaultSummary; -- cgit v1.2.3