Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / layout / base / nsStyleChangeList.h
blob9dd80509dd89fb5ba3726c13a4e0389592349ad5
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/. */
7 /*
8 * a list of the recomputation that needs to be done in response to a
9 * style change
12 #ifndef nsStyleChangeList_h___
13 #define nsStyleChangeList_h___
15 #include "mozilla/Attributes.h"
17 #include "nsChangeHint.h"
18 #include "nsCOMPtr.h"
19 #include "nsTArray.h"
21 class nsIFrame;
22 class nsIContent;
24 struct nsStyleChangeData {
25 nsIFrame* mFrame; // weak
26 nsCOMPtr<nsIContent> mContent;
27 nsChangeHint mHint;
30 class nsStyleChangeList : private AutoTArray<nsStyleChangeData, 10> {
31 typedef AutoTArray<nsStyleChangeData, 10> base_type;
32 nsStyleChangeList(const nsStyleChangeList&) = delete;
34 public:
35 using base_type::begin;
36 using base_type::Clear;
37 using base_type::end;
38 using base_type::IsEmpty;
39 using base_type::Length;
40 using base_type::operator[];
42 MOZ_COUNTED_DEFAULT_CTOR(nsStyleChangeList)
43 MOZ_COUNTED_DTOR(nsStyleChangeList)
44 void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
46 // Starting from the end of the list, removes all changes until the list is
47 // empty or an element with |mContent != aContent| is found.
48 void PopChangesForContent(nsIContent* aContent) {
49 while (!IsEmpty() && LastElement().mContent == aContent) {
50 RemoveLastElement();
55 #endif /* nsStyleChangeList_h___ */