diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
commit | 9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/generic/ColumnSetWrapperFrame.h | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/generic/ColumnSetWrapperFrame.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/layout/generic/ColumnSetWrapperFrame.h b/layout/generic/ColumnSetWrapperFrame.h new file mode 100644 index 0000000000..e219348189 --- /dev/null +++ b/layout/generic/ColumnSetWrapperFrame.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// A frame for CSS multi-column layout that wraps nsColumnSetFrames and +// column-span frames. + +#ifndef mozilla_ColumnSetWrapperFrame_h +#define mozilla_ColumnSetWrapperFrame_h + +#include "nsBlockFrame.h" + +namespace mozilla { + +class PresShell; + +// This class is a wrapper for nsColumnSetFrames and column-span frame. +// Essentially, we divide the *original* nsColumnSetFrame into multiple +// nsColumnSetFrames on the basis of the number and position of spanning +// elements. +// +// This wrapper is necessary for implementing column-span as it allows us to +// maintain each nsColumnSetFrame as an independent set of columns, and each +// column-span element then becomes just a block level element. +// +class ColumnSetWrapperFrame final : public nsBlockFrame { + public: + NS_DECL_FRAMEARENA_HELPERS(ColumnSetWrapperFrame) + NS_DECL_QUERYFRAME + + friend nsBlockFrame* ::NS_NewColumnSetWrapperFrame( + mozilla::PresShell* aPresShell, ComputedStyle* aStyle, + nsFrameState aStateFlags); + + void Init(nsIContent* aContent, nsContainerFrame* aParent, + nsIFrame* aPrevInFlow) override; + + nsContainerFrame* GetContentInsertionFrame() override; + + void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; + +#ifdef DEBUG_FRAME_DUMP + nsresult GetFrameName(nsAString& aResult) const override; +#endif + + void AppendFrames(ChildListID aListID, nsFrameList&& aFrameList) override; + + void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame, + const nsLineList::iterator* aPrevFrameLine, + nsFrameList&& aFrameList) override; + + void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override; + + void MarkIntrinsicISizesDirty() override; + + nscoord GetMinISize(gfxContext* aRenderingContext) override; + + nscoord GetPrefISize(gfxContext* aRenderingContext) override; + + Maybe<nscoord> GetNaturalBaselineBOffset( + WritingMode aWM, BaselineSharingGroup aBaselineGroup, + BaselineExportContext aExportContext) const override; + + private: + explicit ColumnSetWrapperFrame(ComputedStyle* aStyle, + nsPresContext* aPresContext); + ~ColumnSetWrapperFrame() override = default; + +#ifdef DEBUG + static void AssertColumnSpanWrapperSubtreeIsSane(const nsIFrame* aFrame); + + // True if frame constructor has finished building this frame and all of + // its descendants. + bool mFinishedBuildingColumns = false; +#endif + + template <typename Iterator> + Maybe<nscoord> GetBaselineBOffset(Iterator aStart, Iterator aEnd, + WritingMode aWM, + BaselineSharingGroup aBaselineGroup, + BaselineExportContext aExportContext) const; +}; + +} // namespace mozilla + +#endif // mozilla_ColumnSetWrapperFrame_h |