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/. */
6 #ifndef nsLeafBoxFrame_h___
7 #define nsLeafBoxFrame_h___
8 
9 #include "mozilla/Attributes.h"
10 #include "nsLeafFrame.h"
11 
12 namespace mozilla {
13 class PresShell;
14 }  // namespace mozilla
15 
16 class nsLeafBoxFrame : public nsLeafFrame {
17  public:
18   NS_DECL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
19 
20   friend nsIFrame* NS_NewLeafBoxFrame(mozilla::PresShell* aPresShell,
21                                       ComputedStyle* aStyle);
22 
23   virtual nsSize GetXULPrefSize(nsBoxLayoutState& aState) override;
24   virtual nsSize GetXULMinSize(nsBoxLayoutState& aState) override;
25   virtual nsSize GetXULMaxSize(nsBoxLayoutState& aState) override;
26   virtual nscoord GetXULFlex() override;
27   virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aState) override;
28 
IsFrameOfType(uint32_t aFlags)29   virtual bool IsFrameOfType(uint32_t aFlags) const override {
30     // This is bogus, but it's what we've always done.
31     // Note that nsLeafFrame is also eReplacedContainsBlock.
32     return nsLeafFrame::IsFrameOfType(
33         aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock |
34                    nsIFrame::eXULBox));
35   }
36 
37 #ifdef DEBUG_FRAME_DUMP
38   virtual nsresult GetFrameName(nsAString& aResult) const override;
39 #endif
40 
41   // nsIHTMLReflow overrides
42 
43   virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
44   virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
45 
46   // Our auto size is that provided by nsFrame, not nsLeafFrame
47   virtual mozilla::LogicalSize ComputeAutoSize(
48       gfxContext* aRenderingContext, mozilla::WritingMode aWM,
49       const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
50       const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
51       const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
52 
53   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
54                       const ReflowInput& aReflowInput,
55                       nsReflowStatus& aStatus) override;
56 
57   virtual nsresult CharacterDataChanged(
58       const CharacterDataChangeInfo&) override;
59 
60   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
61                     nsIFrame* asPrevInFlow) override;
62 
63   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
64                                 const nsDisplayListSet& aLists) override;
65 
XULComputesOwnOverflowArea()66   virtual bool XULComputesOwnOverflowArea() override { return false; }
67 
68  protected:
69   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
70 
71   virtual nscoord GetIntrinsicISize() override;
72 
73   explicit nsLeafBoxFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
74                           ClassID aID = kClassID)
nsLeafFrame(aStyle,aPresContext,aID)75       : nsLeafFrame(aStyle, aPresContext, aID) {}
76 
77 };  // class nsLeafBoxFrame
78 
79 #endif /* nsLeafBoxFrame_h___ */
80