2015-05-03 19:32:37 +00: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 11:12:37 +00: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 18:05:23 +00:00
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
#include "mozilla/dom/HTMLAnchorElement.h"
|
2013-06-30 16:26:39 +00:00
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
#include "mozilla/dom/HTMLAnchorElementBinding.h"
|
2014-03-18 04:48:21 +00:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-03 04:18:36 +00:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2000-05-31 00:48:02 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
#include "nsContentUtils.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "nsHTMLDNSPrefetch.h"
|
2017-06-01 16:33:30 +00:00
|
|
|
#include "nsAttrValueOrString.h"
|
2009-08-27 18:05:23 +00:00
|
|
|
#include "nsIDocument.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "nsIPresShell.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2013-08-24 02:42:40 +00:00
|
|
|
#include "nsIURI.h"
|
2018-03-27 23:44:49 +00:00
|
|
|
#include "nsWindowSizes.h"
|
2008-11-07 23:00:26 +00:00
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
|
2012-06-04 23:49:57 +00:00
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2008-02-21 20:39:20 +00:00
|
|
|
|
2012-10-02 00:52:06 +00: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-20 23:14:46 +00:00
|
|
|
|
2013-06-08 08:54:59 +00:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
2012-10-02 00:52:06 +00:00
|
|
|
|
|
|
|
#undef ANCHOR_ELEMENT_FLAG_BIT
|
2008-02-21 20:39:20 +00:00
|
|
|
|
2016-05-05 03:41:24 +00:00
|
|
|
// static
|
|
|
|
const DOMTokenListSupportedToken HTMLAnchorElement::sSupportedRelValues[] = {
|
|
|
|
"noreferrer",
|
2016-10-20 20:52:39 +00:00
|
|
|
"noopener",
|
2016-05-05 03:41:24 +00:00
|
|
|
nullptr
|
|
|
|
};
|
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::~HTMLAnchorElement()
|
1998-08-29 03:13:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-05-29 09:23:08 +00:00
|
|
|
bool
|
|
|
|
HTMLAnchorElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
|
|
|
|
{
|
|
|
|
return HasAttr(kNameSpaceID_None, nsGkAtoms::href) ||
|
|
|
|
nsGenericHTMLElement::IsInteractiveHTMLContent(aIgnoreTabindex);
|
|
|
|
}
|
|
|
|
|
2017-09-29 19:04:09 +00:00
|
|
|
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement,
|
|
|
|
Link)
|
2017-09-22 21:56:51 +00:00
|
|
|
|
2017-09-29 19:04:09 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLAnchorElement,
|
|
|
|
nsGenericHTMLElement,
|
|
|
|
mRelList)
|
2008-02-21 20:39:20 +00:00
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement)
|
1998-08-29 03:13:29 +00:00
|
|
|
|
2013-01-04 17:02:13 +00: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 14:13:33 +00:00
|
|
|
HTMLAnchorElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-04 17:02:13 +00: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 14:13:33 +00:00
|
|
|
return HTMLAnchorElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-04 17:02:13 +00:00
|
|
|
}
|
2008-02-21 20:39:20 +00:00
|
|
|
|
2012-10-06 07:19:51 +00:00
|
|
|
int32_t
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::TabIndexDefault()
|
2012-10-06 07:19:51 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-06 07:19:52 +00:00
|
|
|
bool
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::Draggable() const
|
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
|
2012-10-06 07:19:52 +00:00
|
|
|
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
|
|
|
// no href, so just use the same behavior as other elements
|
|
|
|
return nsGenericHTMLElement::Draggable();
|
2008-08-27 12:07:27 +00:00
|
|
|
}
|
|
|
|
|
2012-10-06 07:19:52 +00:00
|
|
|
return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
|
|
|
nsGkAtoms::_false, eIgnoreCase);
|
2008-08-27 12:07:27 +00:00
|
|
|
}
|
2000-05-17 03:11:47 +00:00
|
|
|
|
2012-01-20 23:14:46 +00:00
|
|
|
void
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::OnDNSPrefetchRequested()
|
2012-01-20 23:14:46 +00:00
|
|
|
{
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
SetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::OnDNSPrefetchDeferred()
|
2012-01-20 23:14:46 +00:00
|
|
|
{
|
|
|
|
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
SetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::HasDeferredDNSPrefetchRequest()
|
2012-01-20 23:14:46 +00:00
|
|
|
{
|
|
|
|
return HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
nsresult
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2000-05-17 03:11:47 +00:00
|
|
|
{
|
2012-12-07 14:35:14 +00:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
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
|
2014-10-02 19:07:24 +00:00
|
|
|
nsIDocument* doc = GetComposedDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->RegisterPendingLinkUpdate(this);
|
2015-12-01 17:22:20 +00:00
|
|
|
TryDNSPrefetch();
|
2008-12-05 20:53:24 +00:00
|
|
|
}
|
2011-11-14 03:24:41 +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
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2005-04-05 23:54:35 +00:00
|
|
|
{
|
2012-01-20 23:14:46 +00: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.
|
2015-12-01 17:22:20 +00:00
|
|
|
CancelDNSPrefetch(HTML_ANCHOR_DNS_PREFETCH_DEFERRED,
|
|
|
|
HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
2012-01-20 23:14:46 +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.
|
2012-12-07 14:35:14 +00:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2014-10-02 19:07:24 +00:00
|
|
|
|
2005-04-05 23:54:35 +00:00
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
2000-05-17 03:11:47 +00:00
|
|
|
}
|
|
|
|
|
2015-01-17 23:50:09 +00:00
|
|
|
static bool
|
|
|
|
IsNodeInEditableRegion(nsINode* aNode)
|
|
|
|
{
|
|
|
|
while (aNode) {
|
|
|
|
if (aNode->IsEditable()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
aNode = aNode->GetParent();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
|
|
|
bool *aIsFocusable, int32_t *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
|
2014-08-22 20:11:27 +00: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 18:00:39 +00:00
|
|
|
if (doc) {
|
2018-02-20 22:00:10 +00:00
|
|
|
nsPresContext* presContext = doc->GetPresContext();
|
|
|
|
if (presContext && !presContext->GetLinkHandler()) {
|
|
|
|
*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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-17 23:50:09 +00: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 18:40:38 +00:00
|
|
|
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
|
2012-05-23 03:03:32 +00:00
|
|
|
if (!Link::HasURI()) {
|
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
|
|
|
}
|
|
|
|
|
2018-04-05 17:42:41 +00:00
|
|
|
void
|
2016-10-21 02:11:07 +00:00
|
|
|
HTMLAnchorElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
2007-04-23 07:31:21 +00:00
|
|
|
{
|
2018-04-05 17:42:41 +00:00
|
|
|
GetEventTargetParentForAnchors(aVisitor);
|
2007-04-23 07:31:21 +00:00
|
|
|
}
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:20 +00:00
|
|
|
HTMLAnchorElement::PostHandleEvent(EventChainPostVisitor& 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
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::IsLink(nsIURI** aURI) const
|
2007-01-04 10:53:59 +00:00
|
|
|
{
|
|
|
|
return IsHTMLLink(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::GetLinkTarget(nsAString& aTarget)
|
2007-01-04 10:53:59 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2017-09-22 21:56:51 +00:00
|
|
|
void
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::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
|
|
|
}
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2014-03-11 12:04:26 +00:00
|
|
|
nsDOMTokenList*
|
|
|
|
HTMLAnchorElement::RelList()
|
|
|
|
{
|
|
|
|
if (!mRelList) {
|
2016-05-05 03:41:24 +00:00
|
|
|
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues);
|
2014-03-11 12:04:26 +00:00
|
|
|
}
|
|
|
|
return mRelList;
|
|
|
|
}
|
|
|
|
|
2017-09-22 21:56:51 +00:00
|
|
|
void
|
|
|
|
HTMLAnchorElement::GetText(nsAString& aText, mozilla::ErrorResult& aRv)
|
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
|
|
|
{
|
2017-09-22 21:56:51 +00:00
|
|
|
if (NS_WARN_IF(!nsContentUtils::GetNodeTextContent(this, true, aText, fallible))) {
|
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
2014-03-20 19:51:16 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2017-09-22 21:56:51 +00:00
|
|
|
void
|
|
|
|
HTMLAnchorElement::SetText(const nsAString& aText, ErrorResult& aRv)
|
2010-07-30 23:48:57 +00:00
|
|
|
{
|
2017-09-22 21:56:51 +00:00
|
|
|
aRv = nsContentUtils::SetNodeTextContent(this, aText, false);
|
2010-07-30 23:48:57 +00:00
|
|
|
}
|
|
|
|
|
2017-09-22 21:56:51 +00:00
|
|
|
void
|
2013-01-04 17:02:13 +00: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 16:46:42 +00:00
|
|
|
{
|
|
|
|
return GetHref(aSource);
|
|
|
|
}
|
|
|
|
|
2009-07-13 11:48:06 +00:00
|
|
|
already_AddRefed<nsIURI>
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::GetHrefURI() const
|
2003-06-17 16:22:51 +00:00
|
|
|
{
|
2013-04-22 11:15:59 +00:00
|
|
|
nsCOMPtr<nsIURI> uri = Link::GetCachedURI();
|
2012-05-24 06:57:16 +00:00
|
|
|
if (uri) {
|
2013-04-22 11:15:59 +00:00
|
|
|
return uri.forget();
|
2012-05-24 06:57:16 +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
|
2017-10-02 22:05:19 +00:00
|
|
|
HTMLAnchorElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-06-01 16:33:30 +00:00
|
|
|
const nsAttrValueOrString* aValue,
|
|
|
|
bool aNotify)
|
2002-02-21 23:21:17 +00:00
|
|
|
{
|
2017-06-01 16:33:30 +00:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (aName == nsGkAtoms::href) {
|
2015-12-01 17:22:20 +00:00
|
|
|
CancelDNSPrefetch(HTML_ANCHOR_DNS_PREFETCH_DEFERRED,
|
|
|
|
HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
|
|
|
|
}
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
|
|
|
|
2017-06-01 16:33:30 +00:00
|
|
|
return nsGenericHTMLElement::BeforeSetAttr(aNamespaceID, aName, aValue,
|
|
|
|
aNotify);
|
2002-02-21 23:21:17 +00:00
|
|
|
}
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
2017-10-02 22:05:19 +00:00
|
|
|
HTMLAnchorElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-06-01 16:33:30 +00:00
|
|
|
const nsAttrValue* aValue,
|
2017-10-09 21:33:38 +00:00
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
|
|
|
bool aNotify)
|
2002-02-21 23:21:17 +00:00
|
|
|
{
|
2017-06-01 16:33:30 +00:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (aName == nsGkAtoms::href) {
|
|
|
|
Link::ResetLinkState(aNotify, !!aValue);
|
|
|
|
if (aValue && IsInComposedDoc()) {
|
|
|
|
TryDNSPrefetch();
|
|
|
|
}
|
|
|
|
}
|
2010-03-03 20:55:35 +00:00
|
|
|
}
|
|
|
|
|
2017-06-01 16:33:30 +00:00
|
|
|
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName,
|
2017-10-09 21:33:38 +00:00
|
|
|
aValue, aOldValue, aSubjectPrincipal, aNotify);
|
2009-03-10 13:51:34 +00:00
|
|
|
}
|
|
|
|
|
2014-04-03 04:18:36 +00:00
|
|
|
EventStates
|
2013-01-04 17:02:13 +00:00
|
|
|
HTMLAnchorElement::IntrinsicState() const
|
2009-12-16 00:04:09 +00:00
|
|
|
{
|
|
|
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
|
|
|
}
|
2011-08-17 22:14:53 +00:00
|
|
|
|
Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.
Here is an example of the output.
> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │ ├──12,772,544 B (12.26%) -- layout
> │ │ ├───4,483,744 B (04.30%) -- frames
> │ │ │ ├──1,653,552 B (01.59%) ── nsInlineFrame
> │ │ │ ├──1,415,760 B (01.36%) ── nsTextFrame
> │ │ │ ├────431,376 B (00.41%) ── nsBlockFrame
> │ │ │ ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │ │ │ ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │ │ │ ├────156,408 B (00.15%) ── nsBulletFrame
> │ │ │ ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │ │ │ ├─────27,656 B (00.03%) ── sundries
> │ │ │ ├─────23,520 B (00.02%) ── nsTableCellFrame
> │ │ │ ├─────16,704 B (00.02%) ── nsImageFrame
> │ │ │ ├─────15,488 B (00.01%) ── nsTableRowFrame
> │ │ │ ├─────13,776 B (00.01%) ── nsTableColFrame
> │ │ │ └─────13,376 B (00.01%) ── nsTableFrame
> │ │ ├───3,412,192 B (03.28%) -- servo-style-structs
> │ │ │ ├──1,288,224 B (01.24%) ── Display
> │ │ │ ├────742,400 B (00.71%) ── Position
> │ │ │ ├────308,736 B (00.30%) ── Font
> │ │ │ ├────226,512 B (00.22%) ── Background
> │ │ │ ├────218,304 B (00.21%) ── TextReset
> │ │ │ ├────214,896 B (00.21%) ── Text
> │ │ │ ├────130,560 B (00.13%) ── Border
> │ │ │ ├─────81,408 B (00.08%) ── UIReset
> │ │ │ ├─────61,440 B (00.06%) ── Padding
> │ │ │ ├─────38,176 B (00.04%) ── UserInterface
> │ │ │ ├─────29,232 B (00.03%) ── Margin
> │ │ │ ├─────21,824 B (00.02%) ── sundries
> │ │ │ ├─────20,080 B (00.02%) ── Color
> │ │ │ ├─────20,080 B (00.02%) ── Column
> │ │ │ └─────10,320 B (00.01%) ── Effects
> │ │ ├───2,227,680 B (02.14%) -- computed-values
> │ │ │ ├──1,182,928 B (01.14%) ── non-dom
> │ │ │ └──1,044,752 B (01.00%) ── dom
> │ │ ├───1,500,016 B (01.44%) ── text-runs
> │ │ ├─────492,640 B (00.47%) ── line-boxes
> │ │ ├─────326,688 B (00.31%) ── frame-properties
> │ │ ├─────301,760 B (00.29%) ── pres-shell
> │ │ ├──────27,648 B (00.03%) ── pres-contexts
> │ │ └─────────176 B (00.00%) ── style-sets
The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.
Other notable things done by the patch are as follows.
- It significantly changes the signatures of the methods measuring nsINode and
its subclasses, in order to handle the tallying of style structs separately
from element-nodes. Likewise for nsIFrame.
- It renames the 'layout/style-structs' sub-tree as
'layout/gecko-style-structs', to clearly distinguish it from the new
'layout/servo-style-structs' sub-tree.
- It adds some FFI functions to access various Rust-side data structures from
C++ code.
- There is a nasty hack used twice to measure Arcs, by stepping backwards from
an interior pointer to a base pointer. It works, but I want to replace it
with something better eventually. The "XXX WARNING" comments have details.
- It makes DMD print a line to the console if it sees a pointer it doesn't
recognise. This is useful for detecting when we are measuring an interior
pointer instead of a base pointer, which is bad but easy to do when Arcs are
involved.
- It removes the Rust code for measuring CVs, because it's now all done on the
C++ side.
MozReview-Commit-ID: BKebACLKtCi
--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 06:37:33 +00:00
|
|
|
void
|
2017-08-25 04:47:54 +00:00
|
|
|
HTMLAnchorElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
|
Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.
Here is an example of the output.
> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │ ├──12,772,544 B (12.26%) -- layout
> │ │ ├───4,483,744 B (04.30%) -- frames
> │ │ │ ├──1,653,552 B (01.59%) ── nsInlineFrame
> │ │ │ ├──1,415,760 B (01.36%) ── nsTextFrame
> │ │ │ ├────431,376 B (00.41%) ── nsBlockFrame
> │ │ │ ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │ │ │ ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │ │ │ ├────156,408 B (00.15%) ── nsBulletFrame
> │ │ │ ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │ │ │ ├─────27,656 B (00.03%) ── sundries
> │ │ │ ├─────23,520 B (00.02%) ── nsTableCellFrame
> │ │ │ ├─────16,704 B (00.02%) ── nsImageFrame
> │ │ │ ├─────15,488 B (00.01%) ── nsTableRowFrame
> │ │ │ ├─────13,776 B (00.01%) ── nsTableColFrame
> │ │ │ └─────13,376 B (00.01%) ── nsTableFrame
> │ │ ├───3,412,192 B (03.28%) -- servo-style-structs
> │ │ │ ├──1,288,224 B (01.24%) ── Display
> │ │ │ ├────742,400 B (00.71%) ── Position
> │ │ │ ├────308,736 B (00.30%) ── Font
> │ │ │ ├────226,512 B (00.22%) ── Background
> │ │ │ ├────218,304 B (00.21%) ── TextReset
> │ │ │ ├────214,896 B (00.21%) ── Text
> │ │ │ ├────130,560 B (00.13%) ── Border
> │ │ │ ├─────81,408 B (00.08%) ── UIReset
> │ │ │ ├─────61,440 B (00.06%) ── Padding
> │ │ │ ├─────38,176 B (00.04%) ── UserInterface
> │ │ │ ├─────29,232 B (00.03%) ── Margin
> │ │ │ ├─────21,824 B (00.02%) ── sundries
> │ │ │ ├─────20,080 B (00.02%) ── Color
> │ │ │ ├─────20,080 B (00.02%) ── Column
> │ │ │ └─────10,320 B (00.01%) ── Effects
> │ │ ├───2,227,680 B (02.14%) -- computed-values
> │ │ │ ├──1,182,928 B (01.14%) ── non-dom
> │ │ │ └──1,044,752 B (01.00%) ── dom
> │ │ ├───1,500,016 B (01.44%) ── text-runs
> │ │ ├─────492,640 B (00.47%) ── line-boxes
> │ │ ├─────326,688 B (00.31%) ── frame-properties
> │ │ ├─────301,760 B (00.29%) ── pres-shell
> │ │ ├──────27,648 B (00.03%) ── pres-contexts
> │ │ └─────────176 B (00.00%) ── style-sets
The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.
Other notable things done by the patch are as follows.
- It significantly changes the signatures of the methods measuring nsINode and
its subclasses, in order to handle the tallying of style structs separately
from element-nodes. Likewise for nsIFrame.
- It renames the 'layout/style-structs' sub-tree as
'layout/gecko-style-structs', to clearly distinguish it from the new
'layout/servo-style-structs' sub-tree.
- It adds some FFI functions to access various Rust-side data structures from
C++ code.
- There is a nasty hack used twice to measure Arcs, by stepping backwards from
an interior pointer to a base pointer. It works, but I want to replace it
with something better eventually. The "XXX WARNING" comments have details.
- It makes DMD print a line to the console if it sees a pointer it doesn't
recognise. This is useful for detecting when we are measuring an interior
pointer instead of a base pointer, which is bad but easy to do when Arcs are
involved.
- It removes the Rust code for measuring CVs, because it's now all done on the
C++ side.
MozReview-Commit-ID: BKebACLKtCi
--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 06:37:33 +00:00
|
|
|
size_t* aNodeSize) const
|
2012-02-20 03:51:48 +00:00
|
|
|
{
|
2017-08-25 04:47:54 +00:00
|
|
|
nsGenericHTMLElement::AddSizeOfExcludingThis(aSizes, aNodeSize);
|
|
|
|
*aNodeSize += Link::SizeOfExcludingThis(aSizes.mState);
|
2012-02-20 03:51:48 +00:00
|
|
|
}
|
|
|
|
|
2013-01-04 17:02:13 +00:00
|
|
|
} // namespace dom
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|