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 ***** */
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* See if the given aX,aY <b>pixel</b> coordinates are in the image
|
2011-10-17 18:59:28 +04:00
|
|
|
* map. If they are then true is returned and aContent points to the
|
|
|
|
* found area. If the coordinates are not in the map then false
|
2002-11-29 02:02:31 +03:00
|
|
|
* is returned.
|
1999-01-09 03:18:08 +03:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsInside(nscoord aX, nscoord aY,
|
2004-02-20 22:00:43 +03:00
|
|
|
nsIContent** aContent) const;
|
1999-01-09 03:18:08 +03:00
|
|
|
|
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 */
|