Bug 1317937: Rename nsImageMap::mContainsBlockContents to mConsiderWholeSubtree so it is more descriptive of what it actually does. r=mats draft
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 08 Nov 2017 16:02:05 +0100
changeset 695005 ca7d3b875cc083a2769b7e9bf08381c204498755
parent 694565 40df5dd35fdb7ce3652fe4448ac8961c075c928e
child 695006 95c6a81ea899ca20691d9cff17a9eea5f998982f
push id88302
push userbmo:emilio@crisal.io
push dateWed, 08 Nov 2017 16:26:12 +0000
reviewersmats
bugs1317937
milestone58.0a1
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 */