nsLeafBoxFrame.h 3.3 KB

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