DetailsFrame.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* -*- Mode: C++; tab-width: 8; 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 DetailsFrame_h
  6. #define DetailsFrame_h
  7. #include "nsBlockFrame.h"
  8. #include "nsIAnonymousContentCreator.h"
  9. class nsContainerFrame;
  10. class nsStyleContext;
  11. // DetailsFrame is generated by HTMLDetailsElement. See
  12. // nsCSSFrameConstructor::ConstructDetailsFrame for the structure of a
  13. // DetailsFrame.
  14. //
  15. class DetailsFrame final : public nsBlockFrame
  16. , public nsIAnonymousContentCreator
  17. {
  18. public:
  19. NS_DECL_FRAMEARENA_HELPERS
  20. NS_DECL_QUERYFRAME_TARGET(DetailsFrame)
  21. NS_DECL_QUERYFRAME
  22. explicit DetailsFrame(nsStyleContext* aContext);
  23. virtual ~DetailsFrame();
  24. nsIAtom* GetType() const override;
  25. #ifdef DEBUG_FRAME_DUMP
  26. nsresult GetFrameName(nsAString& aResult) const override
  27. {
  28. return MakeFrameName(NS_LITERAL_STRING("Details"), aResult);
  29. }
  30. #endif
  31. #ifdef DEBUG
  32. // Check the frame of the main summary element is the first child in the frame
  33. // list. Returns true if we found the main summary frame; false otherwise.
  34. bool CheckValidMainSummary(const nsFrameList& aFrameList) const;
  35. #endif
  36. void SetInitialChildList(ChildListID aListID,
  37. nsFrameList& aChildList) override;
  38. void DestroyFrom(nsIFrame* aDestructRoot) override;
  39. // nsIAnonymousContentCreator
  40. nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
  41. void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
  42. uint32_t aFilter) override;
  43. // Returns true if |aSummaryFrame| is the main summary (i.e. the first child
  44. // of this details frame).
  45. // This function is used when the summary element is removed from the parent
  46. // details element since at that moment the summary element has been already
  47. // removed from the details element children.
  48. bool HasMainSummaryFrame(nsIFrame* aSummaryFrame);
  49. private:
  50. nsCOMPtr<nsIContent> mDefaultSummary;
  51. };
  52. #endif // DetailsFrame_h