Fix for 90081, r/sr=waterson,attinasi

This commit is contained in:
hyatt%netscape.com 2001-07-18 22:48:35 +00:00
Родитель 4ae03235e4
Коммит 1f794f1074
5 изменённых файлов: 72 добавлений и 2 удалений

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

@ -548,7 +548,38 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct)
NS_IMETHODIMP
nsStyleContext::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
{
// XXXdwh This function can probably be eliminated.
// First we need to clear out all of our style data.
if (mCachedStyleData.mResetData || mCachedStyleData.mInheritedData)
mCachedStyleData.Destroy(mBits, aPresContext);
mBits &= ~NS_STYLE_INHERIT_MASK; // Clear out all data that indicates we should look for
// style data in our parent.
// Now we need to ensure that any cached data along the path from our
// rule node back to the root is cleared out.
mRuleNode->ClearPath();
// Now do the same for all of our children, but only if the recurse boolean
// is set.
if (!aRecurse)
return NS_OK;
if (mChild) {
nsStyleContext* child = mChild;
do {
child->RemapStyle(aPresContext);
child = child->mNextSibling;
} while (mChild != child);
}
if (mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->RemapStyle(aPresContext);
child = child->mNextSibling;
} while (mEmptyChild != child);
}
return NS_OK;
}

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

@ -299,6 +299,7 @@ public:
NS_IMETHOD GetPresContext(nsIPresContext** aResult)=0;
NS_IMETHOD ClearPath()=0;
NS_IMETHOD ClearCachedData(nsIStyleRule* aRule)=0;
NS_IMETHOD ClearCachedDataInSubtree(nsIStyleRule* aRule)=0;

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

@ -412,6 +412,12 @@ nsRuleNode::GetRule(nsIStyleRule** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsRuleNode::ClearPath()
{
return ClearCachedData(mRule);
}
NS_IMETHODIMP
nsRuleNode::ClearCachedData(nsIStyleRule* aRule)
{

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

@ -240,6 +240,7 @@ public:
NS_IMETHOD GetParent(nsIRuleNode** aResult);
NS_IMETHOD IsRoot(PRBool* aResult);
NS_IMETHOD GetRule(nsIStyleRule** aResult);
NS_IMETHOD ClearPath();
NS_IMETHOD ClearCachedData(nsIStyleRule* aRule);
NS_IMETHOD ClearCachedDataInSubtree(nsIStyleRule* aRule);
NS_IMETHOD GetPresContext(nsIPresContext** aResult);

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

@ -548,7 +548,38 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct)
NS_IMETHODIMP
nsStyleContext::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse)
{
// XXXdwh This function can probably be eliminated.
// First we need to clear out all of our style data.
if (mCachedStyleData.mResetData || mCachedStyleData.mInheritedData)
mCachedStyleData.Destroy(mBits, aPresContext);
mBits &= ~NS_STYLE_INHERIT_MASK; // Clear out all data that indicates we should look for
// style data in our parent.
// Now we need to ensure that any cached data along the path from our
// rule node back to the root is cleared out.
mRuleNode->ClearPath();
// Now do the same for all of our children, but only if the recurse boolean
// is set.
if (!aRecurse)
return NS_OK;
if (mChild) {
nsStyleContext* child = mChild;
do {
child->RemapStyle(aPresContext);
child = child->mNextSibling;
} while (mChild != child);
}
if (mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->RemapStyle(aPresContext);
child = child->mNextSibling;
} while (mEmptyChild != child);
}
return NS_OK;
}