mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 830192. Integrate GetFixedContainingBlock into GetAbsoluteContainingBlock and ensure only elements which can be abs-pos containing blocks are turned into fixed-pos containing blocks when transformed. r=bzbarsky
This commit is contained in:
parent
2f49e6acff
commit
b6c051330b
17
layout/base/crashtests/830138-1.html
Normal file
17
layout/base/crashtests/830138-1.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!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>
|
31
layout/base/crashtests/830192-1.html
Normal file
31
layout/base/crashtests/830192-1.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<!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>
|
27
layout/base/crashtests/830299-1.html
Normal file
27
layout/base/crashtests/830299-1.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!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>
|
@ -929,9 +929,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShe
|
|||||||
// See PushAbsoluteContaningBlock below
|
// See PushAbsoluteContaningBlock below
|
||||||
mFrameState(aHistoryState),
|
mFrameState(aHistoryState),
|
||||||
mAdditionalStateBits(0),
|
mAdditionalStateBits(0),
|
||||||
mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
|
// If the fixed-pos containing block is equal to the abs-pos containing
|
||||||
aAbsoluteContainingBlock->GetStyleDisplay()->
|
// block, use the abs-pos containing block's abs-pos list for fixed-pos
|
||||||
HasTransform(aAbsoluteContainingBlock)),
|
// frames.
|
||||||
|
mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
|
||||||
mHavePendingPopupgroup(false),
|
mHavePendingPopupgroup(false),
|
||||||
mCreatingExtraFrames(false),
|
mCreatingExtraFrames(false),
|
||||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||||
@ -962,9 +963,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
|
|||||||
mFloatedItems(aFloatContainingBlock),
|
mFloatedItems(aFloatContainingBlock),
|
||||||
// See PushAbsoluteContaningBlock below
|
// See PushAbsoluteContaningBlock below
|
||||||
mAdditionalStateBits(0),
|
mAdditionalStateBits(0),
|
||||||
mFixedPosIsAbsPos(aAbsoluteContainingBlock &&
|
// If the fixed-pos containing block is equal to the abs-pos containing
|
||||||
aAbsoluteContainingBlock->GetStyleDisplay()->
|
// block, use the abs-pos containing block's abs-pos list for fixed-pos
|
||||||
HasTransform(aAbsoluteContainingBlock)),
|
// frames.
|
||||||
|
mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
|
||||||
mHavePendingPopupgroup(false),
|
mHavePendingPopupgroup(false),
|
||||||
mCreatingExtraFrames(false),
|
mCreatingExtraFrames(false),
|
||||||
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
mTreeMatchContext(true, nsRuleWalker::eRelevantLinkUnvisited,
|
||||||
@ -5588,12 +5590,13 @@ 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
|
// relatively positioned (and transformed, if aType is FIXED)
|
||||||
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
|
||||||
@ -5608,7 +5611,10 @@ 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 (!frame->IsPositioned()) {
|
// If we're looking for a fixed-pos containing block and the frame is
|
||||||
|
// not transformed, skip it.
|
||||||
|
if (!frame->IsPositioned() ||
|
||||||
|
(aType == FIXED_POS && !frame->GetStyleDisplay()->HasTransform(frame))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nsIFrame* absPosCBCandidate = nullptr;
|
nsIFrame* absPosCBCandidate = nullptr;
|
||||||
@ -5624,9 +5630,9 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For tables, return the outer table frame.
|
// For tables, skip the inner frame and consider the outer table frame.
|
||||||
if (absPosCBCandidate->GetType() == nsGkAtoms::tableFrame) {
|
if (absPosCBCandidate->GetType() == nsGkAtoms::tableFrame) {
|
||||||
return absPosCBCandidate->GetParent();
|
continue;
|
||||||
}
|
}
|
||||||
// For outer table frames, we can just return absPosCBCandidate.
|
// For outer table frames, we can just return absPosCBCandidate.
|
||||||
return absPosCBCandidate;
|
return absPosCBCandidate;
|
||||||
@ -5635,22 +5641,10 @@ 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.
|
||||||
return mHasRootAbsPosContainingBlock ? mDocElementContainingBlock : nullptr;
|
if (aType == FIXED_POS) {
|
||||||
}
|
return mFixedContainingBlock;
|
||||||
|
|
||||||
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 mHasRootAbsPosContainingBlock ? mDocElementContainingBlock : nullptr;
|
||||||
return mFixedContainingBlock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
@ -6647,8 +6641,9 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
|||||||
&parentAfterFrame);
|
&parentAfterFrame);
|
||||||
|
|
||||||
// Create some new frames
|
// Create some new frames
|
||||||
nsFrameConstructorState state(mPresShell, GetFixedContainingBlock(parentFrame),
|
nsFrameConstructorState state(mPresShell,
|
||||||
GetAbsoluteContainingBlock(parentFrame),
|
GetAbsoluteContainingBlock(parentFrame, FIXED_POS),
|
||||||
|
GetAbsoluteContainingBlock(parentFrame, ABS_POS),
|
||||||
GetFloatContainingBlock(parentFrame));
|
GetFloatContainingBlock(parentFrame));
|
||||||
state.mTreeMatchContext.InitAncestors(aContainer->AsElement());
|
state.mTreeMatchContext.InitAncestors(aContainer->AsElement());
|
||||||
|
|
||||||
@ -7082,8 +7077,9 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFrameConstructorState state(mPresShell, GetFixedContainingBlock(parentFrame),
|
nsFrameConstructorState state(mPresShell,
|
||||||
GetAbsoluteContainingBlock(parentFrame),
|
GetAbsoluteContainingBlock(parentFrame, FIXED_POS),
|
||||||
|
GetAbsoluteContainingBlock(parentFrame, ABS_POS),
|
||||||
GetFloatContainingBlock(parentFrame),
|
GetFloatContainingBlock(parentFrame),
|
||||||
aFrameState);
|
aFrameState);
|
||||||
state.mTreeMatchContext.InitAncestors(aContainer ?
|
state.mTreeMatchContext.InitAncestors(aContainer ?
|
||||||
@ -8696,8 +8692,9 @@ 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, mFixedContainingBlock,
|
nsFrameConstructorState state(mPresShell,
|
||||||
GetAbsoluteContainingBlock(newFrame),
|
GetAbsoluteContainingBlock(newFrame, FIXED_POS),
|
||||||
|
GetAbsoluteContainingBlock(newFrame, ABS_POS),
|
||||||
nullptr);
|
nullptr);
|
||||||
state.mCreatingExtraFrames = true;
|
state.mCreatingExtraFrames = true;
|
||||||
|
|
||||||
@ -10568,8 +10565,9 @@ 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, mFixedContainingBlock,
|
nsFrameConstructorState state(mPresShell,
|
||||||
GetAbsoluteContainingBlock(aParentFrame),
|
GetAbsoluteContainingBlock(aParentFrame, FIXED_POS),
|
||||||
|
GetAbsoluteContainingBlock(aParentFrame, ABS_POS),
|
||||||
aBlockContinuation);
|
aBlockContinuation);
|
||||||
|
|
||||||
// Create the right type of first-letter frame
|
// Create the right type of first-letter frame
|
||||||
@ -10956,8 +10954,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, mFixedContainingBlock,
|
nsFrameConstructorState state(mPresShell, GetAbsoluteContainingBlock(aParentFrame, FIXED_POS),
|
||||||
GetAbsoluteContainingBlock(aParentFrame),
|
GetAbsoluteContainingBlock(aParentFrame, ABS_POS),
|
||||||
GetFloatContainingBlock(aParentFrame),
|
GetFloatContainingBlock(aParentFrame),
|
||||||
mTempFrameTreeState);
|
mTempFrameTreeState);
|
||||||
|
|
||||||
|
@ -1463,8 +1463,11 @@ private:
|
|||||||
* corresponding logic in these functions.
|
* corresponding logic in these functions.
|
||||||
*/
|
*/
|
||||||
public:
|
public:
|
||||||
nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
|
enum ContainingBlockType {
|
||||||
nsIFrame* GetFixedContainingBlock(nsIFrame* aFrame);
|
ABS_POS,
|
||||||
|
FIXED_POS
|
||||||
|
};
|
||||||
|
nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame, ContainingBlockType aType);
|
||||||
nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame);
|
nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -9006,7 +9006,8 @@ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user