2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
The base XUL element class and associates.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsXULElement_h__
|
|
|
|
#define nsXULElement_h__
|
|
|
|
|
2014-04-11 15:19:05 -07:00
|
|
|
#include "js/TracingAPI.h"
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMEvent.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIAtom.h"
|
2014-06-19 19:01:40 -07:00
|
|
|
#include "mozilla/dom/NodeInfo.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIControllers.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIDOMXULElement.h"
|
|
|
|
#include "nsIDOMXULMultSelectCntrlEl.h"
|
|
|
|
#include "nsIRDFCompositeDataSource.h"
|
|
|
|
#include "nsIRDFResource.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsIXULTemplateBuilder.h"
|
|
|
|
#include "nsLayoutCID.h"
|
|
|
|
#include "nsAttrAndChildArray.h"
|
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2010-02-23 20:37:46 -08:00
|
|
|
#include "nsStyledElement.h"
|
2008-03-21 04:18:10 -07:00
|
|
|
#include "nsIFrameLoader.h"
|
2013-01-29 09:51:55 -08:00
|
|
|
#include "nsFrameLoader.h"
|
2013-09-20 03:21:03 -07:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2013-10-02 13:09:18 -07:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIDocument;
|
|
|
|
class nsString;
|
|
|
|
class nsIDocShell;
|
2013-08-19 16:24:27 -07:00
|
|
|
class nsXULPrototypeDocument;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIObjectInputStream;
|
|
|
|
class nsIObjectOutputStream;
|
2014-03-16 23:56:53 -07:00
|
|
|
class nsIOffThreadScriptReceiver;
|
2008-10-08 04:41:52 -07:00
|
|
|
class nsXULPrototypeNode;
|
|
|
|
typedef nsTArray<nsRefPtr<nsXULPrototypeNode> > nsPrototypeArray;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-10 18:48:57 -08:00
|
|
|
namespace mozilla {
|
2014-03-17 21:48:19 -07:00
|
|
|
class EventChainPreVisitor;
|
2014-03-16 23:56:53 -07:00
|
|
|
class EventListenerManager;
|
2011-03-10 18:48:57 -08:00
|
|
|
namespace css {
|
|
|
|
class StyleRule;
|
|
|
|
}
|
2014-10-14 13:15:21 -07:00
|
|
|
namespace dom {
|
|
|
|
class BoxObject;
|
|
|
|
}
|
2011-03-10 18:48:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-25 07:11:57 -07:00
|
|
|
namespace JS {
|
|
|
|
class SourceBufferHolder;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
|
|
|
|
#define XUL_PROTOTYPE_ATTRIBUTE_METER(counter) (nsXULPrototypeAttribute::counter++)
|
|
|
|
#else
|
|
|
|
#define XUL_PROTOTYPE_ATTRIBUTE_METER(counter) ((void) 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
A prototype attribute for an nsXULPrototypeElement.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsXULPrototypeAttribute
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXULPrototypeAttribute()
|
2012-07-19 02:18:01 -07:00
|
|
|
: mName(nsGkAtoms::id) // XXX this is a hack, but names have to have a value
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumAttributes);
|
|
|
|
MOZ_COUNT_CTOR(nsXULPrototypeAttribute);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsXULPrototypeAttribute();
|
|
|
|
|
|
|
|
nsAttrName mName;
|
|
|
|
nsAttrValue mValue;
|
|
|
|
|
|
|
|
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t gNumElements;
|
|
|
|
static uint32_t gNumAttributes;
|
|
|
|
static uint32_t gNumCacheTests;
|
|
|
|
static uint32_t gNumCacheHits;
|
|
|
|
static uint32_t gNumCacheSets;
|
|
|
|
static uint32_t gNumCacheFills;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif /* !XUL_PROTOTYPE_ATTRIBUTE_METERING */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
A prototype content model element that holds the "primordial" values
|
2012-07-19 02:18:01 -07:00
|
|
|
that have been parsed from the original XUL document.
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-08-24 09:50:06 -07:00
|
|
|
class nsXULPrototypeNode
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type { eType_Element, eType_Script, eType_Text, eType_PI };
|
|
|
|
|
|
|
|
Type mType;
|
|
|
|
|
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIURI* aDocumentURI,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual const char* ClassName() = 0;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual uint32_t ClassSize() = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2007-07-05 15:40:26 -07:00
|
|
|
/**
|
|
|
|
* The prototype document must call ReleaseSubtree when it is going
|
|
|
|
* away. This makes the parents through the tree stop owning their
|
|
|
|
* children, whether or not the parent's reference count is zero.
|
|
|
|
* Individual elements may still own individual prototypes, but
|
|
|
|
* those prototypes no longer remember their children to allow them
|
|
|
|
* to be constructed.
|
|
|
|
*/
|
2008-10-08 04:41:52 -07:00
|
|
|
virtual void ReleaseSubtree() { }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-24 09:50:06 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsXULPrototypeNode)
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsXULPrototypeNode)
|
2007-05-24 07:10:02 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit nsXULPrototypeNode(Type aType)
|
2008-10-08 04:41:52 -07:00
|
|
|
: mType(aType) {}
|
2014-06-24 19:09:15 -07:00
|
|
|
virtual ~nsXULPrototypeNode() {}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsXULPrototypeElement : public nsXULPrototypeNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXULPrototypeElement()
|
|
|
|
: nsXULPrototypeNode(eType_Element),
|
|
|
|
mNumAttributes(0),
|
2011-10-17 07:59:28 -07:00
|
|
|
mHasIdAttribute(false),
|
|
|
|
mHasClassAttribute(false),
|
|
|
|
mHasStyleAttribute(false),
|
2012-07-30 07:20:58 -07:00
|
|
|
mAttributes(nullptr)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~nsXULPrototypeElement()
|
|
|
|
{
|
2007-10-29 06:45:07 -07:00
|
|
|
Unlink();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeElement"; }
|
|
|
|
virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); }
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void ReleaseSubtree() MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
for (int32_t i = mChildren.Length() - 1; i >= 0; i--) {
|
2008-10-08 04:41:52 -07:00
|
|
|
if (mChildren[i].get())
|
|
|
|
mChildren[i]->ReleaseSubtree();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2008-10-08 04:41:52 -07:00
|
|
|
mChildren.Clear();
|
|
|
|
nsXULPrototypeNode::ReleaseSubtree();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIURI* aDocumentURI,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult SetAttrAt(uint32_t aPos, const nsAString& aValue, nsIURI* aDocumentURI);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-29 06:45:07 -07:00
|
|
|
void Unlink();
|
|
|
|
|
2012-08-24 13:22:23 -07:00
|
|
|
// Trace all scripts held by this element and its children.
|
|
|
|
void TraceAllScripts(JSTracer* aTrc);
|
|
|
|
|
2008-10-08 04:41:52 -07:00
|
|
|
nsPrototypeArray mChildren;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
nsRefPtr<mozilla::dom::NodeInfo> mNodeInfo;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mNumAttributes:29;
|
|
|
|
uint32_t mHasIdAttribute:1;
|
|
|
|
uint32_t mHasClassAttribute:1;
|
|
|
|
uint32_t mHasStyleAttribute:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsXULPrototypeAttribute* mAttributes; // [OWNER]
|
|
|
|
};
|
|
|
|
|
2013-03-26 08:31:53 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class XULDocument;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsXULPrototypeScript : public nsXULPrototypeNode
|
|
|
|
{
|
|
|
|
public:
|
2012-08-22 08:56:38 -07:00
|
|
|
nsXULPrototypeScript(uint32_t aLineNo, uint32_t version);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~nsXULPrototypeScript();
|
|
|
|
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeScript"; }
|
|
|
|
virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); }
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult SerializeOutOfLine(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIURI* aDocumentURI,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult DeserializeOutOfLine(nsIObjectInputStream* aInput,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-25 07:11:57 -07:00
|
|
|
nsresult Compile(JS::SourceBufferHolder& aSrcBuf,
|
|
|
|
nsIURI* aURI, uint32_t aLineNo,
|
|
|
|
nsIDocument* aDocument,
|
|
|
|
nsIOffThreadScriptReceiver *aOffThreadReceiver = nullptr);
|
|
|
|
|
2014-01-04 07:02:17 -08:00
|
|
|
nsresult Compile(const char16_t* aText, int32_t aTextLength,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIURI* aURI, uint32_t aLineNo,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDocument* aDocument,
|
2013-08-15 14:14:43 -07:00
|
|
|
nsIOffThreadScriptReceiver *aOffThreadReceiver = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-11 06:29:50 -07:00
|
|
|
void UnlinkJSObjects();
|
2007-10-29 06:45:07 -07:00
|
|
|
|
2011-10-29 13:13:31 -07:00
|
|
|
void Set(JSScript* aObject);
|
2007-10-29 06:45:07 -07:00
|
|
|
|
2013-05-20 05:40:06 -07:00
|
|
|
// It's safe to return a handle because we trace mScriptObject, no one ever
|
|
|
|
// uses the handle (or the script object) past the point at which the
|
|
|
|
// nsXULPrototypeScript dies, and we can't get memmoved so the
|
|
|
|
// &mScriptObject pointer can't go stale.
|
|
|
|
JS::Handle<JSScript*> GetScriptObject()
|
2007-10-29 06:45:07 -07:00
|
|
|
{
|
2013-07-23 02:58:28 -07:00
|
|
|
// Calling fromMarkedLocation() is safe because we trace mScriptObject in
|
|
|
|
// TraceScriptObject() and because its value is never changed after it has
|
|
|
|
// been set.
|
2013-07-23 02:58:27 -07:00
|
|
|
return JS::Handle<JSScript*>::fromMarkedLocation(mScriptObject.address());
|
2012-08-24 13:22:23 -07:00
|
|
|
}
|
2012-04-24 15:31:28 -07:00
|
|
|
|
2013-03-28 13:37:22 -07:00
|
|
|
void TraceScriptObject(JSTracer* aTrc)
|
|
|
|
{
|
|
|
|
if (mScriptObject) {
|
2014-08-13 02:05:22 -07:00
|
|
|
JS_CallScriptTracer(aTrc, &mScriptObject, "active window XUL prototype script");
|
2013-03-28 13:37:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-27 04:50:49 -07:00
|
|
|
void Trace(const TraceCallbacks& aCallbacks, void* aClosure)
|
|
|
|
{
|
|
|
|
if (mScriptObject) {
|
|
|
|
aCallbacks.Trace(&mScriptObject, "mScriptObject", aClosure);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIURI> mSrcURI;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mLineNo;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSrcLoading;
|
|
|
|
bool mOutOfLine;
|
2013-03-26 08:31:53 -07:00
|
|
|
mozilla::dom::XULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mLangVersion;
|
2012-08-24 13:22:23 -07:00
|
|
|
private:
|
2013-06-18 03:00:37 -07:00
|
|
|
JS::Heap<JSScript*> mScriptObject;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsXULPrototypeText : public nsXULPrototypeNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXULPrototypeText()
|
|
|
|
: nsXULPrototypeNode(eType_Text)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~nsXULPrototypeText()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeText"; }
|
|
|
|
virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); }
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIURI* aDocumentURI,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsString mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsXULPrototypePI : public nsXULPrototypeNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXULPrototypePI()
|
|
|
|
: nsXULPrototypeNode(eType_PI)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~nsXULPrototypePI()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypePI"; }
|
|
|
|
virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); }
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2013-08-19 16:24:27 -07:00
|
|
|
nsXULPrototypeDocument* aProtoDoc,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIURI* aDocumentURI,
|
2014-06-19 19:01:40 -07:00
|
|
|
const nsTArray<nsRefPtr<mozilla::dom::NodeInfo>> *aNodeInfos) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsString mTarget;
|
|
|
|
nsString mData;
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
The XUL element.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-10-01 17:52:06 -07:00
|
|
|
#define XUL_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// XUL element specific bits
|
|
|
|
enum {
|
2012-10-16 05:37:26 -07:00
|
|
|
XUL_ELEMENT_TEMPLATE_GENERATED = XUL_ELEMENT_FLAG_BIT(0),
|
|
|
|
XUL_ELEMENT_HAS_CONTENTMENU_LISTENER = XUL_ELEMENT_FLAG_BIT(1),
|
|
|
|
XUL_ELEMENT_HAS_POPUP_LISTENER = XUL_ELEMENT_FLAG_BIT(2)
|
2012-10-01 17:52:06 -07:00
|
|
|
};
|
2010-06-18 09:23:04 -07:00
|
|
|
|
2013-06-08 01:54:59 -07:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 3);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-10-01 17:52:06 -07:00
|
|
|
#undef XUL_ELEMENT_FLAG_BIT
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsScriptEventHandlerOwnerTearoff;
|
|
|
|
|
2013-07-11 14:26:54 -07:00
|
|
|
class nsXULElement MOZ_FINAL : public nsStyledElement,
|
|
|
|
public nsIDOMXULElement
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit nsXULElement(already_AddRefed<mozilla::dom::NodeInfo> aNodeInfo);
|
2010-07-23 02:49:57 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static nsresult
|
|
|
|
Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument,
|
2013-02-04 15:22:51 -08:00
|
|
|
bool aIsScriptable, bool aIsRoot, mozilla::dom::Element** aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-26 07:17:51 -07:00
|
|
|
NS_IMPL_FROMCONTENT(nsXULElement, kNameSpaceID_XUL)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-05-30 00:36:53 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULElement, nsStyledElement)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsINode
|
2014-03-17 21:48:19 -07:00
|
|
|
virtual nsresult PreHandleEvent(
|
|
|
|
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIContent
|
2008-03-21 04:18:10 -07:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
|
|
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent) MOZ_OVERRIDE;
|
|
|
|
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) MOZ_OVERRIDE;
|
|
|
|
virtual void DestroyContent() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE;
|
|
|
|
virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aIsTrustedEvent) MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult ClickWithInputSource(uint16_t aInputSource);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual nsIContent *GetBindingParent() const MOZ_OVERRIDE;
|
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
2013-11-19 14:21:16 -08:00
|
|
|
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-29 13:43:41 -07:00
|
|
|
int32_t aModType) const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// XUL element methods
|
2008-10-20 08:36:05 -07:00
|
|
|
/**
|
|
|
|
* The template-generated flag is used to indicate that a
|
|
|
|
* template-generated element has already had its children generated.
|
|
|
|
*/
|
|
|
|
void SetTemplateGenerated() { SetFlags(XUL_ELEMENT_TEMPLATE_GENERATED); }
|
|
|
|
void ClearTemplateGenerated() { UnsetFlags(XUL_ELEMENT_TEMPLATE_GENERATED); }
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetTemplateGenerated() { return HasFlag(XUL_ELEMENT_TEMPLATE_GENERATED); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMNode
|
2012-10-09 05:31:24 -07:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
2013-01-29 09:51:55 -08:00
|
|
|
// And since that shadowed GetParentElement with the XPCOM
|
|
|
|
// signature, pull in the one we care about.
|
|
|
|
using nsStyledElement::GetParentElement;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMElement
|
2012-10-16 04:51:00 -07:00
|
|
|
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMXULElement
|
|
|
|
NS_DECL_NSIDOMXULELEMENT
|
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2014-04-02 21:18:36 -07:00
|
|
|
virtual mozilla::EventStates IntrinsicState() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-03-21 04:18:10 -07:00
|
|
|
nsresult GetFrameLoader(nsIFrameLoader** aFrameLoader);
|
2008-08-11 01:38:43 -07:00
|
|
|
nsresult SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner);
|
2008-03-21 04:18:10 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void RecompileScriptEventListeners() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-15 18:13:47 -07:00
|
|
|
// This function should ONLY be used by BindToTree implementations.
|
2007-05-21 15:22:51 -07:00
|
|
|
// The function exists solely because XUL elements store the binding
|
2012-11-14 14:10:08 -08:00
|
|
|
// parent as a member instead of in the slots, as Element does.
|
2007-05-15 18:13:47 -07:00
|
|
|
void SetXULBindingParent(nsIContent* aBindingParent)
|
|
|
|
{
|
|
|
|
mBindingParent = aBindingParent;
|
|
|
|
}
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
2013-01-02 12:24:07 -08:00
|
|
|
|
|
|
|
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
|
|
|
|
|
2013-01-29 09:51:55 -08:00
|
|
|
void SetXULAttr(nsIAtom* aName, const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
aError = SetAttr(kNameSpaceID_None, aName, aValue, true);
|
|
|
|
}
|
|
|
|
void SetXULBoolAttr(nsIAtom* aName, bool aValue)
|
|
|
|
{
|
|
|
|
if (aValue) {
|
|
|
|
SetAttr(kNameSpaceID_None, aName, NS_LITERAL_STRING("true"), true);
|
|
|
|
} else {
|
|
|
|
UnsetAttr(kNameSpaceID_None, aName, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WebIDL API
|
|
|
|
// The XPCOM getter is fine for our string attributes.
|
|
|
|
// The XPCOM setter is fine for our bool attributes.
|
|
|
|
void SetClassName(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::_class, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::align, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetDir(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::dir, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetFlex(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::flex, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetFlexGroup(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::flexgroup, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetOrdinal(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::ordinal, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetOrient(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::orient, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetPack(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::pack, aValue, rv);
|
|
|
|
}
|
|
|
|
bool Hidden() const
|
|
|
|
{
|
|
|
|
return BoolAttrIsTrue(nsGkAtoms::hidden);
|
|
|
|
}
|
|
|
|
bool Collapsed() const
|
|
|
|
{
|
|
|
|
return BoolAttrIsTrue(nsGkAtoms::collapsed);
|
|
|
|
}
|
|
|
|
void SetObserves(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::observes, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetMenu(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::menu, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetContextMenu(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::contextmenu, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetTooltip(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::tooltip, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetWidth(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::width, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetHeight(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::height, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetMinWidth(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::minwidth, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetMinHeight(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::minheight, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetMaxWidth(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::maxwidth, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetMaxHeight(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::maxheight, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetPersist(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::persist, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetLeft(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::left, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetTop(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::top, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetDatasources(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::datasources, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetRef(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::ref, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetTooltipText(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::tooltiptext, aValue, rv);
|
|
|
|
}
|
|
|
|
void SetStatusText(const nsAString& aValue, mozilla::ErrorResult& rv)
|
|
|
|
{
|
|
|
|
SetXULAttr(nsGkAtoms::statustext, aValue, rv);
|
|
|
|
}
|
|
|
|
bool AllowEvents() const
|
|
|
|
{
|
|
|
|
return BoolAttrIsTrue(nsGkAtoms::allowevents);
|
|
|
|
}
|
|
|
|
already_AddRefed<nsIRDFCompositeDataSource> GetDatabase();
|
|
|
|
already_AddRefed<nsIXULTemplateBuilder> GetBuilder();
|
|
|
|
already_AddRefed<nsIRDFResource> GetResource(mozilla::ErrorResult& rv);
|
|
|
|
nsIControllers* GetControllers(mozilla::ErrorResult& rv);
|
2014-10-14 13:15:21 -07:00
|
|
|
already_AddRefed<mozilla::dom::BoxObject> GetBoxObject(mozilla::ErrorResult& rv);
|
2013-01-29 09:51:55 -08:00
|
|
|
void Focus(mozilla::ErrorResult& rv);
|
|
|
|
void Blur(mozilla::ErrorResult& rv);
|
|
|
|
void Click(mozilla::ErrorResult& rv);
|
|
|
|
// The XPCOM DoCommand never fails, so it's OK for us.
|
|
|
|
already_AddRefed<nsINodeList>
|
|
|
|
GetElementsByAttribute(const nsAString& aAttribute,
|
|
|
|
const nsAString& aValue);
|
|
|
|
already_AddRefed<nsINodeList>
|
|
|
|
GetElementsByAttributeNS(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
// Style() inherited from nsStyledElement
|
|
|
|
already_AddRefed<nsFrameLoader> GetFrameLoader();
|
|
|
|
void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& rv);
|
|
|
|
|
2014-10-30 14:38:48 -07:00
|
|
|
nsINode* GetScopeChainParent() const MOZ_OVERRIDE
|
|
|
|
{
|
2014-10-30 14:43:42 -07:00
|
|
|
// For XUL, the parent is the parent element, if any
|
2014-10-30 14:38:48 -07:00
|
|
|
Element* parent = GetParentElement();
|
|
|
|
return parent ? parent : nsStyledElement::GetScopeChainParent();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
~nsXULElement();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-08-04 17:58:16 -07:00
|
|
|
// This can be removed if EnsureContentsGenerated dies.
|
|
|
|
friend class nsNSElementTearoff;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Implementation methods
|
|
|
|
nsresult EnsureContentsGenerated(void) const;
|
|
|
|
|
|
|
|
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAString& attrName);
|
|
|
|
|
|
|
|
static nsresult
|
2013-10-01 20:46:04 -07:00
|
|
|
ExecuteJSCode(nsIDOMElement* anElement, mozilla::WidgetEvent* aEvent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Helper routine that crawls a parent chain looking for a tree element.
|
|
|
|
NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement);
|
|
|
|
|
|
|
|
nsresult AddPopupListener(nsIAtom* aName);
|
|
|
|
|
2012-11-14 14:10:08 -08:00
|
|
|
class nsXULSlots : public mozilla::dom::Element::nsDOMSlots
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2011-08-28 07:07:24 -07:00
|
|
|
nsXULSlots();
|
|
|
|
virtual ~nsXULSlots();
|
2008-03-21 04:18:10 -07:00
|
|
|
|
2011-08-28 07:07:24 -07:00
|
|
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
|
|
|
|
|
|
|
nsRefPtr<nsFrameLoader> mFrameLoader;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual nsINode::nsSlots* CreateSlots() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-03-21 04:18:10 -07:00
|
|
|
nsresult LoadSrc();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* The nearest enclosing content node with a binding
|
|
|
|
* that created us. [Weak]
|
|
|
|
*/
|
|
|
|
nsIContent* mBindingParent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abandon our prototype linkage, and copy all attributes locally
|
|
|
|
*/
|
2012-07-14 08:28:54 -07:00
|
|
|
nsresult MakeHeavyweight(nsXULPrototypeElement* aPrototype);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2012-02-13 18:00:56 -08:00
|
|
|
const nsAttrValueOrString* aValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2013-05-29 13:43:41 -07:00
|
|
|
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void UpdateEditableState(bool aNotify) MOZ_OVERRIDE;
|
2011-05-31 18:46:57 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-16 23:56:53 -07:00
|
|
|
virtual mozilla::EventListenerManager*
|
|
|
|
GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
|
|
|
bool* aDefer) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a listener for the specified attribute, if appropriate.
|
|
|
|
*/
|
|
|
|
void AddListenerFor(const nsAttrName& aName,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCompileEventHandlers);
|
2007-03-22 10:30:00 -07:00
|
|
|
void MaybeAddPopupListener(nsIAtom* aLocalName);
|
|
|
|
|
2009-10-21 00:05:34 -07:00
|
|
|
nsIWidget* GetWindowWidget();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-24 19:01:07 -07:00
|
|
|
// attribute setters for widget
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult HideWindowChrome(bool aShouldHide);
|
2012-02-13 18:00:56 -08:00
|
|
|
void SetChromeMargins(const nsAttrValue* aValue);
|
2010-06-24 19:01:07 -07:00
|
|
|
void ResetChromeMargins();
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetTitlebarColor(nscolor aColor, bool aActive);
|
2007-10-29 21:03:42 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetDrawsInTitlebar(bool aState);
|
2013-12-17 08:11:13 -08:00
|
|
|
void SetDrawsTitle(bool aState);
|
2014-11-03 19:14:10 -08:00
|
|
|
void UpdateBrightTitlebarForeground(nsIDocument* aDocument);
|
2009-10-21 00:05:34 -07:00
|
|
|
|
2008-01-29 07:12:34 -08:00
|
|
|
void RemoveBroadcaster(const nsAString & broadcasterId);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
// Internal accessor. This shadows the 'Slots', and returns
|
|
|
|
// appropriate value.
|
|
|
|
nsIControllers *Controllers() {
|
|
|
|
nsDOMSlots* slots = GetExistingDOMSlots();
|
2012-07-30 07:20:58 -07:00
|
|
|
return slots ? slots->mControllers : nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void UnregisterAccessKey(const nsAString& aOldValue);
|
2013-01-29 09:51:55 -08:00
|
|
|
bool BoolAttrIsTrue(nsIAtom* aName) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
friend nsresult
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewXULElement(mozilla::dom::Element** aResult, mozilla::dom::NodeInfo *aNodeInfo);
|
2010-08-19 16:12:46 -07:00
|
|
|
friend void
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_TrustedNewXULElement(nsIContent** aResult, mozilla::dom::NodeInfo *aNodeInfo);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static already_AddRefed<nsXULElement>
|
2014-06-19 19:01:40 -07:00
|
|
|
Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *aNodeInfo,
|
2013-02-04 15:22:51 -08:00
|
|
|
bool aIsScriptable, bool aIsRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-05-31 18:46:57 -07:00
|
|
|
bool IsReadWriteTextElement() const
|
|
|
|
{
|
|
|
|
const nsIAtom* tag = Tag();
|
|
|
|
return
|
|
|
|
GetNameSpaceID() == kNameSpaceID_XUL &&
|
|
|
|
(tag == nsGkAtoms::textbox || tag == nsGkAtoms::textarea) &&
|
|
|
|
!HasAttr(kNameSpaceID_None, nsGkAtoms::readonly);
|
|
|
|
}
|
2013-01-29 09:51:55 -08:00
|
|
|
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-02-04 15:22:51 -08:00
|
|
|
|
|
|
|
void MaybeUpdatePrivateLifetime();
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsXULElement_h__
|