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

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

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

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

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

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

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