зеркало из https://github.com/mozilla/pjs.git
Bug 291026, Allow XBL to bind to XTF elements, r=alex, sr=bryner, a=mkaply
This commit is contained in:
Родитель
5d718abb27
Коммит
888311c91a
|
@ -59,6 +59,9 @@ XPIDLSRCS = \
|
|||
nsIXTFXMLVisualWrapper.idl \
|
||||
nsIXTFXULVisual.idl \
|
||||
nsIXTFXULVisualWrapper.idl \
|
||||
nsIXTFBindableElement.idl \
|
||||
nsIXTFBindableElementWrapper.idl \
|
||||
nsIXTFStyledElementWrapper.idl \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_SVG
|
||||
|
|
|
@ -43,7 +43,7 @@ interface nsIDOMElement;
|
|||
interface nsIDOMNode;
|
||||
interface nsIDOMEvent;
|
||||
|
||||
[scriptable, uuid(61077434-18c8-4d2d-956c-7c389a7e9bba)]
|
||||
[scriptable, uuid(a8b607fd-24b6-4a8c-9a89-d9b24f8e2592)]
|
||||
interface nsIXTFElement : nsISupports
|
||||
{
|
||||
// called when the wrapper object is being destroyed.
|
||||
|
@ -67,6 +67,10 @@ interface nsIXTFElement : nsISupports
|
|||
// nsIXTFXULVisual interface in addition to nsIXTFElement:
|
||||
const unsigned long ELEMENT_TYPE_XUL_VISUAL = 3;
|
||||
|
||||
// Elements of type BINDABLE are required to implement the
|
||||
// nsIXTFBindableElement interface in addition to nsIXTFElement:
|
||||
const unsigned long ELEMENT_TYPE_BINDABLE = 4;
|
||||
|
||||
// elementType identifies the type of wrapper that will be built for
|
||||
// a given xtf element. It must remain constant for the entire
|
||||
// lifetime of the xtf element (i.e. before any onCreated()-calls
|
||||
|
|
|
@ -38,17 +38,20 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAtom;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
[scriptable, uuid(94c05b72-997a-4bb0-a23d-63e40c55b02c)]
|
||||
[scriptable, uuid(e71b0b11-45e3-422b-b589-9ea4629e36ec)]
|
||||
interface nsIXTFElementWrapper : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMElement elementNode;
|
||||
readonly attribute nsIDOMElement documentFrameElement;
|
||||
|
||||
// Events can be unmasked by setting the corresponding bit as given
|
||||
// by the NOTIFY_* constants in nsIXTFElement and nsIXTFVisual:
|
||||
/**
|
||||
* Events can be unmasked by setting the corresponding bit as given
|
||||
* by the NOTIFY_* constants in nsIXTFElement and nsIXTFVisual:
|
||||
*/
|
||||
attribute unsigned long notificationMask;
|
||||
};
|
||||
|
||||
|
|
|
@ -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(056d0708-6112-44ff-b3ca-ecf14936d599)]
|
||||
interface nsIXTFSVGVisualWrapper : nsIXTFElementWrapper
|
||||
{
|
||||
};
|
||||
|
|
@ -1,81 +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(59de39e3-56ff-47c0-a580-f15dbde45ed3)]
|
||||
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();
|
||||
|
||||
// Returns an atom holding the name of the "class" attribute.
|
||||
// This is called once during XTFVisual creation.
|
||||
// The xtf element doesn't have to keep a strong ref to the atom.
|
||||
// Note! nsIXTFAttributeHandler can't be used to handle class attribute.
|
||||
nsIAtom getClassAttributeName();
|
||||
};
|
|
@ -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(a260bc18-c639-41e5-b28a-a6b5c8e99993)]
|
||||
interface nsIXTFXMLVisualWrapper : nsIXTFElementWrapper
|
||||
{
|
||||
};
|
||||
|
|
@ -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(b8bb0585-5b59-4e6f-9e0e-13569da1ad33)]
|
||||
interface nsIXTFXULVisualWrapper : nsIXTFElementWrapper
|
||||
{
|
||||
};
|
||||
|
|
@ -69,6 +69,7 @@ CPPSRCS = \
|
|||
nsXTFWeakTearoff.cpp \
|
||||
nsXTFXMLVisualWrapper.cpp \
|
||||
nsXTFXULVisualWrapper.cpp \
|
||||
nsXTFBindableElementWrapper.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_SVG
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
/* -*- 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:
|
||||
void *innerPtr = nsnull;
|
||||
QueryInterfaceInner(aIID, &innerPtr);
|
||||
|
||||
if (innerPtr)
|
||||
return NS_NewXTFInterfaceAggregator(aIID,
|
||||
NS_STATIC_CAST(nsISupports*, innerPtr),
|
||||
NS_STATIC_CAST(nsIContent*, this),
|
||||
aInstancePtr);
|
||||
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXTFBindableElementWrapper implementation:
|
||||
|
||||
// XXX nothing yet
|
||||
|
|
@ -704,3 +704,62 @@ nsXTFElementWrapper::HandleDOMEvent(nsPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// nsXTFStyleableElementWrapper
|
||||
|
||||
nsXTFStyledElementWrapper::nsXTFStyledElementWrapper(nsINodeInfo* aNodeInfo)
|
||||
: nsXTFElementWrapper(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsXTFStyledElementWrapper::GetClassAttributeName() const
|
||||
{
|
||||
return mClassAttributeName;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsXTFStyledElementWrapper::GetClasses() const
|
||||
{
|
||||
const nsAttrValue* val = nsnull;
|
||||
nsIAtom* clazzAttr = GetClassAttributeName();
|
||||
if (clazzAttr) {
|
||||
val = mAttrsAndChildren.GetAttr(clazzAttr);
|
||||
// This is possibly the first time we need any classes.
|
||||
if (val && val->Type() == nsAttrValue::eString) {
|
||||
nsAutoString value;
|
||||
val->ToString(value);
|
||||
nsAttrValue newValue;
|
||||
newValue.ParseAtomArray(value);
|
||||
NS_CONST_CAST(nsAttrAndChildArray*, &mAttrsAndChildren)->
|
||||
SetAndTakeAttr(clazzAttr, newValue);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXTFStyledElementWrapper::HasClass(nsIAtom* aClass, PRBool /*aCaseSensitive*/) const
|
||||
{
|
||||
const nsAttrValue* val = GetClasses();
|
||||
if (val) {
|
||||
if (val->Type() == nsAttrValue::eAtom) {
|
||||
return aClass == val->GetAtomValue();
|
||||
}
|
||||
|
||||
if (val->Type() == nsAttrValue::eAtomArray) {
|
||||
return val->GetAtomArrayValue()->IndexOf(aClass) >= 0;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXTFStyledElementWrapper::SetClassAttributeName(nsIAtom* aName)
|
||||
{
|
||||
// The class attribute name can be set only once
|
||||
if (mClassAttributeName || !aName)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mClassAttributeName = aName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsXMLElement.h"
|
||||
#include "nsIXTFAttributeHandler.h"
|
||||
#include "nsIXTFElement.h"
|
||||
#include "nsIXTFStyledElementWrapper.h"
|
||||
|
||||
typedef nsXMLElement nsXTFElementWrapperBase;
|
||||
|
||||
|
@ -137,4 +138,19 @@ protected:
|
|||
nsCOMPtr<nsIXTFAttributeHandler> mAttributeHandler;
|
||||
};
|
||||
|
||||
class nsXTFStyledElementWrapper : public nsXTFElementWrapper
|
||||
{
|
||||
public:
|
||||
nsXTFStyledElementWrapper(nsINodeInfo* aNodeInfo);
|
||||
|
||||
// for nsIStyledContent
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual const nsAttrValue* GetClasses() const;
|
||||
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
|
||||
|
||||
nsresult SetClassAttributeName(nsIAtom* aName);
|
||||
protected:
|
||||
nsCOMPtr<nsIAtom> mClassAttributeName;
|
||||
};
|
||||
|
||||
#endif // __NS_XTFELEMENTWRAPPER_H__
|
||||
|
|
|
@ -1,172 +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
|
||||
|
||||
// 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_END_INHERITING(nsXTFSVGVisualWrapperBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXTFSVGVisualWrapper implementation:
|
||||
|
||||
// XXX nothing yet
|
||||
|
||||
|
|
@ -50,6 +50,8 @@
|
|||
#include "nsXTFGenericElementWrapper.h"
|
||||
#include "nsXTFXMLVisualWrapper.h"
|
||||
#include "nsXTFXULVisualWrapper.h"
|
||||
#include "nsIXTFBindableElement.h"
|
||||
#include "nsXTFBindableElementWrapper.h"
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsXTFSVGVisualWrapper.h"
|
||||
|
@ -149,7 +151,11 @@ nsXTFService::CreateElement(nsIContent** aResult, nsINodeInfo* aNodeInfo)
|
|||
{
|
||||
nsCOMPtr<nsIXTFGenericElement> elem2 = do_QueryInterface(elem);
|
||||
return NS_NewXTFGenericElementWrapper(elem2, aNodeInfo, aResult);
|
||||
break;
|
||||
}
|
||||
case nsIXTFElement::ELEMENT_TYPE_BINDABLE:
|
||||
{
|
||||
nsCOMPtr<nsIXTFBindableElement> elem2 = do_QueryInterface(elem);
|
||||
return NS_NewXTFBindableElementWrapper(elem2, aNodeInfo, aResult);
|
||||
}
|
||||
case nsIXTFElement::ELEMENT_TYPE_SVG_VISUAL:
|
||||
{
|
||||
|
@ -158,20 +164,18 @@ nsXTFService::CreateElement(nsIContent** aResult, nsINodeInfo* aNodeInfo)
|
|||
return NS_NewXTFSVGVisualWrapper(elem2, aNodeInfo, aResult);
|
||||
#else
|
||||
NS_ERROR("xtf svg visuals are only supported in mozilla builds with native svg support");
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
case nsIXTFElement::ELEMENT_TYPE_XML_VISUAL:
|
||||
{
|
||||
nsCOMPtr<nsIXTFXMLVisual> elem2 = do_QueryInterface(elem);
|
||||
return NS_NewXTFXMLVisualWrapper(elem2, aNodeInfo, aResult);
|
||||
break;
|
||||
}
|
||||
case nsIXTFElement::ELEMENT_TYPE_XUL_VISUAL:
|
||||
{
|
||||
nsCOMPtr<nsIXTFXULVisual> elem2 = do_QueryInterface(elem);
|
||||
return NS_NewXTFXULVisualWrapper(elem2, aNodeInfo, aResult);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_ERROR("unknown xtf element type");
|
||||
|
|
|
@ -1,175 +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()
|
||||
{
|
||||
nsresult rv = nsXTFVisualWrapperBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return GetXTFVisual()->GetClassAttributeName(getter_AddRefs(mClassAttributeName));
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsXTFVisualWrapper::GetClassAttributeName() const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIAtom> classAttr;
|
||||
GetXTFVisual()->GetClassAttributeName(getter_AddRefs(classAttr));
|
||||
NS_WARN_IF_FALSE(classAttr == mClassAttributeName,
|
||||
"The name of the class attribute has changed.");
|
||||
#endif
|
||||
return mClassAttributeName;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsXTFVisualWrapper::GetClasses() const
|
||||
{
|
||||
const nsAttrValue* val = nsnull;
|
||||
nsIAtom* clazzAttr = GetClassAttributeName();
|
||||
if (clazzAttr) {
|
||||
val = mAttrsAndChildren.GetAttr(clazzAttr);
|
||||
// This is possibly the first time we need any classes.
|
||||
if (val && val->Type() == nsAttrValue::eString) {
|
||||
nsAutoString value;
|
||||
val->ToString(value);
|
||||
nsAttrValue newValue;
|
||||
newValue.ParseAtomArray(value);
|
||||
NS_CONST_CAST(nsAttrAndChildArray*, &mAttrsAndChildren)->
|
||||
SetAndTakeAttr(clazzAttr, newValue);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsXTFVisualWrapper::HasClass(nsIAtom* aClass, PRBool /*aCaseSensitive*/) const
|
||||
{
|
||||
const nsAttrValue* val = GetClasses();
|
||||
if (val) {
|
||||
if (val->Type() == nsAttrValue::eAtom) {
|
||||
return aClass == val->GetAtomValue();
|
||||
}
|
||||
|
||||
if (val->Type() == nsAttrValue::eAtomArray) {
|
||||
return val->GetAtomArrayValue()->IndexOf(aClass) >= 0;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
@ -1,81 +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 nsXTFElementWrapper 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();
|
||||
|
||||
// nsIStyledContent
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual const nsAttrValue* GetClasses() const;
|
||||
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
|
||||
|
||||
protected:
|
||||
// to be implemented by subclasses:
|
||||
virtual nsIXTFVisual *GetXTFVisual() const = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> mVisualContent;
|
||||
nsCOMPtr<nsIAtom> mClassAttributeName;
|
||||
};
|
||||
|
||||
#endif // __NS_XTFVISUALWRAPPER_H__
|
|
@ -1,175 +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
|
||||
|
||||
// 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_END_INHERITING(nsXTFXMLVisualWrapperBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXTFXMLVisualWrapper implementation:
|
||||
|
||||
// XXX nothing yet
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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 "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
|
||||
|
||||
// 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_END_INHERITING(nsXTFXULVisualWrapperBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXTFXULVisualWrapper implementation:
|
||||
|
||||
// XXX nothing yet
|
|
@ -36,6 +36,9 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsXFormsAtoms_h_
|
||||
#define nsXFormsAtoms_h_
|
||||
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
/**
|
||||
|
@ -72,3 +75,5 @@ class nsXFormsAtoms
|
|||
private:
|
||||
static NS_HIDDEN_(const nsStaticAtom) Atoms_info[];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIModelElementPrivate.h"
|
||||
#include "nsXFormsAtoms.h"
|
||||
#include "nsXFormsControlStub.h"
|
||||
#include "nsXFormsMDGEngine.h"
|
||||
|
||||
|
@ -83,20 +82,15 @@ nsXFormsHintHelpListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsControlStub,
|
||||
nsXFormsXMLVisualStub,
|
||||
nsIXFormsContextControl,
|
||||
nsIXFormsControl)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::GetBoundNode(nsIDOMNode **aBoundNode)
|
||||
nsXFormsControlStubBase::GetBoundNode(nsIDOMNode **aBoundNode)
|
||||
{
|
||||
NS_IF_ADDREF(*aBoundNode = mBoundNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::GetDependencies(nsCOMArray<nsIDOMNode> **aDependencies)
|
||||
nsXFormsControlStubBase::GetDependencies(nsCOMArray<nsIDOMNode> **aDependencies)
|
||||
{
|
||||
if (aDependencies)
|
||||
*aDependencies = &mDependencies;
|
||||
|
@ -104,14 +98,14 @@ nsXFormsControlStub::GetDependencies(nsCOMArray<nsIDOMNode> **aDependencies)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::GetElement(nsIDOMElement **aElement)
|
||||
nsXFormsControlStubBase::GetElement(nsIDOMElement **aElement)
|
||||
{
|
||||
NS_IF_ADDREF(*aElement = mElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::RemoveIndexListeners()
|
||||
nsXFormsControlStubBase::RemoveIndexListeners()
|
||||
{
|
||||
if (!mIndexesUsed.Count())
|
||||
return;
|
||||
|
@ -125,9 +119,9 @@ nsXFormsControlStub::RemoveIndexListeners()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::ResetBoundNode(const nsString &aBindAttribute,
|
||||
PRUint16 aResultType,
|
||||
nsIDOMXPathResult **aResult)
|
||||
nsXFormsControlStubBase::ResetBoundNode(const nsString &aBindAttribute,
|
||||
PRUint16 aResultType,
|
||||
nsIDOMXPathResult **aResult)
|
||||
{
|
||||
// Clear existing bound node, etc.
|
||||
mBoundNode = nsnull;
|
||||
|
@ -167,21 +161,21 @@ nsXFormsControlStub::ResetBoundNode(const nsString &aBindAttribute,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::Bind()
|
||||
nsXFormsControlStubBase::Bind()
|
||||
{
|
||||
return ResetBoundNode(NS_LITERAL_STRING("ref"),
|
||||
nsIDOMXPathResult::FIRST_ORDERED_NODE_TYPE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::TryFocus(PRBool* aOK)
|
||||
nsXFormsControlStubBase::TryFocus(PRBool* aOK)
|
||||
{
|
||||
*aOK = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::IsEventTarget(PRBool *aOK)
|
||||
nsXFormsControlStubBase::IsEventTarget(PRBool *aOK)
|
||||
{
|
||||
*aOK = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -189,7 +183,7 @@ nsXFormsControlStub::IsEventTarget(PRBool *aOK)
|
|||
|
||||
|
||||
nsresult
|
||||
nsXFormsControlStub::ProcessNodeBinding(const nsString &aBindingAttr,
|
||||
nsXFormsControlStubBase::ProcessNodeBinding(const nsString &aBindingAttr,
|
||||
PRUint16 aResultType,
|
||||
nsIDOMXPathResult **aResult,
|
||||
nsIModelElementPrivate **aModel)
|
||||
|
@ -255,7 +249,7 @@ nsXFormsControlStub::ProcessNodeBinding(const nsString &aBindingAttr,
|
|||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::ResetHelpAndHint(PRBool aInitialize)
|
||||
nsXFormsControlStubBase::ResetHelpAndHint(PRBool aInitialize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(mElement));
|
||||
if (!targ)
|
||||
|
@ -284,7 +278,7 @@ nsXFormsControlStub::ResetHelpAndHint(PRBool aInitialize)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsXFormsControlStub::GetReadOnlyState()
|
||||
nsXFormsControlStubBase::GetReadOnlyState()
|
||||
{
|
||||
PRBool res = PR_FALSE;
|
||||
if (mElement) {
|
||||
|
@ -294,7 +288,7 @@ nsXFormsControlStub::GetReadOnlyState()
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsXFormsControlStub::GetRelevantState()
|
||||
nsXFormsControlStubBase::GetRelevantState()
|
||||
{
|
||||
PRBool res = PR_FALSE;
|
||||
if (mElement) {
|
||||
|
@ -303,9 +297,9 @@ nsXFormsControlStub::GetRelevantState()
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled)
|
||||
{
|
||||
NS_ENSURE_ARG(aHandled);
|
||||
*aHandled = PR_FALSE;
|
||||
|
@ -332,8 +326,8 @@ nsXFormsControlStub::HandleDefault(nsIDOMEvent *aEvent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::Create(nsIXTFElementWrapper *aWrapper)
|
||||
{
|
||||
aWrapper->SetNotificationMask(kStandardNotificationMask);
|
||||
|
||||
|
@ -345,8 +339,8 @@ nsXFormsControlStub::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::OnDestroyed()
|
||||
nsresult
|
||||
nsXFormsControlStubBase::OnDestroyed()
|
||||
{
|
||||
ResetHelpAndHint(PR_FALSE);
|
||||
RemoveIndexListeners();
|
||||
|
@ -360,8 +354,8 @@ nsXFormsControlStub::OnDestroyed()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::DocumentChanged(nsIDOMDocument *aNewDocument)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::DocumentChanged(nsIDOMDocument *aNewDocument)
|
||||
{
|
||||
// We need to re-evaluate our instance data binding when our document
|
||||
// changes, since our context can change
|
||||
|
@ -373,8 +367,8 @@ nsXFormsControlStub::DocumentChanged(nsIDOMDocument *aNewDocument)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::ParentChanged(nsIDOMElement *aNewParent)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::ParentChanged(nsIDOMElement *aNewParent)
|
||||
{
|
||||
mHasParent = aNewParent != nsnull;
|
||||
// We need to re-evaluate our instance data binding when our parent changes,
|
||||
|
@ -387,29 +381,29 @@ nsXFormsControlStub::ParentChanged(nsIDOMElement *aNewParent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::WillSetAttribute(nsIAtom *aName, const nsAString &aValue)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::WillSetAttribute(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
MaybeRemoveFromModel(aName, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::AttributeSet(nsIAtom *aName, const nsAString &aValue)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::AttributeSet(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
MaybeBindAndRefresh(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::WillRemoveAttribute(nsIAtom *aName)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::WillRemoveAttribute(nsIAtom *aName)
|
||||
{
|
||||
MaybeRemoveFromModel(aName, EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::AttributeRemoved(nsIAtom *aName)
|
||||
nsresult
|
||||
nsXFormsControlStubBase::AttributeRemoved(nsIAtom *aName)
|
||||
{
|
||||
MaybeBindAndRefresh(aName);
|
||||
return NS_OK;
|
||||
|
@ -418,16 +412,16 @@ nsXFormsControlStub::AttributeRemoved(nsIAtom *aName)
|
|||
// nsIXFormsContextControl
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::SetContextNode(nsIDOMNode *aContextNode)
|
||||
nsXFormsControlStubBase::SetContextNode(nsIDOMNode *aContextNode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsControlStub::GetContext(nsAString &aModelID,
|
||||
nsIDOMNode **aContextNode,
|
||||
PRInt32 *aContextPosition,
|
||||
PRInt32 *aContextSize)
|
||||
nsXFormsControlStubBase::GetContext(nsAString &aModelID,
|
||||
nsIDOMNode **aContextNode,
|
||||
PRInt32 *aContextPosition,
|
||||
PRInt32 *aContextSize)
|
||||
{
|
||||
NS_ENSURE_ARG(aContextSize);
|
||||
NS_ENSURE_ARG(aContextPosition);
|
||||
|
@ -451,7 +445,7 @@ nsXFormsControlStub::GetContext(nsAString &aModelID,
|
|||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::ResetProperties()
|
||||
nsXFormsControlStubBase::ResetProperties()
|
||||
{
|
||||
if (!mElement) {
|
||||
return;
|
||||
|
@ -465,7 +459,7 @@ nsXFormsControlStub::ResetProperties()
|
|||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::AddRemoveSNBAttr(nsIAtom *aName, const nsAString &aValue)
|
||||
nsXFormsControlStubBase::AddRemoveSNBAttr(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
nsAutoString attrStr, attrValue;
|
||||
aName->ToString(attrStr);
|
||||
|
@ -487,7 +481,7 @@ nsXFormsControlStub::AddRemoveSNBAttr(nsIAtom *aName, const nsAString &aValue)
|
|||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::MaybeBindAndRefresh(nsIAtom *aName)
|
||||
nsXFormsControlStubBase::MaybeBindAndRefresh(nsIAtom *aName)
|
||||
{
|
||||
if (aName == nsXFormsAtoms::bind ||
|
||||
aName == nsXFormsAtoms::ref ||
|
||||
|
@ -500,8 +494,8 @@ nsXFormsControlStub::MaybeBindAndRefresh(nsIAtom *aName)
|
|||
}
|
||||
|
||||
void
|
||||
nsXFormsControlStub::MaybeRemoveFromModel(nsIAtom *aName,
|
||||
const nsAString &aValue)
|
||||
nsXFormsControlStubBase::MaybeRemoveFromModel(nsIAtom *aName,
|
||||
const nsAString &aValue)
|
||||
{
|
||||
if (aName == nsXFormsAtoms::model ||
|
||||
aName == nsXFormsAtoms::bind ||
|
||||
|
@ -514,3 +508,15 @@ nsXFormsControlStub::MaybeRemoveFromModel(nsIAtom *aName,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsControlStub,
|
||||
nsXFormsXMLVisualStub,
|
||||
nsIXFormsContextControl,
|
||||
nsIXFormsControl)
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsBindableControlStub,
|
||||
nsXFormsBindableStub,
|
||||
nsIXFormsContextControl,
|
||||
nsIXFormsControl)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Allan Beaufour <abeaufour@novell.com>
|
||||
* 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
|
||||
|
@ -45,6 +46,7 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIXTFElement.h"
|
||||
#include "nsXFormsAtoms.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
#include "nsIModelElementPrivate.h"
|
||||
|
@ -52,6 +54,8 @@
|
|||
#include "nsIXFormsRepeatElement.h"
|
||||
#include "nsXFormsStubElement.h"
|
||||
#include "nsXFormsUtils.h"
|
||||
#include "nsIXTFXMLVisualWrapper.h"
|
||||
#include "nsIXTFBindableElementWrapper.h"
|
||||
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMXPathResult;
|
||||
|
@ -61,19 +65,14 @@ class nsIXTFXMLVisualWrapper;
|
|||
* Common stub for all XForms controls that inherit from nsIXFormsControl and
|
||||
* is bound to an instance node.
|
||||
*
|
||||
* It also inherits from nsXFormsXMLVisualStub, and overrides a couple of its
|
||||
* functions.
|
||||
*
|
||||
* @bug If a control has a model attribute, but no binding attributes we fail
|
||||
* to set this as the context for children. We need to return the contextnode
|
||||
* from EvaluateNodeBinding in that case, and return that in GetContext(). (XXX)
|
||||
* @see http://bugzilla.mozilla.org/show_bug.cgi?id=280366
|
||||
*/
|
||||
class nsXFormsControlStub : public nsIXFormsControl,
|
||||
public nsXFormsXMLVisualStub
|
||||
class nsXFormsControlStubBase : public nsIXFormsControl
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
/** The standard notification flags set on nsIXTFElement */
|
||||
const PRUint32 kStandardNotificationMask;
|
||||
|
@ -95,20 +94,17 @@ public:
|
|||
NS_IMETHOD TryFocus(PRBool* aOK);
|
||||
NS_IMETHOD IsEventTarget(PRBool *aOK);
|
||||
|
||||
// nsIXTFXMLVisual overrides
|
||||
/** This sets the notification mask and initializes mElement */
|
||||
NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper);
|
||||
|
||||
// nsIXTFElement overrides
|
||||
NS_IMETHOD HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled);
|
||||
NS_IMETHOD OnDestroyed();
|
||||
NS_IMETHOD DocumentChanged(nsIDOMDocument *aNewDocument);
|
||||
NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent);
|
||||
NS_IMETHOD WillSetAttribute(nsIAtom *aName, const nsAString &aValue);
|
||||
NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aValue);
|
||||
NS_IMETHOD WillRemoveAttribute(nsIAtom *aName);
|
||||
NS_IMETHOD AttributeRemoved(nsIAtom *aName);
|
||||
nsresult Create(nsIXTFElementWrapper *aWrapper);
|
||||
// for nsIXTFElement
|
||||
nsresult HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled);
|
||||
nsresult OnDestroyed();
|
||||
nsresult DocumentChanged(nsIDOMDocument *aNewDocument);
|
||||
nsresult ParentChanged(nsIDOMElement *aNewParent);
|
||||
nsresult WillSetAttribute(nsIAtom *aName, const nsAString &aValue);
|
||||
nsresult AttributeSet(nsIAtom *aName, const nsAString &aValue);
|
||||
nsresult WillRemoveAttribute(nsIAtom *aName);
|
||||
nsresult AttributeRemoved(nsIAtom *aName);
|
||||
|
||||
/**
|
||||
* This function manages the mBindAttrsCount value. mBindAttrsCount will
|
||||
|
@ -132,7 +128,7 @@ public:
|
|||
NS_DECL_NSIXFORMSCONTEXTCONTROL
|
||||
|
||||
/** Constructor */
|
||||
nsXFormsControlStub() :
|
||||
nsXFormsControlStubBase() :
|
||||
kStandardNotificationMask(nsIXTFElement::NOTIFY_WILL_SET_ATTRIBUTE |
|
||||
nsIXTFElement::NOTIFY_ATTRIBUTE_SET |
|
||||
nsIXTFElement::NOTIFY_WILL_REMOVE_ATTRIBUTE |
|
||||
|
@ -224,4 +220,129 @@ protected:
|
|||
void RemoveIndexListeners();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* nsXFormsControlStub inherits from nsXFormsXMLVisualStub
|
||||
*/
|
||||
class nsXFormsControlStub : public nsXFormsControlStubBase,
|
||||
public nsXFormsXMLVisualStub
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
// nsIXTFXMLVisual overrides
|
||||
/** This sets the notification mask and initializes mElement */
|
||||
NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
||||
{
|
||||
NS_ENSURE_ARG(aWrapper);
|
||||
aWrapper->SetClassAttributeName(nsXFormsAtoms::clazz);
|
||||
return nsXFormsControlStubBase::Create(aWrapper);
|
||||
}
|
||||
|
||||
// nsIXTFElement overrides
|
||||
NS_IMETHOD HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled)
|
||||
{
|
||||
return nsXFormsControlStubBase::HandleDefault(aEvent, aHandled);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDestroyed() {
|
||||
return nsXFormsControlStubBase::OnDestroyed();
|
||||
}
|
||||
|
||||
NS_IMETHOD DocumentChanged(nsIDOMDocument *aNewDocument)
|
||||
{
|
||||
return nsXFormsControlStubBase::DocumentChanged(aNewDocument);
|
||||
}
|
||||
|
||||
NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent)
|
||||
{
|
||||
return nsXFormsControlStubBase::ParentChanged(aNewParent);
|
||||
}
|
||||
|
||||
NS_IMETHOD WillSetAttribute(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
return nsXFormsControlStubBase::WillSetAttribute(aName, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
return nsXFormsControlStubBase::AttributeSet(aName, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHOD WillRemoveAttribute(nsIAtom *aName)
|
||||
{
|
||||
return nsXFormsControlStubBase::WillRemoveAttribute(aName);
|
||||
}
|
||||
|
||||
NS_IMETHOD AttributeRemoved(nsIAtom *aName)
|
||||
{
|
||||
return nsXFormsControlStubBase::AttributeRemoved(aName);
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
nsXFormsControlStub() : nsXFormsControlStubBase() {};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* nsXFormsBindableControlStub inherits from nsXFormsBindableStub
|
||||
*/
|
||||
class nsXFormsBindableControlStub : public nsXFormsControlStubBase,
|
||||
public nsXFormsBindableStub
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
// nsIXTFBindableElement overrides
|
||||
/** This sets the notification mask and initializes mElement */
|
||||
NS_IMETHOD OnCreated(nsIXTFBindableElementWrapper *aWrapper)
|
||||
{
|
||||
NS_ENSURE_ARG(aWrapper);
|
||||
aWrapper->SetClassAttributeName(nsXFormsAtoms::clazz);
|
||||
return nsXFormsControlStubBase::Create(aWrapper);
|
||||
}
|
||||
|
||||
// nsIXTFElement overrides
|
||||
NS_IMETHOD HandleDefault(nsIDOMEvent *aEvent,
|
||||
PRBool *aHandled)
|
||||
{
|
||||
return nsXFormsControlStubBase::HandleDefault(aEvent, aHandled);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDestroyed() {
|
||||
return nsXFormsControlStubBase::OnDestroyed();
|
||||
}
|
||||
|
||||
NS_IMETHOD DocumentChanged(nsIDOMDocument *aNewDocument)
|
||||
{
|
||||
return nsXFormsControlStubBase::DocumentChanged(aNewDocument);
|
||||
}
|
||||
|
||||
NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent)
|
||||
{
|
||||
return nsXFormsControlStubBase::ParentChanged(aNewParent);
|
||||
}
|
||||
|
||||
NS_IMETHOD WillSetAttribute(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
return nsXFormsControlStubBase::WillSetAttribute(aName, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aValue)
|
||||
{
|
||||
return nsXFormsControlStubBase::AttributeSet(aName, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHOD WillRemoveAttribute(nsIAtom *aName)
|
||||
{
|
||||
return nsXFormsControlStubBase::WillRemoveAttribute(aName);
|
||||
}
|
||||
|
||||
NS_IMETHOD AttributeRemoved(nsIAtom *aName)
|
||||
{
|
||||
return nsXFormsControlStubBase::AttributeRemoved(aName);
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
nsXFormsBindableControlStub() : nsXFormsControlStubBase() {};
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -374,13 +374,6 @@ nsXFormsXMLVisualStub::DidLayout()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsXMLVisualStub::GetClassAttributeName(nsIAtom** aName)
|
||||
{
|
||||
NS_ADDREF(*aName = nsXFormsAtoms::clazz);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsXMLVisualStub::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
||||
{
|
||||
|
@ -403,3 +396,160 @@ NS_NewXFormsXMLVisualStub(nsIXTFElement **aResult)
|
|||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsXFormsBindableStub implementation
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsXFormsBindableStub, nsIXTFElement, nsIXTFBindableElement)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::OnDestroyed()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::GetElementType(PRUint32 *aElementType)
|
||||
{
|
||||
*aElementType = nsIXTFElement::ELEMENT_TYPE_BINDABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::GetIsAttributeHandler(PRBool *aIsAttributeHandler)
|
||||
{
|
||||
*aIsAttributeHandler = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::GetScriptingInterfaces(PRUint32 *aCount, nsIID ***aArray)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillChangeDocument(nsIDOMDocument *aNewDocument)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::DocumentChanged(nsIDOMDocument *aNewDocument)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillChangeParent(nsIDOMElement *aNewParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::ParentChanged(nsIDOMElement *aNewParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillInsertChild(nsIDOMNode *aChild, PRUint32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::ChildInserted(nsIDOMNode *aChild, PRUint32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillAppendChild(nsIDOMNode *aChild)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::ChildAppended(nsIDOMNode *aChild)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillRemoveChild(PRUint32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::ChildRemoved(PRUint32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillSetAttribute(nsIAtom *aName,
|
||||
const nsAString &aNewValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::AttributeSet(nsIAtom *aName, const nsAString &aNewValue)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::WillRemoveAttribute(nsIAtom *aName)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::AttributeRemoved(nsIAtom *aName)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::BeginAddingChildren()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::DoneAddingChildren()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::HandleDefault(nsIDOMEvent *aEvent, PRBool *aHandled)
|
||||
{
|
||||
*aHandled = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::OnCreated(nsIXTFBindableElementWrapper *aWrapper)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsBindableStub::CloneState(nsIDOMElement *aElement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXFormsBindableStub(nsIXTFElement **aResult)
|
||||
{
|
||||
*aResult = new nsXFormsBindableStub();
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include "nsIXTFGenericElement.h"
|
||||
#include "nsIXTFXMLVisual.h"
|
||||
#include "nsIXTFBindableElement.h"
|
||||
|
||||
/**
|
||||
* An implementation of a generic non-UI XForms element.
|
||||
|
@ -86,6 +87,28 @@ public:
|
|||
NS_DECL_NSIXTFXMLVISUAL
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of an XForms bindable control.
|
||||
*
|
||||
* This is a base class for UI controls that use nsIXTFBindableElement.
|
||||
* Note: a pointer to the anonymous content root is _not_ provided as part
|
||||
* of this base class because different implementations want to store
|
||||
* different types of interface pointers.
|
||||
*/
|
||||
class nsXFormsBindableStub : public nsIXTFBindableElement
|
||||
{
|
||||
protected:
|
||||
// We need a virtual destructor so that when a subclass does
|
||||
// NS_IMPL_ISUPPORTS_INHERITED, our Release() implementation calls the
|
||||
// derived class destructor.
|
||||
virtual ~nsXFormsBindableStub() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIXTFELEMENT
|
||||
NS_DECL_NSIXTFBINDABLEELEMENT
|
||||
};
|
||||
|
||||
/* Factory methods */
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsStubElement(nsIXTFElement **aResult);
|
||||
|
@ -93,4 +116,6 @@ NS_NewXFormsStubElement(nsIXTFElement **aResult);
|
|||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsXMLVisualStub(nsIXTFElement **aResult);
|
||||
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsBindableStub(nsIXTFElement **aResult);
|
||||
#endif
|
||||
|
|
|
@ -7644,7 +7644,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsFrameConstructorState& aState,
|
|||
// display:none, so they don't mess with pseudo-state!
|
||||
aState.mFrameManager->SetUndisplayedContent(aContent, styleContext);
|
||||
return NS_OK;
|
||||
} else
|
||||
} else if (xtfElem->GetElementType() != nsIXTFElement::ELEMENT_TYPE_BINDABLE)
|
||||
rv = ConstructXTFFrame(aState, aContent, adjParentFrame, aTag,
|
||||
aNameSpaceID, styleContext, *frameItems,
|
||||
pseudoParent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче