layout/base/nsStyleChangeList.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:fa25c6b76e48
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
6 /*
7 * a list of the recomputation that needs to be done in response to a
8 * style change
9 */
10
11 #ifndef nsStyleChangeList_h___
12 #define nsStyleChangeList_h___
13
14 #include "mozilla/Attributes.h"
15
16 #include "nsError.h"
17 #include "nsChangeHint.h"
18
19 class nsIFrame;
20 class nsIContent;
21
22 // XXX would all platforms support putting this inside the list?
23 struct nsStyleChangeData {
24 nsIFrame* mFrame;
25 nsIContent* mContent;
26 nsChangeHint mHint;
27 };
28
29 static const uint32_t kStyleChangeBufferSize = 10;
30
31 // Note: nsStyleChangeList owns a reference to
32 // nsIContent pointers in its list.
33 class nsStyleChangeList {
34 public:
35 nsStyleChangeList();
36 ~nsStyleChangeList();
37
38 int32_t Count(void) const {
39 return mCount;
40 }
41
42 /**
43 * Fills in pointers without reference counting.
44 */
45 nsresult ChangeAt(int32_t aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
46 nsChangeHint& aHint) const;
47
48 /**
49 * Fills in a pointer to the list entry storage (no reference counting
50 * involved).
51 */
52 nsresult ChangeAt(int32_t aIndex, const nsStyleChangeData** aChangeData) const;
53
54 nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
55
56 void Clear(void);
57
58 protected:
59 nsStyleChangeList& operator=(const nsStyleChangeList& aCopy);
60 bool operator==(const nsStyleChangeList& aOther) const;
61
62 nsStyleChangeData* mArray;
63 int32_t mArraySize;
64 int32_t mCount;
65 nsStyleChangeData mBuffer[kStyleChangeBufferSize];
66
67 private:
68 nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE;
69 };
70
71
72 #endif /* nsStyleChangeList_h___ */

mercurial