зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479859 patch 1 - Make inline frames be abs-pos containing blocks for reasons other than being relatively positioned. r=emilio
The basic change here is making nsCSSFrameConstructor::ConstructInline use the function nsIFrame::IsAbsPosContainingBlock rather than testing for only one of the conditions in it (being relatively or absolutely positioned). The rest of the code changes follow from that change. I tested locally that the added test fails without the patch and passes with it (either with or without the next patch). Note that this causes a regression of three web-platform-test reftests: testing/web-platform/tests/css/css-contain/contain-paint-002.html testing/web-platform/tests/css/css-contain/contain-paint-011.html testing/web-platform/tests/css/css-contain/contain-paint-012.html which will be fixed in patch 4, since that fix is easier to write after patch 2. Differential Revision: https://phabricator.services.mozilla.com/D2813 --HG-- extra : rebase_source : 0d374628207c234bcd7cf4e320188994fc2680b8
This commit is contained in:
Родитель
fe449c667f
Коммит
7642040d1b
|
@ -6247,9 +6247,9 @@ nsCSSFrameConstructor::AppendFramesToParent(nsFrameConstructorState& aStat
|
|||
}
|
||||
|
||||
if (!aFrameList.IsEmpty()) {
|
||||
bool positioned = aParentFrame->IsRelativelyPositioned();
|
||||
nsFrameItems ibSiblings;
|
||||
CreateIBSiblings(aState, aParentFrame, positioned, aFrameList,
|
||||
CreateIBSiblings(aState, aParentFrame,
|
||||
aParentFrame->IsAbsPosContainingBlock(), aFrameList,
|
||||
ibSiblings);
|
||||
|
||||
// Make sure to trigger reflow of the inline that used to be our
|
||||
|
@ -11118,11 +11118,6 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
|||
nsIContent* const content = aItem.mContent;
|
||||
ComputedStyle* const computedStyle = aItem.mComputedStyle;
|
||||
|
||||
bool positioned =
|
||||
StyleDisplay::Inline == aDisplay->mDisplay &&
|
||||
aDisplay->IsRelativelyPositionedStyle() &&
|
||||
!nsSVGUtils::IsInSVGTextSubtree(aParentFrame);
|
||||
|
||||
nsInlineFrame* newFrame = NS_NewInlineFrame(mPresShell, computedStyle);
|
||||
|
||||
// Initialize the frame
|
||||
|
@ -11132,8 +11127,9 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
|||
// because the object's destructor is significant
|
||||
// this is part of the fix for bug 42372
|
||||
|
||||
bool isAbsPosCB = newFrame->IsAbsPosContainingBlock();
|
||||
newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
|
||||
if (positioned) {
|
||||
if (isAbsPosCB) {
|
||||
// Relatively positioned frames becomes a container for child
|
||||
// frames that are positioned
|
||||
aState.PushAbsoluteContainingBlock(newFrame, newFrame, absoluteSaveState);
|
||||
|
@ -11172,7 +11168,7 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
|||
aFrameItems.AddChild(newFrame);
|
||||
|
||||
newFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
|
||||
CreateIBSiblings(aState, newFrame, positioned, childItems, aFrameItems);
|
||||
CreateIBSiblings(aState, newFrame, isAbsPosCB, childItems, aFrameItems);
|
||||
|
||||
return newFrame;
|
||||
}
|
||||
|
@ -11180,10 +11176,12 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
|||
void
|
||||
nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
|
||||
nsContainerFrame* aInitialInline,
|
||||
bool aIsPositioned,
|
||||
bool aIsAbsPosCB,
|
||||
nsFrameItems& aChildItems,
|
||||
nsFrameItems& aSiblings)
|
||||
{
|
||||
MOZ_ASSERT(aIsAbsPosCB == aInitialInline->IsAbsPosContainingBlock());
|
||||
|
||||
nsIContent* content = aInitialInline->GetContent();
|
||||
ComputedStyle* computedStyle = aInitialInline->Style();
|
||||
nsContainerFrame* parentFrame = aInitialInline->GetParent();
|
||||
|
@ -11231,7 +11229,7 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
|
|||
nsInlineFrame* inlineFrame = NS_NewInlineFrame(mPresShell, computedStyle);
|
||||
InitAndRestoreFrame(aState, content, parentFrame, inlineFrame, false);
|
||||
inlineFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
|
||||
if (aIsPositioned) {
|
||||
if (aIsAbsPosCB) {
|
||||
inlineFrame->MarkAsAbsoluteContainingBlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -163681,6 +163681,18 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/filter-effects/filter-cb-abspos-inline-001.html": [
|
||||
[
|
||||
"/css/filter-effects/filter-cb-abspos-inline-001.html",
|
||||
[
|
||||
[
|
||||
"/css/filter-effects/filter-cb-abspos-inline-001-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/filter-effects/filter-contrast-001.html": [
|
||||
[
|
||||
"/css/filter-effects/filter-contrast-001.html",
|
||||
|
@ -266007,6 +266019,11 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/filter-effects/filter-cb-abspos-inline-001-ref.html": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/filter-effects/filter-contrast-001-ref.html": [
|
||||
[
|
||||
{}
|
||||
|
@ -563604,6 +563621,14 @@
|
|||
"8caaede02f27a120278d9d1512084e6fd57ab27f",
|
||||
"reftest"
|
||||
],
|
||||
"css/filter-effects/filter-cb-abspos-inline-001-ref.html": [
|
||||
"6ebe4635511242cd0f5965a778a5a491cc406436",
|
||||
"support"
|
||||
],
|
||||
"css/filter-effects/filter-cb-abspos-inline-001.html": [
|
||||
"6f99c48d5f34761ba1bc1ce7dbdfd927469ac65a",
|
||||
"reftest"
|
||||
],
|
||||
"css/filter-effects/filter-contrast-001-ref.html": [
|
||||
"1be00e8bba72ed3203819cb51586947535ac5096",
|
||||
"support"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[filtered-inline-is-container.html]
|
||||
expected: FAIL
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=UTF-8>
|
||||
<title>CSS Filter: Establishing containing block for absolutely-positioned elements, on an inline element</title>
|
||||
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/">
|
||||
<meta name="flags" content="">
|
||||
<style>
|
||||
|
||||
#cb {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#abspos {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<p>Filler text.</p>
|
||||
|
||||
<div>
|
||||
<span id="cb">Blue box should cover top-left corner of this sentence.<span id="abspos"></span></span>
|
||||
</div>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=UTF-8>
|
||||
<title>CSS Filter: Establishing containing block for absolutely-positioned elements, on an inline element</title>
|
||||
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
|
||||
<link rel="author" title="Mozilla Corporation" href="http://mozilla.com/">
|
||||
<link rel="match" href="filter-cb-abspos-inline-001-ref.html">
|
||||
<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#FilterProperty">
|
||||
<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#supported-filter-functions">
|
||||
<meta name="flags" content="">
|
||||
<meta name="assert" content="A value other than none for the filter property results in the creation of a containing block for absolute and fixed positioned descendants unless the element it applies to is a document root element in the current browsing context.">
|
||||
<meta name="assert" content="A value of 100% leaves the input unchanged.">
|
||||
<style>
|
||||
|
||||
#cb {
|
||||
filter: brightness(100%);
|
||||
}
|
||||
|
||||
#abspos {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<p>Filler text.</p>
|
||||
|
||||
<div>
|
||||
<span id="cb">Blue box should cover top-left corner of this sentence.<span id="abspos"></span></span>
|
||||
</div>
|
Загрузка…
Ссылка в новой задаче