Bug 1438193 - part10: SetCurrentItem r=surkov
authorTokio Kajitsuka <kajitsuka-tokio@g.ecc.u-tokyo.ac.jp>
Sun, 13 May 2018 19:14:55 +0900
changeset 475117 9db73092a9f35af336ff9105e1c6dc948e1bac77
parent 475116 93e6b97c66f0d093f6edaa73dc3d53e4d30245b8
child 475118 b8a9fd5984ccfbca43d1a685f52274554d2f6278
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1438193
milestone62.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 1438193 - part10: SetCurrentItem r=surkov turn SetCurrentItem & GetChromeFlags & HasChildren into const functions
accessible/generic/Accessible.cpp
accessible/generic/Accessible.h
accessible/generic/RootAccessible.cpp
accessible/generic/RootAccessible.h
accessible/html/HTMLSelectAccessible.cpp
accessible/html/HTMLSelectAccessible.h
accessible/xul/XULMenuAccessible.cpp
accessible/xul/XULMenuAccessible.h
accessible/xul/XULSelectControlAccessible.cpp
accessible/xul/XULSelectControlAccessible.h
accessible/xul/XULTreeAccessible.cpp
accessible/xul/XULTreeAccessible.h
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2592,17 +2592,17 @@ Accessible::CurrentItem() const
       if (document)
         return document->GetAccessible(activeDescendantElm);
     }
   }
   return nullptr;
 }
 
 void
-Accessible::SetCurrentItem(Accessible* aItem)
+Accessible::SetCurrentItem(const Accessible* aItem)
 {
   nsAtom* id = aItem->GetContent()->GetID();
   if (id) {
     nsAutoString idStr;
     id->ToString(idStr);
     mContent->AsElement()->SetAttr(kNameSpaceID_None,
                                    nsGkAtoms::aria_activedescendant,
                                    idStr,
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -430,17 +430,17 @@ public:
   /**
    * Return index in parent accessible.
    */
   virtual int32_t IndexInParent() const;
 
   /**
    * Return true if accessible has children;
    */
-  bool HasChildren() { return !!GetChildAt(0); }
+  bool HasChildren() const { return !!GetChildAt(0); }
 
   /**
    * Return first/last/next/previous sibling of the accessible.
    */
   inline Accessible* NextSibling() const
     {  return GetSiblingAtOffset(1); }
   inline Accessible* PrevSibling() const
     { return GetSiblingAtOffset(-1); }
@@ -850,17 +850,17 @@ public:
    * Return the current item of the widget, i.e. an item that has or will have
    * keyboard focus when widget gets active.
    */
   virtual Accessible* CurrentItem() const;
 
   /**
    * Set the current item of the widget.
    */
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual void SetCurrentItem(const Accessible* aItem);
 
   /**
    * Return container widget this accessible belongs to.
    */
   virtual Accessible* ContainerWidget() const;
 
   /**
    * Return the localized string for the given key.
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -97,17 +97,17 @@ RootAccessible::NativeRole() const
     return roles::DIALOG;
 
   return DocAccessibleWrap::NativeRole();
 }
 
 // RootAccessible protected member
 #ifdef MOZ_XUL
 uint32_t
-RootAccessible::GetChromeFlags()
+RootAccessible::GetChromeFlags() const
 {
   // Return the flag set for the top level window as defined
   // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
   // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
   nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
   NS_ENSURE_TRUE(docShell, 0);
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
   docShell->GetTreeOwner(getter_AddRefs(treeOwner));
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -71,17 +71,17 @@ protected:
   void HandlePopupHidingEvent(nsINode* aNode);
 
 #ifdef MOZ_XUL
   void HandleTreeRowCountChangedEvent(dom::Event* aEvent,
                                       XULTreeAccessible* aAccessible);
   void HandleTreeInvalidatedEvent(dom::Event* aEvent,
                                   XULTreeAccessible* aAccessible);
 
-    uint32_t GetChromeFlags();
+    uint32_t GetChromeFlags() const;
 #endif
 };
 
 inline RootAccessible*
 Accessible::AsRoot()
 {
   return IsRoot() ? static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
 }
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -103,17 +103,17 @@ HTMLSelectListAccessible::CurrentItem() 
       if (document)
         return document->GetAccessible(activeOptionNode);
     }
   }
   return nullptr;
 }
 
 void
-HTMLSelectListAccessible::SetCurrentItem(Accessible* aItem)
+HTMLSelectListAccessible::SetCurrentItem(const Accessible* aItem)
 {
   if (!aItem->GetContent()->IsElement())
     return;
 
   aItem->GetContent()->AsElement()->SetAttr(kNameSpaceID_None,
                                             nsGkAtoms::selected,
                                             NS_LITERAL_STRING("true"),
                                             true);
@@ -501,17 +501,17 @@ HTMLComboboxAccessible::AreItemsOperable
 
 Accessible*
 HTMLComboboxAccessible::CurrentItem() const
 {
   return AreItemsOperable() ? mListAccessible->CurrentItem() : nullptr;
 }
 
 void
-HTMLComboboxAccessible::SetCurrentItem(Accessible* aItem)
+HTMLComboboxAccessible::SetCurrentItem(const Accessible* aItem)
 {
   if (AreItemsOperable())
     mListAccessible->SetCurrentItem(aItem);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxAccessible: protected
 
--- a/accessible/html/HTMLSelectAccessible.h
+++ b/accessible/html/HTMLSelectAccessible.h
@@ -45,17 +45,17 @@ public:
   virtual bool SelectAll() override;
   virtual bool UnselectAll() override;
 
   // Widgets
   virtual bool IsWidget() const override;
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* CurrentItem() const override;
-  virtual void SetCurrentItem(Accessible* aItem) override;
+  virtual void SetCurrentItem(const Accessible* aItem) override;
 };
 
 /*
  * Options inside the select, contained within the list
  */
 class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap
 {
 public:
@@ -176,17 +176,17 @@ public:
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
 
   // Widgets
   virtual bool IsWidget() const override;
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* CurrentItem() const override;
-  virtual void SetCurrentItem(Accessible* aItem) override;
+  virtual void SetCurrentItem(const Accessible* aItem) override;
 
 protected:
   /**
    * Return selected option.
    */
   Accessible* SelectedOption() const;
 
 private:
--- a/accessible/xul/XULMenuAccessible.cpp
+++ b/accessible/xul/XULMenuAccessible.cpp
@@ -582,12 +582,12 @@ XULMenubarAccessible::CurrentItem() cons
       nsIContent* menuItemNode = menuFrame->GetContent();
       return mDoc->GetAccessible(menuItemNode);
     }
   }
   return nullptr;
 }
 
 void
-XULMenubarAccessible::SetCurrentItem(Accessible* aItem)
+XULMenubarAccessible::SetCurrentItem(const Accessible* aItem)
 {
   NS_ERROR("XULMenubarAccessible::SetCurrentItem not implemented");
 }
--- a/accessible/xul/XULMenuAccessible.h
+++ b/accessible/xul/XULMenuAccessible.h
@@ -104,17 +104,17 @@ public:
 
   // Accessible
   virtual a11y::role NativeRole() const override;
 
   // Widget
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* CurrentItem() const override;
-  virtual void SetCurrentItem(Accessible* aItem) override;
+  virtual void SetCurrentItem(const Accessible* aItem) override;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) override;
 };
 
 } // namespace a11y
 } // namespace mozilla
--- a/accessible/xul/XULSelectControlAccessible.cpp
+++ b/accessible/xul/XULSelectControlAccessible.cpp
@@ -233,17 +233,17 @@ XULSelectControlAccessible::CurrentItem(
     if (document)
       return document->GetAccessible(DOMNode);
   }
 
   return nullptr;
 }
 
 void
-XULSelectControlAccessible::SetCurrentItem(Accessible* aItem)
+XULSelectControlAccessible::SetCurrentItem(const Accessible* aItem)
 {
   if (!mSelectControl)
     return;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
     do_QueryInterface(aItem->GetContent());
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
     do_QueryInterface(mSelectControl);
--- a/accessible/xul/XULSelectControlAccessible.h
+++ b/accessible/xul/XULSelectControlAccessible.h
@@ -32,17 +32,17 @@ public:
   virtual bool IsItemSelected(uint32_t aIndex) override;
   virtual bool AddItemToSelection(uint32_t aIndex) override;
   virtual bool RemoveItemFromSelection(uint32_t aIndex) override;
   virtual bool SelectAll() override;
   virtual bool UnselectAll() override;
 
   // Widgets
   virtual Accessible* CurrentItem() const override;
-  virtual void SetCurrentItem(Accessible* aItem) override;
+  virtual void SetCurrentItem(const Accessible* aItem) override;
 
 protected:
   // nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
   // one of these if the widget is valid and not defunct
   nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
 };
 
 } // namespace a11y
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -235,17 +235,17 @@ XULTreeAccessible::CurrentItem() const
     if (currentIndex >= 0)
       return GetTreeItemAccessible(currentIndex);
   }
 
   return nullptr;
 }
 
 void
-XULTreeAccessible::SetCurrentItem(Accessible* aItem)
+XULTreeAccessible::SetCurrentItem(const Accessible* aItem)
 {
   NS_ERROR("XULTreeAccessible::SetCurrentItem not implemented");
 }
 
 void
 XULTreeAccessible::SelectedItems(nsTArray<Accessible*>* aItems)
 {
   if (!mTreeView)
--- a/accessible/xul/XULTreeAccessible.h
+++ b/accessible/xul/XULTreeAccessible.h
@@ -60,17 +60,17 @@ public:
   virtual bool SelectAll() override;
   virtual bool UnselectAll() override;
 
   // Widgets
   virtual bool IsWidget() const override;
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* CurrentItem() const override;
-  virtual void SetCurrentItem(Accessible* aItem) override;
+  virtual void SetCurrentItem(const Accessible* aItem) override;
 
   virtual Accessible* ContainerWidget() const override;
 
   // XULTreeAccessible
 
   /**
    * Return tree item accessible at the givem row. If accessible doesn't exist
    * in the cache then create and cache it.