gecko-dev/layout/base/nsStyleChangeList.h

73 lines
1.8 KiB
C
Raw Normal View History

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