mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1460940 - Remove nsIDOMDocument uses in toolkit/. r=bz
MozReview-Commit-ID: LJhw1bKsUkn --HG-- extra : rebase_source : bb6f877f75ced11f33ae37d7d2e430e54d82517c
This commit is contained in:
parent
3a8ef6cf8a
commit
3309929466
@ -306,8 +306,7 @@ ExtensionPolicyService::CheckDocument(nsIDocument* aDocument)
|
||||
|
||||
RefPtr<WebExtensionPolicy> policy = BasePrincipal::Cast(principal)->AddonPolicy();
|
||||
if (policy) {
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aDocument);
|
||||
ProcessScript().InitExtensionDocument(policy, doc);
|
||||
ProcessScript().InitExtensionDocument(policy, aDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface mozIDOMWindowProxy;
|
||||
interface nsIDOMDocument;
|
||||
webidl Document;
|
||||
|
||||
[scriptable,uuid(6b09dc51-6caa-4ca7-9d6d-30c87258a630)]
|
||||
interface mozIExtensionProcessScript : nsISupports
|
||||
@ -14,5 +14,5 @@ interface mozIExtensionProcessScript : nsISupports
|
||||
|
||||
void loadContentScript(in nsISupports contentScript, in mozIDOMWindowProxy window);
|
||||
|
||||
void initExtensionDocument(in nsISupports extension, in nsIDOMDocument doc);
|
||||
void initExtensionDocument(in nsISupports extension, in Document doc);
|
||||
};
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
@ -424,23 +423,21 @@ nsWebBrowserFind::SetSelectionAndScroll(nsPIDOMWindowOuter* aWindow,
|
||||
|
||||
// Adapted from TextServicesDocument::GetDocumentContentRootNode
|
||||
nsresult
|
||||
nsWebBrowserFind::GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode)
|
||||
nsWebBrowserFind::GetRootNode(nsIDocument* aDoc, nsIDOMNode** aNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDoc);
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
*aNode = 0;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDomDoc);
|
||||
NS_ENSURE_ARG_POINTER(doc);
|
||||
|
||||
if (doc->IsHTMLOrXHTML()) {
|
||||
Element* body = doc->GetBody();
|
||||
if (aDoc->IsHTMLOrXHTML()) {
|
||||
Element* body = aDoc->GetBody();
|
||||
NS_ENSURE_ARG_POINTER(body);
|
||||
NS_ADDREF(*aNode = body->AsDOMNode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// For non-HTML documents, the content root node will be the doc element.
|
||||
Element* root = doc->GetDocumentElement();
|
||||
Element* root = aDoc->GetDocumentElement();
|
||||
NS_ENSURE_ARG_POINTER(root);
|
||||
NS_ADDREF(*aNode = root->AsDOMNode());
|
||||
return NS_OK;
|
||||
@ -450,7 +447,7 @@ nsresult
|
||||
nsWebBrowserFind::SetRangeAroundDocument(nsRange* aSearchRange,
|
||||
nsRange* aStartPt,
|
||||
nsRange* aEndPt,
|
||||
nsIDOMDocument* aDoc)
|
||||
nsIDocument* aDoc)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> bodyNode;
|
||||
nsresult rv = GetRootNode(aDoc, getter_AddRefs(bodyNode));
|
||||
@ -484,7 +481,7 @@ nsWebBrowserFind::SetRangeAroundDocument(nsRange* aSearchRange,
|
||||
nsresult
|
||||
nsWebBrowserFind::GetSearchLimits(nsRange* aSearchRange,
|
||||
nsRange* aStartPt, nsRange* aEndPt,
|
||||
nsIDOMDocument* aDoc, Selection* aSel,
|
||||
nsIDocument* aDoc, Selection* aSel,
|
||||
bool aWrap)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSel);
|
||||
@ -727,17 +724,14 @@ nsWebBrowserFind::SearchInFrame(nsPIDOMWindowOuter* aWindow, bool aWrapping,
|
||||
|
||||
nsCOMPtr<nsIDOMRange> foundRange;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(theDoc);
|
||||
MOZ_ASSERT(domDoc);
|
||||
|
||||
// If !aWrapping, search from selection to end
|
||||
if (!aWrapping)
|
||||
rv = GetSearchLimits(searchRange, startPt, endPt, domDoc, sel, false);
|
||||
rv = GetSearchLimits(searchRange, startPt, endPt, theDoc, sel, false);
|
||||
|
||||
// If aWrapping, search the part of the starting frame
|
||||
// up to the point where we left off.
|
||||
else
|
||||
rv = GetSearchLimits(searchRange, startPt, endPt, domDoc, sel, true);
|
||||
rv = GetSearchLimits(searchRange, startPt, endPt, theDoc, sel, true);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
class nsIDOMWindow;
|
||||
|
||||
class nsIDocShell;
|
||||
class nsIDocument;
|
||||
class nsRange;
|
||||
|
||||
namespace mozilla {
|
||||
@ -71,15 +72,15 @@ protected:
|
||||
|
||||
void SetSelectionAndScroll(nsPIDOMWindowOuter* aWindow, nsRange* aRange);
|
||||
|
||||
nsresult GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode);
|
||||
nsresult GetRootNode(nsIDocument* aDomDoc, nsIDOMNode** aNode);
|
||||
nsresult GetSearchLimits(nsRange* aRange,
|
||||
nsRange* aStartPt, nsRange* aEndPt,
|
||||
nsIDOMDocument* aDoc, mozilla::dom::Selection* aSel,
|
||||
nsIDocument* aDoc, mozilla::dom::Selection* aSel,
|
||||
bool aWrap);
|
||||
nsresult SetRangeAroundDocument(nsRange* aSearchRange,
|
||||
nsRange* aStartPoint,
|
||||
nsRange* aEndPoint,
|
||||
nsIDOMDocument* aDoc);
|
||||
nsIDocument* aDoc);
|
||||
|
||||
protected:
|
||||
nsString mSearchString;
|
||||
|
Loading…
Reference in New Issue
Block a user