bug 1155829 - inline MaiHyperlink::GetAtkHyperlink r=surkov
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Tue, 07 Apr 2015 15:56:28 -0400
changeset 259165 86d231dcc30cfd654edbe6311c923914df7f1642
parent 259164 5a16a3825802963b523479515d255b38d92786b6
child 259166 7e3e8edde0a3e9dd06bd07214da6077b07cb8726
push id8007
push userraliiev@mozilla.com
push dateMon, 11 May 2015 19:23:16 +0000
treeherdermozilla-aurora@e2ce1aac996e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1155829
milestone40.0a1
bug 1155829 - inline MaiHyperlink::GetAtkHyperlink r=surkov
accessible/atk/nsMaiHyperlink.cpp
accessible/atk/nsMaiHyperlink.h
--- a/accessible/atk/nsMaiHyperlink.cpp
+++ b/accessible/atk/nsMaiHyperlink.cpp
@@ -89,46 +89,35 @@ mai_atk_hyperlink_get_type(void)
     }
     return type;
 }
 
 MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
     mHyperlink(aHyperLink),
     mMaiAtkHyperlink(nullptr)
 {
-}
-
-MaiHyperlink::~MaiHyperlink()
-{
-    if (mMaiAtkHyperlink) {
-        MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
-        g_object_unref(mMaiAtkHyperlink);
-    }
-}
-
-AtkHyperlink*
-MaiHyperlink::GetAtkHyperlink(void)
-{
-  NS_ENSURE_TRUE(mHyperlink, nullptr);
-
-  if (mMaiAtkHyperlink)
-    return mMaiAtkHyperlink;
-
   if (!mHyperlink->IsLink())
-    return nullptr;
+    return;
 
     mMaiAtkHyperlink =
         reinterpret_cast<AtkHyperlink *>
                         (g_object_new(mai_atk_hyperlink_get_type(), nullptr));
     NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
-    NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr);
+    if (!mMaiAtkHyperlink)
+      return;
 
     MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this;
+}
 
-    return mMaiAtkHyperlink;
+MaiHyperlink::~MaiHyperlink()
+{
+  if (mMaiAtkHyperlink) {
+    MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
+    g_object_unref(mMaiAtkHyperlink);
+  }
 }
 
 
 /* static functions for ATK callbacks */
 
 void
 classInitCB(AtkHyperlinkClass *aClass)
 {
--- a/accessible/atk/nsMaiHyperlink.h
+++ b/accessible/atk/nsMaiHyperlink.h
@@ -22,17 +22,17 @@ namespace a11y {
 
 class MaiHyperlink
 {
 public:
   explicit MaiHyperlink(Accessible* aHyperLink);
   ~MaiHyperlink();
 
 public:
-  AtkHyperlink *GetAtkHyperlink(void);
+  AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
   Accessible* GetAccHyperlink()
     { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
 
 protected:
   Accessible* mHyperlink;
   AtkHyperlink* mMaiAtkHyperlink;
 };