This commit is contained in:
hyatt%netscape.com 2000-01-14 10:34:27 +00:00
Родитель 589e605a7d
Коммит f1ee25a53e
7 изменённых файлов: 97 добавлений и 1 удалений

Просмотреть файл

@ -41,10 +41,12 @@
#include "nsSpaceManager.h"
#include "nsHTMLParts.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsIPresShell.h"
#include "nsGenericHTMLElement.h"
#include "nsFrameNavigator.h"
#include "nsCSSRendering.h"
#include "nsISelfScrollingFrame.h"
#define CONSTANT 0
#define DEBUG_REFLOW 0
@ -882,7 +884,15 @@ nsBoxFrame::CollapseChild(nsIPresContext* aPresContext, nsIFrame* frame, PRBool
return;
}
}
// Trees have to collapse their scrollbars manually, since you can't
// get to the scrollbar via the normal frame list.
nsISelfScrollingFrame* treeFrame;
if (NS_SUCCEEDED(frame->QueryInterface(nsISelfScrollingFrame::GetIID(), (void**)&treeFrame)) && treeFrame) {
// Tell the tree frame to collapse its scrollbar.
treeFrame->CollapseScrollbar(aPresContext, hide);
}
// collapse the child
nsIFrame* child = nsnull;
frame->FirstChild(nsnull, &child);

Просмотреть файл

@ -617,6 +617,22 @@ nsTreeFrame::ScrollByLines(nsIPresContext* aPresContext, PRInt32 lines)
return NS_OK;
}
NS_IMETHODIMP
nsTreeFrame::CollapseScrollbar(nsIPresContext* aPresContext, PRBool aHide)
{
// Get our treechildren child frame.
nsTreeRowGroupFrame* treeRowGroup = nsnull;
GetTreeBody(&treeRowGroup);
if (!treeRowGroup)
return NS_OK; // No tree body. Just bail.
treeRowGroup->CollapseScrollbar(aHide, aPresContext, nsnull);
return NS_OK;
}
NS_IMETHODIMP
nsTreeFrame::EnsureRowIsVisible(PRInt32 aRowIndex)
{

Просмотреть файл

@ -94,6 +94,7 @@ public:
// nsISelfScrollingFrame interface
NS_IMETHOD ScrollByLines(nsIPresContext* aPresContext, PRInt32 lines);
NS_IMETHOD CollapseScrollbar(nsIPresContext* aPresContext, PRBool aHide);
// nsITreeFrame.h
NS_IMETHOD EnsureRowIsVisible(PRInt32 aRowIndex);

Просмотреть файл

@ -225,4 +225,25 @@ nsTreeOuterFrame::ScrollByLines(nsIPresContext* aPresContext, PRInt32 lines)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsTreeOuterFrame::CollapseScrollbar(nsIPresContext* aPresContext, PRBool aHide)
{
// What we need to do is call the corresponding method on our TreeFrame
// In most cases the TreeFrame will be the only child, but just to make
// sure we'll check for the right interface
nsISelfScrollingFrame* sf;
nsIFrame* child;
FirstChild(NULL, &child);
while (child != nsnull) {
if (NS_OK == child->QueryInterface(NS_GET_IID(nsISelfScrollingFrame),
(void**)&sf)) {
return sf->CollapseScrollbar(aPresContext, aHide);
}
child->GetNextSibling(&child);
}
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -53,6 +53,7 @@ public:
nsHTMLReflowState& aChildReflowState);
NS_IMETHOD ScrollByLines(nsIPresContext* aPresContext, PRInt32 lines);
NS_IMETHOD CollapseScrollbar(nsIPresContext* aPresContext, PRBool aHide);
protected:
nsTreeOuterFrame();

Просмотреть файл

@ -47,6 +47,8 @@
#include "nsIDOMDragListener.h"
#include "nsTreeItemDragCapturer.h"
#include "nsLayoutAtoms.h"
#include "nsIViewManager.h"
#include "nsIView.h"
// I added the following function to improve keeping the frame
// chains in synch with the table. repackage as appropriate - karnaze
@ -1624,6 +1626,50 @@ void nsTreeRowGroupFrame::CreateScrollbar(nsIPresContext* aPresContext)
}
}
void
nsTreeRowGroupFrame::CollapseScrollbar(PRBool hide, nsIPresContext* aPresContext, nsIFrame* aFrame)
{
nsIFrame* frame = aFrame;
if (frame == nsnull)
frame = mScrollbar;
if (frame == nsnull)
return;
// shrink the view
nsIView* view = nsnull;
frame->GetView(aPresContext, &view);
// if we find a view stop right here. All views under it
// will be clipped.
if (view) {
nsViewVisibility v;
view->GetVisibility(v);
nsCOMPtr<nsIWidget> widget;
view->GetWidget(*getter_AddRefs(widget));
if (hide) {
view->SetVisibility(nsViewVisibility_kHide);
} else {
view->SetVisibility(nsViewVisibility_kShow);
}
if (widget) {
return;
}
}
// collapse the child
nsIFrame* child = nsnull;
frame->FirstChild(nsnull, &child);
while (nsnull != child)
{
CollapseScrollbar(hide, aPresContext, child);
nsresult rv = child->GetNextSibling(&child);
NS_ASSERTION(rv == NS_OK,"failed to get next child");
}
}
void
nsTreeRowGroupFrame::IndexOfCell(nsIPresContext* aPresContext,
nsIContent* aCellContent, PRInt32& aRowIndex, PRInt32& aColIndex)

Просмотреть файл

@ -50,6 +50,7 @@ public:
void SetFrameConstructor(nsCSSFrameConstructor* aFrameConstructor) { mFrameConstructor = aFrameConstructor; };
void CreateScrollbar(nsIPresContext* aPresContext);
void CollapseScrollbar(PRBool aHide, nsIPresContext* aPresContext, nsIFrame* aCurrentFrame);
NS_IMETHOD TreeAppendFrames(nsIFrame* aFrameList);