From 3a130c31ef7077b572fe33a733f2d2bfbfd0f370 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 9 Jan 2009 11:35:24 -0500 Subject: [PATCH] Backed out changeset 4c4df6ed1b41 - Bug 396185 - Make nsIFrame not inherit from nsISupports due to mochitest failures... these appear to be crashes in nsGenericHTMLElement::GetEditorInternal. --- accessible/public/nsIAccessibilityService.idl | 34 +-- .../src/base/nsAccessibilityService.cpp | 99 ++++--- accessible/src/base/nsAccessibilityService.h | 3 +- accessible/src/base/nsAccessible.cpp | 3 +- accessible/src/base/nsCoreUtils.cpp | 3 +- accessible/src/base/nsRootAccessible.cpp | 3 +- accessible/src/html/nsHTMLAreaAccessible.cpp | 6 +- .../src/html/nsHTMLFormControlAccessible.cpp | 3 +- .../src/html/nsHTMLSelectAccessible.cpp | 32 ++- accessible/src/html/nsHTMLTableAccessible.cpp | 9 +- accessible/src/html/nsHyperTextAccessible.cpp | 3 +- accessible/src/msaa/nsAccessibleWrap.cpp | 3 +- content/base/src/nsFrameLoader.cpp | 3 +- content/base/src/nsGenericElement.cpp | 9 +- content/base/src/nsObjectLoadingContent.cpp | 15 +- content/events/src/nsEventStateManager.cpp | 22 +- .../html/content/src/nsGenericHTMLElement.cpp | 8 +- .../html/content/src/nsHTMLButtonElement.cpp | 4 +- .../html/content/src/nsHTMLInputElement.cpp | 38 ++- .../html/content/src/nsHTMLObjectElement.cpp | 6 +- .../html/content/src/nsHTMLSelectElement.cpp | 12 +- .../content/src/nsHTMLTextAreaElement.cpp | 26 +- .../html/document/src/nsPluginDocument.cpp | 7 +- .../content/src/nsISVGTextContentMetrics.h | 14 +- content/svg/content/src/nsISVGValue.h | 2 - .../svg/content/src/nsSVGGraphicElement.cpp | 3 +- .../svg/content/src/nsSVGPatternElement.cpp | 3 +- content/svg/content/src/nsSVGSVGElement.cpp | 12 +- .../svg/content/src/nsSVGSwitchElement.cpp | 4 +- content/svg/content/src/nsSVGTSpanElement.cpp | 23 +- content/svg/content/src/nsSVGTextElement.cpp | 23 +- .../svg/content/src/nsSVGTextPathElement.cpp | 21 +- .../svg/content/src/nsSVGTextPathElement.h | 2 +- docshell/base/nsDocShell.cpp | 11 +- editor/libeditor/html/nsTableEditor.cpp | 8 +- embedding/components/find/src/nsFind.cpp | 3 +- .../components/find/src/nsWebBrowserFind.cpp | 2 +- layout/base/nsBidiPresUtils.cpp | 6 +- layout/base/nsCSSFrameConstructor.cpp | 66 +++-- layout/base/nsCSSRendering.cpp | 11 +- layout/base/nsCaret.cpp | 3 +- layout/base/nsDocumentViewer.cpp | 4 +- layout/base/nsFrameManager.cpp | 12 +- layout/base/nsIPercentHeightObserver.h | 13 +- layout/base/nsLayoutDebugger.cpp | 5 +- layout/base/nsLayoutUtils.cpp | 25 +- layout/base/nsPresShell.cpp | 55 ++-- layout/forms/nsComboboxControlFrame.cpp | 132 +++++---- layout/forms/nsComboboxControlFrame.h | 8 +- layout/forms/nsFileControlFrame.cpp | 21 +- layout/forms/nsFileControlFrame.h | 5 +- layout/forms/nsFormControlFrame.cpp | 16 +- layout/forms/nsFormControlFrame.h | 7 +- layout/forms/nsGfxButtonControlFrame.cpp | 16 +- layout/forms/nsGfxButtonControlFrame.h | 5 +- layout/forms/nsGfxCheckboxControlFrame.cpp | 19 +- layout/forms/nsGfxCheckboxControlFrame.h | 7 +- layout/forms/nsGfxRadioControlFrame.cpp | 16 +- layout/forms/nsGfxRadioControlFrame.h | 9 +- layout/forms/nsHTMLButtonControlFrame.cpp | 28 +- layout/forms/nsHTMLButtonControlFrame.h | 5 +- layout/forms/nsICheckboxControlFrame.h | 17 +- layout/forms/nsIComboboxControlFrame.h | 17 +- layout/forms/nsIFormControlFrame.h | 15 +- layout/forms/nsIListControlFrame.h | 15 +- layout/forms/nsIRadioControlFrame.h | 17 +- layout/forms/nsISelectControlFrame.h | 17 +- layout/forms/nsImageControlFrame.cpp | 35 ++- layout/forms/nsIsIndexFrame.cpp | 18 +- layout/forms/nsIsIndexFrame.h | 5 +- layout/forms/nsLegendFrame.cpp | 18 +- layout/forms/nsLegendFrame.h | 7 +- layout/forms/nsListControlFrame.cpp | 32 ++- layout/forms/nsListControlFrame.h | 3 +- layout/forms/nsTextControlFrame.cpp | 46 ++- layout/forms/nsTextControlFrame.h | 2 +- layout/generic/Makefile.in | 1 - layout/generic/nsAbsoluteContainingBlock.cpp | 8 +- layout/generic/nsBRFrame.cpp | 2 +- layout/generic/nsBlockFrame.cpp | 24 +- layout/generic/nsBlockFrame.h | 11 +- layout/generic/nsContainerFrame.cpp | 4 +- layout/generic/nsFloatManager.cpp | 1 + layout/generic/nsFrame.cpp | 78 +++-- layout/generic/nsFrame.h | 13 +- layout/generic/nsFrameFrame.cpp | 27 +- layout/generic/nsFrameList.cpp | 4 +- layout/generic/nsFrameSetFrame.cpp | 22 +- layout/generic/nsFrameSetFrame.h | 11 +- layout/generic/nsGfxScrollFrame.cpp | 91 ++++-- layout/generic/nsGfxScrollFrame.h | 11 +- layout/generic/nsHTMLFrame.cpp | 32 ++- layout/generic/nsIAnonymousContentCreator.h | 16 +- layout/generic/nsICanvasFrame.h | 12 +- layout/generic/nsIFrame.h | 12 +- layout/generic/nsIFrameDebug.h | 16 +- layout/generic/nsIFrameFrame.h | 10 +- layout/generic/nsIImageFrame.h | 12 +- layout/generic/nsIObjectFrame.h | 11 +- layout/generic/nsIPageSequenceFrame.h | 20 +- layout/generic/nsIScrollableFrame.h | 9 +- layout/generic/nsIScrollableViewProvider.h | 14 +- layout/generic/nsIStatefulFrame.h | 13 +- layout/generic/nsImageFrame.cpp | 15 +- layout/generic/nsImageFrame.h | 3 +- layout/generic/nsInlineFrame.cpp | 18 +- layout/generic/nsInlineFrame.h | 9 +- layout/generic/nsLineBox.cpp | 10 +- layout/generic/nsObjectFrame.cpp | 33 ++- layout/generic/nsObjectFrame.h | 7 +- layout/generic/nsQueryFrame.h | 267 ------------------ layout/generic/nsSelection.cpp | 11 +- layout/generic/nsSimplePageSequence.cpp | 14 +- layout/generic/nsSimplePageSequence.h | 6 +- layout/generic/nsVideoFrame.cpp | 22 +- layout/generic/nsVideoFrame.h | 2 +- layout/generic/nsViewportFrame.cpp | 2 +- layout/mathml/base/src/nsIMathMLFrame.h | 15 +- .../base/src/nsMathMLContainerFrame.cpp | 46 ++- .../mathml/base/src/nsMathMLContainerFrame.h | 2 +- .../base/src/nsMathMLForeignFrameWrapper.cpp | 6 +- .../base/src/nsMathMLForeignFrameWrapper.h | 2 +- layout/mathml/base/src/nsMathMLFrame.cpp | 14 +- layout/mathml/base/src/nsMathMLFrame.h | 17 +- .../mathml/base/src/nsMathMLmactionFrame.cpp | 21 +- .../mathml/base/src/nsMathMLmfencedFrame.cpp | 3 +- .../mathml/base/src/nsMathMLmtableFrame.cpp | 27 +- layout/mathml/base/src/nsMathMLmtableFrame.h | 10 +- layout/printing/nsPrintEngine.cpp | 32 ++- layout/style/nsComputedDOMStyle.cpp | 3 +- layout/style/nsICSSPseudoComparator.h | 12 +- layout/svg/base/src/nsISVGChildFrame.h | 14 +- layout/svg/base/src/nsISVGGlyphFragmentLeaf.h | 12 +- layout/svg/base/src/nsISVGGlyphFragmentNode.h | 13 +- layout/svg/base/src/nsISVGSVGFrame.h | 13 +- layout/svg/base/src/nsSVGClipPathFrame.cpp | 10 +- layout/svg/base/src/nsSVGContainerFrame.cpp | 24 +- layout/svg/base/src/nsSVGContainerFrame.h | 7 +- layout/svg/base/src/nsSVGFilterFrame.cpp | 2 +- .../svg/base/src/nsSVGForeignObjectFrame.cpp | 11 +- layout/svg/base/src/nsSVGForeignObjectFrame.h | 8 +- layout/svg/base/src/nsSVGGlyphFrame.cpp | 21 +- layout/svg/base/src/nsSVGGlyphFrame.h | 5 +- layout/svg/base/src/nsSVGInnerSVGFrame.cpp | 28 +- layout/svg/base/src/nsSVGIntegrationUtils.cpp | 5 +- layout/svg/base/src/nsSVGMarkerFrame.cpp | 6 +- layout/svg/base/src/nsSVGOuterSVGFrame.cpp | 26 +- layout/svg/base/src/nsSVGOuterSVGFrame.h | 7 +- .../svg/base/src/nsSVGPathGeometryFrame.cpp | 8 +- layout/svg/base/src/nsSVGPathGeometryFrame.h | 7 +- layout/svg/base/src/nsSVGPatternFrame.cpp | 4 +- layout/svg/base/src/nsSVGSwitchFrame.cpp | 9 +- layout/svg/base/src/nsSVGTSpanFrame.cpp | 20 +- layout/svg/base/src/nsSVGTSpanFrame.h | 8 +- .../svg/base/src/nsSVGTextContainerFrame.cpp | 15 +- layout/svg/base/src/nsSVGTextContainerFrame.h | 8 +- layout/svg/base/src/nsSVGUseFrame.cpp | 16 +- layout/svg/base/src/nsSVGUtils.cpp | 31 +- layout/tables/nsITableCellLayout.h | 14 +- layout/tables/nsITableLayout.h | 13 +- layout/tables/nsTableCellFrame.cpp | 23 +- layout/tables/nsTableCellFrame.h | 3 +- layout/tables/nsTableFrame.cpp | 23 +- layout/tables/nsTableFrame.h | 3 +- layout/tables/nsTableOuterFrame.cpp | 18 +- layout/tables/nsTableOuterFrame.h | 3 +- layout/tables/nsTableRowGroupFrame.cpp | 16 +- layout/tables/nsTableRowGroupFrame.h | 7 +- layout/xul/base/public/nsIMenuFrame.h | 15 +- layout/xul/base/public/nsIScrollbarMediator.h | 22 +- layout/xul/base/src/grid/nsGrid.cpp | 10 +- .../xul/base/src/grid/nsGridRowLeafLayout.cpp | 2 +- layout/xul/base/src/nsBoxObject.cpp | 10 + layout/xul/base/src/nsContainerBoxObject.cpp | 4 +- layout/xul/base/src/nsDocElementBoxFrame.cpp | 20 +- layout/xul/base/src/nsIRootBox.h | 16 +- layout/xul/base/src/nsIScrollbarFrame.h | 14 +- layout/xul/base/src/nsListBoxBodyFrame.cpp | 39 ++- layout/xul/base/src/nsListBoxBodyFrame.h | 16 +- layout/xul/base/src/nsListBoxObject.cpp | 6 +- layout/xul/base/src/nsListItemFrame.cpp | 15 + layout/xul/base/src/nsListItemFrame.h | 2 + layout/xul/base/src/nsMenuFrame.cpp | 25 +- layout/xul/base/src/nsMenuFrame.h | 2 +- layout/xul/base/src/nsMenuPopupFrame.cpp | 7 +- layout/xul/base/src/nsPopupSetFrame.cpp | 11 +- layout/xul/base/src/nsRootBoxFrame.cpp | 25 +- layout/xul/base/src/nsScrollBoxObject.cpp | 8 +- .../xul/base/src/nsScrollbarButtonFrame.cpp | 3 +- layout/xul/base/src/nsScrollbarFrame.cpp | 19 +- layout/xul/base/src/nsScrollbarFrame.h | 7 +- layout/xul/base/src/nsSliderFrame.cpp | 7 +- layout/xul/base/src/nsSplitterFrame.cpp | 7 + layout/xul/base/src/nsSplitterFrame.h | 4 + .../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 62 +++- .../xul/base/src/tree/src/nsTreeBodyFrame.h | 16 +- .../xul/base/src/tree/src/nsTreeBoxObject.cpp | 3 +- .../xul/base/src/tree/src/nsTreeColFrame.cpp | 18 ++ layout/xul/base/src/tree/src/nsTreeColFrame.h | 2 + widget/src/gtk2/nsNativeThemeGTK.cpp | 4 +- widget/src/windows/nsNativeThemeWin.cpp | 13 +- 201 files changed, 2096 insertions(+), 1153 deletions(-) delete mode 100644 layout/generic/nsQueryFrame.h diff --git a/accessible/public/nsIAccessibilityService.idl b/accessible/public/nsIAccessibilityService.idl index ae19a782f8d..e05a91c3fe1 100644 --- a/accessible/public/nsIAccessibilityService.idl +++ b/accessible/public/nsIAccessibilityService.idl @@ -52,29 +52,29 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode); nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument); - nsIAccessible createHTML4ButtonAccessible(in nsIFrame aFrame); - nsIAccessible createHyperTextAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLBRAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLButtonAccessible(in nsIFrame aFrame); + nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame); + nsIAccessible createHyperTextAccessible(in nsISupports aFrame); + nsIAccessible createHTMLBRAccessible(in nsISupports aFrame); + nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame); nsIAccessible createHTMLAccessibleByMarkup(in nsIFrame aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode); - nsIAccessible createHTMLLIAccessible(in nsIFrame aFrame, in nsIFrame aBulletFrame, in AString aBulletText); - nsIAccessible createHTMLCheckboxAccessible(in nsIFrame aFrame); + nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText); + nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame); nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell); - nsIAccessible createHTMLGenericAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLGroupboxAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLHRAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLImageAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLLabelAccessible(in nsIFrame aFrame); + nsIAccessible createHTMLGenericAccessible(in nsISupports aFrame); + nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame); + nsIAccessible createHTMLHRAccessible(in nsISupports aFrame); + nsIAccessible createHTMLImageAccessible(in nsISupports aFrame); + nsIAccessible createHTMLLabelAccessible(in nsISupports aFrame); nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell); nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame); - nsIAccessible createHTMLRadioButtonAccessible(in nsIFrame aFrame); + nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame); nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell); - nsIAccessible createHTMLTableAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLTableCellAccessible(in nsIFrame aFrame); + nsIAccessible createHTMLTableAccessible(in nsISupports aFrame); + nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame); nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode); - nsIAccessible createHTMLTextAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLTextFieldAccessible(in nsIFrame aFrame); - nsIAccessible createHTMLCaptionAccessible(in nsIFrame aFrame); + nsIAccessible createHTMLTextAccessible(in nsISupports aFrame); + nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame); + nsIAccessible createHTMLCaptionAccessible(in nsISupports aFrame); nsIAccessible getAccessible(in nsIDOMNode aNode, in nsIPresShell aPresShell, in nsIWeakReference aWeakShell, diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index a4a6fd45338..27ab6227bcd 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -332,10 +332,11 @@ NS_IMETHODIMP nsAccessibilityService::OnSecurityChange(nsIWebProgress *aWebProgr nsresult -nsAccessibilityService::GetInfo(nsIFrame* aFrame, nsIWeakReference** aShell, nsIDOMNode** aNode) +nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode) { NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!"); - nsCOMPtr content = aFrame->GetContent(); + *aRealFrame = static_cast(aFrame); + nsCOMPtr content = (*aRealFrame)->GetContent(); nsCOMPtr node(do_QueryInterface(content)); if (!content || !node) return NS_ERROR_FAILURE; @@ -473,11 +474,12 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell, * HTML widget creation */ NS_IMETHODIMP -nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -490,11 +492,12 @@ nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessi } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -562,14 +565,15 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame *aFrame, } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame, - nsIFrame *aBulletFrame, +nsAccessibilityService::CreateHTMLLIAccessible(nsISupports *aFrame, + nsISupports *aBulletFrame, const nsAString& aBulletText, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -582,11 +586,12 @@ nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame, } NS_IMETHODIMP -nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible) +nsAccessibilityService::CreateHyperTextAccessible(nsISupports *aFrame, nsIAccessible **aAccessible) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -601,11 +606,12 @@ nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessibl } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -629,11 +635,12 @@ nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWe } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -651,17 +658,18 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame, nsIAccessibl } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLGenericAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible) +nsAccessibilityService::CreateHTMLGenericAccessible(nsISupports *aFrame, nsIAccessible **aAccessible) { return CreateHyperTextAccessible(aFrame, aAccessible); } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLGroupboxAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -699,10 +707,11 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame, { nsCOMPtr node; nsCOMPtr weakShell; - GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsIFrame *frame; + GetInfo(static_cast(aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); *aAccessible = nsnull; - if (aFrame->GetRect().IsEmpty()) { + if (!frame || frame->GetRect().IsEmpty()) { return NS_ERROR_FAILURE; } // 1) for object elements containing either HTML or TXT documents @@ -734,7 +743,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame, // 3) for images and imagemaps, or anything else with a child frame // we have the object frame, get the image frame - nsIFrame *frame = aFrame->GetFirstChild(nsnull); + frame = aFrame->GetFirstChild(nsnull); if (frame) return frame->GetAccessible(aAccessible); @@ -742,11 +751,12 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame, } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -773,11 +783,12 @@ nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLTableAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -817,11 +828,12 @@ nsAccessibilityService::CreateHTMLTableHeadAccessible(nsIDOMNode *aDOMNode, nsIA } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -834,13 +846,14 @@ nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAcces } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval) { *_retval = nsnull; + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -854,11 +867,12 @@ nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -871,11 +885,12 @@ nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAcces } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLLabelAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -888,11 +903,12 @@ nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessibl } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLHRAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -905,11 +921,12 @@ nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible * } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLBRAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -922,11 +939,12 @@ nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible * } NS_IMETHODIMP -nsAccessibilityService::CreateHTMLCaptionAccessible(nsIFrame *aFrame, nsIAccessible **_retval) +nsAccessibilityService::CreateHTMLCaptionAccessible(nsISupports *aFrame, nsIAccessible **_retval) { + nsIFrame* frame; nsCOMPtr node; nsCOMPtr weakShell; - nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node)); + nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); if (NS_FAILED(rv)) return rv; @@ -1392,7 +1410,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode, // image frame is the image content. // Check if frame is an image frame, and content is - nsIImageFrame *imageFrame = do_QueryFrame(frame); + nsIImageFrame *imageFrame; + CallQueryInterface(frame, &imageFrame); nsCOMPtr areaElmt = do_QueryInterface(content); if (imageFrame && areaElmt) { nsCOMPtr imageAcc; diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index b98e04deed9..59f3bca6f82 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -89,11 +89,12 @@ private: * Return presentation shell, DOM node for the given frame. * * @param aFrame - the given frame + * @param aRealFrame [out] - the given frame casted to nsIFrame * @param aShell [out] - presentation shell for DOM node associated with the * given frame * @param aContent [out] - DOM node associated with the given frame */ - nsresult GetInfo(nsIFrame *aFrame, + nsresult GetInfo(nsISupports *aFrame, nsIFrame **aRealFrame, nsIWeakReference **aShell, nsIDOMNode **aContent); diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index f195ba42112..4daba4893f6 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2774,7 +2774,8 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce if (frame) { nsIView *view = frame->GetViewExternal(); if (view) { - nsIScrollableFrame *scrollFrame = do_QueryFrame(frame); + nsIScrollableFrame *scrollFrame = nsnull; + CallQueryInterface(frame, &scrollFrame); if (scrollFrame || view->GetWidget()) { return GetParent(aRelated); } diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 285a7cdf1c2..83042411117 100755 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -331,7 +331,8 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame, nsIFrame *aFrame, const nsIntPoint& aPoint) { - nsIScrollableFrame *scrollableFrame = do_QueryFrame(aScrollableFrame); + nsIScrollableFrame *scrollableFrame = nsnull; + CallQueryInterface(aScrollableFrame, &scrollableFrame); if (!scrollableFrame) return; diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 96888116987..a31bd5e65d7 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -841,7 +841,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent, nsIFrame* menuFrame = menuAccessNode->GetFrame(); NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE); - nsIMenuFrame* imenuFrame = do_QueryFrame(menuFrame); + nsIMenuFrame* imenuFrame; + CallQueryInterface(menuFrame, &imenuFrame); if (imenuFrame) fireFocus = PR_TRUE; // QI failed for nsIMenuFrame means it's not on menu bar diff --git a/accessible/src/html/nsHTMLAreaAccessible.cpp b/accessible/src/html/nsHTMLAreaAccessible.cpp index 31ca00c4370..29eaf2916e9 100644 --- a/accessible/src/html/nsHTMLAreaAccessible.cpp +++ b/accessible/src/html/nsHTMLAreaAccessible.cpp @@ -120,8 +120,6 @@ NS_IMETHODIMP nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height) { - nsresult rv; - // Essentially this uses GetRect on mAreas of nsImageMap from nsImageFrame *x = *y = *width = *height = 0; @@ -134,7 +132,9 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y, nsIFrame *frame = GetFrame(); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - nsIImageFrame *imageFrame = do_QueryFrame(frame); + nsIImageFrame *imageFrame; + nsresult rv = frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr map; imageFrame->GetImageMap(presContext, getter_AddRefs(map)); diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index e1133b0decc..56356972d6a 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -292,7 +292,8 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName) // Use the button's (default) label if nothing else works nsIFrame* frame = GetFrame(); if (frame) { - nsIFormControlFrame* fcFrame = do_QueryFrame(frame); + nsIFormControlFrame* fcFrame = nsnull; + CallQueryInterface(frame, &fcFrame); if (fcFrame) fcFrame->GetFormProperty(nsAccessibilityAtoms::defaultLabel, name); } diff --git a/accessible/src/html/nsHTMLSelectAccessible.cpp b/accessible/src/html/nsHTMLSelectAccessible.cpp index 06e6bcecc68..f96a887e48e 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -743,12 +743,14 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index) return NS_ERROR_FAILURE; nsIFrame *selectFrame = presShell->GetPrimaryFrameFor(selectContent); - nsIComboboxControlFrame *comboBoxFrame = do_QueryFrame(selectFrame); + nsIComboboxControlFrame *comboBoxFrame = nsnull; + CallQueryInterface(selectFrame, &comboBoxFrame); if (comboBoxFrame) { nsIFrame *listFrame = comboBoxFrame->GetDropDown(); if (comboBoxFrame->IsDroppedDown() && listFrame) { // use this list control frame to roll up the list - nsIListControlFrame *listControlFrame = do_QueryFrame(listFrame); + nsIListControlFrame *listControlFrame = nsnull; + listFrame->QueryInterface(NS_GET_IID(nsIListControlFrame), (void**)&listControlFrame); if (listControlFrame) { PRInt32 newIndex = 0; option->GetIndex(&newIndex); @@ -795,7 +797,8 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod nsresult rv = selectElement->GetOptions(getter_AddRefs(options)); if (NS_SUCCEEDED(rv)) { - nsIListControlFrame *listFrame = do_QueryFrame(frame); + nsIListControlFrame *listFrame = nsnull; + frame->QueryInterface(NS_GET_IID(nsIListControlFrame), (void**)&listFrame); if (listFrame) { // Get what's focused in listbox by asking frame for "selected item". // Can't use dom interface for this, because it will always return the first selected item @@ -1013,7 +1016,8 @@ void nsHTMLComboboxAccessible::CacheChildren() if (!frame) { return; } - nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame); + nsIComboboxControlFrame *comboFrame = nsnull; + frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); if (!comboFrame) { return; } @@ -1072,7 +1076,11 @@ nsHTMLComboboxAccessible::GetStateInternal(PRUint32 *aState, NS_ENSURE_A11Y_SUCCESS(rv, rv); nsIFrame *frame = GetBoundsFrame(); - nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame); + nsIComboboxControlFrame *comboFrame = nsnull; + if (frame) { + frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); + } + if (comboFrame && comboFrame->IsDroppedDown()) { *aState |= nsIAccessibleStates::STATE_EXPANDED; } @@ -1152,7 +1160,8 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::DoAction(PRUint8 aIndex) if (!frame) { return NS_ERROR_FAILURE; } - nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame); + nsIComboboxControlFrame *comboFrame = nsnull; + frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); if (!comboFrame) { return NS_ERROR_FAILURE; } @@ -1177,7 +1186,8 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& if (!frame) { return NS_ERROR_FAILURE; } - nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame); + nsIComboboxControlFrame *comboFrame = nsnull; + frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); if (!comboFrame) { return NS_ERROR_FAILURE; } @@ -1418,7 +1428,8 @@ nsHTMLComboboxListAccessible::GetFrame() nsIFrame* frame = nsHTMLSelectListAccessible::GetFrame(); if (frame) { - nsIComboboxControlFrame* comboBox = do_QueryFrame(frame); + nsIComboboxControlFrame* comboBox; + CallQueryInterface(frame, &comboBox); if (comboBox) { return comboBox->GetDropDown(); } @@ -1443,7 +1454,10 @@ nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState, NS_ENSURE_A11Y_SUCCESS(rv, rv); nsIFrame *boundsFrame = GetBoundsFrame(); - nsIComboboxControlFrame* comboFrame = do_QueryFrame(boundsFrame); + nsIComboboxControlFrame* comboFrame = nsnull; + if (boundsFrame) + boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); + if (comboFrame && comboFrame->IsDroppedDown()) *aState |= nsIAccessibleStates::STATE_FLOATING; else diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index 30b33d1903f..13b56c4c42d 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -95,7 +95,8 @@ nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttri NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell."); NS_ENSURE_STATE(frame); - nsITableCellLayout *cellLayout = do_QueryFrame(frame); + nsITableCellLayout *cellLayout = nsnull; + CallQueryInterface(frame, &cellLayout); NS_ENSURE_STATE(cellLayout); PRInt32 rowIdx = -1, cellIdx = -1; @@ -927,11 +928,7 @@ nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aTableLayout) NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); nsIFrame *frame = shell->GetPrimaryFrameFor(tableContent); - if (!frame) - return NS_ERROR_FAILURE; - - *aTableLayout = do_QueryFrame(frame); - return (*aTableLayout) ? NS_OK : NS_NOINTERFACE; + return frame ? CallQueryInterface(frame, aTableLayout) : NS_ERROR_FAILURE; } nsresult diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index 23b96dc18df..1e522ec5f32 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -2044,7 +2044,8 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex, PRBool initialScrolled = PR_FALSE; nsIFrame *parentFrame = frame; while ((parentFrame = parentFrame->GetParent())) { - nsIScrollableFrame *scrollableFrame = do_QueryFrame(parentFrame); + nsIScrollableFrame *scrollableFrame = nsnull; + CallQueryInterface(parentFrame, &scrollableFrame); if (scrollableFrame) { if (!initialScrolled) { // Scroll substring to the given point. Turn the point into percents diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index ec3a25c9925..262bb782bce 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -216,7 +216,8 @@ __try { else { // If a frame is a scrollable frame, then it has one window for the client area, // not an extra parent window for just the scrollbars - nsIScrollableFrame *scrollFrame = do_QueryFrame(frame); + nsIScrollableFrame *scrollFrame = nsnull; + CallQueryInterface(frame, &scrollFrame); if (scrollFrame) { hwnd = (HWND)scrollFrame->GetScrolledFrame()->GetWindow()->GetNativeData(NS_NATIVE_WINDOW); NS_ASSERTION(hwnd, "No window handle for window"); diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 4f221b56c13..5ff58b041e7 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -638,7 +638,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, return NS_ERROR_NOT_IMPLEMENTED; } - nsIFrameFrame* ourFrameFrame = do_QueryFrame(ourFrame); + nsIFrameFrame* ourFrameFrame = nsnull; + CallQueryInterface(ourFrame, &ourFrameFrame); if (!ourFrameFrame) { mInSwap = aOther->mInSwap = PR_FALSE; FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE); diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 237777434ed..f208c75e41d 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1117,9 +1117,12 @@ nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView, } // Get the scrollable frame - nsIScrollableFrame *scrollFrame = do_QueryFrame(frame); + nsIScrollableFrame *scrollFrame = nsnull; + CallQueryInterface(frame, &scrollFrame); + if (!scrollFrame) { - nsIScrollableViewProvider *scrollProvider = do_QueryFrame(frame); + nsIScrollableViewProvider *scrollProvider = nsnull; + CallQueryInterface(frame, &scrollProvider); // menu frames implement nsIScrollableViewProvider but we don't want // to use it here. if (scrollProvider && frame->GetType() != nsGkAtoms::menuFrame) { @@ -1148,7 +1151,7 @@ nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView, break; } - scrollFrame = do_QueryFrame(frame); + CallQueryInterface(frame, &scrollFrame); } while (!scrollFrame); } diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index c86a414f69b..a6e758ce833 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -561,7 +561,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, } { - nsIFrame *nsiframe = do_QueryFrame(frame); + nsIFrame *nsiframe; + CallQueryInterface(frame, &nsiframe); nsWeakFrame weakFrame(nsiframe); @@ -750,7 +751,8 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance) } } - nsIFrame *nsiframe = do_QueryFrame(frame); + nsIFrame *nsiframe; + CallQueryInterface(frame, &nsiframe); nsWeakFrame weakFrame(nsiframe); // We may have a plugin instance already; if so, do nothing @@ -803,7 +805,8 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame) } } - nsIFrame* frame = do_QueryFrame(aFrame); + nsIFrame* frame = nsnull; + CallQueryInterface(aFrame, &frame); nsCOMPtr event = new nsAsyncInstantiateEvent(this, frame, mContentType, mURI); if (!event) { @@ -1649,7 +1652,8 @@ nsObjectLoadingContent::GetExistingFrame(FlushType aFlushType) aFlushType = eDontFlush; } while (1); - nsIObjectFrame* objFrame = do_QueryFrame(frame); + nsIObjectFrame* objFrame; + CallQueryInterface(frame, &objFrame); return objFrame; } @@ -1691,7 +1695,8 @@ nsObjectLoadingContent::TryInstantiate(const nsACString& aMIMEType, // frame does have a plugin instance already, be sure to // re-instantiate the plugin as its source or whatnot might have // chanced since it was instantiated. - nsIFrame* iframe = do_QueryFrame(frame); + nsIFrame* iframe; + CallQueryInterface(frame, &iframe); if (iframe->GetStateBits() & NS_FRAME_FIRST_REFLOW) { LOG(("OBJLC [%p]: Frame hasn't been reflown yet\n", this)); return NS_OK; // Not a failure to have no frame diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index f6452299d47..be59679cc35 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2379,7 +2379,8 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext, if (presShell) { nsIFrame* frame = presShell->GetPrimaryFrameFor(content); if (frame) { - nsTreeBodyFrame* treeBody = do_QueryFrame(frame); + nsTreeBodyFrame* treeBody; + CallQueryInterface(frame, &treeBody); treeBody->GetSelectionRegion(getter_AddRefs(region)); } } @@ -2534,7 +2535,8 @@ static nsIScrollableView* GetScrollableViewForFrame(nsPresContext* aPresContext, nsIFrame* aFrame) { for (; aFrame; aFrame = GetParentFrameToScroll(aPresContext, aFrame)) { - nsIScrollableViewProvider* svp = do_QueryFrame(aFrame); + nsIScrollableViewProvider* svp; + CallQueryInterface(aFrame, &svp); if (svp) { nsIScrollableView* scrollView = svp->GetScrollableView(); if (scrollView) @@ -2610,7 +2612,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, // operation, even if the mouse hasn't moved. nsIFrame* lastScrollFrame = nsMouseWheelTransaction::GetTargetFrame(); if (lastScrollFrame) { - nsIScrollableViewProvider* svp = do_QueryFrame(lastScrollFrame); + nsIScrollableViewProvider* svp; + CallQueryInterface(lastScrollFrame, &svp); if (svp) { scrollView = svp->GetScrollableView(); nsMouseWheelTransaction::UpdateTransaction(); @@ -2625,7 +2628,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, scrollFrame = GetParentFrameToScroll(aPresContext, scrollFrame)) { // Check whether the frame wants to provide us with a scrollable view. scrollView = nsnull; - nsIScrollableViewProvider* svp = do_QueryFrame(scrollFrame); + nsIScrollableViewProvider* svp; + CallQueryInterface(scrollFrame, &svp); if (svp) { scrollView = svp->GetScrollableView(); } @@ -2654,7 +2658,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext, } // Comboboxes need special care. - nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame); + nsIComboboxControlFrame* comboBox = nsnull; + CallQueryInterface(scrollFrame, &comboBox); if (comboBox) { if (comboBox->IsDroppedDown()) { // Don't propagate to parent when drop down menu is active. @@ -3588,7 +3593,8 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto) if (mLastMouseOverFrame) { // if the frame is associated with a subdocument, // tell the subdocument that we're moving out of it - nsIFrameFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame()); + nsIFrameFrame* subdocFrame; + CallQueryInterface(mLastMouseOverFrame.GetFrame(), &subdocFrame); if (subdocFrame) { nsCOMPtr docshell; subdocFrame->GetDocShell(getter_AddRefs(docshell)); @@ -5209,7 +5215,9 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext, currentFocusFrame = presShell->GetPrimaryFrameFor(mCurrentFocus); if (!currentFocusFrame) currentFocusFrame = mCurrentTarget; - nsIObjectFrame* objFrame = do_QueryFrame(currentFocusFrame); + nsIObjectFrame* objFrame = nsnull; + if (currentFocusFrame) + CallQueryInterface(currentFocusFrame, &objFrame); if (objFrame) { nsIView* view = currentFocusFrame->GetViewExternal(); NS_ASSERTION(view, "Object frames must have views"); diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 644671ef60a..ac181d8b567 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1326,7 +1326,8 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent, } nsIFrame* frame = GetPrimaryFrameFor(aContent, aDocument); if (frame) { - nsIFormControlFrame* form_frame = do_QueryFrame(frame); + nsIFormControlFrame* form_frame = nsnull; + CallQueryInterface(frame, &form_frame); if (form_frame) { return form_frame; } @@ -1336,7 +1337,7 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent, for (frame = frame->GetFirstChild(nsnull); frame; frame = frame->GetNextSibling()) { - form_frame = do_QueryFrame(frame); + CallQueryInterface(frame, &form_frame); if (form_frame) { return form_frame; } @@ -3551,7 +3552,8 @@ nsGenericHTMLElement::GetEditorInternal(nsIEditor** aEditor) nsIFormControlFrame *fcFrame = GetFormControlFrame(PR_FALSE); if (fcFrame) { - nsITextControlFrame *textFrame = do_QueryFrame(fcFrame); + nsITextControlFrame *textFrame = nsnull; + CallQueryInterface(fcFrame, &textFrame); if (textFrame) { return textFrame->GetEditor(aEditor); } diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 698fb781226..076f3634862 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -306,7 +306,9 @@ nsHTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); if (formControlFrame) { - nsIFrame* formFrame = do_QueryFrame(formControlFrame); + nsIFrame* formFrame = nsnull; + CallQueryInterface(formControlFrame, &formFrame); + if (formFrame) { const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface(); diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index fcfb24c4b7f..205b56b9933 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -787,7 +787,9 @@ nsHTMLInputElement::GetValue(nsAString& aValue) PRBool frameOwnsValue = PR_FALSE; if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) { textControlFrame->OwnsValue(&frameOwnsValue); } else { @@ -991,7 +993,7 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue, formControlFrame = GetFormControlFrame(PR_FALSE); if (formControlFrame) { - textControlFrame = do_QueryFrame(formControlFrame); + CallQueryInterface(formControlFrame, &textControlFrame); } } @@ -1264,12 +1266,14 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify) nsPresContext *presContext = GetPresContext(); if (mType == NS_FORM_INPUT_CHECKBOX) { - nsICheckboxControlFrame* checkboxFrame = do_QueryFrame(frame); + nsICheckboxControlFrame* checkboxFrame = nsnull; + CallQueryInterface(frame, &checkboxFrame); if (checkboxFrame) { checkboxFrame->OnChecked(presContext, aChecked); } } else if (mType == NS_FORM_INPUT_RADIO) { - nsIRadioControlFrame* radioFrame = do_QueryFrame(frame); + nsIRadioControlFrame* radioFrame = nsnull; + CallQueryInterface(frame, &radioFrame); if (radioFrame) { radioFrame->OnChecked(presContext, aChecked); } @@ -1596,7 +1600,8 @@ nsHTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) if (aVisitor.mEvent->message == NS_BLUR_CONTENT) { nsIFrame* primaryFrame = GetPrimaryFrame(); if (primaryFrame) { - nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame); + nsITextControlFrame* textFrame = nsnull; + CallQueryInterface(primaryFrame, &textFrame); if (textFrame) { textFrame->CheckFireOnChange(); } @@ -1834,7 +1839,8 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) if (!isButton) { nsIFrame* primaryFrame = GetPrimaryFrame(); if (primaryFrame) { - nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame); + nsITextControlFrame* textFrame = nsnull; + CallQueryInterface(primaryFrame, &textFrame); // Fire onChange (if necessary) if (textFrame) { @@ -2206,7 +2212,9 @@ nsHTMLInputElement::SetSelectionRange(PRInt32 aSelectionStart, nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd); } @@ -2230,7 +2238,9 @@ nsHTMLInputElement::SetSelectionStart(PRInt32 aSelectionStart) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionStart(aSelectionStart); } @@ -2255,7 +2265,9 @@ nsHTMLInputElement::SetSelectionEnd(PRInt32 aSelectionEnd) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionEnd(aSelectionEnd); } @@ -2292,7 +2304,9 @@ nsHTMLInputElement::GetSelectionRange(PRInt32* aSelectionStart, nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd); } @@ -2307,7 +2321,9 @@ nsHTMLInputElement::GetPhonetic(nsAString& aPhonetic) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) textControlFrame->GetPhonetic(aPhonetic); } diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index 96e2435ed03..1f737b37bb7 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -323,7 +323,11 @@ nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission *aFormSubmission, nsIFrame* frame = GetPrimaryFrame(); - nsIObjectFrame *objFrame = do_QueryFrame(frame); + nsIObjectFrame *objFrame = nsnull; + if (frame) { + CallQueryInterface(frame, &objFrame); + } + if (!objFrame) { // No frame, nothing to submit. diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index a3d95e4572a..8a39b8ec7d9 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -601,7 +601,7 @@ nsHTMLSelectElement::GetSelectFrame() nsISelectControlFrame *select_frame = nsnull; if (form_control_frame) { - select_frame = do_QueryFrame(form_control_frame); + CallQueryInterface(form_control_frame, &select_frame); } return select_frame; @@ -1440,7 +1440,9 @@ nsHTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) nsIFrame* formFrame = nsnull; if (formControlFrame && - (formFrame = do_QueryFrame(formControlFrame))) { + NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) && + formFrame) + { const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface(); if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || @@ -1700,12 +1702,14 @@ void nsHTMLSelectElement::DispatchContentReset() { // Only dispatch content reset notification if this is a list control // frame or combo box control frame. if (IsCombobox()) { - nsIComboboxControlFrame* comboFrame = do_QueryFrame(formControlFrame); + nsIComboboxControlFrame* comboFrame = nsnull; + CallQueryInterface(formControlFrame, &comboFrame); if (comboFrame) { comboFrame->OnContentReset(); } } else { - nsIListControlFrame* listFrame = do_QueryFrame(formControlFrame); + nsIListControlFrame* listFrame = nsnull; + CallQueryInterface(formControlFrame, &listFrame); if (listFrame) { listFrame->OnContentReset(); } diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 830ab702f24..478386f72fb 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -410,7 +410,7 @@ nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap) nsIFrame* primaryFrame = GetPrimaryFrame(); nsITextControlFrame* textControlFrame = nsnull; if (primaryFrame) { - textControlFrame = do_QueryFrame(primaryFrame); + CallQueryInterface(primaryFrame, &textControlFrame); } // If the frame exists and owns the value, get it from the frame. Otherwise @@ -453,7 +453,7 @@ nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue, formControlFrame = GetFormControlFrame(PR_FALSE); if (formControlFrame) { - textControlFrame = do_QueryFrame(formControlFrame); + CallQueryInterface(formControlFrame, &textControlFrame); } } @@ -593,7 +593,8 @@ nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) nsIFrame* formFrame = nsnull; if (formControlFrame && - (formFrame = do_QueryFrame(formControlFrame))) { + NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) && + formFrame) { const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface(); if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || @@ -627,7 +628,8 @@ nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) if (aVisitor.mEvent->message == NS_BLUR_CONTENT) { nsIFrame* primaryFrame = GetPrimaryFrame(); if (primaryFrame) { - nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame); + nsITextControlFrame* textFrame = nsnull; + CallQueryInterface(primaryFrame, &textFrame); if (textFrame) { textFrame->CheckFireOnChange(); } @@ -728,7 +730,9 @@ nsHTMLTextAreaElement::SetSelectionStart(PRInt32 aSelectionStart) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame){ - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionStart(aSelectionStart); } @@ -752,7 +756,9 @@ nsHTMLTextAreaElement::SetSelectionEnd(PRInt32 aSelectionEnd) nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionEnd(aSelectionEnd); } @@ -768,7 +774,9 @@ nsHTMLTextAreaElement::GetSelectionRange(PRInt32* aSelectionStart, nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd); } @@ -783,7 +791,9 @@ nsHTMLTextAreaElement::SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelec nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE); if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); + nsITextControlFrame* textControlFrame = nsnull; + CallQueryInterface(formControlFrame, &textControlFrame); + if (textControlFrame) rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd); } diff --git a/content/html/document/src/nsPluginDocument.cpp b/content/html/document/src/nsPluginDocument.cpp index 16d765ffebe..a95c52d5a3e 100644 --- a/content/html/document/src/nsPluginDocument.cpp +++ b/content/html/document/src/nsPluginDocument.cpp @@ -129,7 +129,8 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt) return rv; } - nsIObjectFrame* objFrame = do_QueryFrame(frame); + nsIObjectFrame* objFrame; + CallQueryInterface(frame, &objFrame); if (!objFrame) { mPluginDoc->AllowNormalInstantiation(); return NS_ERROR_UNEXPECTED; @@ -327,7 +328,9 @@ nsPluginDocument::Print() nsIFrame* frame = shell->GetPrimaryFrameFor(mPluginContent); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - nsIObjectFrame* objectFrame = do_QueryFrame(frame); + nsIObjectFrame* objectFrame = nsnull; + CallQueryInterface(frame, &objectFrame); + if (objectFrame) { nsCOMPtr pi; objectFrame->GetPluginInstance(*getter_AddRefs(pi)); diff --git a/content/svg/content/src/nsISVGTextContentMetrics.h b/content/svg/content/src/nsISVGTextContentMetrics.h index 5657c657808..294051fcfca 100644 --- a/content/svg/content/src/nsISVGTextContentMetrics.h +++ b/content/svg/content/src/nsISVGTextContentMetrics.h @@ -39,18 +39,21 @@ #ifndef __NS_ISVGTEXTCONTENTMETRICS_H__ #define __NS_ISVGTEXTCONTENTMETRICS_H__ -#include "nsQueryFrame.h" - +#include "nsISupports.h" class nsIDOMSVGRect; class nsIDOMSVGPoint; //////////////////////////////////////////////////////////////////////// // nsISVGTextContentMetrics -class nsISVGTextContentMetrics +// {CBF0A774-4171-4112-BD9A-F49BEFC0CE18} +#define NS_ISVGTEXTCONTENTMETRICS_IID \ +{ 0xcbf0a774, 0x4171, 0x4112, { 0xbd, 0x9a, 0xf4, 0x9b, 0xef, 0xc0, 0xce, 0x18 } } + +class nsISVGTextContentMetrics : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsISVGTextContentMetrics) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGTEXTCONTENTMETRICS_IID) NS_IMETHOD GetNumberOfChars(PRInt32 *_retval)=0; NS_IMETHOD GetComputedTextLength(float *_retval)=0; @@ -62,4 +65,7 @@ public: NS_IMETHOD GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGTextContentMetrics, + NS_ISVGTEXTCONTENTMETRICS_IID) + #endif // __NS_ISVGTEXTCONTENTMETRICS_H__ diff --git a/content/svg/content/src/nsISVGValue.h b/content/svg/content/src/nsISVGValue.h index 89efc2b8a2d..9025e81ee46 100644 --- a/content/svg/content/src/nsISVGValue.h +++ b/content/svg/content/src/nsISVGValue.h @@ -41,7 +41,6 @@ #define __NS_ISVGVALUE_H__ #include "nsISupports.h" -#include "nsQueryFrame.h" #include "nsString.h" class nsISVGValueObserver; @@ -73,7 +72,6 @@ public: }; NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGVALUE_IID) - NS_DECLARE_FRAME_ACCESSOR(nsISVGValue) NS_IMETHOD SetValueString(const nsAString& aValue)=0; NS_IMETHOD GetValueString(nsAString& aValue)=0; diff --git a/content/svg/content/src/nsSVGGraphicElement.cpp b/content/svg/content/src/nsSVGGraphicElement.cpp index 2063cb6dacd..14d07232c0c 100644 --- a/content/svg/content/src/nsSVGGraphicElement.cpp +++ b/content/svg/content/src/nsSVGGraphicElement.cpp @@ -94,7 +94,8 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval) if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) return NS_ERROR_FAILURE; - nsISVGChildFrame* svgframe = do_QueryFrame(frame); + nsISVGChildFrame* svgframe; + CallQueryInterface(frame, &svgframe); NS_ASSERTION(svgframe, "wrong frame type"); if (svgframe) { svgframe->SetMatrixPropagation(PR_FALSE); diff --git a/content/svg/content/src/nsSVGPatternElement.cpp b/content/svg/content/src/nsSVGPatternElement.cpp index c9cf099ab14..2a9fc36827e 100644 --- a/content/svg/content/src/nsSVGPatternElement.cpp +++ b/content/svg/content/src/nsSVGPatternElement.cpp @@ -276,7 +276,8 @@ nsSVGPatternElement::PushUpdate() nsIFrame *frame = GetPrimaryFrame(); if (frame) { - nsISVGValue *value = do_QueryFrame(frame); + nsISVGValue *value = nsnull; + CallQueryInterface(frame, &value); if (value) { value->BeginBatchUpdate(); value->EndBatchUpdate(); diff --git a/content/svg/content/src/nsSVGSVGElement.cpp b/content/svg/content/src/nsSVGSVGElement.cpp index ca54bd2fd26..05d9461fa78 100644 --- a/content/svg/content/src/nsSVGSVGElement.cpp +++ b/content/svg/content/src/nsSVGSVGElement.cpp @@ -365,7 +365,8 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval NS_ASSERTION(frame, "suspending redraw w/o frame"); #endif if (frame) { - nsISVGSVGFrame* svgframe = do_QueryFrame(frame); + nsISVGSVGFrame* svgframe; + CallQueryInterface(frame, &svgframe); NS_ASSERTION(svgframe, "wrong frame type"); if (svgframe) { svgframe->SuspendRedraw(); @@ -403,7 +404,8 @@ nsSVGSVGElement::UnsuspendRedrawAll() NS_ASSERTION(frame, "unsuspending redraw w/o frame"); #endif if (frame) { - nsISVGSVGFrame* svgframe = do_QueryFrame(frame); + nsISVGSVGFrame* svgframe; + CallQueryInterface(frame, &svgframe); NS_ASSERTION(svgframe, "wrong frame type"); if (svgframe) { svgframe->UnsuspendRedraw(); @@ -656,7 +658,8 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval) if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) return NS_ERROR_FAILURE; - nsISVGChildFrame* svgframe = do_QueryFrame(frame); + nsISVGChildFrame* svgframe; + CallQueryInterface(frame, &svgframe); if (svgframe) { svgframe->SetMatrixPropagation(PR_FALSE); svgframe->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | @@ -1294,7 +1297,8 @@ nsSVGSVGElement::InvalidateTransformNotifyFrame() nsIFrame* frame = presShell->GetPrimaryFrameFor(this); if (frame) { - nsISVGSVGFrame* svgframe = do_QueryFrame(frame); + nsISVGSVGFrame* svgframe; + CallQueryInterface(frame, &svgframe); if (svgframe) { svgframe->NotifyViewportChange(); } diff --git a/content/svg/content/src/nsSVGSwitchElement.cpp b/content/svg/content/src/nsSVGSwitchElement.cpp index 7b0edc0d079..a2fb084b2ef 100644 --- a/content/svg/content/src/nsSVGSwitchElement.cpp +++ b/content/svg/content/src/nsSVGSwitchElement.cpp @@ -97,7 +97,9 @@ nsSVGSwitchElement::MaybeInvalidate() nsIFrame *frame = GetPrimaryFrame(); if (frame) { - nsISVGChildFrame* svgFrame = do_QueryFrame(frame); + nsISVGChildFrame* svgFrame = nsnull; + + CallQueryInterface(frame, &svgFrame); if (svgFrame) { nsSVGUtils::UpdateGraphic(svgFrame); } diff --git a/content/svg/content/src/nsSVGTSpanElement.cpp b/content/svg/content/src/nsSVGTSpanElement.cpp index 9a88df4b440..e3fdcab37c5 100644 --- a/content/svg/content/src/nsSVGTSpanElement.cpp +++ b/content/svg/content/src/nsSVGTSpanElement.cpp @@ -82,7 +82,7 @@ protected: // nsSVGElement overrides virtual PRBool IsEventName(nsIAtom* aName); - nsISVGTextContentMetrics* GetTextContentMetrics(); + already_AddRefed GetTextContentMetrics(); // nsIDOMSVGTextPositioning properties: nsCOMPtr mX; @@ -253,7 +253,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * /* long getNumberOfChars (); */ NS_IMETHODIMP nsSVGTSpanElement::GetNumberOfChars(PRInt32 *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetNumberOfChars(_retval); @@ -265,7 +265,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetNumberOfChars(PRInt32 *_retval) /* float getComputedTextLength (); */ NS_IMETHODIMP nsSVGTSpanElement::GetComputedTextLength(float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetComputedTextLength(_retval); @@ -277,7 +277,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetComputedTextLength(float *_retval) /* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */ NS_IMETHODIMP nsSVGTSpanElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetSubStringLength(charnum, nchars, _retval); @@ -290,7 +290,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetSubStringLength(PRUint32 charnum, PRUint32 n NS_IMETHODIMP nsSVGTSpanElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -301,7 +301,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOM NS_IMETHODIMP nsSVGTSpanElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -312,7 +312,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSV NS_IMETHODIMP nsSVGTSpanElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -324,7 +324,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetRotationOfChar(PRUint32 charnum, float *_ret { *_retval = 0.0; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -339,7 +339,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, if (!point) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetCharNumAtPosition(point, _retval); @@ -385,7 +385,7 @@ nsSVGTSpanElement::IsEventName(nsIAtom* aName) //---------------------------------------------------------------------- // implementation helpers: -nsISVGTextContentMetrics* +already_AddRefed nsSVGTSpanElement::GetTextContentMetrics() { nsIFrame* frame = GetPrimaryFrame(Flush_Layout); @@ -394,6 +394,7 @@ nsSVGTSpanElement::GetTextContentMetrics() return nsnull; } - nsISVGTextContentMetrics* metrics = do_QueryFrame(frame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(frame, &metrics); return metrics; } diff --git a/content/svg/content/src/nsSVGTextElement.cpp b/content/svg/content/src/nsSVGTextElement.cpp index ef31d7f4f44..b992f43b48d 100644 --- a/content/svg/content/src/nsSVGTextElement.cpp +++ b/content/svg/content/src/nsSVGTextElement.cpp @@ -80,7 +80,7 @@ public: protected: - nsISVGTextContentMetrics* GetTextContentMetrics(); + already_AddRefed GetTextContentMetrics(); // nsIDOMSVGTextPositioning properties: nsCOMPtr mX; @@ -250,7 +250,7 @@ NS_IMETHODIMP nsSVGTextElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * * /* long getNumberOfChars (); */ NS_IMETHODIMP nsSVGTextElement::GetNumberOfChars(PRInt32 *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetNumberOfChars(_retval); @@ -262,7 +262,7 @@ NS_IMETHODIMP nsSVGTextElement::GetNumberOfChars(PRInt32 *_retval) /* float getComputedTextLength (); */ NS_IMETHODIMP nsSVGTextElement::GetComputedTextLength(float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetComputedTextLength(_retval); @@ -274,7 +274,7 @@ NS_IMETHODIMP nsSVGTextElement::GetComputedTextLength(float *_retval) /* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */ NS_IMETHODIMP nsSVGTextElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetSubStringLength(charnum, nchars, _retval); @@ -287,7 +287,7 @@ NS_IMETHODIMP nsSVGTextElement::GetSubStringLength(PRUint32 charnum, PRUint32 nc NS_IMETHODIMP nsSVGTextElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -298,7 +298,7 @@ NS_IMETHODIMP nsSVGTextElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMS NS_IMETHODIMP nsSVGTextElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -309,7 +309,7 @@ NS_IMETHODIMP nsSVGTextElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVG NS_IMETHODIMP nsSVGTextElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -321,7 +321,7 @@ NS_IMETHODIMP nsSVGTextElement::GetRotationOfChar(PRUint32 charnum, float *_retv { *_retval = 0.0; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -335,7 +335,7 @@ NS_IMETHODIMP nsSVGTextElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRIn if (!point) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetCharNumAtPosition(point, _retval); @@ -369,7 +369,7 @@ nsSVGTextElement::IsAttributeMapped(const nsIAtom* name) const //---------------------------------------------------------------------- // implementation helpers: -nsISVGTextContentMetrics* +already_AddRefed nsSVGTextElement::GetTextContentMetrics() { nsIFrame* frame = GetPrimaryFrame(Flush_Layout); @@ -378,6 +378,7 @@ nsSVGTextElement::GetTextContentMetrics() return nsnull; } - nsISVGTextContentMetrics* metrics = do_QueryFrame(frame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(frame, &metrics); return metrics; } diff --git a/content/svg/content/src/nsSVGTextPathElement.cpp b/content/svg/content/src/nsSVGTextPathElement.cpp index 0216963f566..5fbc2264a6e 100644 --- a/content/svg/content/src/nsSVGTextPathElement.cpp +++ b/content/svg/content/src/nsSVGTextPathElement.cpp @@ -155,7 +155,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration /* long getNumberOfChars (); */ NS_IMETHODIMP nsSVGTextPathElement::GetNumberOfChars(PRInt32 *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetNumberOfChars(_retval); @@ -167,7 +167,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetNumberOfChars(PRInt32 *_retval) /* float getComputedTextLength (); */ NS_IMETHODIMP nsSVGTextPathElement::GetComputedTextLength(float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetComputedTextLength(_retval); @@ -179,7 +179,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetComputedTextLength(float *_retval) /* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */ NS_IMETHODIMP nsSVGTextPathElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval) { - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetSubStringLength(charnum, nchars, _retval); @@ -192,7 +192,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetSubStringLength(PRUint32 charnum, PRUint3 NS_IMETHODIMP nsSVGTextPathElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -203,7 +203,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetStartPositionOfChar(PRUint32 charnum, nsI NS_IMETHODIMP nsSVGTextPathElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -214,7 +214,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetEndPositionOfChar(PRUint32 charnum, nsIDO NS_IMETHODIMP nsSVGTextPathElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval) { *_retval = nsnull; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -226,7 +226,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetRotationOfChar(PRUint32 charnum, float *_ { *_retval = 0.0; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (!metrics) return NS_ERROR_FAILURE; @@ -241,7 +241,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, if (!point) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR; - nsISVGTextContentMetrics *metrics = GetTextContentMetrics(); + nsCOMPtr metrics = GetTextContentMetrics(); if (metrics) return metrics->GetCharNumAtPosition(point, _retval); @@ -307,7 +307,7 @@ nsSVGTextPathElement::GetStringInfo() //---------------------------------------------------------------------- // implementation helpers: -nsISVGTextContentMetrics* +already_AddRefed nsSVGTextPathElement::GetTextContentMetrics() { nsIFrame* frame = GetPrimaryFrame(Flush_Layout); @@ -316,6 +316,7 @@ nsSVGTextPathElement::GetTextContentMetrics() return nsnull; } - nsISVGTextContentMetrics* metrics = do_QueryFrame(frame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(frame, &metrics); return metrics; } diff --git a/content/svg/content/src/nsSVGTextPathElement.h b/content/svg/content/src/nsSVGTextPathElement.h index 362ae7e2397..1056a067685 100755 --- a/content/svg/content/src/nsSVGTextPathElement.h +++ b/content/svg/content/src/nsSVGTextPathElement.h @@ -82,7 +82,7 @@ protected: virtual PRBool IsEventName(nsIAtom* aName); - nsISVGTextContentMetrics* GetTextContentMetrics(); + already_AddRefed GetTextContentMetrics(); enum { STARTOFFSET }; nsSVGLength2 mLengthAttributes[1]; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index b2e1ab23d85..b373e945c81 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -4345,7 +4345,8 @@ nsDocShell::GetScrollbarVisibility(PRBool * verticalVisible, static_cast(scrollView->View()->GetParent()->GetClientData()); if (!scrollFrame) return NS_ERROR_FAILURE; - nsIScrollableFrame* scrollable = do_QueryFrame(scrollFrame); + nsIScrollableFrame* scrollable = nsnull; + CallQueryInterface(scrollFrame, &scrollable); if (!scrollable) return NS_ERROR_FAILURE; @@ -9263,8 +9264,8 @@ nsDocShell::SetHasFocus(PRBool aHasFocus) // child lists. aFrame must be non-null. static nsICanvasFrame* FindCanvasFrame(nsIFrame* aFrame) { - nsICanvasFrame* canvasFrame = do_QueryFrame(aFrame); - if (canvasFrame) { + nsICanvasFrame* canvasFrame; + if (NS_SUCCEEDED(CallQueryInterface(aFrame, &canvasFrame))) { return canvasFrame; } @@ -9301,8 +9302,8 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus) if (frame) { frame = frame->GetParent(); if (frame) { - nsICanvasFrame* canvasFrame = do_QueryFrame(frame); - if (canvasFrame) { + nsICanvasFrame* canvasFrame; + if (NS_SUCCEEDED(CallQueryInterface(frame, &canvasFrame))) { return canvasFrame->SetHasFocus(aCanvasHasFocus); } } diff --git a/editor/libeditor/html/nsTableEditor.cpp b/editor/libeditor/html/nsTableEditor.cpp index 38d1b6fe9c5..5cb19c7a07c 100644 --- a/editor/libeditor/html/nsTableEditor.cpp +++ b/editor/libeditor/html/nsTableEditor.cpp @@ -2730,7 +2730,9 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent); if (!layoutObject) return NS_ERROR_FAILURE; - nsITableCellLayout *cellLayoutObject = do_QueryFrame(layoutObject); + nsITableCellLayout *cellLayoutObject=nsnull; // again, frames are not ref-counted + res = layoutObject->QueryInterface(NS_GET_IID(nsITableCellLayout), (void**)(&cellLayoutObject)); + if (NS_FAILED(res)) return res; if (!cellLayoutObject) return NS_ERROR_FAILURE; return cellLayoutObject->GetCellIndexes(*aRowIndex, *aColIndex); } @@ -2750,8 +2752,8 @@ nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **table nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent); if (!layoutObject) return NS_ERROR_FAILURE; - *tableLayoutObject = do_QueryFrame(layoutObject); - return *tableLayoutObject ? NS_OK : NS_NOINTERFACE; + return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout), + (void**)(tableLayoutObject)); } //Return actual number of cells (a cell with colspan > 1 counts as just 1) diff --git a/embedding/components/find/src/nsFind.cpp b/embedding/components/find/src/nsFind.cpp index 8c8e6c00546..5282f6285e4 100644 --- a/embedding/components/find/src/nsFind.cpp +++ b/embedding/components/find/src/nsFind.cpp @@ -378,7 +378,8 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent) if (!frame) return; - nsITextControlFrame* tcFrame = do_QueryFrame(frame); + nsITextControlFrame* tcFrame = nsnull; + CallQueryInterface(frame, &tcFrame); if (!tcFrame) return; diff --git a/embedding/components/find/src/nsWebBrowserFind.cpp b/embedding/components/find/src/nsWebBrowserFind.cpp index 2087d4a7db4..11ed7e5694d 100644 --- a/embedding/components/find/src/nsWebBrowserFind.cpp +++ b/embedding/components/find/src/nsWebBrowserFind.cpp @@ -440,7 +440,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow, nsIFrame* f = presShell->GetPrimaryFrameFor(content); if (!f) return; - tcFrame = do_QueryFrame(f); + CallQueryInterface(f, &tcFrame); break; } } diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index bdbb664d00c..711e56509ce 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -53,6 +53,8 @@ #include "nsInlineFrame.h" #include "nsPlaceholderFrame.h" +static NS_DEFINE_IID(kInlineFrameCID, NS_INLINE_FRAME_CID); + static const PRUnichar kSpace = 0x0020; static const PRUnichar kLineSeparator = 0x2028; static const PRUnichar kObjectSubstitute = 0xFFFC; @@ -850,7 +852,9 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame, isLeftMost /* out */, isRightMost /* out */); - nsInlineFrame* testFrame = do_QueryFrame(aFrame); + nsIFrame* testFrame; + aFrame->QueryInterface(kInlineFrameCID, (void**)&testFrame); + if (testFrame) { aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 7ab027302ee..f1fe2402b3d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -4517,7 +4517,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement, PR_TRUE, newFrame); - nsIScrollableFrame* scrollable = do_QueryFrame(newFrame); + nsIScrollableFrame* scrollable; + CallQueryInterface(newFrame, &scrollable); NS_ENSURE_TRUE(scrollable, NS_ERROR_FAILURE); nsIScrollableView* scrollableView = scrollable->GetScrollableView(); @@ -4672,8 +4673,8 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIFrame** aNewFrame, radioStyle = mPresShell->StyleSet()->ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::radio, aStyleContext); - nsIRadioControlFrame* radio = do_QueryFrame(*aNewFrame); - if (radio) { + nsIRadioControlFrame* radio = nsnull; + if (*aNewFrame && NS_SUCCEEDED(CallQueryInterface(*aNewFrame, &radio))) { radio->SetRadioButtonFaceStyleContext(radioStyle); } return NS_OK; @@ -4693,8 +4694,8 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIFrame** aNewFrame, checkboxStyle = mPresShell->StyleSet()->ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::check, aStyleContext); - nsICheckboxControlFrame* checkbox = do_QueryFrame(*aNewFrame); - if (checkbox) { + nsICheckboxControlFrame* checkbox = nsnull; + if (*aNewFrame && NS_SUCCEEDED(CallQueryInterface(*aNewFrame, &checkbox))) { checkbox->SetCheckboxFaceStyleContext(checkboxStyle); } return NS_OK; @@ -4771,7 +4772,8 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, #ifdef DEBUG // Make sure that we're an anonymous content creator exactly when we're a // leaf - nsIAnonymousContentCreator* creator = do_QueryFrame(buttonFrame); + nsIAnonymousContentCreator* creator = nsnull; + CallQueryInterface(buttonFrame, &creator); NS_ASSERTION(!creator == !isLeaf, "Should be creator exactly when we're a leaf"); #endif @@ -4789,7 +4791,8 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, #ifdef DEBUG // Make sure that anonymous child creation will have no effect in this case - nsIAnonymousContentCreator* creator = do_QueryFrame(blockFrame); + nsIAnonymousContentCreator* creator = nsnull; + CallQueryInterface(blockFrame, &creator); NS_ASSERTION(!creator, "Shouldn't be an anonymous content creator!"); #endif @@ -4875,7 +4878,8 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState, /////////////////////////////////////////////////////////////////// // Combobox - Old Native Implementation /////////////////////////////////////////////////////////////////// - nsIComboboxControlFrame* comboBox = do_QueryFrame(comboboxFrame); + nsIComboboxControlFrame* comboBox = nsnull; + CallQueryInterface(comboboxFrame, &comboBox); NS_ASSERTION(comboBox, "NS_NewComboboxControlFrame returned frame that " "doesn't implement nsIComboboxControlFrame"); @@ -4889,8 +4893,9 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState, nsIFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle); // Notify the listbox that it is being used as a dropdown list. - nsIListControlFrame * listControlFrame = do_QueryFrame(listFrame); - if (listControlFrame) { + nsIListControlFrame * listControlFrame; + rv = CallQueryInterface(listFrame, &listControlFrame); + if (NS_SUCCEEDED(rv)) { listControlFrame->SetComboboxFrame(comboboxFrame); } // Notify combobox that it should use the listbox as it's popup @@ -5110,12 +5115,13 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState, ProcessChildren(aState, aContent, aStyleContext, blockFrame, PR_TRUE, childItems, PR_TRUE); + static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); nsIFrame * child = childItems.childList; nsIFrame * previous = nsnull; - nsLegendFrame* legendFrame = nsnull; + nsIFrame* legendFrame = nsnull; while (nsnull != child) { - legendFrame = do_QueryFrame(child); - if (legendFrame) { + nsresult result = child->QueryInterface(kLegendFrameCID, (void**)&legendFrame); + if (NS_SUCCEEDED(result) && legendFrame) { // We want the legend to be the first frame in the fieldset child list. // That way the EventStateManager will do the right thing when tabbing // from a selection point within the legend (bug 236071), which is @@ -5182,7 +5188,8 @@ nsCSSFrameConstructor::ConstructTextFrame(nsFrameConstructorState& aState, if (aParentFrame->IsFrameOfType(nsIFrame::eSVG)) { nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame); if (ancestorFrame) { - nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(ancestorFrame, &metrics); if (!metrics) { return NS_OK; } @@ -5572,7 +5579,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState, nsIFrame* aParentFrame, nsFrameItems& aChildItems) { - nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame); + nsIAnonymousContentCreator* creator = nsnull; + CallQueryInterface(aParentFrame, &creator); if (!creator) return NS_OK; @@ -6985,7 +6993,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, else if (aTag == nsGkAtoms::text) { nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame); if (ancestorFrame) { - nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(ancestorFrame, &metrics); // Text cannot be nested if (!metrics) newFrame = NS_NewSVGTextFrame(mPresShell, aContent, aStyleContext); @@ -6994,7 +7003,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, else if (aTag == nsGkAtoms::tspan) { nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame); if (ancestorFrame) { - nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(ancestorFrame, &metrics); if (metrics) newFrame = NS_NewSVGTSpanFrame(mPresShell, aContent, ancestorFrame, aStyleContext); @@ -8489,7 +8499,8 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer, #ifdef DEBUG if (gReallyNoisyContentUpdates) { - nsIFrameDebug* fdbg = do_QueryFrame(parentFrame); + nsIFrameDebug* fdbg = nsnull; + CallQueryInterface(parentFrame, &fdbg); if (fdbg) { printf("nsCSSFrameConstructor::ContentAppended: resulting frame model:\n"); fdbg->List(stdout, 0); @@ -8636,7 +8647,8 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer, InvalidateCanvasIfNeeded(docElementFrame); #ifdef DEBUG if (gReallyNoisyContentUpdates) { - nsIFrameDebug* fdbg = do_QueryFrame(docElementFrame); + nsIFrameDebug* fdbg = nsnull; + CallQueryInterface(docElementFrame, &fdbg); if (fdbg) { printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n"); fdbg->List(stdout, 0); @@ -8928,7 +8940,8 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer, #ifdef DEBUG if (gReallyNoisyContentUpdates && parentFrame) { - nsIFrameDebug* fdbg = do_QueryFrame(parentFrame); + nsIFrameDebug* fdbg = nsnull; + CallQueryInterface(parentFrame, &fdbg); if (fdbg) { printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n"); fdbg->List(stdout, 0); @@ -9306,7 +9319,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer, nsFrame::ListTag(stdout, childFrame); printf("\n"); - nsIFrameDebug* fdbg = do_QueryFrame(parentFrame); + nsIFrameDebug* fdbg = nsnull; + CallQueryInterface(parentFrame, &fdbg); if (fdbg) fdbg->List(stdout, 0); } @@ -9370,7 +9384,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer, #ifdef DEBUG if (gReallyNoisyContentUpdates && parentFrame) { - nsIFrameDebug* fdbg = do_QueryFrame(parentFrame); + nsIFrameDebug* fdbg = nsnull; + CallQueryInterface(parentFrame, &fdbg); if (fdbg) { printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n"); fdbg->List(stdout, 0); @@ -12521,15 +12536,16 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState, nsIFrameDebug* frameDebug; printf("nsCSSFrameConstructor::ConstructInline:\n"); - if ( (frameDebug = do_QueryFrame(aNewFrame)) ) { + if (NS_SUCCEEDED(CallQueryInterface(aNewFrame, &frameDebug))) { printf(" ==> leading inline frame:\n"); frameDebug->List(stdout, 2); } - if ( (frameDebug = do_QueryFrame(blockFrame)) ) { + if (NS_SUCCEEDED(CallQueryInterface(blockFrame, &frameDebug))) { printf(" ==> block frame:\n"); frameDebug->List(stdout, 2); } - if ( (frameDebug = do_QueryFrame(inlineFrame)) ) { + if (inlineFrame && + NS_SUCCEEDED(CallQueryInterface(inlineFrame, &frameDebug))) { printf(" ==> trailing inline frame:\n"); frameDebug->List(stdout, 2); } diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 0975b2a354a..f6d6266fe37 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -240,13 +240,14 @@ protected: if (mBidiEnabled) { // Find the containing block frame nsIFrame* frame = aFrame; - do { + nsresult rv = NS_ERROR_FAILURE; + while (frame && + frame->IsFrameOfType(nsIFrame::eLineParticipant) && + NS_FAILED(rv)) { frame = frame->GetParent(); - mBlockFrame = do_QueryFrame(frame); + rv = frame->QueryInterface(kBlockFrameCID, (void**)&mBlockFrame); } - while (frame && frame->IsFrameOfType(nsIFrame::eLineParticipant)); - - NS_ASSERTION(mBlockFrame, "Cannot find containing block."); + NS_ASSERTION(NS_SUCCEEDED(rv) && mBlockFrame, "Cannot find containing block."); mLineContinuationPoint = mContinuationPoint; } diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index eeb414e58cf..bf0b3559668 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -1184,7 +1184,8 @@ nsresult nsCaret::UpdateCaretRects(nsIFrame* aFrame, PRInt32 aFrameOffset) if (scrollFrame) { // First, use the scrollFrame to get at the scrollable view that we're in. - nsIScrollableFrame *scrollable = do_QueryFrame(scrollFrame); + nsIScrollableFrame *scrollable; + CallQueryInterface(scrollFrame, &scrollable); nsIScrollableView *scrollView = scrollable->GetScrollableView(); nsIView *view; scrollView->GetScrolledView(view); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 6cc646e7b73..786809aa4fe 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -3737,8 +3737,8 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) if (fndPageFrame && scrollableView) { nscoord deadSpaceGapTwips = 0; - nsIPageSequenceFrame * sqf = do_QueryFrame(seqFrame); - if (sqf) { + nsIPageSequenceFrame * sqf; + if (NS_SUCCEEDED(CallQueryInterface(seqFrame, &sqf))) { sqf->GetDeadSpaceValue(&deadSpaceGapTwips); } diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 4f10af43e60..a6ee8e21c62 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -737,8 +737,9 @@ DumpContext(nsIFrame* aFrame, nsStyleContext* aContext) if (aFrame) { fputs("frame: ", stdout); nsAutoString name; - nsIFrameDebug *frameDebug = do_QueryFrame(aFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(name); fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout); } @@ -1587,7 +1588,9 @@ nsFrameManager::CaptureFrameStateFor(nsIFrame* aFrame, } // Only capture state for stateful frames - nsIStatefulFrame* statefulFrame = do_QueryFrame(aFrame); + nsIStatefulFrame* statefulFrame; + CallQueryInterface(aFrame, &statefulFrame); + if (!statefulFrame) { return; } @@ -1652,7 +1655,8 @@ nsFrameManager::RestoreFrameStateFor(nsIFrame* aFrame, } // Only restore state for stateful frames - nsIStatefulFrame* statefulFrame = do_QueryFrame(aFrame); + nsIStatefulFrame* statefulFrame; + CallQueryInterface(aFrame, &statefulFrame); if (!statefulFrame) { return; } diff --git a/layout/base/nsIPercentHeightObserver.h b/layout/base/nsIPercentHeightObserver.h index c80d6b89ee7..e7201cf0523 100644 --- a/layout/base/nsIPercentHeightObserver.h +++ b/layout/base/nsIPercentHeightObserver.h @@ -38,20 +38,22 @@ #ifndef nsIPercentHeightObserver_h___ #define nsIPercentHeightObserver_h___ -#include "nsQueryFrame.h" - struct nsHTMLReflowState; class nsPresContext; +// IID for the nsIPercentHeightObserver interface +#define NS_IPERCENTHEIGHTOBSERVER_IID \ + { 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}} + /** * This interface is supported by frames that need to provide computed height * values to children during reflow which would otherwise not happen. Currently only * table cells support this. */ -class nsIPercentHeightObserver +class nsIPercentHeightObserver : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIPercentHeightObserver) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID) // Notify the observer that aReflowState has no computed height, but it has a percent height virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0; @@ -60,4 +62,7 @@ public: virtual PRBool NeedsToObserve(const nsHTMLReflowState& aReflowState) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIPercentHeightObserver, + NS_IPERCENTHEIGHTOBSERVER_IID) + #endif // nsIPercentHeightObserver_h___ diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index 7977f874ba2..3c694eeb6b8 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -159,7 +159,10 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList, fputc(' ', aOutput); } nsIFrame* f = i->GetUnderlyingFrame(); - nsIFrameDebug* fDebug = do_QueryFrame(f); + nsIFrameDebug* fDebug = nsnull; + if (f) { + CallQueryInterface(f, &fDebug); + } nsAutoString fName; if (fDebug) { fDebug->GetFrameName(fName); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 60402565175..80150bb8e9d 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -546,7 +546,8 @@ nsLayoutUtils::GetScrollableFrameFor(nsIFrame *aScrolledFrame) if (!frame) { return nsnull; } - nsIScrollableFrame *sf = do_QueryFrame(frame); + nsIScrollableFrame *sf; + CallQueryInterface(frame, &sf); return sf; } @@ -555,8 +556,12 @@ nsIScrollableFrame* nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView) { nsIFrame *frame = GetFrameFor(aScrollableView->View()->GetParent()); - nsIScrollableFrame *sf = do_QueryFrame(frame); - return sf; + if (frame) { + nsIScrollableFrame *sf; + CallQueryInterface(frame, &sf); + return sf; + } + return nsnull; } //static @@ -1529,8 +1534,10 @@ nsLayoutUtils::FindChildContainingDescendant(nsIFrame* aParent, nsIFrame* aDesce nsBlockFrame* nsLayoutUtils::GetAsBlock(nsIFrame* aFrame) { - nsBlockFrame* block = do_QueryFrame(aFrame); - return block; + nsBlockFrame* block; + if (NS_SUCCEEDED(aFrame->QueryInterface(kBlockFrameCID, (void**)&block))) + return block; + return nsnull; } nsBlockFrame* @@ -1675,7 +1682,8 @@ nsLayoutUtils::IsViewportScrollbarFrame(nsIFrame* aFrame) if (!rootScrollFrame) return PR_FALSE; - nsIScrollableFrame* rootScrollableFrame = do_QueryFrame(rootScrollFrame); + nsIScrollableFrame* rootScrollableFrame = nsnull; + CallQueryInterface(rootScrollFrame, &rootScrollableFrame); NS_ASSERTION(rootScrollableFrame, "The root scorollable frame is null"); if (!IsProperAncestorFrame(rootScrollFrame, aFrame)) @@ -2518,8 +2526,9 @@ nsLayoutUtils::GetFirstLineBaseline(const nsIFrame* aFrame, nscoord* aResult) // For first-line baselines, we have to consider scroll frames. if (fType == nsGkAtoms::scrollFrame) { - nsIScrollableFrame *sFrame = do_QueryFrame(const_cast(aFrame)); - if (!sFrame) { + nsIScrollableFrame *sFrame; + if (NS_FAILED(CallQueryInterface(const_cast + (aFrame), &sFrame)) || !sFrame) { NS_NOTREACHED("not scroll frame"); } nscoord kidBaseline; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9ea3773641c..39e149c3a7d 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2930,7 +2930,8 @@ nsIPresShell::GetRootScrollFrameAsScrollable() const nsIFrame* frame = GetRootScrollFrame(); if (!frame) return nsnull; - nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame); + nsIScrollableFrame* scrollableFrame = nsnull; + CallQueryInterface(frame, &scrollableFrame); NS_ASSERTION(scrollableFrame, "All scroll frames must implement nsIScrollableFrame"); return scrollableFrame; @@ -2946,7 +2947,9 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const *aResult = nsnull; nsIFrame* frame = mFrameConstructor->GetPageSequenceFrame(); - *aResult = do_QueryFrame(frame); + if (frame) { + CallQueryInterface(frame, aResult); + } return *aResult ? NS_OK : NS_ERROR_FAILURE; } @@ -3000,7 +3003,8 @@ PresShell::RestoreRootScrollPosition() if (historyState) { nsIFrame* scrollFrame = GetRootScrollFrame(); if (scrollFrame) { - nsIScrollableFrame* scrollableFrame = do_QueryFrame(scrollFrame); + nsIScrollableFrame* scrollableFrame; + CallQueryInterface(scrollFrame, &scrollableFrame); if (scrollableFrame) { FrameManager()->RestoreFrameStateFor(scrollFrame, historyState, nsIStatefulFrame::eDocumentScrollState); @@ -3218,7 +3222,8 @@ PresShell::GetViewToScroll(nsLayoutUtils::Direction aDirection) if (focusedContent) { nsIFrame* startFrame = GetPrimaryFrameFor(focusedContent); if (startFrame) { - nsIScrollableViewProvider* svp = do_QueryFrame(startFrame); + nsIScrollableViewProvider* svp; + CallQueryInterface(startFrame, &svp); // If this very frame provides a scroll view, start there instead of frame's // closest view, because the scroll view may be inside a child frame. // For example, this happens in the case of overflow:scroll. @@ -5990,7 +5995,9 @@ StopPluginInstance(PresShell *aShell, nsIContent *aContent) { nsIFrame *frame = aShell->FrameManager()->GetPrimaryFrameFor(aContent, -1); - nsIObjectFrame *objectFrame = do_QueryFrame(frame); + nsIObjectFrame *objectFrame = nsnull; + if (frame) + CallQueryInterface(frame, &objectFrame); if (!objectFrame) return; @@ -6274,9 +6281,10 @@ void PresShell::DoVerifyReflow() { if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; nsIFrame* rootFrame = FrameManager()->GetRootFrame(); - nsIFrameDebug *frameDebug = do_QueryFrame(rootFrame); - if (frameDebug) { + if (NS_SUCCEEDED(rootFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), + (void**)&frameDebug))) { frameDebug->VerifyTree(); } } @@ -6418,7 +6426,8 @@ ReResolveMenusAndTrees(nsIFrame *aFrame, void *aClosure) { // Trees have a special style cache that needs to be flushed when // the theme changes. - nsTreeBodyFrame *treeBody = do_QueryFrame(aFrame); + nsTreeBodyFrame *treeBody = nsnull; + CallQueryInterface(aFrame, &treeBody); if (treeBody) treeBody->ClearStyleAndImageCaches(); @@ -6592,8 +6601,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf("verifyreflow: "); nsAutoString name; if (nsnull != k1) { - nsIFrameDebug *frameDebug = do_QueryFrame(k1); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug), + (void**)&frameDebug))) { frameDebug->GetFrameName(name); } } @@ -6607,8 +6618,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf(" != "); if (nsnull != k2) { - nsIFrameDebug *frameDebug = do_QueryFrame(k2); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug), + (void**)&frameDebug))) { frameDebug->GetFrameName(name); } } @@ -6628,8 +6641,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, { printf("VerifyReflow Error:\n"); nsAutoString name; - nsIFrameDebug *frameDebug = do_QueryFrame(k1); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug), + (void**)&frameDebug))) { fprintf(stdout, " "); frameDebug->GetFrameName(name); fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout); @@ -6639,8 +6654,8 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, printf(" != \n"); - frameDebug = do_QueryFrame(k2); - if (frameDebug) { + if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug), + (void**)&frameDebug))) { fprintf(stdout, " "); frameDebug->GetFrameName(name); fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout); @@ -6998,13 +7013,13 @@ PresShell::VerifyIncrementalReflow() PRBool ok = CompareTrees(mPresContext, root1, cx, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { printf("Verify reflow failed, primary tree:\n"); - nsIFrameDebug* frameDebug = do_QueryFrame(root1); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(CallQueryInterface(root1, &frameDebug))) { frameDebug->List(stdout, 0); } printf("Verification tree:\n"); - frameDebug = do_QueryFrame(root2); - if (frameDebug) { + if (NS_SUCCEEDED(CallQueryInterface(root2, &frameDebug))) { frameDebug->List(stdout, 0); } } diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 140956e1f57..a5bed373bd1 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -287,28 +287,36 @@ nsComboboxControlFrame::~nsComboboxControlFrame() } //-------------------------------------------------------------- - -NS_QUERYFRAME_HEAD(nsComboboxControlFrame) - NS_QUERYFRAME_ENTRY(nsIComboboxControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsISelectControlFrame) - NS_QUERYFRAME_ENTRY(nsIStatefulFrame) - NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) - -NS_IMPL_QUERY_INTERFACE1(nsComboboxControlFrame, nsIRollupListener) - -NS_IMETHODIMP_(nsrefcnt) -nsComboboxControlFrame::AddRef() +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) { - return 2; -} + NS_PRECONDITION(aInstancePtr, "null out param"); -NS_IMETHODIMP_(nsrefcnt) -nsComboboxControlFrame::Release() -{ - return 1; + if (aIID.Equals(NS_GET_IID(nsIComboboxControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIRollupListener))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } #ifdef ACCESSIBILITY @@ -417,7 +425,8 @@ nsComboboxControlFrame::ShowList(nsPresContext* aPresContext, PRBool aShowList) return PR_FALSE; } - nsIFrame* listFrame = do_QueryFrame(mListControlFrame); + nsIFrame* listFrame; + CallQueryInterface(mListControlFrame, &listFrame); if (listFrame) { nsIView* view = listFrame->GetView(); NS_ASSERTION(view, "nsComboboxControlFrame view is null"); @@ -561,7 +570,8 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext nscoord scrollbarWidth = 0; nsPresContext* presContext = PresContext(); if (mListControlFrame) { - nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame); + nsIScrollableFrame* scrollable; + CallQueryInterface(mListControlFrame, &scrollable); NS_ASSERTION(scrollable, "List must be a scrollable frame"); scrollbarWidth = scrollable->GetDesiredScrollbarSizes(presContext, aRenderingContext).LeftRight(); @@ -666,7 +676,8 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext, buttonWidth = 0; } else { - nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame); + nsIScrollableFrame* scrollable; + CallQueryInterface(mListControlFrame, &scrollable); NS_ASSERTION(scrollable, "List must be a scrollable frame"); buttonWidth = scrollable->GetDesiredScrollbarSizes(PresContext(), @@ -763,7 +774,8 @@ void nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame) { mDropdownFrame = aDropDownFrame; - mListControlFrame = do_QueryFrame(mDropdownFrame); + + CallQueryInterface(mDropdownFrame, &mListControlFrame); } nsIFrame* @@ -866,11 +878,15 @@ nsComboboxControlFrame::GetIndexOfDisplayArea() NS_IMETHODIMP nsComboboxControlFrame::DoneAddingChildren(PRBool aIsDone) { - nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame); - if (!listFrame) - return NS_ERROR_FAILURE; - - return listFrame->DoneAddingChildren(aIsDone); + nsISelectControlFrame* listFrame = nsnull; + nsresult rv = NS_ERROR_FAILURE; + if (mDropdownFrame != nsnull) { + rv = CallQueryInterface(mDropdownFrame, &listFrame); + if (listFrame) { + rv = listFrame->DoneAddingChildren(aIsDone); + } + } + return rv; } NS_IMETHODIMP @@ -908,9 +924,10 @@ nsComboboxControlFrame::RemoveOption(nsPresContext* aPresContext, PRInt32 aIndex NS_IMETHODIMP nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue) { + nsISelectControlFrame* listFrame = nsnull; NS_ASSERTION(mDropdownFrame, "No dropdown frame!"); - nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame); + CallQueryInterface(mDropdownFrame, &listFrame); NS_ASSERTION(listFrame, "No list frame!"); return listFrame->GetOptionSelected(aIndex, aValue); @@ -920,9 +937,11 @@ NS_IMETHODIMP nsComboboxControlFrame::OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex) { RedisplayText(aNewIndex); - NS_ASSERTION(mDropdownFrame, "No dropdown frame!"); - nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame); + nsISelectControlFrame* listFrame = nsnull; + NS_ASSERTION(mDropdownFrame, "No dropdown frame!"); + + CallQueryInterface(mDropdownFrame, &listFrame); NS_ASSERTION(listFrame, "No list frame!"); return listFrame->OnSetSelectedIndex(aOldIndex, aNewIndex); @@ -958,23 +977,29 @@ nsComboboxControlFrame::HandleEvent(nsPresContext* aPresContext, nsresult nsComboboxControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aValue) { - nsIFormControlFrame* fcFrame = do_QueryFrame(mDropdownFrame); - if (!fcFrame) { - return NS_NOINTERFACE; + nsIFormControlFrame* fcFrame = nsnull; + nsresult result = CallQueryInterface(mDropdownFrame, &fcFrame); + if (NS_FAILED(result)) { + return result; } - - return fcFrame->SetFormProperty(aName, aValue); + if (fcFrame) { + return fcFrame->SetFormProperty(aName, aValue); + } + return NS_OK; } nsresult nsComboboxControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const { - nsIFormControlFrame* fcFrame = do_QueryFrame(mDropdownFrame); - if (!fcFrame) { - return NS_ERROR_FAILURE; + nsIFormControlFrame* fcFrame = nsnull; + nsresult result = CallQueryInterface(mDropdownFrame, &fcFrame); + if(NS_FAILED(result)) { + return result; } - - return fcFrame->GetFormProperty(aName, aValue); + if (fcFrame) { + return fcFrame->GetFormProperty(aName, aValue); + } + return NS_OK; } nsIFrame* @@ -1204,8 +1229,8 @@ nsComboboxControlFrame::Destroy() if (mDroppedDown) { // Get parent view - nsIFrame * listFrame = do_QueryFrame(mListControlFrame); - if (listFrame) { + nsIFrame * listFrame; + if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) { nsIView* view = listFrame->GetView(); NS_ASSERTION(view, "nsComboboxControlFrame view is null"); if (view) { @@ -1421,8 +1446,9 @@ nsIScrollableView* nsComboboxControlFrame::GetScrollableView() if (!mDropdownFrame) return nsnull; - nsIScrollableFrame* scrollable = do_QueryFrame(mDropdownFrame); - if (!scrollable) + nsIScrollableFrame* scrollable = nsnull; + nsresult rv = CallQueryInterface(mDropdownFrame, &scrollable); + if (NS_FAILED(rv)) return nsnull; return scrollable->GetScrollableView(); @@ -1438,7 +1464,8 @@ nsComboboxControlFrame::OnOptionSelected(nsPresContext* aPresContext, PRBool aSelected) { if (mDroppedDown) { - nsISelectControlFrame *selectFrame = do_QueryFrame(mListControlFrame); + nsCOMPtr selectFrame + = do_QueryInterface(mListControlFrame); if (selectFrame) { selectFrame->OnOptionSelected(aPresContext, aIndex, aSelected); } @@ -1490,7 +1517,8 @@ nsComboboxControlFrame::SaveState(SpecialStateID aStateID, if (!mListControlFrame) return NS_ERROR_FAILURE; - nsIStatefulFrame* stateful = do_QueryFrame(mListControlFrame); + nsIStatefulFrame* stateful; + CallQueryInterface(mListControlFrame, &stateful); return stateful->SaveState(aStateID, aState); } @@ -1500,9 +1528,11 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState) if (!mListControlFrame) return NS_ERROR_FAILURE; - nsIStatefulFrame* stateful = do_QueryFrame(mListControlFrame); - NS_ASSERTION(stateful, "Must implement nsIStatefulFrame"); - return stateful->RestoreState(aState); + nsIStatefulFrame* stateful; + nsresult rv = CallQueryInterface(mListControlFrame, &stateful); + NS_ASSERTION(NS_SUCCEEDED(rv), "Must implement nsIStatefulFrame"); + rv = stateful->RestoreState(aState); + return rv; } diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index 5f5f5ccc396..08e70aef97b 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -96,8 +96,8 @@ public: nsComboboxControlFrame(nsStyleContext* aContext); ~nsComboboxControlFrame(); - NS_DECL_QUERYFRAME - NS_DECL_ISUPPORTS_INHERITED + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIAnonymousContentCreator virtual nsresult CreateAnonymousContent(nsTArray& aElements); @@ -292,6 +292,10 @@ protected: #ifdef DO_REFLOW_COUNTER PRInt32 mReflowId; #endif + +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } }; #endif diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 2ed1e297273..a670ba54d0f 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -228,10 +228,23 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray& aElements) return NS_OK; } -NS_QUERYFRAME_HEAD(nsFileControlFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); +} void nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index b957fd3d036..18e36f66ede 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -63,7 +63,7 @@ public: const nsRect& aDirtyRect, const nsDisplayListSet& aLists); - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFormControlFrame virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue); @@ -183,6 +183,9 @@ private: */ void SyncAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aWhichControls); + + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } }; #endif diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index 359a9bda3b4..75da5959c4f 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -62,9 +62,19 @@ nsFormControlFrame::Destroy() nsLeafFrame::Destroy(); } -NS_QUERYFRAME_HEAD(nsFormControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsFormControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsLeafFrame::QueryInterface(aIID, aInstancePtr); +} nscoord nsFormControlFrame::GetIntrinsicWidth() diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index 86ee407d3f1..7a819189a32 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -64,7 +64,7 @@ public: ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); } - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); /** * Respond to a gui event @@ -124,6 +124,11 @@ protected: */ void GetCurrentCheckState(PRBool* aState); + +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } + }; #endif diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index bfa4a784d26..40e5eeb6d5e 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -186,9 +186,19 @@ NS_IMETHODIMP nsGfxButtonControlFrame::GetAccessible(nsIAccessible** aAccessible } #endif -NS_QUERYFRAME_HEAD(nsGfxButtonControlFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButtonControlFrame) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr); +} // Initially we hardcoded the default strings here. // Next, we used html.css to store the default label for various types diff --git a/layout/forms/nsGfxButtonControlFrame.h b/layout/forms/nsGfxButtonControlFrame.h index 6c5d9892178..98fc5d6fa22 100644 --- a/layout/forms/nsGfxButtonControlFrame.h +++ b/layout/forms/nsGfxButtonControlFrame.h @@ -74,8 +74,8 @@ public: #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_DECL_QUERYFRAME // nsIAnonymousContentCreator virtual nsresult CreateAnonymousContent(nsTArray& aElements); @@ -101,6 +101,9 @@ protected: PRBool IsFileBrowseButton(PRInt32 type); // Browse button of file input private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } + nsSize mSuggestedSize; nsCOMPtr mTextContent; }; diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 6a77e8f2ddc..06b9ae6bed5 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -93,9 +93,22 @@ nsGfxCheckboxControlFrame::~nsGfxCheckboxControlFrame() } -NS_QUERYFRAME_HEAD(nsGfxCheckboxControlFrame) - NS_QUERYFRAME_ENTRY(nsICheckboxControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) +//---------------------------------------------------------------------- +// nsISupports +//---------------------------------------------------------------------- +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsGfxCheckboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsICheckboxControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsFormControlFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/forms/nsGfxCheckboxControlFrame.h b/layout/forms/nsGfxCheckboxControlFrame.h index 301a6622d95..19d6a3d03f3 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.h +++ b/layout/forms/nsGfxCheckboxControlFrame.h @@ -78,7 +78,7 @@ public: virtual void SetAdditionalStyleContext(PRInt32 aIndex, nsStyleContext* aStyleContext); - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); void PaintCheckBox(nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect); @@ -91,6 +91,11 @@ protected: PRBool GetCheckboxState(); nsRefPtr mCheckButtonFaceStyle; + +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } + }; #endif diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index 38aabb05f4d..b9ff00fbd5b 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -61,9 +61,19 @@ nsGfxRadioControlFrame::~nsGfxRadioControlFrame() { } -NS_QUERYFRAME_HEAD(nsGfxRadioControlFrame) - NS_QUERYFRAME_ENTRY(nsIRadioControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsGfxRadioControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIRadioControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsFormControlFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/forms/nsGfxRadioControlFrame.h b/layout/forms/nsGfxRadioControlFrame.h index 8922376014f..e4d90027b58 100644 --- a/layout/forms/nsGfxRadioControlFrame.h +++ b/layout/forms/nsGfxRadioControlFrame.h @@ -60,9 +60,8 @@ public: nsGfxRadioControlFrame(nsStyleContext* aContext); ~nsGfxRadioControlFrame(); - NS_DECL_QUERYFRAME - - //nsIRadioControlFrame methods + //nsIRadioControlFrame methods + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD SetRadioButtonFaceStyleContext(nsStyleContext *aRadioButtonFaceStyleContext); #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); @@ -82,6 +81,10 @@ public: protected: nsRefPtr mRadioButtonFaceStyle; + +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } }; #endif diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 1964b9c0bc1..1c2cd7f03cb 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -105,9 +105,31 @@ nsHTMLButtonControlFrame::Init( return rv; } -NS_QUERYFRAME_HEAD(nsHTMLButtonControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +nsrefcnt nsHTMLButtonControlFrame::AddRef(void) +{ + NS_WARNING("not supported"); + return 1; +} + +nsrefcnt nsHTMLButtonControlFrame::Release(void) +{ + NS_WARNING("not supported"); + return 1; +} + +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsHTMLButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index 4473d2633d9..0581b8cb46b 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -65,7 +65,7 @@ public: virtual void Destroy(); - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, @@ -142,6 +142,9 @@ protected: nsMargin aFocusPadding, nsReflowStatus& aStatus); + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); + PRIntn GetSkipSides() const; nsButtonFrameRenderer mRenderer; }; diff --git a/layout/forms/nsICheckboxControlFrame.h b/layout/forms/nsICheckboxControlFrame.h index f553a0f72ef..8cf81ffd346 100644 --- a/layout/forms/nsICheckboxControlFrame.h +++ b/layout/forms/nsICheckboxControlFrame.h @@ -38,18 +38,24 @@ #ifndef nsICheckControlFrame_h___ #define nsICheckControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsStyleContext; class nsPresContext; +// IID for the nsICheckControlFrame class +// {401347ED-0101-11d4-9706-0060B0FB9956} +#define NS_ICHECKBOXCONTROLFRAME_IID \ +{ 0x401347ed, 0x101, 0x11d4, \ + { 0x97, 0x6, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } } + /** * nsICheckControlFrame is the common interface radio buttons. * @see nsFromControlFrame and its base classes for more info */ -class nsICheckboxControlFrame -{ +class nsICheckboxControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsICheckboxControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICHECKBOXCONTROLFRAME_IID) /** * Sets the Pseudo Style Contexts for the Check button @@ -63,5 +69,8 @@ public: NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsICheckboxControlFrame, + NS_ICHECKBOXCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsIComboboxControlFrame.h b/layout/forms/nsIComboboxControlFrame.h index ec8067c0a07..48aa1ee81e5 100644 --- a/layout/forms/nsIComboboxControlFrame.h +++ b/layout/forms/nsIComboboxControlFrame.h @@ -38,7 +38,7 @@ #ifndef nsIComboboxControlFrame_h___ #define nsIComboboxControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsFont.h" class nsPresContext; @@ -47,15 +47,21 @@ class nsIContent; class nsVoidArray; class nsCSSFrameConstructor; + +// IID for the nsIComboboxControlFrame class +#define NS_ICOMBOBOXCONTROLFRAME_IID \ + { 0x23f75e9c, 0x6850, 0x11da, \ + { 0x95, 0x2c, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } } + /** * nsIComboboxControlFrame is the common interface for frames of form controls. It * provides a uniform way of creating widgets, resizing, and painting. * @see nsLeafFrame and its base classes for more info */ -class nsIComboboxControlFrame : public nsQueryFrame -{ +class nsIComboboxControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIComboboxControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMBOBOXCONTROLFRAME_IID) /** * Indicates whether the list is dropped down @@ -121,5 +127,8 @@ public: virtual PRInt32 GetIndexOfDisplayArea() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIComboboxControlFrame, + NS_ICOMBOBOXCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsIFormControlFrame.h b/layout/forms/nsIFormControlFrame.h index 6e757e70521..af736bb47c4 100644 --- a/layout/forms/nsIFormControlFrame.h +++ b/layout/forms/nsIFormControlFrame.h @@ -38,21 +38,26 @@ #ifndef nsIFormControlFrame_h___ #define nsIFormControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsAString; class nsIContent; class nsIAtom; struct nsSize; +// IID for the nsIFormControlFrame class +#define NS_IFORMCONTROLFRAME_IID \ + { 0x189e1565, 0x44f, 0x11da, \ + { 0x94, 0xfc, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } } + /** * nsIFormControlFrame is the common interface for frames of form controls. It * provides a uniform way of creating widgets, resizing, and painting. * @see nsLeafFrame and its base classes for more info */ -class nsIFormControlFrame : public nsQueryFrame -{ +class nsIFormControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIFormControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMCONTROLFRAME_IID) /** * @@ -81,5 +86,7 @@ public: virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormControlFrame, NS_IFORMCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsIListControlFrame.h b/layout/forms/nsIListControlFrame.h index bea580ba0a6..80d815d0c00 100644 --- a/layout/forms/nsIListControlFrame.h +++ b/layout/forms/nsIListControlFrame.h @@ -38,19 +38,24 @@ #ifndef nsIListControlFrame_h___ #define nsIListControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsFont.h" class nsPresContext; class nsAString; class nsIContent; +// IID for the nsIListControlFrame class +#define NS_ILISTCONTROLFRAME_IID \ +{ 0x4de9ab73, 0x31b5, 0x4d92, \ + { 0xb7, 0xe4, 0x73, 0xb4, 0x4d, 0xcb, 0xfc, 0xda } } + /** * nsIListControlFrame is the interface for frame-based listboxes. */ -class nsIListControlFrame : public nsQueryFrame -{ +class nsIListControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIListControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILISTCONTROLFRAME_IID) /** * Sets the ComboBoxFrame @@ -121,5 +126,7 @@ public: virtual void OnContentReset() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIListControlFrame, NS_ILISTCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsIRadioControlFrame.h b/layout/forms/nsIRadioControlFrame.h index 6301b61e859..b205aff32b4 100644 --- a/layout/forms/nsIRadioControlFrame.h +++ b/layout/forms/nsIRadioControlFrame.h @@ -38,17 +38,24 @@ #ifndef nsIRadioControlFrame_h___ #define nsIRadioControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsStyleContext; +// IID for the nsIRadioControlFrame class +// {06450E00-24D9-11d3-966B-00105A1B1B76} +#define NS_IRADIOCONTROLFRAME_IID \ +{ 0x6450e00, 0x24d9, 0x11d3, \ + { 0x96, 0x6b, 0x0, 0x10, 0x5a, 0x1b, 0x1b, 0x76 } } + + /** * nsIRadioControlFrame is the common interface radio buttons. * @see nsFormControlFrame and its base classes for more info */ -class nsIRadioControlFrame -{ +class nsIRadioControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIRadioControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRADIOCONTROLFRAME_IID) /** * Sets the Pseudo Style Contexts for the Radio button @@ -62,5 +69,7 @@ public: NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioControlFrame, NS_IRADIOCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsISelectControlFrame.h b/layout/forms/nsISelectControlFrame.h index 278cd31e1f2..cb9b0914ec0 100644 --- a/layout/forms/nsISelectControlFrame.h +++ b/layout/forms/nsISelectControlFrame.h @@ -39,17 +39,23 @@ #ifndef nsISelectControlFrame_h___ #define nsISelectControlFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" + +// IID for the nsISelectControlFrame class +// f8a1b329-d0d8-4bd5-a9ab-08c3c0f2f166 +#define NS_ISELECTCONTROLFRAME_IID \ +{ 0xf8a1b329, 0xd0d8, 0x4bd5, \ + { 0xa9, 0xab, 0x08, 0xc3, 0xc0, 0xf2, 0xf1, 0x66 } } class nsIDOMHTMLOptionElement; /** * nsISelectControlFrame is the interface for combo boxes and listboxes */ -class nsISelectControlFrame -{ +class nsISelectControlFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsISelectControlFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISELECTCONTROLFRAME_IID) /** * Adds an option to the list at index @@ -88,4 +94,7 @@ public: }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISelectControlFrame, + NS_ISELECTCONTROLFRAME_IID) + #endif diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp index 2d7645fe037..b124708d59f 100644 --- a/layout/forms/nsImageControlFrame.cpp +++ b/layout/forms/nsImageControlFrame.cpp @@ -81,8 +81,7 @@ public: NS_IMETHOD Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow); - - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -111,6 +110,10 @@ public: virtual void SetFocus(PRBool aOn, PRBool aRepaint); virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue); virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const; + +protected: + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); }; @@ -157,9 +160,19 @@ nsImageControlFrame::Init(nsIContent* aContent, IntPointDtorFunc); } -NS_QUERYFRAME_HEAD(nsImageControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsImageControlFrameSuper) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsImageControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsImageControlFrameSuper::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsImageControlFrame::GetAccessible(nsIAccessible** aAccessible) @@ -179,6 +192,18 @@ NS_IMETHODIMP nsImageControlFrame::GetAccessible(nsIAccessible** aAccessible) } #endif +nsrefcnt nsImageControlFrame::AddRef(void) +{ + NS_WARNING("not supported"); + return 1; +} + +nsrefcnt nsImageControlFrame::Release(void) +{ + NS_WARNING("not supported"); + return 1; +} + nsIAtom* nsImageControlFrame::GetType() const { diff --git a/layout/forms/nsIsIndexFrame.cpp b/layout/forms/nsIsIndexFrame.cpp index df24668ae4f..0485587ec2c 100644 --- a/layout/forms/nsIsIndexFrame.cpp +++ b/layout/forms/nsIsIndexFrame.cpp @@ -147,8 +147,7 @@ nsIsIndexFrame::GetInputFrame(nsIFormControlFrame** oFrame) if (presShell && mInputContent) { nsIFrame *frame = presShell->GetPrimaryFrameFor(mInputContent); if (frame) { - *oFrame = do_QueryFrame(frame); - return *oFrame ? NS_OK : NS_NOINTERFACE; + return CallQueryInterface(frame, oFrame); } } return NS_OK; @@ -234,17 +233,20 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray& aElements) return NS_OK; } -NS_QUERYFRAME_HEAD(nsIsIndexFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsIStatefulFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) - // Frames are not refcounted, no need to AddRef NS_IMETHODIMP nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) { NS_PRECONDITION(aInstancePtr, "null out param"); + if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } if (aIID.Equals(NS_GET_IID(nsIDOMKeyListener))) { *aInstancePtr = static_cast(this); return NS_OK; @@ -254,7 +256,7 @@ nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return NS_OK; } - return NS_NOINTERFACE; + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); } nscoord diff --git a/layout/forms/nsIsIndexFrame.h b/layout/forms/nsIsIndexFrame.h index 42e1cd385de..c5ef853a9e9 100644 --- a/layout/forms/nsIsIndexFrame.h +++ b/layout/forms/nsIsIndexFrame.h @@ -81,12 +81,9 @@ public: */ NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent); // we only care when a key is pressed - NS_DECL_QUERYFRAME - - // nsISupports + // nsIFormControlFrame NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - // nsIFormControlFrame virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext); virtual PRBool IsLeaf() const; diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index 5556ee2ca65..e66cae2d738 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -52,6 +52,8 @@ #include "nsFont.h" #include "nsFormControlFrame.h" +static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); + nsIFrame* NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { @@ -75,9 +77,19 @@ nsLegendFrame::Destroy() nsBlockFrame::Destroy(); } -NS_QUERYFRAME_HEAD(nsLegendFrame) - NS_QUERYFRAME_ENTRY(nsLegendFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(kLegendFrameCID)) { + *aInstancePtr = this; + return NS_OK; + } + + return nsBlockFrame::QueryInterface(aIID, aInstancePtr); +} NS_IMETHODIMP nsLegendFrame::Reflow(nsPresContext* aPresContext, diff --git a/layout/forms/nsLegendFrame.h b/layout/forms/nsLegendFrame.h index 971fddd9801..b616847092c 100644 --- a/layout/forms/nsLegendFrame.h +++ b/layout/forms/nsLegendFrame.h @@ -49,13 +49,14 @@ struct nsHTMLReflowMetrics; class nsIRenderingContext; struct nsRect; +#define NS_LEGEND_FRAME_CID \ +{ 0x73805d40, 0x5a24, 0x11d2, { 0x80, 0x46, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } } + class nsLegendFrame : public nsBlockFrame { public: - NS_DECLARE_FRAME_ACCESSOR(nsLegendFrame) - nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {} - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 0b43268afe2..ee4cadb4b67 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -386,11 +386,28 @@ nsListControlFrame::InvalidateFocus() } } -NS_QUERYFRAME_HEAD(nsListControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) - NS_QUERYFRAME_ENTRY(nsIListControlFrame) - NS_QUERYFRAME_ENTRY(nsISelectControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLScrollFrame) +//--------------------------------------------------------- +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsListControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIListControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLScrollFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsListControlFrame::GetAccessible(nsIAccessible** aAccessible) @@ -1349,7 +1366,7 @@ void nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame) { if (nsnull != aComboboxFrame) { - mComboboxFrame = do_QueryFrame(aComboboxFrame); + aComboboxFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame),(void**) &mComboboxFrame); } } @@ -2184,7 +2201,8 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) if (!nsComboboxControlFrame::ToolkitHasNativePopup()) { PRBool isDroppedDown = mComboboxFrame->IsDroppedDown(); - nsIFrame* comboFrame = do_QueryFrame(mComboboxFrame); + nsIFrame* comboFrame; + CallQueryInterface(mComboboxFrame, &comboFrame); nsWeakFrame weakFrame(comboFrame); mComboboxFrame->ShowDropDown(!isDroppedDown); if (!weakFrame.IsAlive()) diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index 77a7adeece7..5f6201d1db7 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -80,7 +80,8 @@ class nsListControlFrame : public nsHTMLScrollFrame, public: friend nsIFrame* NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame NS_IMETHOD HandleEvent(nsPresContext* aPresContext, diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index 55564658a22..f56c451561a 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -1004,13 +1004,34 @@ NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) return new (aPresShell) nsTextControlFrame(aPresShell, aContext); } -NS_QUERYFRAME_HEAD(nsTextControlFrame) - NS_QUERYFRAME_ENTRY(nsIFormControlFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsITextControlFrame) - if (nsIScrollableViewProvider::kFrameIID == id && IsScrollable()) - return static_cast(this); -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +NS_IMPL_ADDREF_INHERITED(nsTextControlFrame, nsBoxFrame) +NS_IMPL_RELEASE_INHERITED(nsTextControlFrame, nsBoxFrame) + + +NS_IMETHODIMP +nsTextControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsITextControlFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider)) && IsScrollable()) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsBoxFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsTextControlFrame::GetAccessible(nsIAccessible** aAccessible) @@ -1373,7 +1394,8 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext, if (IsTextArea()) { nsIFrame* first = GetFirstChild(nsnull); - nsIScrollableFrame *scrollableFrame = do_QueryFrame(first); + nsIScrollableFrame *scrollableFrame; + CallQueryInterface(first, &scrollableFrame); NS_ASSERTION(scrollableFrame, "Child must be scrollable"); nsMargin scrollbarSizes = @@ -2796,7 +2818,8 @@ nsTextControlFrame::SetInitialChildList(nsIAtom* aListName, // than descending from the root frame of the frame hierarchy. first->AddStateBits(NS_FRAME_REFLOW_ROOT); - nsIScrollableFrame *scrollableFrame = do_QueryFrame(first); + nsIScrollableFrame *scrollableFrame = nsnull; + CallQueryInterface(first, &scrollableFrame); NS_ASSERTION(scrollableFrame, "Child must be scrollable"); // we must turn off scrollbars for singleline text controls @@ -2841,7 +2864,10 @@ nsTextControlFrame::SetInitialChildList(nsIAtom* aListName, nsIScrollableView* nsTextControlFrame::GetScrollableView() { nsIFrame* first = GetFirstChild(nsnull); - nsIScrollableFrame* scrollableFrame = do_QueryFrame(first); + nsIScrollableFrame* scrollableFrame = nsnull; + if (first) { + CallQueryInterface(first, &scrollableFrame); + } return scrollableFrame ? scrollableFrame->GetScrollableView() : nsnull; } diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index a87cfd5f3b1..8ca8bb1f03c 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -168,7 +168,7 @@ public: NS_IMETHOD GetText(nsString* aText); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED public: //for methods who access nsTextControlFrame directly /** diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index 403e1483fc6..423de86dba8 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -83,7 +83,6 @@ REQUIRES += accessibility endif EXPORTS = \ - nsQueryFrame.h \ nsFrameList.h \ nsHTMLParts.h \ nsHTMLReflowMetrics.h \ diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index ff2ded318b2..7f30889a9f3 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -369,8 +369,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent); printf("abs pos "); if (nsnull != aKidFrame) { - nsIFrameDebug *frameDebug = do_QueryFrame(aKidFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) { nsAutoString name; frameDebug->GetFrameName(name); printf("%s ", NS_LossyConvertUTF16toASCII(name).get()); @@ -513,8 +513,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent - 1); printf("abs pos "); if (nsnull != aKidFrame) { - nsIFrameDebug *frameDebug = do_QueryFrame(aKidFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) { nsAutoString name; frameDebug->GetFrameName(name); printf("%s ", NS_LossyConvertUTF16toASCII(name).get()); diff --git a/layout/generic/nsBRFrame.cpp b/layout/generic/nsBRFrame.cpp index 33b05bf898a..23c0f32d551 100644 --- a/layout/generic/nsBRFrame.cpp +++ b/layout/generic/nsBRFrame.cpp @@ -281,7 +281,7 @@ NS_IMETHODIMP BRFrame::GetAccessible(nsIAccessible** aAccessible) // "bogus node" used when there is no text in the control return NS_ERROR_FAILURE; } - return accService->CreateHTMLBRAccessible(this, aAccessible); + return accService->CreateHTMLBRAccessible(static_cast(this), aAccessible); } #endif diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index ebb82097a46..6d5ddf06b3a 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -266,6 +266,8 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) //---------------------------------------------------------------------- +const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID; + nsIFrame* NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) { @@ -328,9 +330,17 @@ nsBlockFrame::GetLineIterator() return it; } -NS_QUERYFRAME_HEAD(nsBlockFrame) - NS_QUERYFRAME_ENTRY(nsBlockFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrameSuper) +NS_IMETHODIMP +nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(kBlockFrameCID)) { + *aInstancePtr = static_cast(static_cast(this)); + return NS_OK; + } + return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); +} nsSplittableType nsBlockFrame::GetSplittableType() const @@ -439,8 +449,9 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (kid) { - nsIFrameDebug *frameDebug = do_QueryFrame(kid); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(CallQueryInterface(kid, &frameDebug))) { frameDebug->List(out, aIndent + 1); } kid = kid->GetNextSibling(); @@ -821,7 +832,8 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState, if (aLastRS != &aReflowState) { // Scrollbars need to be specifically excluded, if present, because they are outside the // padding-edge. We need better APIs for getting the various boxes from a frame. - nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRS->frame); + nsIScrollableFrame* scrollFrame; + CallQueryInterface(aLastRS->frame, &scrollFrame); nsMargin scrollbars(0,0,0,0); if (scrollFrame) { scrollbars = diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index a3713fa493e..14dad1551c4 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -127,6 +127,11 @@ class nsIntervalSet; #define nsBlockFrameSuper nsHTMLContainerFrame +#define NS_BLOCK_FRAME_CID \ + { 0xa6cf90df, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + +extern const nsIID kBlockFrameCID; + /* * Base class for block and inline frames. * The block frame has an additional named child list: @@ -137,8 +142,6 @@ class nsIntervalSet; class nsBlockFrame : public nsBlockFrameSuper { public: - NS_DECLARE_FRAME_ACCESSOR(nsBlockFrame) - typedef nsLineList::iterator line_iterator; typedef nsLineList::const_iterator const_line_iterator; typedef nsLineList::reverse_iterator reverse_line_iterator; @@ -155,8 +158,8 @@ public: friend nsIFrame* NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags); - // nsQueryFrame - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame NS_IMETHOD Init(nsIContent* aContent, diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 7a139feaf51..04e0a8297f4 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1643,8 +1643,8 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer"); // Have the child frame list - nsIFrameDebug *frameDebug = do_QueryFrame(kid); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(out, aIndent + 1); } kid = kid->GetNextSibling(); diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index c32def160e7..c9f70a2712e 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -372,6 +372,7 @@ nsFloatManager::List(FILE* out) const fi.mRect.x, fi.mRect.y, fi.mRect.width, fi.mRect.height, fi.mLeftYMost, fi.mRightYMost); } + return NS_OK; } #endif diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 967174ef816..3c38fc9b3e0 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -273,8 +273,10 @@ nsIFrameDebug::RootFrameList(nsPresContext* aPresContext, FILE* out, PRInt32 aIn if (nsnull != shell) { nsIFrame* frame = shell->FrameManager()->GetRootFrame(); if(nsnull != frame) { - nsIFrameDebug* debugFrame = do_QueryFrame(frame); - if (debugFrame) + nsIFrameDebug* debugFrame; + nsresult rv; + rv = frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&debugFrame); + if(NS_SUCCEEDED(rv)) debugFrame->List(out, aIndent); } } @@ -364,12 +366,42 @@ nsFrame::~nsFrame() mStyleContext->Release(); } -NS_QUERYFRAME_HEAD(nsFrame) - NS_QUERYFRAME_ENTRY(nsIFrame) +///////////////////////////////////////////////////////////////////////////// +// nsISupports + +NS_IMETHODIMP +nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + #ifdef DEBUG - NS_QUERYFRAME_ENTRY(nsIFrameDebug) + if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } #endif -NS_QUERYFRAME_TAIL + + if (aIID.Equals(NS_GET_IID(nsIFrame)) || + aIID.Equals(NS_GET_IID(nsISupports))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + *aInstancePtr = nsnull; + return NS_ERROR_NO_INTERFACE; +} + +nsrefcnt nsFrame::AddRef(void) +{ + NS_WARNING("not supported for frames"); + return 1; +} + +nsrefcnt nsFrame::Release(void) +{ + NS_WARNING("not supported for frames"); + return 1; +} ///////////////////////////////////////////////////////////////////////////// // nsIFrame @@ -1693,8 +1725,9 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection, while (frame && NS_SUCCEEDED(result)) { // Check for a table cell by querying to a known CellFrame interface - nsITableCellLayout *cellElement = do_QueryFrame(frame); - if (cellElement) + nsITableCellLayout *cellElement; + result = (frame)->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)&cellElement); + if (NS_SUCCEEDED(result) && cellElement) { foundCell = PR_TRUE; //TODO: If we want to use proximity to top or left border @@ -1706,8 +1739,9 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection, // If not a cell, check for table // This will happen when starting frame is the table or child of a table, // such as a row (we were inbetween cells or in table border) - nsITableLayout *tableElement = do_QueryFrame(frame); - if (tableElement) + nsITableLayout *tableElement; + result = (frame)->QueryInterface(NS_GET_IID(nsITableLayout), (void **)&tableElement); + if (NS_SUCCEEDED(result) && tableElement) { foundTable = PR_TRUE; //TODO: How can we select row when along left table edge @@ -4259,8 +4293,8 @@ nsFrame::GetSelectionController(nsPresContext *aPresContext, nsISelectionControl nsIFrame *frame = this; while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) { - nsITextControlFrame *tcf = do_QueryFrame(frame); - if (tcf) { + nsITextControlFrame *tcf; + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITextControlFrame),(void**)&tcf))) { NS_IF_ADDREF(*aSelCon = tcf->GetOwnedSelectionController()); return NS_OK; } @@ -4284,8 +4318,8 @@ nsIFrame::GetConstFrameSelection() { nsIFrame *frame = this; while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) { - nsITextControlFrame *tcf = do_QueryFrame(frame); - if (tcf) { + nsITextControlFrame *tcf; + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITextControlFrame),(void**)&tcf))) { return tcf->GetOwnedFrameSelection(); } frame = frame->GetParent(); @@ -4373,8 +4407,9 @@ nsFrame::DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 } aIndent++; while (kid) { - nsIFrameDebug* frameDebug = do_QueryFrame(kid); - if (kid) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->DumpRegressionData(aPresContext, out, aIndent, aIncludeStyleData); } kid = kid->GetNextSibling(); @@ -4783,8 +4818,9 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection) // Treat form controls as inline leaves // XXX we really need a way to determine whether a frame is inline-level - nsIFormControlFrame* fcf = do_QueryFrame(aFrame); - if (fcf) + nsIFormControlFrame* fcf; // used only for QI + nsresult rv = aFrame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&fcf); + if (NS_SUCCEEDED(rv)) return result; // Check the frame itself @@ -6050,7 +6086,7 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse) // because the extra focus outlines are considered unnecessarily ugly. // When clicked on, the selection position within the element // will be enough to make them keyboard scrollable. - nsIScrollableFrame *scrollFrame = do_QueryFrame(this); + nsCOMPtr scrollFrame = do_QueryInterface(this); if (scrollFrame) { nsMargin margin = scrollFrame->GetActualScrollbarSizes(); if (margin.top || margin.right || margin.bottom || margin.left) { @@ -7336,8 +7372,8 @@ void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, } if(!strcmp(frameTypeInfo->mNameAbbrev, "unknown")) { nsAutoString name; - nsIFrameDebug* frameDebug = do_QueryFrame(aFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(name); printf("%s %p ", NS_LossyConvertUTF16toASCII(name).get(), (void*)aFrame); } diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index f464934b256..334ddd0f1b9 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -156,8 +156,8 @@ private: public: - // nsQueryFrame - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame NS_IMETHOD Init(nsIContent* aContent, @@ -442,8 +442,9 @@ public: static void ListTag(FILE* out, nsIFrame* aFrame) { nsAutoString tmp; - nsIFrameDebug* frameDebug = do_QueryFrame(aFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); } fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); @@ -621,6 +622,10 @@ private: NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState); virtual nsILineIterator* GetLineIterator(); + +protected: + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); }; // Start Display Reflow Debugging diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index def4ca94ca7..a336f2dbca8 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -120,7 +120,10 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; } + NS_IMETHOD_(nsrefcnt) Release(void) { return 1; } virtual nsIAtom* GetType() const; @@ -239,9 +242,20 @@ NS_IMETHODIMP nsSubDocumentFrame::GetAccessible(nsIAccessible** aAccessible) } #endif -NS_QUERYFRAME_HEAD(nsSubDocumentFrame) - NS_QUERYFRAME_ENTRY(nsIFrameFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame) +//-------------------------------------------------------------- +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +nsSubDocumentFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIFrameFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsLeafFrame::QueryInterface(aIID, aInstancePtr); +} NS_IMETHODIMP nsSubDocumentFrame::Init(nsIContent* aContent, @@ -642,7 +656,10 @@ nsSubDocumentFrame::AttributeChanged(PRInt32 aNameSpaceID, if (parentFrame) { // There is no interface for nsHTMLFramesetFrame so QI'ing to // concrete class, yay! - nsHTMLFramesetFrame* framesetFrame = do_QueryFrame(parentFrame); + nsHTMLFramesetFrame* framesetFrame = nsnull; + parentFrame->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame), + (void **)&framesetFrame); + if (framesetFrame) { framesetFrame->RecalculateBorderResize(); } diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index 2beaad5c026..4c230850c1f 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -414,8 +414,8 @@ nsFrameList::List(FILE* out) const fputs("<\n", out); for (nsIFrame* frame = mFirstChild; frame; frame = frame->GetNextSibling()) { - nsIFrameDebug *frameDebug = do_QueryFrame(frame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(out, 1); } } diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 5c75c8f8eaf..956fdc3fc77 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -253,9 +253,18 @@ nsHTMLFramesetFrame::~nsHTMLFramesetFrame() FrameResizePrefCallback, this); } -NS_QUERYFRAME_HEAD(nsHTMLFramesetFrame) - NS_QUERYFRAME_ENTRY(nsHTMLFramesetFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +NS_IMETHODIMP +nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsHTMLFramesetFrame))) { + *aInstancePtr = (void*)this; + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} // static int @@ -302,7 +311,9 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent, nsIFrame* parentFrame = GetParent(); mTopLevelFrameset = (nsHTMLFramesetFrame*)this; while (parentFrame) { - nsHTMLFramesetFrame* frameset = do_QueryFrame(parentFrame); + nsHTMLFramesetFrame* frameset = nsnull; + CallQueryInterface(parentFrame, &frameset); + if (frameset) { mTopLevelFrameset = frameset; parentFrame = parentFrame->GetParent(); @@ -1298,7 +1309,8 @@ nsHTMLFramesetFrame::IsLeaf() const PRBool nsHTMLFramesetFrame::ChildIsFrameset(nsIFrame* aChild) { - nsHTMLFramesetFrame* childFrame = do_QueryFrame(aChild); + nsIFrame* childFrame = nsnull; + aChild->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame), (void**)&childFrame); if (childFrame) { return PR_TRUE; } diff --git a/layout/generic/nsFrameSetFrame.h b/layout/generic/nsFrameSetFrame.h index 286b9f66474..4b7de877a43 100644 --- a/layout/generic/nsFrameSetFrame.h +++ b/layout/generic/nsFrameSetFrame.h @@ -59,6 +59,10 @@ class nsHTMLFramesetBorderFrame; class nsGUIEvent; class nsHTMLFramesetFrame; +#define NS_IFRAMESETFRAME_IID \ +{ 0xf47deac0, 0x4200, 0x11d2, \ + { 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } } + #define NO_COLOR 0xFFFFFFFA struct nsBorderColor @@ -104,13 +108,14 @@ struct nsFramesetDrag { class nsHTMLFramesetFrame : public nsHTMLContainerFrame { public: - NS_DECLARE_FRAME_ACCESSOR(nsHTMLFramesetFrame) + // Woohoo, concrete class with an IID! + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMESETFRAME_IID) nsHTMLFramesetFrame(nsStyleContext* aContext); virtual ~nsHTMLFramesetFrame(); - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Init(nsIContent* aContent, nsIFrame* aParent, @@ -267,4 +272,6 @@ protected: PRBool mForceFrameResizability; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLFramesetFrame, NS_IFRAMESETFRAME_IID) + #endif diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b7a834d94d2..5bbb766efc5 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -878,6 +878,18 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, return rv; } +NS_IMETHODIMP_(nsrefcnt) +nsHTMLScrollFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsHTMLScrollFrame::Release(void) +{ + return NS_OK; +} + #ifdef NS_DEBUG NS_IMETHODIMP nsHTMLScrollFrame::GetFrameName(nsAString& aResult) const @@ -911,15 +923,15 @@ nsHTMLScrollFrame::CurPosAttributeChanged(nsIContent* aChild, mInner.CurPosAttributeChanged(aChild); } -NS_QUERYFRAME_HEAD(nsHTMLScrollFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsIScrollableFrame) - NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider) - NS_QUERYFRAME_ENTRY(nsIStatefulFrame) -#ifdef DEBUG - NS_QUERYFRAME_ENTRY(nsIFrameDebug) +NS_INTERFACE_MAP_BEGIN(nsHTMLScrollFrame) + NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator) +#ifdef NS_DEBUG + NS_INTERFACE_MAP_ENTRY(nsIFrameDebug) #endif -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollableFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollableViewProvider) + NS_INTERFACE_MAP_ENTRY(nsIStatefulFrame) +NS_INTERFACE_MAP_END_INHERITING(nsHTMLContainerFrame) //----------nsXULScrollFrame------------------------------------------- @@ -1230,6 +1242,18 @@ nsXULScrollFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) } #endif +NS_IMETHODIMP_(nsrefcnt) +nsXULScrollFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsXULScrollFrame::Release(void) +{ + return NS_OK; +} + #ifdef NS_DEBUG NS_IMETHODIMP nsXULScrollFrame::GetFrameName(nsAString& aResult) const @@ -1254,16 +1278,18 @@ nsXULScrollFrame::DoLayout(nsBoxLayoutState& aState) return rv; } -NS_QUERYFRAME_HEAD(nsXULScrollFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) - NS_QUERYFRAME_ENTRY(nsIScrollableFrame) - NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider) - NS_QUERYFRAME_ENTRY(nsIStatefulFrame) -#ifdef DEBUG - NS_QUERYFRAME_ENTRY(nsIFrameDebug) +NS_INTERFACE_MAP_BEGIN(nsXULScrollFrame) + NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator) +#ifdef NS_DEBUG + NS_INTERFACE_MAP_ENTRY(nsIFrameDebug) #endif -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) - + NS_INTERFACE_MAP_ENTRY(nsIScrollableFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollableViewProvider) + NS_INTERFACE_MAP_ENTRY(nsIStatefulFrame) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) + + + //-------------------- Inner ---------------------- nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsContainerFrame* aOuter, @@ -1302,6 +1328,16 @@ nsGfxScrollFrameInner::~nsGfxScrollFrameInner() { } +NS_IMETHODIMP_(nsrefcnt) nsGfxScrollFrameInner::AddRef(void) +{ + return 2; +} + +NS_IMETHODIMP_(nsrefcnt) nsGfxScrollFrameInner::Release(void) +{ + return 1; +} + NS_IMPL_QUERY_INTERFACE1(nsGfxScrollFrameInner, nsIScrollPositionListener) nsresult @@ -1376,15 +1412,16 @@ nsGfxScrollFrameInner::NeedsClipWidget() const return PR_FALSE; /* If we're a form element, we don't need a widget. */ - nsIFormControlFrame* fcFrame = do_QueryFrame(parentFrame); - if (fcFrame) { + nsIFormControlFrame* fcFrame; + if ((NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&fcFrame)))) { return PR_FALSE; } } // Scrollports that don't ever show associated scrollbars don't get // widgets, because they will seldom actually be scrolled. - nsIScrollableFrame *scrollableFrame = do_QueryFrame(mOuter); + nsIScrollableFrame *scrollableFrame; + CallQueryInterface(mOuter, &scrollableFrame); ScrollbarStyles scrollbars = scrollableFrame->GetScrollbarStyles(); if ((scrollbars.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN || scrollbars.mHorizontal == NS_STYLE_OVERFLOW_VISIBLE) @@ -1650,7 +1687,8 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray& aElements) } } - nsIScrollableFrame *scrollable = do_QueryFrame(mOuter); + nsIScrollableFrame *scrollable; + CallQueryInterface(mOuter, &scrollable); // At this stage in frame construction, the document element and/or // BODY overflow styles have not yet been propagated to the @@ -1675,7 +1713,8 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray& aElements) } // The anonymous
used by never gets scrollbars. - nsITextControlFrame* textFrame = do_QueryFrame(parent); + nsITextControlFrame* textFrame = nsnull; + CallQueryInterface(parent, &textFrame); if (textFrame) { // Make sure we are not a text area. nsCOMPtr textAreaElement(do_QueryInterface(parent->GetContent())); @@ -2675,13 +2714,14 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl if (!aScrollbar) return; - nsIScrollbarFrame* scrollbar = do_QueryFrame(aScrollbar); + nsIScrollbarFrame* scrollbar; + CallQueryInterface(aScrollbar, &scrollbar); if (scrollbar) { // See if we have a mediator. nsIScrollbarMediator* mediator = scrollbar->GetScrollbarMediator(); if (mediator) { // Inform the mediator of the visibility change. - mediator->VisibilityChanged(aVisible); + mediator->VisibilityChanged(scrollbar, aVisible); } } } @@ -2779,7 +2819,8 @@ nsGfxScrollFrameInner::SaveState(nsIStatefulFrame::SpecialStateID aStateID) return nsnull; } - nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame()); + nsIScrollbarMediator* mediator; + CallQueryInterface(GetScrolledFrame(), &mediator); if (mediator) { // child handles its own scroll state, so don't bother saving state here return nsnull; diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index fed84dd7d9a..6bfcb180982 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -66,8 +66,8 @@ class nsGfxScrollFrameInner : public nsIScrollPositionListener, public nsIReflowCallback { public: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; } - NS_IMETHOD_(nsrefcnt) Release(void) { return 1; } + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); nsGfxScrollFrameInner(nsContainerFrame* aOuter, PRBool aIsRoot, PRBool aIsXUL); @@ -248,7 +248,7 @@ class nsHTMLScrollFrame : public nsHTMLContainerFrame, public: friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS // Called to set the child frames. We typically have three: the scroll area, // the vertical scrollbar, and the horizontal scrollbar. @@ -433,8 +433,6 @@ class nsXULScrollFrame : public nsBoxFrame, public nsIAnonymousContentCreator, public nsIStatefulFrame { public: - NS_DECL_QUERYFRAME - friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot); // Called to set the child frames. We typically have three: the scroll area, @@ -495,6 +493,9 @@ public: // nsIAnonymousContentCreator virtual nsresult CreateAnonymousContent(nsTArray& aElements); + // nsIBox methods + NS_DECL_ISUPPORTS + virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index aed861f0508..40cf6d15e5f 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -87,9 +87,7 @@ public: : nsHTMLContainerFrame(aContext), mDoPaintFocus(PR_FALSE), mAbsoluteContainer(nsGkAtoms::absoluteList) {} - NS_DECL_QUERYFRAME - - // nsISupports (nsIScrollPositionListener) + // nsISupports NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Init(nsIContent* aContent, @@ -190,11 +188,24 @@ NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) return new (aPresShell)CanvasFrame(aContext); } -NS_IMPL_QUERY_INTERFACE1(CanvasFrame, nsIScrollPositionListener) +//-------------------------------------------------------------- +// Frames are not refcounted, no need to AddRef +NS_IMETHODIMP +CanvasFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); -NS_QUERYFRAME_HEAD(CanvasFrame) - NS_QUERYFRAME_ENTRY(nsICanvasFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) + if (aIID.Equals(NS_GET_IID(nsIScrollPositionListener))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsICanvasFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} NS_IMETHODIMP CanvasFrame::Init(nsIContent* aContent, @@ -396,7 +407,8 @@ nsRect CanvasFrame::CanvasArea() const { nsRect result(GetOverflowRect()); - nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent()); + nsIScrollableFrame *scrollableFrame; + CallQueryInterface(GetParent(), &scrollableFrame); if (scrollableFrame) { nsIScrollableView* scrollableView = scrollableFrame->GetScrollableView(); nsRect vcr = scrollableView->View()->GetBounds(); @@ -537,7 +549,9 @@ CanvasFrame::PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt) { nsRect focusRect(aPt, GetSize()); - nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent()); + nsIScrollableFrame *scrollableFrame; + CallQueryInterface(GetParent(), &scrollableFrame); + if (scrollableFrame) { nsIScrollableView* scrollableView = scrollableFrame->GetScrollableView(); nsRect vcr = scrollableView->View()->GetBounds(); diff --git a/layout/generic/nsIAnonymousContentCreator.h b/layout/generic/nsIAnonymousContentCreator.h index 9518062e019..9f69dd2ffc1 100644 --- a/layout/generic/nsIAnonymousContentCreator.h +++ b/layout/generic/nsIAnonymousContentCreator.h @@ -43,13 +43,19 @@ #ifndef nsIAnonymousContentCreator_h___ #define nsIAnonymousContentCreator_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsIContent.h" class nsPresContext; class nsIFrame; template class nsTArray; +// {7568a516-3831-4db4-88a7-a42578acc136} +#define NS_IANONYMOUS_CONTENT_CREATOR_IID \ +{ 0x7568a516, 0x3831, 0x4db4, \ + { 0x88, 0xa7, 0xa4, 0x25, 0x78, 0xac, 0xc1, 0x36 } } + + /** * Any source for anonymous content can implement this interface to provide it. * HTML frames like nsFileControlFrame currently use this as well as XUL frames @@ -57,10 +63,9 @@ template class nsTArray; * * @see nsCSSFrameConstructor */ -class nsIAnonymousContentCreator -{ +class nsIAnonymousContentCreator : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIAnonymousContentCreator) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANONYMOUS_CONTENT_CREATOR_IID) /** * Creates "native" anonymous content and adds the created content to @@ -88,5 +93,8 @@ public: virtual void PostCreateFrames() {} }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnonymousContentCreator, + NS_IANONYMOUS_CONTENT_CREATOR_IID) + #endif diff --git a/layout/generic/nsICanvasFrame.h b/layout/generic/nsICanvasFrame.h index 0a7693af0c4..0beb4142687 100644 --- a/layout/generic/nsICanvasFrame.h +++ b/layout/generic/nsICanvasFrame.h @@ -40,12 +40,16 @@ #ifndef nsICanvasFrame_h__ #define nsICanvasFrame_h__ -#include "nsQueryFrame.h" +#include "nsISupports.h" -class nsICanvasFrame +// IID for the nsICanvasFrame interface +#define NS_ICANVASFRAME_IID \ +{ 0x9df7db77, 0x49a2, 0x11d5, {0x97, 0x92, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56} } + +class nsICanvasFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsICanvasFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASFRAME_IID) /** SetHasFocus tells the CanvasFrame to draw with focus ring * @param aHasFocus PR_TRUE to show focus ring, PR_FALSE to hide it @@ -54,5 +58,7 @@ public: }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasFrame, NS_ICANVASFRAME_IID) + #endif // nsICanvasFrame_h__ diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index f1c02ff7994..d5539e44b1c 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -47,7 +47,7 @@ variables in this file. -dwh */ #include -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsEvent.h" #include "nsStyleStruct.h" #include "nsStyleContext.h" @@ -464,10 +464,10 @@ typedef PRBool nsDidReflowStatus; * If you're not in layout but you must call functions in here, at least * restrict yourself to calling virtual methods, which won't hurt you as badly. */ -class nsIFrame : public nsQueryFrame +class nsIFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAME_IID) nsPresContext* PresContext() const { return GetStyleContext()->GetRuleNode()->GetPresContext(); @@ -2348,6 +2348,9 @@ protected: nsresult PeekOffsetParagraph(nsPeekOffsetStruct *aPos); private: + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; + nsRect* GetOverflowAreaProperty(PRBool aCreateIfNecessary = PR_FALSE); }; @@ -2422,4 +2425,7 @@ private: nsIFrame* mFrame; }; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrame, NS_IFRAME_IID) + #endif /* nsIFrame_h___ */ diff --git a/layout/generic/nsIFrameDebug.h b/layout/generic/nsIFrameDebug.h index 7dc035a088d..e75d4685968 100644 --- a/layout/generic/nsIFrameDebug.h +++ b/layout/generic/nsIFrameDebug.h @@ -40,17 +40,23 @@ #ifndef nsIFrameDebug_h___ #define nsIFrameDebug_h___ +#include "nsISupports.h" #include "nsIFrame.h" class nsPresContext; struct PRLogModuleInfo; +// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32} +#define NS_IFRAMEDEBUG_IID \ +{ 0xa6cf9069, 0x15b3, 0x11d2, \ + {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + /** * Debug related functions */ -class nsIFrameDebug { +class nsIFrameDebug : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIFrameDebug) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMEDEBUG_IID) NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0; /** @@ -128,6 +134,12 @@ public: static PRBool GetShowEventTargetFrameBorder(); static void PrintDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList); + +private: + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrameDebug, NS_IFRAMEDEBUG_IID) + #endif /* nsIFrameDebug_h___ */ diff --git a/layout/generic/nsIFrameFrame.h b/layout/generic/nsIFrameFrame.h index 7bcf14f1c14..3f081cb81f5 100644 --- a/layout/generic/nsIFrameFrame.h +++ b/layout/generic/nsIFrameFrame.h @@ -45,10 +45,14 @@ class nsIDocShell; -class nsIFrameFrame +#define NS_IFRAMEFRAME_IID \ +{ 0x22e34108, 0xc24b, 0x40ea, { \ + 0xb9, 0x79, 0x50, 0x18, 0x38, 0x8d, 0xd5, 0x88 } } + +class nsIFrameFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIFrameFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMEFRAME_IID) NS_IMETHOD GetDocShell(nsIDocShell **aDocShell) = 0; @@ -61,4 +65,6 @@ public: virtual void EndSwapDocShells(nsIFrame* aOther) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrameFrame, NS_IFRAMEFRAME_IID) + #endif diff --git a/layout/generic/nsIImageFrame.h b/layout/generic/nsIImageFrame.h index d015ec6ed7a..8637bfc3121 100644 --- a/layout/generic/nsIImageFrame.h +++ b/layout/generic/nsIImageFrame.h @@ -43,19 +43,25 @@ #ifndef nsIImageFrame_h___ #define nsIImageFrame_h___ +#include "nsISupports.h" struct nsSize; class imgIRequest; class nsPresContext; class nsIImageMap; -class nsIImageFrame -{ +// {B261A0D5-E696-11d4-9885-00C04FA0CF4B} +#define NS_IIMAGEFRAME_IID \ +{ 0xb261a0d5, 0xe696, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } } + +class nsIImageFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIImageFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIMAGEFRAME_IID) NS_IMETHOD GetIntrinsicImageSize(nsSize& aSize) = 0; NS_IMETHOD GetImageMap(nsPresContext *aPresContext, nsIImageMap **aImageMap) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIImageFrame, NS_IIMAGEFRAME_IID) + #endif /* nsIImageFrame_h___ */ diff --git a/layout/generic/nsIObjectFrame.h b/layout/generic/nsIObjectFrame.h index 90d05a59a8e..c3d0a7df264 100644 --- a/layout/generic/nsIObjectFrame.h +++ b/layout/generic/nsIObjectFrame.h @@ -47,10 +47,13 @@ class nsIPluginInstance; -class nsIObjectFrame : public nsQueryFrame -{ +// {3e2df1fe-a898-4e2e-8763-4ca904fa338e} +#define NS_IOBJECTFRAME_IID \ +{ 0x3e2df1fe, 0xa898, 0x4e2e, { 0x87, 0x63, 0x4c, 0xa9, 0x4, 0xfa, 0x33, 0x8e } } + +class nsIObjectFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIObjectFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IOBJECTFRAME_IID) NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance) = 0; @@ -91,4 +94,6 @@ public: virtual void StopPlugin() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIObjectFrame, NS_IOBJECTFRAME_IID) + #endif /* nsIObjectFrame_h___ */ diff --git a/layout/generic/nsIPageSequenceFrame.h b/layout/generic/nsIPageSequenceFrame.h index 5a008ab2097..108975b8694 100644 --- a/layout/generic/nsIPageSequenceFrame.h +++ b/layout/generic/nsIPageSequenceFrame.h @@ -37,21 +37,27 @@ #ifndef nsIPageSequenceFrame_h___ #define nsIPageSequenceFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsRect.h" class nsPresContext; class nsIPrintSettings; +// IID for the nsIPageSequenceFrame interface +// a6cf90d2-15b3-11d2-932e-00805f8add32 +#define NS_IPAGESEQUENCEFRAME_IID \ + { 0xa6cf90d2, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + +//---------------------------------------------------------------------- + /** * Interface for accessing special capabilities of the page sequence frame. * * Today all that exists are member functions for printing. */ -class nsIPageSequenceFrame : public nsQueryFrame -{ +class nsIPageSequenceFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIPageSequenceFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPAGESEQUENCEFRAME_IID) /** * Print the set of pages. @@ -86,8 +92,14 @@ public: // For Shrink To Fit NS_IMETHOD GetSTFPercent(float& aSTFPercent) = 0; + +private: + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIPageSequenceFrame, NS_IPAGESEQUENCEFRAME_IID) + #endif /* nsIPageSequenceFrame_h___ */ diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index 21ec24816b2..83800841180 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -52,10 +52,15 @@ class nsBoxLayoutState; +// IID for the nsIScrollableFrame interface +#define NS_ISCROLLABLE_FRAME_IID \ +{ 0xf285c180, 0x8492, 0x48d5, \ +{ 0xb1, 0xb5, 0x03, 0x28, 0x21, 0xc9, 0x72, 0x02 } } + class nsIScrollableFrame : public nsIScrollableViewProvider { public: - NS_DECLARE_FRAME_ACCESSOR(nsIScrollableFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCROLLABLE_FRAME_IID) /** * Get the frame that we are scrolling within the scrollable frame. @@ -121,4 +126,6 @@ public: virtual void ScrollToRestoredPosition() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollableFrame, NS_ISCROLLABLE_FRAME_IID) + #endif diff --git a/layout/generic/nsIScrollableViewProvider.h b/layout/generic/nsIScrollableViewProvider.h index eb229d01fef..d9d9d26da91 100644 --- a/layout/generic/nsIScrollableViewProvider.h +++ b/layout/generic/nsIScrollableViewProvider.h @@ -39,16 +39,22 @@ #ifndef _nsIScrollableViewProvider_h #define _nsIScrollableViewProvider_h -#include "nsQueryFrame.h" +#include "nsISupports.h" + +#define NS_ISCROLLABLEVIEWPROVIDER_IID \ +{0xdafcbf5f, 0x701f, 0x4697, \ +{0xa5, 0x13, 0x81, 0xd8, 0x0e, 0x01, 0x41, 0x2c}} class nsIScrollableView; -class nsIScrollableViewProvider : public nsQueryFrame -{ +class nsIScrollableViewProvider : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIScrollableViewProvider) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCROLLABLEVIEWPROVIDER_IID) virtual nsIScrollableView* GetScrollableView() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollableViewProvider, + NS_ISCROLLABLEVIEWPROVIDER_IID) + #endif /* _nsIScrollableViewProvider_h */ diff --git a/layout/generic/nsIStatefulFrame.h b/layout/generic/nsIStatefulFrame.h index ba2d870e833..f8475beefb0 100644 --- a/layout/generic/nsIStatefulFrame.h +++ b/layout/generic/nsIStatefulFrame.h @@ -6,15 +6,18 @@ #ifndef _nsIStatefulFrame_h #define _nsIStatefulFrame_h -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsPresContext; class nsPresState; -class nsIStatefulFrame -{ +#define NS_ISTATEFULFRAME_IID \ +{ 0x25c232cf, 0x40ba, 0x4394, \ + { 0x84, 0xe4, 0x73, 0xa2, 0xf7, 0x4d, 0x8b, 0x64 } } + +class nsIStatefulFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIStatefulFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID) // If you create a special type stateful frame (e.g. scroll) that needs // to be captured outside of the standard pass through the frames, you'll need @@ -31,4 +34,6 @@ class nsIStatefulFrame NS_IMETHOD RestoreState(nsPresState* aState) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIStatefulFrame, NS_ISTATEFULFRAME_IID) + #endif /* _nsIStatefulFrame_h */ diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index c0cdfdae3d5..2d0e1537a6b 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -186,9 +186,18 @@ nsImageFrame::~nsImageFrame() { } -NS_QUERYFRAME_HEAD(nsImageFrame) - NS_QUERYFRAME_ENTRY(nsIImageFrame) -NS_QUERYFRAME_TAIL_INHERITING(ImageFrameSuper) +NS_IMETHODIMP +nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIImageFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return ImageFrameSuper::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsImageFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index aeb74a1448e..fd17a3eb22d 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -96,7 +96,8 @@ class nsImageFrame : public ImageFrameSuper, public nsIImageFrame { public: nsImageFrame(nsStyleContext* aContext); - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); virtual void Destroy(); NS_IMETHOD Init(nsIContent* aContent, diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index 1173df2205c..77d1c941cae 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -62,6 +62,9 @@ #endif +NS_DEFINE_IID(kInlineFrameCID, NS_INLINE_FRAME_CID); + + ////////////////////////////////////////////////////////////////////// // Basic nsInlineFrame methods @@ -72,9 +75,18 @@ NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) return new (aPresShell) nsInlineFrame(aContext); } -NS_QUERYFRAME_HEAD(nsInlineFrame) - NS_QUERYFRAME_ENTRY(nsInlineFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsInlineFrameSuper) +NS_IMETHODIMP +nsInlineFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(kInlineFrameCID)) { + *aInstancePtr = this; + return NS_OK; + } + + return nsInlineFrameSuper::QueryInterface(aIID, aInstancePtr); +} #ifdef DEBUG NS_IMETHODIMP diff --git a/layout/generic/nsInlineFrame.h b/layout/generic/nsInlineFrame.h index 1a613cf4a10..aa7836ecf91 100644 --- a/layout/generic/nsInlineFrame.h +++ b/layout/generic/nsInlineFrame.h @@ -46,6 +46,9 @@ class nsAnonymousBlockFrame; +#define NS_INLINE_FRAME_CID \ + { 0x88b298af, 0x8b0e, 0x4592,{0x9e, 0xc6, 0xea, 0x4c, 0x4b, 0x3f, 0xf7, 0xa4}} + #define nsInlineFrameSuper nsHTMLContainerFrame // NS_INLINE_FRAME_HARD_TEXT_OFFSETS is used for access keys, where what @@ -76,11 +79,11 @@ class nsAnonymousBlockFrame; class nsInlineFrame : public nsInlineFrameSuper { public: - NS_DECLARE_FRAME_ACCESSOR(nsInlineFrame) - NS_DECL_QUERYFRAME - friend nsIFrame* NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); + // nsISupports overrides + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); + // nsIFrame overrides NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index f9f39611027..629b4a3c2c4 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -145,8 +145,9 @@ ListFloats(FILE* out, PRInt32 aIndent, const nsFloatCacheList& aFloats) fprintf(out, "placeholder@%p ", static_cast(ph)); nsIFrame* frame = ph->GetOutOfFlowFrame(); if (frame) { - nsIFrameDebug* frameDebug = do_QueryFrame(frame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(frameName); fputs(NS_LossyConvertUTF16toASCII(frameName).get(), out); } @@ -224,8 +225,9 @@ nsLineBox::List(FILE* out, PRInt32 aIndent) const nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { - nsIFrameDebug* frameDebug = do_QueryFrame(frame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(out, aIndent + 1); } frame = frame->GetNextSibling(); diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 427d2d70c88..03770b64fff 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -581,9 +581,30 @@ nsObjectFrame::~nsObjectFrame() ("nsObjectFrame %p deleted\n", this)); } -NS_QUERYFRAME_HEAD(nsObjectFrame) - NS_QUERYFRAME_ENTRY(nsIObjectFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsObjectFrameSuper) +NS_IMETHODIMP +nsObjectFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIObjectFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsObjectFrameSuper::QueryInterface(aIID, aInstancePtr); +} + +NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::AddRef(void) +{ + NS_WARNING("not supported for frames"); + return 1; +} + +NS_IMETHODIMP_(nsrefcnt) nsObjectFrame::Release(void) +{ + NS_WARNING("not supported for frames"); + return 1; +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsObjectFrame::GetAccessible(nsIAccessible** aAccessible) @@ -1172,7 +1193,8 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext, nsPresContext* presContext = PresContext(); // make sure this is REALLY an nsIObjectFrame // we may need to go through the children to get it - nsIObjectFrame* objectFrame = do_QueryFrame(frame); + nsIObjectFrame* objectFrame = nsnull; + CallQueryInterface(frame,&objectFrame); if (!objectFrame) objectFrame = GetNextObjectFrame(presContext,frame); if (!objectFrame) @@ -2135,7 +2157,8 @@ nsObjectFrame::GetNextObjectFrame(nsPresContext* aPresContext, nsIFrame* aRoot) nsIFrame* child = aRoot->GetFirstChild(nsnull); while (child) { - nsIObjectFrame* outFrame = do_QueryFrame(child); + nsIObjectFrame* outFrame = nsnull; + CallQueryInterface(child, &outFrame); if (outFrame) { nsCOMPtr pi; outFrame->GetPluginInstance(*getter_AddRefs(pi)); // make sure we have a REAL plugin diff --git a/layout/generic/nsObjectFrame.h b/layout/generic/nsObjectFrame.h index e57723f745d..a4c1fc4fda4 100644 --- a/layout/generic/nsObjectFrame.h +++ b/layout/generic/nsObjectFrame.h @@ -62,7 +62,8 @@ class nsObjectFrame : public nsObjectFrameSuper, public nsIObjectFrame { public: friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Init(nsIContent* aContent, nsIFrame* aParent, @@ -139,6 +140,10 @@ public: nsIFrame* aRoot); protected: + // nsISupports + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); + nsObjectFrame(nsStyleContext* aContext); virtual ~nsObjectFrame(); diff --git a/layout/generic/nsQueryFrame.h b/layout/generic/nsQueryFrame.h deleted file mode 100644 index b8e748f7d5a..00000000000 --- a/layout/generic/nsQueryFrame.h +++ /dev/null @@ -1,267 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Mozilla layout engine. - * - * The Initial Developer of the Original Code is - * the Mozilla Foundation . - * - * Portions created by the Initial Developer are Copyright (C) 2008 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsQueryFrame_h -#define nsQueryFrame_h - -#include "nscore.h" - -#define NS_DECLARE_FRAME_ACCESSOR(classname) \ - static const nsQueryFrame::FrameIID kFrameIID = nsQueryFrame::classname##_id; - -#define NS_DECL_QUERYFRAME \ - virtual void* QueryFrame(FrameIID id); - -#define NS_QUERYFRAME_HEAD(class) \ - void* class::QueryFrame(FrameIID id) { - -#define NS_QUERYFRAME_ENTRY(class) \ - if (class::kFrameIID == id) \ - return static_cast(this); - -#define NS_QUERYFRAME_TAIL_INHERITING(class) \ - return class::QueryFrame(id); } - -#define NS_QUERYFRAME_TAIL return nsnull; } - -class nsQueryFrame -{ -public: - enum FrameIID { - BRFrame_id, - CanvasFrame_id, - nsAreaFrame_id, - nsAutoRepeatBoxFrame_id, - nsBCTableCellFrame_id, - nsBlockFrame_id, - nsBox_id, - nsBoxFrame_id, - nsBulletFrame_id, - nsButtonBoxFrame_id, - nsColumnSetFrame_id, - nsComboboxControlFrame_id, - nsComboboxDisplayFrame_id, - nsContainerFrame_id, - nsContinuingTextFrame_id, - nsDeckFrame_id, - nsDirectionalFrame_id, - nsDocElementBoxFrame_id, - nsFieldSetFrame_id, - nsFileControlFrame_id, - nsFirstLetterFrame_id, - nsFirstLineFrame_id, - nsFormControlFrame_id, - nsFrame_id, - nsGfxButtonControlFrame_id, - nsGfxCheckboxControlFrame_id, - nsGfxRadioControlFrame_id, - nsGridRowGroupFrame_id, - nsGridRowLeafFrame_id, - nsGroupBoxFrame_id, - nsHTMLButtonControlFrame_id, - nsHTMLCanvasFrame_id, - nsHTMLContainerFrame_id, - nsHTMLFramesetBlankFrame_id, - nsHTMLFramesetBorderFrame_id, - nsHTMLFramesetFrame_id, - nsHTMLScrollFrame_id, - nsIAnonymousContentCreator_id, - nsICSSPseudoComparator_id, - nsICanvasFrame_id, - nsICheckboxControlFrame_id, - nsIComboboxControlFrame_id, - nsIFormControlFrame_id, - nsIFrame_id, - nsIFrameDebug_id, - nsIFrameFrame_id, - nsIImageFrame_id, - nsIListControlFrame_id, - nsIMathMLFrame_id, - nsIMenuFrame_id, - nsIObjectFrame_id, - nsIPageSequenceFrame_id, - nsIPercentHeightObserver_id, - nsIRadioControlFrame_id, - nsIRootBox_id, - nsISVGChildFrame_id, - nsISVGGlyphFragmentLeaf_id, - nsISVGGlyphFragmentNode_id, - nsISVGSVGFrame_id, - nsISVGTextContentMetrics_id, - nsISVGValue_id, - nsIScrollableFrame_id, - nsIScrollableViewProvider_id, - nsIScrollbarFrame_id, - nsIScrollbarMediator_id, - nsIScrollPositionListener_id, - nsISelectControlFrame_id, - nsIStatefulFrame_id, - nsITableCellLayout_id, - nsITableLayout_id, - nsITreeBoxObject_id, - nsImageBoxFrame_id, - nsImageControlFrame_id, - nsImageFrame_id, - nsInlineFrame_id, - nsIsIndexFrame_id, - nsLeafBoxFrame_id, - nsLeafFrame_id, - nsLegendFrame_id, - nsListBoxBodyFrame_id, - nsListControlFrame_id, - nsListItemFrame_id, - nsMathMLContainerFrame_id, - nsMathMLForeignFrameWrapper_id, - nsMathMLFrame_id, - nsMathMLmactionFrame_id, - nsMathMLmathBlockFrame_id, - nsMathMLmathInlineFrame_id, - nsMathMLmfencedFrame_id, - nsMathMLmfracFrame_id, - nsMathMLmmultiscriptsFrame_id, - nsMathMLmoFrame_id, - nsMathMLmoverFrame_id, - nsMathMLmpaddedFrame_id, - nsMathMLmphantomFrame_id, - nsMathMLmrootFrame_id, - nsMathMLmrowFrame_id, - nsMathMLmspaceFrame_id, - nsMathMLmsqrtFrame_id, - nsMathMLmstyleFrame_id, - nsMathMLmsubFrame_id, - nsMathMLmsubsupFrame_id, - nsMathMLmsupFrame_id, - nsMathMLmtableFrame_id, - nsMathMLmtableOuterFrame_id, - nsMathMLmtdFrame_id, - nsMathMLmtdInnerFrame_id, - nsMathMLmtrFrame_id, - nsMathMLmunderFrame_id, - nsMathMLmunderoverFrame_id, - nsMathMLTokenFrame_id, - nsMenuBarFrame_id, - nsMenuFrame_id, - nsMenuPopupFrame_id, - nsObjectFrame_id, - nsPageBreakFrame_id, - nsPageContentFrame_id, - nsPageFrame_id, - nsPlaceholderFrame_id, - nsPopupSetFrame_id, - nsPositionedInlineFrame_id, - nsProgressMeterFrame_id, - nsResizerFrame_id, - nsRootBoxFrame_id, - nsScrollbarButtonFrame_id, - nsScrollbarFrame_id, - nsSelectsAreaFrame_id, - nsSimplePageSequenceFrame_id, - nsSliderFrame_id, - nsSplittableFrame_id, - nsSplitterFrame_id, - nsStackFrame_id, - nsSubDocumentFrame_id, - nsSVGAFrame_id, - nsSVGClipPathFrame_id, - nsSVGContainerFrame_id, - nsSVGDisplayContainerFrame_id, - nsSVGFilterFrame_id, - nsSVGForeignObjectFrame_id, - nsSVGGenericContainerFrame_id, - nsSVGGeometryFrame_id, - nsSVGGFrame_id, - nsSVGGlyphFrame_id, - nsSVGGradientFrame_id, - nsSVGImageFrame_id, - nsSVGInnerSVGFrame_id, - nsSVGLeafFrame_id, - nsSVGLinearGradientFrame_id, - nsSVGMarkerFrame_id, - nsSVGMaskFrame_id, - nsSVGOuterSVGFrame_id, - nsSVGPaintServerFrame_id, - nsSVGPathGeometryFrame_id, - nsSVGPatternFrame_id, - nsSVGRadialGradientFrame_id, - nsSVGStopFrame_id, - nsSVGSwitchFrame_id, - nsSVGTextContainerFrame_id, - nsSVGTextFrame_id, - nsSVGTextPathFrame_id, - nsSVGTSpanFrame_id, - nsSVGUseFrame_id, - nsTableCaptionFrame_id, - nsTableCellFrame_id, - nsTableColFrame_id, - nsTableColGroupFrame_id, - nsTableFrame_id, - nsTableOuterFrame_id, - nsTableRowFrame_id, - nsTableRowGroupFrame_id, - nsTextBoxFrame_id, - nsTextControlFrame_id, - nsTextFrame_id, - nsTitleBarFrame_id, - nsTreeBodyFrame_id, - nsTreeColFrame_id, - nsVideoFrame_id, - nsXULScrollFrame_id, - SpacerFrame_id, - ViewportFrame_id - }; - - virtual void* QueryFrame(FrameIID id) = 0; -}; - -class do_QueryFrame -{ -public: - do_QueryFrame(nsQueryFrame *s) : mRawPtr(s) { } - - template - operator Dest*() { - if (!mRawPtr) - return nsnull; - - return reinterpret_cast(mRawPtr->QueryFrame(Dest::kFrameIID)); - } - -private: - nsQueryFrame *mRawPtr; -}; - -#endif // nsQueryFrame_h diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 7a2578ceb13..9a5e8e323b8 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -2433,7 +2433,9 @@ nsFrameSelection::GetCellLayout(nsIContent *aCellContent) const if (!cellFrame) return nsnull; - nsITableCellLayout *cellLayoutObject = do_QueryFrame(cellFrame); + nsITableCellLayout *cellLayoutObject = nsnull; + CallQueryInterface(cellFrame, &cellLayoutObject); + return cellLayoutObject; } @@ -2446,7 +2448,9 @@ nsFrameSelection::GetTableLayout(nsIContent *aTableContent) const if (!tableFrame) return nsnull; - nsITableLayout *tableLayoutObject = do_QueryFrame(tableFrame); + nsITableLayout *tableLayoutObject = nsnull; + CallQueryInterface(tableFrame, &tableLayoutObject); + return tableLayoutObject; } @@ -4592,7 +4596,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, frame->SetSelected(aPresContext, nsnull, aFlags, eSpreadDown, mType); if (mFrameSelection->GetTableCellSelection()) { - nsITableCellLayout *tcl = do_QueryFrame(frame); + nsITableCellLayout *tcl = nsnull; + CallQueryInterface(frame, &tcl); if (tcl) { return NS_OK; diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index 64740430fa3..e8952d2cfc5 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -137,9 +137,17 @@ nsSimplePageSequenceFrame::~nsSimplePageSequenceFrame() if (mPageData) delete mPageData; } -NS_QUERYFRAME_HEAD(nsSimplePageSequenceFrame) - NS_QUERYFRAME_ENTRY(nsIPageSequenceFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) +NS_IMETHODIMP +nsSimplePageSequenceFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsIPageSequenceFrame))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + return nsContainerFrame::QueryInterface(aIID, aInstancePtr); +} //---------------------------------------------------------------------- diff --git a/layout/generic/nsSimplePageSequence.h b/layout/generic/nsSimplePageSequence.h index 629831c80ba..a3937b482e7 100644 --- a/layout/generic/nsSimplePageSequence.h +++ b/layout/generic/nsSimplePageSequence.h @@ -84,7 +84,8 @@ class nsSimplePageSequenceFrame : public nsContainerFrame, public: friend nsIFrame* NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + // nsISupports + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame NS_IMETHOD Reflow(nsPresContext* aPresContext, @@ -148,6 +149,9 @@ protected: void SetDateTimeStr(PRUnichar * aDateTimeStr); void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly); + NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();} + NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();} + nsMargin mMargin; PRBool mIsPrintingSelection; diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index 48194394e51..106d3e3da75 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -71,12 +71,24 @@ nsVideoFrame::~nsVideoFrame() { } -NS_QUERYFRAME_HEAD(nsVideoFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -#ifdef DEBUG - NS_QUERYFRAME_ENTRY(nsIFrameDebug) +NS_INTERFACE_MAP_BEGIN(nsVideoFrame) + NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator) +#ifdef NS_DEBUG + NS_INTERFACE_MAP_ENTRY(nsIFrameDebug) #endif -NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) +NS_INTERFACE_MAP_END_INHERITING(nsContainerFrame) + +NS_IMETHODIMP_(nsrefcnt) +nsVideoFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsVideoFrame::Release(void) +{ + return NS_OK; +} nsresult nsVideoFrame::CreateAnonymousContent(nsTArray& aElements) diff --git a/layout/generic/nsVideoFrame.h b/layout/generic/nsVideoFrame.h index aecc737b7ac..53a29b7b080 100644 --- a/layout/generic/nsVideoFrame.h +++ b/layout/generic/nsVideoFrame.h @@ -57,7 +57,7 @@ class nsVideoFrame : public nsContainerFrame, public nsIAnonymousContentCreator public: nsVideoFrame(nsStyleContext* aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/layout/generic/nsViewportFrame.cpp b/layout/generic/nsViewportFrame.cpp index a53409f8b66..c25b603f913 100644 --- a/layout/generic/nsViewportFrame.cpp +++ b/layout/generic/nsViewportFrame.cpp @@ -224,7 +224,7 @@ ViewportFrame::AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) c // Get our prinicpal child frame and see if we're scrollable nsIFrame* kidFrame = mFrames.FirstChild(); - nsIScrollableFrame *scrollingFrame = do_QueryFrame(kidFrame); + nsCOMPtr scrollingFrame(do_QueryInterface(kidFrame)); if (scrollingFrame) { nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes(); diff --git a/layout/mathml/base/src/nsIMathMLFrame.h b/layout/mathml/base/src/nsIMathMLFrame.h index 642ad5ffd0c..042616d7f9c 100644 --- a/layout/mathml/base/src/nsIMathMLFrame.h +++ b/layout/mathml/base/src/nsIMathMLFrame.h @@ -46,6 +46,13 @@ struct nsPresentationData; struct nsEmbellishData; struct nsHTMLReflowMetrics; +// a781ed45-4338-43cb-9739-a7a8f8418ff3 +#define NS_IMATHMLFRAME_IID \ +{ 0xa781ed45, 0x4338, 0x43cb, \ + { 0x97, 0x39, 0xa7, 0xa8, 0xf8, 0x41, 0x8f, 0xf3 } } + +static NS_DEFINE_IID(kIMathMLFrameIID, NS_IMATHMLFRAME_IID); + // For MathML, this 'type' will be used to determine the spacing between frames // Subclasses can return a 'type' that will give them a particular spacing enum eMathMLFrameType { @@ -61,10 +68,9 @@ enum eMathMLFrameType { }; // Abstract base class that provides additional methods for MathML frames -class nsIMathMLFrame -{ +class nsIMathMLFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsIMathMLFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMATHMLFRAME_IID) /* SUPPORT FOR PRECISE POSITIONING */ /*====================================================================*/ @@ -303,6 +309,9 @@ struct nsPresentationData { } }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIMathMLFrame, NS_IMATHMLFRAME_IID) + + // ========================================================================== // Bits used for the presentation flags -- these bits are set // in their relevant situation as they become available diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 6309050d6c2..ac7ecd299ec 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -65,13 +65,18 @@ #include "nsCSSFrameConstructor.h" #include "nsIReflowCallback.h" +NS_DEFINE_CID(kInlineFrameCID, NS_INLINE_FRAME_CID); + // // nsMathMLContainerFrame implementation // -NS_QUERYFRAME_HEAD(nsMathMLContainerFrame) - NS_QUERYFRAME_ENTRY(nsMathMLFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +// nsISupports +// ============================================================================= + +NS_IMPL_ADDREF_INHERITED(nsMathMLContainerFrame, nsMathMLFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLContainerFrame, nsMathMLFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLContainerFrame, nsHTMLContainerFrame, nsMathMLFrame) // ============================================================================= @@ -210,7 +215,8 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra if (aMathMLFrameType) { if (!IsForeignChild(aFrame)) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame); + nsIMathMLFrame* mathMLFrame; + CallQueryInterface(aFrame, &mathMLFrame); if (mathMLFrame) { *aMathMLFrameType = mathMLFrame->GetMathMLFrameType(); return; @@ -261,7 +267,8 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIRenderingContext& aRenderingC nsIFrame* childFrame = GetFirstChild(nsnull); while (childFrame) { // initializations in case this child happens not to be a MathML frame - nsIMathMLFrame* mathMLFrame = do_QueryFrame(childFrame); + nsIMathMLFrame* mathMLFrame; + childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { nsEmbellishData embellishData; nsPresentationData presentationData; @@ -273,7 +280,8 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIRenderingContext& aRenderingC // embellishements are not included, only consider the inner first child itself // XXXkt Does that mean the core descendent frame should be used // instead of the base child? - nsIMathMLFrame* mathMLchildFrame = do_QueryFrame(presentationData.baseFrame); + nsIMathMLFrame* mathMLchildFrame; + presentationData.baseFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLchildFrame); if (mathMLchildFrame) { mathMLFrame = mathMLchildFrame; } @@ -351,7 +359,8 @@ nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext, nsIFrame* baseFrame = mPresentationData.baseFrame; if (baseFrame) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(baseFrame); + nsIMathMLFrame* mathMLFrame; + baseFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); NS_ASSERTION(mathMLFrame, "Something is wrong somewhere"); if (mathMLFrame) { PRBool stretchAll = @@ -410,7 +419,7 @@ nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext, nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { if (childFrame != mPresentationData.baseFrame) { - mathMLFrame = do_QueryFrame(childFrame); + childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { // retrieve the metrics that was stored at the previous pass GetReflowAndBoundingMetricsFor(childFrame, @@ -525,7 +534,8 @@ nsMathMLContainerFrame::FinalizeReflow(nsIRenderingContext& aRenderingContext, // This means the rect.x and rect.y of our children were not set!! // Don't go without checking to see if our parent will later fire a Stretch() command // targeted at us. The Stretch() will cause the rect.x and rect.y to clear... - nsIMathMLFrame* mathMLFrame = do_QueryFrame(mParent); + nsIMathMLFrame* mathMLFrame; + mParent->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { nsEmbellishData embellishData; nsPresentationData presentationData; @@ -607,7 +617,8 @@ nsMathMLContainerFrame::PropagatePresentationDataFor(nsIFrame* aFrame, { if (!aFrame || !aFlagsToUpdate) return; - nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame); + nsIMathMLFrame* mathMLFrame; + aFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { // update mathMLFrame->UpdatePresentationData(aFlagsValues, @@ -700,14 +711,16 @@ nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsIFrame* aParentFrame) // down the subtrees nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame) { - nsIMathMLFrame* childMathMLFrame = do_QueryFrame(childFrame); + nsIMathMLFrame* childMathMLFrame; + childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&childMathMLFrame); if (childMathMLFrame) { childMathMLFrame->InheritAutomaticData(aParentFrame); } RebuildAutomaticDataForChildren(childFrame); childFrame = childFrame->GetNextSibling(); } - nsIMathMLFrame* mathMLFrame = do_QueryFrame(aParentFrame); + nsIMathMLFrame* mathMLFrame; + aParentFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { mathMLFrame->TransmitAutomaticData(); } @@ -728,7 +741,8 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIFrame* aParentFrame, break; // stop if it is a MathML frame - nsIMathMLFrame* mathMLFrame = do_QueryFrame(frame); + nsIMathMLFrame* mathMLFrame; + frame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) break; @@ -896,7 +910,8 @@ nsMathMLContainerFrame::ReflowChild(nsIFrame* aChildFrame, // frames may be reflowed generically, but nsInlineFrames need extra care. #ifdef DEBUG - nsInlineFrame* inlineFrame = do_QueryFrame(aChildFrame); + nsInlineFrame* inlineFrame; + aChildFrame->QueryInterface(kInlineFrameCID, (void**)&inlineFrame); NS_ASSERTION(!inlineFrame, "Inline frames should be wrapped in blocks"); #endif @@ -992,7 +1007,8 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext, // fire the stretch on each child childFrame = mFrames.FirstChild(); while (childFrame) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(childFrame); + nsIMathMLFrame* mathMLFrame; + childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { // retrieve the metrics that was stored at the previous pass nsHTMLReflowMetrics childDesiredSize; diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.h b/layout/mathml/base/src/nsMathMLContainerFrame.h index 34437b32a47..bcc46108a71 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -71,7 +71,7 @@ class nsMathMLContainerFrame : public nsHTMLContainerFrame, public: nsMathMLContainerFrame(nsStyleContext* aContext) : nsHTMLContainerFrame(aContext) {} - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED // -------------------------------------------------------------------------- // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h diff --git a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp index 171fb5fac53..8a2230b83f2 100644 --- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp +++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp @@ -54,9 +54,9 @@ #include "nsMathMLForeignFrameWrapper.h" -NS_QUERYFRAME_HEAD(nsMathMLForeignFrameWrapper) - NS_QUERYFRAME_ENTRY(nsMathMLFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) +NS_IMPL_ADDREF_INHERITED(nsMathMLForeignFrameWrapper, nsMathMLFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLForeignFrameWrapper, nsMathMLFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLForeignFrameWrapper, nsBlockFrame, nsMathMLFrame) nsIFrame* NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell, nsStyleContext* aContext) diff --git a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h index 743d6328822..9bd21b34c76 100644 --- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h +++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h @@ -52,7 +52,7 @@ class nsMathMLForeignFrameWrapper : public nsBlockFrame, public: friend nsIFrame* NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED // Overloaded nsIMathMLFrame methods diff --git a/layout/mathml/base/src/nsMathMLFrame.cpp b/layout/mathml/base/src/nsMathMLFrame.cpp index 337f60e0c78..6eeaea306e8 100644 --- a/layout/mathml/base/src/nsMathMLFrame.cpp +++ b/layout/mathml/base/src/nsMathMLFrame.cpp @@ -60,6 +60,11 @@ #include "nsDisplayList.h" #include "nsAttrName.h" +static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID); + + +NS_IMPL_QUERY_INTERFACE1(nsMathMLFrame, nsIMathMLFrame) + eMathMLFrameType nsMathMLFrame::GetMathMLFrameType() { @@ -187,7 +192,8 @@ nsMathMLFrame::GetEmbellishDataFrom(nsIFrame* aFrame, aEmbellishData.rightSpace = 0; if (aFrame && aFrame->IsFrameOfType(nsIFrame::eMathML)) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame); + nsIMathMLFrame* mathMLFrame; + CallQueryInterface(aFrame, &mathMLFrame); if (mathMLFrame) { mathMLFrame->GetEmbellishData(aEmbellishData); } @@ -209,7 +215,8 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame, nsIFrame* frame = aFrame; while (frame) { if (frame->IsFrameOfType(nsIFrame::eMathML)) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(frame); + nsIMathMLFrame* mathMLFrame; + CallQueryInterface(frame, &mathMLFrame); if (mathMLFrame) { mathMLFrame->GetPresentationData(aPresentationData); break; @@ -263,7 +270,8 @@ nsMathMLFrame::GetAttribute(nsIContent* aContent, mstyleParentData.mstyle = nsnull; if (mstyleParent) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(mstyleParent); + nsIMathMLFrame* mathMLFrame; + CallQueryInterface(mstyleParent, &mathMLFrame); if (mathMLFrame) { mathMLFrame->GetPresentationData(mstyleParentData); } diff --git a/layout/mathml/base/src/nsMathMLFrame.h b/layout/mathml/base/src/nsMathMLFrame.h index a6cc52c4e9a..5d4bfd1dbb0 100644 --- a/layout/mathml/base/src/nsMathMLFrame.h +++ b/layout/mathml/base/src/nsMathMLFrame.h @@ -57,6 +57,20 @@ class nsMathMLChar; class nsMathMLFrame : public nsIMathMLFrame { public: + // nsISupports ------ + + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + + NS_IMETHOD_(nsrefcnt) AddRef() { + // not meaningfull for frames + return 1; + } + + NS_IMETHOD_(nsrefcnt) Release() { + // not meaningfull for frames + return 1; + } + // nsIMathMLFrame --- NS_IMETHOD @@ -215,7 +229,8 @@ public: GetMathMLFrameTypeFor(nsIFrame* aFrame) { if (aFrame->IsFrameOfType(nsIFrame::eMathML)) { - nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame); + nsIMathMLFrame* mathMLFrame; + CallQueryInterface(aFrame, &mathMLFrame); if (mathMLFrame) return mathMLFrame->GetMathMLFrameType(); } diff --git a/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/layout/mathml/base/src/nsMathMLmactionFrame.cpp index d01d731dfc5..a65b58d5bb6 100644 --- a/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -74,21 +74,12 @@ #define NS_MATHML_ACTION_TYPE_TOOLTIP 3 // unsupported #define NS_MATHML_ACTION_TYPE_RESTYLE 4 -NS_IMETHODIMP_(nsrefcnt) -nsMathMLmactionFrame::AddRef() -{ - return 2; -} - -NS_IMETHODIMP_(nsrefcnt) -nsMathMLmactionFrame::Release() -{ - return 1; -} - -NS_IMPL_QUERY_INTERFACE2(nsMathMLmactionFrame, - nsIDOMMouseListener, - nsIDOMEventListener) +NS_IMPL_ADDREF_INHERITED(nsMathMLmactionFrame, nsMathMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmactionFrame, nsMathMLContainerFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED2(nsMathMLmactionFrame, + nsMathMLContainerFrame, + nsIDOMMouseListener, + nsIDOMEventListener) nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) diff --git a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 1109128a231..6f617527f20 100644 --- a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -351,7 +351,8 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext, stretchDir, containerSize); childFrame = firstChild; while (childFrame) { - nsIMathMLFrame* mathmlChild = do_QueryFrame(childFrame); + nsIMathMLFrame* mathmlChild; + childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathmlChild); if (mathmlChild) { nsHTMLReflowMetrics childDesiredSize; // retrieve the metrics that was stored at the previous pass diff --git a/layout/mathml/base/src/nsMathMLmtableFrame.cpp b/layout/mathml/base/src/nsMathMLmtableFrame.cpp index f301a6540e3..39105914591 100644 --- a/layout/mathml/base/src/nsMathMLmtableFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmtableFrame.cpp @@ -349,9 +349,9 @@ ListMathMLTree(nsIFrame* atLeast) // -------- // implementation of nsMathMLmtableOuterFrame -NS_QUERYFRAME_HEAD(nsMathMLmtableOuterFrame) - NS_QUERYFRAME_ENTRY(nsIMathMLFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsTableOuterFrame) +NS_IMPL_ADDREF_INHERITED(nsMathMLmtableOuterFrame, nsMathMLFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmtableOuterFrame, nsMathMLFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLmtableOuterFrame, nsTableOuterFrame, nsMathMLFrame) nsIFrame* NS_NewMathMLmtableOuterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -647,6 +647,13 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext, return rv; } +// -------- +// implementation of nsMathMLmtableFrame + +NS_IMPL_ADDREF_INHERITED(nsMathMLmtableFrame, nsTableFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmtableFrame, nsTableFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED0(nsMathMLmtableFrame, nsTableFrame) + nsIFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { @@ -681,6 +688,10 @@ nsMathMLmtableFrame::RestyleTable() // -------- // implementation of nsMathMLmtrFrame +NS_IMPL_ADDREF_INHERITED(nsMathMLmtrFrame, nsTableRowFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmtrFrame, nsTableRowFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED0(nsMathMLmtrFrame, nsTableRowFrame) + nsIFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { @@ -738,6 +749,10 @@ nsMathMLmtrFrame::AttributeChanged(PRInt32 aNameSpaceID, // -------- // implementation of nsMathMLmtdFrame +NS_IMPL_ADDREF_INHERITED(nsMathMLmtdFrame, nsTableCellFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmtdFrame, nsTableCellFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED0(nsMathMLmtdFrame, nsTableCellFrame) + nsIFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { @@ -820,9 +835,9 @@ nsMathMLmtdFrame::AttributeChanged(PRInt32 aNameSpaceID, // -------- // implementation of nsMathMLmtdInnerFrame -NS_QUERYFRAME_HEAD(nsMathMLmtdInnerFrame) - NS_QUERYFRAME_ENTRY(nsIMathMLFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame) +NS_IMPL_ADDREF_INHERITED(nsMathMLmtdInnerFrame, nsMathMLFrame) +NS_IMPL_RELEASE_INHERITED(nsMathMLmtdInnerFrame, nsMathMLFrame) +NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLmtdInnerFrame, nsBlockFrame, nsMathMLFrame) nsIFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) diff --git a/layout/mathml/base/src/nsMathMLmtableFrame.h b/layout/mathml/base/src/nsMathMLmtableFrame.h index f398a146f43..9a67581ed15 100644 --- a/layout/mathml/base/src/nsMathMLmtableFrame.h +++ b/layout/mathml/base/src/nsMathMLmtableFrame.h @@ -52,7 +52,7 @@ class nsMathMLmtableOuterFrame : public nsTableOuterFrame, public: friend nsIFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED // Overloaded nsIMathMLFrame methods @@ -107,6 +107,8 @@ class nsMathMLmtableFrame : public nsTableFrame public: friend nsIFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); + NS_DECL_ISUPPORTS_INHERITED + // Overloaded nsTableFrame methods NS_IMETHOD @@ -164,6 +166,8 @@ class nsMathMLmtrFrame : public nsTableRowFrame public: friend nsIFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); + NS_DECL_ISUPPORTS_INHERITED + // overloaded nsTableRowFrame methods NS_IMETHOD @@ -227,6 +231,8 @@ class nsMathMLmtdFrame : public nsTableCellFrame public: friend nsIFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); + NS_DECL_ISUPPORTS_INHERITED + // overloaded nsTableCellFrame methods NS_IMETHOD @@ -254,7 +260,7 @@ class nsMathMLmtdInnerFrame : public nsBlockFrame, public: friend nsIFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED // Overloaded nsIMathMLFrame methods diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index a23838a60dd..02c7cde2f4d 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -361,7 +361,7 @@ nsPrintEngine::GetSeqFrameAndCountPagesInternal(nsPrintObject* aPO, nsIPageSequenceFrame* seqFrame = nsnull; aPO->mPresShell->GetPageSequenceFrame(&seqFrame); if (seqFrame) { - aSeqFrame = do_QueryFrame(seqFrame); + CallQueryInterface(seqFrame, &aSeqFrame); } else { aSeqFrame = nsnull; } @@ -2064,8 +2064,8 @@ nsPrintEngine::CalcNumPrintablePages(PRInt32& aNumPages) if (po->mPresContext && po->mPresContext->IsRootPaginatedDocument()) { nsIPageSequenceFrame* pageSequence; po->mPresShell->GetPageSequenceFrame(&pageSequence); - nsIFrame * seqFrame = do_QueryFrame(pageSequence); - if (seqFrame) { + nsIFrame * seqFrame; + if (NS_SUCCEEDED(CallQueryInterface(pageSequence, &seqFrame))) { nsIFrame* frame = seqFrame->GetFirstChild(nsnull); while (frame) { aNumPages++; @@ -2148,9 +2148,10 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO) if (nsnull != mPrt->mDebugFilePtr) { #ifdef NS_DEBUG // output the regression test + nsIFrameDebug* fdbg; nsIFrame* root = poPresShell->FrameManager()->GetRootFrame(); - nsIFrameDebug* fdbg = do_QueryFrame(root); - if (fdbg) { + + if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) { fdbg->DumpRegressionData(poPresContext, mPrt->mDebugFilePtr, 0, PR_TRUE); } fclose(mPrt->mDebugFilePtr); @@ -2248,8 +2249,8 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO) } } - nsIFrame * seqFrame = do_QueryFrame(pageSequence); - if (!seqFrame) { + nsIFrame * seqFrame; + if (NS_FAILED(CallQueryInterface(pageSequence, &seqFrame))) { SetIsPrinting(PR_FALSE); return NS_ERROR_FAILURE; } @@ -2504,8 +2505,8 @@ nsPrintEngine::GetPageRangeForSelection(nsIPresShell * aPresShell, NS_ASSERTION(aStartFrame, "Pointer is null!"); NS_ASSERTION(aEndFrame, "Pointer is null!"); - nsIFrame * seqFrame = do_QueryFrame(aPageSeqFrame); - if (!seqFrame) { + nsIFrame * seqFrame; + if (NS_FAILED(CallQueryInterface(aPageSeqFrame, &seqFrame))) { return NS_ERROR_FAILURE; } @@ -3295,8 +3296,9 @@ static void RootFrameList(nsPresContext* aPresContext, FILE* out, PRInt32 aInden if (shell) { nsIFrame* frame = shell->FrameManager()->GetRootFrame(); if (frame) { - nsIFrameDebug* debugFrame = do_QueryFrame(frame); - if (debugFrame) + nsIFrameDebug* debugFrame; + nsresult rv = CallQueryInterface(frame, &debugFrame); + if (NS_SUCCEEDED(rv)) debugFrame->List(aPresContext, out, aIndent); } } @@ -3322,9 +3324,9 @@ static void DumpFrames(FILE* out, fprintf(out, " "); } nsAutoString tmp; + nsIFrameDebug* frameDebug; - nsIFrameDebug* frameDebug = do_QueryFrame(child); - if (frameDebug) { + if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) { frameDebug->GetFrameName(tmp); } fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); @@ -3459,8 +3461,8 @@ static void DumpPrintObjectsList(nsVoidArray * aDocList) if (po->mPresShell) { rootFrame = po->mPresShell->FrameManager()->GetRootFrame(); while (rootFrame != nsnull) { - nsIPageSequenceFrame * sqf = do_QueryFrame(rootFrame); - if (sqf) { + nsIPageSequenceFrame * sqf = nsnull; + if (NS_SUCCEEDED(CallQueryInterface(rootFrame, &sqf))) { break; } rootFrame = rootFrame->GetFirstChild(nsnull); diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index ea38105b3f4..bc887bfb672 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3078,7 +3078,8 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIDOMCSSValue** aValue) // scrollbars. We have to do some extra work. // the first child in the default frame list is what we want nsIFrame* scrollingChild = container->GetFirstChild(nsnull); - nsIScrollableFrame *scrollFrame = do_QueryFrame(scrollingChild); + nsCOMPtr scrollFrame = + do_QueryInterface(scrollingChild); if (scrollFrame) { scrollbarSizes = scrollFrame->GetActualScrollbarSizes(); } diff --git a/layout/style/nsICSSPseudoComparator.h b/layout/style/nsICSSPseudoComparator.h index ac8d5e38e10..49d0e2f4741 100644 --- a/layout/style/nsICSSPseudoComparator.h +++ b/layout/style/nsICSSPseudoComparator.h @@ -40,17 +40,21 @@ #ifndef nsICSSPseudoComparator_h___ #define nsICSSPseudoComparator_h___ -#include "nsQueryFrame.h" +// {4B122120-0F2D-4e88-AFE9-84A9AE2404E5} +#define NS_ICSS_PSEUDO_COMPARATOR_IID \ +{ 0x4b122120, 0xf2d, 0x4e88, { 0xaf, 0xe9, 0x84, 0xa9, 0xae, 0x24, 0x4, 0xe5 } } class nsIAtom; struct nsCSSSelector; -class nsICSSPseudoComparator -{ +class nsICSSPseudoComparator: public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsICSSPseudoComparator) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSS_PSEUDO_COMPARATOR_IID) NS_IMETHOD PseudoMatches(nsIAtom* aTag, nsCSSSelector* aSelector, PRBool* aResult)=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSPseudoComparator, + NS_ICSS_PSEUDO_COMPARATOR_IID) + #endif /* nsICSSPseudoComparator_h___ */ diff --git a/layout/svg/base/src/nsISVGChildFrame.h b/layout/svg/base/src/nsISVGChildFrame.h index d3c81e4b130..551c1b243a3 100644 --- a/layout/svg/base/src/nsISVGChildFrame.h +++ b/layout/svg/base/src/nsISVGChildFrame.h @@ -40,7 +40,7 @@ #define __NS_ISVGCHILDFRAME_H__ -#include "nsQueryFrame.h" +#include "nsISupports.h" #include "nsCOMPtr.h" #include "nsRect.h" @@ -50,10 +50,14 @@ class nsIDOMSVGRect; class nsIDOMSVGMatrix; class nsSVGRenderState; -class nsISVGChildFrame : public nsQueryFrame -{ +#define NS_ISVGCHILDFRAME_IID \ +{ 0xfc3ee9b2, 0xaf40, 0x416d, \ + { 0xa8, 0x51, 0xb4, 0x68, 0xa4, 0xe4, 0x8b, 0xcd } } + +class nsISVGChildFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsISVGChildFrame) + + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGCHILDFRAME_IID) // Paint this frame - aDirtyRect is the area being redrawn, in frame // offset pixel coordinates @@ -107,5 +111,7 @@ public: NS_IMETHOD_(PRBool) HasValidCoveredRect()=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGChildFrame, NS_ISVGCHILDFRAME_IID) + #endif // __NS_ISVGCHILDFRAME_H__ diff --git a/layout/svg/base/src/nsISVGGlyphFragmentLeaf.h b/layout/svg/base/src/nsISVGGlyphFragmentLeaf.h index 530e416b327..8c0da4fafbb 100644 --- a/layout/svg/base/src/nsISVGGlyphFragmentLeaf.h +++ b/layout/svg/base/src/nsISVGGlyphFragmentLeaf.h @@ -46,10 +46,17 @@ class nsIDOMSVGPoint; class nsIDOMSVGRect; class nsSVGTextPathFrame; + +// {ec9a9965-3ff2-4bb5-b0e2-dd8830e9f41a} +#define NS_ISVGGLYPHFRAGMENTLEAF_IID \ + { 0xec9a9965, 0x3ff2, 0x4bb5, \ + { 0xb0, 0xe2, 0xdd, 0x88, 0x30, 0xe9, 0xf4, 0x1a } } + class nsISVGGlyphFragmentLeaf : public nsISVGGlyphFragmentNode { public: - NS_DECLARE_FRAME_ACCESSOR(nsISVGGlyphFragmentLeaf) + + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGGLYPHFRAGMENTLEAF_IID) NS_IMETHOD GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)=0; NS_IMETHOD GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)=0; @@ -82,4 +89,7 @@ public: NS_IMETHOD_(PRBool) IsAbsolutelyPositioned()=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGGlyphFragmentLeaf, + NS_ISVGGLYPHFRAGMENTLEAF_IID) + #endif // __NS_ISVGGLYPHFRAGMENTLEAF_H__ diff --git a/layout/svg/base/src/nsISVGGlyphFragmentNode.h b/layout/svg/base/src/nsISVGGlyphFragmentNode.h index 4253a1f6d9c..bc8b3599238 100644 --- a/layout/svg/base/src/nsISVGGlyphFragmentNode.h +++ b/layout/svg/base/src/nsISVGGlyphFragmentNode.h @@ -40,7 +40,7 @@ #ifndef __NS_ISVGGLYPHFRAGMENTNODE_H__ #define __NS_ISVGGLYPHFRAGMENTNODE_H__ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsISVGGlyphFragmentLeaf; class nsIDOMSVGPoint; @@ -50,10 +50,14 @@ class nsIDOMSVGPoint; #define TRIM_LEADING_WHITESPACE 0x02 #define TRIM_TRAILING_WHITESPACE 0x04 -class nsISVGGlyphFragmentNode : public nsQueryFrame +#define NS_ISVGGLYPHFRAGMENTNODE_IID \ +{ 0x1297716a, 0xd68d, 0x4c9d, { 0x8e, 0xf8, 0x9e, 0x01, 0x1d, 0x78, 0x21, 0xd0 } } + +class nsISVGGlyphFragmentNode : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsISVGGlyphFragmentNode) + + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGGLYPHFRAGMENTNODE_IID) NS_IMETHOD_(PRUint32) GetNumberOfChars()=0; NS_IMETHOD_(float) GetComputedTextLength()=0; @@ -64,4 +68,7 @@ public: NS_IMETHOD_(void) SetWhitespaceHandling(PRUint8 aWhitespaceHandling)=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGGlyphFragmentNode, + NS_ISVGGLYPHFRAGMENTNODE_IID) + #endif // __NS_ISVGGLYPHFRAGMENTNODE_H__ diff --git a/layout/svg/base/src/nsISVGSVGFrame.h b/layout/svg/base/src/nsISVGSVGFrame.h index 8e1b5b0e485..0d6447802c5 100644 --- a/layout/svg/base/src/nsISVGSVGFrame.h +++ b/layout/svg/base/src/nsISVGSVGFrame.h @@ -39,16 +39,21 @@ #ifndef __NS_ISVGSVGFRAME_H__ #define __NS_ISVGSVGFRAME_H__ -#include "nsQueryFrame.h" +#include "nsISupports.h" -class nsISVGSVGFrame -{ +// {C38FDFC3-7030-47CB-BA69-D7C5F45E657C} +#define NS_ISVGSVGFRAME_IID \ +{ 0xc38fdfc3, 0x7030, 0x47cb, { 0xba, 0x69, 0xd7, 0xc5, 0xf4, 0x5e, 0x65, 0x7c } } + +class nsISVGSVGFrame : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsISVGSVGFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGSVGFRAME_IID) NS_IMETHOD SuspendRedraw()=0; NS_IMETHOD UnsuspendRedraw()=0; NS_IMETHOD NotifyViewportChange()=0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGSVGFrame, NS_ISVGSVGFRAME_IID) + #endif // __NS_ISVGSVGFRAME_H__ diff --git a/layout/svg/base/src/nsSVGClipPathFrame.cpp b/layout/svg/base/src/nsSVGClipPathFrame.cpp index 70c2918b7a9..f5cb33291cb 100644 --- a/layout/svg/base/src/nsSVGClipPathFrame.cpp +++ b/layout/svg/base/src/nsSVGClipPathFrame.cpp @@ -84,7 +84,8 @@ nsSVGClipPathFrame::ClipPaint(nsSVGRenderState* aContext, for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { // The CTM of each frame referencing us can be different. SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | @@ -120,7 +121,8 @@ nsSVGClipPathFrame::ClipHitTest(nsIFrame* aParent, for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { // Notify the child frame that we may be working with a // different transform, so it can update its covered region @@ -141,7 +143,9 @@ nsSVGClipPathFrame::IsTrivial() for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame *svgChild = do_QueryFrame(kid); + nsISVGChildFrame *svgChild = nsnull; + CallQueryInterface(kid, &svgChild); + if (svgChild) { // We consider a non-trivial clipPath to be one containing // either more than one svg child and/or a svg container diff --git a/layout/svg/base/src/nsSVGContainerFrame.cpp b/layout/svg/base/src/nsSVGContainerFrame.cpp index f1109f1d86d..b7b9c6e3d47 100644 --- a/layout/svg/base/src/nsSVGContainerFrame.cpp +++ b/layout/svg/base/src/nsSVGContainerFrame.cpp @@ -38,9 +38,12 @@ #include "nsSVGUtils.h" #include "nsSVGOuterSVGFrame.h" -NS_QUERYFRAME_HEAD(nsSVGDisplayContainerFrame) - NS_QUERYFRAME_ENTRY(nsISVGChildFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrame) +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGDisplayContainerFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGContainerFrame) nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell, @@ -127,7 +130,8 @@ nsSVGDisplayContainerFrame::InsertFrames(nsIAtom* aListName, for (nsIFrame* kid = aFrameList; kid != end; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->InitialUpdate(); } @@ -188,7 +192,8 @@ nsSVGDisplayContainerFrame::UpdateCoveredRegion() { for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->UpdateCoveredRegion(); } @@ -205,7 +210,8 @@ nsSVGDisplayContainerFrame::InitialUpdate() for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->InitialUpdate(); } @@ -235,7 +241,8 @@ nsSVGDisplayContainerFrame::NotifyRedrawSuspended() { for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame=nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->NotifyRedrawSuspended(); } @@ -248,7 +255,8 @@ nsSVGDisplayContainerFrame::NotifyRedrawUnsuspended() { for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->NotifyRedrawUnsuspended(); } diff --git a/layout/svg/base/src/nsSVGContainerFrame.h b/layout/svg/base/src/nsSVGContainerFrame.h index 505894f564e..9be1181d38e 100644 --- a/layout/svg/base/src/nsSVGContainerFrame.h +++ b/layout/svg/base/src/nsSVGContainerFrame.h @@ -84,8 +84,13 @@ protected: nsSVGContainerFrame(aContext) {} public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame: NS_IMETHOD InsertFrames(nsIAtom* aListName, nsIFrame* aPrevFrame, diff --git a/layout/svg/base/src/nsSVGFilterFrame.cpp b/layout/svg/base/src/nsSVGFilterFrame.cpp index 19fc008a2e0..13868b2eeae 100644 --- a/layout/svg/base/src/nsSVGFilterFrame.cpp +++ b/layout/svg/base/src/nsSVGFilterFrame.cpp @@ -110,7 +110,7 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget, { nsCOMPtr ctm = nsSVGUtils::GetCanvasTM(aTarget); - mTarget = do_QueryFrame(aTarget); + CallQueryInterface(aTarget, &mTarget); if (mTarget) { mTarget->SetMatrixPropagation(PR_FALSE); mTarget->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index c541f06c62f..566a73e601a 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -81,11 +81,14 @@ nsSVGForeignObjectFrame::nsSVGForeignObjectFrame(nsStyleContext* aContext) } //---------------------------------------------------------------------- -// nsIFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGForeignObjectFrame) - NS_QUERYFRAME_ENTRY(nsISVGChildFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGForeignObjectFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGForeignObjectFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectFrameBase) + +//---------------------------------------------------------------------- +// nsIFrame methods NS_IMETHODIMP nsSVGForeignObjectFrame::Init(nsIContent* aContent, diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.h b/layout/svg/base/src/nsSVGForeignObjectFrame.h index dee7fdc4f3a..510ab9afc62 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.h +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.h @@ -57,9 +57,13 @@ class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, protected: nsSVGForeignObjectFrame(nsStyleContext* aContext); -public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame: NS_IMETHOD Init(nsIContent* aContent, nsIFrame* aParent, diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index b1ac7ecedd4..42656353a23 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -187,7 +187,8 @@ nsIFrame* NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parentFrame, nsStyleContext* aContext) { NS_ASSERTION(parentFrame, "null parent"); - nsISVGTextContentMetrics *metrics = do_QueryFrame(parentFrame); + nsISVGTextContentMetrics *metrics; + CallQueryInterface(parentFrame, &metrics); NS_ASSERTION(metrics, "trying to construct an SVGGlyphFrame for an invalid container"); NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT), @@ -197,13 +198,13 @@ NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* pa } //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGGlyphFrame) - NS_QUERYFRAME_ENTRY(nsISVGGlyphFragmentLeaf) - NS_QUERYFRAME_ENTRY(nsISVGGlyphFragmentNode) - NS_QUERYFRAME_ENTRY(nsISVGChildFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGGlyphFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGGlyphFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGGlyphFragmentLeaf) + NS_INTERFACE_MAP_ENTRY(nsISVGGlyphFragmentNode) + NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGGlyphFrameBase) //---------------------------------------------------------------------- // nsIFrame methods @@ -1120,7 +1121,8 @@ nsSVGGlyphFrame::GetNextGlyphFragment() { nsIFrame* sibling = mNextSibling; while (sibling) { - nsISVGGlyphFragmentNode *node = do_QueryFrame(sibling); + nsISVGGlyphFragmentNode *node = nsnull; + CallQueryInterface(sibling, &node); if (node) return node->GetFirstGlyphFragment(); sibling = sibling->GetNextSibling(); @@ -1129,7 +1131,8 @@ nsSVGGlyphFrame::GetNextGlyphFragment() // no more siblings. go back up the tree. NS_ASSERTION(mParent, "null parent"); - nsISVGGlyphFragmentNode *node = do_QueryFrame(mParent); + nsISVGGlyphFragmentNode *node = nsnull; + CallQueryInterface(mParent, &node); return node ? node->GetNextGlyphFragment() : nsnull; } diff --git a/layout/svg/base/src/nsSVGGlyphFrame.h b/layout/svg/base/src/nsSVGGlyphFrame.h index ed46f2bd03c..3a9223f7dc0 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.h +++ b/layout/svg/base/src/nsSVGGlyphFrame.h @@ -71,7 +71,10 @@ protected: } public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } // nsIFrame interface: NS_IMETHOD CharacterDataChanged(nsPresContext* aPresContext, diff --git a/layout/svg/base/src/nsSVGInnerSVGFrame.cpp b/layout/svg/base/src/nsSVGInnerSVGFrame.cpp index cd01be50044..317fefc6105 100644 --- a/layout/svg/base/src/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGInnerSVGFrame.cpp @@ -57,10 +57,13 @@ protected: nsSVGInnerSVGFrame(nsStyleContext* aContext) : nsSVGInnerSVGFrameBase(aContext) {} -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // We don't define an AttributeChanged method since changes to the // 'x', 'y', 'width' and 'height' attributes of our content object // are handled in nsSVGSVGElement::DidModifySVGObservable @@ -126,27 +129,14 @@ NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleCo NS_INTERFACE_MAP_BEGIN(nsSVGInnerSVGFrame) NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) -NS_INTERFACE_MAP_END + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGSVGFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGInnerSVGFrameBase) -NS_IMETHODIMP_(nsrefcnt) -nsSVGInnerSVGFrame::AddRef() -{ - return 2; -} - -NS_IMETHODIMP_(nsrefcnt) -nsSVGInnerSVGFrame::Release() -{ - return 1; -} //---------------------------------------------------------------------- // nsIFrame methods -NS_QUERYFRAME_HEAD(nsSVGInnerSVGFrame) - NS_QUERYFRAME_ENTRY(nsISVGSVGFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGInnerSVGFrameBase) - nsIAtom * nsSVGInnerSVGFrame::GetType() const { diff --git a/layout/svg/base/src/nsSVGIntegrationUtils.cpp b/layout/svg/base/src/nsSVGIntegrationUtils.cpp index 12cb624c6e3..8842b32d82c 100644 --- a/layout/svg/base/src/nsSVGIntegrationUtils.cpp +++ b/layout/svg/base/src/nsSVGIntegrationUtils.cpp @@ -244,9 +244,10 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsIRenderingContext* aCtx, nsDisplayList* aInnerList) { #ifdef DEBUG - nsISVGChildFrame *svgChildFrame = do_QueryFrame(aEffectsFrame); - NS_ASSERTION(!svgChildFrame, "Should never be called on an SVG frame"); + nsISVGChildFrame *svgChildFrame; + CallQueryInterface(aEffectsFrame, &svgChildFrame); #endif + NS_ASSERTION(!svgChildFrame, "Should never be called on an SVG frame"); float opacity = aEffectsFrame->GetStyleDisplay()->mOpacity; if (opacity == 0.0f) diff --git a/layout/svg/base/src/nsSVGMarkerFrame.cpp b/layout/svg/base/src/nsSVGMarkerFrame.cpp index 8ba218c0df8..7fec0c90707 100644 --- a/layout/svg/base/src/nsSVGMarkerFrame.cpp +++ b/layout/svg/base/src/nsSVGMarkerFrame.cpp @@ -198,7 +198,8 @@ nsSVGMarkerFrame::PaintMark(nsSVGRenderState *aContext, for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { // The CTM of each frame referencing us may be different. SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | @@ -235,7 +236,8 @@ nsSVGMarkerFrame::RegionMark(nsSVGPathGeometryFrame *aMarkedFrame, for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* child = do_QueryFrame(kid); + nsISVGChildFrame* child = nsnull; + CallQueryInterface(kid, &child); if (child) child->UpdateCoveredRegion(); } diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index 231d70f30ed..6b9236bc50a 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -104,7 +104,8 @@ nsSVGMutationObserver::AttributeChanged(nsIDocument *aDocument, } // is the content a child of a text element - nsISVGTextContentMetrics* metrics = do_QueryFrame(frame); + nsISVGTextContentMetrics* metrics; + CallQueryInterface(frame, &metrics); if (metrics) { nsSVGTextContainerFrame *containerFrame = static_cast(frame); @@ -189,11 +190,11 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent, } //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGOuterSVGFrame) - NS_QUERYFRAME_ENTRY(nsISVGSVGFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGOuterSVGFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGOuterSVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGSVGFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGOuterSVGFrameBase) //---------------------------------------------------------------------- // nsIFrame methods @@ -405,7 +406,8 @@ nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext, // call InitialUpdate() on all frames: nsIFrame* kid = mFrames.FirstChild(); while (kid) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->InitialUpdate(); } @@ -634,7 +636,8 @@ nsSVGOuterSVGFrame::GetType() const void nsSVGOuterSVGFrame::InvalidateCoveredRegion(nsIFrame *aFrame) { - nsISVGChildFrame *svgFrame = do_QueryFrame(aFrame); + nsISVGChildFrame *svgFrame = nsnull; + CallQueryInterface(aFrame, &svgFrame); if (!svgFrame) return; @@ -645,7 +648,8 @@ nsSVGOuterSVGFrame::InvalidateCoveredRegion(nsIFrame *aFrame) PRBool nsSVGOuterSVGFrame::UpdateAndInvalidateCoveredRegion(nsIFrame *aFrame) { - nsISVGChildFrame *svgFrame = do_QueryFrame(aFrame); + nsISVGChildFrame *svgFrame = nsnull; + CallQueryInterface(aFrame, &svgFrame); if (!svgFrame) return PR_FALSE; @@ -681,7 +685,8 @@ nsSVGOuterSVGFrame::SuspendRedraw() for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame=nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->NotifyRedrawSuspended(); } @@ -703,7 +708,8 @@ nsSVGOuterSVGFrame::UnsuspendRedraw() for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame=nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { SVGFrame->NotifyRedrawUnsuspended(); } diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.h b/layout/svg/base/src/nsSVGOuterSVGFrame.h index 247060bb0c4..f077fde951d 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.h +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.h @@ -59,8 +59,13 @@ class nsSVGOuterSVGFrame : public nsSVGOuterSVGFrameBase, protected: nsSVGOuterSVGFrame(nsStyleContext* aContext); + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } + public: - NS_DECL_QUERYFRAME #ifdef DEBUG ~nsSVGOuterSVGFrame() { diff --git a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp index bd13eaa3458..9c9c0225ecb 100644 --- a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp @@ -60,11 +60,11 @@ NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, } //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGPathGeometryFrame) - NS_QUERYFRAME_ENTRY(nsISVGChildFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGPathGeometryFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGPathGeometryFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame) +NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrameBase) //---------------------------------------------------------------------- // nsIFrame methods diff --git a/layout/svg/base/src/nsSVGPathGeometryFrame.h b/layout/svg/base/src/nsSVGPathGeometryFrame.h index ba343877d29..e0ebc96b235 100644 --- a/layout/svg/base/src/nsSVGPathGeometryFrame.h +++ b/layout/svg/base/src/nsSVGPathGeometryFrame.h @@ -68,8 +68,13 @@ protected: nsSVGPathGeometryFrameBase(aContext) {} public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame interface: NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, diff --git a/layout/svg/base/src/nsSVGPatternFrame.cpp b/layout/svg/base/src/nsSVGPatternFrame.cpp index 8541fbb3e6b..94aacc64c0a 100644 --- a/layout/svg/base/src/nsSVGPatternFrame.cpp +++ b/layout/svg/base/src/nsSVGPatternFrame.cpp @@ -640,9 +640,9 @@ nsSVGPatternFrame::GetCallerGeometry(nsIDOMSVGMatrix **aCTM, // will be in *device coordinates* nsISVGChildFrame *callerSVGFrame; if (callerType == nsGkAtoms::svgGlyphFrame) - callerSVGFrame = do_QueryFrame(aSource->GetParent()); + CallQueryInterface(aSource->GetParent(), &callerSVGFrame); else - callerSVGFrame = do_QueryFrame(aSource); + CallQueryInterface(aSource, &callerSVGFrame); callerSVGFrame->SetMatrixPropagation(PR_FALSE); callerSVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION | diff --git a/layout/svg/base/src/nsSVGSwitchFrame.cpp b/layout/svg/base/src/nsSVGSwitchFrame.cpp index 7838c334c94..5e5ffeacb7d 100644 --- a/layout/svg/base/src/nsSVGSwitchFrame.cpp +++ b/layout/svg/base/src/nsSVGSwitchFrame.cpp @@ -120,7 +120,8 @@ nsSVGSwitchFrame::GetFrameForPoint(const nsPoint &aPoint) { nsIFrame *kid = GetActiveChildFrame(); if (kid) { - nsISVGChildFrame* svgFrame = do_QueryFrame(kid); + nsISVGChildFrame* svgFrame; + CallQueryInterface(kid, &svgFrame); if (svgFrame) { return svgFrame->GetFrameForPoint(aPoint); } @@ -136,7 +137,8 @@ nsSVGSwitchFrame::GetCoveredRegion() nsIFrame *kid = GetActiveChildFrame(); if (kid) { - nsISVGChildFrame* child = do_QueryFrame(kid); + nsISVGChildFrame* child = nsnull; + CallQueryInterface(kid, &child); if (child) { rect = child->GetCoveredRegion(); } @@ -176,7 +178,8 @@ nsSVGSwitchFrame::GetBBox(nsIDOMSVGRect **aRect) nsIFrame *kid = GetActiveChildFrame(); if (kid) { - nsISVGChildFrame* svgFrame = do_QueryFrame(kid); + nsISVGChildFrame* svgFrame = nsnull; + CallQueryInterface(kid, &svgFrame); if (svgFrame) { nsCOMPtr box; svgFrame->GetBBox(getter_AddRefs(box)); diff --git a/layout/svg/base/src/nsSVGTSpanFrame.cpp b/layout/svg/base/src/nsSVGTSpanFrame.cpp index a3ad5ce78ef..500a29de967 100644 --- a/layout/svg/base/src/nsSVGTSpanFrame.cpp +++ b/layout/svg/base/src/nsSVGTSpanFrame.cpp @@ -51,7 +51,8 @@ NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parentFrame, nsStyleContext* aContext) { NS_ASSERTION(parentFrame, "null parent"); - nsISVGTextContentMetrics *metrics = do_QueryFrame(parentFrame); + nsISVGTextContentMetrics *metrics; + CallQueryInterface(parentFrame, &metrics); if (!metrics) { NS_ERROR("trying to construct an SVGTSpanFrame for an invalid container"); return nsnull; @@ -73,11 +74,11 @@ nsSVGTSpanFrame::GetType() const } //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGTSpanFrame) - NS_QUERYFRAME_ENTRY(nsISVGGlyphFragmentNode) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGTSpanFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGTSpanFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGGlyphFragmentNode) +NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanFrameBase) //---------------------------------------------------------------------- // nsIFrame methods @@ -149,7 +150,8 @@ nsSVGTSpanFrame::GetFirstGlyphFragment() // try children first: nsIFrame* kid = mFrames.FirstChild(); while (kid) { - nsISVGGlyphFragmentNode *node = do_QueryFrame(kid); + nsISVGGlyphFragmentNode *node = nsnull; + CallQueryInterface(kid, &node); if (node) return node->GetFirstGlyphFragment(); kid = kid->GetNextSibling(); @@ -165,7 +167,8 @@ nsSVGTSpanFrame::GetNextGlyphFragment() { nsIFrame* sibling = mNextSibling; while (sibling) { - nsISVGGlyphFragmentNode *node = do_QueryFrame(sibling); + nsISVGGlyphFragmentNode *node = nsnull; + CallQueryInterface(sibling, &node); if (node) return node->GetFirstGlyphFragment(); sibling = sibling->GetNextSibling(); @@ -174,7 +177,8 @@ nsSVGTSpanFrame::GetNextGlyphFragment() // no more siblings. go back up the tree. NS_ASSERTION(mParent, "null parent"); - nsISVGGlyphFragmentNode *node = do_QueryFrame(mParent); + nsISVGGlyphFragmentNode *node = nsnull; + CallQueryInterface(mParent, &node); return node ? node->GetNextGlyphFragment() : nsnull; } diff --git a/layout/svg/base/src/nsSVGTSpanFrame.h b/layout/svg/base/src/nsSVGTSpanFrame.h index db43c7fa6b3..75692093c5c 100644 --- a/layout/svg/base/src/nsSVGTSpanFrame.h +++ b/layout/svg/base/src/nsSVGTSpanFrame.h @@ -54,9 +54,13 @@ protected: nsSVGTSpanFrame(nsStyleContext* aContext) : nsSVGTextContainerFrame(aContext) {} -public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame: NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, diff --git a/layout/svg/base/src/nsSVGTextContainerFrame.cpp b/layout/svg/base/src/nsSVGTextContainerFrame.cpp index 4d29d65e5f9..c3dc3f2f41b 100644 --- a/layout/svg/base/src/nsSVGTextContainerFrame.cpp +++ b/layout/svg/base/src/nsSVGTextContainerFrame.cpp @@ -45,11 +45,11 @@ #include "nsDOMError.h" //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGTextContainerFrame) - NS_QUERYFRAME_ENTRY(nsISVGTextContentMetrics) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame) +NS_INTERFACE_MAP_BEGIN(nsSVGTextContainerFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGTextContentMetrics) +NS_INTERFACE_MAP_END_INHERITING(nsSVGDisplayContainerFrame) void nsSVGTextContainerFrame::NotifyGlyphMetricsChange() @@ -308,7 +308,7 @@ nsSVGTextContainerFrame::GetFirstGlyphFragmentChildNode() nsISVGGlyphFragmentNode *retval = nsnull; nsIFrame* kid = mFrames.FirstChild(); while (kid) { - retval = do_QueryFrame(kid); + CallQueryInterface(kid, &retval); if (retval) break; kid = kid->GetNextSibling(); } @@ -319,11 +319,12 @@ nsISVGGlyphFragmentNode * nsSVGTextContainerFrame::GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode *node) { nsISVGGlyphFragmentNode *retval = nsnull; - nsIFrame *frame = do_QueryFrame(node); + nsIFrame *frame = nsnull; + CallQueryInterface(node, &frame); NS_ASSERTION(frame, "interface not implemented"); frame = frame->GetNextSibling(); while (frame) { - retval = do_QueryFrame(frame); + CallQueryInterface(frame, &retval); if (retval) break; frame = frame->GetNextSibling(); } diff --git a/layout/svg/base/src/nsSVGTextContainerFrame.h b/layout/svg/base/src/nsSVGTextContainerFrame.h index 677e34acfd1..5d49c3e352c 100644 --- a/layout/svg/base/src/nsSVGTextContainerFrame.h +++ b/layout/svg/base/src/nsSVGTextContainerFrame.h @@ -59,9 +59,13 @@ public: NS_IMETHOD_(already_AddRefed) GetDx(); NS_IMETHOD_(already_AddRefed) GetDy(); -public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame NS_IMETHOD InsertFrames(nsIAtom* aListName, nsIFrame* aPrevFrame, diff --git a/layout/svg/base/src/nsSVGUseFrame.cpp b/layout/svg/base/src/nsSVGUseFrame.cpp index c03a7681f7a..cc1afb36856 100644 --- a/layout/svg/base/src/nsSVGUseFrame.cpp +++ b/layout/svg/base/src/nsSVGUseFrame.cpp @@ -53,9 +53,13 @@ class nsSVGUseFrame : public nsSVGUseFrameBase, protected: nsSVGUseFrame(nsStyleContext* aContext) : nsSVGUseFrameBase(aContext) {} -public: - NS_DECL_QUERYFRAME + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } + NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame interface: NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -106,11 +110,11 @@ nsSVGUseFrame::GetType() const } //---------------------------------------------------------------------- -// nsQueryFrame methods +// nsISupports methods -NS_QUERYFRAME_HEAD(nsSVGUseFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGUseFrameBase) +NS_INTERFACE_MAP_BEGIN(nsSVGUseFrame) + NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator) +NS_INTERFACE_MAP_END_INHERITING(nsSVGUseFrameBase) //---------------------------------------------------------------------- // nsIFrame methods: diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 942e41d2ebf..2d175af17fe 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -522,7 +522,8 @@ nsSVGUtils::GetBBox(nsFrameList *aFrames, nsIDOMSVGRect **_retval) nsIFrame* kid = aFrames->FirstChild(); while (kid) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); if (SVGFrame) { nsCOMPtr box; SVGFrame->GetBBox(getter_AddRefs(box)); @@ -597,7 +598,8 @@ nsSVGUtils::InvalidateCoveredRegion(nsIFrame *aFrame) void nsSVGUtils::UpdateGraphic(nsISVGChildFrame *aSVGFrame) { - nsIFrame *frame = do_QueryFrame(aSVGFrame); + nsIFrame *frame; + CallQueryInterface(aSVGFrame, &frame); nsSVGEffects::InvalidateRenderingObservers(frame); @@ -742,7 +744,8 @@ nsSVGUtils::GetOuterSVGFrame(nsIFrame *aFrame) nsIFrame* nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect) { - nsISVGChildFrame* svg = do_QueryFrame(aFrame); + nsISVGChildFrame* svg; + CallQueryInterface(aFrame, &svg); if (!svg) return nsnull; *aRect = svg->GetCoveredRegion(); @@ -877,7 +880,8 @@ nsSVGUtils::NotifyChildrenOfSVGChange(nsIFrame *aFrame, PRUint32 aFlags) nsIFrame *aKid = aFrame->GetFirstChild(nsnull); while (aKid) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(aKid); + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(aKid, &SVGFrame); if (SVGFrame) { SVGFrame->NotifySVGChanged(aFlags); } else { @@ -920,7 +924,8 @@ public: virtual void Paint(nsSVGRenderState *aContext, nsIFrame *aTarget, const nsIntRect* aDirtyRect) { - nsISVGChildFrame *svgChildFrame = do_QueryFrame(aTarget); + nsISVGChildFrame *svgChildFrame; + CallQueryInterface(aTarget, &svgChildFrame); NS_ASSERTION(svgChildFrame, "Expected SVG frame here"); NS_ASSERTION(!svgChildFrame->GetMatrixPropagation(), "This should have been set to false already"); @@ -956,7 +961,9 @@ nsSVGUtils::PaintFrameWithEffects(nsSVGRenderState *aContext, const nsIntRect *aDirtyRect, nsIFrame *aFrame) { - nsISVGChildFrame *svgChildFrame = do_QueryFrame(aFrame); + nsISVGChildFrame *svgChildFrame; + CallQueryInterface(aFrame, &svgChildFrame); + if (!svgChildFrame) return; @@ -1137,7 +1144,8 @@ nsSVGUtils::HitTestChildren(nsIFrame *aFrame, const nsPoint &aPoint) // now do the backwards traversal while (current) { - nsISVGChildFrame* SVGFrame = do_QueryFrame(current); + nsISVGChildFrame* SVGFrame; + CallQueryInterface(current, &SVGFrame); if (SVGFrame) { result = SVGFrame->GetFrameForPoint(aPoint); if (result) @@ -1172,7 +1180,8 @@ nsSVGUtils::GetCoveredRegion(const nsFrameList &aFrames) for (nsIFrame* kid = aFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { - nsISVGChildFrame* child = do_QueryFrame(kid); + nsISVGChildFrame* child = nsnull; + CallQueryInterface(kid, &child); if (child) { nsRect childRect = child->GetCoveredRegion(); rect.UnionRect(rect, childRect); @@ -1351,7 +1360,8 @@ nsSVGUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut) already_AddRefed nsSVGUtils::GetBBox(nsIFrame *aFrame) { - nsISVGChildFrame *svg = do_QueryFrame(aFrame); + nsISVGChildFrame *svg; + CallQueryInterface(aFrame, &svg); if (!svg) { nsIDOMSVGRect *rect = nsnull; gfxRect r = nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(aFrame); @@ -1446,7 +1456,8 @@ nsSVGUtils::AdjustMatrixForUnits(nsIDOMSVGMatrix *aMatrix, PRBool gotRect = PR_FALSE; if (aFrame->IsFrameOfType(nsIFrame::eSVG)) { - nsISVGChildFrame *svgFrame = do_QueryFrame(aFrame); + nsISVGChildFrame *svgFrame; + CallQueryInterface(aFrame, &svgFrame); nsCOMPtr rect; svgFrame->GetBBox(getter_AddRefs(rect)); if (rect) { diff --git a/layout/tables/nsITableCellLayout.h b/layout/tables/nsITableCellLayout.h index f201d6bacc1..4e9c18dcd23 100644 --- a/layout/tables/nsITableCellLayout.h +++ b/layout/tables/nsITableCellLayout.h @@ -37,7 +37,13 @@ #ifndef nsITableCellLayout_h__ #define nsITableCellLayout_h__ -#include "nsQueryFrame.h" +#include "nsISupports.h" + +// IID for the nsITableCellLayout interface +// 0238f187-033d-426b-bd03-96eb75af5129 +#define NS_ITABLECELLAYOUT_IID \ +{ 0x0238f187, 0x033d, 0x426b, \ + { 0xbd, 0x03, 0x96, 0xeb, 0x75, 0xaf, 0x51, 0x29 } } /** * nsITableCellLayout @@ -45,11 +51,11 @@ * * @author sclark */ -class nsITableCellLayout +class nsITableCellLayout : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsITableCellLayout) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITABLECELLAYOUT_IID) /** return the mapped cell's row and column indexes (starting at 0 for each) */ NS_IMETHOD GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)=0; @@ -61,6 +67,8 @@ public: virtual nsresult GetColIndex(PRInt32 &aColIndex) const = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsITableCellLayout, NS_ITABLECELLAYOUT_IID) + #endif diff --git a/layout/tables/nsITableLayout.h b/layout/tables/nsITableLayout.h index 0d9e3aef874..72e304702c1 100644 --- a/layout/tables/nsITableLayout.h +++ b/layout/tables/nsITableLayout.h @@ -37,9 +37,14 @@ #ifndef nsITableLayout_h__ #define nsITableLayout_h__ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsIDOMElement; +// IID for the nsITableLayout interface +// A9222E6B-437E-11d3-B227-004095E27A10 +#define NS_ITABLELAYOUT_IID \ + { 0xf8363dea, 0x11ad, 0x483a, { 0xba, 0xea, 0xf6, 0xf2, 0xc3, 0x58, 0x8d, 0xde }} + /** * nsITableLayout * interface for layout objects that act like tables. @@ -47,11 +52,11 @@ class nsIDOMElement; * * @author sclark */ -class nsITableLayout +class nsITableLayout : public nsISupports { public: - NS_DECLARE_FRAME_ACCESSOR(nsITableLayout) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITABLELAYOUT_IID) /** return all the relevant layout information about a cell. * @param aRowIndex a row which the cell intersects @@ -109,4 +114,6 @@ public: PRInt32 *aRow, PRInt32 *aColumn) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsITableLayout, NS_ITABLELAYOUT_IID) + #endif diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index adb4053b58f..5c2d660ec77 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -1015,10 +1015,25 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext, /* ----- global methods ----- */ -NS_QUERYFRAME_HEAD(nsTableCellFrame) - NS_QUERYFRAME_ENTRY(nsITableCellLayout) - NS_QUERYFRAME_ENTRY(nsIPercentHeightObserver) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) + +NS_IMETHODIMP +nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsTableCellFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index b39548ba9f1..4a4870c75a2 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -72,7 +72,8 @@ class nsTableCellFrame : public nsHTMLContainerFrame, { public: - NS_DECL_QUERYFRAME + // nsISupports + NS_DECL_ISUPPORTS_INHERITED // default constructor supplied by the compiler diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index a61944e5bd2..042636b36f3 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -196,9 +196,21 @@ nsTableFrame::nsTableFrame(nsStyleContext* aContext) mBits.mGeometryDirty = PR_FALSE; } -NS_QUERYFRAME_HEAD(nsTableFrame) - NS_QUERYFRAME_ENTRY(nsITableLayout) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableFrame, nsHTMLContainerFrame) + +NS_IMETHODIMP +nsTableFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsITableLayout))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} NS_IMETHODIMP nsTableFrame::Init(nsIContent* aContent, @@ -1104,8 +1116,9 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame, rgFrame = aFrame; } else if (nsGkAtoms::scrollFrame == frameType) { - nsIScrollableFrame* scrollable = do_QueryFrame(aFrame); - if (scrollable) { + nsIScrollableFrame* scrollable = nsnull; + nsresult rv = CallQueryInterface(aFrame, &scrollable); + if (NS_SUCCEEDED(rv) && (scrollable)) { nsIFrame* scrolledFrame = scrollable->GetScrolledFrame(); if (scrolledFrame) { if (nsGkAtoms::tableRowGroupFrame == scrolledFrame->GetType()) { diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 95f7020182f..a548a26196c 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -140,7 +140,8 @@ class nsTableFrame : public nsHTMLContainerFrame, public nsITableLayout { public: - NS_DECL_QUERYFRAME + // nsISupports + NS_DECL_ISUPPORTS_INHERITED /** nsTableOuterFrame has intimate knowledge of the inner table frame */ friend class nsTableOuterFrame; diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 5c172e3c68a..f3a9ad88db6 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -176,6 +176,9 @@ NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) /* ----------- nsTableOuterFrame ---------- */ +NS_IMPL_ADDREF_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) + nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext): nsHTMLContainerFrame(aContext) { @@ -185,9 +188,18 @@ nsTableOuterFrame::~nsTableOuterFrame() { } -NS_QUERYFRAME_HEAD(nsTableOuterFrame) - NS_QUERYFRAME_ENTRY(nsITableLayout) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +NS_IMETHODIMP +nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + if (aIID.Equals(NS_GET_IID(nsITableLayout))) { + *aInstancePtr = static_cast(this); + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} #ifdef ACCESSIBILITY NS_IMETHODIMP nsTableOuterFrame::GetAccessible(nsIAccessible** aAccessible) diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index 725c7c23bde..66ac343c5ea 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -87,7 +87,8 @@ class nsTableOuterFrame : public nsHTMLContainerFrame, public nsITableLayout { public: - NS_DECL_QUERYFRAME + // nsISupports + NS_DECL_ISUPPORTS_INHERITED /** instantiate a new instance of nsTableRowFrame. * @param aPresShell the pres shell for this frame diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 3592c1ffb6c..2108a637315 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -64,9 +64,19 @@ nsTableRowGroupFrame::~nsTableRowGroupFrame() { } -NS_QUERYFRAME_HEAD(nsTableRowGroupFrame) - NS_QUERYFRAME_ENTRY(nsTableRowGroupFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) +NS_IMETHODIMP +nsTableRowGroupFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + NS_PRECONDITION(aInstancePtr, "null out param"); + + static NS_DEFINE_IID(kITableRowGroupIID, NS_ITABLEROWGROUPFRAME_IID); + if (aIID.Equals(kITableRowGroupIID)) { + *aInstancePtr = (void*)this; + return NS_OK; + } + + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); +} /* virtual */ PRBool nsTableRowGroupFrame::IsContainingBlock() const diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 586f5f5a6e3..5319bf2e11a 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -72,6 +72,10 @@ struct nsRowGroupReflowState { ~nsRowGroupReflowState() {} }; +#define NS_ITABLEROWGROUPFRAME_IID \ +{ 0xe940e7bc, 0xb534, 0x11d2, \ + { 0x95, 0xa2, 0x0, 0x60, 0xb0, 0xc3, 0x44, 0x14 } } + // use the following bits from nsFrame's frame state // thead or tfoot should be repeated on every printed page @@ -97,8 +101,7 @@ class nsTableRowGroupFrame , public nsILineIterator { public: - NS_DECLARE_FRAME_ACCESSOR(nsTableRowGroupFrame) - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID &aIID, void **aInstancePtr); /** instantiate a new instance of nsTableRowFrame. * @param aPresShell the pres shell for this frame diff --git a/layout/xul/base/public/nsIMenuFrame.h b/layout/xul/base/public/nsIMenuFrame.h index 68419dd5e41..c17ff03e780 100644 --- a/layout/xul/base/public/nsIMenuFrame.h +++ b/layout/xul/base/public/nsIMenuFrame.h @@ -38,15 +38,20 @@ #ifndef nsIMenuFrame_h___ #define nsIMenuFrame_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" // this interface exists solely because native themes need to call into it. // Only menu frames should implement it -class nsIMenuFrame -{ +// {212521C8-1509-4F41-ADDB-6A0B9356770F} +#define NS_IMENUFRAME_IID \ +{ 0x212521C8, 0x1509, 0x4F41, { 0xAD, 0xDB, 0x6A, 0x0B, 0x93, 0x56, 0x77, 0x0F } } + +class nsIMenuFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIMenuFrame) + + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMENUFRAME_IID) virtual PRBool IsOpen() = 0; virtual PRBool IsMenu() = 0; @@ -54,5 +59,7 @@ public: virtual PRBool IsOnActiveMenuBar() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIMenuFrame, NS_IMENUFRAME_IID) + #endif diff --git a/layout/xul/base/public/nsIScrollbarMediator.h b/layout/xul/base/public/nsIScrollbarMediator.h index 465e1242abd..2b63802d0a2 100644 --- a/layout/xul/base/public/nsIScrollbarMediator.h +++ b/layout/xul/base/public/nsIScrollbarMediator.h @@ -40,24 +40,28 @@ #ifndef nsIScrollbarMediator_h___ #define nsIScrollbarMediator_h___ -#include "nsQueryFrame.h" +// {b589027f-271b-4c68-91df-04f139885e9a} +#define NS_ISCROLLBARMEDIATOR_IID \ +{ 0xb589027f, 0x271b, 0x4c68, { 0x91, 0xdf, 0x04, 0xf1, 0x39, 0x88, 0x5e, 0x9a } } -class nsIScrollbarFrame; +static NS_DEFINE_IID(kIScrollbarMediatorIID, NS_ISCROLLBARMEDIATOR_IID); + +class nsIScrollbarMediator : public nsISupports { -class nsIScrollbarMediator -{ public: - NS_DECLARE_FRAME_ACCESSOR(nsIScrollbarMediator) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCROLLBARMEDIATOR_IID) - // The nsIFrame aScrollbar argument below denotes the + // The nsISupports aScrollbar argument below denotes the // scrollbar that's firing the notification. It should be // where the same object as where nsIScrollbarFrame is implemented - NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) = 0; - NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) = 0; + NS_IMETHOD PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) = 0; + NS_IMETHOD ScrollbarButtonPressed(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) = 0; - NS_IMETHOD VisibilityChanged(PRBool aVisible) = 0; + NS_IMETHOD VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible) = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollbarMediator, NS_ISCROLLBARMEDIATOR_IID) + #endif diff --git a/layout/xul/base/src/grid/nsGrid.cpp b/layout/xul/base/src/grid/nsGrid.cpp index bcdcf661ece..b3b6020f9a9 100644 --- a/layout/xul/base/src/grid/nsGrid.cpp +++ b/layout/xul/base/src/grid/nsGrid.cpp @@ -290,11 +290,13 @@ nsGrid::FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns) while(child) { nsIBox* oldBox = child; - nsIScrollableFrame *scrollFrame = do_QueryFrame(child); + nsresult rv = NS_OK; + nsCOMPtr scrollFrame = do_QueryInterface(child, &rv); if (scrollFrame) { nsIFrame* scrolledFrame = scrollFrame->GetScrolledFrame(); NS_ASSERTION(scrolledFrame,"Error no scroll frame!!"); - child = do_QueryFrame(scrolledFrame); + if (NS_FAILED(CallQueryInterface(scrolledFrame, &child))) + child = nsnull; } nsCOMPtr layout; @@ -1297,7 +1299,7 @@ nsIBox* nsGrid::GetScrolledBox(nsIBox* aChild) { // first see if it is a scrollframe. If so walk down into it and get the scrolled child - nsIScrollableFrame *scrollFrame = do_QueryFrame(aChild); + nsCOMPtr scrollFrame = do_QueryInterface(aChild); if (scrollFrame) { nsIFrame* scrolledFrame = scrollFrame->GetScrolledFrame(); NS_ASSERTION(scrolledFrame,"Error no scroll frame!!"); @@ -1327,7 +1329,7 @@ nsGrid::GetScrollBox(nsIBox* aChild) // if it's a parent then the child passed does not // have a scroll frame immediately wrapped around it. while (parent) { - nsIScrollableFrame *scrollFrame = do_QueryFrame(parent); + nsCOMPtr scrollFrame = do_QueryInterface(parent); // scrollframe? Yep return it. if (scrollFrame) return parent; diff --git a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index 160826de2b2..0f6e58a485e 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -269,7 +269,7 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent)); while (parentBox) { nsIBox* scrollbox = nsGrid::GetScrollBox(parentBox); - nsIScrollableFrame *scrollable = do_QueryFrame(scrollbox); + nsCOMPtr scrollable = do_QueryInterface(scrollbox); if (scrollable) { nsMargin scrollbarSizes = scrollable->GetActualScrollbarSizes(); diff --git a/layout/xul/base/src/nsBoxObject.cpp b/layout/xul/base/src/nsBoxObject.cpp index 083234cee1d..159fe2922cf 100644 --- a/layout/xul/base/src/nsBoxObject.cpp +++ b/layout/xul/base/src/nsBoxObject.cpp @@ -314,6 +314,16 @@ nsBoxObject::GetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports** NS_IMETHODIMP nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue) { +#ifdef DEBUG + if (aValue) { + nsIFrame* frame; + CallQueryInterface(aValue, &frame); + NS_ASSERTION(!frame, + "Calling SetPropertyAsSupports on a frame. Prepare to crash " + "and be exploited any time some random website decides to " + "exploit you"); + } +#endif NS_ENSURE_ARG(aPropertyName && *aPropertyName); if (!mPropertyTable) { diff --git a/layout/xul/base/src/nsContainerBoxObject.cpp b/layout/xul/base/src/nsContainerBoxObject.cpp index 982d3834f07..e4192748aa8 100644 --- a/layout/xul/base/src/nsContainerBoxObject.cpp +++ b/layout/xul/base/src/nsContainerBoxObject.cpp @@ -83,7 +83,9 @@ NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult) nsIFrame *frame = GetFrame(PR_FALSE); if (frame) { - nsIFrameFrame *frame_frame = do_QueryFrame(frame); + nsIFrameFrame *frame_frame = nsnull; + CallQueryInterface(frame, &frame_frame); + if (frame_frame) { // Ok, the frame for mContent is a nsIFrameFrame, it knows how // to reach the docshell, so ask it... diff --git a/layout/xul/base/src/nsDocElementBoxFrame.cpp b/layout/xul/base/src/nsDocElementBoxFrame.cpp index f2d80a89553..9d5d74205fd 100644 --- a/layout/xul/base/src/nsDocElementBoxFrame.cpp +++ b/layout/xul/base/src/nsDocElementBoxFrame.cpp @@ -72,7 +72,7 @@ public: nsDocElementBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext) :nsBoxFrame(aShell, aContext, PR_TRUE) {} - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED // nsIAnonymousContentCreator virtual nsresult CreateAnonymousContent(nsTArray& aElements); @@ -148,9 +148,21 @@ nsDocElementBoxFrame::CreateAnonymousContent(nsTArray& aElements) return NS_OK; } -NS_QUERYFRAME_HEAD(nsDocElementBoxFrame) - NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +NS_IMETHODIMP_(nsrefcnt) +nsDocElementBoxFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsDocElementBoxFrame::Release(void) +{ + return NS_OK; +} + +NS_INTERFACE_MAP_BEGIN(nsDocElementBoxFrame) + NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) #ifdef DEBUG NS_IMETHODIMP diff --git a/layout/xul/base/src/nsIRootBox.h b/layout/xul/base/src/nsIRootBox.h index 142a284bd6e..d6693b4ca23 100644 --- a/layout/xul/base/src/nsIRootBox.h +++ b/layout/xul/base/src/nsIRootBox.h @@ -40,15 +40,21 @@ #ifndef nsIRootBox_h___ #define nsIRootBox_h___ -#include "nsQueryFrame.h" +#include "nsISupports.h" class nsPopupSetFrame; class nsIContent; class nsIPresShell; -class nsIRootBox -{ +// {9777EC2A-9A46-4D01-8CEB-B9CEB2C262A5} +#define NS_IROOTBOX_IID \ +{ 0x9777EC2A, 0x9A46, 0x4D01, \ + { 0x8C, 0xEB, 0xB9, 0xCE, 0xB2, 0xC2, 0x62, 0xA5 } } + + +class nsIRootBox : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIRootBox) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IROOTBOX_IID) virtual nsPopupSetFrame* GetPopupSetFrame() = 0; virtual void SetPopupSetFrame(nsPopupSetFrame* aPopupSet) = 0; @@ -62,5 +68,7 @@ public: static nsIRootBox* GetRootBox(nsIPresShell* aShell); }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIRootBox, NS_IROOTBOX_IID) + #endif diff --git a/layout/xul/base/src/nsIScrollbarFrame.h b/layout/xul/base/src/nsIScrollbarFrame.h index 74e5576d7f9..c0e48339b0a 100644 --- a/layout/xul/base/src/nsIScrollbarFrame.h +++ b/layout/xul/base/src/nsIScrollbarFrame.h @@ -39,14 +39,18 @@ #ifndef nsIScrollbarFrame_h___ #define nsIScrollbarFrame_h___ -#include "nsQueryFrame.h" +// {660e5ed6-1cf7-47ff-b094-c588c21986e8} +#define NS_ISCROLLBARFRAME_IID \ +{ 0x660e5ed6, 0x1cf7, 0x47ff, { 0xb0, 0x94, 0xc5, 0x88, 0xc2, 0x19, 0x86, 0xe8 } } + +static NS_DEFINE_IID(kIScrollbarFrameIID, NS_ISCROLLBARFRAME_IID); class nsIScrollbarMediator; -class nsIScrollbarFrame : public nsQueryFrame -{ +class nsIScrollbarFrame : public nsISupports { + public: - NS_DECLARE_FRAME_ACCESSOR(nsIScrollbarFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCROLLBARFRAME_IID) // Sets the scrollbar mediator content. We will try to get its primary frame // and then QI that to nsIScrollbarMediator as necessary. @@ -56,4 +60,6 @@ public: virtual nsIScrollbarMediator* GetScrollbarMediator() = 0; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollbarFrame, NS_ISCROLLBARFRAME_IID) + #endif diff --git a/layout/xul/base/src/nsListBoxBodyFrame.cpp b/layout/xul/base/src/nsListBoxBodyFrame.cpp index 31055c6d740..6e8cf9fce2f 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -206,10 +206,32 @@ nsListBoxBodyFrame::~nsListBoxBodyFrame() } -NS_QUERYFRAME_HEAD(nsListBoxBodyFrame) - NS_QUERYFRAME_ENTRY(nsIScrollbarMediator) - NS_QUERYFRAME_ENTRY(nsListBoxBodyFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +////////// nsISupports ///////////////// + +NS_IMETHODIMP_(nsrefcnt) +nsListBoxBodyFrame::AddRef(void) +{ + return 2; +} + +NS_IMETHODIMP_(nsrefcnt) +nsListBoxBodyFrame::Release(void) +{ + return 1; +} + +// +// QueryInterface +// +NS_INTERFACE_MAP_BEGIN(nsListBoxBodyFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollbarMediator) + if (aIID.Equals(NS_GET_IID(nsListBoxBodyFrame))) { + *aInstancePtr = this; + return NS_OK; + } + else +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) + ////////// nsIFrame ///////////////// @@ -226,7 +248,8 @@ nsListBoxBodyFrame::Init(nsIContent* aContent, scrollableView->SetScrollProperties(NS_SCROLL_PROPERTY_ALWAYS_BLIT); nsIBox* verticalScrollbar = scrollFrame->GetScrollbarBox(PR_TRUE); if (verticalScrollbar) { - nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(verticalScrollbar); + nsIScrollbarFrame* scrollbarFrame = nsnull; + CallQueryInterface(verticalScrollbar, &scrollbarFrame); scrollbarFrame->SetScrollbarMediatorContent(GetContent()); } } @@ -358,7 +381,7 @@ nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState) ///////////// nsIScrollbarMediator /////////////// NS_IMETHODIMP -nsListBoxBodyFrame::PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) +nsListBoxBodyFrame::PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) { if (mScrolling || mRowHeight == 0) return NS_OK; @@ -410,7 +433,7 @@ nsListBoxBodyFrame::PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldI } NS_IMETHODIMP -nsListBoxBodyFrame::VisibilityChanged(PRBool aVisible) +nsListBoxBodyFrame::VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible) { if (mRowHeight == 0) return NS_OK; @@ -428,7 +451,7 @@ nsListBoxBodyFrame::VisibilityChanged(PRBool aVisible) } NS_IMETHODIMP -nsListBoxBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) +nsListBoxBodyFrame::ScrollbarButtonPressed(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) { if (aOldIndex == aNewIndex) return NS_OK; diff --git a/layout/xul/base/src/nsListBoxBodyFrame.h b/layout/xul/base/src/nsListBoxBodyFrame.h index 9809ef6ad49..9647206c5d4 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.h +++ b/layout/xul/base/src/nsListBoxBodyFrame.h @@ -51,6 +51,10 @@ #include "nsThreadUtils.h" #include "nsPIBoxObject.h" +#define NS_LISTBOXBODYFRAME_IID \ +{ 0x6e0acf13, 0x0b07, 0x481d, \ + { 0xa3, 0x39, 0x4c, 0xb6, 0x44, 0xbc, 0x1b, 0xd8 } } + class nsListScrollSmoother; nsIFrame* NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, @@ -65,9 +69,9 @@ class nsListBoxBodyFrame : public nsBoxFrame, virtual ~nsListBoxBodyFrame(); public: - NS_DECLARE_FRAME_ACCESSOR(nsListBoxBodyFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_LISTBOXBODYFRAME_IID) - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS // non-virtual nsIListBoxObject nsresult GetRowCount(PRInt32 *aResult); @@ -93,9 +97,9 @@ public: NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType); // nsIScrollbarMediator - NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex); - NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex); - NS_IMETHOD VisibilityChanged(PRBool aVisible); + NS_IMETHOD PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex); + NS_IMETHOD ScrollbarButtonPressed(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex); + NS_IMETHOD VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible); // nsIReflowCallback virtual PRBool ReflowFinished(); @@ -222,4 +226,6 @@ protected: nsCOMPtr mBoxObject; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsListBoxBodyFrame, NS_LISTBOXBODYFRAME_IID) + #endif // nsListBoxBodyFrame_h diff --git a/layout/xul/base/src/nsListBoxObject.cpp b/layout/xul/base/src/nsListBoxObject.cpp index f87a48d3f30..2fb640abf04 100644 --- a/layout/xul/base/src/nsListBoxObject.cpp +++ b/layout/xul/base/src/nsListBoxObject.cpp @@ -206,7 +206,8 @@ nsListBoxObject::GetListBoxBody(PRBool aFlush) frame = shell->GetPrimaryFrameFor(content); if (!frame) return nsnull; - nsIScrollableFrame* scrollFrame = do_QueryFrame(frame); + nsIScrollableFrame* scrollFrame; + CallQueryInterface(frame, &scrollFrame); if (!scrollFrame) return nsnull; @@ -216,7 +217,8 @@ nsListBoxObject::GetListBoxBody(PRBool aFlush) return nsnull; // It's a frame. Refcounts are irrelevant. - nsListBoxBodyFrame* listBoxBody = do_QueryFrame(yeahBaby); + nsListBoxBodyFrame* listBoxBody = nsnull; + CallQueryInterface(yeahBaby, &listBoxBody); NS_ENSURE_TRUE(listBoxBody && listBoxBody->SetBoxObject(this), nsnull); diff --git a/layout/xul/base/src/nsListItemFrame.cpp b/layout/xul/base/src/nsListItemFrame.cpp index 32249f3a98c..f2922bc106c 100644 --- a/layout/xul/base/src/nsListItemFrame.cpp +++ b/layout/xul/base/src/nsListItemFrame.cpp @@ -44,6 +44,21 @@ #include "nsGkAtoms.h" #include "nsDisplayList.h" +NS_IMETHODIMP_(nsrefcnt) +nsListItemFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsListItemFrame::Release(void) +{ + return NS_OK; +} + +NS_INTERFACE_MAP_BEGIN(nsListItemFrame) +NS_INTERFACE_MAP_END_INHERITING(nsGridRowLeafFrame) + nsListItemFrame::nsListItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot, diff --git a/layout/xul/base/src/nsListItemFrame.h b/layout/xul/base/src/nsListItemFrame.h index af017ebb8ac..ac972e05525 100644 --- a/layout/xul/base/src/nsListItemFrame.h +++ b/layout/xul/base/src/nsListItemFrame.h @@ -48,6 +48,8 @@ nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell, class nsListItemFrame : public nsGridRowLeafFrame { public: + NS_DECL_ISUPPORTS + friend nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell, nsStyleContext *aContext, PRBool aIsRoot, diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 1f29a926886..4d841075d2c 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -168,10 +168,25 @@ NS_NewMenuFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFl return it; } -NS_QUERYFRAME_HEAD(nsMenuFrame) - NS_QUERYFRAME_ENTRY(nsIMenuFrame) - NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +NS_IMETHODIMP_(nsrefcnt) +nsMenuFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsMenuFrame::Release(void) +{ + return NS_OK; +} + +// +// QueryInterface +// +NS_INTERFACE_MAP_BEGIN(nsMenuFrame) + NS_INTERFACE_MAP_ENTRY(nsIMenuFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollableViewProvider) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) // // nsMenuFrame cntr @@ -755,7 +770,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState) nsRect bounds(mPopupFrame->GetRect()); - nsIScrollableFrame *scrollframe = do_QueryFrame(child); + nsCOMPtr scrollframe(do_QueryInterface(child)); if (scrollframe && scrollframe->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { if (bounds.height < prefSize.height) { diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index ecee80248ac..6e6c750fcb1 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -110,7 +110,7 @@ class nsMenuFrame : public nsBoxFrame, public: nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS // nsIBox NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 43e29022269..374fcc141f3 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -351,7 +351,7 @@ nsMenuPopupFrame::AdjustView() // if the popup has just opened, make sure the scrolled window is at 0,0 if (mIsOpenChanged) { nsIBox* child = GetChildBox(); - nsIScrollableFrame *scrollframe = do_QueryFrame(child); + nsCOMPtr scrollframe(do_QueryInterface(child)); if (scrollframe) scrollframe->ScrollTo(nsPoint(0,0)); } @@ -1119,8 +1119,9 @@ PRBool nsMenuPopupFrame::ConsumeOutsideClicks() static nsIScrollableView* GetScrollableViewForFrame(nsIFrame* aFrame) { - nsIScrollableFrame* sf = do_QueryFrame(aFrame); - if (!sf) + nsIScrollableFrame* sf; + nsresult rv = CallQueryInterface(aFrame, &sf); + if (NS_FAILED(rv)) return nsnull; return sf->GetScrollableView(); } diff --git a/layout/xul/base/src/nsPopupSetFrame.cpp b/layout/xul/base/src/nsPopupSetFrame.cpp index b28b12fc4e0..7eea4e62211 100644 --- a/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/layout/xul/base/src/nsPopupSetFrame.cpp @@ -180,7 +180,7 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState) nsRect bounds(popupChild->GetRect()); - nsIScrollableFrame *scrollframe = do_QueryFrame(child); + nsCOMPtr scrollframe = do_QueryInterface(child); if (scrollframe && scrollframe->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) { // if our pref height @@ -365,8 +365,8 @@ nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer"); // Have the child frame list - nsIFrameDebug* frameDebug = do_QueryFrame(kid); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(out, aIndent + 1); } kid = kid->GetNextSibling(); @@ -392,8 +392,9 @@ nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const fputs(" <\n", out); ++aIndent; for (nsPopupFrameList* l = mPopupList; l; l = l->mNextPopup) { - nsIFrameDebug* frameDebug = do_QueryFrame(l->mPopupFrame); - if (frameDebug) { + nsIFrameDebug* frameDebug; + if (l->mPopupFrame && + NS_SUCCEEDED(CallQueryInterface(l->mPopupFrame, &frameDebug))) { frameDebug->List(out, aIndent); } } diff --git a/layout/xul/base/src/nsRootBoxFrame.cpp b/layout/xul/base/src/nsRootBoxFrame.cpp index ace9dfe35a6..47c013331b0 100644 --- a/layout/xul/base/src/nsRootBoxFrame.cpp +++ b/layout/xul/base/src/nsRootBoxFrame.cpp @@ -69,7 +69,10 @@ nsIRootBox::GetRootBox(nsIPresShell* aShell) rootFrame = rootFrame->GetFirstChild(nsnull); } - nsIRootBox* rootBox = do_QueryFrame(rootFrame); + nsIRootBox* rootBox = nsnull; + if (rootFrame) { + CallQueryInterface(rootFrame, &rootBox); + } return rootBox; } @@ -80,7 +83,7 @@ public: nsRootBoxFrame(nsIPresShell* aShell, nsStyleContext *aContext); - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS_INHERITED virtual nsPopupSetFrame* GetPopupSetFrame(); virtual void SetPopupSetFrame(nsPopupSetFrame* aPopupSet); @@ -330,9 +333,21 @@ nsRootBoxFrame::RemoveTooltipSupport(nsIContent* aNode) return NS_ERROR_NOT_IMPLEMENTED; } -NS_QUERYFRAME_HEAD(nsRootBoxFrame) - NS_QUERYFRAME_ENTRY(nsIRootBox) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +NS_IMETHODIMP_(nsrefcnt) +nsRootBoxFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsRootBoxFrame::Release(void) +{ + return NS_OK; +} + +NS_INTERFACE_MAP_BEGIN(nsRootBoxFrame) + NS_INTERFACE_MAP_ENTRY(nsIRootBox) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) #ifdef DEBUG NS_IMETHODIMP diff --git a/layout/xul/base/src/nsScrollBoxObject.cpp b/layout/xul/base/src/nsScrollBoxObject.cpp index 5b740a69d21..fcb6972f6a2 100644 --- a/layout/xul/base/src/nsScrollBoxObject.cpp +++ b/layout/xul/base/src/nsScrollBoxObject.cpp @@ -125,8 +125,8 @@ static nsIFrame* GetScrolledBox(nsBoxObject* aScrollBox) { nsIFrame* frame = aScrollBox->GetFrame(PR_FALSE); if (!frame) return nsnull; - nsIScrollableFrame* scrollFrame = do_QueryFrame(frame); - if (!scrollFrame) { + nsIScrollableFrame* scrollFrame; + if (NS_FAILED(CallQueryInterface(frame, &scrollFrame))) { NS_WARNING("nsIScrollBoxObject attached to something that's not a scroll frame!"); return nsnull; } @@ -435,8 +435,8 @@ nsScrollBoxObject::GetScrollableView() if (!frame) return nsnull; - nsIScrollableFrame* scrollFrame = do_QueryFrame(frame); - if (!scrollFrame) + nsIScrollableFrame* scrollFrame; + if (NS_FAILED(CallQueryInterface(frame, &scrollFrame))) return nsnull; nsIScrollableView* scrollingView = scrollFrame->GetScrollableView(); diff --git a/layout/xul/base/src/nsScrollbarButtonFrame.cpp b/layout/xul/base/src/nsScrollbarButtonFrame.cpp index 10c0d2fab88..19e930dbf6d 100644 --- a/layout/xul/base/src/nsScrollbarButtonFrame.cpp +++ b/layout/xul/base/src/nsScrollbarButtonFrame.cpp @@ -230,7 +230,8 @@ nsScrollbarButtonFrame::DoButtonAction(PRBool aSmoothScroll) else if (curpos > maxpos) curpos = maxpos; - nsIScrollbarFrame* sb = do_QueryFrame(scrollbar); + nsIScrollbarFrame* sb; + CallQueryInterface(scrollbar, &sb); if (sb) { nsIScrollbarMediator* m = sb->GetScrollbarMediator(); if (m) { diff --git a/layout/xul/base/src/nsScrollbarFrame.cpp b/layout/xul/base/src/nsScrollbarFrame.cpp index 95d7738ede7..15641fc4e00 100644 --- a/layout/xul/base/src/nsScrollbarFrame.cpp +++ b/layout/xul/base/src/nsScrollbarFrame.cpp @@ -59,9 +59,13 @@ NS_NewScrollbarFrame (nsIPresShell* aPresShell, nsStyleContext* aContext) return new (aPresShell) nsScrollbarFrame (aPresShell, aContext); } // NS_NewScrollbarFrame -NS_QUERYFRAME_HEAD(nsScrollbarFrame) - NS_QUERYFRAME_ENTRY(nsIScrollbarFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) +// +// QueryInterface +// +NS_INTERFACE_MAP_BEGIN(nsScrollbarFrame) + NS_INTERFACE_MAP_ENTRY(nsIScrollbarFrame) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) + NS_IMETHODIMP nsScrollbarFrame::Init(nsIContent* aContent, @@ -131,7 +135,8 @@ nsScrollbarFrame::AttributeChanged(PRInt32 aNameSpaceID, if (!parent) return rv; - nsIScrollableFrame* scrollable = do_QueryFrame(parent); + nsIScrollableFrame* scrollable = nsnull; + parent->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollable); if (!scrollable) return rv; @@ -189,13 +194,15 @@ nsScrollbarFrame::GetScrollbarMediator() // check if the frame is a scroll frame. If so, get the scrollable frame // inside it. - nsIScrollableFrame* scrollFrame = do_QueryFrame(f); + nsIScrollableFrame* scrollFrame; + CallQueryInterface(f, &scrollFrame); if (scrollFrame) { f = scrollFrame->GetScrolledFrame(); if (!f) return nsnull; } - nsIScrollbarMediator* sbm = do_QueryFrame(f); + nsIScrollbarMediator* sbm; + CallQueryInterface(f, &sbm); return sbm; } diff --git a/layout/xul/base/src/nsScrollbarFrame.h b/layout/xul/base/src/nsScrollbarFrame.h index 947a2cec1e0..b7c9f84b3fb 100644 --- a/layout/xul/base/src/nsScrollbarFrame.h +++ b/layout/xul/base/src/nsScrollbarFrame.h @@ -42,6 +42,7 @@ #ifndef nsScrollbarFrame_h__ #define nsScrollbarFrame_h__ + #include "nsBoxFrame.h" #include "nsIScrollbarFrame.h" @@ -67,9 +68,11 @@ public: nsIAtom* aAttribute, PRInt32 aModType); - NS_DECL_QUERYFRAME + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } - NS_IMETHOD HandlePress(nsPresContext* aPresContext, + NS_IMETHOD HandlePress(nsPresContext* aPresContext, nsGUIEvent * aEvent, nsEventStatus* aEventStatus); diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index a1557d67189..82577b10a3f 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -259,7 +259,8 @@ nsSliderFrame::AttributeChanged(PRInt32 aNameSpaceID, current = max; // set the new position and notify observers - nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox); + nsIScrollbarFrame* scrollbarFrame; + CallQueryInterface(scrollbarBox, &scrollbarFrame); if (scrollbarFrame) { nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator(); if (mediator) { @@ -766,7 +767,9 @@ nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, PRInt32 aNewPo { nsCOMPtr scrollbar = aScrollbar; nsIBox* scrollbarBox = GetScrollbar(); - nsIScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox); + nsIScrollbarFrame* scrollbarFrame; + CallQueryInterface(scrollbarBox, &scrollbarFrame); + if (scrollbarFrame) { // See if we have a mediator. nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator(); diff --git a/layout/xul/base/src/nsSplitterFrame.cpp b/layout/xul/base/src/nsSplitterFrame.cpp index f353d581b2e..8e2c19a4e06 100644 --- a/layout/xul/base/src/nsSplitterFrame.cpp +++ b/layout/xul/base/src/nsSplitterFrame.cpp @@ -280,6 +280,13 @@ nsSplitterFrame::Destroy() } +// +// QueryInterface +// +NS_INTERFACE_MAP_BEGIN(nsSplitterFrame) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) + + NS_IMETHODIMP nsSplitterFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) diff --git a/layout/xul/base/src/nsSplitterFrame.h b/layout/xul/base/src/nsSplitterFrame.h index 748253955ac..58cbe36f185 100644 --- a/layout/xul/base/src/nsSplitterFrame.h +++ b/layout/xul/base/src/nsSplitterFrame.h @@ -76,6 +76,10 @@ public: NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + NS_IMETHOD_(nsrefcnt) AddRef(void) { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release(void) { return NS_OK; } + NS_IMETHOD HandlePress(nsPresContext* aPresContext, nsGUIEvent * aEvent, nsEventStatus* aEventStatus); diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 87848975174..21f7a707359 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -134,11 +134,19 @@ NS_NewTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) } // NS_NewTreeFrame -NS_QUERYFRAME_HEAD(nsTreeBodyFrame) - NS_QUERYFRAME_ENTRY(nsICSSPseudoComparator) - NS_QUERYFRAME_ENTRY(nsIScrollbarMediator) - NS_QUERYFRAME_ENTRY(nsTreeBodyFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame) +// +// QueryInterface +// + +NS_INTERFACE_MAP_BEGIN(nsTreeBodyFrame) + NS_INTERFACE_MAP_ENTRY(nsICSSPseudoComparator) + NS_INTERFACE_MAP_ENTRY(nsIScrollbarMediator) + if (aIID.Equals(NS_GET_IID(nsTreeBodyFrame))) { + *aInstancePtr = this; + return NS_OK; + } + else +NS_INTERFACE_MAP_END_INHERITING(nsLeafBoxFrame) // Constructor nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -171,6 +179,18 @@ nsTreeBodyFrame::~nsTreeBodyFrame() delete mSlots; } +NS_IMETHODIMP_(nsrefcnt) +nsTreeBodyFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsTreeBodyFrame::Release(void) +{ + return NS_OK; +} + static void GetBorderPadding(nsStyleContext* aContext, nsMargin& aMargin) { @@ -843,14 +863,16 @@ static void FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult) { if (!aResult->mColumnsScrollableView) { - nsIScrollableFrame* f = do_QueryFrame(aCurrFrame); + nsIScrollableFrame* f; + CallQueryInterface(aCurrFrame, &f); if (f) { aResult->mColumnsFrame = aCurrFrame; aResult->mColumnsScrollableView = f->GetScrollableView(); } } - nsIScrollbarFrame *sf = do_QueryFrame(aCurrFrame); + nsIScrollbarFrame *sf = nsnull; + CallQueryInterface(aCurrFrame, &sf); if (sf) { if (!aCurrFrame->IsHorizontal()) { if (!aResult->mVScrollbar) { @@ -887,12 +909,14 @@ nsTreeBodyFrame::ScrollParts nsTreeBodyFrame::GetScrollParts() FindScrollParts(treeFrame, &result); if (result.mHScrollbar) { result.mHScrollbar->SetScrollbarMediatorContent(GetContent()); - nsIFrame* f = do_QueryFrame(result.mHScrollbar); + nsIFrame* f; + CallQueryInterface(result.mHScrollbar, &f); result.mHScrollbarContent = f->GetContent(); } if (result.mVScrollbar) { result.mVScrollbar->SetScrollbarMediatorContent(GetContent()); - nsIFrame* f = do_QueryFrame(result.mVScrollbar); + nsIFrame* f; + CallQueryInterface(result.mVScrollbar, &f); result.mVScrollbarContent = f->GetContent(); } } @@ -4107,11 +4131,16 @@ nsTreeBodyFrame::ScrollHorzInternal(const ScrollParts& aParts, PRInt32 aPosition } NS_IMETHODIMP -nsTreeBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) +nsTreeBodyFrame::ScrollbarButtonPressed(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex) { + // Determine which scrollbar we're talking about + nsIScrollbarFrame* sf = nsnull; + CallQueryInterface(aScrollbar, &sf); + NS_ASSERTION(sf, "scrollbar has no frame"); + ScrollParts parts = GetScrollParts(); - if (aScrollbar == parts.mVScrollbar) { + if (sf == parts.mVScrollbar) { if (aNewIndex > aOldIndex) ScrollToRowInternal(parts, mTopRowIndex+1); else if (aNewIndex < aOldIndex) @@ -4126,21 +4155,26 @@ nsTreeBodyFrame::ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 a } NS_IMETHODIMP -nsTreeBodyFrame::PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) +nsTreeBodyFrame::PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex) { ScrollParts parts = GetScrollParts(); if (aOldIndex == aNewIndex) return NS_OK; + // Determine which scrollbar we're talking about + nsIScrollbarFrame* sf = nsnull; + CallQueryInterface(aScrollbar, &sf); + NS_ASSERTION(sf, "scrollbar has no frame"); + // Vertical Scrollbar - if (parts.mVScrollbar == aScrollbar) { + if (parts.mVScrollbar == sf) { nscoord rh = nsPresContext::AppUnitsToIntCSSPixels(mRowHeight); nscoord newrow = aNewIndex/rh; ScrollInternal(parts, newrow); // Horizontal Scrollbar - } else if (parts.mHScrollbar == aScrollbar) { + } else if (parts.mHScrollbar == sf) { ScrollHorzInternal(parts, aNewIndex); } diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h index 43429cf5305..895fa568017 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h @@ -76,6 +76,10 @@ struct nsTreeImageCacheEntry nsCOMPtr listener; }; +#define NS_TREEBODYFRAME_IID \ +{ 0xe35eb017, 0xa679, 0x4d4d, \ + { 0x83, 0xda, 0xce, 0xd6, 0x20, 0xae, 0x9e, 0x66 } } + // The actual frame that paints the cells and rows. class NS_FINAL_CLASS nsTreeBodyFrame : public nsLeafBoxFrame @@ -87,9 +91,9 @@ public: nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); ~nsTreeBodyFrame(); - NS_DECLARE_FRAME_ACCESSOR(nsTreeBodyFrame) + NS_DECLARE_STATIC_IID_ACCESSOR(NS_TREEBODYFRAME_IID) - NS_DECL_QUERYFRAME + NS_DECL_ISUPPORTS // non-virtual signatures like nsITreeBodyFrame nsresult GetColumns(nsITreeColumns **aColumns); @@ -146,9 +150,9 @@ public: NS_IMETHOD PseudoMatches(nsIAtom* aTag, nsCSSSelector* aSelector, PRBool* aResult); // nsIScrollbarMediator - NS_IMETHOD PositionChanged(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex); - NS_IMETHOD ScrollbarButtonPressed(nsIScrollbarFrame* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex); - NS_IMETHOD VisibilityChanged(PRBool aVisible) { Invalidate(); return NS_OK; } + NS_IMETHOD PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex); + NS_IMETHOD ScrollbarButtonPressed(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32 aNewIndex); + NS_IMETHOD VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible) { Invalidate(); return NS_OK; } // Overridden from nsIFrame to cache our pres context. NS_IMETHOD Init(nsIContent* aContent, @@ -599,4 +603,6 @@ protected: // Data Members nsRevocableEventPtr mScrollEvent; }; // class nsTreeBodyFrame +NS_DEFINE_STATIC_IID_ACCESSOR(nsTreeBodyFrame, NS_TREEBODYFRAME_IID) + #endif diff --git a/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp b/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp index 73f2be612a7..a1942a5008a 100644 --- a/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp @@ -131,7 +131,8 @@ nsTreeBoxObject::GetTreeBody() return nsnull; // Make sure that the treebodyframe has a pointer to |this|. - nsTreeBodyFrame *treeBody = do_QueryFrame(frame); + nsTreeBodyFrame *treeBody = nsnull; + CallQueryInterface(frame, &treeBody); NS_ENSURE_TRUE(treeBody && treeBody->GetTreeBoxObject() == this, nsnull); mTreeBody = treeBody; diff --git a/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index b302744b767..5a6703c5847 100644 --- a/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -65,6 +65,24 @@ NS_NewTreeColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, return new (aPresShell) nsTreeColFrame(aPresShell, aContext, aIsRoot, aLayoutManager); } // NS_NewTreeColFrame +NS_IMETHODIMP_(nsrefcnt) +nsTreeColFrame::AddRef(void) +{ + return NS_OK; +} + +NS_IMETHODIMP_(nsrefcnt) +nsTreeColFrame::Release(void) +{ + return NS_OK; +} + +// +// QueryInterface +// +NS_INTERFACE_MAP_BEGIN(nsTreeColFrame) +NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame) + // Destructor nsTreeColFrame::~nsTreeColFrame() { diff --git a/layout/xul/base/src/tree/src/nsTreeColFrame.h b/layout/xul/base/src/tree/src/nsTreeColFrame.h index aa6d5e03248..26bf0260417 100644 --- a/layout/xul/base/src/tree/src/nsTreeColFrame.h +++ b/layout/xul/base/src/tree/src/nsTreeColFrame.h @@ -48,6 +48,8 @@ nsIFrame* NS_NewTreeColFrame(nsIPresShell* aPresShell, class nsTreeColFrame : public nsBoxFrame { public: + NS_DECL_ISUPPORTS + nsTreeColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = nsnull, diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 8ef946f2868..b837bb9742c 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -301,7 +301,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, aWidgetType == NS_THEME_MENUSEPARATOR || aWidgetType == NS_THEME_MENUARROW) { PRBool isTopLevel = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsIMenuFrame *menuFrame; + CallQueryInterface(aFrame, &menuFrame); + if (menuFrame) { isTopLevel = menuFrame->IsOnMenuBar(); } diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index b24c2a15f65..c8eb752d9c7 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -130,7 +130,9 @@ static void GetNativeRect(const nsRect& aSrc, RECT& aDst) static PRBool IsTopLevelMenu(nsIFrame *aFrame) { PRBool isTopLevel(PR_FALSE); - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsIMenuFrame *menuFrame(nsnull); + CallQueryInterface(aFrame, &menuFrame); + if (menuFrame) { isTopLevel = menuFrame->IsOnMenuBar(); } @@ -815,7 +817,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, if (nsUXThemeData::sIsVistaOrLater) { if (isHTML) { - nsIComboboxControlFrame* ccf = do_QueryFrame(aFrame); + nsIComboboxControlFrame* ccf = nsnull; + CallQueryInterface(aFrame, &ccf); if (ccf && ccf->IsDroppedDown()) { /* Hover is propagated, but we need to know whether we're * hovering just the combobox frame, not the dropdown frame. @@ -853,7 +856,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, PRBool isTopLevel = PR_FALSE; PRBool isOpen = PR_FALSE; PRBool isHover = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsIMenuFrame *menuFrame; + CallQueryInterface(aFrame, &menuFrame); isTopLevel = IsTopLevelMenu(aFrame); @@ -2038,7 +2042,8 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 PRBool isTopLevel = PR_FALSE; PRBool isOpen = PR_FALSE; PRBool isContainer = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsIMenuFrame *menuFrame = nsnull; + CallQueryInterface(aFrame, &menuFrame); // We indicate top-level-ness using aPart. 0 is a normal menu item, // 1 is a top-level menu item. The state of the item is composed of