Bug 1317937: Rename nsImageMap::mContainsBlockContents to mConsiderWholeSubtree so it is more descriptive of what it actually does. r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 08 Nov 2017 16:02:05 +0100
changeset 444184 33824395a6ca9145c8b8ce474f043081181164d3
parent 444183 8e5b21f2547f7ad3f4fed61e7af2e3c905d13830
child 444185 0f4264c818570755b5b2f9d4005315f2a7fc01be
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1317937
milestone58.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 1317937: Rename nsImageMap::mContainsBlockContents to mConsiderWholeSubtree so it is more descriptive of what it actually does. r=mats MozReview-Commit-ID: 4TpkkWmMIrc
layout/generic/nsImageMap.cpp
layout/generic/nsImageMap.h
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -672,19 +672,19 @@ void CircleArea::GetRect(nsIFrame* aFram
 
     aRect.SetRect(x1 - radius, y1 - radius, x1 + radius, y1 + radius);
   }
 }
 
 //----------------------------------------------------------------------
 
 
-nsImageMap::nsImageMap() :
-  mImageFrame(nullptr),
-  mContainsBlockContents(false)
+nsImageMap::nsImageMap()
+  : mImageFrame(nullptr)
+  , mConsiderWholeSubtree(false)
 {
 }
 
 nsImageMap::~nsImageMap()
 {
   NS_ASSERTION(mAreas.Length() == 0, "Destroy was not called");
 }
 
@@ -757,46 +757,46 @@ nsImageMap::SearchForAreas(nsIContent* a
     nsIContent *child = aParent->GetChildAt(i);
 
     // If we haven't determined that the map element contains an
     // <a> element yet, then look for <area>.
     if (!aFoundAnchor && child->IsHTMLElement(nsGkAtoms::area)) {
       aFoundArea = true;
       AddArea(child);
 
-      // Continue to next child. This stops mContainsBlockContents from
+      // Continue to next child. This stops mConsiderWholeSubtree from
       // getting set. It also makes us ignore children of <area>s which
       // is consistent with how we react to dynamic insertion of such
       // children.
       continue;
     }
 
     // If we haven't determined that the map element contains an
     // <area> element yet, then look for <a>.
     if (!aFoundArea && child->IsHTMLElement(nsGkAtoms::a)) {
       aFoundAnchor = true;
       AddArea(child);
     }
 
     if (child->IsElement()) {
-      mContainsBlockContents = true;
+      mConsiderWholeSubtree = true;
       SearchForAreas(child, aFoundArea, aFoundAnchor);
     }
   }
 }
 
 void
 nsImageMap::UpdateAreas()
 {
   // Get rid of old area data
   FreeAreas();
 
   bool foundArea = false;
   bool foundAnchor = false;
-  mContainsBlockContents = false;
+  mConsiderWholeSubtree = false;
 
   SearchForAreas(mMap, foundArea, foundAnchor);
 #ifdef ACCESSIBILITY
   if (nsAccessibilityService* accService = GetAccService()) {
     accService->UpdateImageMap(mImageFrame);
   }
 #endif
 }
@@ -883,17 +883,17 @@ nsImageMap::Draw(nsIFrame* aFrame, DrawT
     Area* area = mAreas.ElementAt(i);
     area->Draw(aFrame, aDrawTarget, aColor, aStrokeOptions);
   }
 }
 
 void
 nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
 {
-  if (aContent == mMap || mContainsBlockContents) {
+  if (aContent == mMap || mConsiderWholeSubtree) {
     UpdateAreas();
   }
 }
 
 void
 nsImageMap::AttributeChanged(nsIDocument*  aDocument,
                              dom::Element* aElement,
                              int32_t       aNameSpaceID,
--- a/layout/generic/nsImageMap.h
+++ b/layout/generic/nsImageMap.h
@@ -88,12 +88,16 @@ protected:
 
   void AddArea(nsIContent* aArea);
 
   void MaybeUpdateAreas(nsIContent *aContent);
 
   nsImageFrame* mImageFrame;  // the frame that owns us
   nsCOMPtr<nsIContent> mMap;
   AutoTArray<Area*, 8> mAreas; // almost always has some entries
-  bool mContainsBlockContents;
+
+  // This is set when we search for all area children and tells us whether we
+  // should consider the whole subtree or just direct children when we get
+  // content notifications about changes inside the map subtree.
+  bool mConsiderWholeSubtree;
 };
 
 #endif /* nsImageMap_h */