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/. */
10 #include "nsBlockFrame.h"
11 #include "nsIAnonymousContentCreator.h"
13 class nsContainerFrame
;
17 // DetailsFrame is generated by HTMLDetailsElement. See
18 // nsCSSFrameConstructor::ConstructDetailsFrame for the structure of a
21 class DetailsFrame final
: public nsBlockFrame
,
22 public nsIAnonymousContentCreator
{
24 NS_DECL_FRAMEARENA_HELPERS(DetailsFrame
)
27 explicit DetailsFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
);
29 virtual ~DetailsFrame();
31 #ifdef DEBUG_FRAME_DUMP
32 nsresult
GetFrameName(nsAString
& aResult
) const override
{
33 return MakeFrameName(u
"Details"_ns
, aResult
);
38 // Check the frame of the main summary element is the first child in the frame
39 // list. Returns true if we found the main summary frame; false otherwise.
40 bool CheckValidMainSummary(const nsFrameList
& aFrameList
) const;
43 void SetInitialChildList(ChildListID aListID
,
44 nsFrameList
& aChildList
) override
;
46 void DestroyFrom(nsIFrame
* aDestructRoot
,
47 PostDestroyData
& aPostDestroyData
) override
;
49 // nsIAnonymousContentCreator
50 nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) override
;
52 void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
53 uint32_t aFilter
) override
;
54 // Returns true if |aSummaryFrame| is the main summary (i.e. the first child
55 // of this details frame).
56 // This function is used when the summary element is removed from the parent
57 // details element since at that moment the summary element has been already
58 // removed from the details element children.
59 bool HasMainSummaryFrame(nsIFrame
* aSummaryFrame
);
62 nsCOMPtr
<nsIContent
> mDefaultSummary
;
65 } // namespace mozilla
67 #endif // DetailsFrame_h