Closed Bug 698232 Opened 8 years ago Closed 8 years ago

[ImageMap] s/IsInside/GetArea to simplify the code

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: smaug, Assigned: smaug)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
No description provided.
Attachment #570506 - Attachment is patch: true
Attachment #570506 - Flags: review?(matspal)
Comment on attachment 570506 [details] [diff] [review]
patch

In layout/generic/nsImageFrame.cpp:
> nsImageFrame::GetCursor(const nsPoint& aPoint,
> ...
>     nsCOMPtr<nsIContent> area;
>-    if (map->IsInside(p.x, p.y, getter_AddRefs(area))) {
>+    if ((area = map->GetArea(p.x, p.y))) {

I'd prefer:
      nsCOMPtr<nsIContent> area = map->GetArea(p.x, p.y);
      if (area) {


In layout/generic/nsImageMap.h:
>+   * See if the given aX,aY pixel coordinates are in the image
>+   * map. If they are then pointer to the relevant area element is returned.
>+   * If the coordinates are not in the map then nsnull
>    * is returned.

Let's try to improve this doc comment while we're here.  How about:

"Return the first area element (in content order) for the given aX,aY pixel
coordinate or nsnull if the coordinate is outside all areas."
Attachment #570506 - Flags: review?(matspal) → review+
Attached patch patchSplinter Review
Assignee: nobody → Olli.Pettay
https://hg.mozilla.org/mozilla-central/rev/100b46734dd2
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Attachment #570506 - Attachment is obsolete: true
Flags: in-testsuite-
OS: Linux → All
Hardware: x86_64 → All
Target Milestone: --- → mozilla10
Version: unspecified → Trunk
Depends on: 699228
Product: Core → Core Graveyard
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.