2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-11-17 02:23:22 +00:00
|
|
|
/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
|
2001-09-25 01:32:19 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-08-29 03:13:29 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00: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/
|
1998-08-29 03:13:29 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00: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.
|
1998-08-29 03:13:29 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 01:32:19 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* Contributor(s):
|
2002-02-21 23:21:17 +00:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00: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-25 01:32:19 +00: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-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 01:32:19 +00: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-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2009-08-27 18:05:23 +00:00
|
|
|
|
2011-08-11 13:29:50 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsIDOMHTMLAnchorElement.h"
|
|
|
|
#include "nsILink.h"
|
|
|
|
#include "Link.h"
|
|
|
|
|
2000-05-31 00:48:02 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
#include "nsContentUtils.h"
|
2001-09-29 08:28:41 +00:00
|
|
|
#include "nsReadableUtils.h"
|
2001-10-13 00:16:32 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2009-08-27 18:05:23 +00:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsIDocument.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2008-11-07 23:00:26 +00:00
|
|
|
#include "nsHTMLDNSPrefetch.h"
|
2011-08-17 22:14:53 +00:00
|
|
|
#include "nsDOMMemoryReporter.h"
|
2008-11-07 23:00:26 +00:00
|
|
|
|
2009-10-13 22:13:41 +00:00
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2008-02-21 20:39:20 +00:00
|
|
|
class nsHTMLAnchorElement : public nsGenericHTMLElement,
|
|
|
|
public nsIDOMHTMLAnchorElement,
|
2009-10-13 22:13:41 +00:00
|
|
|
public nsILink,
|
|
|
|
public Link
|
2008-02-21 20:39:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-07-30 23:48:57 +00:00
|
|
|
using nsGenericElement::GetText;
|
|
|
|
using nsGenericElement::SetText;
|
|
|
|
|
2010-07-23 09:49:57 +00:00
|
|
|
nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
2008-02-21 20:39:20 +00:00
|
|
|
virtual ~nsHTMLAnchorElement();
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMNode
|
|
|
|
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
|
|
|
|
|
|
|
|
// nsIDOMElement
|
|
|
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
|
|
|
|
|
|
|
|
// nsIDOMHTMLElement
|
2011-10-29 20:03:55 +00:00
|
|
|
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD Click() {
|
|
|
|
return nsGenericHTMLElement::Click();
|
|
|
|
}
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD Focus() {
|
|
|
|
return nsGenericHTMLElement::Focus();
|
|
|
|
}
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable);
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
|
|
|
|
return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
|
|
|
|
}
|
|
|
|
NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
|
|
|
|
return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
|
|
|
|
}
|
2008-02-21 20:39:20 +00:00
|
|
|
|
|
|
|
// nsIDOMHTMLAnchorElement
|
|
|
|
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
|
|
|
|
2011-08-17 22:14:53 +00:00
|
|
|
// TODO: we do not really count Link::mCachedURI but given that it's a
|
|
|
|
// nsCOMPtr<nsIURI>, that would be required adding SizeOf() to the interface.
|
|
|
|
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsHTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2008-02-21 20:39:20 +00:00
|
|
|
// nsILink
|
|
|
|
NS_IMETHOD LinkAdded() { return NS_OK; }
|
|
|
|
NS_IMETHOD LinkRemoved() { return NS_OK; }
|
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCompileEventHandlers);
|
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
|
|
|
bool aNullParent = true);
|
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
|
2008-02-21 20:39:20 +00:00
|
|
|
|
|
|
|
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
|
|
|
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsLink(nsIURI** aURI) const;
|
2008-02-21 20:39:20 +00:00
|
|
|
virtual void GetLinkTarget(nsAString& aTarget);
|
2009-07-13 11:48:06 +00:00
|
|
|
virtual nsLinkState GetLinkState() const;
|
2011-06-01 01:46:57 +00:00
|
|
|
virtual void RequestLinkStateUpdate();
|
2009-07-13 11:48:06 +00:00
|
|
|
virtual already_AddRefed<nsIURI> GetHrefURI() const;
|
2008-02-21 20:39:20 +00:00
|
|
|
|
|
|
|
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
2011-09-29 06:19:26 +00:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2008-02-21 20:39:20 +00:00
|
|
|
{
|
|
|
|
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
|
|
|
|
}
|
|
|
|
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify);
|
2008-02-21 20:39:20 +00:00
|
|
|
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify);
|
|
|
|
virtual bool ParseAttribute(PRInt32 aNamespaceID,
|
2009-03-10 13:51:34 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult);
|
2008-02-21 20:39:20 +00:00
|
|
|
|
|
|
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
|
|
|
|
2010-10-20 11:26:32 +00:00
|
|
|
virtual nsEventStates IntrinsicState() const;
|
2010-07-23 09:49:57 +00:00
|
|
|
|
|
|
|
virtual nsXPCClassInfo* GetClassInfo();
|
2008-02-21 20:39:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-18 20:58:12 +00:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
|
1998-08-29 03:13:29 +00:00
|
|
|
|
2010-07-23 09:49:57 +00:00
|
|
|
nsHTMLAnchorElement::nsHTMLAnchorElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
2011-10-26 12:13:07 +00:00
|
|
|
: nsGenericHTMLElement(aNodeInfo),
|
|
|
|
Link(this)
|
1998-08-29 03:13:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-09-02 23:53:16 +00:00
|
|
|
nsHTMLAnchorElement::~nsHTMLAnchorElement()
|
1998-08-29 03:13:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
|
|
|
|
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 16:46:42 +00:00
|
|
|
|
2010-07-23 09:49:57 +00:00
|
|
|
DOMCI_NODE_DATA(HTMLAnchorElement, nsHTMLAnchorElement)
|
2010-01-12 13:08:43 +00:00
|
|
|
|
2008-02-21 20:39:20 +00:00
|
|
|
// QueryInterface implementation for nsHTMLAnchorElement
|
2008-11-03 10:31:47 +00:00
|
|
|
NS_INTERFACE_TABLE_HEAD(nsHTMLAnchorElement)
|
2010-08-05 02:40:17 +00:00
|
|
|
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLAnchorElement,
|
2008-11-03 10:31:47 +00:00
|
|
|
nsIDOMHTMLAnchorElement,
|
2010-02-24 16:37:03 +00:00
|
|
|
nsILink,
|
|
|
|
Link)
|
2008-11-03 10:31:47 +00:00
|
|
|
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement)
|
2008-02-21 20:39:20 +00:00
|
|
|
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAnchorElement)
|
|
|
|
|
|
|
|
|
2006-09-05 10:22:54 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(nsHTMLAnchorElement)
|
1998-08-29 03:13:29 +00:00
|
|
|
|
2008-02-21 20:39:20 +00:00
|
|
|
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
|
2003-07-08 05:35:04 +00:00
|
|
|
NS_IMPL_URI_ATTR(nsHTMLAnchorElement, Href, href)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Hreflang, hreflang)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Name, name)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
|
2010-10-19 05:53:15 +00:00
|
|
|
NS_IMPL_INT_ATTR(nsHTMLAnchorElement, TabIndex, tabindex)
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
|
1998-08-29 03:13:29 +00:00
|
|
|
|
2008-08-27 12:07:27 +00:00
|
|
|
NS_IMETHODIMP
|
2011-09-29 06:19:26 +00:00
|
|
|
nsHTMLAnchorElement::GetDraggable(bool* aDraggable)
|
2008-08-27 12:07:27 +00:00
|
|
|
{
|
|
|
|
// links can be dragged as long as there is an href and the
|
|
|
|
// draggable attribute isn't false
|
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
|
|
|
*aDraggable = !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
|
|
|
nsGkAtoms::_false, eIgnoreCase);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// no href, so just use the same behavior as other elements
|
|
|
|
return nsGenericHTMLElement::GetDraggable(aDraggable);
|
|
|
|
}
|
2000-05-17 03:11:47 +00:00
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
nsresult
|
|
|
|
nsHTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCompileEventHandlers)
|
2000-05-17 03:11:47 +00:00
|
|
|
{
|
2010-02-24 16:37:03 +00:00
|
|
|
Link::ResetLinkState(false);
|
2009-11-23 18:48:52 +00:00
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2008-12-05 20:53:24 +00:00
|
|
|
// Prefetch links
|
2011-10-18 10:53:36 +00:00
|
|
|
if (aDocument && nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
|
2009-01-12 15:36:55 +00:00
|
|
|
nsHTMLDNSPrefetch::PrefetchLow(this);
|
2008-12-05 20:53:24 +00:00
|
|
|
}
|
2005-04-05 23:54:35 +00:00
|
|
|
return rv;
|
|
|
|
}
|
2000-05-17 03:11:47 +00:00
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
void
|
2011-09-29 06:19:26 +00:00
|
|
|
nsHTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2005-04-05 23:54:35 +00:00
|
|
|
{
|
2009-11-23 18:48:52 +00:00
|
|
|
// If this link is ever reinserted into a document, it might
|
|
|
|
// be under a different xml:base, so forget the cached state now.
|
2010-02-24 16:37:03 +00:00
|
|
|
Link::ResetLinkState(false);
|
2009-11-23 18:48:52 +00:00
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
2000-05-17 03:11:47 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
|
|
|
nsHTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
|
|
|
bool *aIsFocusable, PRInt32 *aTabIndex)
|
1999-03-02 19:19:24 +00:00
|
|
|
{
|
2010-06-21 12:37:34 +00:00
|
|
|
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2008-04-15 18:40:38 +00:00
|
|
|
}
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 18:00:39 +00:00
|
|
|
// cannot focus links if there is no link handler
|
|
|
|
nsIDocument* doc = GetCurrentDoc();
|
|
|
|
if (doc) {
|
2010-06-25 13:59:57 +00:00
|
|
|
nsIPresShell* presShell = doc->GetShell();
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 18:00:39 +00:00
|
|
|
if (presShell) {
|
|
|
|
nsPresContext* presContext = presShell->GetPresContext();
|
|
|
|
if (presContext && !presContext->GetLinkHandler()) {
|
2011-10-17 14:59:28 +00:00
|
|
|
*aIsFocusable = false;
|
|
|
|
return false;
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 18:00:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-15 18:40:38 +00:00
|
|
|
if (IsEditable()) {
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = -1;
|
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
*aIsFocusable = false;
|
2008-04-15 18:40:38 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2004-01-09 23:54:21 +00:00
|
|
|
}
|
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
|
2004-10-07 01:15:40 +00:00
|
|
|
// check whether we're actually a link
|
2007-01-04 10:53:59 +00:00
|
|
|
nsCOMPtr<nsIURI> absURI;
|
|
|
|
if (!IsLink(getter_AddRefs(absURI))) {
|
2004-10-07 01:15:40 +00:00
|
|
|
// Not tabbable or focusable without href (bug 17605), unless
|
|
|
|
// forced to be via presence of nonnegative tabindex attribute
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = -1;
|
|
|
|
}
|
2008-04-15 18:40:38 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
*aIsFocusable = false;
|
2008-04-15 18:40:38 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2004-07-24 21:12:43 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-08 01:46:00 +00:00
|
|
|
|
2004-07-24 21:12:43 +00:00
|
|
|
if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) {
|
|
|
|
*aTabIndex = -1;
|
2000-09-08 01:46:00 +00:00
|
|
|
}
|
2004-07-24 21:12:43 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
*aIsFocusable = true;
|
2008-04-15 18:40:38 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1999-03-02 19:19:24 +00:00
|
|
|
}
|
|
|
|
|
2007-04-23 07:31:21 +00:00
|
|
|
nsresult
|
|
|
|
nsHTMLAnchorElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|
|
|
{
|
|
|
|
return PreHandleEventForAnchors(aVisitor);
|
|
|
|
}
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
2006-03-07 17:08:51 +00:00
|
|
|
nsHTMLAnchorElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
1998-08-29 03:13:29 +00:00
|
|
|
{
|
2006-03-07 17:08:51 +00:00
|
|
|
return PostHandleEventForAnchors(aVisitor);
|
1998-08-29 03:13:29 +00:00
|
|
|
}
|
1998-12-10 23:52:46 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2007-01-04 10:53:59 +00:00
|
|
|
nsHTMLAnchorElement::IsLink(nsIURI** aURI) const
|
|
|
|
{
|
|
|
|
return IsHTMLLink(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
|
|
|
|
{
|
2007-03-26 13:19:33 +00:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
|
|
|
|
if (aTarget.IsEmpty()) {
|
|
|
|
GetBaseTarget(aTarget);
|
|
|
|
}
|
2007-01-04 10:53:59 +00:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:57:02 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 23:04:39 +00:00
|
|
|
nsHTMLAnchorElement::GetTarget(nsAString& aValue)
|
2001-04-12 06:57:02 +00:00
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
|
2004-02-20 19:00:43 +00:00
|
|
|
GetBaseTarget(aValue);
|
2001-04-12 06:57:02 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 23:04:39 +00:00
|
|
|
nsHTMLAnchorElement::SetTarget(const nsAString& aValue)
|
2001-04-12 06:57:02 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, true);
|
2001-04-12 06:57:02 +00:00
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2009-03-10 02:32:09 +00:00
|
|
|
#define IMPL_URI_PART(_part) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
nsHTMLAnchorElement::Get##_part(nsAString& a##_part) \
|
|
|
|
{ \
|
2009-11-09 18:00:54 +00:00
|
|
|
return Link::Get##_part(a##_part); \
|
2009-03-10 02:32:09 +00:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
nsHTMLAnchorElement::Set##_part(const nsAString& a##_part) \
|
|
|
|
{ \
|
2009-11-09 18:00:54 +00:00
|
|
|
return Link::Set##_part(a##_part); \
|
2009-03-10 02:32:09 +00:00
|
|
|
}
|
2001-11-17 02:23:22 +00:00
|
|
|
|
2009-03-10 02:32:09 +00:00
|
|
|
IMPL_URI_PART(Protocol)
|
|
|
|
IMPL_URI_PART(Host)
|
|
|
|
IMPL_URI_PART(Hostname)
|
|
|
|
IMPL_URI_PART(Pathname)
|
|
|
|
IMPL_URI_PART(Search)
|
|
|
|
IMPL_URI_PART(Port)
|
|
|
|
IMPL_URI_PART(Hash)
|
2001-11-17 02:23:22 +00:00
|
|
|
|
2009-03-10 02:32:09 +00:00
|
|
|
#undef IMPL_URI_PART
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 13:27:00 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 23:04:39 +00:00
|
|
|
nsHTMLAnchorElement::GetText(nsAString& aText)
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 13:27:00 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsContentUtils::GetNodeTextContent(this, true, aText);
|
2000-08-18 07:46:58 +00:00
|
|
|
return NS_OK;
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 13:27:00 +00:00
|
|
|
}
|
|
|
|
|
2010-07-30 23:48:57 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLAnchorElement::SetText(const nsAString& aText)
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return nsContentUtils::SetNodeTextContent(this, aText, false);
|
2010-07-30 23:48:57 +00:00
|
|
|
}
|
|
|
|
|
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 16:46:42 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 23:04:39 +00:00
|
|
|
nsHTMLAnchorElement::ToString(nsAString& aSource)
|
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 16:46:42 +00:00
|
|
|
{
|
|
|
|
return GetHref(aSource);
|
|
|
|
}
|
|
|
|
|
2006-01-24 05:48:32 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLAnchorElement::GetPing(nsAString& aValue)
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return GetURIListAttr(nsGkAtoms::ping, aValue);
|
2006-01-24 05:48:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLAnchorElement::SetPing(const nsAString& aValue)
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
|
2006-01-24 05:48:32 +00:00
|
|
|
}
|
|
|
|
|
2009-07-13 11:48:06 +00:00
|
|
|
nsLinkState
|
|
|
|
nsHTMLAnchorElement::GetLinkState() const
|
2000-07-27 23:17:53 +00:00
|
|
|
{
|
2009-10-13 22:13:41 +00:00
|
|
|
return Link::GetLinkState();
|
2000-07-27 23:17:53 +00:00
|
|
|
}
|
|
|
|
|
2011-06-01 01:46:57 +00:00
|
|
|
void
|
|
|
|
nsHTMLAnchorElement::RequestLinkStateUpdate()
|
|
|
|
{
|
|
|
|
UpdateLinkState(Link::LinkState());
|
|
|
|
}
|
|
|
|
|
2009-07-13 11:48:06 +00:00
|
|
|
already_AddRefed<nsIURI>
|
|
|
|
nsHTMLAnchorElement::GetHrefURI() const
|
2003-06-17 16:22:51 +00:00
|
|
|
{
|
2009-07-13 11:48:06 +00:00
|
|
|
return GetHrefURIForAnchors();
|
2000-07-27 23:17:53 +00:00
|
|
|
}
|
2002-02-21 23:21:17 +00:00
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
2002-02-21 23:21:17 +00:00
|
|
|
nsHTMLAnchorElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
2004-01-15 17:07:27 +00:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify)
|
2002-02-21 23:21:17 +00:00
|
|
|
{
|
2010-02-24 16:37:38 +00:00
|
|
|
bool reset = false;
|
2006-12-26 17:47:52 +00:00
|
|
|
if (aName == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
2010-06-16 16:59:26 +00:00
|
|
|
// If we do not have a cached URI, we have some value here so we must reset
|
|
|
|
// our link state after calling the parent.
|
|
|
|
if (!Link::HasCachedURI()) {
|
2010-02-24 16:37:38 +00:00
|
|
|
reset = true;
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
2010-06-16 16:59:26 +00:00
|
|
|
// However, if we have a cached URI, we'll want to see if the value changed.
|
|
|
|
else {
|
|
|
|
nsAutoString val;
|
|
|
|
GetHref(val);
|
|
|
|
if (!val.Equals(aValue)) {
|
|
|
|
reset = true;
|
|
|
|
}
|
|
|
|
}
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
|
|
|
|
2004-01-15 17:07:27 +00:00
|
|
|
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
2002-05-22 00:14:51 +00:00
|
|
|
|
2010-02-24 16:37:38 +00:00
|
|
|
// The ordering of the parent class's SetAttr call and Link::ResetLinkState
|
|
|
|
// is important here! The attribute is not set until SetAttr returns, and
|
|
|
|
// we will need the updated attribute value because notifying the document
|
|
|
|
// that content states have changed will call IntrinsicState, which will try
|
|
|
|
// to get updated information about the visitedness from Link.
|
|
|
|
if (reset) {
|
|
|
|
Link::ResetLinkState(!!aNotify);
|
|
|
|
}
|
|
|
|
|
2002-05-22 00:14:51 +00:00
|
|
|
return rv;
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
|
|
|
nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify)
|
2002-02-21 23:21:17 +00:00
|
|
|
{
|
2010-03-03 20:55:35 +00:00
|
|
|
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute,
|
|
|
|
aNotify);
|
|
|
|
|
|
|
|
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
|
|
|
// is important here! The attribute is not unset until UnsetAttr returns, and
|
|
|
|
// we will need the updated attribute value because notifying the document
|
|
|
|
// that content states have changed will call IntrinsicState, which will try
|
|
|
|
// to get updated information about the visitedness from Link.
|
|
|
|
if (aAttribute == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
|
|
|
Link::ResetLinkState(!!aNotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
2009-03-10 13:51:34 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2009-03-10 13:51:34 +00:00
|
|
|
nsHTMLAnchorElement::ParseAttribute(PRInt32 aNamespaceID,
|
2009-11-09 18:00:54 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
2009-03-10 13:51:34 +00:00
|
|
|
{
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
|
|
|
}
|
|
|
|
|
2010-10-20 11:26:32 +00:00
|
|
|
nsEventStates
|
2009-12-16 00:04:09 +00:00
|
|
|
nsHTMLAnchorElement::IntrinsicState() const
|
|
|
|
{
|
|
|
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
|
|
|
}
|
2011-08-17 22:14:53 +00:00
|
|
|
|