From c6871d4b8e189464f24c1b923ea58cdb8e623e16 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Fri, 3 Mar 2000 02:08:02 +0000 Subject: [PATCH] part 2 of fix for bug #25073, r=pink,evaughan, a=jevering --- layout/xul/base/src/nsMenuFrame.cpp | 35 ++++++------------------ layout/xul/base/src/nsMenuPopupFrame.cpp | 2 +- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index a06a4807951e..f857bc995897 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -309,14 +309,15 @@ nsMenuFrame::HandleEvent(nsIPresContext* aPresContext, // an un-checked radio menu if (mType == eMenuType_Checkbox || (mType == eMenuType_Radio && !mChecked)) { - nsAutoString checked; - - if (mChecked) - checked = "false"; - else - checked = "true"; - mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, checked, + if (mChecked) { + mContent->UnsetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, PR_TRUE); + } + else { + mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, nsAutoString("true"), + PR_TRUE); + } + /* the AttributeChanged code will update all the internal state */ } @@ -494,26 +495,6 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext, } else if ( aAttribute == nsHTMLAtoms::type || aAttribute == nsHTMLAtoms::name ) UpdateMenuType(aPresContext); - /* we need to reflow, if these change */ - if (aAttribute == nsHTMLAtoms::value || - aAttribute == nsXULAtoms::acceltext || - aAttribute == nsHTMLAtoms::type || - aAttribute == nsHTMLAtoms::checked) { - - nsCOMPtr shell; - nsresult rv = aPresContext->GetShell(getter_AddRefs(shell)); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr reflowCmd; - rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, - nsIReflowCommand::StyleChanged); - if (NS_FAILED(rv)) - return rv; - - shell->AppendReflowCommand(reflowCmd); - } - return NS_OK; } diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 53ead32f1b43..eae6b901bb05 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -684,7 +684,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext, nsAutoString shouldDisplay, menuActive; mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, menuActive); - if ( !menuActive.Equals("true") ) { + if (menuActive != "true") { mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, shouldDisplay); if ( shouldDisplay.Equals("true") ) mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);