|
|
|
|
| 5 |
|
5 |
|
| 6 |
/* |
6 |
/* |
| 7 |
* a list of the recomputation that needs to be done in response to a |
7 |
* a list of the recomputation that needs to be done in response to a |
| 8 |
* style change |
8 |
* style change |
| 9 |
*/ |
9 |
*/ |
| 10 |
|
10 |
|
| 11 |
#include "nsStyleChangeList.h" |
11 |
#include "nsStyleChangeList.h" |
| 12 |
#include "nsIContent.h" |
12 |
#include "nsIContent.h" |
|
|
13 |
#include "nsIFrame.h" |
| 14 |
#include "nsFrameManager.h" |
| 13 |
|
15 |
|
| 14 |
static const uint32_t kGrowArrayBy = 10; |
16 |
static const uint32_t kGrowArrayBy = 10; |
| 15 |
|
17 |
|
| 16 |
nsStyleChangeList::nsStyleChangeList() |
18 |
nsStyleChangeList::nsStyleChangeList() |
| 17 |
: mArray(mBuffer), |
19 |
: mArray(mBuffer), |
| 18 |
mArraySize(kStyleChangeBufferSize), |
20 |
mArraySize(kStyleChangeBufferSize), |
| 19 |
mCount(0) |
21 |
mCount(0) |
| 20 |
{ |
22 |
{ |
|
Lines 53-70
nsStyleChangeList::ChangeAt(int32_t aInd
|
Link Here
|
|---|
|
| 53 |
nsresult |
55 |
nsresult |
| 54 |
nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint) |
56 |
nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint) |
| 55 |
{ |
57 |
{ |
| 56 |
NS_ASSERTION(aFrame || (aHint & nsChangeHint_ReconstructFrame), |
58 |
NS_ASSERTION(aFrame || (aHint & nsChangeHint_ReconstructFrame), |
| 57 |
"must have frame"); |
59 |
"must have frame"); |
| 58 |
NS_ASSERTION(aContent || !(aHint & nsChangeHint_ReconstructFrame), |
60 |
NS_ASSERTION(aContent || !(aHint & nsChangeHint_ReconstructFrame), |
| 59 |
"must have content"); |
61 |
"must have content"); |
| 60 |
// XXXbz we should make this take Element instead of nsIContent |
62 |
// XXXbz we should make this take Element instead of nsIContent |
| 61 |
NS_ASSERTION(!aContent || aContent->IsElement(), |
63 |
NS_ASSERTION(!aContent || aContent->IsElement() || |
| 62 |
"Shouldn't be trying to restyle non-elements directly"); |
64 |
(aFrame && aContent->GetParent() && aFrame->PresContext()->FrameManager()->GetDisplayContents(aContent->GetParent())), |
|
|
65 |
"Shouldn't be trying to restyle non-elements directly, except if it's a display:contents child"); |
| 63 |
NS_ASSERTION(!(aHint & nsChangeHint_AllReflowHints) || |
66 |
NS_ASSERTION(!(aHint & nsChangeHint_AllReflowHints) || |
| 64 |
(aHint & nsChangeHint_NeedReflow), |
67 |
(aHint & nsChangeHint_NeedReflow), |
| 65 |
"Reflow hint bits set without actually asking for a reflow"); |
68 |
"Reflow hint bits set without actually asking for a reflow"); |
| 66 |
|
69 |
|
| 67 |
if ((0 < mCount) && (aHint & nsChangeHint_ReconstructFrame)) { // filter out all other changes for same content |
70 |
if ((0 < mCount) && (aHint & nsChangeHint_ReconstructFrame)) { // filter out all other changes for same content |
| 68 |
if (aContent) { |
71 |
if (aContent) { |
| 69 |
for (int32_t index = mCount - 1; index >= 0; --index) { |
72 |
for (int32_t index = mCount - 1; index >= 0; --index) { |
| 70 |
if (aContent == mArray[index].mContent) { // remove this change |
73 |
if (aContent == mArray[index].mContent) { // remove this change |