Backout 342c2b349402, bug 803192

This commit is contained in:
Robert O'Callahan 2013-01-25 21:50:24 +13:00
parent ed68c62ba6
commit d869cf0ec4
6 changed files with 39 additions and 116 deletions

View File

@ -1,17 +0,0 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body>
<math><menclose id="m" style="transform:translate(10px,0)">
<ll style="display:block">
<ll id=test2 style="display:none; position: fixed"></ll>
</ll>
</menclose></math>
<script>
function doTest() {
document.getElementById("test2").setAttribute("style", "position:fixed")
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<style>
.test {
position:fixed;
display:none;
width:100px; height:100px;
background:yellow;
}
.doTest .test {
display:block;
}
</style>
</head>
<body>
<table>
<tr style="transform:translate(10px,0)">
<td>
<div class="test"></div>
</td>
</tr>
</table>
<script>
function doTest() {
document.documentElement.setAttribute("class", "doTest");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<style>
.test {
position:fixed;
display:none;
width:100px; height:100px;
background:yellow;
}
.doTest .test {
display:block;
}
</style>
</head>
<body>
<div style="transform:translate(10px,0); overflow:scroll; width:200px; height:200px;">
<div class="test"></div>
</div>
<script>
function doTest() {
document.documentElement.setAttribute("class", "doTest");
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>

View File

@ -929,10 +929,9 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
// See PushAbsoluteContaningBlock below // See PushAbsoluteContaningBlock below
mFrameState(aHistoryState), mFrameState(aHistoryState),
mAdditionalStateBits(0), mAdditionalStateBits(0),
// If the fixed-pos containing block is equal to the abs-pos containing mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
// block, use the abs-pos containing block's abs-pos list for fixed-pos aAbsoluteContainingBlock->GetStyleDisplay()->
// frames. HasTransform(aAbsoluteContainingBlock)),
mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
mHavePendingPopupgroup(false), mHavePendingPopupgroup(false),
mCreatingExtraFrames(false), mCreatingExtraFrames(false),
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited, mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
@ -963,10 +962,9 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
mFloatedItems(aFloatContainingBlock), mFloatedItems(aFloatContainingBlock),
// See PushAbsoluteContaningBlock below // See PushAbsoluteContaningBlock below
mAdditionalStateBits(0), mAdditionalStateBits(0),
// If the fixed-pos containing block is equal to the abs-pos containing mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
// block, use the abs-pos containing block's abs-pos list for fixed-pos aAbsoluteContainingBlock->GetStyleDisplay()->
// frames. HasTransform(aAbsoluteContainingBlock)),
mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
mHavePendingPopupgroup(false), mHavePendingPopupgroup(false),
mCreatingExtraFrames(false), mCreatingExtraFrames(false),
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited, mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
@ -5590,13 +5588,12 @@ nsCSSFrameConstructor::GetFrameFor(nsIContent* aContent)
} }
nsIFrame* nsIFrame*
nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame, nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame)
ContainingBlockType aType)
{ {
NS_PRECONDITION(nullptr != mRootElementFrame, "no root element frame"); NS_PRECONDITION(nullptr != mRootElementFrame, "no root element frame");
// Starting with aFrame, look for a frame that is absolutely positioned or // Starting with aFrame, look for a frame that is absolutely positioned or
// relatively positioned (and transformed, if aType is FIXED) // relatively positioned
for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) { for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) {
if (frame->IsFrameOfType(nsIFrame::eMathML)) { if (frame->IsFrameOfType(nsIFrame::eMathML)) {
// If it's mathml, bail out -- no absolute positioning out from inside // If it's mathml, bail out -- no absolute positioning out from inside
@ -5611,10 +5608,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame,
// Scrollframes are special since they're not positioned, but their // Scrollframes are special since they're not positioned, but their
// scrolledframe might be. So, we need to check this special case to return // scrolledframe might be. So, we need to check this special case to return
// the correct containing block (the scrolledframe) in that case. // the correct containing block (the scrolledframe) in that case.
// If we're looking for a fixed-pos containing block and the frame is if (!frame->IsPositioned()) {
// not transformed, skip it.
if (!frame->IsPositioned() ||
(aType == FIXED_POS && !frame->GetStyleDisplay()->HasTransform(frame))) {
continue; continue;
} }
nsIFrame* absPosCBCandidate = nullptr; nsIFrame* absPosCBCandidate = nullptr;
@ -5630,9 +5624,9 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame,
continue; continue;
} }
// For tables, skip the inner frame and consider the outer table frame. // For tables, return the outer table frame.
if (absPosCBCandidate->GetType() == nsGkAtoms::tableFrame) { if (absPosCBCandidate->GetType() == nsGkAtoms::tableFrame) {
continue; return absPosCBCandidate->GetParent();
} }
// For outer table frames, we can just return absPosCBCandidate. // For outer table frames, we can just return absPosCBCandidate.
return absPosCBCandidate; return absPosCBCandidate;
@ -5641,12 +5635,24 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame,
// It is possible for the search for the containing block to fail, because // It is possible for the search for the containing block to fail, because
// no absolute container can be found in the parent chain. In those cases, // no absolute container can be found in the parent chain. In those cases,
// we fall back to the document element's containing block. // we fall back to the document element's containing block.
if (aType == FIXED_POS) {
return mFixedContainingBlock;
}
return mHasRootAbsPosContainingBlock ? mDocElementContainingBlock : nullptr; return mHasRootAbsPosContainingBlock ? mDocElementContainingBlock : nullptr;
} }
nsIFrame*
nsCSSFrameConstructor::GetFixedContainingBlock(nsIFrame* aFrame)
{
NS_PRECONDITION(nullptr != mRootElementFrame, "no root element frame");
// Starting with aFrame, look for a frame that is CSS-transformed
for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) {
if (frame->GetStyleDisplay()->HasTransform(frame)) {
return frame;
}
}
return mFixedContainingBlock;
}
nsIFrame* nsIFrame*
nsCSSFrameConstructor::GetFloatContainingBlock(nsIFrame* aFrame) nsCSSFrameConstructor::GetFloatContainingBlock(nsIFrame* aFrame)
{ {
@ -6641,9 +6647,8 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
&parentAfterFrame); &parentAfterFrame);
// Create some new frames // Create some new frames
nsFrameConstructorState state(mPresShell, nsFrameConstructorState state(mPresShell, GetFixedContainingBlock(parentFrame),
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), GetAbsoluteContainingBlock(parentFrame),
GetAbsoluteContainingBlock(parentFrame, ABS_POS),
GetFloatContainingBlock(parentFrame)); GetFloatContainingBlock(parentFrame));
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); state.mTreeMatchContext.InitAncestors(aContainer->AsElement());
@ -7077,9 +7082,8 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
return rv; return rv;
} }
nsFrameConstructorState state(mPresShell, nsFrameConstructorState state(mPresShell, GetFixedContainingBlock(parentFrame),
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), GetAbsoluteContainingBlock(parentFrame),
GetAbsoluteContainingBlock(parentFrame, ABS_POS),
GetFloatContainingBlock(parentFrame), GetFloatContainingBlock(parentFrame),
aFrameState); aFrameState);
state.mTreeMatchContext.InitAncestors(aContainer ? state.mTreeMatchContext.InitAncestors(aContainer ?
@ -8692,9 +8696,8 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
// Replicate the header/footer frame. // Replicate the header/footer frame.
nsTableRowGroupFrame* headerFooterFrame; nsTableRowGroupFrame* headerFooterFrame;
nsFrameItems childItems; nsFrameItems childItems;
nsFrameConstructorState state(mPresShell, nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(newFrame, FIXED_POS), GetAbsoluteContainingBlock(newFrame),
GetAbsoluteContainingBlock(newFrame, ABS_POS),
nullptr); nullptr);
state.mCreatingExtraFrames = true; state.mCreatingExtraFrames = true;
@ -10565,9 +10568,8 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIFrame* aBlockFrame,
NS_ASSERTION(aBlockContinuation == GetFloatContainingBlock(aParentFrame), NS_ASSERTION(aBlockContinuation == GetFloatContainingBlock(aParentFrame),
"Containing block is confused"); "Containing block is confused");
nsFrameConstructorState state(mPresShell, nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(aParentFrame, FIXED_POS), GetAbsoluteContainingBlock(aParentFrame),
GetAbsoluteContainingBlock(aParentFrame, ABS_POS),
aBlockContinuation); aBlockContinuation);
// Create the right type of first-letter frame // Create the right type of first-letter frame
@ -10954,8 +10956,8 @@ nsCSSFrameConstructor::CreateListBoxContent(nsPresContext* aPresContext,
// Construct a new frame // Construct a new frame
if (nullptr != aParentFrame) { if (nullptr != aParentFrame) {
nsFrameItems frameItems; nsFrameItems frameItems;
nsFrameConstructorState state(mPresShell, GetAbsoluteContainingBlock(aParentFrame, FIXED_POS), nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(aParentFrame, ABS_POS), GetAbsoluteContainingBlock(aParentFrame),
GetFloatContainingBlock(aParentFrame), GetFloatContainingBlock(aParentFrame),
mTempFrameTreeState); mTempFrameTreeState);

View File

@ -1463,11 +1463,8 @@ private:
* corresponding logic in these functions. * corresponding logic in these functions.
*/ */
public: public:
enum ContainingBlockType { nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
ABS_POS, nsIFrame* GetFixedContainingBlock(nsIFrame* aFrame);
FIXED_POS
};
nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame, ContainingBlockType aType);
nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame); nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame);
private: private:

View File

@ -9006,8 +9006,7 @@ void ColorToString(nscolor aColor, nsAutoString &aString)
nsIFrame* nsIPresShell::GetAbsoluteContainingBlock(nsIFrame *aFrame) nsIFrame* nsIPresShell::GetAbsoluteContainingBlock(nsIFrame *aFrame)
{ {
return FrameConstructor()->GetAbsoluteContainingBlock(aFrame, return FrameConstructor()->GetAbsoluteContainingBlock(aFrame);
nsCSSFrameConstructor::ABS_POS);
} }
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY