diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 043c180b6ed5..d83430e5c698 100755 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -459,6 +459,7 @@ GK_ATOM(isindex, "isindex") GK_ATOM(ismap, "ismap") GK_ATOM(kbd, "kbd") GK_ATOM(noautofocus, "noautofocus") +GK_ATOM(keepcurrentinview, "keepcurrentinview") GK_ATOM(key, "key") GK_ATOM(keycode, "keycode") GK_ATOM(keydown, "keydown") diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index bd560740d9bf..c910223a3a8c 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -451,15 +451,20 @@ nsTreeBodyFrame::ReflowFinished() if (mTopRowIndex > lastPageTopRow) ScrollToRowInternal(parts, lastPageTopRow); - // make sure that the current selected item is still - // visible after the tree changes size. - nsCOMPtr sel; - mView->GetSelection(getter_AddRefs(sel)); - if (sel) { - PRInt32 currentIndex; - sel->GetCurrentIndex(¤tIndex); - if (currentIndex != -1) - EnsureRowIsVisibleInternal(parts, currentIndex); + nsIContent *treeContent = GetBaseElement(); + if (treeContent->AttrValueIs(kNameSpaceID_None, + nsGkAtoms::keepcurrentinview, + nsGkAtoms::_true, eCaseMatters)) { + // make sure that the current selected item is still + // visible after the tree changes size. + nsCOMPtr sel; + mView->GetSelection(getter_AddRefs(sel)); + if (sel) { + PRInt32 currentIndex; + sel->GetCurrentIndex(¤tIndex); + if (currentIndex != -1) + EnsureRowIsVisibleInternal(parts, currentIndex); + } } if (!FullScrollbarsUpdate(PR_FALSE)) { diff --git a/toolkit/content/widgets/tree.xml b/toolkit/content/widgets/tree.xml index 7bf2270ba728..bded213b14a5 100644 --- a/toolkit/content/widgets/tree.xml +++ b/toolkit/content/widgets/tree.xml @@ -105,6 +105,11 @@ true #endif + +