From 4781091ef7e631c8a1386ba4e559b8b0aaa9352f Mon Sep 17 00:00:00 2001 From: "db48x%yahoo.com" Date: Sun, 10 Dec 2006 18:13:48 +0000 Subject: [PATCH] bug 363112: nsDeckFrame::GetSelectedBox should use mIndex patch by Alex Vincent , r=enn, sr=neil git-svn-id: svn://10.0.0.236/trunk@216825 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/xul/base/src/nsDeckFrame.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.cpp b/mozilla/layout/xul/base/src/nsDeckFrame.cpp index de47ab94757..c975c559ecf 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.cpp +++ b/mozilla/layout/xul/base/src/nsDeckFrame.cpp @@ -99,7 +99,7 @@ nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID, aModType); - // if the index changed hide the old element and make the now element visible + // if the index changed hide the old element and make the new element visible if (aAttribute == nsXULAtoms::selectedIndex) { IndexChanged(GetPresContext()); } @@ -157,16 +157,16 @@ nsDeckFrame::IndexChanged(nsPresContext* aPresContext) Redraw(state); // hide the currently showing box - nsIBox* currentBox = (mIndex >= 0) ? GetBoxAt(mIndex) : nsnull; + nsIBox* currentBox = GetSelectedBox(); if (currentBox) // only hide if it exists HideBox(aPresContext, currentBox); + mIndex = index; + // show the new box - nsIBox* newBox = (index >= 0) ? GetBoxAt(index) : nsnull; + nsIBox* newBox = GetSelectedBox(); if (newBox) // only show if it exists ShowBox(aPresContext, newBox); - - mIndex = index; } PRInt32 @@ -191,11 +191,7 @@ nsDeckFrame::GetSelectedIndex() nsIBox* nsDeckFrame::GetSelectedBox() { - // ok we want to paint only the child that as at the given index - PRInt32 index = GetSelectedIndex(); - - // get the child at that index. - return (index >= 0) ? GetBoxAt(index) : nsnull; + return (mIndex >= 0) ? GetBoxAt(mIndex) : nsnull; } NS_IMETHODIMP