Bug 1447889 part 2. Remove the XPCOM goop for creating Selection. r=mystor

It's unused; we never create these things by contract or classid.

MozReview-Commit-ID: 3Jsyb6QHlJt
This commit is contained in:
Boris Zbarsky 2018-03-27 00:35:20 -04:00
Родитель 0245595d7e
Коммит 5abddeaf58
5 изменённых файлов: 3 добавлений и 28 удалений

Просмотреть файл

@ -261,14 +261,6 @@ private:
NS_IMPL_ISUPPORTS(nsAutoScrollTimer, nsITimerCallback, nsINamed)
nsresult NS_NewDomSelection(nsISelection **aDomSelection)
{
Selection* rlist = new Selection;
*aDomSelection = (nsISelection *)rlist;
NS_ADDREF(rlist);
return NS_OK;
}
/*
The limiter is used specifically for the text areas and textfields
In that case it is the DIV tag that is anonymously created for the text

Просмотреть файл

@ -69,8 +69,6 @@
using namespace mozilla;
using namespace mozilla::dom;
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
@ -333,16 +331,14 @@ nsCopySupport::GetTransferableForNode(nsINode* aNode,
nsIDocument* aDoc,
nsITransferable** aTransferable)
{
nsCOMPtr<nsISelection> selection;
// Make a temporary selection with aNode in a single range.
// XXX We should try to get rid of the Selection object here.
// XXX bug 1245883
nsresult rv = NS_NewDomSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISelection> selection = new Selection();
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
RefPtr<nsRange> range = new nsRange(aNode);
rv = range->SelectNode(node);
nsresult rv = range->SelectNode(node);
NS_ENSURE_SUCCESS(rv, rv);
ErrorResult result;
selection->AsSelection()->AddRangeInternal(*range, aDoc, result);

Просмотреть файл

@ -53,8 +53,6 @@
using namespace mozilla;
using namespace mozilla::dom;
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
enum nsRangeIterationDirection {
kDirectionOut = -1,
kDirectionIn = 1
@ -1345,8 +1343,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
// there's no Clone() for selection! fix...
//nsresult rv = aSelection->Clone(getter_AddRefs(mSelection);
//NS_ENSURE_SUCCESS(rv, rv);
NS_NewDomSelection(getter_AddRefs(mSelection));
NS_ENSURE_TRUE(mSelection, NS_ERROR_FAILURE);
mSelection = new Selection();
// loop thru the ranges in the selection
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {

Просмотреть файл

@ -15,10 +15,6 @@
#define NS_LAYOUT_DEBUGGER_CID \
{ 0xa6cf90f9, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_DOMSELECTION_CID \
{/* {C87A37FC-8109-4ce2-A322-8CDEC925379F}*/ \
0xc87a37fc, 0x8109, 0x4ce2, { 0xa3, 0x22, 0x8c, 0xde, 0xc9, 0x25, 0x37, 0x9f } }
// {D750A964-2D14-484c-B3AA-8ED7823B5C7B}
#define NS_BOXOBJECT_CID \
{ 0xd750a964, 0x2d14, 0x484c, { 0xb3, 0xaa, 0x8e, 0xd7, 0x82, 0x3b, 0x5c, 0x7b } }

Просмотреть файл

@ -34,7 +34,6 @@
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIScriptError.h"
#include "nsISelection.h"
#include "nsCaret.h"
#include "nsPlainTextSerializer.h"
#include "nsXMLContentSerializer.h"
@ -328,7 +327,6 @@ nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
nsresult NS_NewDomSelection(nsISelection** aResult);
already_AddRefed<nsIContentViewer> NS_NewContentViewer();
nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
@ -401,7 +399,6 @@ MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTM
MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
MAKE_CTOR2(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
MAKE_CTOR2(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
MAKE_CTOR2(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
@ -547,7 +544,6 @@ NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
@ -796,7 +792,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_XMLDOCUMENT_CID, false, nullptr, CreateXMLDocument },
{ &kNS_SVGDOCUMENT_CID, false, nullptr, CreateSVGDocument },
{ &kNS_IMAGEDOCUMENT_CID, false, nullptr, CreateImageDocument },
{ &kNS_DOMSELECTION_CID, false, nullptr, CreateDOMSelection },
{ &kNS_CONTENTITERATOR_CID, false, nullptr, CreateContentIterator },
{ &kNS_PRECONTENTITERATOR_CID, false, nullptr, CreatePreContentIterator },
{ &kNS_SUBTREEITERATOR_CID, false, nullptr, CreateSubtreeIterator },
@ -908,7 +903,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
{ "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
{ "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
{ "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
{ "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
{ "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
{ "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },