2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2009-08-27 22:05:23 +04:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
#include "mozilla/dom/HTMLAnchorElement.h"
|
2013-06-30 20:26:39 +04:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
#include "mozilla/dom/HTMLAnchorElementBinding.h"
|
2014-03-18 08:48:21 +04:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2000-05-31 04:48:02 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2011-08-11 17:29:50 +04:00
|
|
|
#include "nsContentUtils.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsHTMLDNSPrefetch.h"
|
2009-08-27 22:05:23 +04:00
|
|
|
#include "nsIDocument.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsIPresShell.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2013-08-24 06:42:40 +04:00
|
|
|
#include "nsIURI.h"
|
2008-11-08 02:00:26 +03:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
|
2012-06-05 03:49:57 +04:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2012-10-02 04:52:06 +04:00
|
|
|
#define ANCHOR_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// Anchor element specific bits
|
|
|
|
enum {
|
|
|
|
// Indicates that a DNS Prefetch has been requested from this Anchor elem
|
|
|
|
HTML_ANCHOR_DNS_PREFETCH_REQUESTED = ANCHOR_ELEMENT_FLAG_BIT(0),
|
|
|
|
|
|
|
|
// Indicates that a DNS Prefetch was added to the deferral queue
|
|
|
|
HTML_ANCHOR_DNS_PREFETCH_DEFERRED = ANCHOR_ELEMENT_FLAG_BIT(1)
|
|
|
|
};
|
2012-01-21 03:14:46 +04:00
|
|
|
|
2013-06-08 12:54:59 +04:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
2012-10-02 04:52:06 +04:00
|
|
|
|
|
|
|
#undef ANCHOR_ELEMENT_FLAG_BIT
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::~HTMLAnchorElement()
|
1998-08-29 07:13:29 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-05-29 12:23:08 +03:00
|
|
|
bool
|
|
|
|
HTMLAnchorElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
|
|
|
|
{
|
|
|
|
return HasAttr(kNameSpaceID_None, nsGkAtoms::href) ||
|
|
|
|
nsGenericHTMLElement::IsInteractiveHTMLContent(aIgnoreTabindex);
|
|
|
|
}
|
|
|
|
|
2013-12-12 23:30:27 +04:00
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLAnchorElement)
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(HTMLAnchorElement,
|
|
|
|
nsIDOMHTMLAnchorElement,
|
|
|
|
Link)
|
2013-12-12 23:30:27 +04:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLAnchorElement, Element)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(HTMLAnchorElement, Element)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLAnchorElement)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement)
|
2014-10-23 19:32:35 +04:00
|
|
|
tmp->Link::Traverse(cb);
|
2014-03-11 16:04:26 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList)
|
2013-12-12 23:30:27 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement)
|
2014-10-23 19:32:35 +04:00
|
|
|
tmp->Link::Unlink();
|
2014-03-11 16:04:26 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList)
|
2013-12-12 23:30:27 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement)
|
1998-08-29 07:13:29 +04:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
HTMLAnchorElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-04 21:02:13 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return HTMLAnchorElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-04 21:02:13 +04:00
|
|
|
}
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Charset, charset)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Coords, coords)
|
|
|
|
NS_IMPL_URI_ATTR(HTMLAnchorElement, Href, href)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Hreflang, hreflang)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Name, name)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Rel, rel)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Rev, rev)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Shape, shape)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Type, type)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLAnchorElement, Download, download)
|
1998-08-29 07:13:29 +04:00
|
|
|
|
2012-10-06 11:19:51 +04:00
|
|
|
int32_t
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::TabIndexDefault()
|
2012-10-06 11:19:51 +04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-05 03:49:57 +04:00
|
|
|
void
|
2015-02-13 04:27:39 +03:00
|
|
|
HTMLAnchorElement::GetItemValueText(DOMString& aValue)
|
2012-06-05 03:49:57 +04:00
|
|
|
{
|
|
|
|
GetHref(aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::SetItemValueText(const nsAString& aValue)
|
2012-06-05 03:49:57 +04:00
|
|
|
{
|
|
|
|
SetHref(aValue);
|
|
|
|
}
|
|
|
|
|
2012-10-06 11:19:52 +04:00
|
|
|
bool
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::Draggable() const
|
2008-08-27 16:07:27 +04:00
|
|
|
{
|
|
|
|
// links can be dragged as long as there is an href and the
|
|
|
|
// draggable attribute isn't false
|
2012-10-06 11:19:52 +04:00
|
|
|
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
|
|
|
// no href, so just use the same behavior as other elements
|
|
|
|
return nsGenericHTMLElement::Draggable();
|
2008-08-27 16:07:27 +04:00
|
|
|
}
|
|
|
|
|
2012-10-06 11:19:52 +04:00
|
|
|
return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
|
|
|
nsGkAtoms::_false, eIgnoreCase);
|
2008-08-27 16:07:27 +04:00
|
|
|
}
|
2000-05-17 07:11:47 +04:00
|
|
|
|
2012-01-21 03:14:46 +04:00
|
|
|
void
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::OnDNSPrefetchRequested()
|
2012-01-21 03:14:46 +04:00
|
|
|
{
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
SetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::OnDNSPrefetchDeferred()
|
2012-01-21 03:14:46 +04:00
|
|
|
{
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
SetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::HasDeferredDNSPrefetchRequest()
|
2012-01-21 03:14:46 +04:00
|
|
|
{
|
|
|
|
return HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
nsresult
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2000-05-17 07:11:47 +04:00
|
|
|
{
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2009-11-23 21:48:52 +03:00
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2008-12-05 23:53:24 +03:00
|
|
|
// Prefetch links
|
2014-10-02 23:07:24 +04:00
|
|
|
nsIDocument* doc = GetComposedDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->RegisterPendingLinkUpdate(this);
|
2011-11-14 07:24:41 +04:00
|
|
|
if (nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
|
|
|
|
nsHTMLDNSPrefetch::PrefetchLow(this);
|
|
|
|
}
|
2008-12-05 23:53:24 +03:00
|
|
|
}
|
2011-11-14 07:24:41 +04:00
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
return rv;
|
|
|
|
}
|
2000-05-17 07:11:47 +04:00
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
void
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2005-04-06 03:54:35 +04:00
|
|
|
{
|
2012-01-21 03:14:46 +04:00
|
|
|
// Cancel any DNS prefetches
|
|
|
|
// Note: Must come before ResetLinkState. If called after, it will recreate
|
|
|
|
// mCachedURI based on data that is invalid - due to a call to GetHostname.
|
|
|
|
|
|
|
|
// If prefetch was deferred, clear flag and move on
|
|
|
|
if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED))
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
// Else if prefetch was requested, clear flag and send cancellation
|
|
|
|
else if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_REQUESTED)) {
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
// Possible that hostname could have changed since binding, but since this
|
|
|
|
// covers common cases, most DNS prefetch requests will be canceled
|
|
|
|
nsHTMLDNSPrefetch::CancelPrefetchLow(this, NS_ERROR_ABORT);
|
|
|
|
}
|
|
|
|
|
2009-11-23 21:48:52 +03:00
|
|
|
// If this link is ever reinserted into a document, it might
|
|
|
|
// be under a different xml:base, so forget the cached state now.
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2014-10-02 23:07:24 +04:00
|
|
|
|
|
|
|
// Note, we need to use OwnerDoc() here, since GetComposedDoc() might
|
|
|
|
// return null.
|
|
|
|
nsIDocument* doc = OwnerDoc();
|
2011-11-14 07:24:41 +04:00
|
|
|
if (doc) {
|
|
|
|
doc->UnregisterPendingLinkUpdate(this);
|
|
|
|
}
|
2009-11-23 21:48:52 +03:00
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
2000-05-17 07:11:47 +04:00
|
|
|
}
|
|
|
|
|
2015-01-18 02:50:09 +03:00
|
|
|
static bool
|
|
|
|
IsNodeInEditableRegion(nsINode* aNode)
|
|
|
|
{
|
|
|
|
while (aNode) {
|
|
|
|
if (aNode->IsEditable()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
aNode = aNode->GetParent();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
|
|
|
bool *aIsFocusable, int32_t *aTabIndex)
|
1999-03-02 22:19:24 +03:00
|
|
|
{
|
2010-06-21 16:37:34 +04:00
|
|
|
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2008-04-15 22:40:38 +04: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 22:00:39 +04:00
|
|
|
// cannot focus links if there is no link handler
|
2014-08-23 00:11:27 +04:00
|
|
|
nsIDocument* doc = GetComposedDoc();
|
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 22:00:39 +04:00
|
|
|
if (doc) {
|
2010-06-25 17:59:57 +04: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 22:00:39 +04:00
|
|
|
if (presShell) {
|
|
|
|
nsPresContext* presContext = presShell->GetPresContext();
|
|
|
|
if (presContext && !presContext->GetLinkHandler()) {
|
2011-10-17 18:59:28 +04: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 22:00:39 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-18 02:50:09 +03:00
|
|
|
// Links that are in an editable region should never be focusable, even if
|
|
|
|
// they are in a contenteditable="false" region.
|
|
|
|
if (IsNodeInEditableRegion(this)) {
|
2008-04-15 22:40:38 +04:00
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = -1;
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsFocusable = false;
|
2008-04-15 22:40:38 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2004-01-10 02:54:21 +03:00
|
|
|
}
|
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
|
2004-10-07 05:15:40 +04:00
|
|
|
// check whether we're actually a link
|
2012-05-23 07:03:32 +04:00
|
|
|
if (!Link::HasURI()) {
|
2004-10-07 05:15:40 +04: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 22:40:38 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsFocusable = false;
|
2008-04-15 22:40:38 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-07-25 01:12:43 +04:00
|
|
|
}
|
|
|
|
}
|
2000-09-08 05:46:00 +04:00
|
|
|
|
2004-07-25 01:12:43 +04:00
|
|
|
if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) {
|
|
|
|
*aTabIndex = -1;
|
2000-09-08 05:46:00 +04:00
|
|
|
}
|
2004-07-25 01:12:43 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsFocusable = true;
|
2008-04-15 22:40:38 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
1999-03-02 22:19:24 +03:00
|
|
|
}
|
|
|
|
|
2007-04-23 11:31:21 +04:00
|
|
|
nsresult
|
2014-03-18 08:48:19 +04:00
|
|
|
HTMLAnchorElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2007-04-23 11:31:21 +04:00
|
|
|
{
|
|
|
|
return PreHandleEventForAnchors(aVisitor);
|
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
nsresult
|
2014-03-18 08:48:20 +04:00
|
|
|
HTMLAnchorElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
1998-08-29 07:13:29 +04:00
|
|
|
{
|
2006-03-07 20:08:51 +03:00
|
|
|
return PostHandleEventForAnchors(aVisitor);
|
1998-08-29 07:13:29 +04:00
|
|
|
}
|
1998-12-11 02:52:46 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::IsLink(nsIURI** aURI) const
|
2007-01-04 13:53:59 +03:00
|
|
|
{
|
|
|
|
return IsHTMLLink(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
|
2007-01-04 13:53:59 +03:00
|
|
|
{
|
2007-03-26 17:19:33 +04:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
|
|
|
|
if (aTarget.IsEmpty()) {
|
|
|
|
GetBaseTarget(aTarget);
|
|
|
|
}
|
2007-01-04 13:53:59 +03:00
|
|
|
}
|
|
|
|
|
2001-04-12 10:57:02 +04:00
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::GetTarget(nsAString& aValue)
|
2001-04-12 10:57:02 +04:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
|
2004-02-20 22:00:43 +03:00
|
|
|
GetBaseTarget(aValue);
|
2001-04-12 10:57:02 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::SetTarget(const nsAString& aValue)
|
2001-04-12 10:57:02 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, true);
|
2001-04-12 10:57:02 +04:00
|
|
|
}
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2014-03-11 16:04:26 +04:00
|
|
|
nsDOMTokenList*
|
|
|
|
HTMLAnchorElement::RelList()
|
|
|
|
{
|
|
|
|
if (!mRelList) {
|
|
|
|
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel);
|
|
|
|
}
|
|
|
|
return mRelList;
|
|
|
|
}
|
|
|
|
|
2009-03-10 05:32:09 +03:00
|
|
|
#define IMPL_URI_PART(_part) \
|
|
|
|
NS_IMETHODIMP \
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::Get##_part(nsAString& a##_part) \
|
2009-03-10 05:32:09 +03:00
|
|
|
{ \
|
2014-07-12 03:30:27 +04:00
|
|
|
ErrorResult rv; \
|
|
|
|
Link::Get##_part(a##_part, rv); \
|
|
|
|
MOZ_ASSERT(!rv.Failed()); \
|
2013-01-04 21:02:13 +04:00
|
|
|
return NS_OK; \
|
2009-03-10 05:32:09 +03:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::Set##_part(const nsAString& a##_part) \
|
2009-03-10 05:32:09 +03:00
|
|
|
{ \
|
2014-07-12 03:30:27 +04:00
|
|
|
ErrorResult rv; \
|
|
|
|
Link::Set##_part(a##_part, rv); \
|
|
|
|
MOZ_ASSERT(!rv.Failed()); \
|
2013-01-04 21:02:13 +04:00
|
|
|
return NS_OK; \
|
2009-03-10 05:32:09 +03:00
|
|
|
}
|
2001-11-17 05:23:22 +03:00
|
|
|
|
2009-03-10 05:32:09 +03: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 05:23:22 +03:00
|
|
|
|
2009-03-10 05:32:09 +03: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 16:27:00 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::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 16:27:00 +03:00
|
|
|
{
|
2015-05-22 21:16:20 +03:00
|
|
|
if(!nsContentUtils::GetNodeTextContent(this, true, aText, fallible)) {
|
2014-03-20 23:51:16 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2000-08-18 11:46:58 +04: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 16:27:00 +03:00
|
|
|
}
|
|
|
|
|
2010-07-31 03:48:57 +04:00
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::SetText(const nsAString& aText)
|
2010-07-31 03:48:57 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return nsContentUtils::SetNodeTextContent(this, aText, false);
|
2010-07-31 03:48:57 +04: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 20:46:42 +04:00
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::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 20:46:42 +04:00
|
|
|
{
|
|
|
|
return GetHref(aSource);
|
|
|
|
}
|
|
|
|
|
2006-01-24 08:48:32 +03:00
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::GetPing(nsAString& aValue)
|
2006-01-24 08:48:32 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return GetURIListAttr(nsGkAtoms::ping, aValue);
|
2006-01-24 08:48:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::SetPing(const nsAString& aValue)
|
2006-01-24 08:48:32 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
|
2006-01-24 08:48:32 +03:00
|
|
|
}
|
|
|
|
|
2009-07-13 15:48:06 +04:00
|
|
|
already_AddRefed<nsIURI>
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::GetHrefURI() const
|
2003-06-17 20:22:51 +04:00
|
|
|
{
|
2013-04-22 15:15:59 +04:00
|
|
|
nsCOMPtr<nsIURI> uri = Link::GetCachedURI();
|
2012-05-24 10:57:16 +04:00
|
|
|
if (uri) {
|
2013-04-22 15:15:59 +04:00
|
|
|
return uri.forget();
|
2012-05-24 10:57:16 +04:00
|
|
|
}
|
|
|
|
|
2009-07-13 15:48:06 +04:00
|
|
|
return GetHrefURIForAnchors();
|
2000-07-28 03:17:53 +04:00
|
|
|
}
|
2002-02-22 02:21:17 +03:00
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
nsresult
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
|
|
|
bool aNotify)
|
2002-02-22 02:21:17 +03:00
|
|
|
{
|
2010-02-24 19:37:38 +03:00
|
|
|
bool reset = false;
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aName == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
2010-06-16 20:59:26 +04: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 19:37:38 +03:00
|
|
|
reset = true;
|
2002-02-22 02:21:17 +03:00
|
|
|
}
|
2010-06-16 20:59:26 +04: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-22 02:21:17 +03:00
|
|
|
}
|
|
|
|
|
2004-01-15 20:07:27 +03:00
|
|
|
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
2002-05-22 04:14:51 +04:00
|
|
|
|
2010-02-24 19:37:38 +03: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) {
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(!!aNotify, true);
|
2010-02-24 19:37:38 +03:00
|
|
|
}
|
|
|
|
|
2002-05-22 04:14:51 +04:00
|
|
|
return rv;
|
2002-02-22 02:21:17 +03:00
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
nsresult
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
|
|
|
bool aNotify)
|
2002-02-22 02:21:17 +03:00
|
|
|
{
|
2010-03-03 23:55:35 +03: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) {
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(!!aNotify, false);
|
2010-03-03 23:55:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2002-02-22 02:21:17 +03:00
|
|
|
}
|
2009-03-10 16:51:34 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
2009-03-10 16:51:34 +03:00
|
|
|
{
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates
|
2013-01-04 21:02:13 +04:00
|
|
|
HTMLAnchorElement::IntrinsicState() const
|
2009-12-16 03:04:09 +03:00
|
|
|
{
|
|
|
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
|
|
|
}
|
2011-08-18 02:14:53 +04:00
|
|
|
|
2012-02-20 07:51:48 +04:00
|
|
|
size_t
|
2013-06-23 16:03:39 +04:00
|
|
|
HTMLAnchorElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
2012-02-20 07:51:48 +04:00
|
|
|
{
|
|
|
|
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
|
|
|
|
Link::SizeOfExcludingThis(aMallocSizeOf);
|
|
|
|
}
|
|
|
|
|
2013-01-04 21:02:13 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
} // namespace dom
|