Bug 1338086 - Remove useless else blocks in order to reduce complexity in view/ r?tnikkel draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 09 Feb 2017 10:42:41 +0100
changeset 484422 2d9c852ea9d35af340d32b784025fbe5d8939d27
parent 484421 11f027ebdc903f87ac9f0ca746111af21ccc8a91
child 484423 78575ea4bcbcd270bd2c34c656c944bad09512ad
push id45470
push userbmo:sledru@mozilla.com
push dateWed, 15 Feb 2017 08:57:47 +0000
reviewerstnikkel
bugs1338086
milestone54.0a1
Bug 1338086 - Remove useless else blocks in order to reduce complexity in view/ r?tnikkel MozReview-Commit-ID: 6H794QjWZ1t
view/nsView.cpp
view/nsViewManager.cpp
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -1016,17 +1016,17 @@ nsView::WindowResized(nsIWidget* aWidget
       nsIPresShell* presShell = mViewManager->GetPresShell();
       if (presShell && presShell->GetDocument()) {
         pm->AdjustPopupsOnWindowChange(presShell);
       }
     }
 
     return true;
   }
-  else if (IsPopupWidget(aWidget)) {
+  if (IsPopupWidget(aWidget)) {
     nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
     if (pm) {
       pm->PopupResized(mFrame, LayoutDeviceIntSize(aWidth, aHeight));
       return true;
     }
   }
 
   return false;
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -992,28 +992,28 @@ nsViewManager::SetViewVisibility(nsView 
     aView->SetVisibility(aVisible);
   }
 }
 
 bool nsViewManager::IsViewInserted(nsView *aView)
 {
   if (mRootView == aView) {
     return true;
-  } else if (aView->GetParent() == nullptr) {
-    return false;
-  } else {
-    nsView* view = aView->GetParent()->GetFirstChild();
-    while (view != nullptr) {
-      if (view == aView) {
-        return true;
-      }
-      view = view->GetNextSibling();
-    }
+  }
+  if (aView->GetParent() == nullptr) {
     return false;
   }
+  nsView* view = aView->GetParent()->GetFirstChild();
+  while (view != nullptr) {
+    if (view == aView) {
+      return true;
+    }
+    view = view->GetNextSibling();
+  }
+  return false;
 }
 
 void
 nsViewManager::SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZIndex)
 {
   NS_ASSERTION((aView != nullptr), "no view");
 
   // don't allow the root view's z-index to be changed. It should always be zero.