Bug 1499281 - Remove column-span pref in nsCSSFrameConstructor. r=dbaron

For BeginBuildingColumns, returning nsBlockFrame, i.e. the original
NS_NewColumnSetWrapperFrame's return type, should be sufficient since no
other caller in frame constructor needs to call ColumnSetWrapper's
methods.

Differential Revision: https://phabricator.services.mozilla.com/D58398

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-12-31 16:13:41 +00:00
Родитель c93d1c1bda
Коммит 3c0eb96e17
2 изменённых файлов: 18 добавлений и 68 удалений

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

@ -376,9 +376,6 @@ static bool ShouldSuppressFloatingOfDescendants(nsIFrame* aFrame) {
// context). Basically, this is testing whether aFrame establishes a new block // context). Basically, this is testing whether aFrame establishes a new block
// formatting context or not. // formatting context or not.
static bool ShouldSuppressColumnSpanDescendants(nsIFrame* aFrame) { static bool ShouldSuppressColumnSpanDescendants(nsIFrame* aFrame) {
MOZ_ASSERT(StaticPrefs::layout_css_column_span_enabled(),
"Call this only when layout.css.column-span.enabled is true!");
if (aFrame->Style()->GetPseudoType() == PseudoStyleType::columnContent) { if (aFrame->Style()->GetPseudoType() == PseudoStyleType::columnContent) {
// Never suppress column-span under ::-moz-column-content frames. // Never suppress column-span under ::-moz-column-content frames.
return false; return false;
@ -3040,8 +3037,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructFieldSetFrame(
} }
} }
if (!StaticPrefs::layout_css_column_span_enabled() || if (!MayNeedToCreateColumnSpanSiblings(contentFrame, childList)) {
!MayNeedToCreateColumnSpanSiblings(contentFrame, childList)) {
// Set the inner frame's initial child lists. // Set the inner frame's initial child lists.
contentFrame->SetInitialChildList(kPrincipalList, childList); contentFrame->SetInitialChildList(kPrincipalList, childList);
} else { } else {
@ -3743,8 +3739,7 @@ void nsCSSFrameConstructor::ConstructFrameFromItemInternal(
childList = newList; childList = newList;
} }
if (!StaticPrefs::layout_css_column_span_enabled() || if (!(bits & FCDATA_ALLOW_GRID_FLEX_COLUMN) ||
!(bits & FCDATA_ALLOW_GRID_FLEX_COLUMN) ||
!MayNeedToCreateColumnSpanSiblings(newFrameAsContainer, childList)) { !MayNeedToCreateColumnSpanSiblings(newFrameAsContainer, childList)) {
// Set the frame's initial child list. Note that MathML depends on this // Set the frame's initial child list. Note that MathML depends on this
// being called even if childList is empty! // being called even if childList is empty!
@ -6851,8 +6846,7 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
} }
LAYOUT_PHASE_TEMP_EXIT(); LAYOUT_PHASE_TEMP_EXIT();
if (StaticPrefs::layout_css_column_span_enabled() && if (MaybeRecreateForColumnSpan(state, parentFrame, frameList, prevSibling)) {
MaybeRecreateForColumnSpan(state, parentFrame, frameList, prevSibling)) {
LAYOUT_PHASE_TEMP_REENTER(); LAYOUT_PHASE_TEMP_REENTER();
return; return;
} }
@ -7300,8 +7294,7 @@ void nsCSSFrameConstructor::ContentRangeInserted(
} }
LAYOUT_PHASE_TEMP_EXIT(); LAYOUT_PHASE_TEMP_EXIT();
if (StaticPrefs::layout_css_column_span_enabled() && if (MaybeRecreateForColumnSpan(state, insertion.mParentFrame, frameList,
MaybeRecreateForColumnSpan(state, insertion.mParentFrame, frameList,
prevSibling)) { prevSibling)) {
LAYOUT_PHASE_TEMP_REENTER(); LAYOUT_PHASE_TEMP_REENTER();
return; return;
@ -10547,11 +10540,9 @@ void nsCSSFrameConstructor::ConstructBlock(
*aNewFrame, aPositionedFrameForAbsPosContainer, absoluteSaveState); *aNewFrame, aPositionedFrameForAbsPosContainer, absoluteSaveState);
} }
if (StaticPrefs::layout_css_column_span_enabled()) { if (aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) &&
if (aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) && !ShouldSuppressColumnSpanDescendants(aParentFrame)) {
!ShouldSuppressColumnSpanDescendants(aParentFrame)) { blockFrame->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
blockFrame->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
}
} }
// Process the child content // Process the child content
@ -10559,12 +10550,6 @@ void nsCSSFrameConstructor::ConstructBlock(
ProcessChildren(aState, aContent, aComputedStyle, blockFrame, true, childList, ProcessChildren(aState, aContent, aComputedStyle, blockFrame, true, childList,
true); true);
if (!StaticPrefs::layout_css_column_span_enabled()) {
// Set the frame's initial child list
blockFrame->SetInitialChildList(kPrincipalList, childList);
return;
}
if (!MayNeedToCreateColumnSpanSiblings(blockFrame, childList)) { if (!MayNeedToCreateColumnSpanSiblings(blockFrame, childList)) {
// No need to create column-span siblings. // No need to create column-span siblings.
blockFrame->SetInitialChildList(kPrincipalList, childList); blockFrame->SetInitialChildList(kPrincipalList, childList);
@ -10609,7 +10594,7 @@ void nsCSSFrameConstructor::ConstructBlock(
"The column-span siblings should be moved to the proper place!"); "The column-span siblings should be moved to the proper place!");
} }
nsContainerFrame* nsCSSFrameConstructor::BeginBuildingColumns( nsBlockFrame* nsCSSFrameConstructor::BeginBuildingColumns(
nsFrameConstructorState& aState, nsIContent* aContent, nsFrameConstructorState& aState, nsIContent* aContent,
nsContainerFrame* aParentFrame, nsContainerFrame* aColumnContent, nsContainerFrame* aParentFrame, nsContainerFrame* aColumnContent,
ComputedStyle* aComputedStyle) { ComputedStyle* aComputedStyle) {
@ -10619,23 +10604,6 @@ nsContainerFrame* nsCSSFrameConstructor::BeginBuildingColumns(
MOZ_ASSERT(aComputedStyle->StyleColumn()->IsColumnContainerStyle(), MOZ_ASSERT(aComputedStyle->StyleColumn()->IsColumnContainerStyle(),
"No need to build a column hierarchy!"); "No need to build a column hierarchy!");
if (!StaticPrefs::layout_css_column_span_enabled()) {
// Preserve the old behavior which supports no column-span.
// Wrap the block frame in a ColumnSetFrame.
nsContainerFrame* columnSetFrame = NS_NewColumnSetFrame(
mPresShell, aComputedStyle, nsFrameState(NS_FRAME_OWNS_ANON_BOXES));
InitAndRestoreFrame(aState, aContent, aParentFrame, columnSetFrame);
RefPtr<ComputedStyle> anonBlockStyle =
mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(
PseudoStyleType::columnContent, aComputedStyle);
aColumnContent->SetComputedStyleWithoutNotification(anonBlockStyle);
InitAndRestoreFrame(aState, aContent, columnSetFrame, aColumnContent);
SetInitialSingleChild(columnSetFrame, aColumnContent);
return columnSetFrame;
}
// The initial column hierarchy looks like this: // The initial column hierarchy looks like this:
// //
// ColumnSetWrapper (original style) // ColumnSetWrapper (original style)
@ -10676,9 +10644,6 @@ nsContainerFrame* nsCSSFrameConstructor::BeginBuildingColumns(
void nsCSSFrameConstructor::FinishBuildingColumns( void nsCSSFrameConstructor::FinishBuildingColumns(
nsFrameConstructorState& aState, nsContainerFrame* aColumnSetWrapper, nsFrameConstructorState& aState, nsContainerFrame* aColumnSetWrapper,
nsContainerFrame* aColumnContent, nsFrameList& aColumnContentSiblings) { nsContainerFrame* aColumnContent, nsFrameList& aColumnContentSiblings) {
MOZ_ASSERT(StaticPrefs::layout_css_column_span_enabled(),
"Call this only when layout.css.column-span.enabled is true!");
nsContainerFrame* prevColumnSet = aColumnContent->GetParent(); nsContainerFrame* prevColumnSet = aColumnContent->GetParent();
MOZ_ASSERT(prevColumnSet->IsColumnSetFrame() && MOZ_ASSERT(prevColumnSet->IsColumnSetFrame() &&
@ -10719,9 +10684,6 @@ void nsCSSFrameConstructor::FinishBuildingColumns(
bool nsCSSFrameConstructor::MayNeedToCreateColumnSpanSiblings( bool nsCSSFrameConstructor::MayNeedToCreateColumnSpanSiblings(
nsContainerFrame* aBlockFrame, const nsFrameList& aChildList) { nsContainerFrame* aBlockFrame, const nsFrameList& aChildList) {
MOZ_ASSERT(StaticPrefs::layout_css_column_span_enabled(),
"Call this only when layout.css.column-span.enabled is true!");
if (!aBlockFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) { if (!aBlockFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) {
// The block frame isn't in a multi-column block formatting context. // The block frame isn't in a multi-column block formatting context.
return false; return false;
@ -10820,9 +10782,6 @@ nsFrameList nsCSSFrameConstructor::CreateColumnSpanSiblings(
bool nsCSSFrameConstructor::MaybeRecreateForColumnSpan( bool nsCSSFrameConstructor::MaybeRecreateForColumnSpan(
nsFrameConstructorState& aState, nsContainerFrame* aParentFrame, nsFrameConstructorState& aState, nsContainerFrame* aParentFrame,
nsFrameList& aFrameList, nsIFrame* aPrevSibling) { nsFrameList& aFrameList, nsIFrame* aPrevSibling) {
MOZ_ASSERT(StaticPrefs::layout_css_column_span_enabled(),
"Call this only when layout.css.column-span.enabled is true!");
if (!aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) { if (!aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) {
return false; return false;
} }
@ -10977,11 +10936,9 @@ nsIFrame* nsCSSFrameConstructor::ConstructInline(
aState.PushAbsoluteContainingBlock(newFrame, newFrame, absoluteSaveState); aState.PushAbsoluteContainingBlock(newFrame, newFrame, absoluteSaveState);
} }
if (StaticPrefs::layout_css_column_span_enabled()) { if (aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) &&
if (aParentFrame->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) && !ShouldSuppressColumnSpanDescendants(aParentFrame)) {
!ShouldSuppressColumnSpanDescendants(aParentFrame)) { newFrame->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
newFrame->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
}
} }
// Process the child content // Process the child content
@ -11068,8 +11025,7 @@ void nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
nsFrameList blockKids = nsFrameList blockKids =
aChildList.Split([](nsIFrame* f) { return !f->IsBlockOutside(); }); aChildList.Split([](nsIFrame* f) { return !f->IsBlockOutside(); });
if (!StaticPrefs::layout_css_column_span_enabled() || if (!aInitialInline->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) {
!aInitialInline->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR)) {
MoveChildrenTo(aInitialInline, blockFrame, blockKids); MoveChildrenTo(aInitialInline, blockFrame, blockKids);
SetFrameIsIBSplit(lastNewInline, blockFrame); SetFrameIsIBSplit(lastNewInline, blockFrame);

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

@ -1750,16 +1750,12 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// ColumnSetWrapperFrame (which would have been the parent of // ColumnSetWrapperFrame (which would have been the parent of
// aColumnContent if we were not creating a column hierarchy). // aColumnContent if we were not creating a column hierarchy).
// @param aContent is the content of the aColumnContent. // @param aContent is the content of the aColumnContent.
// @return the outermost ColumnSetWrapperFrame (or ColumnSetFrame if // @return the outermost ColumnSetWrapperFrame.
// "column-span" is disabled). nsBlockFrame* BeginBuildingColumns(nsFrameConstructorState& aState,
// nsIContent* aContent,
// Bug 1499281: We can change the return type to ColumnSetWrapperFrame nsContainerFrame* aParentFrame,
// once "layout.css.column-span.enabled" is removed. nsContainerFrame* aColumnContent,
nsContainerFrame* BeginBuildingColumns(nsFrameConstructorState& aState, ComputedStyle* aComputedStyle);
nsIContent* aContent,
nsContainerFrame* aParentFrame,
nsContainerFrame* aColumnContent,
ComputedStyle* aComputedStyle);
// Complete building the column hierarchy by first wrapping each // Complete building the column hierarchy by first wrapping each
// non-column-span child in aChildList in a ColumnSetFrame (skipping // non-column-span child in aChildList in a ColumnSetFrame (skipping
@ -1773,8 +1769,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// @param aColumnContentSiblings contains the aColumnContent's siblings, which // @param aColumnContentSiblings contains the aColumnContent's siblings, which
// are the column spanners and aColumnContent's continuations returned // are the column spanners and aColumnContent's continuations returned
// by CreateColumnSpanSiblings(). It'll become empty after this call. // by CreateColumnSpanSiblings(). It'll become empty after this call.
//
// Note: No need to call this function if "column-span" is disabled.
void FinishBuildingColumns(nsFrameConstructorState& aState, void FinishBuildingColumns(nsFrameConstructorState& aState,
nsContainerFrame* aColumnSetWrapper, nsContainerFrame* aColumnSetWrapper,
nsContainerFrame* aColumnContent, nsContainerFrame* aColumnContent,