Bug 1029104 - Convert XPathExpression to WebIDL bindings, move EvalContextImpl out of header. r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 09 Jul 2013 12:09:39 -0400
changeset 191345 28eaf76803b47c86bfd144c350a464c198f71e5c
parent 191344 a417be1fbee6e278a7185f08bdd6f46a39c0dcd0
child 191346 b7cf23c2be3e02e302e5c7938f7ddc3a46c6fe19
push id27041
push userphilringnalda@gmail.com
push dateSun, 29 Jun 2014 00:39:21 +0000
treeherdermozilla-central@afa67a2f7905 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1029104
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1029104 - Convert XPathExpression to WebIDL bindings, move EvalContextImpl out of header. r=bz.
dom/xslt/xpath/XPathEvaluator.cpp
dom/xslt/xpath/XPathExpression.cpp
dom/xslt/xpath/XPathExpression.h
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -15,16 +15,17 @@
 #include "txExprParser.h"
 #include "nsError.h"
 #include "txURIUtils.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsDOMString.h"
 #include "nsNameSpaceManager.h"
 #include "nsContentUtils.h"
+#include "txIXPathContext.h"
 #include "mozilla/dom/XPathEvaluatorBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 
 extern nsresult
 TX_ResolveFunctionCallXPCOM(const nsCString &aContractID, int32_t aNamespaceID,
                             nsIAtom *aName, nsISupports *aState,
                             FunctionCall **aFunction);
 
--- a/dom/xslt/xpath/XPathExpression.cpp
+++ b/dom/xslt/xpath/XPathExpression.cpp
@@ -2,31 +2,61 @@
 /* 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 "mozilla/Move.h"
 #include "XPathExpression.h"
 #include "txExpr.h"
 #include "txExprResult.h"
+#include "txIXPathContext.h"
 #include "nsError.h"
 #include "nsIDOMCharacterData.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIDOMDocument.h"
 #include "XPathResult.h"
 #include "txURIUtils.h"
 #include "txXPathTreeWalker.h"
 
 using mozilla::Move;
 
 DOMCI_DATA(XPathExpression, mozilla::dom::XPathExpression)
  
 namespace mozilla {
 namespace dom {
 
+class EvalContextImpl : public txIEvalContext
+{
+public:
+    EvalContextImpl(const txXPathNode& aContextNode,
+                    uint32_t aContextPosition, uint32_t aContextSize,
+                    txResultRecycler* aRecycler)
+        : mContextNode(aContextNode),
+          mContextPosition(aContextPosition),
+          mContextSize(aContextSize),
+          mLastError(NS_OK),
+          mRecycler(aRecycler)
+    {
+    }
+
+    nsresult getError()
+    {
+        return mLastError;
+    }
+
+    TX_DECL_EVAL_CONTEXT;
+
+private:
+    const txXPathNode& mContextNode;
+    uint32_t mContextPosition;
+    uint32_t mContextSize;
+    nsresult mLastError;
+    nsRefPtr<txResultRecycler> mRecycler;
+};
+
 NS_IMPL_CYCLE_COLLECTION(XPathExpression, mDocument)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(XPathExpression)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(XPathExpression)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XPathExpression)
   NS_INTERFACE_MAP_ENTRY(nsIDOMXPathExpression)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression)
@@ -152,63 +182,62 @@ XPathExpression::EvaluateWithContext(nsI
 }
 
 /*
  * Implementation of the txIEvalContext private to XPathExpression
  * EvalContextImpl bases on only one context node and no variables
  */
 
 nsresult
-XPathExpression::EvalContextImpl::getVariable(int32_t aNamespace,
-                                              nsIAtom* aLName,
-                                              txAExprResult*& aResult)
+EvalContextImpl::getVariable(int32_t aNamespace,
+                             nsIAtom* aLName,
+                             txAExprResult*& aResult)
 {
     aResult = 0;
     return NS_ERROR_INVALID_ARG;
 }
 
 bool
-XPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
+EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
 {
     return false;
 }
 
 void*
-XPathExpression::EvalContextImpl::getPrivateContext()
+EvalContextImpl::getPrivateContext()
 {
     // we don't have a private context here.
     return nullptr;
 }
 
 txResultRecycler*
-XPathExpression::EvalContextImpl::recycler()
+EvalContextImpl::recycler()
 {
     return mRecycler;
 }
 
 void
-XPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
-                                               nsresult aRes)
+EvalContextImpl::receiveError(const nsAString& aMsg, nsresult aRes)
 {
     mLastError = aRes;
     // forward aMsg to console service?
 }
 
 const txXPathNode&
-XPathExpression::EvalContextImpl::getContextNode()
+EvalContextImpl::getContextNode()
 {
     return mContextNode;
 }
 
 uint32_t
-XPathExpression::EvalContextImpl::size()
+EvalContextImpl::size()
 {
     return mContextSize;
 }
 
 uint32_t
-XPathExpression::EvalContextImpl::position()
+EvalContextImpl::position()
 {
     return mContextPosition;
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/xslt/xpath/XPathExpression.h
+++ b/dom/xslt/xpath/XPathExpression.h
@@ -3,17 +3,16 @@
  * 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 mozilla_dom_XPathExpression_h
 #define mozilla_dom_XPathExpression_h
 
 #include "nsIDOMXPathExpression.h"
 #include "nsIDOMNSXPathExpression.h"
-#include "txIXPathContext.h"
 #include "txResultRecycler.h"
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 
 class Expr;
 class txXPathNode;
 
@@ -42,43 +41,14 @@ public:
     NS_DECL_NSIDOMNSXPATHEXPRESSION
 
 private:
     ~nsXPathExpression() {}
 
     nsAutoPtr<Expr> mExpression;
     nsRefPtr<txResultRecycler> mRecycler;
     nsCOMPtr<nsIDOMDocument> mDocument;
-
-    class EvalContextImpl : public txIEvalContext
-    {
-    public:
-        EvalContextImpl(const txXPathNode& aContextNode,
-                        uint32_t aContextPosition, uint32_t aContextSize,
-                        txResultRecycler* aRecycler)
-            : mContextNode(aContextNode),
-              mContextPosition(aContextPosition),
-              mContextSize(aContextSize),
-              mLastError(NS_OK),
-              mRecycler(aRecycler)
-        {
-        }
-
-        nsresult getError()
-        {
-            return mLastError;
-        }
-
-        TX_DECL_EVAL_CONTEXT;
-
-    private:
-        const txXPathNode& mContextNode;
-        uint32_t mContextPosition;
-        uint32_t mContextSize;
-        nsresult mLastError;
-        nsRefPtr<txResultRecycler> mRecycler;
-    };
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif /* mozilla_dom_XPathExpression_h */