Bug 484400. When removing a positioned element use the placeholder frame to get the relevant containing block for first-letter processing. r=bzbarsky

--HG--
extra : rebase_source : 9a327e8f44541ac822bc7be52caa1ceab825ccd1
This commit is contained in:
Timothy Nikkel 2009-12-22 17:47:25 -06:00
parent 5f6a955352
commit ad77d4e1d7
4 changed files with 39 additions and 9 deletions

View File

@ -6985,7 +6985,13 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
// Examine the containing-block for the removed content and see if
// :first-letter style applies.
nsIFrame* containingBlock = GetFloatContainingBlock(parentFrame);
nsIFrame* inflowChild = childFrame;
if (childFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
inflowChild = frameManager->GetPlaceholderFrameFor(childFrame);
NS_ASSERTION(inflowChild, "No placeholder for out-of-flow?");
}
nsIFrame* containingBlock =
GetFloatContainingBlock(inflowChild->GetParent());
PRBool haveFLS = containingBlock && HasFirstLetterStyle(containingBlock);
if (haveFLS) {
// Trap out to special routine that handles adjusting a blocks
@ -7057,11 +7063,6 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
}
if (haveFLS && mRootElementFrame) {
NS_ASSERTION(containingBlock == GetFloatContainingBlock(parentFrame),
"What happened here?");
nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(parentFrame),
containingBlock);
RecoverLetterFrames(containingBlock);
}
@ -7414,9 +7415,6 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
frame->CharacterDataChanged(aInfo);
if (haveFirstLetterStyle) {
nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(frame),
block, nsnull);
RecoverLetterFrames(block);
}
}

View File

@ -0,0 +1,11 @@
<html>
<head>
<style>
div::first-letter { color: red; font-size: 200%; background-color: blue; }
</style>
</head>
<body>
<div>
T
</div>
</body>

View File

@ -0,0 +1,20 @@
<html class="reftest-wait">
<head>
<style>
div::first-letter { color: red; font-size: 200%; background-color: blue; }
</style>
<script>
function boom() {
document.documentElement.offsetWidth;
var s = document.getElementById("s");
s.parentNode.removeChild(s);
document.documentElement.offsetWidth;
document.documentElement.removeAttribute("class");
}
</script>
</head>
<body onload="boom();">
<div>
<span id="s" style="position: absolute;">abcdefh</span>T
</div>
</body>

View File

@ -53,3 +53,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 329069-1.html 329069-1-ref.html # failu
== 429968-2c.html 429968-2-ref.html
== 441418-1.html 441418-1-ref.html
== 469227-1.html 469227-1-ref.html
== 484400-1.html 484400-1-ref.html