/src/mozilla-central/layout/base/nsStyleChangeList.h
Line | Count | Source (jump to first uncovered line) |
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 | | /* |
8 | | * a list of the recomputation that needs to be done in response to a |
9 | | * style change |
10 | | */ |
11 | | |
12 | | #ifndef nsStyleChangeList_h___ |
13 | | #define nsStyleChangeList_h___ |
14 | | |
15 | | #include "mozilla/Attributes.h" |
16 | | |
17 | | #include "nsChangeHint.h" |
18 | | #include "nsCOMPtr.h" |
19 | | |
20 | | class nsIFrame; |
21 | | class nsIContent; |
22 | | |
23 | | struct nsStyleChangeData |
24 | | { |
25 | | nsIFrame* mFrame; // weak |
26 | | nsCOMPtr<nsIContent> mContent; |
27 | | nsChangeHint mHint; |
28 | | }; |
29 | | |
30 | | class nsStyleChangeList : private AutoTArray<nsStyleChangeData, 10> |
31 | | { |
32 | | typedef AutoTArray<nsStyleChangeData, 10> base_type; |
33 | | nsStyleChangeList(const nsStyleChangeList&) = delete; |
34 | | |
35 | | public: |
36 | | using base_type::begin; |
37 | | using base_type::end; |
38 | | using base_type::IsEmpty; |
39 | | using base_type::Clear; |
40 | | using base_type::Length; |
41 | | using base_type::operator[]; |
42 | | |
43 | 0 | nsStyleChangeList() { |
44 | 0 | MOZ_COUNT_CTOR(nsStyleChangeList); |
45 | 0 | } |
46 | 0 | ~nsStyleChangeList() { MOZ_COUNT_DTOR(nsStyleChangeList); } |
47 | | void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint); |
48 | | |
49 | | // Starting from the end of the list, removes all changes until the list is |
50 | | // empty or an element with |mContent != aContent| is found. |
51 | | void PopChangesForContent(nsIContent* aContent) |
52 | 0 | { |
53 | 0 | while (!IsEmpty() && LastElement().mContent == aContent) { |
54 | 0 | RemoveLastElement(); |
55 | 0 | } |
56 | 0 | } |
57 | | }; |
58 | | |
59 | | #endif /* nsStyleChangeList_h___ */ |