2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-01-09 03:18:08 +03:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-01-09 03:18:08 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-01-09 03:18:08 +03:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-01-09 03:18:08 +03:00
|
|
|
#ifndef nsImageMap_h___
|
|
|
|
#define nsImageMap_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsCoord.h"
|
|
|
|
#include "nsVoidArray.h"
|
2004-01-29 00:04:33 +03:00
|
|
|
#include "nsStubDocumentObserver.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 "nsIDOMFocusListener.h"
|
|
|
|
#include "nsIFrame.h"
|
2002-08-17 05:46:58 +04:00
|
|
|
#include "nsIImageMap.h"
|
2002-12-13 02:22:17 +03:00
|
|
|
#include "nsIHTMLContent.h"
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
class nsIDOMHTMLAreaElement;
|
|
|
|
class nsIDOMHTMLMapElement;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsIRenderingContext;
|
1999-06-23 07:29:44 +04:00
|
|
|
class nsIURI;
|
1999-01-09 03:18:08 +03:00
|
|
|
class nsString;
|
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
|
|
|
class nsIDOMEvent;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2004-01-29 00:04:33 +03:00
|
|
|
class nsImageMap : public nsStubDocumentObserver, public nsIDOMFocusListener,
|
2002-08-17 05:46:58 +04:00
|
|
|
public nsIImageMap
|
1999-01-09 03:18:08 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsImageMap();
|
|
|
|
|
2000-08-18 10:27:42 +04:00
|
|
|
nsresult Init(nsIPresShell* aPresShell, nsIFrame* aImageFrame, nsIDOMHTMLMapElement* aMap);
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See if the given aX,aY <b>pixel</b> coordinates are in the image
|
2004-02-20 22:00:43 +03:00
|
|
|
* map. If they are then PR_TRUE is returned and aContent points to the
|
|
|
|
* found area. If the coordinates are not in the map then PR_FALSE
|
2002-11-29 02:02:31 +03:00
|
|
|
* is returned.
|
1999-01-09 03:18:08 +03:00
|
|
|
*/
|
|
|
|
PRBool IsInside(nscoord aX, nscoord aY,
|
2004-02-20 22:00:43 +03:00
|
|
|
nsIContent** aContent) const;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See if the given aX,aY <b>pixel</b> coordinates are in the image
|
2004-02-20 22:00:43 +03:00
|
|
|
* map.
|
1999-01-09 03:18:08 +03:00
|
|
|
*/
|
2002-12-13 02:22:17 +03:00
|
|
|
PRBool IsInside(nscoord aX, nscoord aY) const;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void Draw(nsIPresContext* aCX, nsIRenderingContext& 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.
|
|
|
|
*/
|
|
|
|
void Destroy(void);
|
|
|
|
|
1999-01-09 03:18:08 +03:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIDocumentObserver
|
2004-01-29 00:04:33 +03:00
|
|
|
virtual void AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
|
|
|
|
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType);
|
|
|
|
virtual void ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
|
|
|
|
PRInt32 aNewIndexInContainer);
|
|
|
|
virtual void ContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
|
|
|
|
nsIContent* aChild, PRInt32 aIndexInContainer);
|
|
|
|
virtual void ContentRemoved(nsIDocument* aDocument, nsIContent* aContainer,
|
|
|
|
nsIContent* aChild, PRInt32 aIndexInContainer);
|
1999-01-09 03:18:08 +03: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-09 01:31:05 +04:00
|
|
|
//nsIDOMFocusListener
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
|
|
|
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
|
|
|
NS_IMETHOD 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-09 01:31:05 +04:00
|
|
|
|
2002-08-17 05:46:58 +04:00
|
|
|
//nsIImageMap
|
|
|
|
NS_IMETHOD GetBoundsForAreaContent(nsIContent *aContent,
|
|
|
|
nsIPresContext* aPresContext,
|
|
|
|
nsRect& aBounds);
|
|
|
|
|
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();
|
2001-04-01 04:45:59 +04:00
|
|
|
nsresult UpdateAreasForBlock(nsIContent* aParent, PRBool* aFoundAnchor);
|
1999-01-09 03:18:08 +03:00
|
|
|
|
1999-03-01 19:57:35 +03:00
|
|
|
static PRBool IsAncestorOf(nsIContent* aContent,
|
|
|
|
nsIContent* aAncestorContent);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);
|
1999-01-09 03:18:08 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
void MaybeUpdateAreas(nsIContent *aContent);
|
|
|
|
|
2000-08-18 10:27:42 +04:00
|
|
|
nsIPresShell* mPresShell; // WEAK - owns the frame that owns us
|
|
|
|
nsIFrame* mImageFrame; // the frame that owns us
|
2000-08-11 06:11:53 +04:00
|
|
|
nsIDocument* mDocument; // WEAK - the imagemap will not outlive the document
|
2002-12-13 02:22:17 +03:00
|
|
|
nsCOMPtr<nsIHTMLContent> mMap;
|
2001-09-07 01:11:44 +04:00
|
|
|
nsAutoVoidArray mAreas; // almost always has some entries
|
1999-03-01 19:57:35 +03:00
|
|
|
PRBool mContainsBlockContents;
|
1999-01-09 03:18:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsImageMap_h___ */
|