From ba1de95c3443f632a931e3310e78511998a79820 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sat, 4 Oct 2003 06:36:33 +0000 Subject: [PATCH] Missed CalcDifference changes in previous patch. r+sr=bzbarsky b=113173 git-svn-id: svn://10.0.0.236/trunk@147549 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/src/nsStyleStruct.cpp | 17 +++++++++++++---- mozilla/layout/style/nsStyleStruct.cpp | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/mozilla/content/shared/src/nsStyleStruct.cpp b/mozilla/content/shared/src/nsStyleStruct.cpp index a4b9438d1e6..670d0f4216f 100644 --- a/mozilla/content/shared/src/nsStyleStruct.cpp +++ b/mozilla/content/shared/src/nsStyleStruct.cpp @@ -191,6 +191,15 @@ inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides, aEnumTable, aNumEnums); } +static PRBool EqualURIs(nsIURI *aURI1, nsIURI *aURI2) +{ + PRBool eq; + return aURI1 == aURI2 || // handle null==null, and optimize + (aURI1 && aURI2 && + NS_SUCCEEDED(aURI1->Equals(aURI2, &eq)) && // not equal on fail + eq); +} + // -------------------- // nsStyleFont // @@ -717,7 +726,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource) nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const { if (mListStylePosition == aOther.mListStylePosition && - mListStyleImage == aOther.mListStyleImage && + EqualURIs(mListStyleImage, aOther.mListStyleImage) && mListStyleType == aOther.mListStyleType) { if (mImageRegion == aOther.mImageRegion) return NS_STYLE_HINT_NONE; @@ -1029,7 +1038,7 @@ nsChangeHint nsStyleBackground::CalcDifference(const nsStyleBackground& aOther) (mBackgroundClip == aOther.mBackgroundClip) && (mBackgroundInlinePolicy == aOther.mBackgroundInlinePolicy) && (mBackgroundOrigin == aOther.mBackgroundOrigin) && - (mBackgroundImage == aOther.mBackgroundImage) && + EqualURIs(mBackgroundImage, aOther.mBackgroundImage) && ((!(mBackgroundFlags & NS_STYLE_BG_X_POSITION_PERCENT) || (mBackgroundXPosition.mFloat == aOther.mBackgroundXPosition.mFloat)) && (!(mBackgroundFlags & NS_STYLE_BG_X_POSITION_LENGTH) || @@ -1081,7 +1090,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const { nsChangeHint hint = nsChangeHint(0); - if (mBinding != aOther.mBinding + if (!EqualURIs(mBinding, aOther.mBinding) || mPosition != aOther.mPosition || mDisplay != aOther.mDisplay || mFloats != aOther.mFloats @@ -1385,7 +1394,7 @@ nsStyleUserInterface::~nsStyleUserInterface(void) nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aOther) const { if ((mCursor != aOther.mCursor) || - (mCursorImage != aOther.mCursorImage)) + !EqualURIs(mCursorImage, aOther.mCursorImage)) return NS_STYLE_HINT_VISUAL; if (mUserInput == aOther.mUserInput) { diff --git a/mozilla/layout/style/nsStyleStruct.cpp b/mozilla/layout/style/nsStyleStruct.cpp index a4b9438d1e6..670d0f4216f 100644 --- a/mozilla/layout/style/nsStyleStruct.cpp +++ b/mozilla/layout/style/nsStyleStruct.cpp @@ -191,6 +191,15 @@ inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides, aEnumTable, aNumEnums); } +static PRBool EqualURIs(nsIURI *aURI1, nsIURI *aURI2) +{ + PRBool eq; + return aURI1 == aURI2 || // handle null==null, and optimize + (aURI1 && aURI2 && + NS_SUCCEEDED(aURI1->Equals(aURI2, &eq)) && // not equal on fail + eq); +} + // -------------------- // nsStyleFont // @@ -717,7 +726,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource) nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const { if (mListStylePosition == aOther.mListStylePosition && - mListStyleImage == aOther.mListStyleImage && + EqualURIs(mListStyleImage, aOther.mListStyleImage) && mListStyleType == aOther.mListStyleType) { if (mImageRegion == aOther.mImageRegion) return NS_STYLE_HINT_NONE; @@ -1029,7 +1038,7 @@ nsChangeHint nsStyleBackground::CalcDifference(const nsStyleBackground& aOther) (mBackgroundClip == aOther.mBackgroundClip) && (mBackgroundInlinePolicy == aOther.mBackgroundInlinePolicy) && (mBackgroundOrigin == aOther.mBackgroundOrigin) && - (mBackgroundImage == aOther.mBackgroundImage) && + EqualURIs(mBackgroundImage, aOther.mBackgroundImage) && ((!(mBackgroundFlags & NS_STYLE_BG_X_POSITION_PERCENT) || (mBackgroundXPosition.mFloat == aOther.mBackgroundXPosition.mFloat)) && (!(mBackgroundFlags & NS_STYLE_BG_X_POSITION_LENGTH) || @@ -1081,7 +1090,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const { nsChangeHint hint = nsChangeHint(0); - if (mBinding != aOther.mBinding + if (!EqualURIs(mBinding, aOther.mBinding) || mPosition != aOther.mPosition || mDisplay != aOther.mDisplay || mFloats != aOther.mFloats @@ -1385,7 +1394,7 @@ nsStyleUserInterface::~nsStyleUserInterface(void) nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aOther) const { if ((mCursor != aOther.mCursor) || - (mCursorImage != aOther.mCursorImage)) + !EqualURIs(mCursorImage, aOther.mCursorImage)) return NS_STYLE_HINT_VISUAL; if (mUserInput == aOther.mUserInput) {