summaryrefslogtreecommitdiffstats
path: root/layout/base
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
commit53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (patch)
tree7eda1d51e148d7dae5d02c143af323e78e4fe92f /layout/base
parent0c99ad16fbb5c3b90ee140235159f9a0ee72397b (diff)
downloadUXP-53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b.tar
UXP-53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b.tar.gz
UXP-53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b.tar.lz
UXP-53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b.tar.xz
UXP-53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b.zip
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
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 57410a55a..8b89b2a22 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -9395,16 +9395,27 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
return true;
}
- if (insertionFrame &&
- aFrame->GetParent()->GetType() == nsGkAtoms::detailsFrame) {
+ nsIFrame* inFlowFrame =
+ (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) ?
+ aFrame->GetPlaceholderFrame() : aFrame;
+ MOZ_ASSERT(inFlowFrame, "How did that happen?");
+ MOZ_ASSERT(inFlowFrame == inFlowFrame->FirstContinuation(),
+ "placeholder for primary frame has previous continuations?");
+ nsIFrame* parent = inFlowFrame->GetParent();
+
+ if (parent && parent->GetType() == nsGkAtoms::detailsFrame) {
HTMLSummaryElement* summary =
- HTMLSummaryElement::FromContent(insertionFrame->GetContent());
+ HTMLSummaryElement::FromContent(aFrame->GetContent());
+ DetailsFrame* detailsFrame = static_cast<DetailsFrame*>(parent);
- if (summary && summary->IsMainSummary()) {
+ // Unlike adding summary element cases, we need to check children of the
+ // parent details frame since at this moment the summary element has been
+ // already removed from the parent details element's child list.
+ if (summary && detailsFrame->HasMainSummaryFrame(aFrame)) {
// When removing a summary, we should reframe the parent details frame to
// ensure that another summary is used or the default summary is
// generated.
- RecreateFramesForContent(aFrame->GetParent()->GetContent(),
+ RecreateFramesForContent(parent->GetContent(),
false, REMOVE_FOR_RECONSTRUCTION,
aDestroyedFramesFor);
return true;
@@ -9412,13 +9423,6 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
}
// Now check for possibly needing to reconstruct due to a pseudo parent
- nsIFrame* inFlowFrame =
- (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) ?
- aFrame->GetPlaceholderFrame() : aFrame;
- MOZ_ASSERT(inFlowFrame, "How did that happen?");
- MOZ_ASSERT(inFlowFrame == inFlowFrame->FirstContinuation(),
- "placeholder for primary frame has previous continuations?");
- nsIFrame* parent = inFlowFrame->GetParent();
// For the case of ruby pseudo parent, effectively, only pseudo rb/rt frame
// need to be checked here, since all other types of parent will be catched
// by "Check ruby containers" section below.