Issue #2732 - Part 1: Rename mContainsBlockContents to mConsiderWholeSubtree

It is more descriptive of what it actually does.
This commit is contained in:
Moonchild 2025-04-24 14:38:33 +02:00 • committed by roytam1
commit 2ef82632d4
2 changed files with 12 additions and 8 deletions

View file

@ -676,9 +676,9 @@ void CircleArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
nsImageMap::nsImageMap() : nsImageMap::nsImageMap()
mImageFrame(nullptr), : mImageFrame(nullptr)
mContainsBlockContents(false) , mConsiderWholeSubtree(false)
{ {
} }
@ -767,7 +767,7 @@ nsImageMap::SearchForAreas(nsIContent* aParent, bool& aFoundArea,
rv = AddArea(child); rv = AddArea(child);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// 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 // getting set. It also makes us ignore children of <area>s which
// is consistent with how we react to dynamic insertion of such // is consistent with how we react to dynamic insertion of such
// children. // children.
@ -783,7 +783,7 @@ nsImageMap::SearchForAreas(nsIContent* aParent, bool& aFoundArea,
} }
if (child->IsElement()) { if (child->IsElement()) {
mContainsBlockContents = true; mConsiderWholeSubtree = true;
rv = SearchForAreas(child, aFoundArea, aFoundAnchor); rv = SearchForAreas(child, aFoundArea, aFoundAnchor);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
@ -800,7 +800,7 @@ nsImageMap::UpdateAreas()
bool foundArea = false; bool foundArea = false;
bool foundAnchor = false; bool foundAnchor = false;
mContainsBlockContents = false; mConsiderWholeSubtree = false;
nsresult rv = SearchForAreas(mMap, foundArea, foundAnchor); nsresult rv = SearchForAreas(mMap, foundArea, foundAnchor);
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
@ -908,7 +908,7 @@ nsImageMap::Draw(nsIFrame* aFrame, DrawTarget& aDrawTarget,
void void
nsImageMap::MaybeUpdateAreas(nsIContent *aContent) nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
{ {
if (aContent == mMap || mContainsBlockContents) { if (aContent == mMap || mConsiderWholeSubtree) {
UpdateAreas(); UpdateAreas();
} }
} }

View file

@ -91,7 +91,11 @@ protected:
nsImageFrame* mImageFrame; // the frame that owns us nsImageFrame* mImageFrame; // the frame that owns us
nsCOMPtr<nsIContent> mMap; nsCOMPtr<nsIContent> mMap;
AutoTArray<Area*, 8> mAreas; // almost always has some entries 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 */ #endif /* nsImageMap_h */