1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 // A frame for CSS multi-column layout that wraps nsColumnSetFrames and
10 #ifndef mozilla_ColumnSetWrapperFrame_h
11 #define mozilla_ColumnSetWrapperFrame_h
13 #include "nsBlockFrame.h"
19 // This class is a wrapper for nsColumnSetFrames and column-span frame.
20 // Essentially, we divide the *original* nsColumnSetFrame into multiple
21 // nsColumnSetFrames on the basis of the number and position of spanning
24 // This wrapper is necessary for implementing column-span as it allows us to
25 // maintain each nsColumnSetFrame as an independent set of columns, and each
26 // column-span element then becomes just a block level element.
28 class ColumnSetWrapperFrame final
: public nsBlockFrame
{
30 NS_DECL_FRAMEARENA_HELPERS(ColumnSetWrapperFrame
)
33 friend nsBlockFrame
* ::NS_NewColumnSetWrapperFrame(
34 mozilla::PresShell
* aPresShell
, ComputedStyle
* aStyle
,
35 nsFrameState aStateFlags
);
37 void Init(nsIContent
* aContent
, nsContainerFrame
* aParent
,
38 nsIFrame
* aPrevInFlow
) override
;
40 nsContainerFrame
* GetContentInsertionFrame() override
;
42 void AppendDirectlyOwnedAnonBoxes(nsTArray
<OwnedAnonBox
>& aResult
) override
;
44 #ifdef DEBUG_FRAME_DUMP
45 nsresult
GetFrameName(nsAString
& aResult
) const override
;
48 void AppendFrames(ChildListID aListID
, nsFrameList
& aFrameList
) override
;
50 void InsertFrames(ChildListID aListID
, nsIFrame
* aPrevFrame
,
51 const nsLineList::iterator
* aPrevFrameLine
,
52 nsFrameList
& aFrameList
) override
;
54 void RemoveFrame(ChildListID aListID
, nsIFrame
* aOldFrame
) override
;
56 void MarkIntrinsicISizesDirty() override
;
58 nscoord
GetMinISize(gfxContext
* aRenderingContext
) override
;
60 nscoord
GetPrefISize(gfxContext
* aRenderingContext
) override
;
63 explicit ColumnSetWrapperFrame(ComputedStyle
* aStyle
,
64 nsPresContext
* aPresContext
);
65 ~ColumnSetWrapperFrame() override
= default;
68 static void AssertColumnSpanWrapperSubtreeIsSane(const nsIFrame
* aFrame
);
70 // True if frame constructor has finished building this frame and all of
72 bool mFinishedBuildingColumns
= false;
76 } // namespace mozilla
78 #endif // mozilla_ColumnSetWrapperFrame_h