Bug 1379421: Remove unneeded null-checks in RestyleManager. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 09 Jul 2017 00:02:47 +0200
changeset 605707 c7329938791408c1707960a8e3395044156f42df
parent 605706 2855333cdf3e302ce1c55f07b4a31c956524e58d
child 636575 e85ea4a617bf97d67dcf7a424588b72d59b5fe4c
push id67497
push userbmo:emilio+bugs@crisal.io
push dateSat, 08 Jul 2017 22:05:12 +0000
bugs1379421
milestone56.0a1
Bug 1379421: Remove unneeded null-checks in RestyleManager. Container is the result of dereferencing a non-null variable, so there's no way that can be null. MozReview-Commit-ID: 42xWAeHxR5E
layout/base/RestyleManager.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -150,18 +150,17 @@ RestyleManager::RestyleForInsertOrChange
   // The container might be a document or a ShadowRoot.
   if (!aContainer->IsElement()) {
     return;
   }
   Element* container = aContainer->AsElement();
 
   NS_ASSERTION(!aChild->IsRootOfAnonymousSubtree(),
                "anonymous nodes should not be in child lists");
-  uint32_t selectorFlags =
-    container ? (container->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0;
+  uint32_t selectorFlags = container->GetFlags() & NODE_ALL_SELECTOR_FLAGS;
   if (selectorFlags == 0)
     return;
 
   if (selectorFlags & NODE_HAS_EMPTY_SELECTOR) {
     // see whether we need to restyle the container
     bool wasEmpty = true; // :empty or :-moz-only-whitespace
     for (nsIContent* child = container->GetFirstChild();
          child;
@@ -245,18 +244,17 @@ RestyleManager::ContentRemoved(nsINode* 
 
   if (aOldChild->IsRootOfAnonymousSubtree()) {
     // This should be an assert, but this is called incorrectly in
     // HTMLEditor::DeleteRefToAnonymousNode and the assertions were clogging
     // up the logs.  Make it an assert again when that's fixed.
     MOZ_ASSERT(aOldChild->GetProperty(nsGkAtoms::restylableAnonymousNode),
                "anonymous nodes should not be in child lists (bug 439258)");
   }
-  uint32_t selectorFlags =
-    container ? (container->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0;
+  uint32_t selectorFlags = container->GetFlags() & NODE_ALL_SELECTOR_FLAGS;
   if (selectorFlags == 0)
     return;
 
   if (selectorFlags & NODE_HAS_EMPTY_SELECTOR) {
     // see whether we need to restyle the container
     bool isEmpty = true; // :empty or :-moz-only-whitespace
     for (nsIContent* child = container->GetFirstChild();
          child;