Bug 1398963 part 3: Generalize "webkit-box" variable names and code-comments in nsCSSFrameConstructor.cpp (idempotent patch). r=mats

Now that (per previous patch) NS_STATE_FLEX_IS_EMULATING_LEGACY_BOX isn't just
a webkit-box-specific tag: this patch here generalizes the variable-names and
comments associated with that flag in nsCSSFrameConstructor.cpp.

This patch does not make any changes to behavior; it's simply renaming &
comment tweaks.

MozReview-Commit-ID: DcF5GirAQwD

--HG--
extra : rebase_source : d847c5579399a4cc31dc14a52a93b03ed917034e
This commit is contained in:
Daniel Holbert 2017-12-18 12:17:10 -06:00
Родитель 0d839c700e
Коммит 91270c255f
1 изменённых файлов: 28 добавлений и 27 удалений

Просмотреть файл

@ -380,7 +380,7 @@ IsFlexOrGridContainer(const nsIFrame* aFrame)
}
// Returns true IFF the given nsIFrame is a nsFlexContainerFrame and
// represents a -webkit-{inline-}box container.
// represents a -webkit-{inline-}box or -moz-{inline-}box container.
static inline bool
IsFlexContainerForLegacyBox(const nsIFrame* aFrame)
{
@ -10032,11 +10032,11 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
return;
}
const bool isWebkitBox = IsFlexContainerForLegacyBox(aParentFrame);
const bool isLegacyBox = IsFlexContainerForLegacyBox(aParentFrame);
FCItemIterator iter(aItems);
do {
// Advance iter past children that don't want to be wrapped
if (iter.SkipItemsThatDontNeedAnonFlexOrGridItem(aState, isWebkitBox)) {
if (iter.SkipItemsThatDontNeedAnonFlexOrGridItem(aState, isLegacyBox)) {
// Hit the end of the items without finding any remaining children that
// need to be wrapped. We're finished!
return;
@ -10059,7 +10059,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
bool hitEnd = afterWhitespaceIter.SkipWhitespace(aState);
bool nextChildNeedsAnonItem =
!hitEnd &&
afterWhitespaceIter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox);
afterWhitespaceIter.item().NeedsAnonFlexOrGridItem(aState, isLegacyBox);
if (!nextChildNeedsAnonItem) {
// There's nothing after the whitespace that we need to wrap, so we
@ -10073,7 +10073,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
// we jump back to the beginning of the loop to skip over that child
// (and anything else non-wrappable after it)
MOZ_ASSERT(!iter.IsDone() &&
!iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox),
!iter.item().NeedsAnonFlexOrGridItem(aState, isLegacyBox),
"hitEnd and/or nextChildNeedsAnonItem lied");
continue;
}
@ -10083,7 +10083,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
// anonymous flex/grid item. Now we see how many children after it also want
// to be wrapped in an anonymous flex/grid item.
FCItemIterator endIter(iter); // iterator to find the end of the group
endIter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isWebkitBox);
endIter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isLegacyBox);
NS_ASSERTION(iter != endIter,
"Should've had at least one wrappable child to seek past");
@ -10720,8 +10720,8 @@ FrameWantsToBeInAnonymousItem(const nsIFrame* aContainerFrame,
return true;
}
// If the container is a -webkit-box/-webkit-inline-box, then placeholders
// also need to be wrapped, for compatibility.
// If the container is a -webkit-{inline-}box or -moz-{inline-}box container,
// then placeholders also need to be wrapped, for compatibility.
if (IsFlexContainerForLegacyBox(aContainerFrame) &&
aFrame->IsPlaceholderFrame()) {
return true;
@ -12402,9 +12402,9 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
// Check if we're adding to-be-wrapped content right *after* an existing
// anonymous flex or grid item (which would need to absorb this content).
const bool isWebkitBox = IsFlexContainerForLegacyBox(aFrame);
const bool isLegacyBox = IsFlexContainerForLegacyBox(aFrame);
if (aPrevSibling && IsAnonymousFlexOrGridItem(aPrevSibling) &&
iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox)) {
iter.item().NeedsAnonFlexOrGridItem(aState, isLegacyBox)) {
RecreateFramesForContent(aFrame->GetContent(), InsertionKind::Async);
return true;
}
@ -12415,7 +12415,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
// Jump to the last entry in the list
iter.SetToEnd();
iter.Prev();
if (iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox)) {
if (iter.item().NeedsAnonFlexOrGridItem(aState, isLegacyBox)) {
RecreateFramesForContent(aFrame->GetContent(), InsertionKind::Async);
return true;
}
@ -12440,8 +12440,8 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
// Skip over things that _do_ need an anonymous flex item, because
// they're perfectly happy to go here -- they won't cause a reframe.
nsIFrame* containerFrame = aFrame->GetParent();
const bool isWebkitBox = IsFlexContainerForLegacyBox(containerFrame);
if (!iter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isWebkitBox)) {
const bool isLegacyBox = IsFlexContainerForLegacyBox(containerFrame);
if (!iter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isLegacyBox)) {
// We hit something that _doesn't_ need an anonymous flex item!
// Rebuild the flex container to bust it out.
RecreateFramesForContent(containerFrame->GetContent(), InsertionKind::Async);
@ -12884,31 +12884,32 @@ Iterator::SkipItemsNotWantingParentType(ParentType aParentType)
return false;
}
// Note: we implement -webkit-box & -webkit-inline-box using
// nsFlexContainerFrame, but we use different rules for what gets wrapped in an
// anonymous flex item.
// Note: we implement -webkit-{inline-}box (and optionally -moz-{inline-}box)
// using nsFlexContainerFrame, but we use different rules for what gets wrapped
// in an anonymous flex item.
bool
nsCSSFrameConstructor::FrameConstructionItem::
NeedsAnonFlexOrGridItem(const nsFrameConstructorState& aState,
bool aIsWebkitBox)
bool aIsLegacyBox)
{
if (mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) {
// This will be an inline non-replaced box.
return true;
}
if (aIsWebkitBox) {
if (aIsLegacyBox) {
if (mStyleContext->StyleDisplay()->IsInlineOutsideStyle()) {
// In a -webkit-box, all inline-level content gets wrapped in anon item.
// In an emulated legacy box, all inline-level content gets wrapped in an
// anonymous flex 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.
// (because our container is an emulated legacy 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;
}
}
@ -12920,10 +12921,10 @@ inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipItemsThatNeedAnonFlexOrGridItem(
const nsFrameConstructorState& aState,
bool aIsWebkitBox)
bool aIsLegacyBox)
{
NS_PRECONDITION(!IsDone(), "Shouldn't be done yet");
while (item().NeedsAnonFlexOrGridItem(aState, aIsWebkitBox)) {
while (item().NeedsAnonFlexOrGridItem(aState, aIsLegacyBox)) {
Next();
if (IsDone()) {
return true;
@ -12936,10 +12937,10 @@ inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipItemsThatDontNeedAnonFlexOrGridItem(
const nsFrameConstructorState& aState,
bool aIsWebkitBox)
bool aIsLegacyBox)
{
NS_PRECONDITION(!IsDone(), "Shouldn't be done yet");
while (!(item().NeedsAnonFlexOrGridItem(aState, aIsWebkitBox))) {
while (!(item().NeedsAnonFlexOrGridItem(aState, aIsLegacyBox))) {
Next();
if (IsDone()) {
return true;