Bug 1410226: Properly compute the insertion point for a display: contents child in an XBL binding. r=mats

MozReview-Commit-ID: DzuGDHZEc1A
This commit is contained in:
Emilio Cobos Álvarez
2017-10-20 13:42:15 +02:00
parent 7ec762e47d
commit 1f5b74dd8f
4 changed files with 40 additions and 18 deletions

View File

@@ -7111,29 +7111,25 @@ nsCSSFrameConstructor::GetInsertionPrevSibling(InsertionPoint* aInsertion,
nsContainerFrame*
nsCSSFrameConstructor::GetContentInsertionFrameFor(nsIContent* aContent)
{
// Get the primary frame associated with the content
nsIFrame* frame = aContent->GetPrimaryFrame();
nsIFrame* frame;
while (!(frame = aContent->GetPrimaryFrame())) {
if (!GetDisplayContentsStyleFor(aContent)) {
return nullptr;
}
if (!frame) {
if (GetDisplayContentsStyleFor(aContent)) {
nsIContent* parent = aContent->GetParent();
if (parent && parent == aContent->GetContainingShadow()) {
parent = parent->GetBindingParent();
}
frame = parent ? GetContentInsertionFrameFor(parent) : nullptr;
}
if (!frame) {
return nullptr;
}
} else {
// If the content of the frame is not the desired content then this is not
// really a frame for the desired content.
// XXX This check is needed due to bug 135040. Remove it once that's fixed.
if (frame->GetContent() != aContent) {
aContent = aContent->GetFlattenedTreeParent();
if (!aContent) {
return nullptr;
}
}
// If the content of the frame is not the desired content then this is not
// really a frame for the desired content.
// XXX This check is needed due to bug 135040. Remove it once that's fixed.
if (frame->GetContent() != aContent) {
return nullptr;
}
nsContainerFrame* insertionFrame = frame->GetContentInsertionFrame();
NS_ASSERTION(!insertionFrame || insertionFrame == frame || !frame->IsLeaf(),