Bug 190735. Final patch for deCOMtamination of core nsIFrame methods! rs=dbaron

This commit is contained in:
uid502 2003-09-23 17:05:29 +00:00
Родитель c81673513f
Коммит 6bed557bd4
41 изменённых файлов: 204 добавлений и 721 удалений

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

@ -101,13 +101,9 @@ PRBool nsAccessibleHyperText::GetAllTextChildren(nsIPresContext *aPresContext, n
}
else {
if (frameType == nsAccessibilityAtoms::textFrame) {
nsRect frameRect;
aCurFrame->GetRect(frameRect);
// Skip the empty text frames that usually only consist of "\n"
if (! frameRect.IsEmpty()) {
nsCOMPtr<nsIContent> content;
aCurFrame->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (! aCurFrame->GetRect().IsEmpty()) {
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aCurFrame->GetContent()));
if (bSave || node == aNode) {
#ifdef DEBUG
nsAutoString text;
@ -133,8 +129,7 @@ PRBool nsAccessibleHyperText::GetAllTextChildren(nsIPresContext *aPresContext, n
return PR_TRUE;
}
nsIFrame* siblingFrame = nsnull;
aCurFrame->GetNextSibling(&siblingFrame);
nsIFrame* siblingFrame = aCurFrame->GetNextSibling();
return GetAllTextChildren(aPresContext, siblingFrame, aNode, bSave);
}

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

@ -659,10 +659,7 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
shell->GetPrimaryFrameFor(content, &frame);
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsRect frameRect;
if (NS_FAILED(frame->GetRect(frameRect))) {
return NS_ERROR_FAILURE;
}
nsRect frameRect = frame->GetRect();
nsCOMPtr<nsIRenderingContext> rc;
shell->CreateRenderingContext(frame, getter_AddRefs(rc));
@ -720,16 +717,14 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
}
//find the topest frame, add the offset recursively
nsRect tmpRect;
nsIFrame *parentFrame = nsnull, *tmpFrame = frame;
nsresult rv = tmpFrame->GetParent(&parentFrame);
while (NS_SUCCEEDED(rv) && parentFrame) {
if (NS_SUCCEEDED(parentFrame->GetRect(tmpRect))) {
tmpX += tmpRect.x;
tmpY += tmpRect.y;
}
nsIFrame* tmpFrame = frame;
nsIFrame* parentFrame = tmpFrame->GetParent();
while (parentFrame) {
nsPoint origin = parentFrame->GetPosition();
tmpX += origin.x;
tmpY += origin.y;
tmpFrame = parentFrame;
rv = tmpFrame->GetParent(&parentFrame);
parentFrame = tmpFrame->GetParent();
}
tmpX = NSTwipsToIntPixels(tmpX, t2p);

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

@ -217,8 +217,7 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr<nsIContent> content;
(*aRealFrame)->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIContent> content = (*aRealFrame)->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (!content || !node)
return NS_ERROR_FAILURE;

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

@ -444,8 +444,7 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
if (!shell)
return PR_FALSE;
nsCOMPtr<nsIViewManager> viewManager;
shell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = shell->GetViewManager();
if (!viewManager)
return PR_FALSE;
@ -473,10 +472,9 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
// We don't use the more accurate GetBoundsRect, because that is more expensive
// and the STATE_OFFSCREEN flag that this is used for only needs to be a rough indicator
nsRect relFrameRect;
nsRect relFrameRect = frame->GetRect();
nsPoint frameOffset;
frame->GetRect(relFrameRect);
nsIView *containingView = frame->GetViewExternal(presContext);
nsIView *containingView = frame->GetViewExternal();
if (!containingView) {
frame->GetOffsetFromView(presContext, frameOffset, &containingView);
if (!containingView)
@ -665,23 +663,22 @@ void nsAccessible::GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFram
if (aPresContext) {
PRInt32 offsetX = 0;
PRInt32 offsetY = 0;
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget = nsnull;
while (aFrame) {
// Look for a widget so we can get screen coordinates
nsIView* view = aFrame->GetViewExternal(aPresContext);
nsPoint origin;
nsIView* view = aFrame->GetViewExternal();
if (view) {
view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
if (widget)
break;
}
// No widget yet, so count up the coordinates of the frame
aFrame->GetOrigin(origin);
nsPoint origin = aFrame->GetPosition();
offsetX += origin.x;
offsetY += origin.y;
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
}
if (widget) {
@ -755,20 +752,19 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame
if (!IsCorrectFrameType(ancestorFrame, nsAccessibilityAtoms::inlineFrame) &&
!IsCorrectFrameType(ancestorFrame, nsAccessibilityAtoms::textFrame))
break;
ancestorFrame->GetParent(&ancestorFrame);
ancestorFrame = ancestorFrame->GetParent();
}
nsIFrame *iterFrame = firstFrame;
nsCOMPtr<nsIContent> firstContent(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIContent> iterContent(firstContent);
nsIContent* iterContent = firstContent;
PRInt32 depth = 0;
// Look only at frames below this depth, or at this depth (if we're still on the content node we started with)
while (iterContent == firstContent || depth > 0) {
// Coordinates will come back relative to parent frame
nsIFrame *parentFrame = iterFrame;
nsRect currFrameBounds;
iterFrame->GetRect(currFrameBounds);
nsRect currFrameBounds = iterFrame->GetRect();
// We just want the width and height - only get relative coordinates if we're not already
// at the bounding frame
@ -776,13 +772,9 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame
// Make this frame's bounds relative to common parent frame
while (parentFrame && parentFrame != *aBoundingFrame) {
nsRect parentFrameBounds;
parentFrame->GetRect(parentFrameBounds);
// Add this frame's bounds to our total rectangle
currFrameBounds.x += parentFrameBounds.x;
currFrameBounds.y += parentFrameBounds.y;
parentFrame->GetParent(&parentFrame);
currFrameBounds += parentFrame->GetPosition();
parentFrame = parentFrame->GetParent();
}
// Add this frame's bounds to total
@ -805,10 +797,10 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame
while (iterFrame) {
iterFrame->GetNextInFlow(&iterNextFrame);
if (!iterNextFrame)
iterFrame->GetNextSibling(&iterNextFrame);
iterNextFrame = iterFrame->GetNextSibling();
if (iterNextFrame || --depth < 0)
break;
iterFrame->GetParent(&iterFrame);
iterFrame = iterFrame->GetParent();
}
}
@ -818,7 +810,7 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame
break;
iterContent = nsnull;
if (depth == 0)
iterFrame->GetContent(getter_AddRefs(iterContent));
iterContent = iterFrame->GetContent();
}
}
@ -1493,8 +1485,7 @@ nsresult nsAccessible::GetParentBlockNode(nsIPresShell *aPresShell, nsIDOMNode *
nsIFrame *firstTextFrame = nsnull;
FindTextFrame(index, presContext, childFrame, &firstTextFrame, frame);
if (firstTextFrame) {
firstTextFrame->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(content));
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(firstTextFrame->GetContent()));
NS_IF_ADDREF(*aBlockNode = domNode);
return NS_OK;
}
@ -1513,8 +1504,7 @@ nsIFrame* nsAccessible::GetParentBlockFrame(nsIFrame *aFrame)
nsCOMPtr<nsIAtom> frameType;
frame->GetFrameType(getter_AddRefs(frameType));
while (frame && frameType != nsAccessibilityAtoms::blockFrame) {
nsIFrame* parentFrame = nsnull;
frame->GetParent(&parentFrame);
nsIFrame* parentFrame = frame->GetParent();
if (parentFrame)
parentFrame->GetFrameType(getter_AddRefs(frameType));
frame = parentFrame;
@ -1553,8 +1543,7 @@ PRBool nsAccessible::FindTextFrame(PRInt32 &index, nsIPresContext *aPresContext,
}
else {
if (frameType == nsAccessibilityAtoms::textFrame) {
nsRect frameRect;
aCurFrame->GetRect(frameRect);
nsRect frameRect = aCurFrame->GetRect();
// skip the empty frame
if (! frameRect.IsEmpty()) {
if (index == 0)
@ -1570,8 +1559,7 @@ PRBool nsAccessible::FindTextFrame(PRInt32 &index, nsIPresContext *aPresContext,
return PR_TRUE;
}
nsIFrame* siblingFrame = nsnull;
aCurFrame->GetNextSibling(&siblingFrame);
nsIFrame* siblingFrame = aCurFrame->GetNextSibling();
return FindTextFrame(index, aPresContext, siblingFrame, aFirstTextFrame, aTextFrame);
}
#endif //MOZ_ACCESSIBILITY_ATK

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

@ -162,16 +162,14 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
nsCOMPtr<nsIViewManager> viewManager;
presShell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = presShell->GetViewManager();
if (!presContext || !viewManager)
return NS_OK;
nsIView *view = nsnull;
viewManager->GetRootView(view);
if (!view)
return NS_OK;
nsCOMPtr<nsIWidget> widget;
view->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = view->GetWidget();
if (!widget)
return NS_OK;

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

@ -93,10 +93,9 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
if (shell) {
shell->GetDocument(getter_AddRefs(mDocument));
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsCOMPtr<nsIWidget> widget;
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetWidget(getter_AddRefs(widget));
if (widget) {
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
@ -417,8 +416,6 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
*aRelativeFrame = GetFrame();
nsCOMPtr<nsIDocument> document(mDocument);
nsRect viewBounds;
nsCOMPtr<nsIViewManager> vm;
nsCOMPtr<nsIDocument> parentDoc;
while (document) {
@ -427,24 +424,25 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
if (!presShell) {
return;
}
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
nsIScrollableView* scrollableView = nsnull;
if (vm)
vm->GetRootScrollableView(&scrollableView);
nsRect viewBounds(0, 0, 0, 0);
if (scrollableView) {
const nsIView *view = nsnull;
scrollableView->GetClipView(&view);
if (view) {
view->GetBounds(viewBounds);
viewBounds = view->GetBounds();
}
}
else {
nsIView *view;
vm->GetRootView(view);
if (view) {
view->GetBounds(viewBounds);
viewBounds = view->GetBounds();
}
}
@ -666,10 +664,9 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
void nsDocAccessible::AddScrollListener(nsIPresShell *aPresShell)
{
nsCOMPtr<nsIViewManager> vm;
nsIViewManager* vm = nsnull;
if (aPresShell)
aPresShell->GetViewManager(getter_AddRefs(vm));
vm = aPresShell->GetViewManager();
nsIScrollableView* scrollableView = nsnull;
if (vm)
@ -681,10 +678,9 @@ void nsDocAccessible::AddScrollListener(nsIPresShell *aPresShell)
void nsDocAccessible::RemoveScrollListener(nsIPresShell *aPresShell)
{
nsCOMPtr<nsIViewManager> vm;
nsIViewManager* vm = nsnull;
if (aPresShell)
aPresShell->GetViewManager(getter_AddRefs(vm));
vm = aPresShell->GetViewManager();
nsIScrollableView* scrollableView = nsnull;
if (vm)

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

@ -991,8 +991,7 @@ NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetValue(nsAString& _retval)
frame->FirstChild(context, nsnull, &frame);
frame->FirstChild(context, nsnull, &frame);
nsCOMPtr<nsIContent> content;
frame->GetContent(getter_AddRefs(content));
nsIContent* content = frame->GetContent();
if (!content)
return NS_ERROR_FAILURE;
@ -1024,7 +1023,7 @@ void nsHTMLComboboxTextFieldAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame*
frame->FirstChild(context, nsnull, aBoundingFrame);
frame->FirstChild(context, nsnull, &frame);
frame->GetRect(aBounds);
aBounds = frame->GetRect();
}
/** Return our cached parent */
@ -1104,14 +1103,12 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::DoAction(PRUint8 aIndex)
return NS_ERROR_FAILURE;
frame->FirstChild(context, nsnull, &frame);
frame->GetNextSibling(&frame);
nsCOMPtr<nsIContent> content;
frame->GetContent(getter_AddRefs(content));
frame = frame->GetNextSibling();
// We only have one action, click. Any other index is meaningless(wrong)
if (aIndex == eAction_Click) {
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
nsCOMPtr<nsIDOMHTMLInputElement>
element(do_QueryInterface(frame->GetContent()));
if (element)
{
element->Click();
@ -1167,10 +1164,7 @@ void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** a
return;
frame->FirstChild(context, nsnull, &frame); // first frame is for the textfield
frame->GetNextSibling(&frame); // sibling frame is for the button
frame->GetRect(aBounds);
aBounds = frame->GetNextSibling()->GetRect(); // sibling frame is for the button
}
/** We are a button. */
@ -1335,9 +1329,6 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
return;
}
frame->GetParent(aBoundingFrame);
frame->GetParent(&frame);
frame->GetRect(aBounds);
*aBoundingFrame = frame->GetParent();
aBounds = (*aBoundingFrame)->GetRect();
}

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

@ -239,8 +239,7 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
presShell->GetPrimaryFrameFor(content, &frame);
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> viewManager;
presShell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = presShell->GetViewManager();
NS_ASSERTION(viewManager, "No view manager for pres shell");
nsCOMPtr<nsIWidget> widget;
@ -258,9 +257,8 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
return E_FAIL;
}
nsRect startRect, endRect;
startFrame->GetRect(startRect);
endFrame->GetRect(endRect);
nsRect startRect = startFrame->GetRect();
nsRect endRect = endFrame->GetRect();
*aX = NSTwipsToIntPixels(startPoint.x + startRect.x, t2p);
*aY = NSTwipsToIntPixels(startPoint.y, t2p);

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

@ -1564,9 +1564,7 @@ nsDocShell::SetZoom(float zoom)
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// get the view manager
nsCOMPtr<nsIViewManager> vm;
NS_ENSURE_SUCCESS(presShell->GetViewManager(getter_AddRefs(vm)),
NS_ERROR_FAILURE);
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
// get the root scrollable view
@ -1891,8 +1889,7 @@ PrintDocTree(nsIDocShellTreeNode * aParentNode, int aLevel)
nsCOMPtr<nsIDOMWindowInternal> domwin(do_QueryInterface(sgo));
nsCOMPtr<nsIWidget> widget;
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
if (vm) {
vm->GetWidget(getter_AddRefs(widget));
}
@ -3150,12 +3147,7 @@ nsDocShell::Repaint(PRBool aForce)
docViewer->GetPresContext(getter_AddRefs(context));
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> shell;
context->GetShell(getter_AddRefs(shell));
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> viewManager;
shell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = context->GetViewManager();
NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
// what about aForce ?
@ -3226,9 +3218,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// get the view manager
nsCOMPtr<nsIViewManager> vm;
NS_ENSURE_SUCCESS(presShell->GetViewManager(getter_AddRefs(vm)),
NS_ERROR_FAILURE);
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
// get the root view
@ -3237,9 +3227,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
// if our root view is hidden, we are not visible
nsViewVisibility vis;
NS_ENSURE_SUCCESS(view->GetVisibility(vis), NS_ERROR_FAILURE);
if (vis == nsViewVisibility_kHide) {
if (view->GetVisibility() == nsViewVisibility_kHide) {
*aVisibility = PR_FALSE;
return NS_OK;
}
@ -3271,14 +3259,9 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
nsIFrame* frame;
pPresShell->GetPrimaryFrameFor(shellContent, &frame);
if (frame) {
nsCOMPtr<nsIPresContext> pc;
pPresShell->GetPresContext(getter_AddRefs(pc));
if (!frame->AreAncestorViewsVisible(pc)) {
*aVisibility = PR_FALSE;
return NS_OK;
}
if (frame && !frame->AreAncestorViewsVisible()) {
*aVisibility = PR_FALSE;
return NS_OK;
}
treeItem = parentItem;
@ -4785,8 +4768,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
docviewer->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
vm->GetDefaultBackgroundColor(&bgcolor);
@ -4863,8 +4845,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
docviewer->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
vm->SetDefaultBackgroundColor(bgcolor);
@ -6710,11 +6691,7 @@ nsDocShell::GetRootScrollableView(nsIScrollableView ** aOutScrollView)
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(shell)), NS_ERROR_FAILURE);
NS_ENSURE_TRUE(shell, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIViewManager> viewManager;
NS_ENSURE_SUCCESS(shell->GetViewManager(getter_AddRefs(viewManager)),
NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(viewManager->GetRootScrollableView(aOutScrollView),
NS_ENSURE_SUCCESS(shell->GetViewManager()->GetRootScrollableView(aOutScrollView),
NS_ERROR_FAILURE);
if (*aOutScrollView == nsnull) {
@ -6906,21 +6883,16 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus)
nsIFrame* frame;
presShell->GetPrimaryFrameFor(rootContent, &frame);
if (frame != nsnull) {
frame->GetParent(&frame);
if (frame != nsnull) {
if (frame) {
frame = frame->GetParent();
if (frame) {
nsICanvasFrame* canvasFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsICanvasFrame), (void**)&canvasFrame))) {
canvasFrame->SetHasFocus(aCanvasHasFocus);
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(getter_AddRefs(presContext));
nsIView* canvasView = frame->GetViewExternal(presContext);
nsIView* canvasView = frame->GetViewExternal();
nsCOMPtr<nsIViewManager> viewManager;
canvasView->GetViewManager(*getter_AddRefs(viewManager));
viewManager->UpdateView(canvasView, NS_VMREFRESH_NO_SYNC);
canvasView->GetViewManager()->UpdateView(canvasView, NS_VMREFRESH_NO_SYNC);
return NS_OK;
}

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

@ -1945,8 +1945,7 @@ GlobalWindowImpl::GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY)
rv = CallQueryInterface(view, &portView);
NS_ENSURE_SUCCESS(rv, rv);
nsRect portRect;
portView->GetBounds(portRect);
nsRect portRect = portView->GetBounds();
if (aScrollMaxX)
*aScrollMaxX = PR_MAX(0,
@ -2476,8 +2475,7 @@ GlobalWindowImpl::Focus()
nsresult result = NS_OK;
if (presShell) {
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetWidget(getter_AddRefs(widget));
@ -4276,16 +4274,14 @@ GlobalWindowImpl::Activate()
mDocShell->GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsIView* rootView;
vm->GetRootView(rootView);
NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE);
nsCOMPtr<nsIWidget> widget;
rootView->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = rootView->GetWidget();
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
return widget->SetFocus();
@ -4310,16 +4306,16 @@ GlobalWindowImpl::Activate()
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsIView *rootView;
vm->GetRootView(rootView);
NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE);
nsCOMPtr<nsIWidget> widget;
rootView->GetWidget(*getter_AddRefs(widget));
// We're holding a STRONG REF to the widget to ensure it doesn't go away
// during event processing
nsCOMPtr<nsIWidget> widget = rootView->GetWidget();
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
nsEventStatus status;
@ -4345,16 +4341,15 @@ GlobalWindowImpl::Deactivate()
mDocShell->GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsIView *rootView;
vm->GetRootView(rootView);
NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE);
nsCOMPtr<nsIWidget> widget;
rootView->GetWidget(*getter_AddRefs(widget));
// Hold a STRONG REF to keep the widget around during event processing
nsCOMPtr<nsIWidget> widget = rootView->GetWidget();
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
nsEventStatus status;
@ -5444,14 +5439,9 @@ GlobalWindowImpl::GetScrollInfo(nsIScrollableView **aScrollableView,
presContext->GetPixelsToTwips(aP2T);
presContext->GetTwipsToPixels(aT2P);
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
if (vm)
return vm->GetRootScrollableView(aScrollableView);
}
nsIViewManager* vm = presContext->GetViewManager();
if (vm)
return vm->GetRootScrollableView(aScrollableView);
}
return NS_OK;
}
@ -5722,16 +5712,14 @@ nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
mDocShell->GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsIView *rootView;
vm->GetRootView(rootView);
NS_ENSURE_TRUE(rootView, NS_ERROR_FAILURE);
nsCOMPtr<nsIWidget> widget;
rootView->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = rootView->GetWidget();
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
// Call esm and set cursor.

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

@ -275,8 +275,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
// is no way to do that right now. So we leave it null here and set
// up a nav html dtd in nsHTMLEditor::Init
ps->GetViewManager(&mViewManager);
mViewManager = ps->GetViewManager();
if (!mViewManager) {return NS_ERROR_NULL_POINTER;}
NS_ADDREF(mViewManager);
mUpdateCount=0;
InsertTextTxn::ClassInit();
@ -1979,29 +1980,17 @@ GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget
if (!frame)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresContext> presContext;
result = aPresShell->GetPresContext(getter_AddRefs(presContext));
if (NS_FAILED(result))
return result;
if (!presContext)
return NS_ERROR_FAILURE;
// Check first to see if this frame contains a view with a native widget.
nsIView *view = frame->GetViewExternal(presContext);
nsIView *view = frame->GetViewExternal();
if (view)
{
result = view->GetWidget(*aResult);
*aResult = view->GetWidget();
if (NS_FAILED(result))
return result;
if (*aResult)
if (*aResult) {
NS_ADDREF(*aResult);
return NS_OK;
}
}
// frame doesn't have a view with a widget, so call GetWindow()
@ -3663,9 +3652,7 @@ nsEditor::IsEditable(nsIDOMNode *aNode)
nsCOMPtr<nsITextContent> text(do_QueryInterface(content));
if (!text)
return PR_TRUE; // not a text node; has a frame
nsFrameState fs;
resultFrame->GetFrameState(&fs);
if ((fs & NS_FRAME_IS_DIRTY)) // we can only trust width data for undirty frames
if (resultFrame->GetStateBits() & NS_FRAME_IS_DIRTY) // we can only trust width data for undirty frames
{
// In the past a comment said:
// "assume all text nodes with dirty frames are editable"
@ -3674,9 +3661,7 @@ nsEditor::IsEditable(nsIDOMNode *aNode)
// and uses enhanced logic to find out in the HTML world.
return IsTextInDirtyFrameVisible(aNode);
}
nsRect rect;
resultFrame->GetRect(rect);
if (rect.width > 0)
if (resultFrame->GetSize().width > 0)
return PR_TRUE; // text node has width
}
return PR_FALSE; // didn't pass any editability test

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

@ -6011,30 +6011,21 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 &
if (nsHTMLEditUtils::IsHR(aElement)) {
nsIFrame* childFrame;
//frame->FirstChild(pcontext, nsnull, &childFrame);
frame->GetNextSibling(&childFrame);
frame = childFrame;
frame = frame->GetNextSibling();
}
PRInt32 offsetX = 0, offsetY = 0;
nsCOMPtr<nsIWidget> widget;
nsresult rv;
while (frame) {
// Look for a widget so we can get screen coordinates
nsIView* view = frame->GetViewExternal(pcontext);
if (view) {
rv = view->GetWidget(*getter_AddRefs(widget));
if (widget)
break;
}
nsIView* view = frame->GetViewExternal();
if (view && view->HasWidget())
break;
// No widget yet, so count up the coordinates of the frame
nsPoint origin;
frame->GetOrigin(origin);
nsPoint origin = frame->GetPosition();
offsetX += origin.x;
offsetY += origin.y;
frame->GetParent(&frame);
frame = frame->GetParent();
}
aX = NSTwipsToIntPixels(offsetX , t2p);

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

@ -1051,8 +1051,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent)
selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
#ifdef USE_HACK_REPAINT
// begin hack repaint
nsCOMPtr<nsIViewManager> viewmgr;
ps->GetViewManager(getter_AddRefs(viewmgr));
nsIViewManager* viewmgr = ps->GetViewManager();
if (viewmgr) {
nsIView* view;
viewmgr->GetRootView(view); // views are not refCounted
@ -1114,8 +1113,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
#ifdef USE_HACK_REPAINT
// begin hack repaint
nsCOMPtr<nsIViewManager> viewmgr;
ps->GetViewManager(getter_AddRefs(viewmgr));
nsIViewManager* viewmgr = ps->GetViewManager();
if (viewmgr)
{
nsIView* view;

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

@ -269,7 +269,7 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
// look for a background image on the element
do {
bg = frame->GetStyleBackground();
frame->GetParent(&frame);
frame = frame->GetParent();
} while (bg && bg->mBackgroundImage.IsEmpty() && frame);
if (bg && !bg->mBackgroundImage.IsEmpty())
@ -297,7 +297,7 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
presShell->GetPrimaryFrameFor(rootContent, &frame);
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
frame->GetParent(&frame);
frame = frame->GetParent();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsICanvasFrame* canvasFrame;
@ -347,8 +347,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon
if (aFrame && aBGFrame) {
*aBGFrame = aFrame; // default to the frame passed in
nsCOMPtr<nsIContent> pContent;
aFrame->GetContent(getter_AddRefs(pContent));
nsIContent* pContent = aFrame->GetContent();
if (pContent) {
// make sure that this is the HTML or BODY element
nsCOMPtr<nsIAtom> tag;
@ -359,8 +358,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon
tag.get() == mTag_html ||
tag.get() == mTag_body) {
// the frame is the body frame, so we provide the canvas frame
nsIFrame *pCanvasFrame = nsnull;
aFrame->GetParent(&pCanvasFrame);
nsIFrame *pCanvasFrame = aFrame->GetParent();
while (pCanvasFrame) {
nsCOMPtr<nsIAtom> parentType;
pCanvasFrame->GetFrameType(getter_AddRefs(parentType));
@ -369,7 +367,7 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon
*aBGFrame = pCanvasFrame;
break;
}
pCanvasFrame->GetParent(&pCanvasFrame);
pCanvasFrame = pCanvasFrame->GetParent();
}
}// if tag == html or body
}

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

@ -145,20 +145,13 @@ inFlasher::RepaintElement(nsIDOMElement* aElement)
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
if (!frame) return NS_OK;
nsCOMPtr<nsIPresContext> pcontext;
presShell->GetPresContext(getter_AddRefs(pcontext));
nsIFrame* parentWithView = nsnull;
frame->GetParentWithView(pcontext, &parentWithView);
nsIFrame* parentWithView = frame->GetAncestorWithView();
if (parentWithView) {
nsIView* view = parentWithView->GetViewExternal(pcontext);
nsIView* view = parentWithView->GetViewExternal();
if (view) {
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIViewManager* viewManager = view->GetViewManager();
if (viewManager) {
nsRect rect;
parentWithView->GetRect(rect);
nsRect rect = parentWithView->GetRect();
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
@ -182,8 +175,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
// get view bounds in case this frame is being scrolled
nsRect rect;
frame->GetRect(rect);
nsRect rect = frame->GetRect();
nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame);
rect.x = origin.x;
rect.y = origin.y;

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

@ -106,10 +106,8 @@ inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
already_AddRefed<nsIRenderingContext>
inLayoutUtils::GetRenderingContextFor(nsIPresShell* aShell)
{
nsCOMPtr<nsIViewManager> viewman;
aShell->GetViewManager(getter_AddRefs(viewman));
nsCOMPtr<nsIWidget> widget;
viewman->GetWidget(getter_AddRefs(widget));
aShell->GetViewManager()->GetWidget(getter_AddRefs(widget));
return widget->GetRenderingContext(); // AddRefs
}
@ -150,20 +148,16 @@ inLayoutUtils::GetClientOrigin(nsIPresContext* aPresContext,
aFrame->GetOffsetFromView(aPresContext, result, &view);
nsIView* rootView = nsnull;
if (view) {
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIViewManager* viewManager = view->GetViewManager();
NS_ASSERTION(viewManager, "View must have a viewmanager");
viewManager->GetRootView(rootView);
}
while (view) {
nscoord x, y;
view->GetPosition(&x, &y);
result.x += x;
result.y += y;
result += view->GetPosition();
if (view == rootView) {
break;
}
view->GetParent(view);
view = view->GetParent();
}
return result;
}
@ -190,28 +184,27 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
if (presContext) {
nsIFrame* frame = nsnull;
nsresult rv = presShell->GetPrimaryFrameFor(content, &frame);
presShell->GetPrimaryFrameFor(content, &frame);
PRInt32 offsetX = 0;
PRInt32 offsetY = 0;
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget = nsnull;
while (frame) {
// Look for a widget so we can get screen coordinates
nsIView* view = frame->GetViewExternal(presContext);
nsIView* view = frame->GetViewExternal();
if (view) {
rv = view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
if (widget)
break;
}
// No widget yet, so count up the coordinates of the frame
nsPoint origin;
frame->GetOrigin(origin);
nsPoint origin = frame->GetPosition();
offsetX += origin.x;
offsetY += origin.y;
frame->GetParent(&frame);
frame = frame->GetParent();
}
if (widget) {

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

@ -109,9 +109,7 @@ view_manager(nsIDocShell *aDocShell)
nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
if (!shell)
return nsnull;
nsIViewManager *result = nsnull;
shell->GetViewManager(&result);
return result;
return shell->GetViewManager();
}
static already_AddRefed<nsIDocument>

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

@ -2228,10 +2228,10 @@ void
nsTypeAheadFind::RemoveDocListeners()
{
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mFocusedWeakShell));
nsCOMPtr<nsIViewManager> vm;
nsIViewManager* vm = nsnull;
if (presShell) {
presShell->GetViewManager(getter_AddRefs(vm));
vm = presShell->GetViewManager();
}
nsIScrollableView* scrollableView = nsnull;
@ -2265,8 +2265,7 @@ nsTypeAheadFind::AttachDocListeners(nsIPresShell *aPresShell)
return;
}
nsCOMPtr<nsIViewManager> vm;
aPresShell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = aPresShell->GetViewManager();
if (!vm) {
return;
}
@ -2634,8 +2633,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
// Set up the variables we need, return true if we can't get at them all
const PRUint16 kMinPixels = 12;
nsCOMPtr<nsIViewManager> viewManager;
aPresShell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = aPresShell->GetViewManager();
if (!viewManager) {
return PR_TRUE;
}
@ -2644,7 +2642,6 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
// We don't use the more accurate AccGetBounds, because that is
// more expensive and the STATE_OFFSCREEN flag that this is used
// for only needs to be a rough indicator
nsRect relFrameRect;
nsIView *containingView = nsnull;
nsPoint frameOffset;
float p2t;
@ -2652,7 +2649,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
nsRectVisibility rectVisibility = nsRectVisibility_kAboveViewport;
if (!aGetTopVisibleLeaf) {
frame->GetRect(relFrameRect);
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
if (!containingView) {
// no view -- not visible
@ -2697,7 +2694,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return PR_FALSE;
}
frame->GetRect(relFrameRect);
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
if (containingView) {
relFrameRect.x = frameOffset.x;
@ -2710,10 +2707,8 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
}
if (frame) {
nsCOMPtr<nsIContent> firstVisibleContent;
frame->GetContent(getter_AddRefs(firstVisibleContent));
nsCOMPtr<nsIDOMNode> firstVisibleNode =
do_QueryInterface(firstVisibleContent);
do_QueryInterface(frame->GetContent());
if (firstVisibleNode) {
(*aFirstVisibleRange)->SelectNode(firstVisibleNode);

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

@ -156,9 +156,8 @@ mozXMLTermUtils::GetPresContextScrollableView(nsIPresContext* aPresContext,
if (NS_FAILED(result) || !presShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIViewManager> viewManager;
result = presShell->GetViewManager(getter_AddRefs(viewManager));
if (NS_FAILED(result) || !viewManager)
nsIViewManager* viewManager = presShell->GetViewManager();
if (!viewManager)
return NS_ERROR_FAILURE;
return viewManager->GetRootScrollableView(aScrollableView);
@ -183,14 +182,8 @@ mozXMLTermUtils::GetPresContextDeviceContext(nsIPresContext* aPresContext,
*aDeviceContext = nsnull;
nsCOMPtr<nsIPresShell> presShell;
result = aPresContext->GetShell(getter_AddRefs(presShell));
if (NS_FAILED(result) || !presShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIViewManager> viewManager;
result = presShell->GetViewManager(getter_AddRefs(viewManager));
if (NS_FAILED(result) || !viewManager)
nsIViewManager* viewManager = aPresContext->GetViewManager();
if (!viewManager)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDeviceContext> deviceContext;

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

@ -100,9 +100,7 @@ static void GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult)
if (!aFrame)
return;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIDocument* doc = content->GetDocument();
nsIDocument* doc = aFrame->GetContent()->GetDocument();
if (doc)
doc->GetShellAt(0, aResult); // Addref happens here.
}
@ -115,8 +113,7 @@ static void RefreshWidgetWindow(nsIFrame* aFrame)
if (!shell)
return;
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = shell->GetViewManager();
if (!vm)
return;
@ -136,11 +133,9 @@ static PRInt32 GetContentState(nsIFrame* aFrame)
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
nsCOMPtr<nsIEventStateManager> esm;
context->GetEventStateManager(getter_AddRefs(esm));
shell->GetPresContext()->GetEventStateManager(getter_AddRefs(esm));
PRInt32 flags = 0;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
esm->GetContentState(content, flags);
esm->GetContentState(aFrame->GetContent(), flags);
return flags;
}
@ -148,10 +143,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
{
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsAutoString attr;
nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr);
nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
if (res == NS_CONTENT_ATTR_NO_VALUE ||
(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty()))
return PR_TRUE; // This handles the HTML case (an attr with no value is like a true val)
@ -163,8 +156,7 @@ static PRInt32 CheckIntegerAttr(nsIFrame *aFrame, nsIAtom *aAtom)
if (!aFrame)
return 0;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (!content)
return 0;
@ -205,7 +197,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
} else {
// for dropdown textfields, look at the parent frame (the textbox)
if (aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD)
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
PRInt32 eventState = GetContentState(aFrame);
@ -222,9 +214,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) {
// for scrollbars we need to go up two to go from the thumb to
// the slider to the actual scrollbar object
nsIFrame *tmpFrame = aFrame;
tmpFrame->GetParent(&tmpFrame);
tmpFrame->GetParent(&tmpFrame);
nsIFrame *tmpFrame = aFrame->GetParent()->GetParent();
aState->curpos = CheckIntegerAttr(tmpFrame, mCurPosAtom);
aState->maxpos = CheckIntegerAttr(tmpFrame, mMaxPosAtom);
@ -252,10 +242,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
if (aFrame) {
// For XUL checkboxes and radio buttons, the state of the parent
// determines our state.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content->IsContentOfType(nsIContent::eXUL))
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
else {
nsCOMPtr<nsIAtom> tag;
content->GetTag(getter_AddRefs(tag));
@ -340,10 +329,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
else if (aWidgetType == NS_THEME_TAB_LEFT_EDGE)
*aWidgetFlags |= MOZ_GTK_TAB_BEFORE_SELECTED;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->HasAttr(kNameSpaceID_None, mFirstTabAtom))
*aWidgetFlags |= MOZ_GTK_TAB_FIRST;
if (aFrame->GetContent()->HasAttr(kNameSpaceID_None, mFirstTabAtom))
*aWidgetFlags |= MOZ_GTK_TAB_FIRST;
}
aGtkWidgetType = MOZ_GTK_TAB;
@ -581,9 +568,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
// Check for specific widgets to see if HTML has overridden the style.
if (aFrame) {
// For now don't support HTML.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML))
if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML))
return PR_FALSE;
}

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

@ -752,12 +752,8 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aF
{
#ifndef MOZ_WIDGET_COCOA
// Only support HTML widgets for Cocoa
if (aFrame) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML))
return PR_FALSE;
}
if (aFrame && aFrame->GetContent()->IsContentOfType(nsIContent::eHTML))
return PR_FALSE;
#endif
if (aPresContext) {

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

@ -171,14 +171,12 @@ NS_IMETHODIMP DeviceContextImpl::CreateRenderingContext(nsIView *aView, nsIRende
#endif
nsresult rv;
nsCOMPtr<nsIWidget> win;
aView->GetWidget(*getter_AddRefs(win));
aContext = nsnull;
nsCOMPtr<nsIRenderingContext> pContext;
rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
if (NS_SUCCEEDED(rv)) {
rv = InitRenderingContext(pContext, win.get());
rv = InitRenderingContext(pContext, aView->GetWidget());
if (NS_SUCCEEDED(rv)) {
aContext = pContext;
NS_ADDREF(aContext);

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

@ -76,10 +76,7 @@ nsNativeTheme::GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult)
if (!aFrame)
return;
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
doc = content->GetDocument();
nsIDocument* doc = aFrame->GetContent()->GetDocument();
if (doc)
doc->GetShellAt(0, aResult); // addrefs
}
@ -91,13 +88,9 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
return 0;
PRBool isXULCheckboxRadio = PR_FALSE;
if (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) {
nsCOMPtr<nsIContent> checkboxRadioContent;
aFrame->GetContent(getter_AddRefs(checkboxRadioContent));
isXULCheckboxRadio = checkboxRadioContent->IsContentOfType(nsIContent::eXUL);
if (isXULCheckboxRadio)
aFrame->GetParent(&aFrame);
}
if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO)
&& aFrame->GetContent()->IsContentOfType(nsIContent::eXUL))
aFrame = aFrame->GetParent();
nsCOMPtr<nsIPresShell> shell;
GetPrimaryPresShell(aFrame, getter_AddRefs(shell));
@ -109,9 +102,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
nsCOMPtr<nsIEventStateManager> esm;
context->GetEventStateManager(getter_AddRefs(esm));
PRInt32 flags = 0;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
esm->GetContentState(content, flags);
esm->GetContentState(aFrame->GetContent(), flags);
if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {
if (IsFocused(aFrame))
@ -127,8 +118,7 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
nsAutoString attr;
nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr);
@ -154,10 +144,8 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom)
if (!aFrame)
return 0;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsAutoString attr;
content->GetAttr(kNameSpaceID_None, aAtom, attr);
aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
PRInt32 err, value = attr.ToInteger(&err);
if (NS_FAILED(err))
return 0;
@ -171,9 +159,7 @@ nsNativeTheme::GetAttr(nsIFrame* aFrame, nsIAtom* aAtom, nsAString& attrValue)
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attrValue);
nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attrValue);
return ((res != NS_CONTENT_ATTR_NOT_THERE) &&
!(res != NS_CONTENT_ATTR_NO_VALUE && attrValue.IsEmpty()));
}
@ -184,13 +170,12 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, PRBool aCheckSelected)
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content->IsContentOfType(nsIContent::eXUL)) {
// For a XUL checkbox or radio button, the state of the parent determines
// the checked state
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
} else {
// Check for an HTML input element
nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
@ -221,10 +206,7 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
if (aFrame && (aWidgetType == NS_THEME_BUTTON ||
aWidgetType == NS_THEME_TEXTFIELD)) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML)) {
if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) {
nscolor defaultBGColor, defaultBorderColor;
PRUint8 defaultBorderStyle;
nsMargin defaultBorderSize;

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

@ -307,9 +307,7 @@ static void GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult)
if (!aFrame)
return;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIDocument* doc = content->GetDocument();
nsIDocument* doc = aFrame->GetContent()->GetDocument();
if (doc)
doc->GetShellAt(0, aResult); // Addref happens here.
}
@ -329,9 +327,7 @@ static PRInt32 GetContentState(nsIFrame* aFrame)
nsCOMPtr<nsIEventStateManager> esm;
context->GetEventStateManager(getter_AddRefs(esm));
PRInt32 flags = 0;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
esm->GetContentState(content, flags);
esm->GetContentState(aFrame->GetContent(), flags);
return flags;
}
@ -339,10 +335,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
{
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsAutoString attr;
nsresult res = content->GetAttr(kNameSpaceID_None, aAtom, attr);
nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
if (res == NS_CONTENT_ATTR_NO_VALUE ||
(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty()))
return PR_TRUE; // This handles the HTML case (an attr with no value is like a true val)
@ -356,10 +350,8 @@ GetAttribute(nsIFrame* aFrame, nsIAtom* inAttribute, nsCString& outValue)
if (!aFrame)
return PR_FALSE;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsAutoString attr;
nsresult res = content->GetAttr(kNameSpaceID_None, inAttribute, attr);
nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, inAttribute, attr);
outValue = NS_LossyConvertUCS2toASCII(attr).get();
return ( res != NS_CONTENT_ATTR_NO_VALUE &&
!(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty()));
@ -379,10 +371,8 @@ PRBool nsNativeThemeWin::IsChecked(nsIFrame* aFrame)
{
if (!aFrame)
return NS_OK;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsAutoString checked;
nsresult res = content->GetAttr(kNameSpaceID_None, mCheckedAtom, checked);
nsresult res = aFrame->GetContent()->GetAttr(kNameSpaceID_None, mCheckedAtom, checked);
if (res == NS_CONTENT_ATTR_NO_VALUE)
return PR_TRUE; // XXXdwh Can the HTML form control's checked property differ
// from the checked attribute? If so, will need an IsContentofType
@ -455,10 +445,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
else {
// For XUL checkboxes and radio buttons, the state of the parent
// determines our state.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content->IsContentOfType(nsIContent::eXUL))
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
else {
// Attempt a QI.
nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(content));
@ -726,11 +715,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
case NS_THEME_DROPDOWN_BUTTON: {
aPart = CBP_DROPMARKER;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
nsIFrame* parentFrame;
aFrame->GetParent(&parentFrame);
nsIFrame* parentFrame = aFrame->GetParent();
nsCOMPtr<nsIMenuFrame> menuFrame(do_QueryInterface(parentFrame));
if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) )
// XUL menu lists and HTML selects get state from parent
@ -813,11 +800,8 @@ nsNativeThemeWin::DrawWidgetBackground(nsIRenderingContext* aContext,
// Draw focus rectangles for XP HTML checkboxes and radio buttons
// XXX it'd be nice to draw these outside of the frame
if (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML)) {
if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO)
&& aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) {
PRInt32 contentState ;
contentState = GetContentState(aFrame);
@ -830,7 +814,6 @@ nsNativeThemeWin::DrawWidgetBackground(nsIRenderingContext* aContext,
::DrawFocusRect(hdc, &widgetRect);
::SetTextColor(hdc, oldColor);
}
}
}
return NS_OK;
}
@ -887,8 +870,7 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext,
aResult->left = 0;
if (aFrame && aWidgetType == NS_THEME_TEXTFIELD) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content && content->IsContentOfType(nsIContent::eHTML)) {
// We need to pad textfields by 1 pixel, since the caret will draw
// flush against the edge by default if we don't.
@ -1066,9 +1048,7 @@ nsNativeThemeWin::ThemeChanged()
PRBool nsNativeThemeWin::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType)
{
if (aFrame && (aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD)) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (content->IsContentOfType(nsIContent::eHTML)) {
if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) {
// Get default CSS style values for widget
// (these need to match the values in forms.css)
@ -1281,8 +1261,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
break;
case NS_THEME_TEXTFIELD: {
(*aResult).top = (*aResult).bottom = 2;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content && content->IsContentOfType(nsIContent::eHTML))
// HTML text-fields need extra padding
(*aResult).left = (*aResult).right = 3;
@ -1295,12 +1274,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
(*aResult).top = 1;
(*aResult).left = 1;
(*aResult).bottom = 1;
nsIFrame* hasSibling = nsnull;
aFrame->GetNextSibling(&hasSibling);
if (hasSibling)
(*aResult).right = 3;
else
(*aResult).right = 1;
(*aResult).right = aFrame->GetNextSibling() ? 3 : 1;
break;
}
case NS_THEME_TOOLTIP:
@ -1418,9 +1392,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
// The down state is flat if the button is focusable
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (!content->IsContentOfType(nsIContent::eHTML))
if (!aFrame->GetContent()->IsContentOfType(nsIContent::eHTML))
aState |= DFCS_FLAT;
aFocused = PR_TRUE;
}
@ -1439,15 +1411,14 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
PRInt32 contentState ;
PRBool isDisabled = PR_FALSE;
aFocused = PR_FALSE;
nsCOMPtr<nsIContent> content;
aPart = DFC_BUTTON;
aState = (aWidgetType == NS_THEME_CHECKBOX) ? DFCS_BUTTONCHECK : DFCS_BUTTONRADIO;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
if (content->IsContentOfType(nsIContent::eXUL)) {
// XUL
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
if (aWidgetType == NS_THEME_CHECKBOX) {
if (IsChecked(aFrame))
aState |= DFCS_CHECKED;
@ -1508,11 +1479,8 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
aPart = DFC_SCROLL;
aState = DFCS_SCROLLCOMBOBOX;
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIFrame* parentFrame;
aFrame->GetParent(&parentFrame);
nsIContent* content = aFrame->GetContent();
nsIFrame* parentFrame = aFrame->GetParent();
nsCOMPtr<nsIMenuFrame> menuFrame(do_QueryInterface(parentFrame));
if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) )
// XUL menu lists and HTML selects get state from parent
@ -1757,11 +1725,10 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsIRenderingContext* aCon
// Draw inset edge
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
// Fill in background
if (IsDisabled(aFrame) || (content->IsContentOfType(nsIContent::eXUL) && IsReadOnly(aFrame)))
if (IsDisabled(aFrame) ||
(aFrame->GetContent()->IsContentOfType(nsIContent::eXUL) &&
IsReadOnly(aFrame)))
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
else
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_WINDOW+1));
@ -1797,9 +1764,7 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsIRenderingContext* aCon
}
// Draw 3D inset statusbar panel
case NS_THEME_STATUSBAR_PANEL: {
nsIFrame* hasSibling = nsnull;
aFrame->GetNextSibling(&hasSibling);
if (hasSibling)
if (aFrame->GetNextSibling())
widgetRect.right -= 2; // space between sibling status panels
::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);

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

@ -3009,7 +3009,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),

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

@ -1218,67 +1218,6 @@ public:
*/
virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; }
// DEPRECATED COMPATIBILITY METHODS
nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; }
nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; }
nsresult GetRect(nsRect& aRect) const {
aRect = mRect;
return NS_OK;
}
nsresult GetOrigin(nsPoint& aPoint) const {
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
nsresult GetSize(nsSize& aSize) const {
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
nsresult SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) {
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
nsresult MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) {
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
nsresult SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) {
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
nsresult GetNextSibling(nsIFrame** aNextSibling) const {
*aNextSibling = mNextSibling;
return NS_OK;
}
nsresult GetFrameState(nsFrameState* aResult) {
*aResult = mState;
return NS_OK;
}
nsresult SetFrameState(nsFrameState aState) {
mState = aState;
return NS_OK;
}
nsIView* GetView(nsIPresContext* aPresContext) const { return GetView(); }
nsIView* GetViewExternal(nsIPresContext* aPresContext) const { return GetViewExternal(); }
nsresult SetView(nsIPresContext* aPresContext, nsIView* aView) { return SetView(aView); }
nsIView* GetClosestView(nsIPresContext* aPresContext) const { return GetClosestView(); }
nsresult GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const {
*aParent = GetAncestorWithViewExternal();
return NS_OK;
}
PRBool AreAncestorViewsVisible(nsIPresContext* aPresContext) const {
return AreAncestorViewsVisible();
}
protected:
// Members
nsRect mRect;

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

@ -407,8 +407,7 @@ nsBulletFrame::SetListItemOrdinal(PRInt32 aNextOrdinal,
// value attribute. Note: we do this with our parent's content
// because our parent is the list-item.
nsHTMLValue value;
nsCOMPtr<nsIContent> parentContent;
mParent->GetContent(getter_AddRefs(parentContent));
nsIContent* parentContent = mParent->GetContent();
if (parentContent) {
nsCOMPtr<nsIHTMLContent> hc = do_QueryInterface(parentContent);
if (hc) {

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

@ -342,9 +342,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
nsresult result = CallCreateInstance(kViewCID, &view);
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView();
nsIView *parView = GetAncestorWithView()->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

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

@ -1218,67 +1218,6 @@ public:
*/
virtual PRBool SupportsVisibilityHidden() { return PR_TRUE; }
// DEPRECATED COMPATIBILITY METHODS
nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; }
nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; }
nsresult GetRect(nsRect& aRect) const {
aRect = mRect;
return NS_OK;
}
nsresult GetOrigin(nsPoint& aPoint) const {
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
nsresult GetSize(nsSize& aSize) const {
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
nsresult SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) {
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
nsresult MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) {
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
nsresult SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) {
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
nsresult GetNextSibling(nsIFrame** aNextSibling) const {
*aNextSibling = mNextSibling;
return NS_OK;
}
nsresult GetFrameState(nsFrameState* aResult) {
*aResult = mState;
return NS_OK;
}
nsresult SetFrameState(nsFrameState aState) {
mState = aState;
return NS_OK;
}
nsIView* GetView(nsIPresContext* aPresContext) const { return GetView(); }
nsIView* GetViewExternal(nsIPresContext* aPresContext) const { return GetViewExternal(); }
nsresult SetView(nsIPresContext* aPresContext, nsIView* aView) { return SetView(aView); }
nsIView* GetClosestView(nsIPresContext* aPresContext) const { return GetClosestView(); }
nsresult GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const {
*aParent = GetAncestorWithViewExternal();
return NS_OK;
}
PRBool AreAncestorViewsVisible(nsIPresContext* aPresContext) const {
return AreAncestorViewsVisible();
}
protected:
// Members
nsRect mRect;

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

@ -407,8 +407,7 @@ nsBulletFrame::SetListItemOrdinal(PRInt32 aNextOrdinal,
// value attribute. Note: we do this with our parent's content
// because our parent is the list-item.
nsHTMLValue value;
nsCOMPtr<nsIContent> parentContent;
mParent->GetContent(getter_AddRefs(parentContent));
nsIContent* parentContent = mParent->GetContent();
if (parentContent) {
nsCOMPtr<nsIHTMLContent> hc = do_QueryInterface(parentContent);
if (hc) {

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

@ -3009,7 +3009,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),

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

@ -342,9 +342,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
nsresult result = CallCreateInstance(kViewCID, &view);
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView();
nsIView *parView = GetAncestorWithView()->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

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

@ -362,7 +362,7 @@ public:
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
virtual void GetNextFrame(nsIFrame* aFrame,
nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
nsIFrame** aResult) { *aResult = aFrame->GetNextSibling(); };
PRBool IsRepeatable() const;
void SetRepeatable(PRBool aRepeatable);
PRBool HasStyleHeight() const;

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

@ -362,7 +362,7 @@ public:
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
virtual void GetNextFrame(nsIFrame* aFrame,
nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
nsIFrame** aResult) { *aResult = aFrame->GetNextSibling(); };
PRBool IsRepeatable() const;
void SetRepeatable(PRBool aRepeatable);
PRBool HasStyleHeight() const;

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

@ -445,10 +445,8 @@ nsBox::RelayoutStyleChange(nsBoxLayoutState& aState, nsIBox* aChild)
NS_IMETHODIMP
nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
{
nsFrameState state;
nsIFrame* frame;
GetFrame(&frame);
frame->GetFrameState(&state);
if (aChild != nsnull) {
nsCOMPtr<nsIBoxLayout> layout;

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

@ -317,21 +317,6 @@ public:
*/
virtual PRBool IsRoot() const = 0;
// DEPRECATED METHODS to be removed by roc
NS_IMETHOD HasWidget(PRBool *aHasWidget) const = 0;
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const = 0;
NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0;
NS_IMETHOD GetParent(nsIView *&aParent) const = 0;
NS_IMETHOD GetFirstChild(nsIView* &aChild) const = 0;
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0;
NS_IMETHOD GetOpacity(float &aOpacity) const = 0;
NS_IMETHOD GetClientData(void *&aData) const = 0;
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const = 0;
NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) const = 0;
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const = 0;
NS_IMETHOD GetPosition(nscoord *aX, nscoord *aY) const = 0;
NS_IMETHOD GetBounds(nsRect &aBounds) const = 0;
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;

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

@ -260,13 +260,6 @@ NS_IMETHODIMP nsView::Destroy()
return NS_OK;
}
NS_IMETHODIMP nsView::GetViewManager(nsIViewManager *&aViewMgr) const
{
NS_IF_ADDREF(mViewManager);
aViewMgr = mViewManager;
return NS_OK;
}
NS_IMETHODIMP nsView::Paint(nsIRenderingContext& rc, const nsRect& rect,
PRUint32 aPaintFlags, PRBool &aResult)
{
@ -452,22 +445,6 @@ NS_IMETHODIMP nsView::SynchWidgetSizePosition()
return NS_OK;
}
NS_IMETHODIMP nsView::GetPosition(nscoord *x, nscoord *y) const
{
nsView *rootView = mViewManager->GetRootView();
if (this == rootView)
*x = *y = 0;
else
{
*x = mPosX;
*y = mPosY;
}
return NS_OK;
}
void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint)
{
nsRect dims = aRect;
@ -517,23 +494,6 @@ void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint)
}
}
NS_IMETHODIMP nsView::GetBounds(nsRect &aBounds) const
{
NS_ASSERTION(mViewManager, "mViewManager is null!");
if (!mViewManager) {
aBounds.x = aBounds.y = 0;
return NS_ERROR_FAILURE;
}
nsView *rootView = mViewManager->GetRootView();
aBounds = mDimBounds;
if (this == rootView)
aBounds.x = aBounds.y = 0;
return NS_OK;
}
NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility)
{
@ -557,20 +517,6 @@ NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility)
return NS_OK;
}
NS_IMETHODIMP nsView::GetVisibility(nsViewVisibility &aVisibility) const
{
aVisibility = mVis;
return NS_OK;
}
NS_IMETHODIMP nsView::GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const
{
aAuto = (mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0;
aZIndex = mZIndex;
aTopMost = (mVFlags & NS_VIEW_FLAG_TOPMOST) != 0;
return NS_OK;
}
NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
{
if (aFloatingView)
@ -588,30 +534,6 @@ NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
return NS_OK;
}
NS_IMETHODIMP nsView::GetFloating(PRBool &aFloatingView) const
{
aFloatingView = ((mVFlags & NS_VIEW_FLAG_FLOATING) != 0);
return NS_OK;
}
NS_IMETHODIMP nsView::GetParent(nsIView *&aParent) const
{
aParent = mParent;
return NS_OK;
}
NS_IMETHODIMP nsView::GetFirstChild(nsIView *&aChild) const
{
aChild = mFirstChild;
return NS_OK;
}
NS_IMETHODIMP nsView::GetNextSibling(nsIView *&aNextSibling) const
{
aNextSibling = mNextSibling;
return NS_OK;
}
void nsView::InsertChild(nsView *aChild, nsView *aSibling)
{
NS_PRECONDITION(nsnull != aChild, "null ptr");
@ -664,29 +586,12 @@ void nsView::RemoveChild(nsView *child)
}
}
nsView* nsView::GetChild(PRInt32 aIndex) const
{
for (nsView* child = GetFirstChild(); child; child = child->GetNextSibling()) {
if (aIndex == 0) {
return child;
}
--aIndex;
}
return nsnull;
}
NS_IMETHODIMP nsView::SetOpacity(float opacity)
{
mOpacity = opacity;
return NS_OK;
}
NS_IMETHODIMP nsView::GetOpacity(float &aOpacity) const
{
aOpacity = mOpacity;
return NS_OK;
}
NS_IMETHODIMP nsView::HasTransparency(PRBool &aTransparent) const
{
aTransparent = (mVFlags & NS_VIEW_FLAG_TRANSPARENT) ? PR_TRUE : PR_FALSE;
@ -709,12 +614,6 @@ NS_IMETHODIMP nsView::SetClientData(void *aData)
return NS_OK;
}
NS_IMETHODIMP nsView::GetClientData(void *&aData) const
{
aData = mClientData;
return NS_OK;
}
NS_IMETHODIMP nsView::CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData,
nsNativeWidget aNative,
@ -811,19 +710,6 @@ NS_IMETHODIMP nsView::SetWidget(nsIWidget *aWidget)
return NS_OK;
}
NS_IMETHODIMP nsView::GetWidget(nsIWidget *&aWidget) const
{
NS_IF_ADDREF(mWindow);
aWidget = mWindow;
return NS_OK;
}
NS_IMETHODIMP nsView::HasWidget(PRBool *aHasWidget) const
{
*aHasWidget = (mWindow != nsnull);
return NS_OK;
}
//
// internal window creation functions
//

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

@ -82,16 +82,6 @@ public:
const nsRect &aBounds,
const nsIView *aParent,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) const;
NS_IMETHOD GetPosition(nscoord *x, nscoord *y) const;
NS_IMETHOD GetBounds(nsRect &aBounds) const;
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const;
NS_IMETHOD GetFloating(PRBool &aFloatingView) const;
NS_IMETHOD GetParent(nsIView *&aParent) const;
NS_IMETHOD GetFirstChild(nsIView* &aChild) const;
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const;
NS_IMETHOD GetOpacity(float &aOpacity) const;
/**
* Used to ask a view if it has any areas within its bounding box
* that are transparent. This is not the same as opacity - opacity can
@ -100,7 +90,6 @@ public:
*/
NS_IMETHOD HasTransparency(PRBool &aTransparent) const;
NS_IMETHOD SetClientData(void *aData);
NS_IMETHOD GetClientData(void *&aData) const;
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget);
NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData = nsnull,
@ -108,8 +97,6 @@ public:
PRBool aEnableDragDrop = PR_TRUE,
PRBool aResetVisibility = PR_TRUE,
nsContentType aContentType = eContentTypeInherit);
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const;
NS_IMETHOD HasWidget(PRBool *aHasWidget) const;
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
NS_IMETHOD Destroy();
@ -290,26 +277,6 @@ public:
nsRect GetDimensions() const { nsRect r = mDimBounds; r.MoveBy(-mPosX, -mPosY); return r; }
// These are defined exactly the same in nsIView, but for now they have to be redeclared
// here because of stupid C++ method hiding rules
PRBool GetFloating() const { return (mVFlags & NS_VIEW_FLAG_FLOATING) != 0; }
float GetOpacity() const { return mOpacity; }
void* GetClientData() const { return mClientData; }
nsViewVisibility GetVisibility() const { return mVis; }
nsRect GetBounds() const {
// this assertion should go away once we're confident that it's not needed
NS_ASSERTION(!IsRoot() || (mDimBounds.x == 0 && mDimBounds.y == 0),
"root views should always have explicit position of (0,0)");
return mDimBounds;
}
nsPoint GetPosition() const {
// this assertion should go away once we're confident that it's not needed
NS_ASSERTION(!IsRoot() || (mPosX == 0 && mPosY == 0),
"root views should always have explicit position of (0,0)");
return nsPoint(mPosX, mPosY);
}
nsIWidget* GetWidget() const { return mWindow; }
PRBool HasWidget() const { return mWindow != nsnull; }
nsView* GetChild(PRInt32 aIndex) const;
void InsertChild(nsView *aChild, nsView *aSibling);
void RemoveChild(nsView *aChild);

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

@ -172,8 +172,7 @@ nsDragService::ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScre
// coordinates.
//
nsRect aRect(0,0,0,0);
aFrame->GetRect(aRect);
nsRect rect = aFrame->GetRect();
// Find offset from our view
nsIView *containingView = nsnull;
@ -208,8 +207,8 @@ nsDragService::ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScre
// stash it all in a mac rect
outScreenRect.left = screenOffset.x;
outScreenRect.top = screenOffset.y;
outScreenRect.right = outScreenRect.left + NSTwipsToIntPixels(aRect.width, t2p);
outScreenRect.bottom = outScreenRect.top + NSTwipsToIntPixels(aRect.height, t2p);
outScreenRect.right = outScreenRect.left + NSTwipsToIntPixels(rect.width, t2p);
outScreenRect.bottom = outScreenRect.top + NSTwipsToIntPixels(rect.height, t2p);
haveRectFlag = PR_TRUE;
}

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

@ -812,8 +812,7 @@ int nsWindow::EvInfo( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo )
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell( getter_AddRefs(presShell) );
nsCOMPtr<nsIViewManager> viewManager;
presShell->GetViewManager(getter_AddRefs(viewManager));
nsIViewManager* viewManager = presShell->GetViewManager();
NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
windowEnumerator->HasMoreElements(&more);

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

@ -74,24 +74,12 @@ NS_IMETHODIMP nsBaseFilePicker::DOMWindowToWidget(nsIDOMWindowInternal *dw, nsIW
rv = docShell->GetPresShell(getter_AddRefs(presShell));
if (NS_SUCCEEDED(rv) && presShell) {
nsCOMPtr<nsIViewManager> viewManager;
rv = presShell->GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(rv)) {
nsIView *view;
rv = viewManager->GetRootView(view);
nsIView *view;
rv = presShell->GetViewManager()->GetRootView(view);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIWidget> widget;
rv = view->GetWidget(*getter_AddRefs(widget));
if (NS_SUCCEEDED(rv)) {
*aResult = widget;
NS_ADDREF(*aResult);
return NS_OK;
}
}
if (NS_SUCCEEDED(rv)) {
*aResult = view->GetWidget();
NS_IF_ADDREF(*aResult);
}
}
}