зеркало из https://github.com/mozilla/pjs.git
Bug 531148. Fix appends of a block to the trailing inline of an {ib} split which has an inline parent. r=roc
This commit is contained in:
Родитель
526afc3be1
Коммит
76f2c21d7a
|
@ -5852,8 +5852,9 @@ nsCSSFrameConstructor::AppendFrames(nsFrameConstructorState& aState,
|
|||
nsIPresShell::eTreeChange,
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
return aState.mFrameManager->InsertFrames(aParentFrame->GetParent(),
|
||||
nsnull, aParentFrame, ibSiblings);
|
||||
// Recurse so we create new ib siblings as needed for aParentFrame's parent
|
||||
return AppendFrames(aState, aParentFrame->GetParent(), ibSiblings,
|
||||
aParentFrame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -11030,6 +11031,26 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
|
|||
aParentItem.mIsAllInline = aParentItem.mChildItems.AreAllItemsInline();
|
||||
}
|
||||
|
||||
// return whether it's ok to append (in the AppendFrames sense) to
|
||||
// aParentFrame if our nextSibling is aNextSibling. aParentFrame must
|
||||
// be an {ib} special inline.
|
||||
static PRBool
|
||||
IsSafeToAppendToSpecialInline(nsIFrame* aParentFrame, nsIFrame* aNextSibling)
|
||||
{
|
||||
NS_PRECONDITION(IsInlineFrame(aParentFrame),
|
||||
"Must have an inline parent here");
|
||||
do {
|
||||
NS_ASSERTION(IsFrameSpecial(aParentFrame), "How is this not special?");
|
||||
if (aNextSibling || aParentFrame->GetNextContinuation() ||
|
||||
GetSpecialSibling(aParentFrame)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
aNextSibling = aParentFrame->GetNextSibling();
|
||||
aParentFrame = aParentFrame->GetParent();
|
||||
} while (IsInlineFrame(aParentFrame));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
||||
nsIFrame* aContainingBlock,
|
||||
|
@ -11240,10 +11261,12 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
|||
// Now we're adding kids including some blocks to an inline part of an
|
||||
// {ib} split. If we plan to call AppendFrames, and don't have a next
|
||||
// sibling for the new frames, and our parent is the last continuation of
|
||||
// the last part of the {ib} split, then AppendFrames will handle things
|
||||
// for us. Bail out in that case.
|
||||
if (aIsAppend && !nextSibling && !aFrame->GetNextContinuation() &&
|
||||
!GetSpecialSibling(aFrame)) {
|
||||
// the last part of the {ib} split, and the same is true of all our
|
||||
// ancestor inlines (they have no following continuations and they're the
|
||||
// last part of their {ib} splits and we'd be adding to the end for all
|
||||
// of them), then AppendFrames will handle things for us. Bail out in
|
||||
// that case.
|
||||
if (aIsAppend && IsSafeToAppendToSpecialInline(aFrame, nextSibling)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
.outermost { border: 2px solid; }
|
||||
.outer { border: 4px solid yellow; }
|
||||
.inner { border: 6px sold green; }
|
||||
</style>
|
||||
</head>
|
||||
<body onload="doTest()">
|
||||
<span class="outermost" style="border-right: none">
|
||||
<span class="outer" style="border-right: none">
|
||||
<span class="inner" style="border-right: none">
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span style="display: block"></span>
|
||||
<span class="outermost" style="border-right: none; border-left: none">
|
||||
<span class="outer" style="border-right: none; border-left: none">
|
||||
<span class="inner" style="border-right: nonel border-left: none">
|
||||
before span
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span style="display: block">span</span>
|
||||
<span class="outermost" style="border-left: none">
|
||||
<span class="outer" style="border-left: none">
|
||||
<span class="inner" style="border-left: none">
|
||||
after span
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#outermost { border: 2px solid; }
|
||||
#outer { border: 4px solid yellow; }
|
||||
#inner { border: 6px sold green; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<span id="outermost">
|
||||
<span id="outer">
|
||||
<span id="inner">
|
||||
<span style="display: block"></span>
|
||||
before span
|
||||
<span style="display: block">span</span>
|
||||
after span
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#outermost { border: 2px solid; }
|
||||
#outer { border: 4px solid yellow; }
|
||||
#inner { border: 6px sold green; }
|
||||
</style>
|
||||
<script>
|
||||
function doTest() {
|
||||
var i = document.getElementById("inner");
|
||||
var frag = document.createDocumentFragment();
|
||||
var newSpan = document.createElement("span");
|
||||
newSpan.appendChild(document.createTextNode("span"));
|
||||
newSpan.style.display = "block";
|
||||
frag.appendChild(newSpan);
|
||||
frag.appendChild(document.createTextNode("after span"));
|
||||
i.appendChild(frag);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="doTest()">
|
||||
<span id="outermost">
|
||||
<span id="outer">
|
||||
<span id="inner">
|
||||
<span style="display: block"></span>
|
||||
before span
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
|
@ -8,7 +8,6 @@
|
|||
<script>
|
||||
function doTest() {
|
||||
var i = document.getElementById("i");
|
||||
dump('a');
|
||||
i.insertBefore(document.createTextNode("Two"), i.firstChild);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -81,3 +81,5 @@
|
|||
== ignored-margins-2b.html ignored-margins-2-ref.html
|
||||
== trailing-inline-with-continuations-1.html trailing-inline-with-continuations-1-ref.html
|
||||
== append-to-empty-trailing-inline-1.html append-to-empty-trailing-inline-1-ref.html
|
||||
== append-to-nested-split-inline-1.html append-to-nested-split-inline-1-ref.html
|
||||
== append-to-nested-split-inline-1-ref.html append-to-nested-split-inline-1-noib-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче