Bug 725998 - get rid of GetAccessibleOrContainer and GetContainerAccessible, r=surkov
authorJignesh Kakadiya <jigneshhk1992@gmail.com>
Sun, 12 Feb 2012 11:35:55 +0900
changeset 89558 777a20d9e7c92625e626ad0da3b5fd62415fc8eb
parent 89557 e47e25d0a6c1891cdf5db6da7c6001f8dac70b48
child 89559 6ac07d3e3a6193bf7c740c81c5d203d69f4b2083
push id783
push userlsblakk@mozilla.com
push dateTue, 24 Apr 2012 17:33:42 +0000
treeherdermozilla-beta@11faed19f136 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs725998
milestone13.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 725998 - get rid of GetAccessibleOrContainer and GetContainerAccessible, r=surkov
accessible/src/base/FocusManager.cpp
accessible/src/base/NotificationController.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/base/nsAccessible.cpp
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -282,21 +282,22 @@ FocusManager::ProcessFocusEvent(AccEvent
 
   EIsFromUserInput fromUserInputFlag = aEvent->IsFromUserInput() ?
     eFromUserInput : eNoUserInput;
 
   // Emit focus event if event target is the active item. Otherwise then check
   // if it's still focused and then update active item and emit focus event.
   nsAccessible* target = aEvent->GetAccessible();
   if (target != mActiveItem) {
+
     // Check if still focused. Otherwise we can end up with storing the active
     // item for control that isn't focused anymore.
-    nsAccessible* DOMFocus =
-      GetAccService()->GetAccessibleOrContainer(FocusedDOMNode(),
-	                                        aEvent->GetDocAccessible());
+    nsDocAccessible* document = aEvent->GetDocAccessible();
+    nsAccessible* DOMFocus = document->GetAccessibleOrContainer(FocusedDOMNode());
+
     if (target != DOMFocus)
       return;
 
     nsAccessible* activeItem = target->CurrentItem();
     if (activeItem) {
       mActiveItem = activeItem;
       target = activeItem;
     }
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -664,19 +664,18 @@ NotificationController::CoalesceTextChan
   }
 
   aTailEvent->mTextChangeEvent.swap(aThisEvent->mTextChangeEvent);
 }
 
 void
 NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
 {
-  nsAccessible* container =
-    GetAccService()->GetContainerAccessible(aEvent->mNode,
-                                            aEvent->GetDocAccessible());
+  nsDocAccessible* document = aEvent->GetDocAccessible();
+  nsAccessible* container = document->GetContainerAccessible(aEvent->mNode);
   if (!container)
     return;
 
   nsHyperTextAccessible* textAccessible = container->AsHyperText();
   if (!textAccessible)
     return;
 
   // Don't fire event for the first html:br in an editor.
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -914,27 +914,16 @@ nsAccessibilityService::GetAccessible(ns
 {
   NS_PRECONDITION(aNode, "Getting an accessible for null node! Crash.");
 
   // XXX handle the presshell
   nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
   return document ? document->GetAccessible(aNode) : nsnull;
 }
 
-nsAccessible*
-nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode, nsDocAccessible* aDoc)
-{
-  if (!aNode)
-    return nsnull;
-
-  NS_PRECONDITION(aDoc, "Must pass a document accessible.");
-
-  return aDoc ? aDoc->GetAccessibleOrContainer(aNode) : nsnull;
-}
-
 static bool HasRelatedContent(nsIContent *aContent)
 {
   nsAutoString id;
   if (!aContent || !nsCoreUtils::GetID(aContent, id) || id.IsEmpty()) {
     return false;
   }
 
   // If the given ID is referred by relation attribute then create an accessible
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -192,34 +192,16 @@ public:
                                       bool* aIsSubtreeHidden = nsnull);
 
   /**
    * Return an accessible for the given DOM node and eventually a presentation
    * shell.
    */
   nsAccessible* GetAccessible(nsINode* aNode, nsIPresShell* aPresShell);
 
-  /**
-   * Return an accessible for the given DOM node or container accessible if
-   * the node is not accessible.
-   *
-   * @param aNode [in] the given node
-   * @param aDoc  [in] the document accessible. Can't be null.
-   */
-  nsAccessible* GetAccessibleOrContainer(nsINode* aNode, nsDocAccessible* aDoc);
-
-  /**
-   * Return a container accessible for the given DOM node.
-   */
-  nsAccessible* GetContainerAccessible(nsINode* aNode, nsDocAccessible* aDoc)
-  {
-    return aNode ?
-      GetAccessibleOrContainer(aNode->GetNodeParent(), aDoc) : nsnull;
-  }
-
 private:
   // nsAccessibilityService creation is controlled by friend
   // NS_GetAccessibilityService, keep constructors private.
   nsAccessibilityService();
   nsAccessibilityService(const nsAccessibilityService&);
   nsAccessibilityService& operator =(const nsAccessibilityService&);
 
 private:
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -847,18 +847,17 @@ nsAccessible::ChildAtPoint(PRInt32 aX, P
   nsIFrame *foundFrame = presShell->GetFrameForPoint(frame, offset);
 
   nsIContent* content = nsnull;
   if (!foundFrame || !(content = foundFrame->GetContent()))
     return fallbackAnswer;
 
   // Get accessible for the node with the point or the first accessible in
   // the DOM parent chain.
-  nsAccessible* accessible =
-    GetAccService()->GetAccessibleOrContainer(content, accDocument);
+  nsAccessible* accessible = accDocument->GetAccessibleOrContainer(content);
   if (!accessible)
     return fallbackAnswer;
 
   if (accessible == this) {
     // Manually walk through accessible children and see if the are within this
     // point. Skip offscreen or invisible accessibles. This takes care of cases
     // where layout won't walk into things for us, such as image map areas and
     // sub documents (XXX: subdocuments should be handled by methods of