|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 #ifndef nsLeafBoxFrame_h___ |
|
6 #define nsLeafBoxFrame_h___ |
|
7 |
|
8 #include "mozilla/Attributes.h" |
|
9 #include "nsLeafFrame.h" |
|
10 #include "nsBox.h" |
|
11 |
|
12 class nsAccessKeyInfo; |
|
13 |
|
14 class nsLeafBoxFrame : public nsLeafFrame |
|
15 { |
|
16 public: |
|
17 NS_DECL_FRAMEARENA_HELPERS |
|
18 |
|
19 friend nsIFrame* NS_NewLeafBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
20 |
|
21 virtual nsSize GetPrefSize(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
22 virtual nsSize GetMinSize(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
23 virtual nsSize GetMaxSize(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
24 virtual nscoord GetFlex(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
25 virtual nscoord GetBoxAscent(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
26 |
|
27 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
28 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
|
29 { |
|
30 // This is bogus, but it's what we've always done. |
|
31 // Note that nsLeafFrame is also eReplacedContainsBlock. |
|
32 return nsLeafFrame::IsFrameOfType(aFlags & |
|
33 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock | nsIFrame::eXULBox)); |
|
34 } |
|
35 |
|
36 #ifdef DEBUG_FRAME_DUMP |
|
37 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; |
|
38 #endif |
|
39 |
|
40 // nsIHTMLReflow overrides |
|
41 |
|
42 virtual void MarkIntrinsicWidthsDirty() MOZ_OVERRIDE; |
|
43 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
|
44 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
|
45 |
|
46 // Our auto size is that provided by nsFrame, not nsLeafFrame |
|
47 virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, |
|
48 nsSize aCBSize, nscoord aAvailableWidth, |
|
49 nsSize aMargin, nsSize aBorder, |
|
50 nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; |
|
51 |
|
52 virtual nsresult Reflow(nsPresContext* aPresContext, |
|
53 nsHTMLReflowMetrics& aDesiredSize, |
|
54 const nsHTMLReflowState& aReflowState, |
|
55 nsReflowStatus& aStatus) MOZ_OVERRIDE; |
|
56 |
|
57 virtual nsresult CharacterDataChanged(CharacterDataChangeInfo* aInfo) MOZ_OVERRIDE; |
|
58 |
|
59 virtual void Init(nsIContent* aContent, |
|
60 nsIFrame* aParent, |
|
61 nsIFrame* asPrevInFlow) MOZ_OVERRIDE; |
|
62 |
|
63 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
|
64 const nsRect& aDirtyRect, |
|
65 const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
|
66 |
|
67 virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
|
68 nsIAtom* aAttribute, |
|
69 int32_t aModType) MOZ_OVERRIDE; |
|
70 |
|
71 virtual bool ComputesOwnOverflowArea() MOZ_OVERRIDE { return false; } |
|
72 |
|
73 protected: |
|
74 |
|
75 NS_IMETHOD DoLayout(nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
76 |
|
77 #ifdef DEBUG_LAYOUT |
|
78 virtual void GetBoxName(nsAutoString& aName) MOZ_OVERRIDE; |
|
79 #endif |
|
80 |
|
81 virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; |
|
82 |
|
83 nsLeafBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext); |
|
84 |
|
85 private: |
|
86 |
|
87 void UpdateMouseThrough(); |
|
88 |
|
89 |
|
90 }; // class nsLeafBoxFrame |
|
91 |
|
92 #endif /* nsLeafBoxFrame_h___ */ |