summaryrefslogtreecommitdiff
path: root/layout/generic
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:09:37 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:09:37 -0400
commitd119425f0c898b1fbd3f82d3328c10a95dbef65b (patch)
tree7eda1d51e148d7dae5d02c143af323e78e4fe92f /layout/generic
parent4fd85d4d3c168f389170b089ec29b862cce5f84b (diff)
downloaduxp-d119425f0c898b1fbd3f82d3328c10a95dbef65b.tar.gz
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 mcp-graveyard/UXP#1375
Diffstat (limited to 'layout/generic')
-rw-r--r--layout/generic/DetailsFrame.cpp9
-rw-r--r--layout/generic/DetailsFrame.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/layout/generic/DetailsFrame.cpp b/layout/generic/DetailsFrame.cpp
index 1d28bbe960..389a476cba 100644
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -129,3 +129,12 @@ DetailsFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& 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 1eb4ea87be..4ae177f16f 100644
--- a/layout/generic/DetailsFrame.h
+++ b/layout/generic/DetailsFrame.h
@@ -54,6 +54,12 @@ public:
void AppendAnonymousContentTo(nsTArray<nsIContent*>& 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<nsIContent> mDefaultSummary;