Bug 1438193 - part9: CurrentItem r=surkov
authorTokio Kajitsuka <kajitsuka-tokio@g.ecc.u-tokyo.ac.jp>
Sun, 13 May 2018 18:26:02 +0900
changeset 418392 93e6b97c66f0d093f6edaa73dc3d53e4d30245b8
parent 418391 14179696a4ef2647be0c9fe78f767f81f8fb276c
child 418393 9db73092a9f35af336ff9105e1c6dc948e1bac77
push id33999
push userdluca@mozilla.com
push dateTue, 15 May 2018 21:54:51 +0000
treeherdermozilla-central@380cf87c1ee3 [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 - part9: CurrentItem r=surkov turn Accessible::CurrentItem into const functions
accessible/generic/Accessible.cpp
accessible/generic/Accessible.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
@@ -2569,17 +2569,17 @@ bool
 Accessible::AreItemsOperable() const
 {
   return HasOwnContent() &&
     mContent->IsElement() &&
     mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant);
 }
 
 Accessible*
-Accessible::CurrentItem()
+Accessible::CurrentItem() const
 {
   // Check for aria-activedescendant, which changes which element has focus.
   // For activedescendant, the ARIA spec does not require that the user agent
   // checks whether pointed node is actually a DOM descendant of the element
   // with the aria-activedescendant attribute.
   nsAutoString id;
   if (HasOwnContent() &&
       mContent->IsElement() &&
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -845,17 +845,17 @@ public:
    * can be activated.
    */
   virtual bool AreItemsOperable() const;
 
   /**
    * 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();
+  virtual Accessible* CurrentItem() const;
 
   /**
    * Set the current item of the widget.
    */
   virtual void SetCurrentItem(Accessible* aItem);
 
   /**
    * Return container widget this accessible belongs to.
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -88,17 +88,17 @@ HTMLSelectListAccessible::IsActiveWidget
 
 bool
 HTMLSelectListAccessible::AreItemsOperable() const
 {
   return true;
 }
 
 Accessible*
-HTMLSelectListAccessible::CurrentItem()
+HTMLSelectListAccessible::CurrentItem() const
 {
   nsIListControlFrame* listControlFrame = do_QueryFrame(GetFrame());
   if (listControlFrame) {
     nsCOMPtr<nsIContent> activeOptionNode = listControlFrame->GetCurrentOption();
     if (activeOptionNode) {
       DocAccessible* document = Document();
       if (document)
         return document->GetAccessible(activeOptionNode);
@@ -495,17 +495,17 @@ HTMLComboboxAccessible::IsActiveWidget()
 bool
 HTMLComboboxAccessible::AreItemsOperable() const
 {
   nsIComboboxControlFrame* comboboxFrame = do_QueryFrame(GetFrame());
   return comboboxFrame && comboboxFrame->IsDroppedDown();
 }
 
 Accessible*
-HTMLComboboxAccessible::CurrentItem()
+HTMLComboboxAccessible::CurrentItem() const
 {
   return AreItemsOperable() ? mListAccessible->CurrentItem() : nullptr;
 }
 
 void
 HTMLComboboxAccessible::SetCurrentItem(Accessible* aItem)
 {
   if (AreItemsOperable())
--- a/accessible/html/HTMLSelectAccessible.h
+++ b/accessible/html/HTMLSelectAccessible.h
@@ -44,17 +44,17 @@ public:
   // SelectAccessible
   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() override;
+  virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(Accessible* aItem) override;
 };
 
 /*
  * Options inside the select, contained within the list
  */
 class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap
 {
@@ -175,17 +175,17 @@ public:
   virtual uint8_t ActionCount() override;
   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() override;
+  virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(Accessible* aItem) override;
 
 protected:
   /**
    * Return selected option.
    */
   Accessible* SelectedOption() const;
 
--- a/accessible/xul/XULMenuAccessible.cpp
+++ b/accessible/xul/XULMenuAccessible.cpp
@@ -568,17 +568,17 @@ XULMenubarAccessible::IsActiveWidget() c
 
 bool
 XULMenubarAccessible::AreItemsOperable() const
 {
   return true;
 }
 
 Accessible*
-XULMenubarAccessible::CurrentItem()
+XULMenubarAccessible::CurrentItem() const
 {
   nsMenuBarFrame* menuBarFrame = do_QueryFrame(GetFrame());
   if (menuBarFrame) {
     nsMenuFrame* menuFrame = menuBarFrame->GetCurrentMenuItem();
     if (menuFrame) {
       nsIContent* menuItemNode = menuFrame->GetContent();
       return mDoc->GetAccessible(menuItemNode);
     }
--- a/accessible/xul/XULMenuAccessible.h
+++ b/accessible/xul/XULMenuAccessible.h
@@ -103,17 +103,17 @@ public:
   XULMenubarAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual a11y::role NativeRole() const override;
 
   // Widget
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
-  virtual Accessible* CurrentItem() override;
+  virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(Accessible* aItem) override;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) override;
 };
 
 } // namespace a11y
--- a/accessible/xul/XULSelectControlAccessible.cpp
+++ b/accessible/xul/XULSelectControlAccessible.cpp
@@ -206,17 +206,17 @@ XULSelectControlAccessible::SelectAll()
   // otherwise, don't support this method
   return false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible: Widgets
 
 Accessible*
-XULSelectControlAccessible::CurrentItem()
+XULSelectControlAccessible::CurrentItem() const
 {
   if (!mSelectControl)
     return nullptr;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
     do_QueryInterface(mSelectControl);
   if (multiSelectControl)
--- a/accessible/xul/XULSelectControlAccessible.h
+++ b/accessible/xul/XULSelectControlAccessible.h
@@ -31,17 +31,17 @@ public:
   virtual Accessible* GetSelectedItem(uint32_t aIndex) override;
   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() override;
+  virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(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;
 };
 
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -217,17 +217,17 @@ XULTreeAccessible::ChildAtPoint(int32_t 
 
   return child;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: SelectAccessible
 
 Accessible*
-XULTreeAccessible::CurrentItem()
+XULTreeAccessible::CurrentItem() const
 {
   if (!mTreeView)
     return nullptr;
 
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (selection) {
     int32_t currentIndex = -1;
--- a/accessible/xul/XULTreeAccessible.h
+++ b/accessible/xul/XULTreeAccessible.h
@@ -59,17 +59,17 @@ public:
   virtual bool RemoveItemFromSelection(uint32_t aIndex) override;
   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() override;
+  virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(Accessible* aItem) override;
 
   virtual Accessible* ContainerWidget() const override;
 
   // XULTreeAccessible
 
   /**
    * Return tree item accessible at the givem row. If accessible doesn't exist