Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * a list of the recomputation that needs to be done in response to a |
michael@0 | 8 | * style change |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #ifndef nsStyleChangeList_h___ |
michael@0 | 12 | #define nsStyleChangeList_h___ |
michael@0 | 13 | |
michael@0 | 14 | #include "mozilla/Attributes.h" |
michael@0 | 15 | |
michael@0 | 16 | #include "nsError.h" |
michael@0 | 17 | #include "nsChangeHint.h" |
michael@0 | 18 | |
michael@0 | 19 | class nsIFrame; |
michael@0 | 20 | class nsIContent; |
michael@0 | 21 | |
michael@0 | 22 | // XXX would all platforms support putting this inside the list? |
michael@0 | 23 | struct nsStyleChangeData { |
michael@0 | 24 | nsIFrame* mFrame; |
michael@0 | 25 | nsIContent* mContent; |
michael@0 | 26 | nsChangeHint mHint; |
michael@0 | 27 | }; |
michael@0 | 28 | |
michael@0 | 29 | static const uint32_t kStyleChangeBufferSize = 10; |
michael@0 | 30 | |
michael@0 | 31 | // Note: nsStyleChangeList owns a reference to |
michael@0 | 32 | // nsIContent pointers in its list. |
michael@0 | 33 | class nsStyleChangeList { |
michael@0 | 34 | public: |
michael@0 | 35 | nsStyleChangeList(); |
michael@0 | 36 | ~nsStyleChangeList(); |
michael@0 | 37 | |
michael@0 | 38 | int32_t Count(void) const { |
michael@0 | 39 | return mCount; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | /** |
michael@0 | 43 | * Fills in pointers without reference counting. |
michael@0 | 44 | */ |
michael@0 | 45 | nsresult ChangeAt(int32_t aIndex, nsIFrame*& aFrame, nsIContent*& aContent, |
michael@0 | 46 | nsChangeHint& aHint) const; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Fills in a pointer to the list entry storage (no reference counting |
michael@0 | 50 | * involved). |
michael@0 | 51 | */ |
michael@0 | 52 | nsresult ChangeAt(int32_t aIndex, const nsStyleChangeData** aChangeData) const; |
michael@0 | 53 | |
michael@0 | 54 | nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint); |
michael@0 | 55 | |
michael@0 | 56 | void Clear(void); |
michael@0 | 57 | |
michael@0 | 58 | protected: |
michael@0 | 59 | nsStyleChangeList& operator=(const nsStyleChangeList& aCopy); |
michael@0 | 60 | bool operator==(const nsStyleChangeList& aOther) const; |
michael@0 | 61 | |
michael@0 | 62 | nsStyleChangeData* mArray; |
michael@0 | 63 | int32_t mArraySize; |
michael@0 | 64 | int32_t mCount; |
michael@0 | 65 | nsStyleChangeData mBuffer[kStyleChangeBufferSize]; |
michael@0 | 66 | |
michael@0 | 67 | private: |
michael@0 | 68 | nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | |
michael@0 | 72 | #endif /* nsStyleChangeList_h___ */ |