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