nsFieldSetFrame.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 nsFieldSetFrame_h___
  6. #define nsFieldSetFrame_h___
  7. #include "mozilla/Attributes.h"
  8. #include "DrawResult.h"
  9. #include "nsContainerFrame.h"
  10. class nsFieldSetFrame final : public nsContainerFrame
  11. {
  12. typedef mozilla::image::DrawResult DrawResult;
  13. public:
  14. NS_DECL_FRAMEARENA_HELPERS
  15. explicit nsFieldSetFrame(nsStyleContext* aContext);
  16. nscoord
  17. GetIntrinsicISize(nsRenderingContext* aRenderingContext,
  18. nsLayoutUtils::IntrinsicISizeType);
  19. virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
  20. virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
  21. virtual mozilla::LogicalSize
  22. ComputeSize(nsRenderingContext *aRenderingContext,
  23. mozilla::WritingMode aWritingMode,
  24. const mozilla::LogicalSize& aCBSize,
  25. nscoord aAvailableISize,
  26. const mozilla::LogicalSize& aMargin,
  27. const mozilla::LogicalSize& aBorder,
  28. const mozilla::LogicalSize& aPadding,
  29. ComputeSizeFlags aFlags) override;
  30. /**
  31. * The area to paint box-shadows around. It's the border rect except
  32. * when there's a <legend> we offset the y-position to the center of it.
  33. */
  34. virtual nsRect VisualBorderRectRelativeToSelf() const override;
  35. virtual void Reflow(nsPresContext* aPresContext,
  36. ReflowOutput& aDesiredSize,
  37. const ReflowInput& aReflowInput,
  38. nsReflowStatus& aStatus) override;
  39. nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override;
  40. bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
  41. nscoord* aBaseline) const override;
  42. bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
  43. BaselineSharingGroup aBaselineGroup,
  44. nscoord* aBaseline) const override;
  45. virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
  46. const nsDisplayListSet& aLists) override;
  47. DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
  48. nsRenderingContext& aRenderingContext,
  49. nsPoint aPt, const nsRect& aDirtyRect);
  50. #ifdef DEBUG
  51. virtual void SetInitialChildList(ChildListID aListID,
  52. nsFrameList& aChildList) override;
  53. virtual void AppendFrames(ChildListID aListID,
  54. nsFrameList& aFrameList) override;
  55. virtual void InsertFrames(ChildListID aListID,
  56. nsIFrame* aPrevFrame,
  57. nsFrameList& aFrameList) override;
  58. virtual void RemoveFrame(ChildListID aListID,
  59. nsIFrame* aOldFrame) override;
  60. #endif
  61. virtual nsIAtom* GetType() const override;
  62. virtual bool IsFrameOfType(uint32_t aFlags) const override
  63. {
  64. return nsContainerFrame::IsFrameOfType(aFlags &
  65. ~nsIFrame::eCanContainOverflowContainers);
  66. }
  67. virtual nsIScrollableFrame* GetScrollTargetFrame() override
  68. {
  69. return do_QueryFrame(GetInner());
  70. }
  71. #ifdef ACCESSIBILITY
  72. virtual mozilla::a11y::AccType AccessibleType() override;
  73. #endif
  74. #ifdef DEBUG_FRAME_DUMP
  75. virtual nsresult GetFrameName(nsAString& aResult) const override {
  76. return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
  77. }
  78. #endif
  79. /**
  80. * Return the anonymous frame that contains all descendants except
  81. * the legend frame. This is currently always a block frame with
  82. * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the
  83. * future when we add support for CSS overflow for <fieldset>.
  84. */
  85. nsIFrame* GetInner() const;
  86. /**
  87. * Return the frame that represents the legend if any. This may be
  88. * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the
  89. * scrolled frame (aka content insertion frame).
  90. */
  91. nsIFrame* GetLegend() const;
  92. protected:
  93. mozilla::LogicalRect mLegendRect;
  94. nscoord mLegendSpace;
  95. };
  96. #endif // nsFieldSetFrame_h___