Bug 1105571 Part 1: Change ConstructScrollableBlock and ConstructNonScrollableBlock to construct containers instead of blocks.
MozReview-Commit-ID: AFSjVz8MlVC
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -4899,17 +4899,17 @@ nsCSSFrameConstructor::ConstructScrollab
nsIFrame*
nsCSSFrameConstructor::ConstructScrollableBlockWithConstructor(
nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
nsContainerFrame* aParentFrame,
const nsStyleDisplay* aDisplay,
nsFrameItems& aFrameItems,
- BlockFrameCreationFunc aConstructor)
+ ContainerFrameCreationFunc aConstructor)
{
nsIContent* const content = aItem.mContent;
nsStyleContext* const styleContext = aItem.mStyleContext;
nsContainerFrame* newFrame = nullptr;
RefPtr<nsStyleContext> scrolledContentStyle
= BeginBuildingScrollFrame(aState, content, styleContext,
aState.GetGeometricParent(aDisplay, aParentFrame),
@@ -4951,17 +4951,17 @@ nsCSSFrameConstructor::ConstructNonScrol
nsIFrame*
nsCSSFrameConstructor::ConstructNonScrollableBlockWithConstructor(
nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
nsContainerFrame* aParentFrame,
const nsStyleDisplay* aDisplay,
nsFrameItems& aFrameItems,
- BlockFrameCreationFunc aConstructor)
+ ContainerFrameCreationFunc aConstructor)
{
nsStyleContext* const styleContext = aItem.mStyleContext;
// We want a block formatting context root in paginated contexts for
// every block that would be scrollable in a non-paginated context.
// We mark our blocks with a bit here if this condition is true, so
// we can check it later in nsFrame::ApplyPaginatedOverflowClipping.
bool clipPaginatedOverflow =
@@ -11111,30 +11111,30 @@ nsCSSFrameConstructor::ProcessChildren(n
nsContentUtils::eXUL_PROPERTIES,
message,
params, ArrayLength(params));
}
RefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock,
frameStyleContext);
- nsBlockFrame* blockFrame = NS_NewBlockFrame(mPresShell, blockSC);
+ nsContainerFrame* containerFrame = NS_NewBlockFrame(mPresShell, blockSC);
// We might, in theory, want to set NS_BLOCK_FLOAT_MGR and
// NS_BLOCK_MARGIN_ROOT, but I think it's a bad idea given that
// a real block placed here wouldn't get those set on it.
- InitAndRestoreFrame(aState, aContent, aFrame, blockFrame, false);
-
- NS_ASSERTION(!blockFrame->HasView(), "need to do view reparenting");
- ReparentFrames(this, blockFrame, aFrameItems);
-
- blockFrame->SetInitialChildList(kPrincipalList, aFrameItems);
+ InitAndRestoreFrame(aState, aContent, aFrame, containerFrame, false);
+
+ NS_ASSERTION(!containerFrame->HasView(), "need to do view reparenting");
+ ReparentFrames(this, containerFrame, aFrameItems);
+
+ containerFrame->SetInitialChildList(kPrincipalList, aFrameItems);
NS_ASSERTION(aFrameItems.IsEmpty(), "How did that happen?");
aFrameItems.Clear();
- aFrameItems.AddChild(blockFrame);
+ aFrameItems.AddChild(containerFrame);
aFrame->AddStateBits(NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK);
}
}
//----------------------------------------------------------------------
// Support for :first-line style
@@ -12232,29 +12232,29 @@ nsCSSFrameConstructor::CreateIBSiblings(
// is block-level.
NS_PRECONDITION(aChildItems.NotEmpty(), "Should have child items");
NS_PRECONDITION(!aChildItems.FirstChild()->IsInlineOutside(),
"Must have list starting with block");
// The initial run of blocks belongs to an anonymous block that we create
// right now. The anonymous block will be the parent of these block
// children of the inline.
- nsBlockFrame* blockFrame = NS_NewBlockFrame(mPresShell, blockSC);
- InitAndRestoreFrame(aState, content, parentFrame, blockFrame, false);
+ nsContainerFrame* containerFrame = NS_NewBlockFrame(mPresShell, blockSC);
+ InitAndRestoreFrame(aState, content, parentFrame, containerFrame, false);
// Find the first non-block child which defines the end of our block kids
// and the start of our next inline's kids
nsFrameList::FrameLinkEnumerator firstNonBlock =
FindFirstNonBlock(aChildItems);
nsFrameList blockKids = aChildItems.ExtractHead(firstNonBlock);
- MoveChildrenTo(aInitialInline, blockFrame, blockKids);
-
- SetFrameIsIBSplit(lastNewInline, blockFrame);
- aSiblings.AddChild(blockFrame);
+ MoveChildrenTo(aInitialInline, containerFrame, blockKids);
+
+ SetFrameIsIBSplit(lastNewInline, containerFrame);
+ aSiblings.AddChild(containerFrame);
// Now grab the initial inlines in aChildItems and put them into an inline
// frame.
nsInlineFrame* inlineFrame = NS_NewInlineFrame(mPresShell, styleContext);
InitAndRestoreFrame(aState, content, parentFrame, inlineFrame, false);
inlineFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT |
NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
if (aIsPositioned) {
@@ -12264,17 +12264,17 @@ nsCSSFrameConstructor::CreateIBSiblings(
if (aChildItems.NotEmpty()) {
nsFrameList::FrameLinkEnumerator firstBlock(aChildItems);
FindFirstBlock(firstBlock);
nsFrameList inlineKids = aChildItems.ExtractHead(firstBlock);
MoveChildrenTo(aInitialInline, inlineFrame, inlineKids);
}
- SetFrameIsIBSplit(blockFrame, inlineFrame);
+ SetFrameIsIBSplit(containerFrame, inlineFrame);
aSiblings.AddChild(inlineFrame);
lastNewInline = inlineFrame;
} while (aChildItems.NotEmpty());
SetFrameIsIBSplit(lastNewInline, nullptr);
}
void
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -1573,17 +1573,17 @@ private:
* function.
*/
nsIFrame* ConstructScrollableBlockWithConstructor(
nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
nsContainerFrame* aParentFrame,
const nsStyleDisplay* aDisplay,
nsFrameItems& aFrameItems,
- BlockFrameCreationFunc aConstructor);
+ ContainerFrameCreationFunc aConstructor);
/**
* Construct a non-scrollable block frame
*/
nsIFrame* ConstructNonScrollableBlock(nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
nsContainerFrame* aParentFrame,
const nsStyleDisplay* aDisplay,
@@ -1594,17 +1594,17 @@ private:
* function.
*/
nsIFrame* ConstructNonScrollableBlockWithConstructor(
nsFrameConstructorState& aState,
FrameConstructionItem& aItem,
nsContainerFrame* aParentFrame,
const nsStyleDisplay* aDisplay,
nsFrameItems& aFrameItems,
- BlockFrameCreationFunc aConstructor);
+ ContainerFrameCreationFunc aConstructor);
/**
* This adds FrameConstructionItem objects to aItemsToConstruct for the
* anonymous content returned by an nsIAnonymousContentCreator::
* CreateAnonymousContent implementation.
*/
void AddFCItemsForAnonymousContent(
nsFrameConstructorState& aState,
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -17,17 +17,17 @@ using namespace mozilla::dom;
NS_IMPL_FRAMEARENA_HELPERS(DetailsFrame)
NS_QUERYFRAME_HEAD(DetailsFrame)
NS_QUERYFRAME_ENTRY(DetailsFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
-nsBlockFrame*
+nsContainerFrame*
NS_NewDetailsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) DetailsFrame(aContext);
}
namespace mozilla {
DetailsFrame::DetailsFrame(nsStyleContext* aContext)
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -290,27 +290,27 @@ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVE
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowOutOfFlowsProperty)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(PushedFloatProperty)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OutsideBulletProperty)
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(InsideBulletProperty, nsBulletFrame)
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BlockEndEdgeOfChildrenProperty, nscoord)
//----------------------------------------------------------------------
-nsBlockFrame*
+nsContainerFrame*
NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsBlockFrame(aContext);
}
-nsBlockFrame*
+nsContainerFrame*
NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
nsStyleContext* aStyleContext)
{
- nsBlockFrame* blockFrame = NS_NewBlockFrame(aPresShell, aStyleContext);
+ nsContainerFrame* blockFrame = NS_NewBlockFrame(aPresShell, aStyleContext);
blockFrame->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
return blockFrame;
}
NS_IMPL_FRAMEARENA_HELPERS(nsBlockFrame)
nsBlockFrame::~nsBlockFrame()
{
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -94,18 +94,18 @@ public:
ConstLineIterator LinesEnd() const { return mLines.end(); }
ReverseLineIterator LinesRBegin() { return mLines.rbegin(); }
ReverseLineIterator LinesREnd() { return mLines.rend(); }
ConstReverseLineIterator LinesRBegin() const { return mLines.rbegin(); }
ConstReverseLineIterator LinesREnd() const { return mLines.rend(); }
LineIterator LinesBeginFrom(nsLineBox* aList) { return mLines.begin(aList); }
ReverseLineIterator LinesRBeginFrom(nsLineBox* aList) { return mLines.rbegin(aList); }
- friend nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
- nsStyleContext* aContext);
+ friend nsContainerFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
+ nsStyleContext* aContext);
// nsQueryFrame
NS_DECL_QUERYFRAME
// nsIFrame
void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -45,17 +45,17 @@ class ViewportFrame;
(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
// Factory methods for creating html layout objects
// Create a frame that supports "display: block" layout behavior
class nsBlockFrame;
-nsBlockFrame*
+nsContainerFrame*
NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
// Special Generated Content Node. It contains text taken from an
// attribute of its *grandparent* content node.
nsresult
NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
int32_t aNameSpaceID, nsIAtom* aAttrName,
nsIContent** aResult);
@@ -63,17 +63,17 @@ NS_NewAttributeContent(nsNodeInfoManager
// Create a basic area frame but the GetFrameForPoint is overridden to always
// return the option frame
// By default, area frames will extend
// their height to cover any children that "stick out".
nsContainerFrame*
NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aFlags);
// Create a block formatting context blockframe
-nsBlockFrame*
+nsContainerFrame*
NS_NewBlockFormattingContext(nsIPresShell* aPresShell, nsStyleContext* aStyleContext);
nsIFrame*
NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewCommentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
@@ -170,17 +170,17 @@ NS_NewProgressFrame(nsIPresShell* aPresS
nsIFrame*
NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewDateTimeControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
-nsBlockFrame*
+nsContainerFrame*
NS_NewDetailsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
// Table frame factories
class nsTableWrapperFrame;
nsTableWrapperFrame*
NS_NewTableWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
class nsTableFrame;
nsTableFrame*