mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
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
This commit is contained in:
@@ -9395,23 +9395,6 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (insertionFrame &&
|
||||
aFrame->GetParent()->GetType() == nsGkAtoms::detailsFrame) {
|
||||
HTMLSummaryElement* summary =
|
||||
HTMLSummaryElement::FromContent(insertionFrame->GetContent());
|
||||
|
||||
if (summary && summary->IsMainSummary()) {
|
||||
// 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(),
|
||||
false, REMOVE_FOR_RECONSTRUCTION,
|
||||
aDestroyedFramesFor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Now check for possibly needing to reconstruct due to a pseudo parent
|
||||
nsIFrame* inFlowFrame =
|
||||
(aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) ?
|
||||
aFrame->GetPlaceholderFrame() : aFrame;
|
||||
@@ -9419,6 +9402,27 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
|
||||
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(aFrame->GetContent());
|
||||
DetailsFrame* detailsFrame = static_cast<DetailsFrame*>(parent);
|
||||
|
||||
// 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(parent->GetContent(),
|
||||
false, REMOVE_FOR_RECONSTRUCTION,
|
||||
aDestroyedFramesFor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Now check for possibly needing to reconstruct due to a pseudo parent
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user