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

MozReview-Commit-ID: DzuGDHZEc1A

--HG--
extra : rebase_source : 59bde9e85e843bd7ce2ee5167b10fcef5dd4d39b
This commit is contained in:
Emilio Cobos Álvarez 2017-10-20 13:42:15 +02:00
Родитель 70736cfb1b
Коммит 650a64145b
4 изменённых файлов: 40 добавлений и 18 удалений

Просмотреть файл

@ -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(),

Просмотреть файл

@ -0,0 +1,8 @@
<style>
* { display: contents; }
</style>
<details>
</details>
<marquee>
<ul>
<canvas>

Просмотреть файл

@ -0,0 +1,16 @@
<!doctype html>
<style>
* { display: contents; }
</style>
<marquee>
<div id="target">
</div>
</marquee>
<script>
document.body.offsetTop;
let div = document.createElement('div');
div.style.display = "block";
div.appendChild(document.createTextNode('where am I'));
target.appendChild(div);
document.body.style.color = "red";
</script>

Просмотреть файл

@ -253,3 +253,5 @@ load 1404324-3.html
load 1404057.html
load 1409502.html
load 1409931.html
load 1410226-1.html
load 1410226-2.html