From 6d37b0243d363fa7fd66b0e28e1e9669cbe9c62a Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Fri, 3 Sep 2004 00:43:46 +0000 Subject: [PATCH] Land bug 72747 in pieces: convert users of nsIScrollableFrame::GetScrollPreference to using GetScrollbarStyles. b=72747 r+sr=roc git-svn-id: svn://10.0.0.236/trunk@161686 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xul/base/src/nsListBoxBodyFrame.cpp | 25 ++++++---------- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 27 +++++++---------- .../layout/xul/base/src/nsPopupSetFrame.cpp | 29 ++++++++----------- 3 files changed, 32 insertions(+), 49 deletions(-) diff --git a/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp b/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp index bedaceecd9d..343cbbef98e 100644 --- a/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -1473,14 +1473,11 @@ nsListboxScrollPortFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& outer->GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode); if (!sizeMode.IsEmpty()) { nsCOMPtr scrollFrame(do_QueryInterface(mParent)); - if (scrollFrame) { - nsIScrollableFrame::nsScrollPref scrollPref; - scrollFrame->GetScrollPreference(aBoxLayoutState.PresContext(), &scrollPref); - - if (scrollPref == nsIScrollableFrame::Auto) { - nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState); - aSize.width += scrollbars.left + scrollbars.right; - } + if (scrollFrame && + scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { + nsMargin scrollbars = + scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState); + aSize.width += scrollbars.left + scrollbars.right; } } else aSize.width = 0; @@ -1510,14 +1507,10 @@ nsListboxScrollPortFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize.height = size*outer->GetRowHeightTwips(); nsCOMPtr scrollFrame(do_QueryInterface(mParent)); - if (scrollFrame) { - nsIScrollableFrame::nsScrollPref scrollPref; - scrollFrame->GetScrollPreference(aBoxLayoutState.PresContext(), &scrollPref); - - if (scrollPref == nsIScrollableFrame::Auto) { - nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState); - aSize.width += scrollbars.left + scrollbars.right; - } + if (scrollFrame && + scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { + nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState); + aSize.width += scrollbars.left + scrollbars.right; } AddMargin(child, aSize); diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 4b843eddce3..16540a561f9 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -1007,23 +1007,18 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState) ibox->GetBounds(bounds); nsCOMPtr scrollframe(do_QueryInterface(child)); - if (scrollframe) { - nsIScrollableFrame::nsScrollPref pref; - scrollframe->GetScrollPreference(aState.PresContext(), &pref); + if (scrollframe && + scrollframe->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { + if (bounds.height < prefSize.height) { + // layout the child + ibox->Layout(aState); - if (pref == nsIScrollableFrame::Auto) - { - if (bounds.height < prefSize.height) { - // layout the child - ibox->Layout(aState); - - nsMargin scrollbars = scrollframe->GetActualScrollbarSizes(); - if (bounds.width < prefSize.width + scrollbars.left + scrollbars.right) - { - bounds.width += scrollbars.left + scrollbars.right; - //printf("Width=%d\n",width); - ibox->SetBounds(aState, bounds); - } + nsMargin scrollbars = scrollframe->GetActualScrollbarSizes(); + if (bounds.width < prefSize.width + scrollbars.left + scrollbars.right) + { + bounds.width += scrollbars.left + scrollbars.right; + //printf("Width=%d\n",width); + ibox->SetBounds(aState, bounds); } } } diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp index 6ea75394467..954e8f76a62 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp @@ -252,24 +252,19 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState) ibox->GetBounds(bounds); nsCOMPtr scrollframe = do_QueryInterface(child); - if (scrollframe) { - nsIScrollableFrame::nsScrollPref pref; - scrollframe->GetScrollPreference(aState.PresContext(), &pref); + if (scrollframe && + scrollframe->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { + // if our pref height + if (bounds.height < prefSize.height) { + // layout the child + ibox->Layout(aState); - if (pref == nsIScrollableFrame::Auto) - { - // if our pref height - if (bounds.height < prefSize.height) { - // layout the child - ibox->Layout(aState); - - nsMargin scrollbars = scrollframe->GetActualScrollbarSizes(); - if (bounds.width < prefSize.width + scrollbars.left + scrollbars.right) - { - bounds.width += scrollbars.left + scrollbars.right; - //printf("Width=%d\n",width); - ibox->SetBounds(aState, bounds); - } + nsMargin scrollbars = scrollframe->GetActualScrollbarSizes(); + if (bounds.width < prefSize.width + scrollbars.left + scrollbars.right) + { + bounds.width += scrollbars.left + scrollbars.right; + //printf("Width=%d\n",width); + ibox->SetBounds(aState, bounds); } } }