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

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

Description User image Olli Pettay [:smaug] 2011-10-29 16:36:33 PDT
Created attachment 570506 [details] [diff] [review]
Comment 1 User image Olli Pettay [:smaug] 2011-10-29 16:37:54 PDT
Comment 2 User image Mats Palmgren (:mats) 2011-10-30 07:52:19 PDT
Comment on attachment 570506 [details] [diff] [review]

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 User image Olli Pettay [:smaug] 2011-10-30 12:50:33 PDT
Created attachment 570565 [details] [diff] [review]
Comment 4 User image Olli Pettay [:smaug] 2011-10-30 12:56:13 PDT

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