2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-29 18:29:03 +00:00
|
|
|
|
|
|
|
/* code for HTML client-side image maps */
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
#include "nsImageMap.h"
|
2011-05-30 11:35:45 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsString.h"
|
2001-09-29 08:28:41 +00:00
|
|
|
#include "nsReadableUtils.h"
|
2011-04-08 01:04:40 +00:00
|
|
|
#include "nsRenderingContext.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIURL.h"
|
1999-06-18 17:34:08 +00:00
|
|
|
#include "nsIServiceManager.h"
|
1999-11-30 04:50:42 +00:00
|
|
|
#include "nsNetUtil.h"
|
1999-01-05 23:02:27 +00:00
|
|
|
#include "nsTextFragment.h"
|
2010-08-24 07:05:56 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
1999-01-09 00:13:53 +00:00
|
|
|
#include "nsIDocument.h"
|
1999-03-01 16:57:35 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2007-05-14 09:11:38 +00:00
|
|
|
#include "nsIDOMEventTarget.h"
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
#include "nsIPresShell.h"
|
2011-10-29 10:44:50 +00:00
|
|
|
#include "nsImageFrame.h"
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
#include "nsCoord.h"
|
2002-08-27 20:49:54 +00:00
|
|
|
#include "nsIConsoleService.h"
|
|
|
|
#include "nsIScriptError.h"
|
|
|
|
#include "nsIStringBundle.h"
|
2004-06-25 12:26:02 +00:00
|
|
|
#include "nsContentUtils.h"
|
2002-08-27 20:49:54 +00:00
|
|
|
|
2012-03-15 20:16:02 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
#include "nsAccessibilityService.h"
|
|
|
|
#endif
|
|
|
|
|
2010-08-24 07:05:56 +00:00
|
|
|
namespace dom = mozilla::dom;
|
|
|
|
|
2002-08-27 20:49:54 +00:00
|
|
|
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
class Area {
|
|
|
|
public:
|
2004-02-20 19:00:43 +00:00
|
|
|
Area(nsIContent* aArea);
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual ~Area();
|
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
virtual void ParseCoords(const nsAString& aSpec);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsInside(nscoord x, nscoord y) const = 0;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC) = 0;
|
2008-08-07 14:44:04 +00:00
|
|
|
virtual void GetRect(nsIFrame* aFrame, nsRect& aRect) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void HasFocus(bool aHasFocus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-02-11 01:24:59 +00:00
|
|
|
nsCOMPtr<nsIContent> mArea;
|
1998-04-13 20:24:54 +00:00
|
|
|
nscoord* mCoords;
|
|
|
|
PRInt32 mNumCoords;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mHasFocus;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-02-20 19:00:43 +00:00
|
|
|
Area::Area(nsIContent* aArea)
|
|
|
|
: mArea(aArea)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-10-08 20:41:19 +00:00
|
|
|
MOZ_COUNT_CTOR(Area);
|
2009-12-29 20:13:54 +00:00
|
|
|
NS_PRECONDITION(mArea, "How did that happen?");
|
2012-07-30 14:20:58 +00:00
|
|
|
mCoords = nullptr;
|
1998-04-13 20:24:54 +00:00
|
|
|
mNumCoords = 0;
|
2011-10-17 14:59:28 +00:00
|
|
|
mHasFocus = false;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Area::~Area()
|
|
|
|
{
|
1999-10-08 20:41:19 +00:00
|
|
|
MOZ_COUNT_DTOR(Area);
|
1998-04-13 20:24:54 +00:00
|
|
|
delete [] mCoords;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2001-07-25 05:14:18 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
inline bool
|
2001-07-25 05:14:18 +00:00
|
|
|
is_space(char c)
|
|
|
|
{
|
|
|
|
return (c == ' ' ||
|
|
|
|
c == '\f' ||
|
|
|
|
c == '\n' ||
|
|
|
|
c == '\r' ||
|
|
|
|
c == '\t' ||
|
|
|
|
c == '\v');
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
static void logMessage(nsIContent* aContent,
|
|
|
|
const nsAString& aCoordsSpec,
|
|
|
|
PRInt32 aFlags,
|
2004-11-23 17:45:37 +00:00
|
|
|
const char* aMessageName) {
|
2011-10-18 10:53:36 +00:00
|
|
|
nsIDocument* doc = aContent->OwnerDoc();
|
2010-12-20 16:21:58 +00:00
|
|
|
|
2004-11-23 17:45:37 +00:00
|
|
|
nsContentUtils::ReportToConsole(
|
2011-12-15 14:47:03 +00:00
|
|
|
aFlags, "ImageMap", doc,
|
2004-11-23 17:45:37 +00:00
|
|
|
nsContentUtils::eLAYOUT_PROPERTIES,
|
|
|
|
aMessageName,
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr, /* params */
|
2004-11-23 17:45:37 +00:00
|
|
|
0, /* params length */
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr,
|
2004-11-23 17:45:37 +00:00
|
|
|
PromiseFlatString(NS_LITERAL_STRING("coords=\"") +
|
|
|
|
aCoordsSpec +
|
2011-12-15 14:47:03 +00:00
|
|
|
NS_LITERAL_STRING("\""))); /* source line */
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
|
|
|
|
2008-09-06 15:52:33 +00:00
|
|
|
void Area::ParseCoords(const nsAString& aSpec)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2008-09-06 15:52:33 +00:00
|
|
|
char* cp = ToNewCString(aSpec);
|
|
|
|
if (cp) {
|
|
|
|
char *tptr;
|
|
|
|
char *n_str;
|
|
|
|
PRInt32 i, cnt;
|
|
|
|
PRInt32 *value_list;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* Nothing in an empty list
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
mNumCoords = 0;
|
2012-07-30 14:20:58 +00:00
|
|
|
mCoords = nullptr;
|
2008-09-06 15:52:33 +00:00
|
|
|
if (*cp == '\0')
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-06-11 20:40:39 +00:00
|
|
|
nsMemory::Free(cp);
|
2008-09-06 15:52:33 +00:00
|
|
|
return;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* Skip beginning whitespace, all whitespace is empty list.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
n_str = cp;
|
|
|
|
while (is_space(*n_str))
|
|
|
|
{
|
|
|
|
n_str++;
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
if (*n_str == '\0')
|
|
|
|
{
|
2011-06-11 20:40:39 +00:00
|
|
|
nsMemory::Free(cp);
|
2008-09-06 15:52:33 +00:00
|
|
|
return;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* Make a pass where any two numbers separated by just whitespace
|
|
|
|
* are given a comma separator. Count entries while passing.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
cnt = 0;
|
|
|
|
while (*n_str != '\0')
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-09-29 06:19:26 +00:00
|
|
|
bool has_comma;
|
2008-09-06 15:52:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip to a separator
|
|
|
|
*/
|
|
|
|
tptr = n_str;
|
|
|
|
while (!is_space(*tptr) && *tptr != ',' && *tptr != '\0')
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2008-09-06 15:52:33 +00:00
|
|
|
tptr++;
|
|
|
|
}
|
|
|
|
n_str = tptr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If no more entries, break out here
|
|
|
|
*/
|
|
|
|
if (*n_str == '\0')
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip to the end of the separator, noting if we have a
|
|
|
|
* comma.
|
|
|
|
*/
|
2011-10-17 14:59:28 +00:00
|
|
|
has_comma = false;
|
2008-09-06 15:52:33 +00:00
|
|
|
while (is_space(*tptr) || *tptr == ',')
|
|
|
|
{
|
|
|
|
if (*tptr == ',')
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2010-02-07 15:52:43 +00:00
|
|
|
if (!has_comma)
|
2008-09-06 15:52:33 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
has_comma = true;
|
2008-09-06 15:52:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2008-09-06 15:52:33 +00:00
|
|
|
tptr++;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If this was trailing whitespace we skipped, we are done.
|
|
|
|
*/
|
2010-02-07 15:52:43 +00:00
|
|
|
if ((*tptr == '\0') && !has_comma)
|
2008-09-06 15:52:33 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Else if the separator is all whitespace, and this is not the
|
|
|
|
* end of the string, add a comma to the separator.
|
|
|
|
*/
|
2010-02-07 15:52:43 +00:00
|
|
|
else if (!has_comma)
|
2008-09-06 15:52:33 +00:00
|
|
|
{
|
|
|
|
*n_str = ',';
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2008-09-06 15:52:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* count the entry skipped.
|
|
|
|
*/
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
n_str = tptr;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* count the last entry in the list.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
cnt++;
|
2009-11-18 06:08:20 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* Allocate space for the coordinate array.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
value_list = new nscoord[cnt];
|
|
|
|
if (!value_list)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-06-11 20:40:39 +00:00
|
|
|
nsMemory::Free(cp);
|
2008-09-06 15:52:33 +00:00
|
|
|
return;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-09-06 15:52:33 +00:00
|
|
|
* Second pass to copy integer values into list.
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2008-09-06 15:52:33 +00:00
|
|
|
tptr = cp;
|
|
|
|
for (i=0; i<cnt; i++)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2008-09-06 15:52:33 +00:00
|
|
|
char *ptr;
|
2001-07-25 05:14:18 +00:00
|
|
|
|
2008-09-06 15:52:33 +00:00
|
|
|
ptr = strchr(tptr, ',');
|
|
|
|
if (ptr)
|
|
|
|
{
|
|
|
|
*ptr = '\0';
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Strip whitespace in front of number because I don't
|
|
|
|
* trust atoi to do it on all platforms.
|
|
|
|
*/
|
|
|
|
while (is_space(*tptr))
|
|
|
|
{
|
|
|
|
tptr++;
|
|
|
|
}
|
|
|
|
if (*tptr == '\0')
|
|
|
|
{
|
|
|
|
value_list[i] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value_list[i] = (nscoord) ::atoi(tptr);
|
|
|
|
}
|
|
|
|
if (ptr)
|
|
|
|
{
|
|
|
|
*ptr = ',';
|
|
|
|
tptr = ptr + 1;
|
|
|
|
}
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2008-09-06 15:52:33 +00:00
|
|
|
mNumCoords = cnt;
|
|
|
|
mCoords = value_list;
|
2009-11-18 06:08:20 +00:00
|
|
|
|
2011-06-11 20:40:39 +00:00
|
|
|
nsMemory::Free(cp);
|
1999-10-28 14:33:34 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void Area::HasFocus(bool aHasFocus)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
|
|
|
mHasFocus = aHasFocus;
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class DefaultArea : public Area {
|
|
|
|
public:
|
2004-02-20 19:00:43 +00:00
|
|
|
DefaultArea(nsIContent* aArea);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsInside(nscoord x, nscoord y) const;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
|
2008-08-07 14:44:04 +00:00
|
|
|
virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-02-20 19:00:43 +00:00
|
|
|
DefaultArea::DefaultArea(nsIContent* aArea)
|
|
|
|
: Area(aArea)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool DefaultArea::IsInside(nscoord x, nscoord y) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void DefaultArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2008-08-07 14:44:04 +00:00
|
|
|
if (mHasFocus) {
|
|
|
|
nsRect r = aFrame->GetRect();
|
|
|
|
r.MoveTo(0, 0);
|
|
|
|
nscoord x1 = r.x;
|
|
|
|
nscoord y1 = r.y;
|
|
|
|
const nscoord kOnePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
|
|
|
nscoord x2 = r.XMost() - kOnePixel;
|
|
|
|
nscoord y2 = r.YMost() - kOnePixel;
|
|
|
|
// XXX aRC.DrawRect(r) result is ugly, that's why we use DrawLine.
|
|
|
|
aRC.DrawLine(x1, y1, x1, y2);
|
|
|
|
aRC.DrawLine(x1, y2, x2, y2);
|
|
|
|
aRC.DrawLine(x1, y1, x2, y1);
|
|
|
|
aRC.DrawLine(x2, y1, x2, y2);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2008-08-07 14:44:04 +00:00
|
|
|
void DefaultArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
2008-08-07 14:44:04 +00:00
|
|
|
aRect = aFrame->GetRect();
|
|
|
|
aRect.MoveTo(0, 0);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class RectArea : public Area {
|
|
|
|
public:
|
2004-02-20 19:00:43 +00:00
|
|
|
RectArea(nsIContent* aArea);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
virtual void ParseCoords(const nsAString& aSpec);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsInside(nscoord x, nscoord y) const;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
|
2008-08-07 14:44:04 +00:00
|
|
|
virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-02-20 19:00:43 +00:00
|
|
|
RectArea::RectArea(nsIContent* aArea)
|
|
|
|
: Area(aArea)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
void RectArea::ParseCoords(const nsAString& aSpec)
|
2002-08-27 20:49:54 +00:00
|
|
|
{
|
|
|
|
Area::ParseCoords(aSpec);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool saneRect = true;
|
2002-08-27 20:49:54 +00:00
|
|
|
PRInt32 flag = nsIScriptError::warningFlag;
|
|
|
|
if (mNumCoords >= 4) {
|
|
|
|
if (mCoords[0] > mCoords[2]) {
|
|
|
|
// x-coords in reversed order
|
|
|
|
nscoord x = mCoords[2];
|
|
|
|
mCoords[2] = mCoords[0];
|
|
|
|
mCoords[0] = x;
|
2011-10-17 14:59:28 +00:00
|
|
|
saneRect = false;
|
2002-08-27 20:49:54 +00:00
|
|
|
}
|
2009-11-18 06:08:20 +00:00
|
|
|
|
2002-08-27 20:49:54 +00:00
|
|
|
if (mCoords[1] > mCoords[3]) {
|
|
|
|
// y-coords in reversed order
|
|
|
|
nscoord y = mCoords[3];
|
|
|
|
mCoords[3] = mCoords[1];
|
|
|
|
mCoords[1] = y;
|
2011-10-17 14:59:28 +00:00
|
|
|
saneRect = false;
|
2002-08-27 20:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mNumCoords > 4) {
|
|
|
|
// Someone missed the concept of a rect here
|
2011-10-17 14:59:28 +00:00
|
|
|
saneRect = false;
|
2002-08-27 20:49:54 +00:00
|
|
|
}
|
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
saneRect = false;
|
2002-08-27 20:49:54 +00:00
|
|
|
flag = nsIScriptError::errorFlag;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!saneRect) {
|
2004-11-23 17:45:37 +00:00
|
|
|
logMessage(mArea, aSpec, flag, "ImageMapRectBoundsError");
|
2002-08-27 20:49:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool RectArea::IsInside(nscoord x, nscoord y) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-09-07 00:20:35 +00:00
|
|
|
if (mNumCoords >= 4) { // Note: > is for nav compatibility
|
1998-04-13 20:24:54 +00:00
|
|
|
nscoord x1 = mCoords[0];
|
|
|
|
nscoord y1 = mCoords[1];
|
|
|
|
nscoord x2 = mCoords[2];
|
|
|
|
nscoord y2 = mCoords[3];
|
2002-08-27 20:49:54 +00:00
|
|
|
NS_ASSERTION(x1 <= x2 && y1 <= y2,
|
|
|
|
"Someone screwed up RectArea::ParseCoords");
|
1998-04-13 20:24:54 +00:00
|
|
|
if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void RectArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
|
|
|
if (mHasFocus) {
|
|
|
|
if (mNumCoords >= 4) {
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
|
|
|
nscoord x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
|
|
|
|
nscoord y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[3]);
|
2002-08-27 20:49:54 +00:00
|
|
|
NS_ASSERTION(x1 <= x2 && y1 <= y2,
|
|
|
|
"Someone screwed up RectArea::ParseCoords");
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
aRC.DrawLine(x1, y1, x1, y2);
|
|
|
|
aRC.DrawLine(x1, y2, x2, y2);
|
|
|
|
aRC.DrawLine(x1, y1, x2, y1);
|
|
|
|
aRC.DrawLine(x2, y1, x2, y2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-07 14:44:04 +00:00
|
|
|
void RectArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
if (mNumCoords >= 4) {
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
|
|
|
nscoord x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
|
|
|
|
nscoord y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[3]);
|
2002-08-27 20:49:54 +00:00
|
|
|
NS_ASSERTION(x1 <= x2 && y1 <= y2,
|
|
|
|
"Someone screwed up RectArea::ParseCoords");
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
aRect.SetRect(x1, y1, x2, y2);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class PolyArea : public Area {
|
|
|
|
public:
|
2004-02-20 19:00:43 +00:00
|
|
|
PolyArea(nsIContent* aArea);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
virtual void ParseCoords(const nsAString& aSpec);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsInside(nscoord x, nscoord y) const;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
|
2008-08-07 14:44:04 +00:00
|
|
|
virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-02-20 19:00:43 +00:00
|
|
|
PolyArea::PolyArea(nsIContent* aArea)
|
|
|
|
: Area(aArea)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
void PolyArea::ParseCoords(const nsAString& aSpec)
|
|
|
|
{
|
|
|
|
Area::ParseCoords(aSpec);
|
|
|
|
|
|
|
|
if (mNumCoords >= 2) {
|
|
|
|
if (mNumCoords & 1U) {
|
|
|
|
logMessage(mArea,
|
|
|
|
aSpec,
|
|
|
|
nsIScriptError::warningFlag,
|
2004-11-23 17:45:37 +00:00
|
|
|
"ImageMapPolyOddNumberOfCoords");
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
logMessage(mArea,
|
|
|
|
aSpec,
|
|
|
|
nsIScriptError::errorFlag,
|
2004-11-23 17:45:37 +00:00
|
|
|
"ImageMapPolyWrongNumberOfCoords");
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool PolyArea::IsInside(nscoord x, nscoord y) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
if (mNumCoords >= 6) {
|
|
|
|
PRInt32 intersects = 0;
|
|
|
|
nscoord wherex = x;
|
|
|
|
nscoord wherey = y;
|
|
|
|
PRInt32 totalv = mNumCoords / 2;
|
|
|
|
PRInt32 totalc = totalv * 2;
|
|
|
|
nscoord xval = mCoords[totalc - 2];
|
|
|
|
nscoord yval = mCoords[totalc - 1];
|
|
|
|
PRInt32 end = totalc;
|
|
|
|
PRInt32 pointer = 1;
|
|
|
|
|
2009-11-18 06:08:20 +00:00
|
|
|
if ((yval >= wherey) != (mCoords[pointer] >= wherey)) {
|
|
|
|
if ((xval >= wherex) == (mCoords[0] >= wherex)) {
|
1998-04-13 20:24:54 +00:00
|
|
|
intersects += (xval >= wherex) ? 1 : 0;
|
2009-11-18 06:08:20 +00:00
|
|
|
} else {
|
1998-04-13 20:24:54 +00:00
|
|
|
intersects += ((xval - (yval - wherey) *
|
|
|
|
(mCoords[0] - xval) /
|
|
|
|
(mCoords[pointer] - yval)) >= wherex) ? 1 : 0;
|
2009-11-18 06:08:20 +00:00
|
|
|
}
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
// XXX I wonder what this is doing; this is a translation of ptinpoly.c
|
|
|
|
while (pointer < end) {
|
|
|
|
yval = mCoords[pointer];
|
|
|
|
pointer += 2;
|
|
|
|
if (yval >= wherey) {
|
|
|
|
while((pointer < end) && (mCoords[pointer] >= wherey))
|
|
|
|
pointer+=2;
|
|
|
|
if (pointer >= end)
|
|
|
|
break;
|
|
|
|
if ((mCoords[pointer-3] >= wherex) ==
|
|
|
|
(mCoords[pointer-1] >= wherex)) {
|
|
|
|
intersects += (mCoords[pointer-3] >= wherex) ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
intersects +=
|
|
|
|
((mCoords[pointer-3] - (mCoords[pointer-2] - wherey) *
|
|
|
|
(mCoords[pointer-1] - mCoords[pointer-3]) /
|
|
|
|
(mCoords[pointer] - mCoords[pointer - 2])) >= wherex) ? 1:0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
while((pointer < end) && (mCoords[pointer] < wherey))
|
|
|
|
pointer+=2;
|
|
|
|
if (pointer >= end)
|
|
|
|
break;
|
|
|
|
if ((mCoords[pointer-3] >= wherex) ==
|
|
|
|
(mCoords[pointer-1] >= wherex)) {
|
|
|
|
intersects += (mCoords[pointer-3] >= wherex) ? 1:0;
|
|
|
|
} else {
|
|
|
|
intersects +=
|
|
|
|
((mCoords[pointer-3] - (mCoords[pointer-2] - wherey) *
|
|
|
|
(mCoords[pointer-1] - mCoords[pointer-3]) /
|
|
|
|
(mCoords[pointer] - mCoords[pointer - 2])) >= wherex) ? 1:0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((intersects & 1) != 0) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void PolyArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
|
|
|
if (mHasFocus) {
|
|
|
|
if (mNumCoords >= 6) {
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord x0 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
nscoord y0 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
nscoord x1, y1;
|
|
|
|
for (PRInt32 i = 2; i < mNumCoords; i += 2) {
|
2007-02-07 07:46:44 +00:00
|
|
|
x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[i]);
|
|
|
|
y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[i+1]);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
aRC.DrawLine(x0, y0, x1, y1);
|
|
|
|
x0 = x1;
|
|
|
|
y0 = y1;
|
|
|
|
}
|
2007-02-07 07:46:44 +00:00
|
|
|
x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
aRC.DrawLine(x0, y0, x1, y1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-07 14:44:04 +00:00
|
|
|
void PolyArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
if (mNumCoords >= 6) {
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
nscoord x1, x2, y1, y2, xtmp, ytmp;
|
2007-02-07 07:46:44 +00:00
|
|
|
x1 = x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
y1 = y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
1998-04-13 20:24:54 +00:00
|
|
|
for (PRInt32 i = 2; i < mNumCoords; i += 2) {
|
2007-02-07 07:46:44 +00:00
|
|
|
xtmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i]);
|
|
|
|
ytmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i+1]);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
x1 = x1 < xtmp ? x1 : xtmp;
|
|
|
|
y1 = y1 < ytmp ? y1 : ytmp;
|
|
|
|
x2 = x2 > xtmp ? x2 : xtmp;
|
|
|
|
y2 = y2 > ytmp ? y2 : ytmp;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
aRect.SetRect(x1, y1, x2, y2);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class CircleArea : public Area {
|
|
|
|
public:
|
2004-02-20 19:00:43 +00:00
|
|
|
CircleArea(nsIContent* aArea);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
virtual void ParseCoords(const nsAString& aSpec);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsInside(nscoord x, nscoord y) const;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
|
2008-08-07 14:44:04 +00:00
|
|
|
virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-02-20 19:00:43 +00:00
|
|
|
CircleArea::CircleArea(nsIContent* aArea)
|
|
|
|
: Area(aArea)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
void CircleArea::ParseCoords(const nsAString& aSpec)
|
|
|
|
{
|
|
|
|
Area::ParseCoords(aSpec);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool wrongNumberOfCoords = false;
|
2004-08-08 14:05:35 +00:00
|
|
|
PRInt32 flag = nsIScriptError::warningFlag;
|
|
|
|
if (mNumCoords >= 3) {
|
|
|
|
if (mCoords[2] < 0) {
|
|
|
|
logMessage(mArea,
|
|
|
|
aSpec,
|
|
|
|
nsIScriptError::errorFlag,
|
2004-11-23 17:45:37 +00:00
|
|
|
"ImageMapCircleNegativeRadius");
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
2009-11-18 06:08:20 +00:00
|
|
|
|
2004-08-08 14:05:35 +00:00
|
|
|
if (mNumCoords > 3) {
|
2011-10-17 14:59:28 +00:00
|
|
|
wrongNumberOfCoords = true;
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
wrongNumberOfCoords = true;
|
2004-08-08 14:05:35 +00:00
|
|
|
flag = nsIScriptError::errorFlag;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wrongNumberOfCoords) {
|
|
|
|
logMessage(mArea,
|
|
|
|
aSpec,
|
|
|
|
flag,
|
2004-11-23 17:45:37 +00:00
|
|
|
"ImageMapCircleWrongNumberOfCoords");
|
2004-08-08 14:05:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool CircleArea::IsInside(nscoord x, nscoord y) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-09-07 00:20:35 +00:00
|
|
|
// Note: > is for nav compatibility
|
1998-04-13 20:24:54 +00:00
|
|
|
if (mNumCoords >= 3) {
|
|
|
|
nscoord x1 = mCoords[0];
|
|
|
|
nscoord y1 = mCoords[1];
|
|
|
|
nscoord radius = mCoords[2];
|
|
|
|
if (radius < 0) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
nscoord dx = x1 - x;
|
|
|
|
nscoord dy = y1 - y;
|
|
|
|
nscoord dist = (dx * dx) + (dy * dy);
|
|
|
|
if (dist <= (radius * radius)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void CircleArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
|
|
|
if (mHasFocus) {
|
|
|
|
if (mNumCoords >= 3) {
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
|
|
|
nscoord radius = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
if (radius < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nscoord x = x1 - radius;
|
|
|
|
nscoord y = y1 - radius;
|
|
|
|
nscoord w = 2 * radius;
|
|
|
|
aRC.DrawEllipse(x, y, w, w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-07 14:44:04 +00:00
|
|
|
void CircleArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
if (mNumCoords >= 3) {
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
|
|
|
nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
|
|
|
nscoord radius = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
|
1998-04-13 20:24:54 +00:00
|
|
|
if (radius < 0) {
|
|
|
|
return;
|
|
|
|
}
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
|
2002-12-12 23:22:17 +00:00
|
|
|
aRect.SetRect(x1 - radius, y1 - radius, x1 + radius, y1 + radius);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2003-07-28 21:25:13 +00:00
|
|
|
nsImageMap::nsImageMap() :
|
2012-07-30 14:20:58 +00:00
|
|
|
mImageFrame(nullptr),
|
2011-10-17 14:59:28 +00:00
|
|
|
mContainsBlockContents(false)
|
1999-01-09 00:13:53 +00:00
|
|
|
{
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
nsImageMap::~nsImageMap()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2009-02-03 14:42:18 +00:00
|
|
|
NS_ASSERTION(mAreas.Length() == 0, "Destroy was not called");
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-06-28 17:59:14 +00:00
|
|
|
NS_IMPL_ISUPPORTS2(nsImageMap,
|
2006-07-02 07:23:10 +00:00
|
|
|
nsIMutationObserver,
|
2011-04-27 05:51:13 +00:00
|
|
|
nsIDOMEventListener)
|
1999-01-09 00:13:53 +00:00
|
|
|
|
2011-04-27 05:51:13 +00:00
|
|
|
nsresult
|
2009-11-18 06:08:20 +00:00
|
|
|
nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
|
2009-12-24 21:20:05 +00:00
|
|
|
nsRect& aBounds)
|
2002-08-17 01:46:58 +00:00
|
|
|
{
|
2011-11-27 19:27:10 +00:00
|
|
|
NS_ENSURE_TRUE(aContent && mImageFrame, NS_ERROR_INVALID_ARG);
|
2008-08-07 14:44:04 +00:00
|
|
|
|
2002-08-17 01:46:58 +00:00
|
|
|
// Find the Area struct associated with this content node, and return bounds
|
2009-02-03 14:42:18 +00:00
|
|
|
PRUint32 i, n = mAreas.Length();
|
2002-08-17 01:46:58 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2009-02-03 14:42:18 +00:00
|
|
|
Area* area = mAreas.ElementAt(i);
|
2002-08-17 01:46:58 +00:00
|
|
|
if (area->mArea == aContent) {
|
2008-08-07 14:44:04 +00:00
|
|
|
aBounds = nsRect();
|
2011-11-27 19:27:10 +00:00
|
|
|
area->GetRect(mImageFrame, aBounds);
|
2002-08-17 01:46:58 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
void
|
|
|
|
nsImageMap::FreeAreas()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2009-02-03 14:42:18 +00:00
|
|
|
PRUint32 i, n = mAreas.Length();
|
1998-04-13 20:24:54 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2009-02-03 14:42:18 +00:00
|
|
|
Area* area = mAreas.ElementAt(i);
|
2012-03-14 20:14:02 +00:00
|
|
|
if (area->mArea->IsInDoc()) {
|
|
|
|
NS_ASSERTION(area->mArea->GetPrimaryFrame() == mImageFrame,
|
|
|
|
"Unexpected primary frame");
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
area->mArea->SetPrimaryFrame(nullptr);
|
2012-03-14 20:14:02 +00:00
|
|
|
}
|
2005-03-28 23:03:47 +00:00
|
|
|
|
2011-11-26 01:33:09 +00:00
|
|
|
area->mArea->RemoveSystemEventListener(NS_LITERAL_STRING("focus"), this,
|
|
|
|
false);
|
|
|
|
area->mArea->RemoveSystemEventListener(NS_LITERAL_STRING("blur"), this,
|
|
|
|
false);
|
1998-04-13 20:24:54 +00:00
|
|
|
delete area;
|
|
|
|
}
|
1999-01-09 00:13:53 +00:00
|
|
|
mAreas.Clear();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
nsresult
|
2011-10-29 10:44:50 +00:00
|
|
|
nsImageMap::Init(nsImageFrame* aImageFrame, nsIContent* aMap)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2011-05-30 11:35:45 +00:00
|
|
|
NS_PRECONDITION(aMap, "null ptr");
|
|
|
|
if (!aMap) {
|
1999-01-09 00:13:53 +00:00
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2000-08-18 06:27:42 +00:00
|
|
|
mImageFrame = aImageFrame;
|
2002-12-12 23:22:17 +00:00
|
|
|
|
2011-05-30 11:35:45 +00:00
|
|
|
mMap = aMap;
|
2006-07-02 07:23:10 +00:00
|
|
|
mMap->AddMutationObserver(this);
|
1999-01-09 00:13:53 +00:00
|
|
|
|
|
|
|
// "Compile" the areas in the map into faster access versions
|
2006-07-02 07:23:10 +00:00
|
|
|
return UpdateAreas();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-03-01 16:57:35 +00:00
|
|
|
|
|
|
|
nsresult
|
2011-09-29 06:19:26 +00:00
|
|
|
nsImageMap::SearchForAreas(nsIContent* aParent, bool& aFoundArea,
|
|
|
|
bool& aFoundAnchor)
|
1999-03-01 16:57:35 +00:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
2003-09-27 04:18:26 +00:00
|
|
|
PRUint32 i, n = aParent->GetChildCount();
|
|
|
|
|
2005-11-10 15:51:10 +00:00
|
|
|
// Look for <area> or <a> elements. We'll use whichever type we find first.
|
|
|
|
for (i = 0; i < n; i++) {
|
2003-09-27 04:18:26 +00:00
|
|
|
nsIContent *child = aParent->GetChildAt(i);
|
|
|
|
|
2009-08-24 20:02:07 +00:00
|
|
|
if (child->IsHTML()) {
|
2005-11-10 15:51:10 +00:00
|
|
|
// If we haven't determined that the map element contains an
|
|
|
|
// <a> element yet, then look for <area>.
|
2006-12-26 17:47:52 +00:00
|
|
|
if (!aFoundAnchor && child->Tag() == nsGkAtoms::area) {
|
2011-10-17 14:59:28 +00:00
|
|
|
aFoundArea = true;
|
2005-11-10 15:51:10 +00:00
|
|
|
rv = AddArea(child);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2009-11-18 06:08:20 +00:00
|
|
|
|
2005-11-10 15:51:10 +00:00
|
|
|
// Continue to next child. This stops mContainsBlockContents from
|
|
|
|
// getting set. It also makes us ignore children of <area>s which
|
|
|
|
// is consistent with how we react to dynamic insertion of such
|
|
|
|
// children.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// If we haven't determined that the map element contains an
|
|
|
|
// <area> element yet, then look for <a>.
|
2006-12-26 17:47:52 +00:00
|
|
|
if (!aFoundArea && child->Tag() == nsGkAtoms::a) {
|
2011-10-17 14:59:28 +00:00
|
|
|
aFoundAnchor = true;
|
2005-11-10 15:51:10 +00:00
|
|
|
rv = AddArea(child);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
2003-09-27 04:18:26 +00:00
|
|
|
}
|
2009-11-18 06:08:20 +00:00
|
|
|
|
2010-04-30 13:12:06 +00:00
|
|
|
if (child->IsElement()) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mContainsBlockContents = true;
|
2005-11-10 15:51:10 +00:00
|
|
|
rv = SearchForAreas(child, aFoundArea, aFoundAnchor);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
1999-03-01 16:57:35 +00:00
|
|
|
}
|
|
|
|
}
|
2005-11-10 15:51:10 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1999-03-01 16:57:35 +00:00
|
|
|
}
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
nsresult
|
|
|
|
nsImageMap::UpdateAreas()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-01-09 00:13:53 +00:00
|
|
|
// Get rid of old area data
|
|
|
|
FreeAreas();
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool foundArea = false;
|
|
|
|
bool foundAnchor = false;
|
2011-10-17 14:59:28 +00:00
|
|
|
mContainsBlockContents = false;
|
1999-03-01 16:57:35 +00:00
|
|
|
|
2012-03-15 20:16:02 +00:00
|
|
|
nsresult rv = SearchForAreas(mMap, foundArea, foundAnchor);
|
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
nsAccessibilityService* accService = GetAccService();
|
|
|
|
if (accService) {
|
|
|
|
accService->UpdateImageMap(mImageFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return rv;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
nsresult
|
1999-03-01 16:57:35 +00:00
|
|
|
nsImageMap::AddArea(nsIContent* aArea)
|
|
|
|
{
|
2006-04-24 05:40:11 +00:00
|
|
|
static nsIContent::AttrValuesArray strings[] =
|
2010-07-02 20:56:09 +00:00
|
|
|
{&nsGkAtoms::rect, &nsGkAtoms::rectangle,
|
|
|
|
&nsGkAtoms::circle, &nsGkAtoms::circ,
|
|
|
|
&nsGkAtoms::_default,
|
|
|
|
&nsGkAtoms::poly, &nsGkAtoms::polygon,
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr};
|
1999-01-09 00:13:53 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
Area* area;
|
2006-12-26 17:47:52 +00:00
|
|
|
switch (aArea->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::shape,
|
2006-04-24 05:40:11 +00:00
|
|
|
strings, eIgnoreCase)) {
|
2010-07-02 20:56:09 +00:00
|
|
|
case nsIContent::ATTR_VALUE_NO_MATCH:
|
|
|
|
case nsIContent::ATTR_MISSING:
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
area = new RectArea(aArea);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
area = new CircleArea(aArea);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
area = new DefaultArea(aArea);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
area = new PolyArea(aArea);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("FindAttrValueIn returned an unexpected value.");
|
|
|
|
break;
|
2002-08-27 20:49:54 +00:00
|
|
|
}
|
|
|
|
if (!area)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2005-03-28 23:03:47 +00:00
|
|
|
|
|
|
|
//Add focus listener to track area focus changes
|
2011-11-26 01:33:09 +00:00
|
|
|
aArea->AddSystemEventListener(NS_LITERAL_STRING("focus"), this, false,
|
|
|
|
false);
|
|
|
|
aArea->AddSystemEventListener(NS_LITERAL_STRING("blur"), this, false,
|
|
|
|
false);
|
2005-03-28 23:03:47 +00:00
|
|
|
|
2008-11-26 01:49:14 +00:00
|
|
|
// This is a nasty hack. It needs to go away: see bug 135040. Once this is
|
|
|
|
// removed, the code added to nsCSSFrameConstructor::RestyleElement,
|
|
|
|
// nsCSSFrameConstructor::ContentRemoved (both hacks there), and
|
|
|
|
// nsCSSFrameConstructor::ProcessRestyledFrames to work around this issue can
|
|
|
|
// be removed.
|
2009-12-24 21:20:05 +00:00
|
|
|
aArea->SetPrimaryFrame(mImageFrame);
|
2005-03-28 23:03:47 +00:00
|
|
|
|
2010-07-02 20:56:09 +00:00
|
|
|
nsAutoString coords;
|
|
|
|
aArea->GetAttr(kNameSpaceID_None, nsGkAtoms::coords, coords);
|
1999-01-09 00:13:53 +00:00
|
|
|
area->ParseCoords(coords);
|
1998-04-13 20:24:54 +00:00
|
|
|
mAreas.AppendElement(area);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-10-30 19:51:19 +00:00
|
|
|
nsIContent*
|
|
|
|
nsImageMap::GetArea(nscoord aX, nscoord aY) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-12-12 23:22:17 +00:00
|
|
|
NS_ASSERTION(mMap, "Not initialized");
|
2009-02-03 14:42:18 +00:00
|
|
|
PRUint32 i, n = mAreas.Length();
|
1998-04-13 20:24:54 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2009-02-03 14:42:18 +00:00
|
|
|
Area* area = mAreas.ElementAt(i);
|
2000-02-11 01:24:59 +00:00
|
|
|
if (area->IsInside(aX, aY)) {
|
2011-10-30 19:51:19 +00:00
|
|
|
return area->mArea;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-15 20:16:02 +00:00
|
|
|
nsIContent*
|
|
|
|
nsImageMap::GetAreaAt(PRUint32 aIndex) const
|
|
|
|
{
|
|
|
|
return mAreas.ElementAt(aIndex)->mArea;
|
|
|
|
}
|
|
|
|
|
1999-01-09 00:13:53 +00:00
|
|
|
void
|
2011-04-08 01:04:40 +00:00
|
|
|
nsImageMap::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2009-02-03 14:42:18 +00:00
|
|
|
PRUint32 i, n = mAreas.Length();
|
1998-04-13 20:24:54 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2009-02-03 14:42:18 +00:00
|
|
|
Area* area = mAreas.ElementAt(i);
|
2008-08-07 14:44:04 +00:00
|
|
|
area->Draw(aFrame, aRC);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-24 00:46:17 +00:00
|
|
|
void
|
|
|
|
nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
|
|
|
|
{
|
2006-07-02 07:23:10 +00:00
|
|
|
if (aContent == mMap || mContainsBlockContents) {
|
2004-01-24 00:46:17 +00:00
|
|
|
UpdateAreas();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-08-24 07:05:56 +00:00
|
|
|
nsImageMap::AttributeChanged(nsIDocument* aDocument,
|
|
|
|
dom::Element* aElement,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType)
|
1999-01-09 00:13:53 +00:00
|
|
|
{
|
|
|
|
// If the parent of the changing content node is our map then update
|
2005-08-16 04:47:36 +00:00
|
|
|
// the map. But only do this if the node is an HTML <area> or <a>
|
|
|
|
// and the attribute that's changing is "shape" or "coords" -- those
|
|
|
|
// are the only cases we care about.
|
2010-08-24 07:05:56 +00:00
|
|
|
if ((aElement->NodeInfo()->Equals(nsGkAtoms::area) ||
|
|
|
|
aElement->NodeInfo()->Equals(nsGkAtoms::a)) &&
|
|
|
|
aElement->IsHTML() &&
|
2005-08-16 04:47:36 +00:00
|
|
|
aNameSpaceID == kNameSpaceID_None &&
|
2006-12-26 17:47:52 +00:00
|
|
|
(aAttribute == nsGkAtoms::shape ||
|
|
|
|
aAttribute == nsGkAtoms::coords)) {
|
2010-08-24 07:05:56 +00:00
|
|
|
MaybeUpdateAreas(aElement->GetParent());
|
2011-10-29 10:44:50 +00:00
|
|
|
} else if (aElement == mMap &&
|
|
|
|
aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aAttribute == nsGkAtoms::name ||
|
|
|
|
aAttribute == nsGkAtoms::id) &&
|
|
|
|
mImageFrame) {
|
|
|
|
// ID or name has changed. Let ImageFrame recreate ImageMap.
|
|
|
|
mImageFrame->DisconnectMap();
|
2005-08-16 04:47:36 +00:00
|
|
|
}
|
1999-01-09 00:13:53 +00:00
|
|
|
}
|
|
|
|
|
2004-01-24 00:46:17 +00:00
|
|
|
void
|
1999-01-09 00:13:53 +00:00
|
|
|
nsImageMap::ContentAppended(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
2010-05-11 01:12:34 +00:00
|
|
|
nsIContent* aFirstNewContent,
|
|
|
|
PRInt32 /* unused */)
|
1999-01-09 00:13:53 +00:00
|
|
|
{
|
2004-01-24 00:46:17 +00:00
|
|
|
MaybeUpdateAreas(aContainer);
|
1999-01-09 00:13:53 +00:00
|
|
|
}
|
|
|
|
|
2004-01-24 00:46:17 +00:00
|
|
|
void
|
1999-01-09 00:13:53 +00:00
|
|
|
nsImageMap::ContentInserted(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
2010-05-11 01:12:34 +00:00
|
|
|
PRInt32 /* unused */)
|
1999-01-09 00:13:53 +00:00
|
|
|
{
|
2004-01-24 00:46:17 +00:00
|
|
|
MaybeUpdateAreas(aContainer);
|
1999-01-09 00:13:53 +00:00
|
|
|
}
|
|
|
|
|
2004-01-24 00:46:17 +00:00
|
|
|
void
|
1999-01-09 00:13:53 +00:00
|
|
|
nsImageMap::ContentRemoved(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
2010-07-21 22:05:17 +00:00
|
|
|
PRInt32 aIndexInContainer,
|
|
|
|
nsIContent* aPreviousSibling)
|
1999-01-09 00:13:53 +00:00
|
|
|
{
|
2004-01-24 00:46:17 +00:00
|
|
|
MaybeUpdateAreas(aContainer);
|
1999-01-09 00:13:53 +00:00
|
|
|
}
|
|
|
|
|
2011-10-29 10:44:50 +00:00
|
|
|
void
|
|
|
|
nsImageMap::ParentChainChanged(nsIContent* aContent)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aContent == mMap,
|
|
|
|
"Unexpected ParentChainChanged notification!");
|
|
|
|
if (mImageFrame) {
|
|
|
|
mImageFrame->DisconnectMap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
nsresult
|
2011-06-28 17:59:14 +00:00
|
|
|
nsImageMap::HandleEvent(nsIDOMEvent* aEvent)
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
{
|
2011-06-28 17:59:14 +00:00
|
|
|
nsAutoString eventType;
|
|
|
|
aEvent->GetType(eventType);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool focus = eventType.EqualsLiteral("focus");
|
2011-06-28 17:59:14 +00:00
|
|
|
NS_ABORT_IF_FALSE(focus == !eventType.EqualsLiteral("blur"),
|
|
|
|
"Unexpected event type");
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
|
|
|
|
//Set which one of our areas changed focus
|
|
|
|
nsCOMPtr<nsIDOMEventTarget> target;
|
|
|
|
if (NS_SUCCEEDED(aEvent->GetTarget(getter_AddRefs(target))) && target) {
|
|
|
|
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(target));
|
|
|
|
if (targetContent) {
|
2009-02-03 14:42:18 +00:00
|
|
|
PRUint32 i, n = mAreas.Length();
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2009-02-03 14:42:18 +00:00
|
|
|
Area* area = mAreas.ElementAt(i);
|
2009-12-29 20:13:54 +00:00
|
|
|
if (area->mArea == targetContent) {
|
2008-08-04 12:45:38 +00:00
|
|
|
//Set or Remove internal focus
|
2011-06-28 17:59:14 +00:00
|
|
|
area->HasFocus(focus);
|
2008-08-04 12:45:38 +00:00
|
|
|
//Now invalidate the rect
|
2011-11-27 19:27:10 +00:00
|
|
|
if (mImageFrame) {
|
2012-07-04 00:24:55 +00:00
|
|
|
nsRect dmgRect;
|
|
|
|
area->GetRect(mImageFrame, dmgRect);
|
|
|
|
mImageFrame->Invalidate(dmgRect);
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
}
|
2008-08-04 12:45:38 +00:00
|
|
|
break;
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-12 00:38:22 +00:00
|
|
|
void
|
|
|
|
nsImageMap::Destroy(void)
|
|
|
|
{
|
2005-03-28 23:03:47 +00:00
|
|
|
FreeAreas();
|
2012-07-30 14:20:58 +00:00
|
|
|
mImageFrame = nullptr;
|
2006-07-02 07:23:10 +00:00
|
|
|
mMap->RemoveMutationObserver(this);
|
2000-08-12 00:38:22 +00:00
|
|
|
}
|