diff --git a/dom/base/nsContentCID.h b/dom/base/nsContentCID.h index 0878058ed1a4..7336f8bdfd60 100644 --- a/dom/base/nsContentCID.h +++ b/dom/base/nsContentCID.h @@ -113,11 +113,6 @@ #define NS_XULCONTROLLERS_CID \ { 0x1f5c1721, 0x7dc3, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } } - -// {BFD05264-834C-11d2-8EAC-00805F29F371} -#define NS_XULSORTSERVICE_CID \ -{ 0xbfd05264, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x71 } } - // {3D262D00-8B5A-11d2-8EB0-00805F29F370} #define NS_XULTEMPLATEBUILDER_CID \ { 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } diff --git a/dom/xul/moz.build b/dom/xul/moz.build index c01839113caf..47e5b310c035 100644 --- a/dom/xul/moz.build +++ b/dom/xul/moz.build @@ -18,6 +18,7 @@ if CONFIG['MOZ_XUL']: EXPORTS += [ 'nsXULCommandDispatcher.h', 'nsXULElement.h', + 'nsXULSortService.h', ] EXPORTS.mozilla.dom += [ diff --git a/dom/xul/nsXULSortService.cpp b/dom/xul/nsXULSortService.cpp index 41e5f9793e5d..09c7d6e94e04 100644 --- a/dom/xul/nsXULSortService.cpp +++ b/dom/xul/nsXULSortService.cpp @@ -353,11 +353,3 @@ XULSortServiceImpl::Sort(Element* aNode, return rv; } - -nsresult -NS_NewXULSortService(nsIXULSortService** sortService) -{ - *sortService = new XULSortServiceImpl(); - NS_ADDREF(*sortService); - return NS_OK; -} diff --git a/dom/xul/nsXULSortService.h b/dom/xul/nsXULSortService.h index 543f51a7ed9b..1e905e97e433 100644 --- a/dom/xul/nsXULSortService.h +++ b/dom/xul/nsXULSortService.h @@ -67,14 +67,12 @@ struct contentSortInfo { // class XULSortServiceImpl : public nsIXULSortService { -protected: +public: XULSortServiceImpl(void) {} + +protected: virtual ~XULSortServiceImpl(void) {} - friend nsresult NS_NewXULSortService(nsIXULSortService** mgr); - -private: - public: // nsISupports NS_DECL_ISUPPORTS diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 31e501831978..b53df3bf5701 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -116,7 +116,6 @@ class nsIDocumentLoaderFactory; #ifdef MOZ_XUL #include "XULDocument.h" -#include "nsIXULSortService.h" #endif static void Shutdown(); @@ -341,7 +340,6 @@ MAKE_CTOR(CreateXHTMLContentSerializer, nsIContentSerializer, NS_NewXHT MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer) MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy) #ifdef MOZ_XUL -MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService) MAKE_CTOR(CreateXULDocument, nsIDocument, NS_NewXULDocument) // NS_NewXULControllers #endif @@ -467,7 +465,6 @@ NS_DEFINE_NAMED_CID(NS_DATADOCUMENTCONTENTPOLICY_CID); NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCONTENTPOLICY_CID); NS_DEFINE_NAMED_CID(NS_XULCONTROLLERS_CID); #ifdef MOZ_XUL -NS_DEFINE_NAMED_CID(NS_XULSORTSERVICE_CID); NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID); #endif NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); @@ -562,7 +559,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kNS_NODATAPROTOCOLCONTENTPOLICY_CID, false, nullptr, nsNoDataProtocolContentPolicyConstructor }, { &kNS_XULCONTROLLERS_CID, false, nullptr, NS_NewXULControllers }, #ifdef MOZ_XUL - { &kNS_XULSORTSERVICE_CID, false, nullptr, CreateXULSortService }, { &kNS_XULDOCUMENT_CID, false, nullptr, CreateXULDocument }, #endif { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF }, @@ -654,9 +650,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, &kNS_DATADOCUMENTCONTENTPOLICY_CID }, { NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, &kNS_NODATAPROTOCOLCONTENTPOLICY_CID }, { "@mozilla.org/xul/xul-controllers;1", &kNS_XULCONTROLLERS_CID }, -#ifdef MOZ_XUL - { "@mozilla.org/xul/xul-sort-service;1", &kNS_XULSORTSERVICE_CID }, -#endif { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID }, { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID }, { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID }, diff --git a/layout/xul/tree/nsTreeContentView.cpp b/layout/xul/tree/nsTreeContentView.cpp index fec3f886e304..fc3a763c2ea8 100644 --- a/layout/xul/tree/nsTreeContentView.cpp +++ b/layout/xul/tree/nsTreeContentView.cpp @@ -11,7 +11,7 @@ #include "nsTreeContentView.h" #include "ChildIterator.h" #include "nsError.h" -#include "nsIXULSortService.h" +#include "nsXULSortService.h" #include "nsTreeBodyFrame.h" #include "nsTreeColumns.h" #include "mozilla/ErrorResult.h" @@ -660,26 +660,24 @@ nsTreeContentView::CycleHeader(nsTreeColumn& aColumn, ErrorResult& aError) nsAutoString sort; column->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, sort); if (!sort.IsEmpty()) { - nsCOMPtr xs = do_GetService("@mozilla.org/xul/xul-sort-service;1"); - if (xs) { - nsAutoString sortdirection; - static Element::AttrValuesArray strings[] = - {&nsGkAtoms::ascending, &nsGkAtoms::descending, nullptr}; - switch (column->FindAttrValueIn(kNameSpaceID_None, - nsGkAtoms::sortDirection, - strings, eCaseMatters)) { - case 0: sortdirection.AssignLiteral("descending"); break; - case 1: sortdirection.AssignLiteral("natural"); break; - default: sortdirection.AssignLiteral("ascending"); break; - } - - nsAutoString hints; - column->GetAttr(kNameSpaceID_None, nsGkAtoms::sorthints, hints); - sortdirection.Append(' '); - sortdirection += hints; - - xs->Sort(mRoot, sort, sortdirection); + nsCOMPtr xs = new XULSortServiceImpl(); + nsAutoString sortdirection; + static Element::AttrValuesArray strings[] = + {&nsGkAtoms::ascending, &nsGkAtoms::descending, nullptr}; + switch (column->FindAttrValueIn(kNameSpaceID_None, + nsGkAtoms::sortDirection, + strings, eCaseMatters)) { + case 0: sortdirection.AssignLiteral("descending"); break; + case 1: sortdirection.AssignLiteral("natural"); break; + default: sortdirection.AssignLiteral("ascending"); break; } + + nsAutoString hints; + column->GetAttr(kNameSpaceID_None, nsGkAtoms::sorthints, hints); + sortdirection.Append(' '); + sortdirection += hints; + + xs->Sort(mRoot, sort, sortdirection); } }