Bug 1439793: Simplify nsStyleChangeList::PopChangesForContent. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 21 Feb 2018 09:32:28 +0100
changeset 404626 2e6fed1f75aee8ff76c7ea4d2ba4189b758c0b15
parent 404625 c67f82baba03f18239716a4362e0dfe8decee534
child 404627 601daa76d78093d7bc2320adf6a615b97db2664d
push id33484
push userrgurzau@mozilla.com
push dateWed, 21 Feb 2018 16:44:18 +0000
treeherdermozilla-central@d09a45f02c78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1439793
milestone60.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 1439793: Simplify nsStyleChangeList::PopChangesForContent. r=xidorn MozReview-Commit-ID: Hnd06USHP3N
layout/base/nsStyleChangeList.h
--- a/layout/base/nsStyleChangeList.h
+++ b/layout/base/nsStyleChangeList.h
@@ -45,22 +45,18 @@ public:
     mType(aType) { MOZ_COUNT_CTOR(nsStyleChangeList); }
   ~nsStyleChangeList() { MOZ_COUNT_DTOR(nsStyleChangeList); }
   void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
 
   // Starting from the end of the list, removes all changes until the list is
   // empty or an element with |mContent != aContent| is found.
   void PopChangesForContent(nsIContent* aContent)
   {
-    while (Length() > 0) {
-      if (LastElement().mContent == aContent) {
-        RemoveElementAt(Length() - 1);
-      } else {
-        break;
-      }
+    while (!IsEmpty() && LastElement().mContent == aContent) {
+      RemoveElementAt(Length() - 1);
     }
   }
 
   bool IsGecko() const { return mType == mozilla::StyleBackendType::Gecko; }
   bool IsServo() const { return mType == mozilla::StyleBackendType::Servo; }
 
 private:
   mozilla::StyleBackendType mType;