Bug 739130 - make GetDocumentNode() inline on nsDocAccessible, r=tbsaunde, surkov
authorMichał Frontczak <michaljev@o2.pl>
Fri, 12 Oct 2012 11:25:34 +0900
changeset 110172 645c3f9045fc68690a7c776a47a7ccb801865a64
parent 110171 cb6023c5b636ec5ef7b4db280a49be6f73dbd762
child 110173 6db2ba78beb85df414f8c85e2b04709882a1ad5f
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerstbsaunde, surkov
bugs739130
milestone19.0a1
Bug 739130 - make GetDocumentNode() inline on nsDocAccessible, r=tbsaunde, surkov
accessible/src/base/Logging.cpp
accessible/src/base/NotificationController.cpp
accessible/src/base/nsAccessNode.cpp
accessible/src/base/nsAccessNode.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/generic/DocAccessible.h
accessible/src/generic/HyperTextAccessible.cpp
accessible/src/generic/OuterDocAccessible.cpp
accessible/src/msaa/AccessibleWrap.cpp
accessible/src/msaa/RootAccessibleWrap.cpp
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -425,21 +425,21 @@ logging::DocLoad(const char* aMsg, nsIDo
 }
 
 void
 logging::DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget)
 {
   MsgBegin(sDocLoadTitle, "document loaded *completely*");
 
   printf("    DOM document: %p, acc document: %p\n",
-         static_cast<void*>(aDocument->GetDocumentNode()),
+         static_cast<void*>(aDocument->DocumentNode()),
          static_cast<void*>(aDocument));
 
   printf("    ");
-  LogDocURI(aDocument->GetDocumentNode());
+  LogDocURI(aDocument->DocumentNode());
   printf("\n");
 
   printf("    ");
   LogDocAccState(aDocument);
   printf("\n");
 
   printf("    document is load event target: %s\n",
          (aIsLoadEventTarget ? "true" : "false"));
@@ -655,17 +655,17 @@ void
 logging::Address(const char* aDescr, Accessible* aAcc)
 {
   if (!aAcc->IsDoc()) {
     printf("    %s accessible: %p, node: %p\n", aDescr,
            static_cast<void*>(aAcc), static_cast<void*>(aAcc->GetNode()));
   }
 
   DocAccessible* doc = aAcc->Document();
-  nsIDocument* docNode = aAcc->GetDocumentNode();
+  nsIDocument* docNode = doc->DocumentNode();
   printf("    document: %p, node: %p\n",
          static_cast<void*>(doc), static_cast<void*>(docNode));
 
   printf("    ");
   LogDocURI(docNode);
   printf("\n");
 }
 
@@ -713,20 +713,20 @@ logging::Node(const char* aDescr, nsINod
          aDescr, static_cast<void*>(elm), tag.get(), id.get(), idxInParent);
 }
 
 void
 logging::Document(DocAccessible* aDocument)
 {
   printf("    Document: %p, document node: %p\n",
          static_cast<void*>(aDocument),
-         static_cast<void*>(aDocument->GetDocumentNode()));
+         static_cast<void*>(aDocument->DocumentNode()));
 
   printf("    Document ");
-  LogDocURI(aDocument->GetDocumentNode());
+  LogDocURI(aDocument->DocumentNode());
   printf("\n");
 }
 
 void
 logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible)
 {
   printf("    %s: %p; ", aDescr, static_cast<void*>(aAccessible));
   if (!aAccessible)
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -238,18 +238,18 @@ NotificationController::WillRefresh(mozi
 
   // Bind hanging child documents.
   uint32_t hangingDocCnt = mHangingChildDocuments.Length();
   for (uint32_t idx = 0; idx < hangingDocCnt; idx++) {
     DocAccessible* childDoc = mHangingChildDocuments[idx];
     if (childDoc->IsDefunct())
       continue;
 
-    nsIContent* ownerContent = mDocument->GetDocumentNode()->
-      FindContentForSubDocument(childDoc->GetDocumentNode());
+    nsIContent* ownerContent = mDocument->DocumentNode()->
+      FindContentForSubDocument(childDoc->DocumentNode());
     if (ownerContent) {
       Accessible* outerDocAcc = mDocument->GetAccessible(ownerContent);
       if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) {
         if (mDocument->AppendChildDocument(childDoc))
           continue;
 
         outerDocAcc->RemoveChild(childDoc);
       }
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -106,22 +106,16 @@ nsAccessNode::GetFrame() const
 }
 
 nsINode*
 nsAccessNode::GetNode() const
 {
   return mContent;
 }
 
-nsIDocument*
-nsAccessNode::GetDocumentNode() const
-{
-  return mContent ? mContent->OwnerDoc() : nullptr;
-}
-
 void
 nsAccessNode::Language(nsAString& aLanguage)
 {
   aLanguage.Truncate();
 
   if (!mDoc)
     return;
 
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -59,17 +59,16 @@ public:
    * Return frame for the given access node object.
    */
   virtual nsIFrame* GetFrame() const;
   /**
    * Return DOM node associated with the accessible.
    */
   virtual nsINode* GetNode() const;
   nsIContent* GetContent() const { return mContent; }
-  virtual nsIDocument* GetDocumentNode() const;
 
   /**
    * Return node type information of DOM node associated with the accessible.
    */
   bool IsContent() const
   {
     return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT);
   }
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -891,17 +891,17 @@ nsAccessibilityService::GetOrCreateAcces
   }
 
   // We have a content node.
   if (!aNode->IsInDoc()) {
     NS_WARNING("Creating accessible for node with no document");
     return nullptr;
   }
 
-  if (aNode->OwnerDoc() != aDoc->GetDocumentNode()) {
+  if (aNode->OwnerDoc() != aDoc->DocumentNode()) {
     NS_ERROR("Creating accessible for wrong document");
     return nullptr;
   }
 
   if (!aNode->IsContent())
     return nullptr;
 
   nsIContent* content = aNode->AsContent();
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -78,17 +78,17 @@ public:
   // nsIDocumentObserver
   NS_DECL_NSIDOCUMENTOBSERVER
 
   // nsAccessNode
   virtual void Init();
   virtual void Shutdown();
   virtual nsIFrame* GetFrame() const;
   virtual nsINode* GetNode() const { return mDocument; }
-  virtual nsIDocument* GetDocumentNode() const { return mDocument; }
+  nsIDocument* DocumentNode() const { return mDocument; }
 
   // Accessible
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual void Description(nsString& aDescription);
   virtual Accessible* FocusedChild();
   virtual mozilla::a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual uint64_t NativeInteractiveState() const;
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -1480,17 +1480,17 @@ HyperTextAccessible::GetEditor() const
 
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mContent);
   nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
   if (!editingSession)
     return nullptr; // No editing session interface
 
   nsCOMPtr<nsIEditor> editor;
-  nsIDocument* docNode = mDoc->GetDocumentNode();
+  nsIDocument* docNode = mDoc->DocumentNode();
   editingSession->GetEditorForWindow(docNode->GetWindow(),
                                      getter_AddRefs(editor));
   return editor.forget();
 }
 
 /**
   * =================== Caret & Selection ======================
   */
@@ -1526,17 +1526,17 @@ HyperTextAccessible::SetSelectionRange(i
   // not focusable. That happens when selection is set within hypertext
   // accessible.
   if (isFocusable)
     return NS_OK;
 
   nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
   if (DOMFocusManager) {
     NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE);
-    nsIDocument* docNode = mDoc->GetDocumentNode();
+    nsIDocument* docNode = mDoc->DocumentNode();
     NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE);
     nsCOMPtr<nsPIDOMWindow> window = docNode->GetWindow();
     nsCOMPtr<nsIDOMElement> result;
     DOMFocusManager->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
                                nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
   }
 
   return NS_OK;
--- a/accessible/src/generic/OuterDocAccessible.cpp
+++ b/accessible/src/generic/OuterDocAccessible.cpp
@@ -128,17 +128,17 @@ OuterDocAccessible::Shutdown()
     logging::OuterDocDestroy(this);
 #endif
 
   Accessible* childAcc = mChildren.SafeElementAt(0, nullptr);
   if (childAcc) {
 #ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocDestroy)) {
       logging::DocDestroy("outerdoc's child document shutdown",
-                          childAcc->GetDocumentNode());
+                          childAcc->AsDoc()->DocumentNode());
     }
 #endif
     childAcc->Shutdown();
   }
 
   AccessibleWrap::Shutdown();
 }
 
@@ -172,17 +172,17 @@ OuterDocAccessible::AppendChild(Accessib
     mChildren[0]->Shutdown();
 
   if (!AccessibleWrap::AppendChild(aAccessible))
     return false;
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate)) {
     logging::DocCreate("append document to outerdoc",
-                       aAccessible->GetDocumentNode());
+                       aAccessible->AsDoc()->DocumentNode());
     logging::Address("outerdoc", this);
   }
 #endif
 
   return true;
 }
 
 bool
@@ -191,18 +191,18 @@ OuterDocAccessible::RemoveChild(Accessib
   Accessible* child = mChildren.SafeElementAt(0, nullptr);
   if (child != aAccessible) {
     NS_ERROR("Wrong child to remove!");
     return false;
   }
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocDestroy)) {
-    logging::DocDestroy("remove document from outerdoc", child->GetDocumentNode(),
-                        child->AsDoc());
+    logging::DocDestroy("remove document from outerdoc",
+                        child->AsDoc()->DocumentNode(), child->AsDoc());
     logging::Address("outerdoc", this);
   }
 #endif
 
   bool wasRemoved = AccessibleWrap::RemoveChild(child);
 
   NS_ASSERTION(!mChildren.Length(),
                "This child document of outerdoc accessible wasn't removed!");
--- a/accessible/src/msaa/AccessibleWrap.cpp
+++ b/accessible/src/msaa/AccessibleWrap.cpp
@@ -161,17 +161,17 @@ AccessibleWrap::get_accParent( IDispatch
     return CO_E_OBJNOTCONNECTED;
 
   DocAccessible* doc = AsDoc();
   if (doc) {
     // Return window system accessible object for root document and tab document
     // accessibles.
     if (!doc->ParentDocument() ||
         nsWinUtils::IsWindowEmulationStarted() &&
-        nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) {
+        nsCoreUtils::IsTabDocument(doc->DocumentNode())) {
       HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
       if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
                                                          IID_IAccessible,
                                                          (void**)ppdispParent))) {
         return S_OK;
       }
     }
   }
--- a/accessible/src/msaa/RootAccessibleWrap.cpp
+++ b/accessible/src/msaa/RootAccessibleWrap.cpp
@@ -30,17 +30,17 @@ RootAccessibleWrap::~RootAccessibleWrap(
 
 ////////////////////////////////////////////////////////////////////////////////
 // RootAccessible
 
 void
 RootAccessibleWrap::DocumentActivated(DocAccessible* aDocument)
 {
   if (Compatibility::IsDolphin() &&
-      nsCoreUtils::IsTabDocument(aDocument->GetDocumentNode())) {
+      nsCoreUtils::IsTabDocument(aDocument->DocumentNode())) {
     uint32_t count = mChildDocuments.Length();
     for (uint32_t idx = 0; idx < count; idx++) {
       DocAccessible* childDoc = mChildDocuments[idx];
       HWND childDocHWND = static_cast<HWND>(childDoc->GetNativeWindow());
       if (childDoc != aDocument)
         nsWinUtils::HideNativeWindow(childDocHWND);
       else
         nsWinUtils::ShowNativeWindow(childDocHWND);