diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index d983add1dd9..ec3246f53e7 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3565,6 +3565,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt // If we need to create a block formatting context to wrap our // kids, do it now. + const nsStyleDisplay* maybeAbsoluteContainingBlockDisplay = display; nsIFrame* maybeAbsoluteContainingBlock = newFrame; nsIFrame* possiblyLeafFrame = newFrame; if (bits & FCDATA_CREATE_BLOCK_WRAPPER_FOR_ALL_KIDS) { @@ -3584,6 +3585,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt // positioned, otherwise the former. const nsStyleDisplay* blockDisplay = blockContext->StyleDisplay(); if (blockDisplay->IsPositioned(blockFrame)) { + maybeAbsoluteContainingBlockDisplay = blockDisplay; maybeAbsoluteContainingBlock = blockFrame; } @@ -3616,7 +3618,11 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt } else if (!(bits & FCDATA_SKIP_ABSPOS_PUSH)) { nsIFrame* cb = maybeAbsoluteContainingBlock; cb->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN); - if (cb->IsPositioned()) { + if ((maybeAbsoluteContainingBlockDisplay->IsAbsolutelyPositionedStyle() || + maybeAbsoluteContainingBlockDisplay->IsRelativelyPositionedStyle() || + (maybeAbsoluteContainingBlockDisplay->HasTransformStyle() && + cb->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) && + !cb->IsSVGText()) { aState.PushAbsoluteContainingBlock(cb, absoluteSaveState); } } diff --git a/layout/reftests/bugs/860370-notref.html b/layout/reftests/bugs/860370-notref.html new file mode 100644 index 00000000000..3988abd4691 --- /dev/null +++ b/layout/reftests/bugs/860370-notref.html @@ -0,0 +1,4 @@ + +
+ +
diff --git a/layout/reftests/bugs/860370.html b/layout/reftests/bugs/860370.html new file mode 100644 index 00000000000..4a5a234b7e5 --- /dev/null +++ b/layout/reftests/bugs/860370.html @@ -0,0 +1,4 @@ + +
+ +
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index c9d68231b7f..92192d7f219 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1754,3 +1754,4 @@ skip-if(B2G) == 818276-1.html 818276-1-ref.html == 848421-1.html 848421-1-ref.html test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html == 858803-1.html 858803-1-ref.html +!= 860370.html 860370-notref.html