Closed Bug 1382593 Opened 2 years ago Closed 2 years ago

Cleanup a bit nsImageMap.

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I did a this as I tried to get bug 135040 fixed, and I think it's worth landing.
Blocks: 135040
Comment on attachment 8888249 [details]
Bug 1382593: Clean a bit nsImageMap.

https://reviewboard.mozilla.org/r/159200/#review165078

::: layout/generic/nsImageMap.cpp:716
(Diff revision 2)
>  }
>  
>  void
>  nsImageMap::FreeAreas()
>  {
> -  uint32_t i, n = mAreas.Length();
> +  for (const auto* area : mAreas) {

Leave off the "const"?  I don't think it adds anything really.

::: layout/generic/nsImageMap.cpp
(Diff revision 2)
> -  if (!area)
> -    return NS_ERROR_OUT_OF_MEMORY;

Maybe upgrade the NS_NOTREACHED above to MOZ_ASSERT_UNREACHABLE?

::: layout/generic/nsImageMap.cpp:862
(Diff revision 2)
>  
>  nsIContent*
>  nsImageMap::GetArea(nscoord aX, nscoord aY) const
>  {
>    NS_ASSERTION(mMap, "Not initialized");
> -  uint32_t i, n = mAreas.Length();
> +  for (const auto* area : mAreas) {

Wouldn't bother with const here either.
Attachment #8888249 - Flags: review?(cam) → review+
https://hg.mozilla.org/mozilla-central/rev/5a67359d51b4
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Product: Core → Core Graveyard
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.