Bug 341245, Remove some unused box object related interfaces, r+sr=roc

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-07-13 09:02:05 +00:00
parent 672343880e
commit 375bcc004f
31 changed files with 225 additions and 631 deletions

View File

@ -3247,12 +3247,10 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
nsCAutoString contractID("@mozilla.org/layout/xul-boxobject");
if (namespaceID == kNameSpaceID_XUL) {
if (tag == nsXULAtoms::browser)
contractID += "-browser";
else if (tag == nsXULAtoms::editor)
contractID += "-editor";
else if (tag == nsXULAtoms::iframe)
contractID += "-iframe";
if (tag == nsXULAtoms::browser ||
tag == nsXULAtoms::editor ||
tag == nsXULAtoms::iframe)
contractID += "-container";
else if (tag == nsXULAtoms::menu)
contractID += "-menu";
else if (tag == nsXULAtoms::popup ||

View File

@ -165,17 +165,10 @@
#define NS_POPUPBOXOBJECT_CID \
{ 0x6c392c62, 0x1ab1, 0x4de7, { 0xbf, 0xc6, 0xed, 0x4f, 0x9f, 0xc7, 0x74, 0x9a } }
// {31246420-A2F7-4933-AE71-79BBD5D94B04}
#define NS_BROWSERBOXOBJECT_CID \
{ 0x31246420, 0xa2f7, 0x4933, { 0xae, 0x71, 0x79, 0xbb, 0xd5, 0xd9, 0x4b, 0x4 } }
// {dca9d7c3-7b6a-4490-ad6d-2699a8d683cd}
#define NS_CONTAINERBOXOBJECT_CID \
{ 0xdca9d7c3, 0x7b6a, 0x4490, { 0xad, 0x6d, 0x26, 0x99, 0xa8, 0xd6, 0x83, 0xcd } }
// {8852AB1F-0AA2-46ef-A147-A908896E0D0B}
#define NS_EDITORBOXOBJECT_CID \
{ 0x8852ab1f, 0xaa2, 0x46ef, { 0xa1, 0x47, 0xa9, 0x8, 0x89, 0x6e, 0xd, 0xb } }
// {9580E69B-8FD6-414e-80CD-3A1821017646}
#define NS_IFRAMEBOXOBJECT_CID \
{ 0x9580e69b, 0x8fd6, 0x414e, { 0x80, 0xcd, 0x3a, 0x18, 0x21, 0x1, 0x76, 0x46 } }
// {3B581FD4-3497-426c-8F61-3658B971CB80}
#define NS_TREEBOXOBJECT_CID \

View File

@ -310,10 +310,8 @@ nsresult NS_NewBoxObject(nsIBoxObject** aResult);
nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
nsresult NS_NewEditorBoxObject(nsIBoxObject** aResult);
nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
nsresult NS_NewBrowserBoxObject(nsIBoxObject** aResult);
nsresult NS_NewIFrameBoxObject(nsIBoxObject** aResult);
nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
#endif
@ -378,11 +376,9 @@ MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
MAKE_CTOR(CreateNewBrowserBoxObject, nsIBoxObject, NS_NewBrowserBoxObject)
MAKE_CTOR(CreateNewEditorBoxObject, nsIBoxObject, NS_NewEditorBoxObject)
MAKE_CTOR(CreateNewIFrameBoxObject, nsIBoxObject, NS_NewIFrameBoxObject)
MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
#endif // MOZ_XUL
#ifndef MOZ_NO_INSPECTOR_APIS
@ -787,20 +783,10 @@ static const nsModuleComponentInfo gComponents[] = {
"@mozilla.org/layout/xul-boxobject-popup;1",
CreateNewPopupBoxObject },
{ "XUL Browser Box Object",
NS_BROWSERBOXOBJECT_CID,
"@mozilla.org/layout/xul-boxobject-browser;1",
CreateNewBrowserBoxObject },
{ "XUL Editor Box Object",
NS_EDITORBOXOBJECT_CID,
"@mozilla.org/layout/xul-boxobject-editor;1",
CreateNewEditorBoxObject },
{ "XUL Iframe Object",
NS_IFRAMEBOXOBJECT_CID,
"@mozilla.org/layout/xul-boxobject-iframe;1",
CreateNewIFrameBoxObject },
{ "Container Box Object",
NS_CONTAINERBOXOBJECT_CID,
"@mozilla.org/layout/xul-boxobject-container;1",
CreateNewContainerBoxObject },
{ "XUL ScrollBox Object",
NS_SCROLLBOXOBJECT_CID,

View File

@ -55,14 +55,13 @@ EXPORTS = \
XPIDLSRCS= nsIBoxObject.idl \
nsIScrollBoxObject.idl \
nsIBoxLayoutManager.idl \
nsIBoxPaintManager.idl \
nsIScrollBoxObject.idl \
nsIPopupBoxObject.idl \
nsIMenuBoxObject.idl \
nsIBrowserBoxObject.idl \
nsIIFrameBoxObject.idl \
nsIEditorBoxObject.idl \
nsIContainerBoxObject.idl \
nsIListBoxObject.idl \
$(NULL)

View File

@ -37,19 +37,14 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIBoxLayoutManager.idl"
#include "nsIBoxPaintManager.idl"
interface nsIDOMElement;
[scriptable, uuid(CAABF76F-9D35-401f-BEAC-3955817C645C)]
[scriptable, uuid(21f723fd-7fb9-4e19-bfa8-0a53a26dc242)]
interface nsIBoxObject : nsISupports
{
readonly attribute nsIDOMElement element;
attribute nsIBoxLayoutManager layoutManager;
attribute nsIBoxPaintManager paintManager;
readonly attribute long x;
readonly attribute long y;
readonly attribute long screenX;

View File

@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
#include "nsISupports.idl"
[scriptable, uuid(5DA1E8F0-6255-4b9c-AF80-AA3DAD7F2FDB)]
interface nsIBoxPaintManager : nsISupports
{
void paint();
};
%{C++
nsresult
NS_NewBoxPaintManager(nsIBoxPaintManager** aResult);
%}

View File

@ -36,18 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIBoxObject.idl"
#include "nsIContainerBoxObject.idl"
interface nsIDocShell;
/**
* @deprecated Please consider using nsIContainerBoxObject.
*/
[scriptable, uuid(F2504C26-7CF5-426a-86A7-E50998AC57C1)]
interface nsIBrowserBoxObject : nsISupports
[scriptable, uuid(db436f2f-c656-4754-b0fa-99bc353bd63f)]
interface nsIBrowserBoxObject : nsIContainerBoxObject
{
readonly attribute nsIDocShell docShell;
};
%{C++
nsresult
NS_NewBrowserBoxObject(nsIBoxObject** aResult);
%}

View File

@ -12,15 +12,14 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
* The Original Code is Mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* The Initial Developer of the Original Code is Mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -38,14 +37,16 @@
#include "nsISupports.idl"
[scriptable, uuid(DC06B890-15A1-45a9-A1A3-F144B42EEA29)]
interface nsIBoxLayoutManager : nsISupports
interface nsIDocShell;
interface nsIBoxObject;
[scriptable, uuid(35d4c04b-3bd3-4375-92e2-a818b4b4acb6)]
interface nsIContainerBoxObject : nsISupports
{
void layout();
readonly attribute nsIDocShell docShell;
};
%{C++
nsresult
NS_NewBoxLayoutManager(nsIBoxLayoutManager** aResult);
NS_NewContainerBoxObject(nsIBoxObject** aResult);
%}

View File

@ -36,19 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIBoxObject.idl"
#include "nsIContainerBoxObject.idl"
interface nsIEditor;
interface nsIDocShell;
/**
* @deprecated Please consider using nsIContainerBoxObject.
*/
[scriptable, uuid(14B3B669-3414-4548-AA03-EDF257D889C8)]
interface nsIEditorBoxObject : nsISupports
[scriptable, uuid(e3800a23-5b83-49aa-b18c-efa1ac5416e0)]
interface nsIEditorBoxObject : nsIContainerBoxObject
{
readonly attribute nsIDocShell docShell;
};
%{C++
nsresult
NS_NewEditorBoxObject(nsIBoxObject** aResult);
%}

View File

@ -36,18 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIBoxObject.idl"
#include "nsIContainerBoxObject.idl"
interface nsIDocShell;
/**
* @deprecated Please consider using nsIContainerBoxObject.
*/
[scriptable, uuid(DD9AB9BE-FED3-4bff-A72D-5390D52DD887)]
interface nsIIFrameBoxObject : nsISupports
[scriptable, uuid(30114c44-d398-44a5-9e01-b48b711291cd)]
interface nsIIFrameBoxObject : nsIContainerBoxObject
{
readonly attribute nsIDocShell docShell;
};
%{C++
nsresult
NS_NewIFrameBoxObject(nsIBoxObject** aResult);
%}

View File

@ -38,10 +38,11 @@
#ifndef nsPIBoxObject_h___
#define nsPIBoxObject_h___
// {91f2b229-b139-460e-a508-db9d52e9ed87}
// {2b8bb262-1b0f-4572-ba87-5d4ae4954445}
#define NS_PIBOXOBJECT_IID \
{ 0x91f2b229, 0xb139, 0x460e, \
{ 0xa5, 0x08, 0xdb, 0x9d, 0x52, 0xe9, 0xed, 0x87 } }
{ 0x2b8bb262, 0x1b0f, 0x4572, \
{ 0xba, 0x87, 0x5d, 0x4a, 0xe4, 0x95, 0x44, 0x45 } }
class nsIPresShell;
class nsIContent;
@ -56,6 +57,10 @@ public:
// Drop the weak ref to the content node as needed
virtual void Clear() = 0;
// The values cached by the implementation of this interface should be
// cleared when this method is called.
virtual void ClearCachedValues() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIBoxObject, NS_PIBOXOBJECT_IID)

View File

@ -101,9 +101,7 @@ CPPSRCS = \
ifdef MOZ_XUL
CPPSRCS += \
nsScrollBoxObject.cpp \
nsBrowserBoxObject.cpp \
nsIFrameBoxObject.cpp \
nsEditorBoxObject.cpp \
nsContainerBoxObject.cpp \
nsMenuBoxObject.cpp \
nsPopupBoxObject.cpp \
nsListBoxObject.cpp \

View File

@ -37,15 +37,12 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBoxObject.h"
#include "nsIBoxLayoutManager.h"
#include "nsIBoxPaintManager.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIFrameFrame.h"
#include "nsIDocShell.h"
#include "nsReadableUtils.h"
#include "nsILookAndFeel.h"
@ -101,36 +98,6 @@ nsBoxObject::GetElement(nsIDOMElement** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetLayoutManager(nsIBoxLayoutManager** aResult)
{
*aResult = mLayoutManager;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::SetLayoutManager(nsIBoxLayoutManager* aLayoutManager)
{
mLayoutManager = aLayoutManager;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetPaintManager(nsIBoxPaintManager** aResult)
{
*aResult = mPaintManager;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::SetPaintManager(nsIBoxPaintManager* aPaintManager)
{
mPaintManager = aPaintManager;
return NS_OK;
}
// nsPIBoxObject //////////////////////////////////////////////////////////////////////////
void
@ -146,6 +113,11 @@ nsBoxObject::Clear()
mContent = nsnull;
}
void
nsBoxObject::ClearCachedValues()
{
}
nsIFrame*
nsBoxObject::GetFrame(PRBool aFlushLayout)
{
@ -530,55 +502,6 @@ nsBoxObject::GetPreviousSibling(nsIFrame* aParentFrame, nsIFrame* aFrame,
return NS_OK;
}
nsresult
nsBoxObject::GetDocShell(nsIDocShell** aResult)
{
*aResult = nsnull;
nsIFrame *frame = GetFrame(PR_FALSE);
if (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...
return frame_frame->GetDocShell(aResult);
}
}
if (!mContent) {
return NS_OK;
}
// No nsIFrameFrame available for mContent, try if there's a mapping
// between mContent's document to mContent's subdocument.
// XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
nsIDocument *doc = mContent->GetDocument();
if (!doc) {
return NS_OK;
}
nsIDocument *sub_doc = doc->GetSubDocumentFor(mContent);
if (!sub_doc) {
return NS_OK;
}
nsCOMPtr<nsISupports> container = sub_doc->GetContainer();
if (!container) {
return NS_OK;
}
return CallQueryInterface(container, aResult);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult

View File

@ -42,8 +42,6 @@
#include "nsPoint.h"
#include "nsAutoPtr.h"
class nsIBoxLayoutManager;
class nsIBoxPaintManager;
class nsIFrame;
class nsIDocShell;
struct nsRect;
@ -60,6 +58,7 @@ public:
// nsPIBoxObject
virtual void Init(nsIContent* aContent);
virtual void Clear();
virtual void ClearCachedValues();
nsIFrame* GetFrame(PRBool aFlushLayout);
nsIPresShell* GetPresShell(PRBool aFlushLayout);
@ -72,12 +71,7 @@ public:
nsIDOMElement** aResult);
protected:
// Helper for some of the subclasses of nsBoxObject
nsresult GetDocShell(nsIDocShell **aDocShell);
// MEMBER VARIABLES
nsCOMPtr<nsIBoxLayoutManager> mLayoutManager; // [OWNER]
nsCOMPtr<nsIBoxPaintManager> mPaintManager; // [OWNER]
nsAutoPtr<nsPresState> mPresState; // [OWNER]
nsIContent* mContent; // [WEAK]

View File

@ -1,104 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
#include "nsCOMPtr.h"
#include "nsIBrowserBoxObject.h"
#include "nsBoxObject.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsXPIDLString.h"
class nsBrowserBoxObject : public nsIBrowserBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIBROWSERBOXOBJECT
nsBrowserBoxObject();
virtual ~nsBrowserBoxObject();
protected:
nsString* mSrcURL;
};
/* Implementation file */
NS_IMPL_ADDREF(nsBrowserBoxObject)
NS_IMPL_RELEASE(nsBrowserBoxObject)
NS_IMETHODIMP
nsBrowserBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(NS_GET_IID(nsIBrowserBoxObject))) {
*aResult = (nsIBrowserBoxObject*)this;
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsBrowserBoxObject::nsBrowserBoxObject()
:mSrcURL(nsnull)
{
}
nsBrowserBoxObject::~nsBrowserBoxObject()
{
/* destructor code */
delete mSrcURL;
}
NS_IMETHODIMP nsBrowserBoxObject::GetDocShell(nsIDocShell** aResult)
{
return nsBoxObject::GetDocShell(aResult);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewBrowserBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsBrowserBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -0,0 +1,135 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
#include "nsCOMPtr.h"
#include "nsIContainerBoxObject.h"
#include "nsIBrowserBoxObject.h"
#include "nsIEditorBoxObject.h"
#include "nsIIFrameBoxObject.h"
#include "nsBoxObject.h"
#include "nsIDocShell.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIFrameFrame.h"
/**
* nsContainerBoxObject implements deprecated nsIBrowserBoxObject,
* nsIEditorBoxObject and nsIIFrameBoxObject interfaces only because of the
* backward compatibility.
*/
class nsContainerBoxObject : public nsBoxObject,
public nsIBrowserBoxObject,
public nsIEditorBoxObject,
public nsIIFrameBoxObject
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSICONTAINERBOXOBJECT
NS_DECL_NSIBROWSERBOXOBJECT
NS_DECL_NSIEDITORBOXOBJECT
NS_DECL_NSIIFRAMEBOXOBJECT
};
NS_INTERFACE_MAP_BEGIN(nsContainerBoxObject)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIContainerBoxObject, nsIBrowserBoxObject)
NS_INTERFACE_MAP_ENTRY(nsIBrowserBoxObject)
NS_INTERFACE_MAP_ENTRY(nsIEditorBoxObject)
NS_INTERFACE_MAP_ENTRY(nsIIFrameBoxObject)
NS_INTERFACE_MAP_END_INHERITING(nsBoxObject)
NS_IMPL_ADDREF_INHERITED(nsContainerBoxObject, nsBoxObject)
NS_IMPL_RELEASE_INHERITED(nsContainerBoxObject, nsBoxObject)
NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
{
*aResult = nsnull;
nsIFrame *frame = GetFrame(PR_FALSE);
if (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...
return frame_frame->GetDocShell(aResult);
}
}
if (!mContent) {
return NS_OK;
}
// No nsIFrameFrame available for mContent, try if there's a mapping
// between mContent's document to mContent's subdocument.
// XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
nsIDocument *doc = mContent->GetDocument();
if (!doc) {
return NS_OK;
}
nsIDocument *sub_doc = doc->GetSubDocumentFor(mContent);
if (!sub_doc) {
return NS_OK;
}
nsCOMPtr<nsISupports> container = sub_doc->GetContainer();
if (!container) {
return NS_OK;
}
return CallQueryInterface(container, aResult);
}
nsresult
NS_NewContainerBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsContainerBoxObject();
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1,86 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
#include "nsCOMPtr.h"
#include "nsIEditorBoxObject.h"
#include "nsBoxObject.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIComponentManager.h"
#include "nsIDocShell.h"
class nsEditorBoxObject : public nsIEditorBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIEDITORBOXOBJECT
nsEditorBoxObject();
virtual ~nsEditorBoxObject();
};
/* Implementation file */
NS_IMPL_ISUPPORTS_INHERITED1(nsEditorBoxObject, nsBoxObject, nsIEditorBoxObject)
nsEditorBoxObject::nsEditorBoxObject()
{
}
nsEditorBoxObject::~nsEditorBoxObject()
{
/* destructor code */
}
NS_IMETHODIMP nsEditorBoxObject::GetDocShell(nsIDocShell** aResult)
{
return nsBoxObject::GetDocShell(aResult);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewEditorBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsEditorBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
#include "nsCOMPtr.h"
#include "nsIIFrameBoxObject.h"
#include "nsBoxObject.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIDocShell.h"
class nsIFrameBoxObject : public nsIIFrameBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIFRAMEBOXOBJECT
nsIFrameBoxObject();
virtual ~nsIFrameBoxObject();
protected:
};
/* Implementation file */
NS_IMPL_ADDREF(nsIFrameBoxObject)
NS_IMPL_RELEASE(nsIFrameBoxObject)
NS_IMETHODIMP
nsIFrameBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(NS_GET_IID(nsIIFrameBoxObject))) {
*aResult = (nsIIFrameBoxObject*)this;
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsIFrameBoxObject::nsIFrameBoxObject()
{
}
nsIFrameBoxObject::~nsIFrameBoxObject()
{
/* destructor code */
}
NS_IMETHODIMP nsIFrameBoxObject::GetDocShell(nsIDocShell** aResult)
{
return nsBoxObject::GetDocShell(aResult);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewIFrameBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsIFrameBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

View File

@ -292,9 +292,9 @@ nsListBoxBodyFrame::Destroy()
nsCOMPtr<nsIBoxObject> box;
nsdoc->GetBoxObjectFor(e, getter_AddRefs(box));
nsCOMPtr<nsPIListBoxObject> piBox = do_QueryInterface(box);
nsCOMPtr<nsPIBoxObject> piBox = do_QueryInterface(box);
if (piBox) {
piBox->ClearCachedListBoxBody();
piBox->ClearCachedValues();
}
break;

View File

@ -55,14 +55,13 @@ public:
NS_DECL_NSILISTBOXOBJECT
// nsPIListBoxObject
virtual void ClearCachedListBoxBody();
virtual nsIListBoxObject* GetListBoxBody();
nsListBoxObject();
virtual ~nsListBoxObject();
// nsPIBoxObject
virtual void Clear();
virtual void ClearCachedValues();
protected:
nsIListBoxObject* mListBoxBody;
@ -76,11 +75,6 @@ nsListBoxObject::nsListBoxObject()
{
}
nsListBoxObject::~nsListBoxObject()
{
}
//////////////////////////////////////////////////////////////////////////
//// nsIListBoxObject
@ -164,12 +158,6 @@ nsListBoxObject::GetIndexOfItem(nsIDOMElement* aElement, PRInt32 *aResult)
return NS_OK;
}
void
nsListBoxObject::ClearCachedListBoxBody()
{
mListBoxBody = nsnull;
}
//////////////////////
static void
@ -240,11 +228,17 @@ nsListBoxObject::GetListBoxBody()
void
nsListBoxObject::Clear()
{
ClearCachedListBoxBody();
ClearCachedValues();
nsBoxObject::Clear();
}
void
nsListBoxObject::ClearCachedValues()
{
mListBoxBody = nsnull;
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult

View File

@ -39,22 +39,15 @@
#define nsPIListBoxObject_h__
#define NS_PILISTBOXOBJECT_IID \
{ 0x294e0820, 0x5c40, 0x42a8, \
{ 0xb3, 0x2f, 0x6d, 0xcf, 0x05, 0xfb, 0xe1, 0xf3 } }
{ 0x965f3d0b, 0x2960, 0x40f5, \
{ 0xaa, 0xab, 0x32, 0xd2, 0xae, 0x09, 0x90, 0x94 } }
#include "nsIListBoxObject.h"
class nsPIListBoxObject : public nsIListBoxObject {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PILISTBOXOBJECT_IID)
/**
* Clear the cached list box body frame from this box object. This should be
* called when the frame in question is destroyed.
*/
virtual void ClearCachedListBoxBody() = 0;
/*
* Get the list box body. This will search for it as needed.
*/
virtual nsIListBoxObject* GetListBoxBody() = 0;

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 Mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Boris Zbarsky <bzbarsky@mit.edu> (Original Author)
*
* 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 nsPITreeBoxObject_h__
#define nsPITreeBoxObject_h__
#define NS_PITREEBOXOBJECT_IID \
{ 0xafcd2a82, 0xc484, 0x4f86, \
{ 0x83, 0x77, 0xd9, 0xb8, 0x59, 0x31, 0xef, 0xf0 } }
#include "nsITreeBoxObject.h"
class nsPITreeBoxObject : public nsITreeBoxObject {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PITREEBOXOBJECT_IID)
/**
* Clear the cached tree body frame from this box object. This should be
* called when the frame in question is destroyed.
*/
virtual void ClearCachedTreeBody() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPITreeBoxObject, NS_PITREEBOXOBJECT_IID)
#endif // nsPITreeBoxObject_h__

View File

@ -318,8 +318,8 @@ nsTreeBodyFrame::Destroy()
// Save off our info into the box object.
EnsureBoxObject();
if (mTreeBoxObject) {
nsCOMPtr<nsIBoxObject> box(do_QueryInterface(mTreeBoxObject));
nsCOMPtr<nsPIBoxObject> box(do_QueryInterface(mTreeBoxObject));
if (box) {
if (mTopRowIndex > 0) {
nsAutoString topRowStr; topRowStr.AssignLiteral("topRow");
nsAutoString topRow;
@ -328,7 +328,7 @@ nsTreeBodyFrame::Destroy()
}
// Always null out the cached tree body frame.
mTreeBoxObject->ClearCachedTreeBody();
box->ClearCachedValues();
mTreeBoxObject = nsnull; // Drop our ref here.
}
@ -357,9 +357,10 @@ nsTreeBodyFrame::EnsureBoxObject()
nsCOMPtr<nsIBoxObject> box;
nsCOMPtr<nsIDOMElement> domElem = do_QueryInterface(parent);
nsDoc->GetBoxObjectFor(domElem, getter_AddRefs(box));
if (box) {
mTreeBoxObject = do_QueryInterface(box);
// Ensure that we got a native box object.
nsCOMPtr<nsPIBoxObject> pBox = do_QueryInterface(box);
if (pBox) {
mTreeBoxObject = do_QueryInterface(pBox);
mColumns->SetTree(mTreeBoxObject);
}
}

View File

@ -42,7 +42,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsLeafBoxFrame.h"
#include "nsPITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsICSSPseudoComparator.h"
#include "nsIScrollbarMediator.h"
@ -377,7 +376,7 @@ protected:
protected: // Data Members
// The cached box object parent.
nsCOMPtr<nsPITreeBoxObject> mTreeBoxObject;
nsCOMPtr<nsITreeBoxObject> mTreeBoxObject;
// Cached column information.
nsRefPtr<nsTreeColumns> mColumns;

View File

@ -40,7 +40,6 @@
#include "nsCOMPtr.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsPITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsITreeSelection.h"
#include "nsBoxObject.h"
@ -52,7 +51,7 @@
#include "nsContentUtils.h"
#include "nsDOMError.h"
class nsTreeBoxObject : public nsPITreeBoxObject, public nsBoxObject
class nsTreeBoxObject : public nsITreeBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS_INHERITED
@ -65,23 +64,20 @@ public:
//NS_PIBOXOBJECT interfaces
virtual void Clear();
// nsPITreeBoxObject
virtual void ClearCachedTreeBody();
virtual void ClearCachedValues();
protected:
nsITreeBoxObject* mTreeBody;
};
/* Implementation file */
NS_IMPL_ISUPPORTS_INHERITED2(nsTreeBoxObject, nsBoxObject, nsITreeBoxObject,
nsPITreeBoxObject)
NS_IMPL_ISUPPORTS_INHERITED1(nsTreeBoxObject, nsBoxObject, nsITreeBoxObject)
void
nsTreeBoxObject::Clear()
{
ClearCachedTreeBody();
ClearCachedValues();
// Drop the view's ref to us.
NS_NAMED_LITERAL_STRING(viewString, "view");
@ -473,7 +469,7 @@ NS_IMETHODIMP nsTreeBoxObject::ClearStyleAndImageCaches()
}
void
nsTreeBoxObject::ClearCachedTreeBody()
nsTreeBoxObject::ClearCachedValues()
{
mTreeBody = nsnull;
}

View File

@ -223,7 +223,7 @@
readonly="true"/>
<property name="docShell"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
readonly="true"/>
<property name="webNavigation"

View File

@ -64,7 +64,7 @@
<property name="contentDocument" readonly="true"
onget="return this.webNavigation.document;"/>
<property name="docShell"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
readonly="true"/>
<property name="contentWindow"
readonly="true"

View File

@ -217,7 +217,7 @@
</property>
<property name="docShell"
readonly="true"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIIFrameBoxObject).docShell"/>
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell"/>
<property name="contentWindow"
readonly="true"
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>

View File

@ -223,7 +223,7 @@
readonly="true"/>
<property name="docShell"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
readonly="true"/>
<property name="webNavigation"

View File

@ -64,7 +64,7 @@
<property name="contentDocument" readonly="true"
onget="return this.webNavigation.document;"/>
<property name="docShell"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
readonly="true"/>
<property name="contentWindow"
readonly="true"

View File

@ -217,7 +217,7 @@
</property>
<property name="docShell"
readonly="true"
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIIFrameBoxObject).docShell"/>
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell"/>
<property name="contentWindow"
readonly="true"
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>