filter out multiple changes to content when framechange in effect

This commit is contained in:
peterl%netscape.com 1999-09-21 07:49:55 +00:00
Родитель 3e1015d0ab
Коммит 8697ad0929
2 изменённых файлов: 52 добавлений и 0 удалений

Просмотреть файл

@ -17,6 +17,9 @@
*/
#include "nsStyleChangeList.h"
#include "nsStyleConsts.h"
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsCRT.h"
static const PRUint32 kGrowArrayBy = 10;
@ -48,6 +51,29 @@ nsresult
nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
{
NS_ASSERTION(aFrame, "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) {
PRInt32 index = mCount;
while (0 < index--) {
nsIContent* content;
mArray[index].mFrame->GetContent(&content);
if (content == changeContent) { // 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);
}
}
PRInt32 last = mCount - 1;
if ((0 < mCount) && (aFrame == mArray[last].mFrame)) { // same as last frame
if (mArray[last].mHint < aHint) {

Просмотреть файл

@ -17,6 +17,9 @@
*/
#include "nsStyleChangeList.h"
#include "nsStyleConsts.h"
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsCRT.h"
static const PRUint32 kGrowArrayBy = 10;
@ -48,6 +51,29 @@ nsresult
nsStyleChangeList::AppendChange(nsIFrame* aFrame, PRInt32 aHint)
{
NS_ASSERTION(aFrame, "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) {
PRInt32 index = mCount;
while (0 < index--) {
nsIContent* content;
mArray[index].mFrame->GetContent(&content);
if (content == changeContent) { // 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);
}
}
PRInt32 last = mCount - 1;
if ((0 < mCount) && (aFrame == mArray[last].mFrame)) { // same as last frame
if (mArray[last].mHint < aHint) {