Bug 1320484 part 2: Wrap abspos placeholders in anonymous flex items, in flex containers that are really emulating legacy -webkit-box containers. r?mats
This changeset is intended to revert the logic from "
Bug 1269045 part 3" [1],
*specifically* for legacy "-webkit-box"/"-webkit-inline-box" flex containers.
[1] https://hg.mozilla.org/mozilla-central/rev/707b2ab5879d
MozReview-Commit-ID: vc4TuAoLai
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -10621,16 +10621,24 @@ FrameWantsToBeInAnonymousItem(const nsIF
containerType == nsGkAtoms::gridContainerFrame);
// Any line-participant frames (e.g. text) definitely want to be wrapped in
// an anonymous flex/grid item.
if (aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
return true;
}
+ // If the container is a -webkit-box/-webkit-inline-box, then placeholders
+ // also need to be wrapped, for compatibility.
+ if (containerType == nsGkAtoms::flexContainerFrame &&
+ aContainerFrame->HasAnyStateBits(NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX) &&
+ aFrame->GetType() == nsGkAtoms::placeholderFrame) {
+ return true;
+ }
+
return false;
}
#endif
static void
VerifyGridFlexContainerChildren(nsIFrame* aParentFrame,
const nsFrameList& aChildren)
{
@@ -12767,20 +12775,30 @@ nsCSSFrameConstructor::FrameConstruction
NeedsAnonFlexOrGridItem(const nsFrameConstructorState& aState,
bool aIsWebkitBox)
{
if (mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) {
// This will be an inline non-replaced box.
return true;
}
- if (aIsWebkitBox &&
- mStyleContext->StyleDisplay()->IsInlineOutsideStyle()) {
- // In a -webkit-box, all inline-level content gets wrapped in an anon item.
- return true;
+ if (aIsWebkitBox) {
+ if (mStyleContext->StyleDisplay()->IsInlineOutsideStyle()) {
+ // In a -webkit-box, all inline-level content gets wrapped in anon item.
+ return true;
+ }
+ if (!(mFCData->mBits & FCDATA_DISALLOW_OUT_OF_FLOW) &&
+ aState.GetGeometricParent(mStyleContext->StyleDisplay(), nullptr)) {
+ // We're abspos or fixedpos, which means we'll spawn a placeholder which
+ // (because our container is a -webkit-box) we'll need to wrap in an
+ // anonymous flex item. So, we just treat _this_ frame as if _it_ needs
+ // to be wrapped in an anonymous flex item, and then when we spawn the
+ // placeholder, it'll end up in the right spot.
+ return true;
+ }
}
return false;
}
inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipItemsThatNeedAnonFlexOrGridItem(