Added ability to track changes to content without frame
Fix for bug 9013 (and any dynamic change from display:none) r=troy git-svn-id: svn://10.0.0.236/trunk@49654 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -37,10 +37,12 @@ nsStyleChangeList::~nsStyleChangeList(void)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) const
|
||||
nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex < mCount)) {
|
||||
aFrame = mArray[aIndex].mFrame;
|
||||
aContent = mArray[aIndex].mContent;
|
||||
aHint = mArray[aIndex].mHint;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -48,29 +50,22 @@ nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) c
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
|
||||
nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "must have frame");
|
||||
NS_ASSERTION(aFrame || (aHint >= NS_STYLE_HINT_FRAMECHANGE), "must have frame");
|
||||
|
||||
if ((0 < mCount) && (NS_STYLE_HINT_FRAMECHANGE == aHint)) { // filter out all other changes for same content
|
||||
nsIContent* changeContent;
|
||||
aFrame->GetContent(&changeContent);
|
||||
if (changeContent) {
|
||||
if (aContent) {
|
||||
PRInt32 index = mCount;
|
||||
while (0 < index--) {
|
||||
nsIContent* content;
|
||||
mArray[index].mFrame->GetContent(&content);
|
||||
if (content == changeContent) { // remove this change
|
||||
if (aContent == mArray[index].mContent) { // remove this change
|
||||
mCount--;
|
||||
if (index < mCount) { // move later changes down
|
||||
nsCRT::memcpy(&(mArray[index]), &(mArray[index + 1]),
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(content);
|
||||
}
|
||||
|
||||
NS_RELEASE(changeContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +92,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
|
||||
}
|
||||
}
|
||||
mArray[mCount].mFrame = aFrame;
|
||||
mArray[mCount].mContent = aContent;
|
||||
mArray[mCount].mHint = aHint;
|
||||
mCount++;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
#include "nslayout.h"
|
||||
#include "nsError.h"
|
||||
class nsIFrame;
|
||||
class nsIContent;
|
||||
|
||||
// XXX would all platforms support putting this inside the list?
|
||||
struct nsStyleChangeData {
|
||||
nsIFrame* mFrame;
|
||||
PRInt32 mHint;
|
||||
nsIFrame* mFrame;
|
||||
nsIContent* mContent;
|
||||
PRInt32 mHint;
|
||||
};
|
||||
|
||||
static const PRUint32 kStyleChangeBufferSize = 10;
|
||||
@@ -39,11 +41,12 @@ public:
|
||||
return mCount;
|
||||
}
|
||||
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) const;
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const;
|
||||
|
||||
nsresult AppendChange(nsIFrame* aFrame, PRInt32 aHint);
|
||||
nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint);
|
||||
|
||||
void Clear();
|
||||
void Clear(void);
|
||||
|
||||
protected:
|
||||
nsStyleChangeList& operator=(const nsStyleChangeList& aCopy);
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
#include "nslayout.h"
|
||||
#include "nsError.h"
|
||||
class nsIFrame;
|
||||
class nsIContent;
|
||||
|
||||
// XXX would all platforms support putting this inside the list?
|
||||
struct nsStyleChangeData {
|
||||
nsIFrame* mFrame;
|
||||
PRInt32 mHint;
|
||||
nsIFrame* mFrame;
|
||||
nsIContent* mContent;
|
||||
PRInt32 mHint;
|
||||
};
|
||||
|
||||
static const PRUint32 kStyleChangeBufferSize = 10;
|
||||
@@ -39,11 +41,12 @@ public:
|
||||
return mCount;
|
||||
}
|
||||
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) const;
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const;
|
||||
|
||||
nsresult AppendChange(nsIFrame* aFrame, PRInt32 aHint);
|
||||
nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint);
|
||||
|
||||
void Clear();
|
||||
void Clear(void);
|
||||
|
||||
protected:
|
||||
nsStyleChangeList& operator=(const nsStyleChangeList& aCopy);
|
||||
|
||||
@@ -37,10 +37,12 @@ nsStyleChangeList::~nsStyleChangeList(void)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) const
|
||||
nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if ((0 <= aIndex) && (aIndex < mCount)) {
|
||||
aFrame = mArray[aIndex].mFrame;
|
||||
aContent = mArray[aIndex].mContent;
|
||||
aHint = mArray[aIndex].mHint;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -48,29 +50,22 @@ nsStyleChangeList::ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, PRInt32& aHint) c
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
|
||||
nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "must have frame");
|
||||
NS_ASSERTION(aFrame || (aHint >= NS_STYLE_HINT_FRAMECHANGE), "must have frame");
|
||||
|
||||
if ((0 < mCount) && (NS_STYLE_HINT_FRAMECHANGE == aHint)) { // filter out all other changes for same content
|
||||
nsIContent* changeContent;
|
||||
aFrame->GetContent(&changeContent);
|
||||
if (changeContent) {
|
||||
if (aContent) {
|
||||
PRInt32 index = mCount;
|
||||
while (0 < index--) {
|
||||
nsIContent* content;
|
||||
mArray[index].mFrame->GetContent(&content);
|
||||
if (content == changeContent) { // remove this change
|
||||
if (aContent == mArray[index].mContent) { // remove this change
|
||||
mCount--;
|
||||
if (index < mCount) { // move later changes down
|
||||
nsCRT::memcpy(&(mArray[index]), &(mArray[index + 1]),
|
||||
(mCount - index) * sizeof(nsStyleChangeData));
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(content);
|
||||
}
|
||||
|
||||
NS_RELEASE(changeContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +92,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
|
||||
}
|
||||
}
|
||||
mArray[mCount].mFrame = aFrame;
|
||||
mArray[mCount].mContent = aContent;
|
||||
mArray[mCount].mHint = aHint;
|
||||
mCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user