Backed out changeset f53842753805 (bug 1804872) for causing reftest failures on 15535...
[gecko.git] / layout / generic / nsFirstLetterFrame.h
blobf17d28f8e5293b3bcfc11337022809d4dc78de83
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 http://mozilla.org/MPL/2.0/. */
7 #ifndef nsFirstLetterFrame_h__
8 #define nsFirstLetterFrame_h__
10 /* rendering object for CSS :first-letter pseudo-element */
12 #include "mozilla/Attributes.h"
13 #include "nsContainerFrame.h"
15 class nsFirstLetterFrame final : public nsContainerFrame {
16 public:
17 NS_DECL_QUERYFRAME
18 NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
20 explicit nsFirstLetterFrame(ComputedStyle* aStyle,
21 nsPresContext* aPresContext)
22 : nsContainerFrame(aStyle, aPresContext, kClassID) {}
24 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
25 const nsDisplayListSet& aLists) override;
27 virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
28 nsIFrame* aPrevInFlow) override;
29 void SetInitialChildList(ChildListID aListID,
30 nsFrameList&& aChildList) override;
31 #ifdef DEBUG_FRAME_DUMP
32 virtual nsresult GetFrameName(nsAString& aResult) const override;
33 #endif
35 bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW); }
37 virtual bool IsFrameOfType(uint32_t aFlags) const override {
38 if (!IsFloating()) aFlags = aFlags & ~(nsIFrame::eLineParticipant);
39 return nsContainerFrame::IsFrameOfType(aFlags &
40 ~(nsIFrame::eBidiInlineContainer));
43 virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
44 virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
45 virtual void AddInlineMinISize(gfxContext* aRenderingContext,
46 InlineMinISizeData* aData) override;
47 virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
48 InlinePrefISizeData* aData) override;
50 SizeComputationResult ComputeSize(
51 gfxContext* aRenderingContext, mozilla::WritingMode aWM,
52 const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
53 const mozilla::LogicalSize& aMargin,
54 const mozilla::LogicalSize& aBorderPadding,
55 const mozilla::StyleSizeOverrides& aSizeOverrides,
56 mozilla::ComputeSizeFlags aFlags) override;
58 virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
59 const ReflowInput& aReflowInput,
60 nsReflowStatus& aStatus) override;
62 virtual bool CanContinueTextRun() const override;
63 Maybe<nscoord> GetNaturalBaselineBOffset(
64 mozilla::WritingMode aWM,
65 BaselineSharingGroup aBaselineGroup) const override;
66 virtual LogicalSides GetLogicalSkipSides() const override;
68 // override of nsFrame method
69 virtual nsresult GetChildFrameContainingOffset(
70 int32_t inContentOffset, bool inHint, int32_t* outFrameContentOffset,
71 nsIFrame** outChildFrame) override;
73 nscoord GetFirstLetterBaseline() const { return mBaseline; }
75 // For floating first letter frames, create a continuation for aChild and
76 // place it in the correct place. aContinuation is an outparam for the
77 // continuation that is created. aIsFluid determines if the continuation is
78 // fluid or not.
79 void CreateContinuationForFloatingParent(nsIFrame* aChild,
80 nsIFrame** aContinuation,
81 bool aIsFluid);
83 // Whether to use tight glyph bounds for a floating first-letter frame,
84 // or "loose" bounds based on font metrics rather than individual glyphs.
85 bool UseTightBounds() const;
87 protected:
88 nscoord mBaseline;
90 void DrainOverflowFrames(nsPresContext* aPresContext);
93 #endif /* nsFirstLetterFrame_h__ */