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 FrameChildList_h_
8 #define FrameChildList_h_
9 
10 #include "mozilla/EnumSet.h"
11 #include "nsFrameList.h"
12 #include "nsTArray.h"
13 
14 class nsIFrame;
15 
16 namespace mozilla {
17 namespace layout {
18 
19 // enum FrameChildListID lives in nsFrameList.h to solve circular dependencies.
20 
21 #ifdef DEBUG_FRAME_DUMP
22 extern const char* ChildListName(FrameChildListID aListID);
23 #endif
24 
25 using FrameChildListIDs = EnumSet<FrameChildListID>;
26 
27 class FrameChildList {
28  public:
FrameChildList(const nsFrameList & aList,FrameChildListID aID)29   FrameChildList(const nsFrameList& aList, FrameChildListID aID)
30       : mList(aList), mID(aID) {}
31   nsFrameList mList;
32   FrameChildListID mID;
33 };
34 
35 }  // namespace layout
36 }  // namespace mozilla
37 
AppendIfNonempty(nsTArray<mozilla::layout::FrameChildList> * aLists,mozilla::layout::FrameChildListID aListID)38 inline void nsFrameList::AppendIfNonempty(
39     nsTArray<mozilla::layout::FrameChildList>* aLists,
40     mozilla::layout::FrameChildListID aListID) const {
41   if (NotEmpty()) {
42     aLists->EmplaceBack(*this, aListID);
43   }
44 }
45 
46 #endif /* !defined(FrameChildList_h_) */
47