From a1c65dd9f5ec19d7f2117b16a0bacf340c88982b Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Mon, 15 Apr 2002 22:28:54 +0000 Subject: [PATCH] Fix event state changes on some UI buttons by not overwriting a true result from HasStateDependentStyle with a false one. b=137067 r=bzbarsky sr=waterson git-svn-id: svn://10.0.0.236/trunk@118997 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsStyleSet.cpp | 14 +++++++++++--- mozilla/layout/style/nsStyleSet.cpp | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index 76929d962dd..dfdf41c317f 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -1448,9 +1448,17 @@ static PRBool SheetHasStatefulStyle(nsISupports* aProcessor, void *aData) { nsIStyleRuleProcessor* processor = (nsIStyleRuleProcessor*)aProcessor; StatefulData* data = (StatefulData*)aData; - processor->HasStateDependentStyle(data, data->mMedium, &data->mStateful); - if (data->mStateful) - return PR_FALSE; // stop iteration + PRBool hasStateful; + processor->HasStateDependentStyle(data, data->mMedium, &hasStateful); + if (hasStateful) { + data->mStateful = PR_TRUE; + // Stop iteration. Note that StyleSetImpl::WalkRuleProcessors uses + // this to stop its own iteration in some cases, but not all (the + // style rule supplier case). Since this optimization is only for + // the case where we have a lot more work to do, it's not worth the + // code needed to make the stopping perfect. + return PR_FALSE; + } return PR_TRUE; // continue } diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index 76929d962dd..dfdf41c317f 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -1448,9 +1448,17 @@ static PRBool SheetHasStatefulStyle(nsISupports* aProcessor, void *aData) { nsIStyleRuleProcessor* processor = (nsIStyleRuleProcessor*)aProcessor; StatefulData* data = (StatefulData*)aData; - processor->HasStateDependentStyle(data, data->mMedium, &data->mStateful); - if (data->mStateful) - return PR_FALSE; // stop iteration + PRBool hasStateful; + processor->HasStateDependentStyle(data, data->mMedium, &hasStateful); + if (hasStateful) { + data->mStateful = PR_TRUE; + // Stop iteration. Note that StyleSetImpl::WalkRuleProcessors uses + // this to stop its own iteration in some cases, but not all (the + // style rule supplier case). Since this optimization is only for + // the case where we have a lot more work to do, it's not worth the + // code needed to make the stopping perfect. + return PR_FALSE; + } return PR_TRUE; // continue }