2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 22:29:03 +04:00
|
|
|
|
|
|
|
/* code for HTML client-side image maps */
|
|
|
|
|
2011-05-30 15:35:45 +04:00
|
|
|
#ifndef nsImageMap_h
|
|
|
|
#define nsImageMap_h
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsCoord.h"
|
2009-02-03 17:42:18 +03:00
|
|
|
#include "nsTArray.h"
|
2006-07-02 11:23:10 +04:00
|
|
|
#include "nsStubMutationObserver.h"
|
2011-06-28 21:59:14 +04:00
|
|
|
#include "nsIDOMEventListener.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-09 01:31:05 +04:00
|
|
|
#include "nsIFrame.h"
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2009-02-03 17:42:18 +03:00
|
|
|
class Area;
|
2011-05-30 15:35:45 +04:00
|
|
|
class nsIDOMEvent;
|
|
|
|
class nsRenderingContext;
|
2011-10-29 14:44:50 +04:00
|
|
|
class nsImageFrame;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2011-06-28 21:59:14 +04:00
|
|
|
class nsImageMap : public nsStubMutationObserver,
|
|
|
|
public nsIDOMEventListener
|
1999-01-09 03:18:08 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsImageMap();
|
|
|
|
|
2011-10-29 14:44:50 +04:00
|
|
|
nsresult Init(nsImageFrame* aImageFrame, nsIContent* aMap);
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
/**
|
2011-10-30 23:51:19 +04:00
|
|
|
* Return the first area element (in content order) for the given aX,aY pixel
|
|
|
|
* coordinate or nsnull if the coordinate is outside all areas.
|
1999-01-09 03:18:08 +03:00
|
|
|
*/
|
2011-10-30 23:51:19 +04:00
|
|
|
nsIContent* GetArea(nscoord aX, nscoord aY) const;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2012-03-16 00:16:02 +04:00
|
|
|
/**
|
|
|
|
* Return area elements count associated with the image map.
|
|
|
|
*/
|
|
|
|
PRUint32 AreaCount() const { return mAreas.Length(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return area element at the given index.
|
|
|
|
*/
|
|
|
|
nsIContent* GetAreaAt(PRUint32 aIndex) const;
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
|
2000-08-12 04:38:22 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called just before the nsImageFrame releases us.
|
|
|
|
* Used to break the cycle caused by the DOM listener.
|
|
|
|
*/
|
2011-05-30 15:35:45 +04:00
|
|
|
void Destroy();
|
2000-08-12 04:38:22 +04:00
|
|
|
|
1999-01-09 03:18:08 +03:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2006-07-02 11:23:10 +04:00
|
|
|
// nsIMutationObserver
|
2007-07-13 00:05:45 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
2011-10-29 14:44:50 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2011-06-28 21:59:14 +04:00
|
|
|
//nsIDOMEventListener
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
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-09 01:31:05 +04:00
|
|
|
|
2011-04-27 09:51:13 +04:00
|
|
|
nsresult GetBoundsForAreaContent(nsIContent *aContent,
|
|
|
|
nsRect& aBounds);
|
2002-08-17 05:46:58 +04:00
|
|
|
|
1999-01-09 03:18:08 +03:00
|
|
|
protected:
|
1999-02-12 20:45:58 +03:00
|
|
|
virtual ~nsImageMap();
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
void FreeAreas();
|
|
|
|
|
|
|
|
nsresult UpdateAreas();
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult SearchForAreas(nsIContent* aParent, bool& aFoundArea,
|
|
|
|
bool& aFoundAnchor);
|
1999-01-09 03:18:08 +03:00
|
|
|
|
1999-03-01 19:57:35 +03:00
|
|
|
nsresult AddArea(nsIContent* aArea);
|
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-09 01:31:05 +04:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
void MaybeUpdateAreas(nsIContent *aContent);
|
|
|
|
|
2011-10-29 14:44:50 +04:00
|
|
|
nsImageFrame* mImageFrame; // the frame that owns us
|
2005-01-12 22:45:38 +03:00
|
|
|
nsCOMPtr<nsIContent> mMap;
|
2009-02-03 17:42:18 +03:00
|
|
|
nsAutoTArray<Area*, 8> mAreas; // almost always has some entries
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mContainsBlockContents;
|
1999-01-09 03:18:08 +03:00
|
|
|
};
|
|
|
|
|
2011-05-30 15:35:45 +04:00
|
|
|
#endif /* nsImageMap_h */
|