From 56914b135eb491a69273ab7b654be3dfb0bc7682 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Wed, 27 Mar 2002 02:58:56 +0000 Subject: [PATCH] Add SetVisibility method to Scroll Views It now checks the visibility and adjusts the scrollbars accordingly Bug 92333 r=kmcclusk sr=attinasi a=asa git-svn-id: svn://10.0.0.236/trunk@117562 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsListControlFrame.cpp | 16 +++++++++++++--- .../layout/html/forms/src/nsListControlFrame.cpp | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index f123d41641b..96e0f9d82c4 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -1045,6 +1045,9 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, } } + const nsStyleVisibility* vis; + GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); + #ifdef IBMBIDI // Retrieve the scrollbar's width and height float sbWidth = 0.0; @@ -1055,9 +1058,6 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, // Convert to nscoord's by rounding nscoord scrollbarWidth = NSToCoordRound(sbWidth); - const nsStyleVisibility* vis; - GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); - if (vis->mDirection == NS_STYLE_DIRECTION_RTL) { nscoord bidiScrolledAreaWidth = scrolledAreaDesiredSize.maxElementSize->width; firstPassState.reason = eReflowReason_StyleChange; @@ -1103,6 +1103,16 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, aDesiredSize.maxElementSize->height = aDesiredSize.height; } + // Set the visibility of the scrollbars + // although this may "turn on" both scrollbars everythime + // they do get adjusted back and show correctly + nsIScrollableView* scrollableView; + GetScrollableView(scrollableView); + if (scrollableView) { + PRBool isVis = vis->IsVisible(); + scrollableView->SetScrollbarVisibility(isVis, isVis); + } + aStatus = NS_FRAME_COMPLETE; #ifdef DEBUG_rodsX diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index f123d41641b..96e0f9d82c4 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -1045,6 +1045,9 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, } } + const nsStyleVisibility* vis; + GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); + #ifdef IBMBIDI // Retrieve the scrollbar's width and height float sbWidth = 0.0; @@ -1055,9 +1058,6 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, // Convert to nscoord's by rounding nscoord scrollbarWidth = NSToCoordRound(sbWidth); - const nsStyleVisibility* vis; - GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); - if (vis->mDirection == NS_STYLE_DIRECTION_RTL) { nscoord bidiScrolledAreaWidth = scrolledAreaDesiredSize.maxElementSize->width; firstPassState.reason = eReflowReason_StyleChange; @@ -1103,6 +1103,16 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, aDesiredSize.maxElementSize->height = aDesiredSize.height; } + // Set the visibility of the scrollbars + // although this may "turn on" both scrollbars everythime + // they do get adjusted back and show correctly + nsIScrollableView* scrollableView; + GetScrollableView(scrollableView); + if (scrollableView) { + PRBool isVis = vis->IsVisible(); + scrollableView->SetScrollbarVisibility(isVis, isVis); + } + aStatus = NS_FRAME_COMPLETE; #ifdef DEBUG_rodsX