Bug 1379421: Remove unneeded null-checks in RestyleManager. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 09 Jul 2017 00:02:47 +0200
changeset 367917 a3bc7a02a48e0cc517034010cf053fa8684de492
parent 367916 e38da505d63fcc4f1d58df9647f79f6c4c1b1792
child 367918 fe590db882de7fba5b46a1f6aac64178b42062bb
push id32149
push userarchaeopteryx@coole-files.de
push dateSun, 09 Jul 2017 09:18:32 +0000
treeherdermozilla-central@858be731fb01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1379421
milestone56.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 1379421: Remove unneeded null-checks in RestyleManager. r=heycam 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;