Bug 355100, Remove XTF visuals (part II/II, removing files)

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-10-08 15:41:46 +00:00
parent 0a857958a2
commit ae83752913
31 changed files with 0 additions and 2749 deletions

View File

@ -1,65 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Olli Pettay.
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 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 "nsIXTFElement.idl"
interface nsIXTFBindableElementWrapper;
/**
* nsIXTFBindableElement can be used to add support for new interfaces to
* normal XML elements. XBL bindings do work with this kind of XTF elements.
*
* @note getScriptingInterfaces don't work at the moment with
* nsIXTFBindableElements. The problem is that XBL does not play nicely
* with that kind of interfaces.
* However, if nsIXTFBindableElement implements scriptable interfaces, those
* can be used by explicitly QIing to them.
*/
[scriptable, uuid(8dcc630c-9adc-4c60-9954-a004cb45e4a7)]
interface nsIXTFBindableElement : nsIXTFElement
{
/**
* onCreated will be called before any notifications are sent to
* the xtf element.
*
* @param wrapper is a weak proxy to the wrapping element
* (i.e. holding a reference to this will not create a cycle).
*/
void onCreated(in nsIXTFBindableElementWrapper wrapper);
};

View File

@ -1,45 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Olli Pettay.
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 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 "nsIXTFStyledElementWrapper.idl"
[scriptable, uuid(7914d5f2-14b4-47d0-88f8-70715cfbdfb7)]
interface nsIXTFBindableElementWrapper : nsIXTFStyledElementWrapper
{
};

View File

@ -1,51 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFElement.idl"
interface nsIXTFGenericElementWrapper;
[scriptable, uuid(e339eb1d-3ea8-4c85-87ce-644eb7a19034)]
interface nsIXTFGenericElement : nsIXTFElement
{
// onCreated: Will be called before any notifications are sent to
// the xtf element. Parameter 'wrapper' is a weak proxy to the
// wrapping element (i.e. it can safely be addrefed by the xtf
// element without creating cyclic XPCOM referencing).
void onCreated(in nsIXTFGenericElementWrapper wrapper);
};

View File

@ -1,45 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFElementWrapper.idl"
[scriptable, uuid(5e0cf513-5b87-4da2-a5ce-d9ba3a30d540)]
interface nsIXTFGenericElementWrapper : nsIXTFElementWrapper
{
};

View File

@ -1,53 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFVisual.idl"
interface nsIXTFSVGVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(5fd47925-03b2-4318-b55e-c37134124b6a)]
interface nsIXTFSVGVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to
// the xtf element or before the element will be asked for its
// visualContent. Parameter 'wrapper' is a weak proxy to the
// wrapping element (i.e. it can safely be addrefed by the xtf
// element without creating cyclic XPCOM referencing).
void onCreated(in nsIXTFSVGVisualWrapper wrapper);
};

View File

@ -1,45 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFStyledElementWrapper.idl"
[scriptable, uuid(78582ad3-db1e-4aa6-a15b-b055a7846352)]
interface nsIXTFSVGVisualWrapper : nsIXTFStyledElementWrapper
{
};

View File

@ -1,51 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Olli Pettay.
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 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 "nsIXTFElementWrapper.idl"
[scriptable, uuid(814dbfdd-32ff-4734-9aea-b84c925bc9c0)]
interface nsIXTFStyledElementWrapper : nsIXTFElementWrapper
{
/**
* This sets the name of the class attribute.
* Should be called only during ::onCreated.
* Note! nsIXTFAttributeHandler can't be used to handle class attribute.
*/
void setClassAttributeName(in nsIAtom name);
};

View File

@ -1,75 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFElement.idl"
interface nsIDOMElement;
[scriptable, uuid(2ee5520b-6593-43c1-b660-4885939a6b68)]
interface nsIXTFVisual : nsIXTFElement
{
// The content tree rooted in 'visualContent' will be rendered where
// the xtf visual is placed into an appropriate context. A visual
// will be asked for its visual content once at most. The tree
// cannot be dynamically replaced during the lifetime of the
// element, it may however be dynamically manipulated (i.e. you can
// insert/remove content, set attributes, etc., but *not* exchange
// the root element for something else).
readonly attribute nsIDOMElement visualContent;
// Children of the xtf visual which are themselves 'visuals'
// (i.e. built-ins elements, other xtf visuals or xbl elements with
// visual <content>) will be rendered as if they were children of
// 'insertionPoint'. 'insertionPoint' should either be null (in
// which case the children will not be automatically rendered) or
// point into the 'visualContent' tree.
readonly attribute nsIDOMElement insertionPoint;
// If 'true', document style sheets will apply to the visual
// content. If 'false', only UA and user style sheets will be
// applied.
readonly attribute boolean applyDocumentStyleSheets;
// Notification mask constants:
// To receive a given event set the corresponding bit in
// nsIXTFElementWrapper::notificationMask.
const unsigned long NOTIFY_DID_LAYOUT = 0x00020000;
// Event notifications:
void didLayout();
};

View File

@ -1,53 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFVisual.idl"
interface nsIXTFXMLVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(e63d240d-bd00-4857-ba65-2f9cc599eead)]
interface nsIXTFXMLVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to
// the xtf element or before the element will be asked for its
// visualContent. Parameter 'wrapper' is a weak proxy to the
// wrapping element (i.e. it can safely be addrefed by the xtf
// element without creating cyclic XPCOM referencing).
void onCreated(in nsIXTFXMLVisualWrapper wrapper);
};

View File

@ -1,45 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFStyledElementWrapper.idl"
[scriptable, uuid(656c9417-744e-4fa3-8e2b-8218185efe21)]
interface nsIXTFXMLVisualWrapper : nsIXTFStyledElementWrapper
{
};

View File

@ -1,53 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFVisual.idl"
interface nsIXTFXULVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(a1173d91-4428-4829-8e3e-fe66e558f161)]
interface nsIXTFXULVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to
// the xtf element or before the element will be asked for its
// visualContent. Parameter 'wrapper' is a weak proxy to the
// wrapping element (i.e. it can safely be addrefed by the xtf
// element without creating cyclic XPCOM referencing).
void onCreated(in nsIXTFXULVisualWrapper wrapper);
};

View File

@ -1,45 +0,0 @@
/* -*- Mode: IDL; 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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsIXTFStyledElementWrapper.idl"
[scriptable, uuid(1ab4b724-fd7e-41af-bc19-80bb7299f3c0)]
interface nsIXTFXULVisualWrapper : nsIXTFStyledElementWrapper
{
};

View File

@ -1,229 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (original author)
* Olli Pettay <Olli.Pettay@helsinki.fi>
*
* 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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFElementWrapper.h"
#include "nsIXTFBindableElement.h"
#include "nsXTFWeakTearoff.h"
#include "nsIXTFBindableElementWrapper.h"
#include "nsXTFInterfaceAggregator.h"
typedef nsXTFStyledElementWrapper nsXTFBindableElementWrapperBase;
////////////////////////////////////////////////////////////////////////
// nsXTFBindableElementWrapper class
class nsXTFBindableElementWrapper : public nsXTFBindableElementWrapperBase,
public nsIXTFBindableElementWrapper
{
protected:
friend nsresult NS_NewXTFBindableElementWrapper(nsIXTFBindableElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
nsXTFBindableElementWrapper(nsINodeInfo* aNodeInfo, nsIXTFBindableElement* xtfElement);
virtual ~nsXTFBindableElementWrapper();
nsresult Init();
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFElementWrapperPrivate interface
virtual PRUint32 GetElementType() { return nsIXTFElement::ELEMENT_TYPE_BINDABLE; }
// nsIXTFBindableElementWrapper interface
NS_DECL_NSIXTFBINDABLEELEMENTWRAPPER
// nsIXTFStyledElementWrapper
NS_FORWARD_NSIXTFSTYLEDELEMENTWRAPPER(nsXTFStyledElementWrapper::)
// nsIXTFElementWrapper interface
NS_FORWARD_NSIXTFELEMENTWRAPPER(nsXTFBindableElementWrapperBase::)
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array);
private:
virtual nsIXTFElement *GetXTFElement() const { return mXTFElement; }
nsCOMPtr<nsIXTFBindableElement> mXTFElement;
};
//----------------------------------------------------------------------
// implementation:
nsXTFBindableElementWrapper::nsXTFBindableElementWrapper(nsINodeInfo* aNodeInfo,
nsIXTFBindableElement* xtfElement)
: nsXTFBindableElementWrapperBase(aNodeInfo), mXTFElement(xtfElement)
{
#ifdef DEBUG
// printf("nsXTFBindableElementWrapper CTOR\n");
#endif
NS_ASSERTION(mXTFElement, "xtfElement is null");
}
nsresult
nsXTFBindableElementWrapper::Init()
{
nsXTFBindableElementWrapperBase::Init();
// pass a weak wrapper (non base object ref-counted), so that
// our mXTFElement can safely addref/release.
nsISupports *weakWrapper = nsnull;
nsresult rv = NS_NewXTFWeakTearoff(NS_GET_IID(nsIXTFBindableElementWrapper),
(nsIXTFBindableElementWrapper*)this,
&weakWrapper);
if (!weakWrapper) {
NS_ERROR("could not construct weak wrapper");
return rv;
}
mXTFElement->OnCreated((nsIXTFBindableElementWrapper*)weakWrapper);
NS_RELEASE(weakWrapper);
return NS_OK;
}
NS_IMETHODIMP
nsXTFBindableElementWrapper::GetInterfaces(PRUint32 *count, nsIID * **array)
{
*count = 0;
*array = nsnull;
return NS_OK;
}
nsXTFBindableElementWrapper::~nsXTFBindableElementWrapper()
{
mXTFElement->OnDestroyed();
mXTFElement = nsnull;
#ifdef DEBUG
// printf("nsXTFBindableElementWrapper DTOR\n");
#endif
}
nsresult
NS_NewXTFBindableElementWrapper(nsIXTFBindableElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult)
{
*aResult = nsnull;
if (!xtfElement) {
NS_ERROR("can't construct an xtf wrapper without an xtf element");
return NS_ERROR_INVALID_ARG;
}
nsXTFBindableElementWrapper* result = new nsXTFBindableElementWrapper(ni, xtfElement);
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
nsresult rv = result->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(result);
return rv;
}
*aResult = result;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFBindableElementWrapper, nsXTFBindableElementWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFBindableElementWrapper, nsXTFBindableElementWrapperBase)
NS_IMETHODIMP
nsXTFBindableElementWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
nsresult rv;
if (aIID.Equals(NS_GET_IID(nsIXTFElementWrapperPrivate))) {
*aInstancePtr = NS_STATIC_CAST(nsIXTFElementWrapperPrivate*, this);
NS_ADDREF_THIS();
return NS_OK;
}
if(aIID.Equals(NS_GET_IID(nsIXTFElementWrapper))) {
*aInstancePtr =
NS_STATIC_CAST(nsIXTFElementWrapper*,
NS_STATIC_CAST(nsXTFBindableElementWrapperBase*, this));
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIXTFBindableElementWrapper))) {
*aInstancePtr = NS_STATIC_CAST(nsIXTFBindableElementWrapper*, this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIXTFStyledElementWrapper))) {
*aInstancePtr = NS_STATIC_CAST(nsIXTFStyledElementWrapper*, this);
NS_ADDREF_THIS();
return NS_OK;
}
// Note, using the nsIClassInfo from nsXMLElement.
if (NS_SUCCEEDED(rv = nsXTFElementWrapperBase::QueryInterface(aIID, aInstancePtr))) {
return rv;
}
// try to get get the interface from our wrapped element:
nsCOMPtr<nsISupports> inner;
QueryInterfaceInner(aIID, getter_AddRefs(inner));
if (inner) {
rv = NS_NewXTFInterfaceAggregator(aIID, inner,
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
return rv;
}
return NS_ERROR_NO_INTERFACE;
}
//----------------------------------------------------------------------
// nsIXTFBindableElementWrapper implementation:
// XXX nothing yet

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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Olli Pettay.
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 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 __NS_XTFBINDABLEELEMENTWRAPPER_H__
#define __NS_XTFBINDABLEELEMENTWRAPPER_H__
class nsIXTFBindableElement;
class nsIContent;
class nsINodeInfo;
nsresult
NS_NewXTFBindableElementWrapper(nsIXTFBindableElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
#endif // __NS_XTFBINDABLEELEMENTWRAPPER_H__

View File

@ -1,170 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFElementWrapper.h"
#include "nsIXTFGenericElement.h"
#include "nsXTFWeakTearoff.h"
#include "nsIXTFGenericElementWrapper.h"
typedef nsXTFElementWrapper nsXTFGenericElementWrapperBase;
////////////////////////////////////////////////////////////////////////
// nsXTFGenericElementWrapper class
class nsXTFGenericElementWrapper : public nsXTFGenericElementWrapperBase,
public nsIXTFGenericElementWrapper
{
protected:
friend nsresult
NS_NewXTFGenericElementWrapper(nsIXTFGenericElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
nsXTFGenericElementWrapper(nsINodeInfo* aNodeInfo, nsIXTFGenericElement* xtfElement);
virtual ~nsXTFGenericElementWrapper();
nsresult Init();
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFElementWrapperPrivate interface
virtual PRUint32 GetElementType() { return nsIXTFElement::ELEMENT_TYPE_GENERIC_ELEMENT; }
// nsIXTFGenericElementWrapper interface
NS_DECL_NSIXTFGENERICELEMENTWRAPPER
// nsIXTFElementWrapper interface
NS_FORWARD_NSIXTFELEMENTWRAPPER(nsXTFGenericElementWrapperBase::)
private:
virtual nsIXTFElement *GetXTFElement() const { return mXTFElement; }
nsCOMPtr<nsIXTFGenericElement> mXTFElement;
};
//----------------------------------------------------------------------
// implementation:
nsXTFGenericElementWrapper::nsXTFGenericElementWrapper(nsINodeInfo* aNodeInfo,
nsIXTFGenericElement* xtfElement)
: nsXTFGenericElementWrapperBase(aNodeInfo), mXTFElement(xtfElement)
{
#ifdef DEBUG
// printf("nsXTFGenericElementWrapper CTOR\n");
#endif
NS_ASSERTION(mXTFElement, "xtfElement is null");
}
nsresult
nsXTFGenericElementWrapper::Init()
{
nsXTFGenericElementWrapperBase::Init();
// pass a weak wrapper (non base object ref-counted), so that
// our mXTFElement can safely addref/release.
nsISupports *weakWrapper=nsnull;
NS_NewXTFWeakTearoff(NS_GET_IID(nsIXTFGenericElementWrapper),
(nsIXTFGenericElementWrapper*)this,
&weakWrapper);
if (!weakWrapper) {
NS_ERROR("could not construct weak wrapper");
return NS_ERROR_FAILURE;
}
mXTFElement->OnCreated((nsIXTFGenericElementWrapper*)weakWrapper);
weakWrapper->Release();
return NS_OK;
}
nsXTFGenericElementWrapper::~nsXTFGenericElementWrapper()
{
mXTFElement->OnDestroyed();
mXTFElement = nsnull;
#ifdef DEBUG
// printf("nsXTFGenericElementWrapper DTOR\n");
#endif
}
nsresult
NS_NewXTFGenericElementWrapper(nsIXTFGenericElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult)
{
*aResult = nsnull;
if (!xtfElement) {
NS_ERROR("can't construct an xtf wrapper without an xtf element");
return NS_ERROR_FAILURE;
}
nsXTFGenericElementWrapper* result = new nsXTFGenericElementWrapper(ni, xtfElement);
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
nsresult rv = result->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(result);
return rv;
}
*aResult = result;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFGenericElementWrapper, nsXTFGenericElementWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFGenericElementWrapper, nsXTFGenericElementWrapperBase)
NS_INTERFACE_MAP_BEGIN(nsXTFGenericElementWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFGenericElementWrapper)
NS_INTERFACE_MAP_END_INHERITING(nsXTFGenericElementWrapperBase)
//----------------------------------------------------------------------
// nsIXTFGenericElementWrapper implementation:
// XXX nothing yet

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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 __NS_XTFGENERICELEMENTWRAPPER_H__
#define __NS_XTFGENERICELEMENTWRAPPER_H__
class nsIXTFGenericElement;
class nsIContent;
class nsINodeInfo;
nsresult
NS_NewXTFGenericElementWrapper(nsIXTFGenericElement* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
#endif // __NS_XTFGENERICELEMENTWRAPPER_H__

View File

@ -1,176 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFVisualWrapper.h"
#include "nsIXTFSVGVisual.h"
#include "nsXTFWeakTearoff.h"
#include "nsIXTFSVGVisualWrapper.h"
typedef nsXTFVisualWrapper nsXTFSVGVisualWrapperBase;
////////////////////////////////////////////////////////////////////////
// nsXTFSVGVisualWrapper class
class nsXTFSVGVisualWrapper : public nsXTFSVGVisualWrapperBase,
public nsIXTFSVGVisualWrapper
{
protected:
friend nsresult
NS_NewXTFSVGVisualWrapper(nsIXTFSVGVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
nsXTFSVGVisualWrapper(nsINodeInfo* ni, nsIXTFSVGVisual* xtfElement);
virtual ~nsXTFSVGVisualWrapper();
nsresult Init();
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFElementWrapperPrivate interface
virtual PRUint32 GetElementType() { return nsIXTFElement::ELEMENT_TYPE_SVG_VISUAL; }
// nsIXTFSVGVisualWrapper interface
NS_DECL_NSIXTFSVGVISUALWRAPPER
// nsIXTFStyledElementWrapper
NS_FORWARD_NSIXTFSTYLEDELEMENTWRAPPER(nsXTFStyledElementWrapper::)
// nsIXTFElementWrapper interface
NS_FORWARD_NSIXTFELEMENTWRAPPER(nsXTFSVGVisualWrapperBase::)
private:
virtual nsIXTFElement *GetXTFElement() const { return mXTFElement; }
virtual nsIXTFVisual *GetXTFVisual() const { return mXTFElement; }
nsCOMPtr<nsIXTFSVGVisual> mXTFElement;
};
//----------------------------------------------------------------------
// implementation:
nsXTFSVGVisualWrapper::nsXTFSVGVisualWrapper(nsINodeInfo* aNodeInfo,
nsIXTFSVGVisual* xtfElement)
: nsXTFSVGVisualWrapperBase(aNodeInfo), mXTFElement(xtfElement)
{
#ifdef DEBUG
// printf("nsXTFSVGVisualWrapper CTOR\n");
#endif
NS_ASSERTION(mXTFElement, "xtfElement is null");
}
nsresult
nsXTFSVGVisualWrapper::Init()
{
nsXTFSVGVisualWrapperBase::Init();
// pass a weak wrapper (non base object ref-counted), so that
// our mXTFElement can safely addref/release.
nsISupports *weakWrapper=nsnull;
NS_NewXTFWeakTearoff(NS_GET_IID(nsIXTFSVGVisualWrapper),
(nsIXTFSVGVisualWrapper*)this,
&weakWrapper);
if (!weakWrapper) {
NS_ERROR("could not construct weak wrapper");
return NS_ERROR_FAILURE;
}
mXTFElement->OnCreated((nsIXTFSVGVisualWrapper*)weakWrapper);
weakWrapper->Release();
return NS_OK;
}
nsXTFSVGVisualWrapper::~nsXTFSVGVisualWrapper()
{
mXTFElement->OnDestroyed();
mXTFElement = nsnull;
#ifdef DEBUG
// printf("nsXTFSVGVisualWrapper DTOR\n");
#endif
}
nsresult
NS_NewXTFSVGVisualWrapper(nsIXTFSVGVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult)
{
*aResult = nsnull;
if (!xtfElement) {
NS_ERROR("can't construct an xtf wrapper without an xtf element");
return NS_ERROR_FAILURE;
}
nsXTFSVGVisualWrapper* result = new nsXTFSVGVisualWrapper(ni, xtfElement);
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
nsresult rv = result->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(result);
return rv;
}
*aResult = result;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFSVGVisualWrapper, nsXTFSVGVisualWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFSVGVisualWrapper, nsXTFSVGVisualWrapperBase)
NS_INTERFACE_MAP_BEGIN(nsXTFSVGVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFSVGVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFStyledElementWrapper)
NS_INTERFACE_MAP_END_INHERITING(nsXTFSVGVisualWrapperBase)
//----------------------------------------------------------------------
// nsIXTFSVGVisualWrapper implementation:
// XXX nothing yet

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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 __NS_XTFSVGVISUALWRAPPER_H__
#define __NS_XTFSVGVISUALWRAPPER_H__
class nsIXTFSVGVisual;
class nsIContent;
class nsINodeInfo;
nsresult
NS_NewXTFSVGVisualWrapper(nsIXTFSVGVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
#endif // __NS_XTFSVGVISUALWRAPPER_H__

View File

@ -1,124 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFVisualWrapper.h"
#include "nsISupportsArray.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIDocument.h"
nsXTFVisualWrapper::nsXTFVisualWrapper(nsINodeInfo* aNodeInfo)
: nsXTFVisualWrapperBase(aNodeInfo)
{}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFVisualWrapper,nsXTFVisualWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFVisualWrapper,nsXTFVisualWrapperBase)
NS_INTERFACE_MAP_BEGIN(nsXTFVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFVisualWrapperPrivate)
NS_INTERFACE_MAP_END_INHERITING(nsXTFVisualWrapperBase)
//----------------------------------------------------------------------
// nsIXTFVisualWrapperPrivate implementation:
NS_IMETHODIMP
nsXTFVisualWrapper::CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)
{
nsIDocument *doc = GetCurrentDoc();
NS_ASSERTION(doc, "no document; cannot create anonymous content");
if (!mVisualContent) {
GetXTFVisual()->GetVisualContent(getter_AddRefs(mVisualContent));
}
if (!mVisualContent) return NS_OK; // nothing to append
// Check if we are creating content for the primary presShell
bool isPrimaryShell =
(aPresContext->PresShell() == doc->GetShellAt(0));
nsCOMPtr<nsIDOMNode> contentToAppend;
if (!isPrimaryShell) {
// The presShell we are generating content for is not a primary
// shell. In practice that means it means we are constructing
// content for printing. Instead of asking the xtf element to
// construct new visual content, we just clone the exisiting
// content. In this way, the xtf element only ever has to provide
// one visual content tree which it can dynamically manipulate.
mVisualContent->CloneNode(PR_TRUE, getter_AddRefs(contentToAppend));
}
else
contentToAppend = mVisualContent;
if (contentToAppend)
aAnonymousItems.AppendElement(contentToAppend);
return NS_OK;
}
void
nsXTFVisualWrapper::DidLayout()
{
if (mNotificationMask & nsIXTFVisual::NOTIFY_DID_LAYOUT)
GetXTFVisual()->DidLayout();
}
void
nsXTFVisualWrapper::GetInsertionPoint(nsIDOMElement** insertionPoint)
{
GetXTFVisual()->GetInsertionPoint(insertionPoint);
}
PRBool
nsXTFVisualWrapper::ApplyDocumentStyleSheets()
{
PRBool retval = PR_FALSE;
GetXTFVisual()->GetApplyDocumentStyleSheets(&retval);
return retval;
}
nsresult
nsXTFVisualWrapper::Init()
{
return nsXTFVisualWrapperBase::Init();
}

View File

@ -1,75 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 __NS_XTFVISUALWRAPPER_H__
#define __NS_XTFVISUALWRAPPER_H__
#include "nsXTFElementWrapper.h"
#include "nsIDOMElement.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIXTFVisual.h"
typedef nsXTFStyledElementWrapper nsXTFVisualWrapperBase;
class nsXTFVisualWrapper : public nsXTFVisualWrapperBase,
public nsIXTFVisualWrapperPrivate
{
protected:
nsXTFVisualWrapper(nsINodeInfo* aNodeInfo);
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFVisualWrapperPrivate
NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
virtual void DidLayout();
virtual void GetInsertionPoint(nsIDOMElement** insertionPoint);
virtual PRBool ApplyDocumentStyleSheets();
nsresult Init();
protected:
// to be implemented by subclasses:
virtual nsIXTFVisual *GetXTFVisual() const = 0;
nsCOMPtr<nsIDOMElement> mVisualContent;
};
#endif // __NS_XTFVISUALWRAPPER_H__

View File

@ -1,179 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFVisualWrapper.h"
#include "nsIXTFXMLVisual.h"
#include "nsXTFWeakTearoff.h"
#include "nsIXTFXMLVisualWrapper.h"
typedef nsXTFVisualWrapper nsXTFXMLVisualWrapperBase;
////////////////////////////////////////////////////////////////////////
// nsXTFXMLVisualWrapper class
class nsXTFXMLVisualWrapper : public nsXTFXMLVisualWrapperBase,
public nsIXTFXMLVisualWrapper
{
protected:
friend nsresult
NS_NewXTFXMLVisualWrapper(nsIXTFXMLVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
nsXTFXMLVisualWrapper(nsINodeInfo* ni, nsIXTFXMLVisual* xtfElement);
virtual ~nsXTFXMLVisualWrapper();
nsresult Init();
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFElementWrapperPrivate interface
virtual PRUint32 GetElementType() { return nsIXTFElement::ELEMENT_TYPE_XML_VISUAL; }
// nsIXTFXMLVisualWrapper interface
NS_DECL_NSIXTFXMLVISUALWRAPPER
// nsIXTFStyledElementWrapper
NS_FORWARD_NSIXTFSTYLEDELEMENTWRAPPER(nsXTFStyledElementWrapper::)
// nsIXTFElementWrapper interface
NS_FORWARD_NSIXTFELEMENTWRAPPER(nsXTFXMLVisualWrapperBase::)
private:
virtual nsIXTFElement *GetXTFElement() const { return mXTFElement; }
virtual nsIXTFVisual *GetXTFVisual() const { return mXTFElement; }
nsCOMPtr<nsIXTFXMLVisual> mXTFElement;
};
//----------------------------------------------------------------------
// implementation:
nsXTFXMLVisualWrapper::nsXTFXMLVisualWrapper(nsINodeInfo* aNodeInfo,
nsIXTFXMLVisual* xtfElement)
: nsXTFXMLVisualWrapperBase(aNodeInfo), mXTFElement(xtfElement)
{
#ifdef DEBUG
// printf("nsXTFXMLVisualWrapper CTOR\n");
#endif
NS_ASSERTION(mXTFElement, "xtfElement is null");
}
nsresult
nsXTFXMLVisualWrapper::Init()
{
nsXTFXMLVisualWrapperBase::Init();
// pass a weak wrapper (non base object ref-counted), so that
// our mXTFElement can safely addref/release.
nsISupports *weakWrapper=nsnull;
NS_NewXTFWeakTearoff(NS_GET_IID(nsIXTFXMLVisualWrapper),
(nsIXTFXMLVisualWrapper*)this,
&weakWrapper);
if (!weakWrapper) {
NS_ERROR("could not construct weak wrapper");
return NS_ERROR_FAILURE;
}
mXTFElement->OnCreated((nsIXTFXMLVisualWrapper*)weakWrapper);
weakWrapper->Release();
return NS_OK;
}
nsXTFXMLVisualWrapper::~nsXTFXMLVisualWrapper()
{
mXTFElement->OnDestroyed();
mXTFElement = nsnull;
#ifdef DEBUG
// printf("nsXTFXMLVisualWrapper DTOR\n");
#endif
}
nsresult
NS_NewXTFXMLVisualWrapper(nsIXTFXMLVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult)
{
*aResult = nsnull;
if (!xtfElement) {
NS_ERROR("can't construct an xtf wrapper without an xtf element");
return NS_ERROR_FAILURE;
}
nsXTFXMLVisualWrapper* result = new nsXTFXMLVisualWrapper(ni, xtfElement);
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
nsresult rv = result->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(result);
return rv;
}
*aResult = result;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFXMLVisualWrapper,nsXTFXMLVisualWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFXMLVisualWrapper,nsXTFXMLVisualWrapperBase)
NS_INTERFACE_MAP_BEGIN(nsXTFXMLVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFXMLVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFStyledElementWrapper)
NS_INTERFACE_MAP_END_INHERITING(nsXTFXMLVisualWrapperBase)
//----------------------------------------------------------------------
// nsIXTFXMLVisualWrapper implementation:
// XXX nothing yet

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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 __NS_XTFXMLVISUALWRAPPER_H__
#define __NS_XTFXMLVISUALWRAPPER_H__
class nsIXTFXMLVisual;
class nsIContent;
class nsINodeInfo;
nsresult
NS_NewXTFXMLVisualWrapper(nsIXTFXMLVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
#endif // __NS_XTFXMLVISUALWRAPPER_H__

View File

@ -1,174 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsXTFVisualWrapper.h"
#include "nsIXTFXULVisual.h"
#include "nsXTFWeakTearoff.h"
#include "nsIXTFXULVisualWrapper.h"
typedef nsXTFVisualWrapper nsXTFXULVisualWrapperBase;
////////////////////////////////////////////////////////////////////////
// nsXTFXULVisualWrapper class
class nsXTFXULVisualWrapper : public nsXTFXULVisualWrapperBase,
public nsIXTFXULVisualWrapper
{
protected:
friend nsresult
NS_NewXTFXULVisualWrapper(nsIXTFXULVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
nsXTFXULVisualWrapper(nsINodeInfo* ni, nsIXTFXULVisual* xtfElement);
virtual ~nsXTFXULVisualWrapper();
nsresult Init();
public:
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED
// nsIXTFElementWrapperPrivate interface
virtual PRUint32 GetElementType() { return nsIXTFElement::ELEMENT_TYPE_XUL_VISUAL; }
// nsIXTFXULVisualWrapper interface
NS_DECL_NSIXTFXULVISUALWRAPPER
// nsIXTFStyledElementWrapper
NS_FORWARD_NSIXTFSTYLEDELEMENTWRAPPER(nsXTFStyledElementWrapper::)
// nsIXTFElementWrapper interface
NS_FORWARD_NSIXTFELEMENTWRAPPER(nsXTFXULVisualWrapperBase::)
private:
virtual nsIXTFElement *GetXTFElement() const { return mXTFElement; }
virtual nsIXTFVisual *GetXTFVisual() const { return mXTFElement; }
nsCOMPtr<nsIXTFXULVisual> mXTFElement;
};
//----------------------------------------------------------------------
// implementation:
nsXTFXULVisualWrapper::nsXTFXULVisualWrapper(nsINodeInfo* aNodeInfo,
nsIXTFXULVisual* xtfElement)
: nsXTFXULVisualWrapperBase(aNodeInfo), mXTFElement(xtfElement)
{
#ifdef DEBUG
// printf("nsXTFXULVisualWrapper CTOR\n");
#endif
NS_ASSERTION(mXTFElement, "xtfElement is null");
}
nsresult
nsXTFXULVisualWrapper::Init()
{
nsXTFXULVisualWrapperBase::Init();
// pass a weak wrapper (non base object ref-counted), so that
// our mXTFElement can safely addref/release.
nsISupports *weakWrapper=nsnull;
NS_NewXTFWeakTearoff(NS_GET_IID(nsIXTFXULVisualWrapper),
(nsIXTFXULVisualWrapper*)this,
&weakWrapper);
if (!weakWrapper) {
NS_ERROR("could not construct weak wrapper");
return NS_ERROR_FAILURE;
}
mXTFElement->OnCreated((nsIXTFXULVisualWrapper*)weakWrapper);
weakWrapper->Release();
return NS_OK;
}
nsXTFXULVisualWrapper::~nsXTFXULVisualWrapper()
{
mXTFElement->OnDestroyed();
mXTFElement = nsnull;
#ifdef DEBUG
// printf("nsXTFXULVisualWrapper DTOR\n");
#endif
}
nsresult
NS_NewXTFXULVisualWrapper(nsIXTFXULVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult)
{
*aResult = nsnull;
if (!xtfElement) {
NS_ERROR("can't construct an xtf wrapper without an xtf element");
return NS_ERROR_FAILURE;
}
nsXTFXULVisualWrapper* result = new nsXTFXULVisualWrapper(ni, xtfElement);
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
nsresult rv = result->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(result);
return rv;
}
*aResult = result;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports implementation
NS_IMPL_ADDREF_INHERITED(nsXTFXULVisualWrapper,nsXTFXULVisualWrapperBase)
NS_IMPL_RELEASE_INHERITED(nsXTFXULVisualWrapper,nsXTFXULVisualWrapperBase)
NS_INTERFACE_MAP_BEGIN(nsXTFXULVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFXULVisualWrapper)
NS_INTERFACE_MAP_ENTRY(nsIXTFStyledElementWrapper)
NS_INTERFACE_MAP_END_INHERITING(nsXTFXULVisualWrapperBase)
//----------------------------------------------------------------------
// nsIXTFXULVisualWrapper implementation:
// XXX nothing yet

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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 __NS_XTFXULVISUALWRAPPER_H__
#define __NS_XTFXULVISUALWRAPPER_H__
class nsIXTFXULVisual;
class nsIContent;
class nsINodeInfo;
nsresult
NS_NewXTFXULVisualWrapper(nsIXTFXULVisual* xtfElement,
nsINodeInfo* ni,
nsIContent** aResult);
#endif // __NS_XTFXULVISUALWRAPPER_H__

View File

@ -1,48 +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 XTF project.
#
# The Initial Developer of the Original Code is
# Alex Fritze.
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alex Fritze <alex@croczilla.com> (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 *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -1,87 +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 XTF project.
#
# The Initial Developer of the Original Code is
# Alex Fritze.
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alex Fritze <alex@croczilla.com> (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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkxtfbase_s
LIBXUL_LIBRARY = 1
REQUIRES = xpcom \
string \
content \
gfx \
widget \
dom \
locale \
necko \
webshell \
$(NULL)
CPPSRCS = \
nsXTFXULDisplayFrame.cpp \
nsXTFXMLDisplayFrame.cpp \
nsXTFFrameUtils.cpp \
$(NULL)
ifdef MOZ_SVG
CPPSRCS += nsXTFSVGDisplayFrame.cpp
endif
include $(topsrcdir)/config/config.mk
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../../generic \
-I$(srcdir)/../../xul/base/src \
$(NULL)
ifdef MOZ_SVG
LOCAL_INCLUDES += -I$(srcdir)/../../svg/base/src
endif
DEFINES += -D_IMPL_NS_LAYOUT

View File

@ -1,72 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
* Alex Fritze <alex@croczilla.com>
*
* 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 ***** */
#include "nsXTFFrameUtils.h"
#include "nsIFrame.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIDOMElement.h"
nsIFrame*
nsXTFFrameUtils::GetContentInsertionFrame(nsIFrame *aFrame)
{
nsCOMPtr<nsIContent> content =
nsXTFFrameUtils::GetContentInsertionNode(aFrame);
NS_ASSERTION(content, "element not implementing nsIContent!?");
return aFrame->GetPresContext()->PresShell()->GetPrimaryFrameFor(content);
}
already_AddRefed<nsIContent>
nsXTFFrameUtils::GetContentInsertionNode(nsIFrame *aFrame)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual =
do_QueryInterface(aFrame->GetContent());
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
nsCOMPtr<nsIDOMElement> childInsertionPoint;
visual->GetInsertionPoint(getter_AddRefs(childInsertionPoint));
if (!childInsertionPoint) return nsnull; // we don't take visual child content
nsIContent *content = nsnull;
CallQueryInterface(childInsertionPoint, &content);
return content;
}

View File

@ -1,58 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
* Alex Fritze <alex@croczilla.com>
*
* 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 nsXTFFrameUtils_h_
#define nsXTFFrameUtils_h_
#include "nsIContent.h"
#include "nsCOMPtr.h"
class nsIFrame;
class nsXTFFrameUtils
{
public:
static NS_HIDDEN_(already_AddRefed<nsIContent>)
GetContentInsertionNode(nsIFrame *aFrame);
static NS_HIDDEN_(nsIFrame*) GetContentInsertionFrame(nsIFrame *aFrame);
};
#endif

View File

@ -1,103 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsContainerFrame.h"
#include "nsPresContext.h"
#include "nsISupportsArray.h"
#include "nsSVGGenericContainerFrame.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIAnonymousContentCreator.h"
typedef nsSVGGenericContainerFrame nsXTFSVGDisplayFrameBase;
class nsXTFSVGDisplayFrame : public nsXTFSVGDisplayFrameBase,
public nsIAnonymousContentCreator
{
public:
nsXTFSVGDisplayFrame(nsStyleContext* aContext) : nsXTFSVGDisplayFrameBase(aContext) {}
friend nsIFrame*
NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
protected:
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// If the creator doesn't want to create special frame for frame hierarchy
// then it should null out the style content arg and return NS_ERROR_FAILURE
NS_IMETHOD CreateFrameFor(nsPresContext* aPresContext,
nsIContent * aContent,
nsIFrame** aFrame) {
if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
};
//----------------------------------------------------------------------
// Implementation
nsIFrame*
NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
{
return new (aPresShell) nsXTFSVGDisplayFrame(aContext);
}
//----------------------------------------------------------------------
// nsISupports methods
NS_INTERFACE_MAP_BEGIN(nsXTFSVGDisplayFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
NS_INTERFACE_MAP_END_INHERITING(nsXTFSVGDisplayFrameBase)
//----------------------------------------------------------------------
// nsIAnonymousContentCreator methods:
NS_IMETHODIMP
nsXTFSVGDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
return visual->CreateAnonymousContent(aPresContext, aAnonymousItems);
}

View File

@ -1,237 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsCOMPtr.h"
#include "nsStyleSet.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsBlockFrame.h"
#include "nsInlineFrame.h"
#include "nsIXTFXMLVisual.h"
#include "nsIDOMElement.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIAnonymousContentCreator.h"
#include "nsXTFFrameUtils.h"
////////////////////////////////////////////////////////////////////////
// nsXTFXMLBlockDisplayFrame
nsIFrame* NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool isBlock);
typedef nsBlockFrame nsXTFXMLBlockDisplayFrameBase;
class nsXTFXMLBlockDisplayFrame : public nsXTFXMLBlockDisplayFrameBase,
public nsIAnonymousContentCreator
{
public:
nsXTFXMLBlockDisplayFrame(nsStyleContext* aContext)
: nsXTFXMLBlockDisplayFrameBase(aContext) {}
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// If the creator doesn't want to create special frame for frame hierarchy
// then it should null out the style content arg and return NS_ERROR_FAILURE
NS_IMETHOD CreateFrameFor(nsPresContext* aPresContext,
nsIContent * aContent,
nsIFrame** aFrame) {
if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
};
//----------------------------------------------------------------------
// nsISupports methods
NS_INTERFACE_MAP_BEGIN(nsXTFXMLBlockDisplayFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
NS_INTERFACE_MAP_END_INHERITING(nsXTFXMLBlockDisplayFrameBase)
//----------------------------------------------------------------------
// nsIFrame methods
nsIFrame*
nsXTFXMLBlockDisplayFrame::GetContentInsertionFrame()
{
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
already_AddRefed<nsIContent>
nsXTFXMLBlockDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP
nsXTFXMLBlockDisplayFrame::DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsXTFXMLBlockDisplayFrameBase::DidReflow(aPresContext, aReflowState, aStatus);
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
visual->DidLayout();
return rv;
}
//----------------------------------------------------------------------
// nsIAnonymousContentCreator methods:
NS_IMETHODIMP
nsXTFXMLBlockDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
return visual->CreateAnonymousContent(aPresContext, aAnonymousItems);
}
////////////////////////////////////////////////////////////////////////
// nsXTFXMLInlineDisplayFrame
typedef nsInlineFrame nsXTFXMLInlineDisplayFrameBase;
class nsXTFXMLInlineDisplayFrame : public nsXTFXMLInlineDisplayFrameBase,
public nsIAnonymousContentCreator
{
public:
nsXTFXMLInlineDisplayFrame(nsStyleContext* aContext)
: nsXTFXMLInlineDisplayFrameBase(aContext) {}
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// If the creator doesn't want to create special frame for frame hierarchy
// then it should null out the style content arg and return NS_ERROR_FAILURE
NS_IMETHOD CreateFrameFor(nsPresContext* aPresContext,
nsIContent * aContent,
nsIFrame** aFrame) {
if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
};
//----------------------------------------------------------------------
// nsISupports methods
NS_INTERFACE_MAP_BEGIN(nsXTFXMLInlineDisplayFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
NS_INTERFACE_MAP_END_INHERITING(nsXTFXMLInlineDisplayFrameBase)
//----------------------------------------------------------------------
// nsIFrame methods
nsIFrame*
nsXTFXMLInlineDisplayFrame::GetContentInsertionFrame()
{
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
already_AddRefed<nsIContent>
nsXTFXMLInlineDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP
nsXTFXMLInlineDisplayFrame::DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsXTFXMLInlineDisplayFrameBase::DidReflow(aPresContext, aReflowState, aStatus);
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
visual->DidLayout();
return rv;
}
//----------------------------------------------------------------------
// nsIAnonymousContentCreator methods:
NS_IMETHODIMP
nsXTFXMLInlineDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
return visual->CreateAnonymousContent(aPresContext, aAnonymousItems);
}
////////////////////////////////////////////////////////////////////////
// Construction API
nsIFrame*
NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool isBlock)
{
if (isBlock)
return new (aPresShell) nsXTFXMLBlockDisplayFrame(aContext);
else
return new (aPresShell) nsXTFXMLInlineDisplayFrame(aContext);
}

View File

@ -1,136 +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 the Mozilla XTF project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (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 ***** */
#include "nsBoxFrame.h"
#include "nsIDOMElement.h"
#include "nsIXTFVisualWrapperPrivate.h"
#include "nsIAnonymousContentCreator.h"
#include "nsXTFFrameUtils.h"
typedef nsBoxFrame nsXTFXULDisplayFrameBase;
class nsXTFXULDisplayFrame : public nsXTFXULDisplayFrameBase,
public nsIAnonymousContentCreator
{
public:
friend nsIFrame* NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsXTFXULDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
public:
// nsIFrame
virtual nsIFrame* GetContentInsertionFrame();
virtual already_AddRefed<nsIContent> GetContentInsertionNode();
NS_IMETHOD EndLayout(nsBoxLayoutState& aState);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// If the creator doesn't want to create special frame for frame hierarchy
// then it should null out the style content arg and return NS_ERROR_FAILURE
NS_IMETHOD CreateFrameFor(nsPresContext* aPresContext,
nsIContent * aContent,
nsIFrame** aFrame) {
if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
};
//----------------------------------------------------------------------
// Implementation
nsIFrame*
NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsXTFXULDisplayFrame(aPresShell, aContext);
}
nsXTFXULDisplayFrame::nsXTFXULDisplayFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
: nsXTFXULDisplayFrameBase(aPresShell, aContext, PR_FALSE, nsnull)
{}
//----------------------------------------------------------------------
// nsISupports methods
NS_INTERFACE_MAP_BEGIN(nsXTFXULDisplayFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
NS_INTERFACE_MAP_END_INHERITING(nsXTFXULDisplayFrameBase)
//----------------------------------------------------------------------
// nsIFrame mehthods
nsIFrame*
nsXTFXULDisplayFrame::GetContentInsertionFrame()
{
return nsXTFFrameUtils::GetContentInsertionFrame(this);
}
already_AddRefed<nsIContent>
nsXTFXULDisplayFrame::GetContentInsertionNode()
{
return nsXTFFrameUtils::GetContentInsertionNode(this);
}
NS_IMETHODIMP
nsXTFXULDisplayFrame::EndLayout(nsBoxLayoutState& aState)
{
nsresult rv = nsXTFXULDisplayFrameBase::EndLayout(aState);
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
visual->DidLayout();
return rv;
}
//----------------------------------------------------------------------
// nsIAnonymousContentCreator methods:
NS_IMETHODIMP
nsXTFXULDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)
{
nsCOMPtr<nsIXTFVisualWrapperPrivate> visual = do_QueryInterface(mContent);
NS_ASSERTION(visual, "huh? associated content not implementing nsIXTFVisualWrapperPrivate");
return visual->CreateAnonymousContent(aPresContext, aAnonymousItems);
}