Ongoing deCOMtamination. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-07-05 15:30:50 +00:00
Родитель c98e21aba3
Коммит a197a69820
4 изменённых файлов: 70 добавлений и 136 удалений

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

@ -398,14 +398,11 @@ nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE); nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE);
} }
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK) { if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK
nsCOMPtr<nsIWidget> widget; && !view->HasWidget()) {
view->GetWidget(*getter_AddRefs(widget)); view->CreateWidget(kCChildCID);
if (!widget)
view->CreateWidget(kCChildCID);
} }
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
@ -584,8 +581,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
{ {
// Invalidate the frame // Invalidate the frame
nsRect frameRect; nsRect frameRect = GetRect();
GetRect(frameRect);
nsRect rect(0, 0, frameRect.width, frameRect.height); nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) { if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE); Invalidate(aPresContext, rect, PR_FALSE);
@ -637,8 +633,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
parentContent->GetTag(getter_AddRefs(parentTag)); parentContent->GetTag(getter_AddRefs(parentTag));
if (parentTag == nsHTMLAtoms::frameset) { if (parentTag == nsHTMLAtoms::frameset) {
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent(&parentFrame);
if (parentFrame) { if (parentFrame) {
// There is no interface for nsHTMLFramesetFrame so QI'ing to // There is no interface for nsHTMLFramesetFrame so QI'ing to
@ -961,11 +956,10 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent** aContent)
{ {
*aContent = nsnull; *aContent = nsnull;
nsIFrame* parent = nsnull; nsIFrame* parent = GetParent();
GetParent(&parent);
if (parent) { if (parent) {
parent->GetContent(aContent); *aContent = parent->GetContent();
NS_IF_ADDREF(*aContent);
} }
} }
@ -1025,17 +1019,14 @@ nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
// The view is created hidden; once we have reflowed it and it has been // The view is created hidden; once we have reflowed it and it has been
// positioned then we show it. // positioned then we show it.
if (NS_FRAME_REFLOW_FINISHED == aStatus) { if (NS_FRAME_REFLOW_FINISHED == aStatus) {
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsViewVisibility newVis = GetStyleVisibility()->IsVisible() nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow ? nsViewVisibility_kShow
: nsViewVisibility_kHide; : nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different. // only change if different.
view->GetVisibility(oldVis); if (newVis != view->GetVisibility()) {
if (newVis != oldVis) { nsIViewManager* vm = view->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (vm) { if (vm) {
vm->SetViewVisibility(view, newVis); vm->SetViewVisibility(view, newVis);
} }
@ -1115,10 +1106,6 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
NS_ENSURE_ARG_POINTER(aPresContext); NS_ENSURE_ARG_POINTER(aPresContext);
NS_ENSURE_ARG_POINTER(aWidget); NS_ENSURE_ARG_POINTER(aWidget);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
float t2p; float t2p;
aPresContext->GetTwipsToPixels(&t2p); aPresContext->GetTwipsToPixels(&t2p);
@ -1138,8 +1125,7 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
GetOffsetFromView(aPresContext, origin, &parView); GetOffsetFromView(aPresContext, origin, &parView);
nsRect viewBounds(origin.x, origin.y, 10, 10); nsRect viewBounds(origin.x, origin.y, 10, 10);
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = aPresContext->GetViewManager();
presShell->GetViewManager(getter_AddRefs(viewMan));
rv = view->Init(viewMan, viewBounds, parView); rv = view->Init(viewMan, viewBounds, parView);
// XXX put it at the end of the document order until we can do better // XXX put it at the end of the document order until we can do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE); viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
@ -1151,7 +1137,7 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
rv = view->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE, rv = view->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE,
xulElement? eContentTypeUI: eContentTypeContent); xulElement? eContentTypeUI: eContentTypeContent);
SetView(aPresContext, view); SetView(view);
nsContainerFrame::SyncFrameViewProperties(aPresContext, this, nsnull, view); nsContainerFrame::SyncFrameViewProperties(aPresContext, this, nsnull, view);
@ -1160,7 +1146,8 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
if (!GetStyleVisibility()->IsVisible()) { if (!GetStyleVisibility()->IsVisible()) {
viewMan->SetViewVisibility(view, nsViewVisibility_kHide); viewMan->SetViewVisibility(view, nsViewVisibility_kHide);
} }
view->GetWidget(*aWidget); *aWidget = view->GetWidget();
NS_IF_ADDREF(*aWidget);
return rv; return rv;
} }

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

@ -325,8 +325,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
aContext, aPrevInFlow); aContext, aPrevInFlow);
// find the highest ancestor that is a frameset // find the highest ancestor that is a frameset
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent(&parentFrame);
mTopLevelFrameset = (nsHTMLFramesetFrame*)this; mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
while (parentFrame) { while (parentFrame) {
nsHTMLFramesetFrame* frameset = nsnull; nsHTMLFramesetFrame* frameset = nsnull;
@ -334,7 +333,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
if (frameset) { if (frameset) {
mTopLevelFrameset = frameset; mTopLevelFrameset = frameset;
parentFrame->GetParent(&parentFrame); parentFrame = parentFrame->GetParent();
} else { } else {
break; break;
} }
@ -343,19 +342,16 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
// create the view. a view is needed since it needs to be a mouse grabber // create the view. a view is needed since it needs to be a mouse grabber
nsIView* view; nsIView* view;
nsresult result = CallCreateInstance(kViewCID, &view); nsresult result = CallCreateInstance(kViewCID, &view);
nsCOMPtr<nsIPresShell> presShell; nsIViewManager* viewMan = aPresContext->GetViewManager();
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIFrame* parWithView; nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView); GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext); nsIView *parView = parWithView->GetView();
nsRect boundBox(0, 0, 0, 0); nsRect boundBox(0, 0, 0, 0);
result = view->Init(viewMan, boundBox, parView); result = view->Init(viewMan, boundBox, parView);
// XXX Put it last in document order until we can do better // XXX Put it last in document order until we can do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE); viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
SetView(aPresContext, view); SetView(view);
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell)); aPresContext->GetShell(getter_AddRefs(shell));
@ -709,8 +705,7 @@ nsHTMLFramesetFrame::GetDesiredSize(nsIPresContext* aPresContext,
nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild) nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
{ {
nsHTMLFramesetFrame* parent = nsnull; nsHTMLFramesetFrame* parent = nsnull;
nsCOMPtr<nsIContent> content; nsIContent* content = aChild->GetContent();
aChild->GetContent(getter_AddRefs(content));
if (content) { if (content) {
nsCOMPtr<nsIContent> contentParent; nsCOMPtr<nsIContent> contentParent;
@ -724,8 +719,7 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
contentParent2->GetTag(getter_AddRefs(tag)); contentParent2->GetTag(getter_AddRefs(tag));
if (tag == nsHTMLAtoms::frameset) { if (tag == nsHTMLAtoms::frameset) {
nsIFrame* fptr; nsIFrame* fptr = aChild->GetParent();
aChild->GetParent(&fptr);
parent = (nsHTMLFramesetFrame*) fptr; parent = (nsHTMLFramesetFrame*) fptr;
} }
} }
@ -759,7 +753,7 @@ void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
// this assumption is used here // this assumption is used here
int i = 0; int i = 0;
for (nsIFrame* child = mFrames.FirstChild(); child; for (nsIFrame* child = mFrames.FirstChild(); child;
child->GetNextSibling(&child)) { child = child->GetNextSibling()) {
if (aChild == child) { if (aChild == child) {
nsPoint ignore; nsPoint ignore;
GetSizeOfChildAt(i, aSize, ignore); GetSizeOfChildAt(i, aSize, ignore);
@ -799,11 +793,9 @@ PRBool
nsHTMLFramesetFrame::IsGrabbingMouse() nsHTMLFramesetFrame::IsGrabbingMouse()
{ {
PRBool result = PR_FALSE; PRBool result = PR_FALSE;
nsIView* view; nsIView* view = GetView();
GetView(&view);
if (view) { if (view) {
nsIViewManager* viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(viewMan);
if (viewMan) { if (viewMan) {
nsIView* grabber; nsIView* grabber;
viewMan->GetMouseEventGrabber(grabber); viewMan->GetMouseEventGrabber(grabber);
@ -1217,7 +1209,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
lastCol = cellIndex.x; lastCol = cellIndex.x;
lastSize = size; lastSize = size;
offset.x += size.width; offset.x += size.width;
child->GetNextSibling(&child); child = child->GetNextSibling();
} }
if (firstTime) { if (firstTime) {
@ -1312,8 +1304,7 @@ PRBool
nsHTMLFramesetFrame::GetNoResize(nsIFrame* aChildFrame) nsHTMLFramesetFrame::GetNoResize(nsIFrame* aChildFrame)
{ {
PRBool result = PR_FALSE; PRBool result = PR_FALSE;
nsCOMPtr<nsIContent> content; nsIContent* content = aChildFrame->GetContent();
aChildFrame->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIHTMLContent> htmlContent(do_QueryInterface(content)); nsCOMPtr<nsIHTMLContent> htmlContent(do_QueryInterface(content));
@ -1456,10 +1447,9 @@ nsHTMLFramesetFrame::StartMouseDrag(nsIPresContext* aPresContext,
IndexOf(aBorder, index); IndexOf(aBorder, index);
NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger"); NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger");
#endif #endif
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(*getter_AddRefs(viewMan));
if (viewMan) { if (viewMan) {
PRBool ignore; PRBool ignore;
viewMan->GrabMouseEvents(view, ignore); viewMan->GrabMouseEvents(view, ignore);
@ -1542,21 +1532,13 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext* aPresContext,
if (change != 0) { if (change != 0) {
mDrag.Reset(mDragger->mVertical, mDragger->mPrevNeighbor, change, this); mDrag.Reset(mDragger->mVertical, mDragger->mPrevNeighbor, change, this);
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent((nsIFrame**)&parentFrame);
if (!parentFrame) { if (!parentFrame) {
return; return;
} }
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
if (!shell) {
return;
}
// Update the view immediately (make drag appear snappier) // Update the view immediately (make drag appear snappier)
nsCOMPtr<nsIViewManager> vm; nsIViewManager* vm = aPresContext->GetViewManager();
shell->GetViewManager(getter_AddRefs(vm));
if (vm) { if (vm) {
nsIView* root; nsIView* root;
vm->GetRootView(root); vm->GetRootView(root);
@ -1570,10 +1552,9 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext* aPresContext,
void void
nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext) nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext)
{ {
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(*getter_AddRefs(viewMan));
if (viewMan) { if (viewMan) {
mDragger = nsnull; mDragger = nsnull;
PRBool ignore; PRBool ignore;
@ -1763,8 +1744,7 @@ nsHTMLFramesetBorderFrame::HandleEvent(nsIPresContext* aPresContext,
switch (aEvent->message) { switch (aEvent->message) {
case NS_MOUSE_LEFT_BUTTON_DOWN: case NS_MOUSE_LEFT_BUTTON_DOWN:
nsHTMLFramesetFrame* parentFrame; nsHTMLFramesetFrame* parentFrame;
nsIFrame* fptr; nsIFrame* fptr = GetParent();
GetParent(&fptr);
parentFrame = (nsHTMLFramesetFrame*) fptr; parentFrame = (nsHTMLFramesetFrame*) fptr;
parentFrame->StartMouseDrag(aPresContext, this, aEvent); parentFrame->StartMouseDrag(aPresContext, this, aEvent);
*aEventStatus = nsEventStatus_eConsumeNoDefault; *aEventStatus = nsEventStatus_eConsumeNoDefault;

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

@ -398,14 +398,11 @@ nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE); nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE);
} }
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK) { if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK
nsCOMPtr<nsIWidget> widget; && !view->HasWidget()) {
view->GetWidget(*getter_AddRefs(widget)); view->CreateWidget(kCChildCID);
if (!widget)
view->CreateWidget(kCChildCID);
} }
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
@ -584,8 +581,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
{ {
// Invalidate the frame // Invalidate the frame
nsRect frameRect; nsRect frameRect = GetRect();
GetRect(frameRect);
nsRect rect(0, 0, frameRect.width, frameRect.height); nsRect rect(0, 0, frameRect.width, frameRect.height);
if (!rect.IsEmpty()) { if (!rect.IsEmpty()) {
Invalidate(aPresContext, rect, PR_FALSE); Invalidate(aPresContext, rect, PR_FALSE);
@ -637,8 +633,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
parentContent->GetTag(getter_AddRefs(parentTag)); parentContent->GetTag(getter_AddRefs(parentTag));
if (parentTag == nsHTMLAtoms::frameset) { if (parentTag == nsHTMLAtoms::frameset) {
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent(&parentFrame);
if (parentFrame) { if (parentFrame) {
// There is no interface for nsHTMLFramesetFrame so QI'ing to // There is no interface for nsHTMLFramesetFrame so QI'ing to
@ -961,11 +956,10 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent** aContent)
{ {
*aContent = nsnull; *aContent = nsnull;
nsIFrame* parent = nsnull; nsIFrame* parent = GetParent();
GetParent(&parent);
if (parent) { if (parent) {
parent->GetContent(aContent); *aContent = parent->GetContent();
NS_IF_ADDREF(*aContent);
} }
} }
@ -1025,17 +1019,14 @@ nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
// The view is created hidden; once we have reflowed it and it has been // The view is created hidden; once we have reflowed it and it has been
// positioned then we show it. // positioned then we show it.
if (NS_FRAME_REFLOW_FINISHED == aStatus) { if (NS_FRAME_REFLOW_FINISHED == aStatus) {
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsViewVisibility newVis = GetStyleVisibility()->IsVisible() nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow ? nsViewVisibility_kShow
: nsViewVisibility_kHide; : nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different. // only change if different.
view->GetVisibility(oldVis); if (newVis != view->GetVisibility()) {
if (newVis != oldVis) { nsIViewManager* vm = view->GetViewManager();
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (vm) { if (vm) {
vm->SetViewVisibility(view, newVis); vm->SetViewVisibility(view, newVis);
} }
@ -1115,10 +1106,6 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
NS_ENSURE_ARG_POINTER(aPresContext); NS_ENSURE_ARG_POINTER(aPresContext);
NS_ENSURE_ARG_POINTER(aWidget); NS_ENSURE_ARG_POINTER(aWidget);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
float t2p; float t2p;
aPresContext->GetTwipsToPixels(&t2p); aPresContext->GetTwipsToPixels(&t2p);
@ -1138,8 +1125,7 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
GetOffsetFromView(aPresContext, origin, &parView); GetOffsetFromView(aPresContext, origin, &parView);
nsRect viewBounds(origin.x, origin.y, 10, 10); nsRect viewBounds(origin.x, origin.y, 10, 10);
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = aPresContext->GetViewManager();
presShell->GetViewManager(getter_AddRefs(viewMan));
rv = view->Init(viewMan, viewBounds, parView); rv = view->Init(viewMan, viewBounds, parView);
// XXX put it at the end of the document order until we can do better // XXX put it at the end of the document order until we can do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE); viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
@ -1151,7 +1137,7 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
rv = view->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE, rv = view->CreateWidget(kCChildCID, nsnull, nsnull, PR_TRUE, PR_TRUE,
xulElement? eContentTypeUI: eContentTypeContent); xulElement? eContentTypeUI: eContentTypeContent);
SetView(aPresContext, view); SetView(view);
nsContainerFrame::SyncFrameViewProperties(aPresContext, this, nsnull, view); nsContainerFrame::SyncFrameViewProperties(aPresContext, this, nsnull, view);
@ -1160,7 +1146,8 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
if (!GetStyleVisibility()->IsVisible()) { if (!GetStyleVisibility()->IsVisible()) {
viewMan->SetViewVisibility(view, nsViewVisibility_kHide); viewMan->SetViewVisibility(view, nsViewVisibility_kHide);
} }
view->GetWidget(*aWidget); *aWidget = view->GetWidget();
NS_IF_ADDREF(*aWidget);
return rv; return rv;
} }

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

@ -325,8 +325,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
aContext, aPrevInFlow); aContext, aPrevInFlow);
// find the highest ancestor that is a frameset // find the highest ancestor that is a frameset
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent(&parentFrame);
mTopLevelFrameset = (nsHTMLFramesetFrame*)this; mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
while (parentFrame) { while (parentFrame) {
nsHTMLFramesetFrame* frameset = nsnull; nsHTMLFramesetFrame* frameset = nsnull;
@ -334,7 +333,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
if (frameset) { if (frameset) {
mTopLevelFrameset = frameset; mTopLevelFrameset = frameset;
parentFrame->GetParent(&parentFrame); parentFrame = parentFrame->GetParent();
} else { } else {
break; break;
} }
@ -343,19 +342,16 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
// create the view. a view is needed since it needs to be a mouse grabber // create the view. a view is needed since it needs to be a mouse grabber
nsIView* view; nsIView* view;
nsresult result = CallCreateInstance(kViewCID, &view); nsresult result = CallCreateInstance(kViewCID, &view);
nsCOMPtr<nsIPresShell> presShell; nsIViewManager* viewMan = aPresContext->GetViewManager();
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIFrame* parWithView; nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView); GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext); nsIView *parView = parWithView->GetView();
nsRect boundBox(0, 0, 0, 0); nsRect boundBox(0, 0, 0, 0);
result = view->Init(viewMan, boundBox, parView); result = view->Init(viewMan, boundBox, parView);
// XXX Put it last in document order until we can do better // XXX Put it last in document order until we can do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE); viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
SetView(aPresContext, view); SetView(view);
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell)); aPresContext->GetShell(getter_AddRefs(shell));
@ -709,8 +705,7 @@ nsHTMLFramesetFrame::GetDesiredSize(nsIPresContext* aPresContext,
nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild) nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
{ {
nsHTMLFramesetFrame* parent = nsnull; nsHTMLFramesetFrame* parent = nsnull;
nsCOMPtr<nsIContent> content; nsIContent* content = aChild->GetContent();
aChild->GetContent(getter_AddRefs(content));
if (content) { if (content) {
nsCOMPtr<nsIContent> contentParent; nsCOMPtr<nsIContent> contentParent;
@ -724,8 +719,7 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
contentParent2->GetTag(getter_AddRefs(tag)); contentParent2->GetTag(getter_AddRefs(tag));
if (tag == nsHTMLAtoms::frameset) { if (tag == nsHTMLAtoms::frameset) {
nsIFrame* fptr; nsIFrame* fptr = aChild->GetParent();
aChild->GetParent(&fptr);
parent = (nsHTMLFramesetFrame*) fptr; parent = (nsHTMLFramesetFrame*) fptr;
} }
} }
@ -759,7 +753,7 @@ void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
// this assumption is used here // this assumption is used here
int i = 0; int i = 0;
for (nsIFrame* child = mFrames.FirstChild(); child; for (nsIFrame* child = mFrames.FirstChild(); child;
child->GetNextSibling(&child)) { child = child->GetNextSibling()) {
if (aChild == child) { if (aChild == child) {
nsPoint ignore; nsPoint ignore;
GetSizeOfChildAt(i, aSize, ignore); GetSizeOfChildAt(i, aSize, ignore);
@ -799,11 +793,9 @@ PRBool
nsHTMLFramesetFrame::IsGrabbingMouse() nsHTMLFramesetFrame::IsGrabbingMouse()
{ {
PRBool result = PR_FALSE; PRBool result = PR_FALSE;
nsIView* view; nsIView* view = GetView();
GetView(&view);
if (view) { if (view) {
nsIViewManager* viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(viewMan);
if (viewMan) { if (viewMan) {
nsIView* grabber; nsIView* grabber;
viewMan->GetMouseEventGrabber(grabber); viewMan->GetMouseEventGrabber(grabber);
@ -1217,7 +1209,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
lastCol = cellIndex.x; lastCol = cellIndex.x;
lastSize = size; lastSize = size;
offset.x += size.width; offset.x += size.width;
child->GetNextSibling(&child); child = child->GetNextSibling();
} }
if (firstTime) { if (firstTime) {
@ -1312,8 +1304,7 @@ PRBool
nsHTMLFramesetFrame::GetNoResize(nsIFrame* aChildFrame) nsHTMLFramesetFrame::GetNoResize(nsIFrame* aChildFrame)
{ {
PRBool result = PR_FALSE; PRBool result = PR_FALSE;
nsCOMPtr<nsIContent> content; nsIContent* content = aChildFrame->GetContent();
aChildFrame->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIHTMLContent> htmlContent(do_QueryInterface(content)); nsCOMPtr<nsIHTMLContent> htmlContent(do_QueryInterface(content));
@ -1456,10 +1447,9 @@ nsHTMLFramesetFrame::StartMouseDrag(nsIPresContext* aPresContext,
IndexOf(aBorder, index); IndexOf(aBorder, index);
NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger"); NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger");
#endif #endif
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(*getter_AddRefs(viewMan));
if (viewMan) { if (viewMan) {
PRBool ignore; PRBool ignore;
viewMan->GrabMouseEvents(view, ignore); viewMan->GrabMouseEvents(view, ignore);
@ -1542,21 +1532,13 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext* aPresContext,
if (change != 0) { if (change != 0) {
mDrag.Reset(mDragger->mVertical, mDragger->mPrevNeighbor, change, this); mDrag.Reset(mDragger->mVertical, mDragger->mPrevNeighbor, change, this);
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = GetParent();
GetParent((nsIFrame**)&parentFrame);
if (!parentFrame) { if (!parentFrame) {
return; return;
} }
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
if (!shell) {
return;
}
// Update the view immediately (make drag appear snappier) // Update the view immediately (make drag appear snappier)
nsCOMPtr<nsIViewManager> vm; nsIViewManager* vm = aPresContext->GetViewManager();
shell->GetViewManager(getter_AddRefs(vm));
if (vm) { if (vm) {
nsIView* root; nsIView* root;
vm->GetRootView(root); vm->GetRootView(root);
@ -1570,10 +1552,9 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext* aPresContext,
void void
nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext) nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext)
{ {
nsIView* view = GetView(aPresContext); nsIView* view = GetView();
if (view) { if (view) {
nsCOMPtr<nsIViewManager> viewMan; nsIViewManager* viewMan = view->GetViewManager();
view->GetViewManager(*getter_AddRefs(viewMan));
if (viewMan) { if (viewMan) {
mDragger = nsnull; mDragger = nsnull;
PRBool ignore; PRBool ignore;
@ -1763,8 +1744,7 @@ nsHTMLFramesetBorderFrame::HandleEvent(nsIPresContext* aPresContext,
switch (aEvent->message) { switch (aEvent->message) {
case NS_MOUSE_LEFT_BUTTON_DOWN: case NS_MOUSE_LEFT_BUTTON_DOWN:
nsHTMLFramesetFrame* parentFrame; nsHTMLFramesetFrame* parentFrame;
nsIFrame* fptr; nsIFrame* fptr = GetParent();
GetParent(&fptr);
parentFrame = (nsHTMLFramesetFrame*) fptr; parentFrame = (nsHTMLFramesetFrame*) fptr;
parentFrame->StartMouseDrag(aPresContext, this, aEvent); parentFrame->StartMouseDrag(aPresContext, this, aEvent);
*aEventStatus = nsEventStatus_eConsumeNoDefault; *aEventStatus = nsEventStatus_eConsumeNoDefault;