mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Merge m-c to inbound.
This commit is contained in:
commit
b2903dc4ee
@ -149,7 +149,6 @@
|
||||
@BINPATH@/components/content_htmldoc.xpt
|
||||
@BINPATH@/components/content_html.xpt
|
||||
@BINPATH@/components/content_xslt.xpt
|
||||
@BINPATH@/components/content_xtf.xpt
|
||||
@BINPATH@/components/cookie.xpt
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
|
@ -158,7 +158,6 @@
|
||||
@BINPATH@/components/content_htmldoc.xpt
|
||||
@BINPATH@/components/content_html.xpt
|
||||
@BINPATH@/components/content_xslt.xpt
|
||||
@BINPATH@/components/content_xtf.xpt
|
||||
@BINPATH@/components/cookie.xpt
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
|
19
configure.in
19
configure.in
@ -4244,7 +4244,6 @@ MOZ_TOOLKIT_SEARCH=1
|
||||
MOZ_UI_LOCALE=en-US
|
||||
MOZ_UNIVERSALCHARDET=1
|
||||
MOZ_URL_CLASSIFIER=
|
||||
MOZ_XTF=1
|
||||
MOZ_XUL=1
|
||||
MOZ_ZIPWRITER=1
|
||||
NS_PRINTING=1
|
||||
@ -5705,17 +5704,6 @@ MOZ_ARG_DISABLE_BOOL(negotiateauth,
|
||||
MOZ_AUTH_EXTENSION=,
|
||||
MOZ_AUTH_EXTENSION=1 )
|
||||
|
||||
dnl ========================================================
|
||||
dnl XTF
|
||||
dnl ========================================================
|
||||
MOZ_ARG_DISABLE_BOOL(xtf,
|
||||
[ --disable-xtf Disable XTF (pluggable xml tags) support],
|
||||
MOZ_XTF=,
|
||||
MOZ_XTF=1 )
|
||||
if test "$MOZ_XTF"; then
|
||||
AC_DEFINE(MOZ_XTF)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Pref extensions (autoconfig)
|
||||
dnl ========================================================
|
||||
@ -6074,12 +6062,6 @@ if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0
|
||||
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
|
||||
fi
|
||||
|
||||
dnl xforms requires xtf
|
||||
if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
|
||||
AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
|
||||
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
|
||||
fi
|
||||
|
||||
dnl Remove dupes
|
||||
MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
|
||||
|
||||
@ -8313,7 +8295,6 @@ AC_SUBST(MOZ_UPDATE_XTERM)
|
||||
AC_SUBST(MOZ_PLATFORM_MAEMO)
|
||||
AC_SUBST(MOZ_AUTH_EXTENSION)
|
||||
AC_SUBST(MOZ_PERMISSIONS)
|
||||
AC_SUBST(MOZ_XTF)
|
||||
AC_SUBST(MOZ_PREF_EXTENSIONS)
|
||||
AC_SUBST(MOZ_JS_LIBS)
|
||||
AC_SUBST(MOZ_PSM)
|
||||
|
@ -17,10 +17,6 @@ ifdef MOZ_MEDIA
|
||||
PARALLEL_DIRS += media
|
||||
endif
|
||||
|
||||
ifdef MOZ_XTF
|
||||
PARALLEL_DIRS += xtf
|
||||
endif
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
TOOL_DIRS += test
|
||||
endif
|
||||
|
@ -97,8 +97,4 @@ NS_NewGenConImageContent(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
imgIRequest* aImageRequest);
|
||||
|
||||
nsresult
|
||||
NS_NewXMLEventsElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
#endif // nsContentCreatorFunctions_h__
|
||||
|
@ -90,9 +90,6 @@ class nsIWidget;
|
||||
class nsIDragSession;
|
||||
class nsIPresShell;
|
||||
class nsIXPConnectJSObjectHolder;
|
||||
#ifdef MOZ_XTF
|
||||
class nsIXTFService;
|
||||
#endif
|
||||
#ifdef IBMBIDI
|
||||
class nsIBidiKeyboard;
|
||||
#endif
|
||||
@ -458,10 +455,6 @@ public:
|
||||
return sIOService;
|
||||
}
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
static nsIXTFService* GetXTFService();
|
||||
#endif
|
||||
|
||||
#ifdef IBMBIDI
|
||||
static nsIBidiKeyboard* GetBidiKeyboard();
|
||||
#endif
|
||||
@ -2222,10 +2215,6 @@ private:
|
||||
|
||||
static nsIIOService *sIOService;
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
static nsIXTFService *sXTFService;
|
||||
#endif
|
||||
|
||||
static bool sImgLoaderInitialized;
|
||||
static void InitImgLoader();
|
||||
|
||||
|
@ -79,8 +79,8 @@ class Element;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x20d19edb, 0xa74c, 0x4ce4, \
|
||||
{ 0xb2, 0x7c, 0x5b, 0xdd, 0x6f, 0xbd, 0x2b, 0x66 } }
|
||||
{ 0xd69b94c2, 0x92ed, 0x4baa, \
|
||||
{ 0x82, 0x08, 0x56, 0xe4, 0xc4, 0xb3, 0xf3, 0xc8 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -959,8 +959,6 @@ public:
|
||||
|
||||
virtual bool IsScriptEnabled() = 0;
|
||||
|
||||
virtual void AddXMLEventsContent(nsIContent * aXMLEventsElement) = 0;
|
||||
|
||||
/**
|
||||
* Create an element with the specified name, prefix and namespace ID.
|
||||
*/
|
||||
|
@ -28,8 +28,7 @@ static const int32_t kNameSpaceID_None = 0;
|
||||
#define kNameSpaceID_RDF 8
|
||||
#define kNameSpaceID_XUL 9
|
||||
#define kNameSpaceID_SVG 10
|
||||
#define kNameSpaceID_XMLEvents 11
|
||||
#define kNameSpaceID_LastBuiltin 11 // last 'built-in' namespace
|
||||
#define kNameSpaceID_LastBuiltin 10 // last 'built-in' namespace
|
||||
|
||||
#define NS_NAMESPACEMANAGER_CONTRACTID "@mozilla.org/content/namespacemanager;1"
|
||||
|
||||
|
@ -1860,10 +1860,6 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
nsNodeUtils::AttributeChanged(this, aNamespaceID, aName, aModType);
|
||||
}
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_XMLEvents &&
|
||||
aName == nsGkAtoms::event && mNodeInfo->GetDocument()) {
|
||||
mNodeInfo->GetDocument()->AddXMLEventsContent(this);
|
||||
}
|
||||
if (aCallAfterSetAttr) {
|
||||
rv = AfterSetAttr(aNamespaceID, aName, &aValueForAfterSetAttr, aNotify);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -68,10 +68,6 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#ifdef MOZ_XTF
|
||||
#include "nsIXTFService.h"
|
||||
static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#endif
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsLWBrkCIID.h"
|
||||
#include "nsILineBreaker.h"
|
||||
@ -195,9 +191,6 @@ nsIThreadJSContextStack *nsContentUtils::sThreadJSContextStack;
|
||||
nsIParserService *nsContentUtils::sParserService = nullptr;
|
||||
nsINameSpaceManager *nsContentUtils::sNameSpaceManager;
|
||||
nsIIOService *nsContentUtils::sIOService;
|
||||
#ifdef MOZ_XTF
|
||||
nsIXTFService *nsContentUtils::sXTFService = nullptr;
|
||||
#endif
|
||||
imgILoader *nsContentUtils::sImgLoader;
|
||||
imgILoader *nsContentUtils::sPrivateImgLoader;
|
||||
imgICache *nsContentUtils::sImgCache;
|
||||
@ -955,21 +948,6 @@ nsContentUtils::ParseSandboxAttributeToFlags(const nsAString& aSandboxAttrValue)
|
||||
return out;
|
||||
}
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
nsIXTFService*
|
||||
nsContentUtils::GetXTFService()
|
||||
{
|
||||
if (!sXTFService) {
|
||||
nsresult rv = CallGetService(kXTFServiceCID, &sXTFService);
|
||||
if (NS_FAILED(rv)) {
|
||||
sXTFService = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return sXTFService;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IBMBIDI
|
||||
nsIBidiKeyboard*
|
||||
nsContentUtils::GetBidiKeyboard()
|
||||
@ -1473,9 +1451,6 @@ nsContentUtils::Shutdown()
|
||||
NS_IF_RELEASE(sIOService);
|
||||
NS_IF_RELEASE(sLineBreaker);
|
||||
NS_IF_RELEASE(sWordBreaker);
|
||||
#ifdef MOZ_XTF
|
||||
NS_IF_RELEASE(sXTFService);
|
||||
#endif
|
||||
NS_IF_RELEASE(sImgLoader);
|
||||
NS_IF_RELEASE(sPrivateImgLoader);
|
||||
NS_IF_RELEASE(sImgCache);
|
||||
|
@ -90,8 +90,6 @@
|
||||
#include "nsIRadioVisitor.h"
|
||||
#include "nsIFormControl.h"
|
||||
|
||||
#include "nsXMLEventsManager.h"
|
||||
|
||||
#include "nsBidiUtils.h"
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
|
||||
@ -1847,16 +1845,6 @@ nsIDocument::GetExtraPropertyTable(uint16_t aCategory)
|
||||
return mExtraPropertyTables[aCategory - 1];
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::AddXMLEventsContent(nsIContent *aXMLEventsElement)
|
||||
{
|
||||
if (!mXMLEventsManager) {
|
||||
mXMLEventsManager = new nsXMLEventsManager();
|
||||
AddObserver(mXMLEventsManager);
|
||||
}
|
||||
mXMLEventsManager->AddXMLEventsContent(aXMLEventsElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
|
@ -88,7 +88,6 @@ struct nsRadioGroupStruct;
|
||||
class nsOnloadBlocker;
|
||||
class nsUnblockOnloadEvent;
|
||||
class nsChildContentList;
|
||||
class nsXMLEventsManager;
|
||||
class nsHTMLStyleSheet;
|
||||
class nsHTMLCSSStyleSheet;
|
||||
class nsDOMNavigationTiming;
|
||||
@ -771,8 +770,6 @@ public:
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
virtual nsresult Init();
|
||||
|
||||
virtual void AddXMLEventsContent(nsIContent * aXMLEventsElement);
|
||||
|
||||
virtual nsresult CreateElem(const nsAString& aName, nsIAtom *aPrefix,
|
||||
int32_t aNamespaceID,
|
||||
@ -1245,7 +1242,6 @@ protected:
|
||||
// The channel that got passed to StartDocumentLoad(), if any
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsRefPtr<nsHTMLCSSStyleSheet> mStyleAttrStyleSheet;
|
||||
nsRefPtr<nsXMLEventsManager> mXMLEventsManager;
|
||||
|
||||
// Our update nesting level
|
||||
uint32_t mUpdateNestLevel;
|
||||
|
@ -18,13 +18,6 @@
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXTFService.h"
|
||||
#include "nsContentUtils.h"
|
||||
static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -38,7 +31,6 @@ using namespace mozilla::dom;
|
||||
#define kRDFNameSpaceURI "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
#define kXULNameSpaceURI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
#define kSVGNameSpaceURI "http://www.w3.org/2000/svg"
|
||||
#define kXMLEventsNameSpaceURI "http://www.w3.org/2001/xml-events"
|
||||
|
||||
class nsNameSpaceKey : public PLDHashEntryHdr
|
||||
{
|
||||
@ -126,7 +118,6 @@ nsresult NameSpaceManagerImpl::Init()
|
||||
REGISTER_NAMESPACE(kRDFNameSpaceURI, kNameSpaceID_RDF);
|
||||
REGISTER_NAMESPACE(kXULNameSpaceURI, kNameSpaceID_XUL);
|
||||
REGISTER_NAMESPACE(kSVGNameSpaceURI, kNameSpaceID_SVG);
|
||||
REGISTER_NAMESPACE(kXMLEventsNameSpaceURI, kNameSpaceID_XMLEvents);
|
||||
|
||||
#undef REGISTER_NAMESPACE
|
||||
|
||||
@ -211,18 +202,6 @@ NS_NewElement(nsIContent** aResult,
|
||||
if (ns == kNameSpaceID_SVG) {
|
||||
return NS_NewSVGElement(aResult, aNodeInfo, aFromParser);
|
||||
}
|
||||
if (ns == kNameSpaceID_XMLEvents) {
|
||||
return NS_NewXMLEventsElement(aResult, aNodeInfo);
|
||||
}
|
||||
#ifdef MOZ_XTF
|
||||
if (ns > kNameSpaceID_LastBuiltin) {
|
||||
nsIXTFService* xtfService = nsContentUtils::GetXTFService();
|
||||
NS_ASSERTION(xtfService, "could not get xtf service");
|
||||
if (xtfService &&
|
||||
NS_SUCCEEDED(xtfService->CreateElement(aResult, aNodeInfo)))
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return NS_NewXMLElement(aResult, aNodeInfo);
|
||||
}
|
||||
|
||||
@ -235,7 +214,6 @@ NameSpaceManagerImpl::HasElementCreator(int32_t aNameSpaceID)
|
||||
#endif
|
||||
aNameSpaceID == kNameSpaceID_MathML ||
|
||||
aNameSpaceID == kNameSpaceID_SVG ||
|
||||
aNameSpaceID == kNameSpaceID_XMLEvents ||
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,6 @@ CPPSRCS = \
|
||||
nsDOMMessageEvent.cpp \
|
||||
nsPaintRequest.cpp \
|
||||
nsPrivateTextRange.cpp \
|
||||
nsXMLEventsManager.cpp \
|
||||
nsXMLEventsElement.cpp \
|
||||
nsAsyncDOMEvent.cpp \
|
||||
nsEventDispatcher.cpp \
|
||||
nsIMEStateManager.cpp \
|
||||
|
@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsXMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
class nsXMLEventsElement : public nsXMLElement {
|
||||
public:
|
||||
nsXMLEventsElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsXMLEventsElement();
|
||||
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
bool aNotify);
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
};
|
||||
|
||||
nsXMLEventsElement::nsXMLEventsElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsXMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsXMLEventsElement::~nsXMLEventsElement()
|
||||
{
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsXMLEventsElement::GetIDAttributeName() const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::listener))
|
||||
return nsGkAtoms::id;
|
||||
return nsXMLElement::GetIDAttributeName();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLEventsElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::listener) &&
|
||||
mNodeInfo->GetDocument() && aNameSpaceID == kNameSpaceID_None &&
|
||||
aName == nsGkAtoms::event)
|
||||
mNodeInfo->GetDocument()->AddXMLEventsContent(this);
|
||||
return nsXMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsXMLEventsElement)
|
||||
|
||||
nsresult
|
||||
NS_NewXMLEventsElement(nsIContent** aInstancePtrResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
{
|
||||
nsXMLEventsElement* it = new nsXMLEventsElement(aNodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(*aInstancePtrResult = it);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,389 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsXMLEventsManager.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
bool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument,
|
||||
nsXMLEventsManager * aManager,
|
||||
nsIContent * aContent)
|
||||
{
|
||||
nsresult rv;
|
||||
int32_t nameSpaceID;
|
||||
if (aContent->GetDocument() != aDocument)
|
||||
return false;
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::listener,
|
||||
kNameSpaceID_XMLEvents))
|
||||
nameSpaceID = kNameSpaceID_None;
|
||||
else
|
||||
nameSpaceID = kNameSpaceID_XMLEvents;
|
||||
nsAutoString eventType;
|
||||
aContent->GetAttr(nameSpaceID, nsGkAtoms::event, eventType);
|
||||
if (eventType.IsEmpty())
|
||||
return false;
|
||||
nsAutoString handlerURIStr;
|
||||
bool hasHandlerURI = false;
|
||||
nsIContent *handler = nullptr;
|
||||
nsAutoString observerID;
|
||||
nsAutoString targetIdref;
|
||||
|
||||
if (aContent->GetAttr(nameSpaceID, nsGkAtoms::handler, handlerURIStr)) {
|
||||
hasHandlerURI = true;
|
||||
nsAutoCString handlerRef;
|
||||
nsCOMPtr<nsIURI> handlerURI;
|
||||
bool equals = false;
|
||||
nsIURI *docURI = aDocument->GetDocumentURI();
|
||||
nsIURI *baseURI = aDocument->GetDocBaseURI();
|
||||
rv = NS_NewURI( getter_AddRefs(handlerURI), handlerURIStr, nullptr, baseURI);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
handlerURI->GetRef(handlerRef);
|
||||
// We support only XML Events Basic.
|
||||
rv = docURI->EqualsExceptRef(handlerURI, &equals);
|
||||
if (NS_SUCCEEDED(rv) && equals) {
|
||||
handler = aDocument->GetElementById(NS_ConvertUTF8toUTF16(handlerRef));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
handler = aContent;
|
||||
if (!handler)
|
||||
return false;
|
||||
|
||||
aContent->GetAttr(nameSpaceID, nsGkAtoms::target, targetIdref);
|
||||
|
||||
bool hasObserver =
|
||||
aContent->GetAttr(nameSpaceID, nsGkAtoms::observer, observerID);
|
||||
|
||||
bool capture =
|
||||
aContent->AttrValueIs(nameSpaceID, nsGkAtoms::phase,
|
||||
nsGkAtoms::capture, eCaseMatters);
|
||||
|
||||
bool stopPropagation =
|
||||
aContent->AttrValueIs(nameSpaceID, nsGkAtoms::propagate,
|
||||
nsGkAtoms::stop, eCaseMatters);
|
||||
|
||||
bool cancelDefault =
|
||||
aContent->AttrValueIs(nameSpaceID, nsGkAtoms::defaultAction,
|
||||
nsGkAtoms::cancel, eCaseMatters);
|
||||
|
||||
nsIContent *observer = nullptr;
|
||||
if (!hasObserver) {
|
||||
if (!hasHandlerURI) //Parent should be the observer
|
||||
observer = aContent->GetParent();
|
||||
else //We have the handler, so this is the observer
|
||||
observer = aContent;
|
||||
}
|
||||
else if (!observerID.IsEmpty()) {
|
||||
observer = aDocument->GetElementById(observerID);
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventTarget> eventObserver(do_QueryInterface(observer));
|
||||
if (eventObserver) {
|
||||
nsXMLEventsListener * eli = new nsXMLEventsListener(aManager,
|
||||
aContent,
|
||||
observer,
|
||||
handler,
|
||||
eventType,
|
||||
capture,
|
||||
stopPropagation,
|
||||
cancelDefault,
|
||||
targetIdref);
|
||||
if (eli) {
|
||||
nsresult rv = eventObserver->AddEventListener(eventType, eli, capture);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aManager->RemoveXMLEventsContent(aContent);
|
||||
aManager->RemoveListener(aContent);
|
||||
aManager->AddListener(aContent, eli);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
delete eli;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsXMLEventsListener::nsXMLEventsListener(nsXMLEventsManager * aManager,
|
||||
nsIContent * aElement,
|
||||
nsIContent * aObserver,
|
||||
nsIContent * aHandler,
|
||||
const nsAString& aEvent,
|
||||
bool aPhase,
|
||||
bool aStopPropagation,
|
||||
bool aCancelDefault,
|
||||
const nsAString& aTarget)
|
||||
: mManager(aManager),
|
||||
mElement(aElement),
|
||||
mObserver(aObserver),
|
||||
mHandler(aHandler),
|
||||
mEvent(aEvent),
|
||||
mPhase(aPhase),
|
||||
mStopPropagation(aStopPropagation),
|
||||
mCancelDefault(aCancelDefault)
|
||||
{
|
||||
if (!aTarget.IsEmpty())
|
||||
mTarget = do_GetAtom(aTarget);
|
||||
}
|
||||
|
||||
nsXMLEventsListener::~nsXMLEventsListener()
|
||||
{
|
||||
}
|
||||
|
||||
void nsXMLEventsListener::Unregister()
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mObserver);
|
||||
if (target) {
|
||||
target->RemoveEventListener(mEvent, this, mPhase);
|
||||
}
|
||||
mObserver = nullptr;
|
||||
mHandler = nullptr;
|
||||
}
|
||||
|
||||
void nsXMLEventsListener::SetIncomplete()
|
||||
{
|
||||
Unregister();
|
||||
mManager->AddXMLEventsContent(mElement);
|
||||
mElement = nullptr;
|
||||
}
|
||||
|
||||
bool nsXMLEventsListener::ObserverEquals(nsIContent * aTarget)
|
||||
{
|
||||
return aTarget == mObserver;
|
||||
}
|
||||
|
||||
bool nsXMLEventsListener::HandlerEquals(nsIContent * aTarget)
|
||||
{
|
||||
return aTarget == mHandler;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXMLEventsListener, nsIDOMEventListener)
|
||||
NS_IMETHODIMP
|
||||
nsXMLEventsListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!aEvent)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
bool targetMatched = true;
|
||||
nsCOMPtr<nsIDOMEvent> event(aEvent);
|
||||
if (mTarget) {
|
||||
targetMatched = false;
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetTarget(getter_AddRefs(target));
|
||||
nsCOMPtr<nsIContent> targetEl(do_QueryInterface(target));
|
||||
if (targetEl && targetEl->GetID() == mTarget)
|
||||
targetMatched = true;
|
||||
}
|
||||
if (!targetMatched)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIDOMEventListener> handler(do_QueryInterface(mHandler));
|
||||
if (handler) {
|
||||
nsresult rv = handler->HandleEvent(event);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mStopPropagation)
|
||||
event->StopPropagation();
|
||||
if (mCancelDefault)
|
||||
event->PreventDefault();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//XMLEventsManager / DocumentObserver
|
||||
|
||||
static PLDHashOperator EnumAndUnregisterListener(nsISupports * aContent,
|
||||
nsCOMPtr<nsXMLEventsListener> & aListener,
|
||||
void * aData)
|
||||
{
|
||||
if (aListener)
|
||||
aListener->Unregister();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator EnumAndSetIncomplete(nsISupports * aContent,
|
||||
nsCOMPtr<nsXMLEventsListener> & aListener,
|
||||
void * aData)
|
||||
{
|
||||
if (aListener && aData) {
|
||||
nsCOMPtr<nsIContent> content = static_cast<nsIContent *>(aData);
|
||||
if (content) {
|
||||
if (aListener->ObserverEquals(content) || aListener->HandlerEquals(content)) {
|
||||
aListener->SetIncomplete();
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsXMLEventsManager::nsXMLEventsManager()
|
||||
{
|
||||
mListeners.Init();
|
||||
}
|
||||
nsXMLEventsManager::~nsXMLEventsManager()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsXMLEventsManager, nsIDocumentObserver, nsIMutationObserver)
|
||||
|
||||
void nsXMLEventsManager::AddXMLEventsContent(nsIContent * aContent)
|
||||
{
|
||||
mIncomplete.RemoveObject(aContent);
|
||||
mIncomplete.AppendObject(aContent);
|
||||
}
|
||||
|
||||
void nsXMLEventsManager::RemoveXMLEventsContent(nsIContent * aContent)
|
||||
{
|
||||
mIncomplete.RemoveObject(aContent);
|
||||
}
|
||||
|
||||
void nsXMLEventsManager::AddListener(nsIContent * aContent,
|
||||
nsXMLEventsListener * aListener)
|
||||
{
|
||||
mListeners.Put(aContent, aListener);
|
||||
}
|
||||
|
||||
bool nsXMLEventsManager::RemoveListener(nsIContent * aContent)
|
||||
{
|
||||
nsCOMPtr<nsXMLEventsListener> listener;
|
||||
mListeners.Get(aContent, getter_AddRefs(listener));
|
||||
if (listener) {
|
||||
listener->Unregister();
|
||||
mListeners.Remove(aContent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void nsXMLEventsManager::AddListeners(nsIDocument* aDocument)
|
||||
{
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
nsIContent *cur;
|
||||
for (int i = 0; i < mIncomplete.Count(); ++i) {
|
||||
cur = mIncomplete[i];
|
||||
//If this succeeds, the object will be removed from mIncomplete
|
||||
if (nsXMLEventsListener::InitXMLEventsListener(aDocument, this, cur))
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
{
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
mIncomplete.Clear();
|
||||
mListeners.Enumerate(EnumAndUnregisterListener, this);
|
||||
mListeners.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::EndLoad(nsIDocument* aDocument)
|
||||
{
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
|
||||
Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType)
|
||||
{
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_XMLEvents &&
|
||||
(aAttribute == nsGkAtoms::event ||
|
||||
aAttribute == nsGkAtoms::handler ||
|
||||
aAttribute == nsGkAtoms::target ||
|
||||
aAttribute == nsGkAtoms::observer ||
|
||||
aAttribute == nsGkAtoms::phase ||
|
||||
aAttribute == nsGkAtoms::propagate)) {
|
||||
RemoveListener(aElement);
|
||||
AddXMLEventsContent(aElement);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
|
||||
}
|
||||
else {
|
||||
if (aElement->NodeInfo()->Equals(nsGkAtoms::listener,
|
||||
kNameSpaceID_XMLEvents)) {
|
||||
RemoveListener(aElement);
|
||||
AddXMLEventsContent(aElement);
|
||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aElement);
|
||||
}
|
||||
else if (aElement->GetIDAttributeName() == aAttribute) {
|
||||
if (aModType == nsIDOMMutationEvent::REMOVAL)
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aElement);
|
||||
else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
|
||||
//Remove possible listener
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aElement);
|
||||
//Add new listeners
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
else {
|
||||
//If we are adding the ID attribute, we must check whether we can
|
||||
//add new listeners
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::ContentAppended(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
int32_t aNewIndexInContainer)
|
||||
{
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::ContentInserted(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
AddListeners(aDocument);
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLEventsManager::ContentRemoved(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
int32_t aIndexInContainer,
|
||||
nsIContent* aPreviousSibling)
|
||||
{
|
||||
if (!aChild || !aChild->IsElement())
|
||||
return;
|
||||
//Note, we can't use IDs here, the observer may not always have an ID.
|
||||
//And to remember: the same observer can be referenced by many
|
||||
//XMLEventsListeners
|
||||
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
//If the content was an XML Events observer or handler
|
||||
mListeners.Enumerate(EnumAndSetIncomplete, aChild);
|
||||
|
||||
//If the content was an XML Events attributes container
|
||||
if (RemoveListener(aChild)) {
|
||||
//for aContainer.appendChild(aContainer.removeChild(aChild));
|
||||
AddXMLEventsContent(aChild);
|
||||
}
|
||||
|
||||
uint32_t count = aChild->GetChildCount();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
ContentRemoved(aDocument, aChild, aChild->GetChildAt(i), i, aChild->GetPreviousSibling());
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsXMLEventsManager_h___
|
||||
#define nsXMLEventsManager_h___
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsStubDocumentObserver.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
/*
|
||||
* The implementation of the XML Events Basic profile
|
||||
*/
|
||||
|
||||
class nsXMLEventsManager;
|
||||
class nsXMLEventsListener MOZ_FINAL : public nsIDOMEventListener {
|
||||
public:
|
||||
static bool InitXMLEventsListener(nsIDocument * aDocument,
|
||||
nsXMLEventsManager * aManager,
|
||||
nsIContent * aContent);
|
||||
nsXMLEventsListener(nsXMLEventsManager * aManager,
|
||||
nsIContent * aElement,
|
||||
nsIContent* aObserver,
|
||||
nsIContent * aHandler,
|
||||
const nsAString& aEvent,
|
||||
bool aPhase,
|
||||
bool aStopPropagation,
|
||||
bool aCancelDefault,
|
||||
const nsAString& aTarget);
|
||||
~nsXMLEventsListener();
|
||||
void Unregister();
|
||||
//Removes this event listener from observer and adds the element back to the
|
||||
//list of incomplete XML Events declarations in XMLEventsManager
|
||||
void SetIncomplete();
|
||||
bool ObserverEquals(nsIContent * aTarget);
|
||||
bool HandlerEquals(nsIContent * aTarget);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
private:
|
||||
nsXMLEventsManager * mManager;
|
||||
nsCOMPtr<nsIContent> mElement;
|
||||
nsCOMPtr<nsIContent> mObserver;
|
||||
nsCOMPtr<nsIContent> mHandler;
|
||||
nsString mEvent;
|
||||
nsCOMPtr<nsIAtom> mTarget;
|
||||
bool mPhase;
|
||||
bool mStopPropagation;
|
||||
bool mCancelDefault;
|
||||
|
||||
};
|
||||
|
||||
class nsXMLEventsManager MOZ_FINAL : public nsStubDocumentObserver {
|
||||
public:
|
||||
nsXMLEventsManager();
|
||||
~nsXMLEventsManager();
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDocumentObserver
|
||||
NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
|
||||
void AddXMLEventsContent(nsIContent * aContent);
|
||||
void RemoveXMLEventsContent(nsIContent * aContent);
|
||||
void AddListener(nsIContent * aContent, nsXMLEventsListener * aListener);
|
||||
//Returns true if a listener was removed.
|
||||
bool RemoveListener(nsIContent * aXMLElement);
|
||||
private:
|
||||
void AddListeners(nsIDocument* aDocument);
|
||||
nsInterfaceHashtable<nsISupportsHashKey,nsXMLEventsListener> mListeners;
|
||||
nsCOMArray<nsIContent> mIncomplete;
|
||||
};
|
||||
|
||||
#endif /* nsXMLEventsManager_h___ */
|
@ -534,9 +534,6 @@ nsXMLContentSink::CloseElement(nsIContent* aContent)
|
||||
#endif
|
||||
nodeInfo->NameAtom() == nsGkAtoms::object ||
|
||||
nodeInfo->NameAtom() == nsGkAtoms::applet))
|
||||
#ifdef MOZ_XTF
|
||||
|| nodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin
|
||||
#endif
|
||||
|| nodeInfo->NameAtom() == nsGkAtoms::title
|
||||
) {
|
||||
aContent->DoneAddingChildren(HaveNotifiedForCurrentContent());
|
||||
@ -1016,11 +1013,6 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
|
||||
nodeInfo->SetIDAttributeAtom(IDAttr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
if (nameSpaceID > kNameSpaceID_LastBuiltin)
|
||||
content->BeginAddingChildren();
|
||||
#endif
|
||||
|
||||
// Set the attributes on the new content element
|
||||
result = AddAttributes(aAtts, content);
|
||||
|
@ -1,16 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PARALLEL_DIRS = public src
|
||||
|
||||
TEST_DIRS += test
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,25 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = content
|
||||
XPIDL_MODULE = content_xtf
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIXMLContentBuilder.idl \
|
||||
nsIXTFAttributeHandler.idl \
|
||||
nsIXTFElement.idl \
|
||||
nsIXTFElementFactory.idl \
|
||||
nsIXTFElementWrapper.idl \
|
||||
nsIXTFPrivate.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,56 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
[scriptable, uuid(e9c4cd4f-cd41-43d0-bf3b-48abb9cde90f)]
|
||||
interface nsIXMLContentBuilder : nsISupports
|
||||
{
|
||||
// (Re-)Initialize this builder. Set 'root' as the new root and
|
||||
// current element. If 'root' is null, the first element built (with
|
||||
// 'beginElement()') will become the new root. Also resets the
|
||||
// element namespace.
|
||||
void clear(in nsIDOMElement root);
|
||||
|
||||
// Set the document which will be used by 'beginElement()' to create
|
||||
// elements. If null, the builder will create a new XML document
|
||||
// internally.
|
||||
void setDocument(in nsIDOMDocument doc);
|
||||
|
||||
// Set the namespace for all elements built subsequently
|
||||
void setElementNamespace(in AString ns);
|
||||
|
||||
// Create an element. The element will become the 'current' element,
|
||||
// i.e. the target for attributes (via 'attrib()') or child content
|
||||
// (via subsequent begin/endElement()-calls), until it is 'closed'
|
||||
// with a call to 'endElement()'.
|
||||
void beginElement(in AString tagname);
|
||||
void endElement();
|
||||
|
||||
// Set an attribute on the current element
|
||||
void attrib(in AString name, in AString value);
|
||||
|
||||
// Create a textNode
|
||||
void textNode(in AString text);
|
||||
|
||||
readonly attribute nsIDOMElement root;
|
||||
readonly attribute nsIDOMElement current;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// {E09AF32D-2A54-4D76-9EF0-3070E83F8BE7}
|
||||
#define NS_XMLCONTENTBUILDER_CID \
|
||||
{ 0xe09af32d, 0x2a54, 0x4d76, { 0x9e, 0xf0, 0x30, 0x70, 0xe8, 0x3f, 0x8b, 0xe7 } }
|
||||
|
||||
#define NS_XMLCONTENTBUILDER_CONTRACTID "@mozilla.org/xtf/xml-contentbuilder;1"
|
||||
|
||||
nsresult NS_NewXMLContentBuilder(nsIXMLContentBuilder** aResult);
|
||||
|
||||
%}
|
||||
|
@ -1,36 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
interface nsIAtom;
|
||||
|
||||
[scriptable, uuid(72152f7f-7e8d-43fd-8477-3f29ae8d240d)]
|
||||
interface nsIXTFAttributeHandler : nsISupports
|
||||
{
|
||||
// If 'false' the given attribute will be handled by the wrapper.
|
||||
// Namespaced attributes will always be handled by the wrapper. The
|
||||
// set of attributes handled by the attribute handler should remain
|
||||
// constant for its complete lifetime.
|
||||
boolean handlesAttribute(in nsIAtom name);
|
||||
|
||||
void setAttribute(in nsIAtom name, in AString newValue);
|
||||
|
||||
void removeAttribute(in nsIAtom name);
|
||||
|
||||
// If the attribute 'name' is unknown the implementation should mark
|
||||
// the returned string as being 'null' (i.e. return 'null' in JS;
|
||||
// call SetIsVoid(PR_TRUE) in C++) rather than throw an exception.
|
||||
// A 'void' result will be translated into the attribute missing
|
||||
// by the wrapper. An empty result will be translated into
|
||||
// the attribute having no value.
|
||||
AString getAttribute(in nsIAtom name);
|
||||
|
||||
boolean hasAttribute(in nsIAtom name);
|
||||
|
||||
unsigned long getAttributeCount();
|
||||
|
||||
// note that this method should return an *atom* not a string.
|
||||
nsIAtom getAttributeNameAt(in unsigned long index);
|
||||
};
|
@ -1,127 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
interface nsIAtom;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMAttr;
|
||||
interface nsIDOMEvent;
|
||||
interface nsIXTFElementWrapper;
|
||||
|
||||
[scriptable, uuid(4f144387-796d-4baf-8641-5db45dba1808)]
|
||||
interface nsIXTFElement : nsISupports
|
||||
{
|
||||
// onCreated will be called before any notifications are sent to
|
||||
// the xtf element.
|
||||
//
|
||||
// @param wrapper is a weak proxy to the wrapping element
|
||||
// (i.e. holding a reference to this will not create a cycle).
|
||||
void onCreated(in nsIXTFElementWrapper wrapper);
|
||||
|
||||
// called when the wrapper object is being destroyed.
|
||||
void onDestroyed();
|
||||
|
||||
// If isAttributeHandler is set to 'true', the xtf element indicates
|
||||
// that it wants to manage its own attributes. In this case it needs
|
||||
// to implement the nsIXTFAttributeHandler interface in addition to
|
||||
// its other interfaces. 'isAttributeHandler' must remain constant
|
||||
// for the entire lifetime of the xtf element (i.e. before any
|
||||
// onCreated()-calls until after onDestroyed()-calls).
|
||||
readonly attribute boolean isAttributeHandler;
|
||||
|
||||
// getScriptingInterfaces: This array serves 2 purposes: a) All
|
||||
// interfaces in this array will automatically be accessible when
|
||||
// our wrapper element is used from JS (other interfaces need to be
|
||||
// explicitly QI'ed for), and b) All these interfaces are callable
|
||||
// from unpriviliged script.
|
||||
// @note 'Normal' DOM interfaces are always automatically scriptable.
|
||||
void getScriptingInterfaces(out unsigned long count,
|
||||
[array, size_is(count), retval] out nsIIDPtr array);
|
||||
|
||||
// Notification mask constants:
|
||||
// To receive a given event set the corresponding bit in
|
||||
// nsIXTFElementWrapper::notificationMask.
|
||||
const unsigned long NOTIFY_WILL_CHANGE_DOCUMENT = 0x00000001;
|
||||
const unsigned long NOTIFY_DOCUMENT_CHANGED = 0x00000002;
|
||||
|
||||
const unsigned long NOTIFY_WILL_CHANGE_PARENT = 0x00000004;
|
||||
const unsigned long NOTIFY_PARENT_CHANGED = 0x00000008;
|
||||
|
||||
const unsigned long NOTIFY_WILL_INSERT_CHILD = 0x00000010;
|
||||
const unsigned long NOTIFY_CHILD_INSERTED = 0x00000020;
|
||||
|
||||
const unsigned long NOTIFY_WILL_APPEND_CHILD = 0x00000040;
|
||||
const unsigned long NOTIFY_CHILD_APPENDED = 0x00000080;
|
||||
|
||||
const unsigned long NOTIFY_WILL_REMOVE_CHILD = 0x00000100;
|
||||
const unsigned long NOTIFY_CHILD_REMOVED = 0x00000200;
|
||||
|
||||
const unsigned long NOTIFY_WILL_SET_ATTRIBUTE = 0x00000400;
|
||||
const unsigned long NOTIFY_ATTRIBUTE_SET = 0x00000800;
|
||||
|
||||
const unsigned long NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000;
|
||||
const unsigned long NOTIFY_ATTRIBUTE_REMOVED = 0x00002000;
|
||||
|
||||
const unsigned long NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000;
|
||||
const unsigned long NOTIFY_DONE_ADDING_CHILDREN = 0x00008000;
|
||||
|
||||
const unsigned long NOTIFY_HANDLE_DEFAULT = 0x00010000;
|
||||
|
||||
const unsigned long NOTIFY_PERFORM_ACCESSKEY = 0x00020000;
|
||||
|
||||
// Event notifications:
|
||||
|
||||
void willChangeDocument(in nsIDOMDocument newDoc);
|
||||
void documentChanged(in nsIDOMDocument newDoc);
|
||||
|
||||
void willChangeParent(in nsIDOMElement newParent);
|
||||
void parentChanged(in nsIDOMElement newParent);
|
||||
|
||||
void willInsertChild(in nsIDOMNode child, in unsigned long index);
|
||||
void childInserted(in nsIDOMNode child, in unsigned long index);
|
||||
|
||||
void willAppendChild(in nsIDOMNode child);
|
||||
void childAppended(in nsIDOMNode child);
|
||||
|
||||
void willRemoveChild(in unsigned long index);
|
||||
void childRemoved(in unsigned long index);
|
||||
|
||||
void willSetAttribute(in nsIAtom name, in AString newValue);
|
||||
void attributeSet(in nsIAtom name, in AString newValue);
|
||||
|
||||
void willRemoveAttribute(in nsIAtom name);
|
||||
void attributeRemoved(in nsIAtom name);
|
||||
|
||||
// These are for batching of child insertions during document load
|
||||
|
||||
// beginAddingChildren is called before any attributes or child nodes are
|
||||
// added to the element.
|
||||
void beginAddingChildren();
|
||||
void doneAddingChildren();
|
||||
|
||||
// The default handler for DOM Events.
|
||||
// This method is called after the normal DOM event flow.
|
||||
// If the return value is true, the event is marked as handled and
|
||||
// other default handlers won't be able to handle it again.
|
||||
boolean handleDefault(in nsIDOMEvent aEvent);
|
||||
|
||||
// Set this element to be equivalent to |aElement|. This does not need
|
||||
// to worry about copying attributes or child nodes, but should copy any
|
||||
// other needed state.
|
||||
void cloneState(in nsIDOMElement aElement);
|
||||
|
||||
/**
|
||||
* Returns accesskey attribute node.
|
||||
*/
|
||||
readonly attribute nsIDOMAttr accesskeyNode;
|
||||
|
||||
/**
|
||||
* Performs accesskey. The method is called when accesskey is activated.
|
||||
*/
|
||||
void performAccesskey();
|
||||
};
|
||||
|
@ -1,21 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIXTFElement;
|
||||
|
||||
[scriptable, uuid(27c10dca-2efc-416b-ae36-9794380a661e)]
|
||||
interface nsIXTFElementFactory : nsISupports
|
||||
{
|
||||
nsIXTFElement createElement(in AString tagName);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_XTF_ELEMENT_FACTORY_CONTRACTID "@mozilla.org/xtf/element-factory;1"
|
||||
#define NS_XTF_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_XTF_ELEMENT_FACTORY_CONTRACTID "?namespace="
|
||||
|
||||
%}
|
@ -1,37 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAtom;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
[scriptable, uuid(3697f9ed-d8bc-4c00-890f-7a702d5b4005)]
|
||||
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:
|
||||
*/
|
||||
attribute unsigned long notificationMask;
|
||||
|
||||
/**
|
||||
* Sets the intrinsic state for the element.
|
||||
* @see nsIContent::IntrinsicState().
|
||||
*/
|
||||
void setIntrinsicState(in unsigned long long newState);
|
||||
|
||||
/**
|
||||
* This sets the name of the class attribute.
|
||||
* Should be called only during ::onCreated.
|
||||
* Note! nsIXTFAttributeHandler can't be used to handle class attribute.
|
||||
*/
|
||||
void setClassAttributeName(in nsIAtom name);
|
||||
};
|
||||
|
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/*
|
||||
* This interface can be used to give access to a private 'inner'
|
||||
* interface when an xtf element is accessed through its wrapper (or
|
||||
* more precisely: accessed through one of the wrapper-generated
|
||||
* nsXTFInterfaceAggregator proxies). For JS-implemented XTF elements
|
||||
* the inner interface can be used to gain access to the underlying
|
||||
* JSObject using xpconnect's "wrappedJSObject" mechanism (see
|
||||
* nsIXPConnect.idl).
|
||||
*/
|
||||
|
||||
[scriptable, uuid(13ef3d54-1dd1-4a5c-a8d5-a04a327fb9b6)]
|
||||
interface nsIXTFPrivate : nsISupports
|
||||
{
|
||||
readonly attribute nsISupports inner;
|
||||
};
|
@ -1,164 +0,0 @@
|
||||
XTF: An eXtensible Tag Framework
|
||||
================================
|
||||
|
||||
XTF allows you to extend Mozilla by implementing new XML elements in
|
||||
XPCOM modules. It is not a C++-version of XBL: XTF elements can be
|
||||
written in any XPCOM-compatible language. I myself tend to write most
|
||||
elements in JavaScript.
|
||||
|
||||
XTF support needs to be explicitly switched on for Mozilla builds by
|
||||
specifying the configure option '--enable-xtf' (add "ac_add_options
|
||||
--enabl-xtf" to your .mozconfig).
|
||||
|
||||
To serve a particular namespace "urn:mycompany:mynamespace" with your
|
||||
own XTF elements, create an XPCOM component that implements the
|
||||
interface nsIXTFElementFactory, and register it with the component
|
||||
manager under the contract id
|
||||
"@mozilla.org/xtf/element-factory;1?namespace=urn:mycompany:mynamespace".
|
||||
Whenever Mozilla encounters a tag in your namespace it will call your
|
||||
factory's 'createElement()' function. This function should either
|
||||
return a new xtf element (an object implementing 'nsIXTFElement' and
|
||||
some other interfaces, depending on type and required features), or
|
||||
'null'. In the later case, the implementation will build a generic XML
|
||||
element.
|
||||
|
||||
All interfaces relevant to XTF factory modules and XTF elements can be
|
||||
found in mozilla/content/xtf/public/. The implementation code itself
|
||||
is mainly spread over the directories mozilla/content/xtf/ and
|
||||
mozilla/layout/xtf/.
|
||||
|
||||
Binding outermost elements (document elements)
|
||||
==============================================
|
||||
|
||||
Binding of outermost elements is not (yet) supported. Depending on
|
||||
what you use xtf elements for, this might or might not be a
|
||||
problem. If you use xtf to implement a whole new language, rather than
|
||||
just widgets that will get used in html, xul, or svg docs, then you'll
|
||||
probably want to wrap up your documents in an xml element for which
|
||||
you provide some style (e.g. via a ua style sheet), so that things get
|
||||
displayed instead of pretty printed. This outermost element can be in
|
||||
your xtf-served namespace, as long as your xtf factory returns a
|
||||
failure for this element's tagname. The implementation will then
|
||||
generate a generic XML element for this element.
|
||||
|
||||
XTF and XUL
|
||||
===========
|
||||
|
||||
When using XTF elements in XUL documents, note that the owner document
|
||||
(both wrapper.ownerDocument & wrapper.elementNode.ownerDocument) will
|
||||
be null at the time of the onCreated() call. (For XML and SVG
|
||||
documents, at least wrapper.ownerDocument should be non-null.) This
|
||||
is unfortunate, since it is often advantageous to build the visual
|
||||
content tree at the time of the onCreated() call and not wait until
|
||||
the visual content is explicitly requested, so that attributes set on
|
||||
the xtf element can be mapped directly to elements in the visual
|
||||
content tree. It is possible to build the content tree using a
|
||||
different document than the ultimate target document, but this in turn
|
||||
leads to some subtleties with XBL-bound content - see below.
|
||||
|
||||
|
||||
XTF and XBL
|
||||
===========
|
||||
|
||||
XTF elements generally behave well in conjunction with XBL. There are
|
||||
a few issues when using XBL-bound elements in an XTFVisual's
|
||||
visualContent that arise from the fact that XBL bindings are attached
|
||||
to elements at layout-time rather than content-tree contruction time:
|
||||
Accessing an XBL-bound element's interfaces or JS object before
|
||||
layout-time usually doesn't yield the expected result. E.g. a listbox
|
||||
won't have the members 'appendItem', 'clearSelection', etc. before
|
||||
layout-time, even if QI'ed for nsIDOMXULMenuListElement. Worse, if the
|
||||
visual content has been constructed in a different document (because
|
||||
the target doc wasn't available at the time of content tree
|
||||
construction time - see above), then the JS object obtained before
|
||||
layout time will be different to the one that will ultimately receive
|
||||
the bound implementation, i.e. even QI'ing at a later stage will
|
||||
fail. To work around these issues, XBL-bound content should a) either
|
||||
be build as late as possible (i.e. when requested by the wrapper with
|
||||
a call to nsIXTFVisual::GetVisualContent()) or b) if this is not a
|
||||
possibility (e.g. because you would like to map attributes directly
|
||||
into the visual content tree), all JS object references to the element
|
||||
should be re-resolved at the time of the first layout (listen in to
|
||||
DidLayout() notifications).
|
||||
|
||||
|
||||
Bugs
|
||||
====
|
||||
|
||||
1.
|
||||
For xtf elements written in JS (and possibly C++ as well),
|
||||
constructing a visual's visualContent using the same document as the
|
||||
visual's leads to some nasty reference cycle which prevents the
|
||||
wrapper, inner xtf element, anonymous content and possibly the whole
|
||||
document from ever getting destroyed. A workaround is to construct the
|
||||
visualContent in a different document (e.g. setting the document in
|
||||
nsXMLContentBuilder to null, or not setting the document at all, will
|
||||
lead to new content being build in a new temporary document).
|
||||
|
||||
|
||||
2.
|
||||
XBL-bound elements behave strangely if *any* XUL content underneath
|
||||
them is accessed from JS too early.
|
||||
Example:
|
||||
|
||||
<groupbox>
|
||||
<caption><xtf:foo/></caption>
|
||||
<label value="label text"/>
|
||||
</groupbox>
|
||||
|
||||
If the JS-implemented xtf element 'foo' accesses any xul content
|
||||
before it receives the 'didLayout' notification, the groupbox will not
|
||||
be properly build (it will not contain the label text). 'Accessing xul
|
||||
content' includes any operation that leads to a js wrapper being
|
||||
constructed for a xul element. E.g. if the xtf element listens in to
|
||||
parentChanged-notifications, a wrapper will be build for the
|
||||
notification's 'parent' parameter and groupbox construction
|
||||
mysteriously fails.
|
||||
|
||||
|
||||
3.
|
||||
Some XUL interfaces can't be used via XPCOM and thus might not work as
|
||||
expected. E.g. menulist's
|
||||
nsIDOMXULSelectControlElement::insertItemAt() is supposed to return an
|
||||
element of type nsIDOMXULSelectControlItemElement. However, since
|
||||
menulist's XBL implementation of insertItemAt creates a xul element
|
||||
which will only be bound when the next asynchronous layout occurs,
|
||||
QI'ing to nsIDOMXULSelectControlItemElement fails. The result is that
|
||||
the method call always fails when invoked through XPCOM. A pragmatic
|
||||
solution would be to change the XUL interface signatures to return
|
||||
nsIDOMXULElement instead of nsIDOMXULSelectControlItemElement.
|
||||
|
||||
|
||||
4.
|
||||
QI'ing a JS-implemented xtf element's wrapper from JS as in
|
||||
|
||||
element.QueryInterface(Components.interface.nsIXTFPrivate);
|
||||
|
||||
occasionally hits the assertion
|
||||
|
||||
###!!! ASSERTION: tearoff not empty in dtor:
|
||||
'!(GetInterface()||GetNative()||GetJSObject())',
|
||||
file /home/alex/devel/mozilla/js/src/xpconnect/src/xpcinlines.h, line 627
|
||||
|
||||
with the result that the QI succeeds (i.e. doesn't throw an exception)
|
||||
but the interface methods/properties aren't available on the element
|
||||
after the QI, even though element implements the given interface.
|
||||
|
||||
This seems to happen if GC kicks in *afer* the xtf element is being
|
||||
queried for its interface ( resulting in the creation of an
|
||||
nsXTFInterfaceAggregator) but *before* the nsXTFInterfaceAggregator
|
||||
has been wrapped for JS use by XPCConvert::NativeData2JS().
|
||||
|
||||
The workaround is to a) either expose the interface via
|
||||
getScriptingInterfaces (in which case it will be available to JS
|
||||
callers automatically), or b) call QI until the interface is correctly
|
||||
installed, e.g.:
|
||||
|
||||
while (!element.inner)
|
||||
element.QueryInterface(Components.interface.nsIXTFPrivate);
|
||||
|
||||
With this code the QI should succeed in the first or second iteration.
|
||||
|
||||
|
||||
|
||||
07. October 2004 Alex Fritze <alex@croczilla.com>
|
@ -1,43 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = content
|
||||
LIBRARY_NAME = gkcontentxtf_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FAIL_ON_WARNINGS = 1
|
||||
|
||||
CPPSRCS = \
|
||||
nsXMLContentBuilder.cpp \
|
||||
nsXTFElementWrapper.cpp \
|
||||
nsXTFInterfaceAggregator.cpp \
|
||||
nsXTFService.cpp \
|
||||
nsXTFWeakTearoff.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
EXPORTS = \
|
||||
nsIXTFService.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../../xml/content/src \
|
||||
-I$(srcdir)/../../base/src \
|
||||
-I$(topsrcdir)/dom \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_IXTFSERVICE_H__
|
||||
#define __NS_IXTFSERVICE_H__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsINodeInfo;
|
||||
|
||||
// {4ac3826f-280e-4572-9ede-6c81a4797861}
|
||||
#define NS_IXTFSERVICE_IID \
|
||||
{ 0x4ac3826f, 0x280e, 0x4572, \
|
||||
{ 0x9e, 0xde, 0x6c, 0x81, 0xa4, 0x79, 0x78, 0x61 } }
|
||||
class nsIXTFService : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXTFSERVICE_IID)
|
||||
|
||||
// try to create an xtf element based on namespace
|
||||
virtual nsresult CreateElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIXTFService, NS_IXTFSERVICE_IID)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// The one class implementing this interface:
|
||||
|
||||
// {4EC832DA-6AE7-4185-807B-DADDCB5DA37A}
|
||||
#define NS_XTFSERVICE_CID \
|
||||
{ 0x4ec832da, 0x6ae7, 0x4185, { 0x80, 0x7b, 0xda, 0xdd, 0xcb, 0x5d, 0xa3, 0x7a } }
|
||||
|
||||
#define NS_XTFSERVICE_CONTRACTID "@mozilla.org/xtf/xtf-service;1"
|
||||
|
||||
nsresult NS_NewXTFService(nsIXTFService** aResult);
|
||||
|
||||
#endif // __NS_IXTFSERVICE_H__
|
||||
|
@ -1,212 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIXMLContentBuilder.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
|
||||
class nsXMLContentBuilder MOZ_FINAL : public nsIXMLContentBuilder
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewXMLContentBuilder(nsIXMLContentBuilder** aResult);
|
||||
|
||||
nsXMLContentBuilder();
|
||||
~nsXMLContentBuilder();
|
||||
|
||||
public:
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXMLContentBuilder interface
|
||||
NS_DECL_NSIXMLCONTENTBUILDER
|
||||
|
||||
private:
|
||||
void EnsureDoc();
|
||||
|
||||
nsCOMPtr<nsIContent> mTop;
|
||||
nsCOMPtr<nsIContent> mCurrent;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
int32_t mNamespaceId;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
nsXMLContentBuilder::nsXMLContentBuilder()
|
||||
: mNamespaceId(kNameSpaceID_None)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// printf("nsXMLContentBuilder CTOR\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsXMLContentBuilder::~nsXMLContentBuilder()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// printf("~nsXMLContentBuilder\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXMLContentBuilder(nsIXMLContentBuilder** aResult)
|
||||
{
|
||||
nsXMLContentBuilder* result = new nsXMLContentBuilder();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXMLContentBuilder, nsIXMLContentBuilder)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXMLContentBuilder implementation
|
||||
|
||||
/* void clear (in nsIDOMElement root); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::Clear(nsIDOMElement *root)
|
||||
{
|
||||
mCurrent = do_QueryInterface(root);
|
||||
mTop = do_QueryInterface(root);
|
||||
if (mNamespaceId != kNameSpaceID_None) {
|
||||
mNamespaceId = kNameSpaceID_None;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setDocument (in nsIDOMDocument doc); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::SetDocument(nsIDOMDocument *doc)
|
||||
{
|
||||
mDocument = do_QueryInterface(doc);
|
||||
#ifdef DEBUG
|
||||
if (!mDocument)
|
||||
NS_WARNING("null document in nsXMLContentBuilder::SetDocument");
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setElementNamespace (in AString ns); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::SetElementNamespace(const nsAString & ns)
|
||||
{
|
||||
nsContentUtils::NameSpaceManager()->RegisterNameSpace(ns, mNamespaceId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void beginElement (in AString tagname); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::BeginElement(const nsAString & tagname)
|
||||
{
|
||||
nsCOMPtr<nsIContent> node;
|
||||
{
|
||||
EnsureDoc();
|
||||
mDocument->CreateElem(tagname, nullptr, mNamespaceId, getter_AddRefs(node));
|
||||
}
|
||||
if (!node) {
|
||||
NS_ERROR("could not create node");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// ok, we created a content element. now either append it to our
|
||||
// top-level array or to the current element.
|
||||
if (!mCurrent) {
|
||||
if (mTop) {
|
||||
NS_ERROR("Building of multi-rooted trees not supported");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTop = node;
|
||||
mCurrent = mTop;
|
||||
}
|
||||
else {
|
||||
mCurrent->AppendChildTo(node, true);
|
||||
mCurrent = node;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void endElement (); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::EndElement()
|
||||
{
|
||||
NS_ASSERTION(mCurrent, "unbalanced begin/endelement");
|
||||
mCurrent = mCurrent->GetParent();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void attrib (in AString name, in AString value); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::Attrib(const nsAString & name, const nsAString & value)
|
||||
{
|
||||
NS_ASSERTION(mCurrent, "can't set attrib w/o open element");
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(name);
|
||||
mCurrent->SetAttr(0, nameAtom, value, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void textNode (in AString text); */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::TextNode(const nsAString & text)
|
||||
{
|
||||
EnsureDoc();
|
||||
NS_ASSERTION(mCurrent, "can't append textnode w/o open element");
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
|
||||
NS_ASSERTION(domDoc, "no dom document");
|
||||
|
||||
nsCOMPtr<nsIDOMText> textNode;
|
||||
domDoc->CreateTextNode(text, getter_AddRefs(textNode));
|
||||
NS_ASSERTION(textNode, "Failed to create text node");
|
||||
nsCOMPtr<nsIContent> textContent = do_QueryInterface(textNode);
|
||||
mCurrent->AppendChildTo(textContent, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement root; */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::GetRoot(nsIDOMElement * *aRoot)
|
||||
{
|
||||
if (!mTop) {
|
||||
*aRoot = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
return CallQueryInterface(mTop, aRoot);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement current; */
|
||||
NS_IMETHODIMP nsXMLContentBuilder::GetCurrent(nsIDOMElement * *aCurrent)
|
||||
{
|
||||
if (!mCurrent) {
|
||||
*aCurrent = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
return CallQueryInterface(mCurrent, aCurrent);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation helpers
|
||||
|
||||
void nsXMLContentBuilder::EnsureDoc()
|
||||
{
|
||||
if (!mDocument) {
|
||||
mDocument = do_CreateInstance(kXMLDocumentCID);
|
||||
// XXX should probably do some doc initialization here, such as
|
||||
// setting the base url
|
||||
}
|
||||
NS_ASSERTION(mDocument, "null doc");
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,215 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_XTFELEMENTWRAPPER_H__
|
||||
#define __NS_XTFELEMENTWRAPPER_H__
|
||||
|
||||
#include "nsIXTFElementWrapper.h"
|
||||
#include "nsXMLElement.h"
|
||||
#include "nsIXTFAttributeHandler.h"
|
||||
#include "nsIXTFElement.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
typedef nsXMLElement nsXTFElementWrapperBase;
|
||||
class nsXTFClassInfo;
|
||||
|
||||
// Pseudo IID for nsXTFElementWrapper
|
||||
// {599EB85F-ABC0-4B52-A1B0-EA103D48E3AE}
|
||||
#define NS_XTFELEMENTWRAPPER_IID \
|
||||
{ 0x599eb85f, 0xabc0, 0x4b52, { 0xa1, 0xb0, 0xea, 0x10, 0x3d, 0x48, 0xe3, 0xae } }
|
||||
|
||||
|
||||
class nsXTFElementWrapper : public nsXTFElementWrapperBase,
|
||||
public nsIXTFElementWrapper
|
||||
{
|
||||
public:
|
||||
nsXTFElementWrapper(already_AddRefed<nsINodeInfo> aNodeInfo, nsIXTFElement* aXTFElement);
|
||||
virtual ~nsXTFElementWrapper();
|
||||
nsresult Init();
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XTFELEMENTWRAPPER_IID)
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsXTFElementWrapper,
|
||||
nsXTFElementWrapperBase)
|
||||
|
||||
// nsIXTFElementWrapper
|
||||
NS_DECL_NSIXTFELEMENTWRAPPER
|
||||
|
||||
// nsIContent specializations:
|
||||
#ifdef HAVE_CPP_AMBIGUITY_RESOLVING_USING
|
||||
using nsINode::GetProperty;
|
||||
using nsINode::SetProperty;
|
||||
#endif
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
||||
bool aNotify);
|
||||
void RemoveChildAt(uint32_t aIndex, bool aNotify);
|
||||
nsIAtom *GetIDAttributeName() const;
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
bool aNotify);
|
||||
bool GetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
bool HasAttr(int32_t aNameSpaceID, nsIAtom* aName) const;
|
||||
virtual bool AttrValueIs(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
virtual bool AttrValueIs(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
virtual int32_t FindAttrValueIn(int32_t aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
AttrValuesArray* aValues,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
|
||||
bool aNotify);
|
||||
const nsAttrName* GetAttrNameAt(uint32_t aIndex) const;
|
||||
uint32_t GetAttrCount() const;
|
||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual void BeginAddingChildren();
|
||||
virtual void DoneAddingChildren(bool aHaveNotified);
|
||||
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent);
|
||||
|
||||
// Element specializations:
|
||||
using nsXMLElement::GetAttribute;
|
||||
using nsXMLElement::RemoveAttribute;
|
||||
using nsXMLElement::HasAttribute;
|
||||
virtual void GetAttribute(const nsAString& aName,
|
||||
nsString& aReturn) MOZ_OVERRIDE;
|
||||
virtual void RemoveAttribute(const nsAString& aName,
|
||||
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
||||
virtual bool HasAttribute(const nsAString& aName) const MOZ_OVERRIDE;
|
||||
|
||||
// nsIClassInfo interface
|
||||
NS_DECL_NSICLASSINFO
|
||||
|
||||
// nsIXPCScriptable interface
|
||||
NS_FORWARD_SAFE_NSIXPCSCRIPTABLE(GetBaseXPCClassInfo())
|
||||
|
||||
// nsXPCClassInfo
|
||||
virtual void PreserveWrapper(nsISupports *aNative)
|
||||
{
|
||||
nsXPCClassInfo *ci = GetBaseXPCClassInfo();
|
||||
if (ci) {
|
||||
ci->PreserveWrapper(aNative);
|
||||
}
|
||||
}
|
||||
virtual uint32_t GetInterfacesBitmap()
|
||||
{
|
||||
nsXPCClassInfo *ci = GetBaseXPCClassInfo();
|
||||
return ci ? ci->GetInterfacesBitmap() : 0;
|
||||
}
|
||||
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
|
||||
nsresult CloneState(nsIDOMElement *aElement)
|
||||
{
|
||||
return GetXTFElement()->CloneState(aElement);
|
||||
}
|
||||
nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual void NodeInfoChanged(nsINodeInfo* aOldNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual nsIXTFElement* GetXTFElement() const
|
||||
{
|
||||
return mXTFElement;
|
||||
}
|
||||
|
||||
static nsXPCClassInfo* GetBaseXPCClassInfo()
|
||||
{
|
||||
return static_cast<nsXPCClassInfo*>(
|
||||
NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id));
|
||||
}
|
||||
|
||||
// implementation helpers:
|
||||
bool QueryInterfaceInner(REFNSIID aIID, void** result);
|
||||
|
||||
bool HandledByInner(nsIAtom* attr) const;
|
||||
|
||||
void RegUnregAccessKey(bool aDoReg);
|
||||
|
||||
nsCOMPtr<nsIXTFElement> mXTFElement;
|
||||
|
||||
uint32_t mNotificationMask;
|
||||
nsCOMPtr<nsIXTFAttributeHandler> mAttributeHandler;
|
||||
|
||||
/*
|
||||
* The intrinsic state of the element.
|
||||
* @see nsIContent::IntrinsicState()
|
||||
*/
|
||||
nsEventStates mIntrinsicState;
|
||||
|
||||
// Temporary owner used by GetAttrNameAt
|
||||
nsAttrName mTmpAttrName;
|
||||
|
||||
nsCOMPtr<nsIAtom> mClassAttributeName;
|
||||
|
||||
nsRefPtr<nsXTFClassInfo> mClassInfo;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsXTFElementWrapper, NS_XTFELEMENTWRAPPER_IID)
|
||||
|
||||
class nsXTFClassInfo MOZ_FINAL : public nsXPCClassInfo
|
||||
{
|
||||
public:
|
||||
nsXTFClassInfo(nsXTFElementWrapper* aWrapper) : mWrapper(aWrapper) {}
|
||||
|
||||
void Disconnect() { mWrapper = nullptr; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSICLASSINFO(mWrapper);
|
||||
NS_FORWARD_SAFE_NSIXPCSCRIPTABLE(mWrapper);
|
||||
|
||||
// nsXPCClassInfo
|
||||
virtual void PreserveWrapper(nsISupports* aNative)
|
||||
{
|
||||
if (mWrapper) {
|
||||
mWrapper->PreserveWrapper(aNative);
|
||||
}
|
||||
}
|
||||
|
||||
virtual uint32_t GetInterfacesBitmap()
|
||||
{
|
||||
return mWrapper ? mWrapper->GetInterfacesBitmap() : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
nsXTFElementWrapper* mWrapper;
|
||||
};
|
||||
|
||||
/* [notxpcom,nostdcall] uint32_t getScriptableFlags(); */
|
||||
// This method isn't automatically forwarded safely because it's notxpcom, so
|
||||
// the IDL binding doesn't know what value to return.
|
||||
inline uint32_t
|
||||
nsXTFClassInfo::GetScriptableFlags()
|
||||
{
|
||||
return mWrapper ? mWrapper->GetScriptableFlags() : 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXTFElementWrapper(nsIXTFElement* aXTFElement, already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
nsIContent** aResult);
|
||||
|
||||
#endif // __NS_XTFELEMENTWRAPPER_H__
|
@ -1,155 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPTCUtils.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsXTFInterfaceAggregator class
|
||||
|
||||
class nsXTFInterfaceAggregator MOZ_FINAL : protected nsAutoXPTCStub
|
||||
{
|
||||
protected:
|
||||
friend nsresult
|
||||
NS_NewXTFInterfaceAggregator(const nsIID& iid,
|
||||
nsISupports* inner,
|
||||
nsISupports* outer,
|
||||
void** result);
|
||||
|
||||
nsXTFInterfaceAggregator(const nsIID& iid,
|
||||
nsISupports* inner,
|
||||
nsISupports* outer,
|
||||
nsresult *rv);
|
||||
~nsXTFInterfaceAggregator();
|
||||
|
||||
public:
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CallMethod(uint16_t methodIndex,
|
||||
const XPTMethodDescriptor* info,
|
||||
nsXPTCMiniVariant* params);
|
||||
|
||||
private:
|
||||
nsISupports *mInner;
|
||||
nsISupports *mOuter;
|
||||
nsIID mIID;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
nsXTFInterfaceAggregator::nsXTFInterfaceAggregator(const nsIID& iid,
|
||||
nsISupports* inner,
|
||||
nsISupports* outer,
|
||||
nsresult *rv)
|
||||
: mInner(inner), mOuter(outer), mIID(iid)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// printf("nsXTFInterfaceAggregator CTOR\n");
|
||||
#endif
|
||||
mInner->AddRef();
|
||||
mOuter->AddRef();
|
||||
|
||||
*rv = InitStub(iid);
|
||||
}
|
||||
|
||||
nsXTFInterfaceAggregator::~nsXTFInterfaceAggregator()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// printf("nsXTFInterfaceAggregator DTOR\n");
|
||||
#endif
|
||||
mInner->Release();
|
||||
mOuter->Release();
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXTFInterfaceAggregator(const nsIID& iid,
|
||||
nsISupports* inner,
|
||||
nsISupports* outer,
|
||||
void** aResult){
|
||||
NS_PRECONDITION(aResult != nullptr, "null ptr");
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsRefPtr<nsXTFInterfaceAggregator> result =
|
||||
new nsXTFInterfaceAggregator(iid, inner, outer, &rv);
|
||||
if (!result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return result->QueryInterface(iid, aResult);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports implementation
|
||||
|
||||
NS_IMPL_ADDREF(nsXTFInterfaceAggregator)
|
||||
NS_IMPL_RELEASE(nsXTFInterfaceAggregator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_PRECONDITION(aInstancePtr, "null out param");
|
||||
|
||||
if (aIID.Equals(mIID)) {
|
||||
*aInstancePtr = mXPTCStub;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return mOuter->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsXPTCStubBase implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXTFInterfaceAggregator::CallMethod(uint16_t methodIndex,
|
||||
const XPTMethodDescriptor *info,
|
||||
nsXPTCMiniVariant* params)
|
||||
{
|
||||
NS_ASSERTION(methodIndex >= 3,
|
||||
"huh? indirect nsISupports method call unexpected");
|
||||
|
||||
// prepare args:
|
||||
int paramCount = info->num_args;
|
||||
nsXPTCVariant* fullPars;
|
||||
if (!paramCount) {
|
||||
fullPars = nullptr;
|
||||
}
|
||||
else {
|
||||
fullPars = new nsXPTCVariant[paramCount];
|
||||
if (!fullPars)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (int i=0; i<paramCount; ++i) {
|
||||
const nsXPTParamInfo& paramInfo = info->params[i];
|
||||
uint8_t flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0;
|
||||
fullPars[i].Init(params[i], paramInfo.GetType(), flags);
|
||||
}
|
||||
|
||||
// make the call:
|
||||
nsresult rv = NS_InvokeByIndex(mInner,
|
||||
methodIndex,
|
||||
paramCount,
|
||||
fullPars);
|
||||
if (fullPars)
|
||||
delete []fullPars;
|
||||
return rv;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_XTFINTERFACEAGGREGATOR_H__
|
||||
#define __NS_XTFINTERFACEAGGREGATOR_H__
|
||||
|
||||
nsresult
|
||||
NS_NewXTFInterfaceAggregator(const nsIID& iid,
|
||||
nsISupports* inner,
|
||||
nsISupports* outer,
|
||||
void** result);
|
||||
|
||||
|
||||
#endif // __NS_XTFINTERFACEAGGREGATOR_H__
|
@ -1,108 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXTFElement.h"
|
||||
#include "nsIXTFElementFactory.h"
|
||||
#include "nsIXTFService.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXTFElementWrapper.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsXTFService class
|
||||
class nsXTFService MOZ_FINAL : public nsIXTFService
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewXTFService(nsIXTFService** aResult);
|
||||
|
||||
nsXTFService();
|
||||
|
||||
public:
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXTFService interface
|
||||
nsresult CreateElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
private:
|
||||
nsInterfaceHashtable<nsUint32HashKey, nsIXTFElementFactory> mFactoryHash;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
nsXTFService::nsXTFService()
|
||||
{
|
||||
mFactoryHash.Init(); // XXX this can fail. move to Init()
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXTFService(nsIXTFService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nullptr, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsXTFService* result = new nsXTFService();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXTFService, nsIXTFService)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXTFService methods
|
||||
|
||||
nsresult
|
||||
nsXTFService::CreateElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
{
|
||||
nsCOMPtr<nsIXTFElementFactory> factory;
|
||||
|
||||
// Check if we have an xtf factory for the given namespaceid in our cache:
|
||||
if (!mFactoryHash.Get(aNodeInfo.get()->NamespaceID(), getter_AddRefs(factory))) {
|
||||
// No. See if there is one registered with the component manager:
|
||||
nsAutoCString xtf_contract_id(NS_XTF_ELEMENT_FACTORY_CONTRACTID_PREFIX);
|
||||
nsAutoString uri;
|
||||
aNodeInfo.get()->GetNamespaceURI(uri);
|
||||
AppendUTF16toUTF8(uri, xtf_contract_id);
|
||||
#ifdef DEBUG_xtf_verbose
|
||||
printf("Testing for XTF factory at %s\n", xtf_contract_id.get());
|
||||
#endif
|
||||
factory = do_GetService(xtf_contract_id.get());
|
||||
if (factory) {
|
||||
#ifdef DEBUG
|
||||
printf("We've got an XTF factory: %s \n", xtf_contract_id.get());
|
||||
#endif
|
||||
// Put into hash:
|
||||
mFactoryHash.Put(aNodeInfo.get()->NamespaceID(), factory);
|
||||
}
|
||||
}
|
||||
if (!factory) return NS_ERROR_FAILURE;
|
||||
|
||||
// We have an xtf factory. Now try to create an element for the given tag name:
|
||||
nsCOMPtr<nsIXTFElement> elem;
|
||||
nsAutoString tagName;
|
||||
aNodeInfo.get()->GetName(tagName);
|
||||
factory->CreateElement(tagName, getter_AddRefs(elem));
|
||||
if (!elem) return NS_ERROR_FAILURE;
|
||||
|
||||
// We've got an xtf element. Create a wrapper for it:
|
||||
return NS_NewXTFElementWrapper(elem, aNodeInfo, aResult);
|
||||
}
|
||||
|
@ -1,135 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPTCUtils.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsXTFWeakTearoff class
|
||||
|
||||
class nsXTFWeakTearoff MOZ_FINAL : protected nsAutoXPTCStub
|
||||
{
|
||||
protected:
|
||||
~nsXTFWeakTearoff();
|
||||
|
||||
public:
|
||||
nsXTFWeakTearoff(const nsIID& iid,
|
||||
nsISupports* obj,
|
||||
nsresult *rv);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CallMethod(uint16_t methodIndex,
|
||||
const XPTMethodDescriptor* info,
|
||||
nsXPTCMiniVariant* params);
|
||||
|
||||
private:
|
||||
nsISupports *mObj;
|
||||
nsIID mIID;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
nsXTFWeakTearoff::nsXTFWeakTearoff(const nsIID& iid,
|
||||
nsISupports* obj,
|
||||
nsresult *rv)
|
||||
: mObj(obj), mIID(iid)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXTFWeakTearoff);
|
||||
|
||||
*rv = InitStub(iid);
|
||||
}
|
||||
|
||||
nsXTFWeakTearoff::~nsXTFWeakTearoff()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsXTFWeakTearoff);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewXTFWeakTearoff(const nsIID& iid,
|
||||
nsISupports* obj,
|
||||
nsISupports** aResult){
|
||||
NS_PRECONDITION(aResult != nullptr, "null ptr");
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsRefPtr<nsXTFWeakTearoff> result =
|
||||
new nsXTFWeakTearoff(iid, obj, &rv);
|
||||
if (!result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return result->QueryInterface(iid, (void**) aResult);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports implementation
|
||||
|
||||
NS_IMPL_ADDREF(nsXTFWeakTearoff)
|
||||
NS_IMPL_RELEASE(nsXTFWeakTearoff)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_PRECONDITION(aInstancePtr, "null out param");
|
||||
|
||||
if (aIID.Equals(mIID) || aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = mXPTCStub;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
// we can't map QI onto the obj, because the xpcom wrapper otherwise
|
||||
// QI-accumulates all interfaces defined on mObj
|
||||
// else return mObj->QueryInterface(aIID, aInstancePtr);
|
||||
*aInstancePtr = nullptr;
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXTFWeakTearoff::CallMethod(uint16_t methodIndex,
|
||||
const XPTMethodDescriptor* info,
|
||||
nsXPTCMiniVariant* params)
|
||||
{
|
||||
NS_ASSERTION(methodIndex >= 3,
|
||||
"huh? indirect nsISupports method call unexpected");
|
||||
|
||||
// prepare args:
|
||||
int paramCount = info->num_args;
|
||||
nsXPTCVariant* fullPars;
|
||||
if (!paramCount) {
|
||||
fullPars = nullptr;
|
||||
}
|
||||
else {
|
||||
fullPars = new nsXPTCVariant[paramCount];
|
||||
if (!fullPars)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (int i=0; i<paramCount; ++i) {
|
||||
const nsXPTParamInfo& paramInfo = info->params[i];
|
||||
uint8_t flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0;
|
||||
fullPars[i].Init(params[i], paramInfo.GetType(), flags);
|
||||
}
|
||||
|
||||
// make the call:
|
||||
nsresult rv = NS_InvokeByIndex(mObj, methodIndex, paramCount, fullPars);
|
||||
if (fullPars)
|
||||
delete []fullPars;
|
||||
return rv;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_XTFWEAKTEAROFF_H__
|
||||
#define __NS_XTFWEAKTEAROFF_H__
|
||||
|
||||
nsresult
|
||||
NS_NewXTFWeakTearoff(const nsIID& iid,
|
||||
nsISupports* obj,
|
||||
nsISupports** result);
|
||||
|
||||
|
||||
#endif // __NS_XTFWEAKTEAROFF_H__
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# 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/.
|
||||
|
||||
#
|
||||
# Makefile for installing and running xpcshell-based tests. You can use
|
||||
# this file as template when creating tests for a new module. Don't
|
||||
# forget to change the lines marked below. See
|
||||
# http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
|
||||
# for detailed instructions.
|
||||
#
|
||||
|
||||
# Note: DEPTH should be set to the relative path to mozilla/
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = @relativesrcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# Note: set the test module's name to test_<yourmodule>
|
||||
MODULE = test_xtf
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,50 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
function run_test() {
|
||||
const C_i = Components.interfaces;
|
||||
const nsIXTFElementFactory = C_i.nsIXTFElementFactory;
|
||||
const nsIXTFPrivate = C_i.nsIXTFPrivate;
|
||||
const nsIDOMParser = C_i.nsIDOMParser;
|
||||
const nsIDOMEventTarget = C_i.nsIDOMEventTarget;
|
||||
do_load_manifest("xtfComponent.manifest");
|
||||
const xtfClass = "@mozilla.org/xtf/element-factory;1?namespace=";
|
||||
|
||||
do_check_true(xtfClass + "xtf-tests;foo" in Components.classes);
|
||||
var fooFactory = Components.classes[xtfClass + "xtf-tests;foo"]
|
||||
.getService(nsIXTFElementFactory);
|
||||
do_check_true(Boolean(fooFactory));
|
||||
|
||||
var xmlSource = "<bar xmlns='xtf-tests;foo'/>";
|
||||
const parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
||||
.createInstance(nsIDOMParser);
|
||||
var xmlDoc = parser.parseFromString(xmlSource, "application/xml");
|
||||
do_check_true(xmlDoc.documentElement instanceof nsIXTFPrivate);
|
||||
do_check_true(xmlDoc.documentElement instanceof nsIDOMEventTarget);
|
||||
|
||||
do_check_true(xmlDoc.documentElement.inner.wrappedJSObject.testpassed);
|
||||
|
||||
// Bug 378247
|
||||
xmlDoc.documentElement.addEventListener("DOMNodeInserted",
|
||||
function foo() {
|
||||
dump('This is a DOMNodeInserted test.\n');
|
||||
},
|
||||
true);
|
||||
xmlDoc.documentElement.appendChild(xmlDoc.createTextNode("bar"));
|
||||
do_check_true(xmlDoc.documentElement.inner.wrappedJSObject.testpassed);
|
||||
|
||||
xmlSource = "<handle_default xmlns='xtf-tests;foo'/>";
|
||||
xmlDoc = parser.parseFromString(xmlSource, "application/xml");
|
||||
do_check_true(xmlDoc.documentElement instanceof nsIXTFPrivate);
|
||||
do_check_true(xmlDoc.documentElement instanceof nsIDOMEventTarget);
|
||||
|
||||
// Bug 378247
|
||||
xmlDoc.documentElement.addEventListener("DOMNodeInserted",
|
||||
function foo() {
|
||||
dump('This is a DOMNodeInserted test.\n');
|
||||
},
|
||||
true);
|
||||
xmlDoc.documentElement.appendChild(xmlDoc.createTextNode("bar"));
|
||||
do_check_true(xmlDoc.documentElement.inner.wrappedJSObject.testpassed);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
[DEFAULT]
|
||||
head =
|
||||
tail =
|
||||
|
||||
[test_xtf.js]
|
@ -1,155 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
// Utility function.
|
||||
function NOT_IMPLEMENTED() {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
const C_i = Components.interfaces;
|
||||
|
||||
const nsIXTFElementFactory = C_i.nsIXTFElementFactory;
|
||||
const nsIXTFElement = C_i.nsIXTFElement;
|
||||
const nsIXTFPrivate = C_i.nsIXTFPrivate;
|
||||
const nsIXTFAttributeHandler = C_i.nsIXTFAttributeHandler;
|
||||
const mozIJSSubScriptLoader = C_i.mozIJSSubScriptLoader;
|
||||
const nsIProgrammingLanguage = C_i.nsIProgrammingLanguage;
|
||||
const nsIClassInfo = C_i.nsIClassInfo;
|
||||
const nsIComponentRegistrar = C_i.nsIComponentRegistrar;
|
||||
const nsIFactory = C_i.nsIFactory;
|
||||
const nsIModule = C_i.nsIModule;
|
||||
const nsISupports = C_i.nsISupports;
|
||||
|
||||
/**
|
||||
* Wrap a JavaScript object for passing to components code.
|
||||
*/
|
||||
function ObjectWrapper(object) {
|
||||
this.wrappedJSObject = object;
|
||||
}
|
||||
|
||||
/* <foo:element xmlns:foo="xtf-tests;foo"> */
|
||||
const FooInner = {
|
||||
bar: {
|
||||
testpassed: true
|
||||
},
|
||||
|
||||
handle_default: {
|
||||
testpassed: false
|
||||
}
|
||||
}
|
||||
|
||||
function FooElement(aLocalName) {
|
||||
this._wrapper = null;
|
||||
|
||||
// nsIXTFPrivate
|
||||
this.inner = new ObjectWrapper(FooInner[aLocalName]);
|
||||
}
|
||||
FooElement.prototype =
|
||||
{
|
||||
// nsIXTFElement
|
||||
onCreated: function onCreated(aWrapper) {
|
||||
this._wrapper = aWrapper;
|
||||
aWrapper.notificationMask = 0;
|
||||
},
|
||||
|
||||
// nsIXTFElement
|
||||
onDestroyed: function onDestroyed() {
|
||||
},
|
||||
|
||||
// nsIXTFElement
|
||||
isAttributeHandler: false,
|
||||
|
||||
// nsIXTFElement
|
||||
getScriptingInterfaces: function getScriptingInterfaces(aCount) {
|
||||
var interfaces = [];
|
||||
aCount.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
|
||||
// nsIXTFElement
|
||||
willChangeDocument: NOT_IMPLEMENTED,
|
||||
documentChanged: NOT_IMPLEMENTED,
|
||||
willChangeParent: NOT_IMPLEMENTED,
|
||||
parentChanged: NOT_IMPLEMENTED,
|
||||
willInsertChild: NOT_IMPLEMENTED,
|
||||
childInserted: NOT_IMPLEMENTED,
|
||||
willAppendChild: NOT_IMPLEMENTED,
|
||||
childAppended: NOT_IMPLEMENTED,
|
||||
willRemoveChild: NOT_IMPLEMENTED,
|
||||
childRemoved: NOT_IMPLEMENTED,
|
||||
willSetAttribute: NOT_IMPLEMENTED,
|
||||
attributeSet: NOT_IMPLEMENTED,
|
||||
willRemoveAttribute: NOT_IMPLEMENTED,
|
||||
attributeRemoved: NOT_IMPLEMENTED,
|
||||
|
||||
beginAddingChildren: NOT_IMPLEMENTED,
|
||||
doneAddingChildren: NOT_IMPLEMENTED,
|
||||
|
||||
handleDefault: NOT_IMPLEMENTED,
|
||||
cloneState: NOT_IMPLEMENTED,
|
||||
|
||||
get accesskeyNode() {
|
||||
return null;
|
||||
},
|
||||
performAccesskey: NOT_IMPLEMENTED,
|
||||
|
||||
// nsISupports
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(nsIXTFPrivate) ||
|
||||
aIID.equals(nsIXTFElement) ||
|
||||
aIID.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
function FooElementFactory() {}
|
||||
FooElementFactory.prototype =
|
||||
{
|
||||
classID: Components.ID("{f367b65d-6b7f-4a7f-9a4b-8bde0ff4ef10}"),
|
||||
|
||||
// nsIXTFElementFactory
|
||||
createElement: function createElement(aLocalName) {
|
||||
var rv = null;
|
||||
switch (aLocalName) {
|
||||
case "bar":
|
||||
rv = new FooElement(aLocalName);
|
||||
rv.handleDefault = function handleDefault(aEvent) {
|
||||
this.inner.wrappedJSObject.testpassed = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "handle_default":
|
||||
var rv = new FooElement(aLocalName);
|
||||
rv.onCreated = function onCreated(aWrapper) {
|
||||
this._wrapper = aWrapper;
|
||||
aWrapper.notificationMask = nsIXTFElement.NOTIFY_HANDLE_DEFAULT;
|
||||
}
|
||||
rv.handleDefault = function handleDefault(aEvent) {
|
||||
this.inner.wrappedJSObject.testpassed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return rv ? rv.QueryInterface(nsIXTFElement) : null;
|
||||
},
|
||||
|
||||
// nsISupports
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(nsIXTFElementFactory) ||
|
||||
aIID.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/* </foo:element> */
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FooElementFactory]);
|
@ -1,2 +0,0 @@
|
||||
component {f367b65d-6b7f-4a7f-9a4b-8bde0ff4ef10} xtfComponent.js
|
||||
contract @mozilla.org/xtf/element-factory;1?namespace=xtf-tests;foo {f367b65d-6b7f-4a7f-9a4b-8bde0ff4ef10}
|
@ -2850,12 +2850,6 @@ nsXULDocument::ResumeWalk()
|
||||
&isAlternate);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
if (element->GetNameSpaceID() > kNameSpaceID_LastBuiltin) {
|
||||
element->DoneAddingChildren(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// Now pop the context stack back up to the parent
|
||||
// element and continue the prototype walk.
|
||||
@ -2926,12 +2920,6 @@ nsXULDocument::ResumeWalk()
|
||||
// immediately.
|
||||
AddElementToDocumentPost(child);
|
||||
}
|
||||
#ifdef MOZ_XTF
|
||||
if (child &&
|
||||
child->GetNameSpaceID() > kNameSpaceID_LastBuiltin) {
|
||||
child->DoneAddingChildren(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3636,12 +3624,6 @@ nsXULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype,
|
||||
|
||||
result = content->AsElement();
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
if (result && xtfNi->NamespaceID() > kNameSpaceID_LastBuiltin) {
|
||||
result->BeginAddingChildren();
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = AddAttributes(aPrototype, result);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
@ -237,12 +237,6 @@ LOCAL_INCLUDES += \
|
||||
$(NULL)
|
||||
SHARED_LIBRARY_LIBS += ../inspector/src/$(LIB_PREFIX)inspector_s.$(LIB_SUFFIX)
|
||||
|
||||
ifdef MOZ_XTF
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/content/xtf/src/$(LIB_PREFIX)gkcontentxtf_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
../svg/$(LIB_PREFIX)gksvgbase_s.$(LIB_SUFFIX) \
|
||||
$(DEPTH)/content/svg/document/src/$(LIB_PREFIX)gkconsvgdoc_s.$(LIB_SUFFIX) \
|
||||
|
@ -224,11 +224,6 @@ NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
#include "nsIXTFService.h"
|
||||
#include "nsIXMLContentBuilder.h"
|
||||
#endif
|
||||
|
||||
#include "nsGeolocation.h"
|
||||
#include "nsDeviceSensors.h"
|
||||
#include "nsCSPService.h"
|
||||
@ -547,10 +542,6 @@ MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXUL
|
||||
MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
|
||||
// NS_NewXULControllers
|
||||
#endif
|
||||
#ifdef MOZ_XTF
|
||||
MAKE_CTOR(CreateXTFService, nsIXTFService, NS_NewXTFService)
|
||||
MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXMLContentBuilder)
|
||||
#endif
|
||||
MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
|
||||
MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, NS_NewEventListenerService)
|
||||
MAKE_CTOR(CreateGlobalMessageManager, nsIMessageBroadcaster, NS_NewGlobalMessageManager)
|
||||
@ -745,10 +736,6 @@ NS_DEFINE_NAMED_CID(NS_XULTEMPLATEBUILDER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XULTREEBUILDER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID);
|
||||
#endif
|
||||
#ifdef MOZ_XTF
|
||||
NS_DEFINE_NAMED_CID(NS_XTFSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XMLCONTENTBUILDER_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
|
||||
@ -1029,10 +1016,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||
{ &kNS_XULTEMPLATEBUILDER_CID, false, NULL, NS_NewXULContentBuilder },
|
||||
{ &kNS_XULTREEBUILDER_CID, false, NULL, NS_NewXULTreeBuilder },
|
||||
{ &kNS_XULDOCUMENT_CID, false, NULL, CreateXULDocument },
|
||||
#endif
|
||||
#ifdef MOZ_XTF
|
||||
{ &kNS_XTFSERVICE_CID, false, NULL, CreateXTFService },
|
||||
{ &kNS_XMLCONTENTBUILDER_CID, false, NULL, CreateXMLContentBuilder },
|
||||
#endif
|
||||
{ &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, NULL, CreateContentDLF },
|
||||
{ &kNS_DOM_SCRIPT_OBJECT_FACTORY_CID, false, NULL, nsDOMScriptObjectFactoryConstructor },
|
||||
@ -1184,10 +1167,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||
{ "@mozilla.org/xul/xul-template-builder;1", &kNS_XULTEMPLATEBUILDER_CID },
|
||||
{ "@mozilla.org/xul/xul-tree-builder;1", &kNS_XULTREEBUILDER_CID },
|
||||
{ "@mozilla.org/xul/xul-document;1", &kNS_XULDOCUMENT_CID },
|
||||
#endif
|
||||
#ifdef MOZ_XTF
|
||||
{ NS_XTFSERVICE_CONTRACTID, &kNS_XTFSERVICE_CID },
|
||||
{ NS_XMLCONTENTBUILDER_CONTRACTID, &kNS_XMLCONTENTBUILDER_CID },
|
||||
#endif
|
||||
{ CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID },
|
||||
{ NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID },
|
||||
|
@ -96,7 +96,6 @@
|
||||
@BINPATH@/components/content_htmldoc.xpt
|
||||
@BINPATH@/components/content_html.xpt
|
||||
@BINPATH@/components/content_xslt.xpt
|
||||
@BINPATH@/components/content_xtf.xpt
|
||||
@BINPATH@/components/cookie.xpt
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
|
@ -151,7 +151,6 @@
|
||||
@BINPATH@/components/content_htmldoc.xpt
|
||||
@BINPATH@/components/content_html.xpt
|
||||
@BINPATH@/components/content_xslt.xpt
|
||||
@BINPATH@/components/content_xtf.xpt
|
||||
@BINPATH@/components/cookie.xpt
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
|
@ -21,7 +21,6 @@
|
||||
[include:dom/system/gonk/tests/xpcshell.ini]
|
||||
[include:dom/tests/unit/xpcshell.ini]
|
||||
[include:dom/indexedDB/test/unit/xpcshell.ini]
|
||||
[include:content/xtf/test/unit/xpcshell.ini]
|
||||
[include:docshell/test/unit/xpcshell.ini]
|
||||
[include:docshell/test/unit_ipc/xpcshell.ini]
|
||||
[include:embedding/tests/unit/xpcshell.ini]
|
||||
|
@ -1078,11 +1078,6 @@ if [ "$ENABLE_TESTS" ]; then
|
||||
toolkit/components/url-classifier/tests/mochitest/Makefile
|
||||
"
|
||||
fi
|
||||
if [ "$MOZ_XTF" ]; then
|
||||
add_makefiles "
|
||||
content/xtf/test/Makefile
|
||||
"
|
||||
fi
|
||||
if [ "$MOZ_XUL" ]; then
|
||||
add_makefiles "
|
||||
content/xul/templates/tests/chrome/Makefile
|
||||
|
Loading…
Reference in New Issue
Block a user