Last Comment Bug 698232 - [ImageMap] s/IsInside/GetArea to simplify the code
: [ImageMap] s/IsInside/GetArea to simplify the code
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout: Images (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla10
Assigned To: Olli Pettay [:smaug] (reviewing overload)
:
:
Mentors:
Depends on: 699228
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-29 16:36 PDT by Olli Pettay [:smaug] (reviewing overload)
Modified: 2011-11-02 14:17 PDT (History)
2 users (show)
emorley: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (4.64 KB, patch)
2011-10-29 16:36 PDT, Olli Pettay [:smaug] (reviewing overload)
mats: review+
Details | Diff | Splinter Review
patch (4.66 KB, patch)
2011-10-30 12:50 PDT, Olli Pettay [:smaug] (reviewing overload)
no flags Details | Diff | Splinter Review

Description Olli Pettay [:smaug] (reviewing overload) 2011-10-29 16:36:33 PDT
Created attachment 570506 [details] [diff] [review]
patch
Comment 1 Olli Pettay [:smaug] (reviewing overload) 2011-10-29 16:37:54 PDT
https://tbpl.mozilla.org/?tree=Try&rev=2bdc56372afb
Comment 2 Mats Palmgren (:mats) 2011-10-30 07:52:19 PDT
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."
Comment 3 Olli Pettay [:smaug] (reviewing overload) 2011-10-30 12:50:33 PDT
Created attachment 570565 [details] [diff] [review]
patch
Comment 4 Olli Pettay [:smaug] (reviewing overload) 2011-10-30 12:56:13 PDT
https://hg.mozilla.org/mozilla-central/rev/100b46734dd2

Note You need to log in before you can comment on or make changes to this bug.