michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * a list of the recomputation that needs to be done in response to a michael@0: * style change michael@0: */ michael@0: michael@0: #ifndef nsStyleChangeList_h___ michael@0: #define nsStyleChangeList_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #include "nsError.h" michael@0: #include "nsChangeHint.h" michael@0: michael@0: class nsIFrame; michael@0: class nsIContent; michael@0: michael@0: // XXX would all platforms support putting this inside the list? michael@0: struct nsStyleChangeData { michael@0: nsIFrame* mFrame; michael@0: nsIContent* mContent; michael@0: nsChangeHint mHint; michael@0: }; michael@0: michael@0: static const uint32_t kStyleChangeBufferSize = 10; michael@0: michael@0: // Note: nsStyleChangeList owns a reference to michael@0: // nsIContent pointers in its list. michael@0: class nsStyleChangeList { michael@0: public: michael@0: nsStyleChangeList(); michael@0: ~nsStyleChangeList(); michael@0: michael@0: int32_t Count(void) const { michael@0: return mCount; michael@0: } michael@0: michael@0: /** michael@0: * Fills in pointers without reference counting. michael@0: */ michael@0: nsresult ChangeAt(int32_t aIndex, nsIFrame*& aFrame, nsIContent*& aContent, michael@0: nsChangeHint& aHint) const; michael@0: michael@0: /** michael@0: * Fills in a pointer to the list entry storage (no reference counting michael@0: * involved). michael@0: */ michael@0: nsresult ChangeAt(int32_t aIndex, const nsStyleChangeData** aChangeData) const; michael@0: michael@0: nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint); michael@0: michael@0: void Clear(void); michael@0: michael@0: protected: michael@0: nsStyleChangeList& operator=(const nsStyleChangeList& aCopy); michael@0: bool operator==(const nsStyleChangeList& aOther) const; michael@0: michael@0: nsStyleChangeData* mArray; michael@0: int32_t mArraySize; michael@0: int32_t mCount; michael@0: nsStyleChangeData mBuffer[kStyleChangeBufferSize]; michael@0: michael@0: private: michael@0: nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE; michael@0: }; michael@0: michael@0: michael@0: #endif /* nsStyleChangeList_h___ */