1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/nsStyleChangeList.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * a list of the recomputation that needs to be done in response to a 1.11 + * style change 1.12 + */ 1.13 + 1.14 +#ifndef nsStyleChangeList_h___ 1.15 +#define nsStyleChangeList_h___ 1.16 + 1.17 +#include "mozilla/Attributes.h" 1.18 + 1.19 +#include "nsError.h" 1.20 +#include "nsChangeHint.h" 1.21 + 1.22 +class nsIFrame; 1.23 +class nsIContent; 1.24 + 1.25 +// XXX would all platforms support putting this inside the list? 1.26 +struct nsStyleChangeData { 1.27 + nsIFrame* mFrame; 1.28 + nsIContent* mContent; 1.29 + nsChangeHint mHint; 1.30 +}; 1.31 + 1.32 +static const uint32_t kStyleChangeBufferSize = 10; 1.33 + 1.34 +// Note: nsStyleChangeList owns a reference to 1.35 +// nsIContent pointers in its list. 1.36 +class nsStyleChangeList { 1.37 +public: 1.38 + nsStyleChangeList(); 1.39 + ~nsStyleChangeList(); 1.40 + 1.41 + int32_t Count(void) const { 1.42 + return mCount; 1.43 + } 1.44 + 1.45 + /** 1.46 + * Fills in pointers without reference counting. 1.47 + */ 1.48 + nsresult ChangeAt(int32_t aIndex, nsIFrame*& aFrame, nsIContent*& aContent, 1.49 + nsChangeHint& aHint) const; 1.50 + 1.51 + /** 1.52 + * Fills in a pointer to the list entry storage (no reference counting 1.53 + * involved). 1.54 + */ 1.55 + nsresult ChangeAt(int32_t aIndex, const nsStyleChangeData** aChangeData) const; 1.56 + 1.57 + nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint); 1.58 + 1.59 + void Clear(void); 1.60 + 1.61 +protected: 1.62 + nsStyleChangeList& operator=(const nsStyleChangeList& aCopy); 1.63 + bool operator==(const nsStyleChangeList& aOther) const; 1.64 + 1.65 + nsStyleChangeData* mArray; 1.66 + int32_t mArraySize; 1.67 + int32_t mCount; 1.68 + nsStyleChangeData mBuffer[kStyleChangeBufferSize]; 1.69 + 1.70 +private: 1.71 + nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE; 1.72 +}; 1.73 + 1.74 + 1.75 +#endif /* nsStyleChangeList_h___ */